@mxpicture/gcp-functions-frontend 0.1.9 → 0.1.10

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.
Files changed (60) hide show
  1. package/dist/cjs/base/FrontendApi.d.ts +7 -5
  2. package/dist/cjs/base/FrontendApi.d.ts.map +1 -1
  3. package/dist/cjs/base/FrontendApi.js +17 -14
  4. package/dist/cjs/config/firebase.config.d.ts +5 -5
  5. package/dist/cjs/config/firebase.config.d.ts.map +1 -1
  6. package/dist/cjs/config/firebase.config.js +8 -7
  7. package/dist/cjs/index.d.ts.map +1 -1
  8. package/dist/cjs/index.js +2 -0
  9. package/dist/cjs/lib.d.ts +0 -1
  10. package/dist/cjs/lib.d.ts.map +1 -1
  11. package/dist/cjs/loader/firebase.loader.d.ts +4 -0
  12. package/dist/cjs/loader/firebase.loader.d.ts.map +1 -0
  13. package/dist/cjs/loader/firebase.loader.js +57 -0
  14. package/dist/cjs/package.d.ts.map +1 -1
  15. package/dist/cjs/package.js +1 -0
  16. package/dist/cjs/services/firebase/auth.service.d.ts +3 -3
  17. package/dist/cjs/services/firebase/auth.service.d.ts.map +1 -1
  18. package/dist/cjs/services/firebase/auth.service.js +15 -8
  19. package/dist/cjs/services/firebase/index.d.ts +1 -1
  20. package/dist/cjs/services/firebase/index.d.ts.map +1 -1
  21. package/dist/cjs/services/firebase/index.js +1 -4
  22. package/dist/esm/base/FrontendApi.d.ts +7 -5
  23. package/dist/esm/base/FrontendApi.d.ts.map +1 -1
  24. package/dist/esm/base/FrontendApi.js +17 -14
  25. package/dist/esm/config/firebase.config.d.ts +5 -5
  26. package/dist/esm/config/firebase.config.d.ts.map +1 -1
  27. package/dist/esm/config/firebase.config.js +8 -7
  28. package/dist/esm/index.d.ts.map +1 -1
  29. package/dist/esm/index.js +2 -0
  30. package/dist/esm/lib.d.ts +0 -1
  31. package/dist/esm/lib.d.ts.map +1 -1
  32. package/dist/esm/loader/firebase.loader.d.ts +4 -0
  33. package/dist/esm/loader/firebase.loader.d.ts.map +1 -0
  34. package/dist/esm/loader/firebase.loader.js +24 -0
  35. package/dist/esm/package.d.ts.map +1 -1
  36. package/dist/esm/package.js +1 -0
  37. package/dist/esm/services/firebase/auth.service.d.ts +3 -3
  38. package/dist/esm/services/firebase/auth.service.d.ts.map +1 -1
  39. package/dist/esm/services/firebase/auth.service.js +15 -8
  40. package/dist/esm/services/firebase/index.d.ts +1 -1
  41. package/dist/esm/services/firebase/index.d.ts.map +1 -1
  42. package/dist/esm/services/firebase/index.js +1 -4
  43. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  44. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  45. package/dist/tsconfig.types.tsbuildinfo +1 -1
  46. package/dist/types/base/FrontendApi.d.ts +7 -5
  47. package/dist/types/base/FrontendApi.d.ts.map +1 -1
  48. package/dist/types/config/firebase.config.d.ts +5 -5
  49. package/dist/types/config/firebase.config.d.ts.map +1 -1
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/lib.d.ts +0 -1
  52. package/dist/types/lib.d.ts.map +1 -1
  53. package/dist/types/loader/firebase.loader.d.ts +4 -0
  54. package/dist/types/loader/firebase.loader.d.ts.map +1 -0
  55. package/dist/types/package.d.ts.map +1 -1
  56. package/dist/types/services/firebase/auth.service.d.ts +3 -3
  57. package/dist/types/services/firebase/auth.service.d.ts.map +1 -1
  58. package/dist/types/services/firebase/index.d.ts +1 -1
  59. package/dist/types/services/firebase/index.d.ts.map +1 -1
  60. package/package.json +1 -1
