@mxpicture/gcp-functions-frontend 1.1.2 → 1.1.4
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/api/FrontendApi.d.ts +53 -0
- package/dist/api/FrontendApi.d.ts.map +1 -1
- package/dist/api/FrontendApi.js +53 -0
- package/dist/api/FrontendApi.js.map +1 -1
- package/dist/api/IFrontendApi.d.ts +25 -0
- package/dist/api/IFrontendApi.d.ts.map +1 -1
- package/dist/api/IFrontendApi.js +25 -0
- package/dist/api/IFrontendApi.js.map +1 -1
- package/dist/config/firebase.config.d.ts +24 -0
- package/dist/config/firebase.config.d.ts.map +1 -1
- package/dist/config/firebase.config.js +24 -0
- package/dist/config/firebase.config.js.map +1 -1
- package/dist/function/IFrontendFunction.d.ts +33 -0
- package/dist/function/IFrontendFunction.d.ts.map +1 -1
- package/dist/function/IFrontendFunction.js +33 -0
- package/dist/function/IFrontendFunction.js.map +1 -1
- package/dist/helper/auth.helper.d.ts +9 -0
- package/dist/helper/auth.helper.d.ts.map +1 -1
- package/dist/helper/auth.helper.js +9 -0
- package/dist/helper/auth.helper.js.map +1 -1
- package/dist/helper/validation.helper.d.ts +19 -0
- package/dist/helper/validation.helper.d.ts.map +1 -1
- package/dist/helper/validation.helper.js +19 -0
- package/dist/helper/validation.helper.js.map +1 -1
- package/dist/loader/firebase.loader.d.ts +24 -0
- package/dist/loader/firebase.loader.d.ts.map +1 -1
- package/dist/loader/firebase.loader.js +24 -0
- package/dist/loader/firebase.loader.js.map +1 -1
- package/dist/services/firebase/auth.service.d.ts +50 -0
- package/dist/services/firebase/auth.service.d.ts.map +1 -1
- package/dist/services/firebase/auth.service.js +50 -0
- package/dist/services/firebase/auth.service.js.map +1 -1
- package/dist/types/auth.types.d.ts +35 -0
- package/dist/types/auth.types.d.ts.map +1 -1
- package/dist/types/firebase.types.d.ts +22 -0
- package/dist/types/firebase.types.d.ts.map +1 -1
- package/package.json +5 -3
|
@@ -1,19 +1,72 @@
|
|
|
1
1
|
import type { DocumentData, WithKey, ApiFromRoutes, CrudRoutes, WithoutKey, DocumentKey, ApiFilter } from "@mxpicture/gcp-functions-common/types";
|
|
2
2
|
import { IFrontendApi } from "./IFrontendApi.js";
|
|
3
3
|
import { IFrontendFunction } from "../function/IFrontendFunction.js";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class providing CRUD operations for a frontend API backed by a cloud function.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Subclasses must supply a concrete {@link IFrontendFunction} via {@link IFrontendApi.useFunc}
|
|
9
|
+
* before any operation is invoked. Every method delegates to the function's
|
|
10
|
+
* {@link IFrontendFunction.outgress | outgress} call with the appropriate route.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam DTO - The document data transfer object shape.
|
|
13
|
+
* @typeParam FUNC - The concrete frontend function type used for remote calls.
|
|
14
|
+
*/
|
|
4
15
|
export declare abstract class FrontendApi<DTO extends DocumentData, FUNC extends IFrontendFunction> extends IFrontendApi<FUNC> implements ApiFromRoutes<CrudRoutes<DTO>> {
|
|
16
|
+
/**
|
|
17
|
+
* Delete a document by its key.
|
|
18
|
+
*
|
|
19
|
+
* @param request - The document key identifying the document to delete.
|
|
20
|
+
* @returns A promise resolving to an object confirming deletion.
|
|
21
|
+
*/
|
|
5
22
|
delete(request: DocumentKey): Promise<{
|
|
6
23
|
deleted: true;
|
|
7
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve a single document by its key.
|
|
27
|
+
*
|
|
28
|
+
* @param request - The document key identifying the document to retrieve.
|
|
29
|
+
* @returns A promise resolving to the document data including its key.
|
|
30
|
+
*/
|
|
8
31
|
get(request: DocumentKey): Promise<WithKey<DTO>>;
|
|
32
|
+
/**
|
|
33
|
+
* Query documents matching an optional filter.
|
|
34
|
+
*
|
|
35
|
+
* @param request - Optional filter criteria; pass `null` or omit to retrieve all documents.
|
|
36
|
+
* @returns A promise resolving to an array of matching documents with their keys.
|
|
37
|
+
*/
|
|
9
38
|
query(request?: ApiFilter | null): Promise<WithKey<DTO>[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Count documents matching an optional filter.
|
|
41
|
+
*
|
|
42
|
+
* @param request - Optional filter criteria; pass `null` or omit to count all documents.
|
|
43
|
+
* @returns A promise resolving to an object containing the document count.
|
|
44
|
+
*/
|
|
10
45
|
count(request?: ApiFilter | null): Promise<{
|
|
11
46
|
count: number;
|
|
12
47
|
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Check whether a document exists.
|
|
50
|
+
*
|
|
51
|
+
* @param request - The document key identifying the document to check.
|
|
52
|
+
* @returns A promise resolving to an object indicating existence.
|
|
53
|
+
*/
|
|
13
54
|
exists(request: DocumentKey): Promise<{
|
|
14
55
|
exists: boolean;
|
|
15
56
|
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new document.
|
|
59
|
+
*
|
|
60
|
+
* @param request - The document data without a key; the backend assigns one.
|
|
61
|
+
* @returns A promise resolving to the created document data including the assigned key.
|
|
62
|
+
*/
|
|
16
63
|
create(request: WithoutKey<DTO>): Promise<WithKey<DTO>>;
|
|
64
|
+
/**
|
|
65
|
+
* Update an existing document with a partial set of fields.
|
|
66
|
+
*
|
|
67
|
+
* @param request - The document key together with the fields to update.
|
|
68
|
+
* @returns A promise resolving to the fully updated document data including its key.
|
|
69
|
+
*/
|
|
17
70
|
update(request: WithKey<Partial<DTO>>): Promise<WithKey<DTO>>;
|
|
18
71
|
}
|
|
19
72
|
//# sourceMappingURL=FrontendApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontendApi.d.ts","sourceRoot":"","sources":["../../src/api/FrontendApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACV,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB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AAW,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAKvE;;;;;OAKG;IACU,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAKpE;;;;;OAKG;IACU,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;CAI3E"}
|
package/dist/api/FrontendApi.js
CHANGED
|
@@ -1,29 +1,82 @@
|
|
|
1
1
|
import { IFrontendApi } from "./IFrontendApi.js";
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class providing CRUD operations for a frontend API backed by a cloud function.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Subclasses must supply a concrete {@link IFrontendFunction} via {@link IFrontendApi.useFunc}
|
|
7
|
+
* before any operation is invoked. Every method delegates to the function's
|
|
8
|
+
* {@link IFrontendFunction.outgress | outgress} call with the appropriate route.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam DTO - The document data transfer object shape.
|
|
11
|
+
* @typeParam FUNC - The concrete frontend function type used for remote calls.
|
|
12
|
+
*/
|
|
2
13
|
export class FrontendApi extends IFrontendApi {
|
|
14
|
+
/**
|
|
15
|
+
* Delete a document by its key.
|
|
16
|
+
*
|
|
17
|
+
* @param request - The document key identifying the document to delete.
|
|
18
|
+
* @returns A promise resolving to an object confirming deletion.
|
|
19
|
+
*/
|
|
3
20
|
async delete(request) {
|
|
4
21
|
return (await this.func().outgress({ route: "delete", data: request }))
|
|
5
22
|
.data;
|
|
6
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve a single document by its key.
|
|
26
|
+
*
|
|
27
|
+
* @param request - The document key identifying the document to retrieve.
|
|
28
|
+
* @returns A promise resolving to the document data including its key.
|
|
29
|
+
*/
|
|
7
30
|
async get(request) {
|
|
8
31
|
return (await this.func().outgress({ route: "get", data: request }))
|
|
9
32
|
.data;
|
|
10
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Query documents matching an optional filter.
|
|
36
|
+
*
|
|
37
|
+
* @param request - Optional filter criteria; pass `null` or omit to retrieve all documents.
|
|
38
|
+
* @returns A promise resolving to an array of matching documents with their keys.
|
|
39
|
+
*/
|
|
11
40
|
async query(request) {
|
|
12
41
|
return (await this.func().outgress({ route: "query", data: request }))
|
|
13
42
|
.data;
|
|
14
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Count documents matching an optional filter.
|
|
46
|
+
*
|
|
47
|
+
* @param request - Optional filter criteria; pass `null` or omit to count all documents.
|
|
48
|
+
* @returns A promise resolving to an object containing the document count.
|
|
49
|
+
*/
|
|
15
50
|
async count(request) {
|
|
16
51
|
return (await this.func().outgress({ route: "count", data: request }))
|
|
17
52
|
.data;
|
|
18
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Check whether a document exists.
|
|
56
|
+
*
|
|
57
|
+
* @param request - The document key identifying the document to check.
|
|
58
|
+
* @returns A promise resolving to an object indicating existence.
|
|
59
|
+
*/
|
|
19
60
|
async exists(request) {
|
|
20
61
|
return (await this.func().outgress({ route: "exists", data: request }))
|
|
21
62
|
.data;
|
|
22
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a new document.
|
|
66
|
+
*
|
|
67
|
+
* @param request - The document data without a key; the backend assigns one.
|
|
68
|
+
* @returns A promise resolving to the created document data including the assigned key.
|
|
69
|
+
*/
|
|
23
70
|
async create(request) {
|
|
24
71
|
return (await this.func().outgress({ route: "create", data: request }))
|
|
25
72
|
.data;
|
|
26
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Update an existing document with a partial set of fields.
|
|
76
|
+
*
|
|
77
|
+
* @param request - The document key together with the fields to update.
|
|
78
|
+
* @returns A promise resolving to the fully updated document data including its key.
|
|
79
|
+
*/
|
|
27
80
|
async update(request) {
|
|
28
81
|
return (await this.func().outgress({ route: "update", data: request }))
|
|
29
82
|
.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontendApi.js","sourceRoot":"","sources":["../../src/api/FrontendApi.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,MAAM,OAAgB,WAIpB,SAAQ,YAAkB;
|
|
1
|
+
{"version":3,"file":"FrontendApi.js","sourceRoot":"","sources":["../../src/api/FrontendApi.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,WAIpB,SAAQ,YAAkB;IAG1B;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,OAAoB;QACtC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACpE,IAAyB,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,OAAoB;QACnC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACjE,IAAoB,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CAAC,OAA0B;QAC3C,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACnE,IAAsB,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,KAAK,CAAC,OAA0B;QAC3C,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACnE,IAAyB,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,OAAoB;QACtC,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACpE,IAA2B,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,OAAwB;QAC1C,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACpE,IAAoB,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,OAA8B;QAChD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aACpE,IAAoB,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import { IFrontendFunction } from "../function/IFrontendFunction.js";
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class that binds a frontend API to an {@link IFrontendFunction}.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Consumers must call {@link useFunc} before invoking any operation so the API
|
|
7
|
+
* knows which cloud function to delegate to.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam FUNC - The concrete frontend function type this API delegates to.
|
|
10
|
+
*/
|
|
2
11
|
export declare abstract class IFrontendApi<FUNC extends IFrontendFunction> {
|
|
3
12
|
readonly name: string;
|
|
4
13
|
protected _func?: FUNC;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new frontend API instance.
|
|
16
|
+
*
|
|
17
|
+
* @param name - A human-readable name used in error messages.
|
|
18
|
+
*/
|
|
5
19
|
constructor(name: string);
|
|
20
|
+
/**
|
|
21
|
+
* Bind a frontend function to this API.
|
|
22
|
+
*
|
|
23
|
+
* @param func - The function instance to use for outgoing requests.
|
|
24
|
+
*/
|
|
6
25
|
useFunc(func: FUNC): void;
|
|
26
|
+
/**
|
|
27
|
+
* Return the bound frontend function.
|
|
28
|
+
*
|
|
29
|
+
* @returns The currently bound function instance.
|
|
30
|
+
* @throws {Error} If {@link useFunc} has not been called yet.
|
|
31
|
+
*/
|
|
7
32
|
protected func(): FUNC;
|
|
8
33
|
}
|
|
9
34
|
//# sourceMappingURL=IFrontendApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrontendApi.d.ts","sourceRoot":"","sources":["../../src/api/IFrontendApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,8BAAsB,YAAY,CAAC,IAAI,SAAS,iBAAiB;
|
|
1
|
+
{"version":3,"file":"IFrontendApi.d.ts","sourceRoot":"","sources":["../../src/api/IFrontendApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE;;;;;;;;GAQG;AACH,8BAAsB,YAAY,CAAC,IAAI,SAAS,iBAAiB;aAQ5B,IAAI,EAAE,MAAM;IAP/C,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IAEvB;;;;OAIG;gBACgC,IAAI,EAAE,MAAM;IAE/C;;;;OAIG;IACI,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAIhC;;;;;OAKG;IACH,SAAS,CAAC,IAAI,IAAI,IAAI;CAKvB"}
|
package/dist/api/IFrontendApi.js
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class that binds a frontend API to an {@link IFrontendFunction}.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Consumers must call {@link useFunc} before invoking any operation so the API
|
|
6
|
+
* knows which cloud function to delegate to.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam FUNC - The concrete frontend function type this API delegates to.
|
|
9
|
+
*/
|
|
1
10
|
export class IFrontendApi {
|
|
2
11
|
name;
|
|
3
12
|
_func;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new frontend API instance.
|
|
15
|
+
*
|
|
16
|
+
* @param name - A human-readable name used in error messages.
|
|
17
|
+
*/
|
|
4
18
|
constructor(name) {
|
|
5
19
|
this.name = name;
|
|
6
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Bind a frontend function to this API.
|
|
23
|
+
*
|
|
24
|
+
* @param func - The function instance to use for outgoing requests.
|
|
25
|
+
*/
|
|
7
26
|
useFunc(func) {
|
|
8
27
|
this._func = func;
|
|
9
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Return the bound frontend function.
|
|
31
|
+
*
|
|
32
|
+
* @returns The currently bound function instance.
|
|
33
|
+
* @throws {Error} If {@link useFunc} has not been called yet.
|
|
34
|
+
*/
|
|
10
35
|
func() {
|
|
11
36
|
if (!this._func)
|
|
12
37
|
throw new Error(`${this.name}: func not provided. Use "useFunc" method`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrontendApi.js","sourceRoot":"","sources":["../../src/api/IFrontendApi.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,YAAY;
|
|
1
|
+
{"version":3,"file":"IFrontendApi.js","sourceRoot":"","sources":["../../src/api/IFrontendApi.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,OAAgB,YAAY;IAQG;IAPzB,KAAK,CAAQ;IAEvB;;;;OAIG;IACH,YAAmC,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAEnD;;;;OAIG;IACI,OAAO,CAAC,IAAU;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACO,IAAI;QACZ,IAAI,CAAC,IAAI,CAAC,KAAK;YACb,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,2CAA2C,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -2,12 +2,36 @@ import { GoogleAuthProvider, type Auth } from "firebase/auth";
|
|
|
2
2
|
import { type FirebaseApp } from "firebase/app";
|
|
3
3
|
import { type Functions } from "firebase/functions";
|
|
4
4
|
import type { FirebaseConfig, FirebaseEmulatorConfig } from "../types/firebase.types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Initialize Firebase with the given configuration and optional emulator settings.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This function may only be called once. Subsequent calls throw an error.
|
|
10
|
+
* After storing the configuration it delegates to {@link configFirebase} to
|
|
11
|
+
* create the Firebase service instances.
|
|
12
|
+
*
|
|
13
|
+
* @param config - The Firebase project configuration.
|
|
14
|
+
* @param emu - Optional emulator connection settings for local development.
|
|
15
|
+
* @returns The initialized Firebase service instances (app, auth, functions, googleProvider).
|
|
16
|
+
* @throws {Error} If Firebase has already been initialized.
|
|
17
|
+
*/
|
|
5
18
|
export declare const initializeFirebase: (config: FirebaseConfig, emu?: FirebaseEmulatorConfig) => {
|
|
6
19
|
app: FirebaseApp;
|
|
7
20
|
auth: Auth;
|
|
8
21
|
functions: Functions;
|
|
9
22
|
googleProvider: GoogleAuthProvider;
|
|
10
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Return the shared Firebase service instances, creating them on first call.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* {@link initializeFirebase} must be called before this function.
|
|
29
|
+
* On the first invocation the Firebase app, auth, functions, and Google auth
|
|
30
|
+
* provider are created and optionally connected to emulators.
|
|
31
|
+
*
|
|
32
|
+
* @returns The Firebase service instances (app, auth, functions, googleProvider).
|
|
33
|
+
* @throws {Error} If {@link initializeFirebase} has not been called yet.
|
|
34
|
+
*/
|
|
11
35
|
export declare const configFirebase: () => {
|
|
12
36
|
app: FirebaseApp;
|
|
13
37
|
auth: Auth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,KAAK,IAAI,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAYpC,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,cAAc,EACtB,MAAM,sBAAsB;
|
|
1
|
+
{"version":3,"file":"firebase.config.d.ts","sourceRoot":"","sources":["../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,KAAK,IAAI,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAYpC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,cAAc,EACtB,MAAM,sBAAsB;SAxBvB,WAAW;UACV,IAAI;eACC,SAAS;oBACJ,kBAAkB;CA2BnC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc;SA3CpB,WAAW;UACV,IAAI;eACC,SAAS;oBACJ,kBAAkB;CAwEnC,CAAC"}
|
|
@@ -4,6 +4,19 @@ import { connectFunctionsEmulator, getFunctions, } from "firebase/functions";
|
|
|
4
4
|
let _inst = null;
|
|
5
5
|
let _config = null;
|
|
6
6
|
let _emu = null;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize Firebase with the given configuration and optional emulator settings.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This function may only be called once. Subsequent calls throw an error.
|
|
12
|
+
* After storing the configuration it delegates to {@link configFirebase} to
|
|
13
|
+
* create the Firebase service instances.
|
|
14
|
+
*
|
|
15
|
+
* @param config - The Firebase project configuration.
|
|
16
|
+
* @param emu - Optional emulator connection settings for local development.
|
|
17
|
+
* @returns The initialized Firebase service instances (app, auth, functions, googleProvider).
|
|
18
|
+
* @throws {Error} If Firebase has already been initialized.
|
|
19
|
+
*/
|
|
7
20
|
export const initializeFirebase = (config, emu) => {
|
|
8
21
|
if (_config)
|
|
9
22
|
throw new Error("Firebase config already present");
|
|
@@ -12,6 +25,17 @@ export const initializeFirebase = (config, emu) => {
|
|
|
12
25
|
_emu = { ...emu };
|
|
13
26
|
return configFirebase();
|
|
14
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Return the shared Firebase service instances, creating them on first call.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* {@link initializeFirebase} must be called before this function.
|
|
33
|
+
* On the first invocation the Firebase app, auth, functions, and Google auth
|
|
34
|
+
* provider are created and optionally connected to emulators.
|
|
35
|
+
*
|
|
36
|
+
* @returns The Firebase service instances (app, auth, functions, googleProvider).
|
|
37
|
+
* @throws {Error} If {@link initializeFirebase} has not been called yet.
|
|
38
|
+
*/
|
|
15
39
|
export const configFirebase = () => {
|
|
16
40
|
if (!_inst) {
|
|
17
41
|
if (!_config)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.config.js","sourceRoot":"","sources":["../../src/config/firebase.config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAoB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AU,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,EAAE,EAClD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAC;QAEJ,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,IAAI,EAAE,aAAa;YACrB,wBAAwB,CACtB,SAAS,EACT,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,aAAa,IAAI,IAAI,CAC3B,CAAC;QAEJ,MAAM,cAAc,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAChD,KAAK,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -1,16 +1,49 @@
|
|
|
1
1
|
import type { DocumentData, FunctionRequest, FunctionResponse } from "@mxpicture/gcp-functions-common/types";
|
|
2
2
|
import { HttpsCallable } from "firebase/functions";
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base class for invoking a Firebase HTTPS callable cloud function.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Subclasses represent a single cloud function endpoint. Callers must register
|
|
8
|
+
* the available routes via {@link useRoutes} before calling {@link outgress}.
|
|
9
|
+
* Date fields in responses are automatically converted using `toDatesDeep`.
|
|
10
|
+
*/
|
|
3
11
|
export declare abstract class IFrontendFunction {
|
|
4
12
|
readonly name: string;
|
|
5
13
|
protected readonly datePaths: string[];
|
|
6
14
|
protected _routes?: string[];
|
|
7
15
|
protected _func?: HttpsCallable<FunctionRequest<any>, Promise<FunctionResponse<any>>, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new frontend function instance.
|
|
18
|
+
*
|
|
19
|
+
* @param name - The cloud function name as deployed in Firebase.
|
|
20
|
+
* @param datePaths - Dot-notation paths within the response data that should be converted to `Date` objects.
|
|
21
|
+
*/
|
|
8
22
|
constructor(name: string, datePaths: string[]);
|
|
23
|
+
/**
|
|
24
|
+
* Register the routes this function supports.
|
|
25
|
+
*
|
|
26
|
+
* @param routes - An array of route names or a record whose values are route names.
|
|
27
|
+
*/
|
|
9
28
|
useRoutes(routes: {
|
|
10
29
|
[key: string]: string;
|
|
11
30
|
} | string[]): void;
|
|
12
31
|
protected routes(): string[];
|
|
13
32
|
protected hasRoute(name: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Send a request to the cloud function and return the transformed response.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* The method validates that the requested route is registered, invokes the
|
|
38
|
+
* callable function, and converts date-typed fields in the response using
|
|
39
|
+
* the configured {@link datePaths}.
|
|
40
|
+
*
|
|
41
|
+
* @typeParam REQ - The request payload type.
|
|
42
|
+
* @typeParam RES - The expected response data type.
|
|
43
|
+
* @param request - The function request containing a route name and optional data.
|
|
44
|
+
* @returns A promise resolving to the function response with date fields converted.
|
|
45
|
+
* @throws {Error} If the requested route has not been registered via {@link useRoutes}.
|
|
46
|
+
*/
|
|
14
47
|
outgress<REQ, RES extends DocumentData>(request: FunctionRequest<REQ>): Promise<FunctionResponse<RES>>;
|
|
15
48
|
protected func(): HttpsCallable<FunctionRequest<any>, Promise<FunctionResponse<any>>, unknown>;
|
|
16
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrontendFunction.d.ts","sourceRoot":"","sources":["../../src/function/IFrontendFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAiB,MAAM,oBAAoB,CAAC;AAIlE,8BAAsB,iBAAiB;
|
|
1
|
+
{"version":3,"file":"IFrontendFunction.d.ts","sourceRoot":"","sources":["../../src/function/IFrontendFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAiB,MAAM,oBAAoB,CAAC;AAIlE;;;;;;;GAOG;AACH,8BAAsB,iBAAiB;aAkBnB,IAAI,EAAE,MAAM;IAC5B,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE;IAlBxC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B,SAAS,CAAC,KAAK,CAAC,EAAE,aAAa,CAE7B,eAAe,CAAC,GAAG,CAAC,EAEpB,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAC9B,OAAO,CACR,CAAC;IAEF;;;;;OAKG;gBAEe,IAAI,EAAE,MAAM,EACT,SAAS,EAAE,MAAM,EAAE;IAGxC;;;;OAIG;IACI,SAAS,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,MAAM,EAAE,GAAG,IAAI;IAIpE,SAAS,CAAC,MAAM,IAAI,MAAM,EAAE;IAQ5B,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;;;;;;;;;;OAaG;IACU,QAAQ,CAAC,GAAG,EAAE,GAAG,SAAS,YAAY,EACjD,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,GAC5B,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAQjC,SAAS,CAAC,IAAI,IAAI,aAAa,CAE7B,eAAe,CAAC,GAAG,CAAC,EAEpB,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAC9B,OAAO,CACR;CAKF"}
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import { httpsCallable } from "firebase/functions";
|
|
2
2
|
import { configFirebase } from "../config/firebase.config.js";
|
|
3
3
|
import { toDatesDeep } from "@mxpicture/gcp-functions-common/helper";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract base class for invoking a Firebase HTTPS callable cloud function.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Subclasses represent a single cloud function endpoint. Callers must register
|
|
9
|
+
* the available routes via {@link useRoutes} before calling {@link outgress}.
|
|
10
|
+
* Date fields in responses are automatically converted using `toDatesDeep`.
|
|
11
|
+
*/
|
|
4
12
|
export class IFrontendFunction {
|
|
5
13
|
name;
|
|
6
14
|
datePaths;
|
|
7
15
|
_routes;
|
|
8
16
|
_func;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new frontend function instance.
|
|
19
|
+
*
|
|
20
|
+
* @param name - The cloud function name as deployed in Firebase.
|
|
21
|
+
* @param datePaths - Dot-notation paths within the response data that should be converted to `Date` objects.
|
|
22
|
+
*/
|
|
9
23
|
constructor(name, datePaths) {
|
|
10
24
|
this.name = name;
|
|
11
25
|
this.datePaths = datePaths;
|
|
12
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Register the routes this function supports.
|
|
29
|
+
*
|
|
30
|
+
* @param routes - An array of route names or a record whose values are route names.
|
|
31
|
+
*/
|
|
13
32
|
useRoutes(routes) {
|
|
14
33
|
this._routes = Array.isArray(routes) ? routes : Object.values(routes);
|
|
15
34
|
}
|
|
@@ -21,6 +40,20 @@ export class IFrontendFunction {
|
|
|
21
40
|
hasRoute(name) {
|
|
22
41
|
return !!this.routes().find((m) => m === name);
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Send a request to the cloud function and return the transformed response.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* The method validates that the requested route is registered, invokes the
|
|
48
|
+
* callable function, and converts date-typed fields in the response using
|
|
49
|
+
* the configured {@link datePaths}.
|
|
50
|
+
*
|
|
51
|
+
* @typeParam REQ - The request payload type.
|
|
52
|
+
* @typeParam RES - The expected response data type.
|
|
53
|
+
* @param request - The function request containing a route name and optional data.
|
|
54
|
+
* @returns A promise resolving to the function response with date fields converted.
|
|
55
|
+
* @throws {Error} If the requested route has not been registered via {@link useRoutes}.
|
|
56
|
+
*/
|
|
24
57
|
async outgress(request) {
|
|
25
58
|
if (!this.hasRoute(request.route))
|
|
26
59
|
throw new Error(`Route ${request.route} not available`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrontendFunction.js","sourceRoot":"","sources":["../../src/function/IFrontendFunction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,OAAgB,iBAAiB;
|
|
1
|
+
{"version":3,"file":"IFrontendFunction.js","sourceRoot":"","sources":["../../src/function/IFrontendFunction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,OAAgB,iBAAiB;IAkBnB;IACG;IAlBX,OAAO,CAAY;IAEnB,KAAK,CAMb;IAEF;;;;;OAKG;IACH,YACkB,IAAY,EACT,SAAmB;QADtB,SAAI,GAAJ,IAAI,CAAQ;QACT,cAAS,GAAT,SAAS,CAAU;IACrC,CAAC;IAEJ;;;;OAIG;IACI,SAAS,CAAC,MAA4C;QAC3D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;IAES,MAAM;QACd,IAAI,CAAC,IAAI,CAAC,OAAO;YACf,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,IAAI,+CAA+C,CAC5D,CAAC;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAES,QAAQ,CAAC,IAAY;QAC7B,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,QAAQ,CACnB,OAA6B;QAE7B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,CAAC,KAAK,gBAAgB,CAAC,CAAC;QAE1D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAC7D,CAAC;IAES,IAAI;QAOZ,IAAI,CAAC,IAAI,CAAC,KAAK;YACb,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,cAAc,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate a Firebase Auth error code into a human-readable message.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* If no matching code is found the original code string is returned as-is.
|
|
6
|
+
*
|
|
7
|
+
* @param code - The Firebase Auth error code (e.g. `"auth/email-already-in-use"`), or `undefined`.
|
|
8
|
+
* @returns The friendly error text, the original code when unrecognised, or `undefined` when `code` is `undefined`.
|
|
9
|
+
*/
|
|
1
10
|
export declare const authErrorText: (code: string | undefined) => string | undefined;
|
|
2
11
|
//# sourceMappingURL=auth.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.helper.d.ts","sourceRoot":"","sources":["../../src/helper/auth.helper.ts"],"names":[],"mappings":"AAiQA,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SACR,CAAC"}
|
|
1
|
+
{"version":3,"file":"auth.helper.d.ts","sourceRoot":"","sources":["../../src/helper/auth.helper.ts"],"names":[],"mappings":"AAiQA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SACR,CAAC"}
|
|
@@ -248,5 +248,14 @@ const errorMessages = [
|
|
|
248
248
|
text: "Invalid Hosting Link Domain",
|
|
249
249
|
},
|
|
250
250
|
];
|
|
251
|
+
/**
|
|
252
|
+
* Translate a Firebase Auth error code into a human-readable message.
|
|
253
|
+
*
|
|
254
|
+
* @remarks
|
|
255
|
+
* If no matching code is found the original code string is returned as-is.
|
|
256
|
+
*
|
|
257
|
+
* @param code - The Firebase Auth error code (e.g. `"auth/email-already-in-use"`), or `undefined`.
|
|
258
|
+
* @returns The friendly error text, the original code when unrecognised, or `undefined` when `code` is `undefined`.
|
|
259
|
+
*/
|
|
251
260
|
export const authErrorText = (code) => errorMessages.find((e) => e.code === code)?.text ?? code;
|
|
252
261
|
//# sourceMappingURL=auth.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.helper.js","sourceRoot":"","sources":["../../src/helper/auth.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,CAAC,EAAE,MAAM,eAAe,CAAC;AAOpD,MAAM,aAAa,GAAe;IAChC;QACE,IAAI,EAAE,CAAC,CAAC,oBAAoB;QAC5B,IAAI,EAAE,4BAA4B;KACnC;IACD,EAAE,IAAI,EAAE,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAClD,EAAE,IAAI,EAAE,CAAC,CAAC,kBAAkB,EAAE,IAAI,EAAE,oBAAoB,EAAE;IAC1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yBAAyB;QACjC,IAAI,EAAE,2BAA2B;KAClC;IACD,EAAE,IAAI,EAAE,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACtD;QACE,IAAI,EAAE,CAAC,CAAC,2BAA2B;QACnC,IAAI,EAAE,6BAA6B;KACpC;CACF,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAwB,EAAsB,EAAE,CAC5E,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC"}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { ValidationResult, ValidationResultFields } from "@mxpicture/gcp-functions-common/types";
|
|
2
|
+
/**
|
|
3
|
+
* Attempt to extract a {@link ValidationResult} from an unknown value.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* If `data` is a `FunctionsError`, its `details` property is inspected recursively.
|
|
7
|
+
* The function returns `null` when the value does not conform to the expected shape.
|
|
8
|
+
*
|
|
9
|
+
* @param data - The value to inspect, typically an error or raw response payload.
|
|
10
|
+
* @returns The extracted validation result, or `null` if the value is not a valid result.
|
|
11
|
+
*/
|
|
2
12
|
export declare const guardValidationResult: (data: unknown) => ValidationResult | null;
|
|
13
|
+
/**
|
|
14
|
+
* Attempt to extract {@link ValidationResultFields} from an unknown value.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Only string array entries are kept for each field name; non-string values are silently skipped.
|
|
18
|
+
*
|
|
19
|
+
* @param fields - The value to inspect, expected to be a record of field names to string arrays.
|
|
20
|
+
* @returns The extracted validation result fields, or `null` if the value is not a valid fields object.
|
|
21
|
+
*/
|
|
3
22
|
export declare const guardValidationResultFields: (fields: unknown) => ValidationResultFields | null;
|
|
4
23
|
//# sourceMappingURL=validation.helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.helper.d.ts","sourceRoot":"","sources":["../../src/helper/validation.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAG/C,eAAO,MAAM,qBAAqB,GAChC,MAAM,OAAO,KACZ,gBAAgB,GAAG,IAerB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,QAAQ,OAAO,KACd,sBAAsB,GAAG,IAc3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation.helper.d.ts","sourceRoot":"","sources":["../../src/helper/validation.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,uCAAuC,CAAC;AAG/C;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,OAAO,KACZ,gBAAgB,GAAG,IAerB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,OAAO,KACd,sBAAsB,GAAG,IAc3B,CAAC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { FunctionsError } from "firebase/functions";
|
|
2
|
+
/**
|
|
3
|
+
* Attempt to extract a {@link ValidationResult} from an unknown value.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* If `data` is a `FunctionsError`, its `details` property is inspected recursively.
|
|
7
|
+
* The function returns `null` when the value does not conform to the expected shape.
|
|
8
|
+
*
|
|
9
|
+
* @param data - The value to inspect, typically an error or raw response payload.
|
|
10
|
+
* @returns The extracted validation result, or `null` if the value is not a valid result.
|
|
11
|
+
*/
|
|
2
12
|
export const guardValidationResult = (data) => {
|
|
3
13
|
if (data instanceof FunctionsError)
|
|
4
14
|
return guardValidationResult(data.details);
|
|
@@ -14,6 +24,15 @@ export const guardValidationResult = (data) => {
|
|
|
14
24
|
}
|
|
15
25
|
: null;
|
|
16
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Attempt to extract {@link ValidationResultFields} from an unknown value.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Only string array entries are kept for each field name; non-string values are silently skipped.
|
|
32
|
+
*
|
|
33
|
+
* @param fields - The value to inspect, expected to be a record of field names to string arrays.
|
|
34
|
+
* @returns The extracted validation result fields, or `null` if the value is not a valid fields object.
|
|
35
|
+
*/
|
|
17
36
|
export const guardValidationResultFields = (fields) => {
|
|
18
37
|
if (!fields || typeof fields !== "object" || Array.isArray(fields))
|
|
19
38
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.helper.js","sourceRoot":"","sources":["../../src/helper/validation.helper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,IAAa,EACY,EAAE;IAC3B,IAAI,IAAI,YAAY,cAAc;QAChC,OAAO,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAE9C,MAAM,QAAQ,GAAG,IAAiC,CAAC;IACnD,IAAI,CAAC,QAAQ,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,WAAW,GAAG,2BAA2B,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACtE,OAAO,WAAW;QAChB,CAAC,CAAC;YACE,WAAW;SACZ;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,MAAe,EACgB,EAAE;IACjC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAChE,OAAO,IAAI,CAAC;IAEd,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAK,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AI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAChE,OAAO,IAAI,CAAC;IAEd,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,SAAS;QAEpD,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,OAAO,IAAI,QAAQ;YAC5B,IAAI,OAAO,OAAO,KAAK,QAAQ;gBAAE,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazily load the `firebase/auth` module.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The import is cached so subsequent calls return the same promise.
|
|
6
|
+
*
|
|
7
|
+
* @returns A promise resolving to the `firebase/auth` module.
|
|
8
|
+
*/
|
|
1
9
|
export declare const loadFirebaseAuth: () => Promise<typeof import("firebase/auth")>;
|
|
10
|
+
/**
|
|
11
|
+
* Lazily load the `firebase/app` module.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* The import is cached so subsequent calls return the same promise.
|
|
15
|
+
*
|
|
16
|
+
* @returns A promise resolving to the `firebase/app` module.
|
|
17
|
+
*/
|
|
2
18
|
export declare const loadFirebaseApp: () => Promise<typeof import("firebase/app")>;
|
|
19
|
+
/**
|
|
20
|
+
* Lazily load the `firebase/functions` module.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The import is cached so subsequent calls return the same promise.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise resolving to the `firebase/functions` module.
|
|
26
|
+
*/
|
|
3
27
|
export declare const loadFirebaseFunctions: () => Promise<typeof import("firebase/functions")>;
|
|
4
28
|
//# sourceMappingURL=firebase.loader.d.ts.map
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"firebase.loader.d.ts","sourceRoot":"","sources":["../../src/loader/firebase.loader.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,+CAG5B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,8CAG3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,oDAGjC,CAAC"}
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
let authPromise = null;
|
|
2
2
|
let appPromise = null;
|
|
3
3
|
let functionsPromise = null;
|
|
4
|
+
/**
|
|
5
|
+
* Lazily load the `firebase/auth` module.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The import is cached so subsequent calls return the same promise.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise resolving to the `firebase/auth` module.
|
|
11
|
+
*/
|
|
4
12
|
export const loadFirebaseAuth = () => {
|
|
5
13
|
if (!authPromise)
|
|
6
14
|
authPromise = import("firebase/auth");
|
|
7
15
|
return authPromise;
|
|
8
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Lazily load the `firebase/app` module.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* The import is cached so subsequent calls return the same promise.
|
|
22
|
+
*
|
|
23
|
+
* @returns A promise resolving to the `firebase/app` module.
|
|
24
|
+
*/
|
|
9
25
|
export const loadFirebaseApp = () => {
|
|
10
26
|
if (!appPromise)
|
|
11
27
|
appPromise = import("firebase/app");
|
|
12
28
|
return appPromise;
|
|
13
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Lazily load the `firebase/functions` module.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The import is cached so subsequent calls return the same promise.
|
|
35
|
+
*
|
|
36
|
+
* @returns A promise resolving to the `firebase/functions` module.
|
|
37
|
+
*/
|
|
14
38
|
export const loadFirebaseFunctions = () => {
|
|
15
39
|
if (!functionsPromise)
|
|
16
40
|
functionsPromise = import("firebase/functions");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.loader.js","sourceRoot":"","sources":["../../src/loader/firebase.loader.ts"],"names":[],"mappings":"AAAA,IAAI,WAAW,GAAmD,IAAI,CAAC;AACvE,IAAI,UAAU,GAAkD,IAAI,CAAC;AACrE,IAAI,gBAAgB,GAClB,IAAI,CAAC;AAEP,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,IAAI,CAAC,WAAW;QAAE,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;IACxD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,UAAU;QAAE,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAI,CAAC,gBAAgB;QAAE,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"firebase.loader.js","sourceRoot":"","sources":["../../src/loader/firebase.loader.ts"],"names":[],"mappings":"AAAA,IAAI,WAAW,GAAmD,IAAI,CAAC;AACvE,IAAI,UAAU,GAAkD,IAAI,CAAC;AACrE,IAAI,gBAAgB,GAClB,IAAI,CAAC;AAEP;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,IAAI,CAAC,WAAW;QAAE,WAAW,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;IACxD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,UAAU;QAAE,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,IAAI,CAAC,gBAAgB;QAAE,gBAAgB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACvE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -1,15 +1,65 @@
|
|
|
1
1
|
import type { AuthUser, LoginCredentials, RegisterCredentials } from "../../types/auth.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Service encapsulating Firebase Authentication operations.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* All methods translate Firebase-specific errors into plain `Error` instances
|
|
7
|
+
* with human-readable messages via {@link authErrorText}.
|
|
8
|
+
*/
|
|
2
9
|
declare class AuthService {
|
|
10
|
+
/**
|
|
11
|
+
* Sign in a user with email and password credentials.
|
|
12
|
+
*
|
|
13
|
+
* @param credentials - The login credentials containing email and password.
|
|
14
|
+
* @returns A promise resolving to the authenticated user.
|
|
15
|
+
* @throws {Error} If authentication fails (e.g. wrong password, user not found).
|
|
16
|
+
*/
|
|
3
17
|
login(credentials: LoginCredentials): Promise<AuthUser>;
|
|
18
|
+
/**
|
|
19
|
+
* Sign in a user via a Google sign-in popup.
|
|
20
|
+
*
|
|
21
|
+
* @returns A promise resolving to the authenticated user.
|
|
22
|
+
* @throws {Error} If the popup is closed or authentication fails.
|
|
23
|
+
*/
|
|
4
24
|
loginWithGoogle(): Promise<AuthUser>;
|
|
25
|
+
/**
|
|
26
|
+
* Register a new user with email and password.
|
|
27
|
+
*
|
|
28
|
+
* @param credentials - The registration credentials including email, password, and profile info.
|
|
29
|
+
* @returns A promise resolving to the newly created authenticated user.
|
|
30
|
+
* @throws {Error} If registration fails (e.g. email already in use, weak password).
|
|
31
|
+
*/
|
|
5
32
|
register(credentials: RegisterCredentials): Promise<AuthUser>;
|
|
33
|
+
/**
|
|
34
|
+
* Sign out the currently authenticated user.
|
|
35
|
+
*
|
|
36
|
+
* @throws {Error} If sign-out fails.
|
|
37
|
+
*/
|
|
6
38
|
logout(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Send a password-reset email to the specified address.
|
|
41
|
+
*
|
|
42
|
+
* @param email - The email address of the user requesting a password reset.
|
|
43
|
+
* @throws {Error} If the reset email cannot be sent.
|
|
44
|
+
*/
|
|
7
45
|
resetPassword(email: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Subscribe to authentication state changes.
|
|
48
|
+
*
|
|
49
|
+
* @param callback - Invoked with the current {@link AuthUser} or `null` on sign-out.
|
|
50
|
+
* @returns A promise resolving to an unsubscribe function.
|
|
51
|
+
*/
|
|
8
52
|
onAuthStateChanged(callback: (user: AuthUser | null) => void): Promise<() => void>;
|
|
53
|
+
/**
|
|
54
|
+
* Return the currently signed-in user, if any.
|
|
55
|
+
*
|
|
56
|
+
* @returns The current {@link AuthUser}, or `null` if no user is signed in.
|
|
57
|
+
*/
|
|
9
58
|
getCurrentUser(): Promise<AuthUser | null>;
|
|
10
59
|
private mapFirebaseUserToAuthUser;
|
|
11
60
|
private handleAuthError;
|
|
12
61
|
}
|
|
62
|
+
/** Shared singleton instance of the {@link AuthService}. */
|
|
13
63
|
export declare const authService: AuthService;
|
|
14
64
|
export {};
|
|
15
65
|
//# sourceMappingURL=auth.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/services/firebase/auth.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAInC,cAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../src/services/firebase/auth.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAInC;;;;;;GAMG;AACH,cAAM,WAAW;IACf;;;;;;OAMG;IACG,KAAK,CAAC,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAa7D;;;;;OAKG;IACG,eAAe,IAAI,OAAO,CAAC,QAAQ,CAAC;IAa1C;;;;;;OAMG;IACG,QAAQ,CAAC,WAAW,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkBnE;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ7B;;;;;OAKG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD;;;;;OAKG;IACG,kBAAkB,CACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,GACxC,OAAO,CAAC,MAAM,IAAI,CAAC;IAMtB;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAKhD,OAAO,CAAC,yBAAyB;IAcjC,OAAO,CAAC,eAAe;CAMxB;AAED,4DAA4D;AAC5D,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { createUserWithEmailAndPassword, onAuthStateChanged, sendPasswordResetEmail, signInWithEmailAndPassword, signInWithPopup, signOut, } from "firebase/auth";
|
|
2
2
|
import { configFirebase } from "../../config/firebase.config.js";
|
|
3
3
|
import { authErrorText } from "../../helper/auth.helper.js";
|
|
4
|
+
/**
|
|
5
|
+
* Service encapsulating Firebase Authentication operations.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* All methods translate Firebase-specific errors into plain `Error` instances
|
|
9
|
+
* with human-readable messages via {@link authErrorText}.
|
|
10
|
+
*/
|
|
4
11
|
class AuthService {
|
|
12
|
+
/**
|
|
13
|
+
* Sign in a user with email and password credentials.
|
|
14
|
+
*
|
|
15
|
+
* @param credentials - The login credentials containing email and password.
|
|
16
|
+
* @returns A promise resolving to the authenticated user.
|
|
17
|
+
* @throws {Error} If authentication fails (e.g. wrong password, user not found).
|
|
18
|
+
*/
|
|
5
19
|
async login(credentials) {
|
|
6
20
|
try {
|
|
7
21
|
const { user } = await signInWithEmailAndPassword(configFirebase().auth, credentials.email, credentials.password);
|
|
@@ -11,6 +25,12 @@ class AuthService {
|
|
|
11
25
|
throw this.handleAuthError(error);
|
|
12
26
|
}
|
|
13
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Sign in a user via a Google sign-in popup.
|
|
30
|
+
*
|
|
31
|
+
* @returns A promise resolving to the authenticated user.
|
|
32
|
+
* @throws {Error} If the popup is closed or authentication fails.
|
|
33
|
+
*/
|
|
14
34
|
async loginWithGoogle() {
|
|
15
35
|
try {
|
|
16
36
|
const config = configFirebase();
|
|
@@ -21,6 +41,13 @@ class AuthService {
|
|
|
21
41
|
throw this.handleAuthError(error);
|
|
22
42
|
}
|
|
23
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Register a new user with email and password.
|
|
46
|
+
*
|
|
47
|
+
* @param credentials - The registration credentials including email, password, and profile info.
|
|
48
|
+
* @returns A promise resolving to the newly created authenticated user.
|
|
49
|
+
* @throws {Error} If registration fails (e.g. email already in use, weak password).
|
|
50
|
+
*/
|
|
24
51
|
async register(credentials) {
|
|
25
52
|
try {
|
|
26
53
|
const { user } = await createUserWithEmailAndPassword(configFirebase().auth, credentials.email, credentials.password);
|
|
@@ -33,6 +60,11 @@ class AuthService {
|
|
|
33
60
|
throw this.handleAuthError(error);
|
|
34
61
|
}
|
|
35
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Sign out the currently authenticated user.
|
|
65
|
+
*
|
|
66
|
+
* @throws {Error} If sign-out fails.
|
|
67
|
+
*/
|
|
36
68
|
async logout() {
|
|
37
69
|
try {
|
|
38
70
|
await signOut(configFirebase().auth);
|
|
@@ -41,6 +73,12 @@ class AuthService {
|
|
|
41
73
|
throw this.handleAuthError(error);
|
|
42
74
|
}
|
|
43
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Send a password-reset email to the specified address.
|
|
78
|
+
*
|
|
79
|
+
* @param email - The email address of the user requesting a password reset.
|
|
80
|
+
* @throws {Error} If the reset email cannot be sent.
|
|
81
|
+
*/
|
|
44
82
|
async resetPassword(email) {
|
|
45
83
|
try {
|
|
46
84
|
await sendPasswordResetEmail(configFirebase().auth, email);
|
|
@@ -49,11 +87,22 @@ class AuthService {
|
|
|
49
87
|
throw this.handleAuthError(error);
|
|
50
88
|
}
|
|
51
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Subscribe to authentication state changes.
|
|
92
|
+
*
|
|
93
|
+
* @param callback - Invoked with the current {@link AuthUser} or `null` on sign-out.
|
|
94
|
+
* @returns A promise resolving to an unsubscribe function.
|
|
95
|
+
*/
|
|
52
96
|
async onAuthStateChanged(callback) {
|
|
53
97
|
return onAuthStateChanged(configFirebase().auth, (user) => {
|
|
54
98
|
callback(user ? this.mapFirebaseUserToAuthUser(user) : null);
|
|
55
99
|
});
|
|
56
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Return the currently signed-in user, if any.
|
|
103
|
+
*
|
|
104
|
+
* @returns The current {@link AuthUser}, or `null` if no user is signed in.
|
|
105
|
+
*/
|
|
57
106
|
async getCurrentUser() {
|
|
58
107
|
const user = configFirebase().auth.currentUser;
|
|
59
108
|
return user ? this.mapFirebaseUserToAuthUser(user) : null;
|
|
@@ -77,5 +126,6 @@ class AuthService {
|
|
|
77
126
|
return new Error(message);
|
|
78
127
|
}
|
|
79
128
|
}
|
|
129
|
+
/** Shared singleton instance of the {@link AuthService}. */
|
|
80
130
|
export const authService = new AuthService();
|
|
81
131
|
//# sourceMappingURL=auth.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/services/firebase/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,OAAO,GAER,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW;IACf,KAAK,CAAC,KAAK,CAAC,WAA6B;QACvC,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,CAC/C,cAAc,EAAE,CAAC,IAAI,EACrB,WAAW,CAAC,KAAK,EACjB,WAAW,CAAC,QAAQ,CACrB,CAAC;YACF,OAAO,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;YAChC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,eAAe,CACpC,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,cAAc,CACtB,CAAC;YACF,OAAO,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC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,EAAE,IAAI,CAAC,QAAQ,EAAE,YAAY;gBACpC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;gBACtC,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;IAED,8DAA8D;IACtD,eAAe,CAAC,KAAU;QAChC,qDAAqD;QACrD,MAAM,OAAO,GACX,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC;QACrE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -1,28 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials required for email/password login.
|
|
3
|
+
*/
|
|
1
4
|
export interface LoginCredentials {
|
|
5
|
+
/** The user's email address. */
|
|
2
6
|
email: string;
|
|
7
|
+
/** The user's password. */
|
|
3
8
|
password: string;
|
|
9
|
+
/** When `true`, the session is persisted across browser restarts. */
|
|
4
10
|
rememberMe?: boolean;
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Credentials required for new user registration.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Extends {@link LoginCredentials} with additional profile and confirmation fields.
|
|
17
|
+
*/
|
|
6
18
|
export interface RegisterCredentials extends LoginCredentials {
|
|
19
|
+
/** The user's first name. */
|
|
7
20
|
firstName: string;
|
|
21
|
+
/** The user's last name. */
|
|
8
22
|
lastName: string;
|
|
23
|
+
/** Must match {@link LoginCredentials.password} for confirmation. */
|
|
9
24
|
confirmPassword: string;
|
|
10
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Represents an authenticated user's profile information.
|
|
28
|
+
*/
|
|
11
29
|
export interface AuthUser {
|
|
30
|
+
/** The unique Firebase user identifier. */
|
|
12
31
|
uid: string;
|
|
32
|
+
/** The user's email address, or `null` if unavailable. */
|
|
13
33
|
email: string | null;
|
|
34
|
+
/** The user's display name, or `null` if not set. */
|
|
14
35
|
displayName: string | null;
|
|
36
|
+
/** URL of the user's profile photo, or `null` if not set. */
|
|
15
37
|
photoURL: string | null;
|
|
38
|
+
/** Whether the user's email address has been verified. */
|
|
16
39
|
emailVerified: boolean;
|
|
40
|
+
/** The date the user account was created. */
|
|
17
41
|
createdAt?: Date;
|
|
18
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Represents the current authentication state of the application.
|
|
45
|
+
*/
|
|
19
46
|
export interface AuthState {
|
|
47
|
+
/** The currently signed-in user, or `null` if unauthenticated. */
|
|
20
48
|
user: AuthUser | null;
|
|
49
|
+
/** Whether a user is currently authenticated. */
|
|
21
50
|
isAuthenticated: boolean;
|
|
51
|
+
/** Whether an authentication operation is in progress. */
|
|
22
52
|
isLoading: boolean;
|
|
53
|
+
/** The most recent authentication error message, or `null`. */
|
|
23
54
|
error: string | null;
|
|
24
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Payload for a password-reset request.
|
|
58
|
+
*/
|
|
25
59
|
export interface PasswordReset {
|
|
60
|
+
/** The email address to send the password-reset link to. */
|
|
26
61
|
email: string;
|
|
27
62
|
}
|
|
28
63
|
//# sourceMappingURL=auth.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/types/auth.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,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6C;IAC7C,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,kEAAkE;IAClE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,iDAAiD;IACjD,eAAe,EAAE,OAAO,CAAC;IACzB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration object for initializing a Firebase application.
|
|
3
|
+
*/
|
|
1
4
|
export interface FirebaseConfig {
|
|
5
|
+
/** The Firebase Web API key. */
|
|
2
6
|
apiKey: string;
|
|
7
|
+
/** The Auth domain used for OAuth redirects (e.g. `"my-app.firebaseapp.com"`). */
|
|
3
8
|
authDomain: string;
|
|
9
|
+
/** The Firebase project identifier. */
|
|
4
10
|
projectId: string;
|
|
11
|
+
/** The Cloud Storage bucket name. */
|
|
5
12
|
storageBucket: string;
|
|
13
|
+
/** The sender ID for Firebase Cloud Messaging. */
|
|
6
14
|
messagingSenderId: string;
|
|
15
|
+
/** The Firebase application identifier. */
|
|
7
16
|
appId: string;
|
|
8
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Base shape for a Firestore document including common metadata fields.
|
|
20
|
+
*/
|
|
9
21
|
export interface FirestoreDocument {
|
|
22
|
+
/** The unique document identifier. */
|
|
10
23
|
id: string;
|
|
24
|
+
/** Timestamp when the document was created. */
|
|
11
25
|
createdAt: Date;
|
|
26
|
+
/** Timestamp when the document was last updated. */
|
|
12
27
|
updatedAt: Date;
|
|
13
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for connecting to Firebase emulators during local development.
|
|
31
|
+
*/
|
|
14
32
|
export interface FirebaseEmulatorConfig {
|
|
33
|
+
/** Hostname of the Auth emulator (e.g. `"localhost"`). */
|
|
15
34
|
authHost?: string;
|
|
35
|
+
/** Port of the Auth emulator. Defaults to `9099` when omitted. */
|
|
16
36
|
authPort?: number;
|
|
37
|
+
/** Hostname of the Functions emulator (e.g. `"localhost"`). */
|
|
17
38
|
functionsHost?: string;
|
|
39
|
+
/** Port of the Functions emulator. Defaults to `5001` when omitted. */
|
|
18
40
|
functionsPort?: number;
|
|
19
41
|
}
|
|
20
42
|
//# sourceMappingURL=firebase.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.types.d.ts","sourceRoot":"","sources":["../../src/types/firebase.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
1
|
+
{"version":3,"file":"firebase.types.d.ts","sourceRoot":"","sources":["../../src/types/firebase.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,SAAS,EAAE,IAAI,CAAC;IAChB,oDAAoD;IACpD,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mxpicture/gcp-functions-frontend",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Utils for google cloud functions, publishing both CommonJS and ESM builds",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MXPicture",
|
|
@@ -27,13 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --ext .ts,.tsx",
|
|
30
|
-
"build": "tsc -b ."
|
|
30
|
+
"build": "tsc -b .",
|
|
31
|
+
"docs": "typedoc",
|
|
32
|
+
"docs:clean": "rm -rf docs"
|
|
31
33
|
},
|
|
32
34
|
"publishConfig": {
|
|
33
35
|
"access": "public"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@mxpicture/gcp-functions-common": "^1.1.
|
|
38
|
+
"@mxpicture/gcp-functions-common": "^1.1.4",
|
|
37
39
|
"firebase": "^12.9.0"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|