4.0.7 • Published 1 month ago

@travetto/model-firestore v4.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Firestore Model Support

Firestore backing for the travetto model module.

Install: @travetto/model-firestore

npm install @travetto/model-firestore

# or

yarn add @travetto/model-firestore

This module provides an Firestore-based implementation of the Data Modeling Support. This source allows the Data Modeling Support module to read, write and query against Firestore.

Supported features:

  • CRUD
  • Indexed Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source or config, you can override and register it with the Dependency Injection module.

Code: Wiring up a custom Model Source

import { InjectableFactory } from '@travetto/di';
import { FirestoreModelConfig, FirestoreModelService } from '@travetto/model-firestore';

export class Init {
  @InjectableFactory({
    primary: true
  })
  static getModelSource(conf: FirestoreModelConfig) {
    return new FirestoreModelService(conf);
  }
}

where the FirestoreModelConfig is defined by:

Code: Structure of FirestoreModelConfig

import { RuntimeResources } from '@travetto/base';
import { Config } from '@travetto/config';

@Config('model.firestore')
export class FirestoreModelConfig {

  databaseURL?: string;
  credentialsFile?: string;
  emulator?: string;
  projectId: string;
  namespace?: string;
  autoCreate?: boolean;
  credentials?: {
    client_email: string;
    project_id: string;
    private_key: string;
  };

  async postConstruct(): Promise<void> {
    if (this.emulator) {
      process.env.FIRESTORE_EMULATOR_HOST = this.emulator;
    }
    if (this.credentialsFile && !this.credentials) {
      this.credentials = JSON.parse(await RuntimeResources.read(this.credentialsFile));
    }
  }
}

Additionally, you can see that the class is registered with the @Config annotation, and so these values can be overridden using the standard Configuration resolution paths.

4.0.7

1 month ago

4.0.6

2 months ago

4.0.5

2 months ago

4.0.4

2 months ago

4.0.3

2 months ago

4.0.1

2 months ago

4.0.0

2 months ago

4.0.2

2 months ago

4.0.0-rc.8

2 months ago

4.0.0-rc.7

2 months ago

3.4.6

2 months ago

4.0.0-rc.6

2 months ago

4.0.0-rc.5

2 months ago

4.0.0-rc.4

3 months ago

4.0.0-rc.3

3 months ago

4.0.0-rc.1

3 months ago

4.0.0-rc.2

3 months ago

4.0.0-rc.0

4 months ago

3.4.4

5 months ago

3.4.5

5 months ago

3.3.8

6 months ago

3.3.7

7 months ago

3.3.6

7 months ago

3.2.2

10 months ago

3.2.5

9 months ago

3.2.4

9 months ago

3.2.3

10 months ago

3.4.0

6 months ago

3.4.3

5 months ago

3.4.2

5 months ago

3.4.1

5 months ago

3.4.0-rc.7

6 months ago

3.4.0-rc.8

6 months ago

3.4.0-rc.5

6 months ago

3.4.0-rc.6

6 months ago

3.4.0-rc.3

6 months ago

3.4.0-rc.4

6 months ago

3.4.0-rc.1

6 months ago

3.4.0-rc.2

6 months ago

3.4.0-rc.0

6 months ago

3.3.1

8 months ago

3.3.0

9 months ago

3.3.5

7 months ago

3.3.4

7 months ago

3.3.3

8 months ago

3.3.2

8 months ago

3.2.1

10 months ago

3.2.0

10 months ago

3.1.13

10 months ago

3.2.0-rc.0

10 months ago

3.1.7

12 months ago

3.1.6

12 months ago

3.1.12

11 months ago

3.1.11

11 months ago

3.1.10

11 months ago

3.1.9

11 months ago

3.1.8

12 months ago

3.1.5

12 months ago

3.1.4

1 year ago

3.0.3

1 year ago

3.1.0-rc.10

1 year ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.1.0-rc.2

1 year ago

3.1.0-rc.3

1 year ago

3.1.0-rc.0

1 year ago

3.1.0-rc.1

1 year ago

3.1.0-rc.6

1 year ago

3.1.0-rc.7

1 year ago

3.1.0-rc.4

1 year ago

3.1.0-rc.5

1 year ago

3.1.0-rc.8

1 year ago

3.1.0-rc.9

1 year ago

3.0.0-rc.26

1 year ago

3.0.0-rc.25

1 year ago

3.0.1-rc.1

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

3.0.2-rc.1

1 year ago

3.0.2-rc.0

1 year ago

3.0.0-rc.24

1 year ago

3.0.0-rc.23

1 year ago

3.0.0-rc.20

1 year ago

3.0.0-rc.22

1 year ago

3.0.0-rc.21

1 year ago

3.0.0-rc.15

1 year ago

3.0.0-rc.14

1 year ago

3.0.0-rc.17

1 year ago

3.0.0-rc.16

1 year ago

3.0.0-rc.19

1 year ago

3.0.0-rc.18

1 year ago

3.0.0-rc.13

1 year ago

3.0.0-rc.12

1 year ago

3.0.0-rc.11

1 year ago

3.0.0-rc.6

1 year ago

3.0.0-rc.10

1 year ago

3.0.0-rc.9

1 year ago

3.0.0-rc.8

1 year ago

3.0.0-rc.7

1 year ago

3.0.0-rc.2

2 years ago

3.0.0-rc.1

2 years ago

3.0.0-rc.0

2 years ago

3.0.0-rc.4

2 years ago

3.0.0-rc.3

2 years ago

2.2.4

2 years ago

2.2.1

2 years ago

2.1.2

2 years ago

2.2.0

2 years ago

2.2.3

2 years ago

2.1.4

2 years ago

2.2.2

2 years ago

2.1.3

2 years ago

2.1.5

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.0-rc.11

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-rc.10

3 years ago

2.0.0-rc.2

3 years ago

2.0.0-rc.3

3 years ago

2.0.0-rc.4

3 years ago

2.0.0-rc.5

3 years ago

2.0.0-rc.0

3 years ago

2.0.0-rc.1

3 years ago

2.0.0-alpha.7

3 years ago

2.0.0-alpha.8

3 years ago

2.0.0-alpha.9

3 years ago

2.0.0-alpha.11

3 years ago

2.0.0-alpha.10

3 years ago

2.0.0-alpha.6

3 years ago

2.0.0-rc.6

3 years ago

2.0.0-rc.7

3 years ago

2.0.0-rc.8

3 years ago

2.0.0-rc.9

3 years ago

2.0.0-alpha.12

3 years ago

2.0.0-alpha.4

3 years ago

2.0.0-alpha.5

3 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.2

3 years ago

2.0.0-alpha.1

3 years ago