@@ -1,11 +1,13 @@
1
- import { MetaItem } from "@mxpicture/zod-meta";
2
- import { ApiKey, DocumentData, WithKey, IApi, FunctionName, FunctionPayload, FunctionResult } from "@mxpicture/gcp-functions-common";
3
- import { HttpsCallable } from "firebase/functions";
4
- export declare const functionCallable: <DTO extends DocumentData, KEYS extends ApiKey>(name: FunctionName) => HttpsCallable<FunctionPayload<DTO, KEYS>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
1
+ import type { MetaItem } from "@mxpicture/zod-meta";
2
+ import type { ApiKey, DocumentData, WithKey, FunctionName, FunctionPayload, FunctionResult } from "@mxpicture/gcp-functions-common";
3
+ import { IApi } from "@mxpicture/gcp-functions-common";
4
+ import type { HttpsCallable } from "firebase/functions";
5
+ export declare const functionCallable: <DTO extends DocumentData, KEYS extends ApiKey>(name: FunctionName) => Promise<HttpsCallable<FunctionPayload<DTO, KEYS>, Promise<FunctionResult<WithKey<DTO>>>, unknown>>;
5
6
  export declare class FrontendApi<DTO extends DocumentData> extends IApi<DTO> {
6
7
  readonly name: FunctionName;
7
- protected service: HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
8
+ protected _service?: HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
8
9
  constructor(name: FunctionName);
10
+ protected service(): Promise<HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>>;
9
11
  delete(keys: ApiKey): Promise<void>;
10
12
  get(keys: ApiKey): Promise<WithKey<DTO>>;
11
13
  query(): Promise<WithKey<DTO>[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"FrontendApi.d.ts","sourceRoot":"","sources":["../../../src/base/FrontendApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,MAAM,EACN,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,eAAe,EACf,cAAc,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAiB,MAAM,oBAAoB,CAAC;AAGlE,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,YAAY,EAAE,IAAI,SAAS,MAAM,EAC5E,MAAM,YAAY,8FAMiB,CAAC;AAEtC,qBAAa,WAAW,CAAC,GAAG,SAAS,YAAY,CAAE,SAAQ,IAAI,CAAC,G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C;AAIxD,eAAO,MAAM,gBAAgB,GAC3B,GAAG,SAAS,YAAY,EACxB,IAAI,SAAS,MAAM,EAEnB,MAAM,YAAY,uGAOnB,CAAC;AAEF,qBAAa,WAAW,CAAC,GAAG,SAAS,YAAY,CAAE,SAAQ,IAAI,CAAC,GAAG,CAAC;aAO/B,IAAI,EAAE,YAAY;IANrD,SAAS,CAAC,QAAQ,CAAC,EAAE,aAAa,CAChC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,EAC5B,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EACrC,OAAO,CACR,CAAC;gBAEiC,IAAI,EAAE,YAAY;cAIrC,OAAO;IAMD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMnC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAMxC,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAKhC,KAAK,IAAI,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAOnC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAYlD,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAM3B,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAUxC,MAAM,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;CAatE"}
@@ -2,37 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrontendApi = exports.functionCallable = void 0;
4
4
  const gcp_functions_common_1 = require("@mxpicture/gcp-functions-common");
5
- const functions_1 = require("firebase/functions");
6
5
  const firebase_config_1 = require("../config/firebase.config");
7
- const functionCallable = (name) =>
8
- // eslint-disable-next-line indent
9
- (0, functions_1.httpsCallable)((0, firebase_config_1.configFirebase)().functions, name);
6
+ const firebase_loader_1 = require("../loader/firebase.loader");
7
+ const functionCallable = async (name) => {
8
+ const { httpsCallable } = await (0, firebase_loader_1.loadFirebaseFunctions)();
9
+ return httpsCallable((0, firebase_config_1.configFirebase)().functions, name);
10
+ };
10
11
  exports.functionCallable = functionCallable;
11
12
  class FrontendApi extends gcp_functions_common_1.IApi {
12
13
  constructor(name) {
13
14
  super();
14
15
  this.name = name;
15
- this.service = (0, exports.functionCallable)(name);
16
+ }
17
+ async service() {
18
+ if (!this._service)
19
+ this._service = await (0, exports.functionCallable)(this.name);
20
+ return this._service;
16
21
  }
17
22
  async delete(keys) {
18
- await this.service({ route: "delete", keys });
23
+ await (await this.service())({ route: "delete", keys });
19
24
  }
20
25
  async get(keys) {
21
- return (await (await this.service({ route: "get", keys })).data)
26
+ return (await (await (await this.service())({ route: "get", keys })).data)
22
27
  .doc;
23
28
  }
24
29
  // todo add filter
25
30
  async query() {
26
- return (await (await this.service({ route: "query" })).data)
31
+ return (await (await (await this.service())({ route: "query" })).data)
27
32
  .doc;
28
33
  }
29
34
  async count() {
30
- return (await (await this.service({ route: "count" })).data)
35
+ return (await (await (await this.service())({ route: "count" })).data)
31
36
  .doc;
32
37
  }
33
38
  async exists(keys) {
34
- return (await (await this.service({ route: "exists", keys })).data)
35
- .doc;
39
+ return (await (await (await this.service())({ route: "exists", keys })).data).doc;
36
40
  }
37
41
  async meta() {
38
42
  // return new Meta(this.shape).items();
@@ -40,11 +44,10 @@ class FrontendApi extends gcp_functions_common_1.IApi {
40
44
  return [];
41
45
  }
42
46
  async create(data) {
43
- return (await (await this.service({ route: "create", content: data })).data)
44
- .doc;
47
+ return (await (await (await this.service())({ route: "create", content: data })).data).doc;
45
48
  }
46
49
  async update(keys, data) {
47
- return (await (await this.service({
50
+ return (await (await (await this.service())({
48
51
  route: "update",
49
52
  keys,
50
53
  content: data,
@@ -1,12 +1,12 @@
1
- import { FirebaseApp } from "firebase/app";
2
- import { type Auth } from "firebase/auth";
3
- import { type Functions } from "firebase/functions";
1
+ import type { Auth } from "firebase/auth";
2
+ import type { FirebaseApp } from "firebase/app";
3
+ import type { Functions } from "firebase/functions";
4
4
  import { FirebaseConfig } from "../types";
5
- export declare const configFirebaseBegin: (firebaseConfig: FirebaseConfig) => {
5
+ export declare const configFirebaseBegin: (firebaseConfig: FirebaseConfig) => Promise<{
6
6
  app: FirebaseApp;
7
7
  auth: Auth;
8
8
  functions: Functions;
9
- };
9
+ }>;
10
10
  export declare const configFirebase: () => {
11
11
  app: FirebaseApp;
12
12
  auth: Auth;
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAW,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,cAAc;;;;CAQjE,CAAC;AAEF,eAAO,MAAM,cAAc;;;;CAS1B,CAAC"}
1
+ {"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW1C,eAAO,MAAM,mBAAmB,GAAU,gBAAgB,cAAc;;;;EAYvE,CAAC;AAEF,eAAO,MAAM,cAAc;;;;CAS1B,CAAC"}
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configFirebase = exports.configFirebaseBegin = void 0;
4
- const app_1 = require("firebase/app");
5
- const auth_1 = require("firebase/auth");
6
- const functions_1 = require("firebase/functions");
4
+ const firebase_loader_1 = require("../loader/firebase.loader");
7
5
  let app = undefined;
8
6
  let auth = undefined;
9
7
  let functions = undefined;
10
- const configFirebaseBegin = (firebaseConfig) => {
8
+ const configFirebaseBegin = async (firebaseConfig) => {
9
+ const { getAuth } = await (0, firebase_loader_1.loadFirebaseAuth)();
10
+ const { getFunctions } = await (0, firebase_loader_1.loadFirebaseFunctions)();
11
+ const { initializeApp } = await (0, firebase_loader_1.loadFirebaseApp)();
11
12
  // Initialize Firebase
12
13
  if (!app)
13
- app = (0, app_1.initializeApp)(firebaseConfig);
14
+ app = initializeApp(firebaseConfig);
14
15
  // Initialize Firebase services
15
16
  if (!auth)
16
- auth = (0, auth_1.getAuth)(app);
17
+ auth = getAuth(app);
17
18
  if (!functions)
18
- functions = (0, functions_1.getFunctions)(app);
19
+ functions = getFunctions(app);
19
20
  return (0, exports.configFirebase)();
20
21
  };
21
22
  exports.configFirebaseBegin = configFirebaseBegin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AAGtB,OAAO,KAAK,IAAI,MAAM,OAAO,CAAC;AAC9B,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AAItB,OAAO,KAAK,IAAI,MAAM,OAAO,CAAC;AAC9B,eAAe,IAAI,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -36,7 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ // eslint-disable-next-line import/export
39
40
  __exportStar(require("./lib"), exports);
40
41
  // A default export can help some consumers using require()
42
+ // eslint-disable-next-line import/namespace
41
43
  const _all = __importStar(require("./lib"));
42
44
  exports.default = _all;
package/dist/cjs/lib.d.ts CHANGED
@@ -5,5 +5,4 @@ export * from "./config/firebase.config.js";
5
5
  export * from "./base/FrontendApi.js";
6
6
  export * from "./services/firebase/auth.service.js";
7
7
  export * from "./services/firebase/index.js";
8
- export { ZodRawShape, ZodSafeParseResult } from "zod";
9
8
  //# sourceMappingURL=lib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,KAAK,CAAC"}
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const loadFirebaseAuth: () => Promise<typeof import("firebase/auth")>;
2
+ export declare const loadFirebaseApp: () => Promise<typeof import("firebase/app")>;
3
+ export declare const loadFirebaseFunctions: () => Promise<typeof import("firebase/functions")>;
4
+ //# sourceMappingURL=firebase.loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.loader.d.ts","sourceRoot":"","sources":["../../../src/loader/firebase.loader.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,+CAG5B,CAAC;AAEF,eAAO,MAAM,eAAe,8CAG3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,oDAGjC,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadFirebaseFunctions = exports.loadFirebaseApp = exports.loadFirebaseAuth = void 0;
37
+ let authPromise = null;
38
+ let appPromise = null;
39
+ let functionsPromise = null;
40
+ const loadFirebaseAuth = () => {
41
+ if (!authPromise)
42
+ authPromise = Promise.resolve().then(() => __importStar(require("firebase/auth")));
43
+ return authPromise;
44
+ };
45
+ exports.loadFirebaseAuth = loadFirebaseAuth;
46
+ const loadFirebaseApp = () => {
47
+ if (!appPromise)
48
+ appPromise = Promise.resolve().then(() => __importStar(require("firebase/app")));
49
+ return appPromise;
50
+ };
51
+ exports.loadFirebaseApp = loadFirebaseApp;
52
+ const loadFirebaseFunctions = () => {
53
+ if (!functionsPromise)
54
+ functionsPromise = Promise.resolve().then(() => __importStar(require("firebase/functions")));
55
+ return functionsPromise;
56
+ };
57
+ exports.loadFirebaseFunctions = loadFirebaseFunctions;
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAKA,cAAc,OAAO,CAAC"}
@@ -17,4 +17,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  // Re-export your public types/exports so this file becomes the root .d.ts for the package.
19
19
  // Adjust the relative path if your source layout differs.
20
+ // eslint-disable-next-line import/export
20
21
  __exportStar(require("./lib"), exports);
@@ -4,11 +4,11 @@ declare class AuthService {
4
4
  register(credentials: RegisterCredentials): Promise<AuthUser>;
5
5
  logout(): Promise<void>;
6
6
  resetPassword(email: string): Promise<void>;
7
- onAuthStateChanged(callback: (user: AuthUser | null) => void): () => void;
7
+ onAuthStateChanged(callback: (user: AuthUser | null) => void): Promise<() => void>;
8
8
  getCurrentUser(): AuthUser | null;
9
9
  private mapFirebaseUserToAuthUser;
10
10
  private handleAuthError;
11
11
  }
12
- declare const _default: AuthService;
13
- export default _default;
12
+ export declare const authService: AuthService;
13
+ export default authService;
14
14
  //# sourceMappingURL=auth.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/services/firebase/auth.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cxB;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC;AAC7C,eAAe,WAAW,CAAC"}
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const auth_1 = require("firebase/auth");
3
+ exports.authService = void 0;
4
4
  const firebase_config_1 = require("../../config/firebase.config");
5
+ const firebase_loader_1 = require("../../loader/firebase.loader");
5
6
  class AuthService {
6
7
  async login(credentials) {
7
8
  try {
8
- const { user } = await (0, auth_1.signInWithEmailAndPassword)((0, firebase_config_1.configFirebase)().auth, credentials.email, credentials.password);
9
+ const { signInWithEmailAndPassword } = await (0, firebase_loader_1.loadFirebaseAuth)();
10
+ const { user } = await signInWithEmailAndPassword((0, firebase_config_1.configFirebase)().auth, credentials.email, credentials.password);
9
11
  return this.mapFirebaseUserToAuthUser(user);
10
12
  }
11
13
  catch (error) {
@@ -14,7 +16,8 @@ class AuthService {
14
16
  }
15
17
  async register(credentials) {
16
18
  try {
17
- const { user } = await (0, auth_1.createUserWithEmailAndPassword)((0, firebase_config_1.configFirebase)().auth, credentials.email, credentials.password);
19
+ const { createUserWithEmailAndPassword } = await (0, firebase_loader_1.loadFirebaseAuth)();
20
+ const { user } = await createUserWithEmailAndPassword((0, firebase_config_1.configFirebase)().auth, credentials.email, credentials.password);
18
21
  // Store additional user data in Firestore
19
22
  // const userService = new UserService()
20
23
  // await userService.createUserProfile(user.uid, credentials)
@@ -26,7 +29,8 @@ class AuthService {
26
29
  }
27
30
  async logout() {
28
31
  try {
29
- await (0, auth_1.signOut)((0, firebase_config_1.configFirebase)().auth);
32
+ const { signOut } = await (0, firebase_loader_1.loadFirebaseAuth)();
33
+ await signOut((0, firebase_config_1.configFirebase)().auth);
30
34
  }
31
35
  catch (error) {
32
36
  throw this.handleAuthError(error);
@@ -34,14 +38,16 @@ class AuthService {
34
38
  }
35
39
  async resetPassword(email) {
36
40
  try {
37
- await (0, auth_1.sendPasswordResetEmail)((0, firebase_config_1.configFirebase)().auth, email);
41
+ const { sendPasswordResetEmail } = await (0, firebase_loader_1.loadFirebaseAuth)();
42
+ await sendPasswordResetEmail((0, firebase_config_1.configFirebase)().auth, email);
38
43
  }
39
44
  catch (error) {
40
45
  throw this.handleAuthError(error);
41
46
  }
42
47
  }
43
- onAuthStateChanged(callback) {
44
- return (0, auth_1.onAuthStateChanged)((0, firebase_config_1.configFirebase)().auth, (user) => {
48
+ async onAuthStateChanged(callback) {
49
+ const { onAuthStateChanged } = await (0, firebase_loader_1.loadFirebaseAuth)();
50
+ return onAuthStateChanged((0, firebase_config_1.configFirebase)().auth, (user) => {
45
51
  callback(user ? this.mapFirebaseUserToAuthUser(user) : null);
46
52
  });
47
53
  }
@@ -75,4 +81,5 @@ class AuthService {
75
81
  return new Error(message);
76
82
  }
77
83
  }
78
- exports.default = new AuthService();
84
+ exports.authService = new AuthService();
85
+ exports.default = exports.authService;
@@ -1,2 +1,2 @@
1
- export { default as authService } from "./auth.service";
1
+ export { authService } from "./auth.service";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/firebase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/firebase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.authService = void 0;
7
4
  var auth_service_1 = require("./auth.service");
8
- Object.defineProperty(exports, "authService", { enumerable: true, get: function () { return __importDefault(auth_service_1).default; } });
5
+ Object.defineProperty(exports, "authService", { enumerable: true, get: function () { return auth_service_1.authService; } });
@@ -1,11 +1,13 @@
1
- import { MetaItem } from "@mxpicture/zod-meta";
2
- import { ApiKey, DocumentData, WithKey, IApi, FunctionName, FunctionPayload, FunctionResult } from "@mxpicture/gcp-functions-common";
3
- import { HttpsCallable } from "firebase/functions";
4
- export declare const functionCallable: <DTO extends DocumentData, KEYS extends ApiKey>(name: FunctionName) => HttpsCallable<FunctionPayload<DTO, KEYS>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
1
+ import type { MetaItem } from "@mxpicture/zod-meta";
2
+ import type { ApiKey, DocumentData, WithKey, FunctionName, FunctionPayload, FunctionResult } from "@mxpicture/gcp-functions-common";
3
+ import { IApi } from "@mxpicture/gcp-functions-common";
4
+ import type { HttpsCallable } from "firebase/functions";
5
+ export declare const functionCallable: <DTO extends DocumentData, KEYS extends ApiKey>(name: FunctionName) => Promise<HttpsCallable<FunctionPayload<DTO, KEYS>, Promise<FunctionResult<WithKey<DTO>>>, unknown>>;
5
6
  export declare class FrontendApi<DTO extends DocumentData> extends IApi<DTO> {
6
7
  readonly name: FunctionName;
7
- protected service: HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
8
+ protected _service?: HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>;
8
9
  constructor(name: FunctionName);
10
+ protected service(): Promise<HttpsCallable<FunctionPayload<DTO, ApiKey>, Promise<FunctionResult<WithKey<DTO>>>, unknown>>;
9
11
  delete(keys: ApiKey): Promise<void>;
10
12
  get(keys: ApiKey): Promise<WithKey<DTO>>;
11
13
  query(): Promise<WithKey<DTO>[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"FrontendApi.d.ts","sourceRoot":"","sources":["../../../src/base/FrontendApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,MAAM,EACN,YAAY,EACZ,OAAO,EACP,IAAI,EACJ,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G,CAAC,CAAC;IAUxC,MAAM,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;CAatE"}
@@ -2,37 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrontendApi = exports.functionCallable = void 0;
4
4
  const gcp_functions_common_1 = require("@mxpicture/gcp-functions-common");
5
- const functions_1 = require("firebase/functions");
6
5
  const firebase_config_1 = require("../config/firebase.config");
7
- const functionCallable = (name) =>
8
- // eslint-disable-next-line indent
9
- (0, functions_1.httpsCallable)((0, firebase_config_1.configFirebase)().functions, name);
6
+ const firebase_loader_1 = require("../loader/firebase.loader");
7
+ const functionCallable = async (name) => {
8
+ const { httpsCallable } = await (0, firebase_loader_1.loadFirebaseFunctions)();
9
+ return httpsCallable((0, firebase_config_1.configFirebase)().functions, name);
10
+ };
10
11
  exports.functionCallable = functionCallable;
11
12
  class FrontendApi extends gcp_functions_common_1.IApi {
12
13
  constructor(name) {
13
14
  super();
14
15
  this.name = name;
15
- this.service = (0, exports.functionCallable)(name);
16
+ }
17
+ async service() {
18
+ if (!this._service)
19
+ this._service = await (0, exports.functionCallable)(this.name);
20
+ return this._service;
16
21
  }
17
22
  async delete(keys) {
18
- await this.service({ route: "delete", keys });
23
+ await (await this.service())({ route: "delete", keys });
19
24
  }
20
25
  async get(keys) {
21
- return (await (await this.service({ route: "get", keys })).data)
26
+ return (await (await (await this.service())({ route: "get", keys })).data)
22
27
  .doc;
23
28
  }
24
29
  // todo add filter
25
30
  async query() {
26
- return (await (await this.service({ route: "query" })).data)
31
+ return (await (await (await this.service())({ route: "query" })).data)
27
32
  .doc;
28
33
  }
29
34
  async count() {
30
- return (await (await this.service({ route: "count" })).data)
35
+ return (await (await (await this.service())({ route: "count" })).data)
31
36
  .doc;
32
37
  }
33
38
  async exists(keys) {
34
- return (await (await this.service({ route: "exists", keys })).data)
35
- .doc;
39
+ return (await (await (await this.service())({ route: "exists", keys })).data).doc;
36
40
  }
37
41
  async meta() {
38
42
  // return new Meta(this.shape).items();
@@ -40,11 +44,10 @@ class FrontendApi extends gcp_functions_common_1.IApi {
40
44
  return [];
41
45
  }
42
46
  async create(data) {
43
- return (await (await this.service({ route: "create", content: data })).data)
44
- .doc;
47
+ return (await (await (await this.service())({ route: "create", content: data })).data).doc;
45
48
  }
46
49
  async update(keys, data) {
47
- return (await (await this.service({
50
+ return (await (await (await this.service())({
48
51
  route: "update",
49
52
  keys,
50
53
  content: data,
@@ -1,12 +1,12 @@
1
- import { FirebaseApp } from "firebase/app";
2
- import { type Auth } from "firebase/auth";
3
- import { type Functions } from "firebase/functions";
1
+ import type { Auth } from "firebase/auth";
2
+ import type { FirebaseApp } from "firebase/app";
3
+ import type { Functions } from "firebase/functions";
4
4
  import { FirebaseConfig } from "../types";
5
- export declare const configFirebaseBegin: (firebaseConfig: FirebaseConfig) => {
5
+ export declare const configFirebaseBegin: (firebaseConfig: FirebaseConfig) => Promise<{
6
6
  app: FirebaseApp;
7
7
  auth: Auth;
8
8
  functions: Functions;
9
- };
9
+ }>;
10
10
  export declare const configFirebase: () => {
11
11
  app: FirebaseApp;
12
12
  auth: Auth;
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAW,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,cAAc;;;;CAQjE,CAAC;AAEF,eAAO,MAAM,cAAc;;;;CAS1B,CAAC"}
1
+ {"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW1C,eAAO,MAAM,mBAAmB,GAAU,gBAAgB,cAAc;;;;EAYvE,CAAC;AAEF,eAAO,MAAM,cAAc;;;;CAS1B,CAAC"}
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configFirebase = exports.configFirebaseBegin = void 0;
4
- const app_1 = require("firebase/app");
5
- const auth_1 = require("firebase/auth");
6
- const functions_1 = require("firebase/functions");
4
+ const firebase_loader_1 = require("../loader/firebase.loader");
7
5
  let app = undefined;
8
6
  let auth = undefined;
9
7
  let functions = undefined;
10
- const configFirebaseBegin = (firebaseConfig) => {
8
+ const configFirebaseBegin = async (firebaseConfig) => {
9
+ const { getAuth } = await (0, firebase_loader_1.loadFirebaseAuth)();
10
+ const { getFunctions } = await (0, firebase_loader_1.loadFirebaseFunctions)();
11
+ const { initializeApp } = await (0, firebase_loader_1.loadFirebaseApp)();
11
12
  // Initialize Firebase
12
13
  if (!app)
13
- app = (0, app_1.initializeApp)(firebaseConfig);
14
+ app = initializeApp(firebaseConfig);
14
15
  // Initialize Firebase services
15
16
  if (!auth)
16
- auth = (0, auth_1.getAuth)(app);
17
+ auth = getAuth(app);
17
18
  if (!functions)
18
- functions = (0, functions_1.getFunctions)(app);
19
+ functions = getFunctions(app);
19
20
  return (0, exports.configFirebase)();
20
21
  };
21
22
  exports.configFirebaseBegin = configFirebaseBegin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AAGtB,OAAO,KAAK,IAAI,MAAM,OAAO,CAAC;AAC9B,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AAItB,OAAO,KAAK,IAAI,MAAM,OAAO,CAAC;AAC9B,eAAe,IAAI,CAAC"}
package/dist/esm/index.js CHANGED
@@ -36,7 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ // eslint-disable-next-line import/export
39
40
  __exportStar(require("./lib"), exports);
40
41
  // A default export can help some consumers using require()
42
+ // eslint-disable-next-line import/namespace
41
43
  const _all = __importStar(require("./lib"));
42
44
  exports.default = _all;
package/dist/esm/lib.d.ts CHANGED
@@ -5,5 +5,4 @@ export * from "./config/firebase.config.js";
5
5
  export * from "./base/FrontendApi.js";
6
6
  export * from "./services/firebase/auth.service.js";
7
7
  export * from "./services/firebase/index.js";
8
- export { ZodRawShape, ZodSafeParseResult } from "zod";
9
8
  //# sourceMappingURL=lib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,KAAK,CAAC"}
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const loadFirebaseAuth: () => Promise<typeof import("firebase/auth")>;
2
+ export declare const loadFirebaseApp: () => Promise<typeof import("firebase/app")>;
3
+ export declare const loadFirebaseFunctions: () => Promise<typeof import("firebase/functions")>;
4
+ //# sourceMappingURL=firebase.loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.loader.d.ts","sourceRoot":"","sources":["../../../src/loader/firebase.loader.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,+CAG5B,CAAC;AAEF,eAAO,MAAM,eAAe,8CAG3B,CAAC;AAEF,eAAO,MAAM,qBAAqB,oDAGjC,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadFirebaseFunctions = exports.loadFirebaseApp = exports.loadFirebaseAuth = void 0;
4
+ let authPromise = null;
5
+ let appPromise = null;
6
+ let functionsPromise = null;
7
+ const loadFirebaseAuth = () => {
8
+ if (!authPromise)
9
+ authPromise = import("firebase/auth");
10
+ return authPromise;
11
+ };
12
+ exports.loadFirebaseAuth = loadFirebaseAuth;
13
+ const loadFirebaseApp = () => {
14
+ if (!appPromise)
15
+ appPromise = import("firebase/app");
16
+ return appPromise;
17
+ };
18
+ exports.loadFirebaseApp = loadFirebaseApp;
19
+ const loadFirebaseFunctions = () => {
20
+ if (!functionsPromise)
21
+ functionsPromise = import("firebase/functions");
22
+ return functionsPromise;
23
+ };
24
+ exports.loadFirebaseFunctions = loadFirebaseFunctions;
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAKA,cAAc,OAAO,CAAC"}
@@ -17,4 +17,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  // Re-export your public types/exports so this file becomes the root .d.ts for the package.
19
19
  // Adjust the relative path if your source layout differs.
20
+ // eslint-disable-next-line import/export
20
21
  __exportStar(require("./lib"), exports);
@@ -4,11 +4,11 @@ declare class AuthService {
4
4
  register(credentials: RegisterCredentials): Promise<AuthUser>;
5
5
  logout(): Promise<void>;
6
6
  resetPassword(email: string): Promise<void>;
7
- onAuthStateChanged(callback: (user: AuthUser | null) => void): () => void;
7
+ onAuthStateChanged(callback: (user: AuthUser | null) => void): Promise<() => void>;
8
8
  getCurrentUser(): AuthUser | null;
9
9
  private mapFirebaseUserToAuthUser;
10
10
  private handleAuthError;
11
11
  }
12
- declare const _default: AuthService;
13
- export default _default;
12
+ export declare const authService: AuthService;
13
+ export default authService;
14
14
  //# sourceMappingURL=auth.service.d.ts.map