@brightnkhoma/domain 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -53500,7 +53500,7 @@ var UserDomain = class {
53500
53500
  constructor(user, db) {
53501
53501
  this.user = user;
53502
53502
  this.userDb = createTable("users", db);
53503
- this.userDomain = createDomain(this.userDb, "user", this.user.id);
53503
+ this.userDomain = createDomain(this.userDb, "user", this.user?.id ?? "");
53504
53504
  this.user = user;
53505
53505
  }
53506
53506
  async verifyUser() {
@@ -53543,9 +53543,9 @@ var MainDomain = class _MainDomain {
53543
53543
  domain(collectionName) {
53544
53544
  return getDomainClass(collectionName, this.db);
53545
53545
  }
53546
- static init(serviceAccount) {
53546
+ static init(serviceAccountPathOrObject) {
53547
53547
  const db = (0, import_app.initializeApp)({
53548
- credential: (0, import_app.cert)(serviceAccount)
53548
+ credential: (0, import_app.cert)(serviceAccountPathOrObject)
53549
53549
  });
53550
53550
  return new _MainDomain(db);
53551
53551
  }
package/dist/index.mjs CHANGED
@@ -53490,7 +53490,7 @@ var UserDomain = class {
53490
53490
  constructor(user, db) {
53491
53491
  this.user = user;
53492
53492
  this.userDb = createTable("users", db);
53493
- this.userDomain = createDomain(this.userDb, "user", this.user.id);
53493
+ this.userDomain = createDomain(this.userDb, "user", this.user?.id ?? "");
53494
53494
  this.user = user;
53495
53495
  }
53496
53496
  async verifyUser() {
@@ -53533,9 +53533,9 @@ var MainDomain = class _MainDomain {
53533
53533
  domain(collectionName) {
53534
53534
  return getDomainClass(collectionName, this.db);
53535
53535
  }
53536
- static init(serviceAccount) {
53536
+ static init(serviceAccountPathOrObject) {
53537
53537
  const db = initializeApp({
53538
- credential: cert(serviceAccount)
53538
+ credential: cert(serviceAccountPathOrObject)
53539
53539
  });
53540
53540
  return new _MainDomain(db);
53541
53541
  }
@@ -1,4 +1,4 @@
1
- import { App } from "firebase-admin/app";
1
+ import { App, ServiceAccount } from "firebase-admin/app";
2
2
  import { Entity } from "../types/entity";
3
3
  import { Domain } from "../@exprimental/domain";
4
4
  import { User } from "../types/user";
@@ -6,6 +6,6 @@ export declare class MainDomain {
6
6
  db: App;
7
7
  constructor(db: App);
8
8
  domain<T extends Entity>(collectionName: string): new (user: User) => Domain<T>;
9
- static init(serviceAccount: string): MainDomain;
9
+ static init(serviceAccountPathOrObject: string | ServiceAccount): MainDomain;
10
10
  }
11
11
  //# sourceMappingURL=mainDomain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mainDomain.d.ts","sourceRoot":"","sources":["../../../src/lib/domain/mainDomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAuB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,qBAAa,UAAU;IACnB,EAAE,EAAG,GAAG,CAAC;IACT,YAAY,EAAE,EAAG,GAAG,EAEnB;IAED,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,cAAc,EAAG,MAAM,GAAE,KAAK,IAAI,EAAG,IAAI,KAAI,MAAM,CAAC,CAAC,CAAC,CAE9E;IAED,MAAM,CAAC,IAAI,CAAC,cAAc,EAAG,MAAM,cAMlC;CAEJ"}
1
+ {"version":3,"file":"mainDomain.d.ts","sourceRoot":"","sources":["../../../src/lib/domain/mainDomain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAuB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,qBAAa,UAAU;IACnB,EAAE,EAAG,GAAG,CAAC;IACT,YAAY,EAAE,EAAG,GAAG,EAEnB;IAED,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,cAAc,EAAG,MAAM,GAAE,KAAK,IAAI,EAAG,IAAI,KAAI,MAAM,CAAC,CAAC,CAAC,CAE9E;IAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,MAAM,GAAG,cAAc,cAM9D;CAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightnkhoma/domain",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A module that automates CRUD functionality and routing and helps you follow DDD(Domain Driven Design) with ease using firebase, express and typescript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",