@quatrain/cloudwrapper-firebase 1.1.25 → 1.2.1
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.
|
@@ -8,10 +8,28 @@ export type FirebaseParams = {
|
|
|
8
8
|
projectId?: string;
|
|
9
9
|
serviceAccount?: string;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Concrete implementation adapting Firebase / Google Cloud platform functions and triggers.
|
|
13
|
+
*/
|
|
11
14
|
export declare class FirebaseCloudWrapper extends AbstractCloudWrapper {
|
|
12
15
|
protected _isInitialized: boolean;
|
|
13
16
|
constructor(params: FirebaseParams);
|
|
17
|
+
/**
|
|
18
|
+
* Registers a new Firebase HTTPS/HTTP function.
|
|
19
|
+
*
|
|
20
|
+
* @param func - The cloud function handler logic.
|
|
21
|
+
* @param params - Resource options (memory, timeout).
|
|
22
|
+
* @returns The constructed HTTPS function.
|
|
23
|
+
*/
|
|
14
24
|
httpsTrigger(func: any, params?: HttpsOptions): HttpsFunction;
|
|
25
|
+
/**
|
|
26
|
+
* Registers a Firebase Storage finalized trigger.
|
|
27
|
+
*
|
|
28
|
+
* @param func - The execution callback payload.
|
|
29
|
+
* @param eventType - Event tracking action (e.g. CREATE).
|
|
30
|
+
* @returns The generated CloudFunction event handler.
|
|
31
|
+
* @throws {Error} If action type is unknown.
|
|
32
|
+
*/
|
|
15
33
|
storageTrigger(func: any, eventType: BackendAction): CloudFunction<import("firebase-functions/v2/storage").StorageEvent>;
|
|
16
34
|
protected _initialize(): void;
|
|
17
35
|
}
|
|
@@ -17,6 +17,9 @@ const v2_1 = require("firebase-functions/v2");
|
|
|
17
17
|
const storage_1 = require("firebase-functions/v2/storage");
|
|
18
18
|
const cloudwrapper_1 = require("@quatrain/cloudwrapper");
|
|
19
19
|
const backend_1 = require("@quatrain/backend");
|
|
20
|
+
/**
|
|
21
|
+
* Concrete implementation adapting Firebase / Google Cloud platform functions and triggers.
|
|
22
|
+
*/
|
|
20
23
|
class FirebaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
|
|
21
24
|
constructor(params) {
|
|
22
25
|
super(params);
|
|
@@ -26,6 +29,13 @@ class FirebaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
|
|
|
26
29
|
(0, v2_1.setGlobalOptions)({ region: region.join(',') });
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Registers a new Firebase HTTPS/HTTP function.
|
|
34
|
+
*
|
|
35
|
+
* @param func - The cloud function handler logic.
|
|
36
|
+
* @param params - Resource options (memory, timeout).
|
|
37
|
+
* @returns The constructed HTTPS function.
|
|
38
|
+
*/
|
|
29
39
|
httpsTrigger(func, params = { memory: '4GiB', timeoutSeconds: 500 }) {
|
|
30
40
|
this._initialize();
|
|
31
41
|
return (0, https_1.onRequest)(Object.assign({ concurrency: 500 }, params), func);
|
|
@@ -45,6 +55,14 @@ class FirebaseCloudWrapper extends cloudwrapper_1.AbstractCloudWrapper {
|
|
|
45
55
|
// throw new Error(`Unknown event type '${trigger.event}'`)
|
|
46
56
|
// }
|
|
47
57
|
// }
|
|
58
|
+
/**
|
|
59
|
+
* Registers a Firebase Storage finalized trigger.
|
|
60
|
+
*
|
|
61
|
+
* @param func - The execution callback payload.
|
|
62
|
+
* @param eventType - Event tracking action (e.g. CREATE).
|
|
63
|
+
* @returns The generated CloudFunction event handler.
|
|
64
|
+
* @throws {Error} If action type is unknown.
|
|
65
|
+
*/
|
|
48
66
|
storageTrigger(func, eventType) {
|
|
49
67
|
this._initialize();
|
|
50
68
|
switch (eventType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/cloudwrapper-firebase",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"description": "Cloud Wrapper adapter for Firebase",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"author": "Quatrain Développement SAS <developers@quatrain.com>",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@quatrain/core": "^1.
|
|
23
|
+
"@quatrain/core": "^1.2.5"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@quatrain/backend": "^1.
|
|
27
|
-
"@quatrain/cloudwrapper": "^1.1
|
|
28
|
-
"@quatrain/core": "^1.
|
|
26
|
+
"@quatrain/backend": "^1.2.7",
|
|
27
|
+
"@quatrain/cloudwrapper": "^1.2.1",
|
|
28
|
+
"@quatrain/core": "^1.2.5",
|
|
29
29
|
"firebase-admin": "^13.4.0",
|
|
30
30
|
"firebase-functions": "^6.4.0"
|
|
31
31
|
},
|
|
@@ -46,5 +46,8 @@
|
|
|
46
46
|
"build": "tsc",
|
|
47
47
|
"wbuild": "tsc --watch",
|
|
48
48
|
"bump-to": "yarn version"
|
|
49
|
+
},
|
|
50
|
+
"typedoc": {
|
|
51
|
+
"entryPoint": "src/index.ts"
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -27,6 +27,9 @@ export type FirebaseParams = {
|
|
|
27
27
|
serviceAccount?: string
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Concrete implementation adapting Firebase / Google Cloud platform functions and triggers.
|
|
32
|
+
*/
|
|
30
33
|
export class FirebaseCloudWrapper extends AbstractCloudWrapper {
|
|
31
34
|
protected _isInitialized = false
|
|
32
35
|
|
|
@@ -38,6 +41,13 @@ export class FirebaseCloudWrapper extends AbstractCloudWrapper {
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Registers a new Firebase HTTPS/HTTP function.
|
|
46
|
+
*
|
|
47
|
+
* @param func - The cloud function handler logic.
|
|
48
|
+
* @param params - Resource options (memory, timeout).
|
|
49
|
+
* @returns The constructed HTTPS function.
|
|
50
|
+
*/
|
|
41
51
|
httpsTrigger(
|
|
42
52
|
func: any,
|
|
43
53
|
params: HttpsOptions = { memory: '4GiB', timeoutSeconds: 500 }
|
|
@@ -68,6 +78,14 @@ export class FirebaseCloudWrapper extends AbstractCloudWrapper {
|
|
|
68
78
|
// }
|
|
69
79
|
// }
|
|
70
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Registers a Firebase Storage finalized trigger.
|
|
83
|
+
*
|
|
84
|
+
* @param func - The execution callback payload.
|
|
85
|
+
* @param eventType - Event tracking action (e.g. CREATE).
|
|
86
|
+
* @returns The generated CloudFunction event handler.
|
|
87
|
+
* @throws {Error} If action type is unknown.
|
|
88
|
+
*/
|
|
71
89
|
storageTrigger(func: any, eventType: BackendAction) {
|
|
72
90
|
this._initialize()
|
|
73
91
|
switch (eventType) {
|