@mxpicture/gcp-functions-common 1.3.17 → 1.3.19
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/config/index.d.ts +0 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +1 -1
- package/dist/decorator/deco.names.d.ts +2 -0
- package/dist/decorator/deco.names.d.ts.map +1 -1
- package/dist/decorator/deco.names.js +2 -0
- package/dist/decorator/deco.names.js.map +1 -1
- package/dist/types/types.function.d.ts +0 -7
- package/dist/types/types.function.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/config/config.function.d.ts +0 -8
- package/dist/config/config.function.d.ts.map +0 -1
- package/dist/config/config.function.js +0 -40
- package/dist/config/config.function.js.map +0 -1
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC"}
|
package/dist/config/index.js
CHANGED
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,cAAc,iBAAiB,CAAC"}
|
|
@@ -27,8 +27,10 @@ export interface DecoNames {
|
|
|
27
27
|
routesName: string;
|
|
28
28
|
/** API client name. */
|
|
29
29
|
api: string;
|
|
30
|
+
apiInterface: string;
|
|
30
31
|
/** Cloud function name. */
|
|
31
32
|
func: string;
|
|
33
|
+
funcInterface: string;
|
|
32
34
|
/** Store module name. */
|
|
33
35
|
store: string;
|
|
34
36
|
/** Shape type name. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deco.names.d.ts","sourceRoot":"","sources":["../../src/decorator/deco.names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,WAAW,EAAE,eAAe,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"deco.names.d.ts","sourceRoot":"","sources":["../../src/decorator/deco.names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,WAAW,EAAE,eAAe,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;CACtB;AAwBD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAEhB,CAAC,MAAM,SAAS,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deco.names.js","sourceRoot":"","sources":["../../src/decorator/deco.names.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deco.names.js","sourceRoot":"","sources":["../../src/decorator/deco.names.ts"],"names":[],"mappings":"AAiDA,MAAM,SAAS,GAAwB;IACrC,WAAW,EAAE,SAAU;IACvB,QAAQ,EAAE,SAAU;IACpB,aAAa,EAAE,SAAU;IACzB,aAAa,EAAE,SAAU;IACzB,GAAG,EAAE,SAAU;IACf,QAAQ,EAAE,SAAU;IACpB,cAAc,EAAE,SAAU;IAC1B,MAAM,EAAE,SAAU;IAClB,UAAU,EAAE,SAAU;IACtB,GAAG,EAAE,SAAU;IACf,YAAY,EAAE,SAAU;IACxB,IAAI,EAAE,SAAU;IAChB,aAAa,EAAE,SAAU;IACzB,KAAK,EAAE,SAAU;IACjB,KAAK,EAAE,SAAU;IACjB,MAAM,EAAE,SAAU;IAClB,WAAW,EAAE,SAAU;IACvB,WAAW,EAAE,SAAU;IACvB,YAAY,EAAE,SAAU;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAC5C,SAAS,CACwB,CAAC"}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type { DocumentData } from "./types.document.js";
|
|
2
1
|
import type { RoutesMap } from "./types.routes.js";
|
|
3
|
-
export interface FunctionRequestHeaders {
|
|
4
|
-
taskId?: string;
|
|
5
|
-
taskStatus?: string;
|
|
6
|
-
}
|
|
7
2
|
/**
|
|
8
3
|
* Typed request payload for a callable cloud function.
|
|
9
4
|
*
|
|
@@ -14,7 +9,6 @@ export interface FunctionRequest<DOC> {
|
|
|
14
9
|
route: string;
|
|
15
10
|
/** The request payload. */
|
|
16
11
|
data: DOC;
|
|
17
|
-
headers?: FunctionRequestHeaders;
|
|
18
12
|
}
|
|
19
13
|
/**
|
|
20
14
|
* Typed response envelope returned by a callable cloud function.
|
|
@@ -35,5 +29,4 @@ export interface FunctionResponse<DOC> {
|
|
|
35
29
|
export type FunctionFromRoutes<R extends RoutesMap> = {
|
|
36
30
|
[K in keyof R]: (request: R[K]["request"]) => Promise<FunctionResponse<R[K]["response"]>>;
|
|
37
31
|
};
|
|
38
|
-
export type FunctionIngressFollowup = <FUNC, REQ, RES extends DocumentData>(func: FUNC, state: "success" | "error", request: FunctionRequest<REQ>, response: FunctionResponse<RES> | null) => Promise<void>;
|
|
39
32
|
//# sourceMappingURL=types.function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.function.d.ts","sourceRoot":"","sources":["../../src/types/types.function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.function.d.ts","sourceRoot":"","sources":["../../src/types/types.function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,GAAG;IAClC,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,GAAG;IACnC,4BAA4B;IAC5B,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,SAAS,IAAI;KACnD,CAAC,IAAI,MAAM,CAAC,GAAG,CACd,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KACrB,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FunctionRequestHeaders } from "../types/types.function.js";
|
|
2
|
-
export declare const functionRequestHeaders: Required<FunctionRequestHeaders>;
|
|
3
|
-
export declare const getFunctionRequestHeaderMap: () => Map<keyof FunctionRequestHeaders, string>;
|
|
4
|
-
export declare const toHttpHeaderKey: (key: keyof FunctionRequestHeaders) => string | null;
|
|
5
|
-
export declare const fromHttpHeaderKey: (key: string) => keyof FunctionRequestHeaders | null;
|
|
6
|
-
export declare const mapHttpToFunctionHeaders: (httpHeaders: Record<string, string | string[] | undefined>) => FunctionRequestHeaders;
|
|
7
|
-
export declare const enrichHttpHeaders: (functionHeaders: FunctionRequestHeaders, httpHeaders: Record<string, string | string[] | undefined>) => void;
|
|
8
|
-
//# sourceMappingURL=config.function.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.function.d.ts","sourceRoot":"","sources":["../../src/config/config.function.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB,CAGnE,CAAC;AAIF,eAAO,MAAM,2BAA2B,QAAO,GAAG,CAChD,MAAM,sBAAsB,EAC5B,MAAM,CAQP,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,sBAAsB,KAChC,MAAM,GAAG,IAAsD,CAAC;AAEnE,eAAO,MAAM,iBAAiB,GAC5B,KAAK,MAAM,KACV,MAAM,sBAAsB,GAAG,IAG0B,CAAC;AAE7D,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,KACzD,sBAWF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,iBAAiB,sBAAsB,EACvC,aAAa,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,KACzD,IAOF,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { kebabCase, upperFirstLetter } from "../helper/helper.string.js";
|
|
2
|
-
export const functionRequestHeaders = {
|
|
3
|
-
taskId: undefined,
|
|
4
|
-
taskStatus: undefined,
|
|
5
|
-
};
|
|
6
|
-
let _keyMap = null;
|
|
7
|
-
export const getFunctionRequestHeaderMap = () => {
|
|
8
|
-
if (!_keyMap) {
|
|
9
|
-
_keyMap = new Map();
|
|
10
|
-
for (const key of Object.keys(functionRequestHeaders))
|
|
11
|
-
_keyMap.set(key, kebabCase(`X${upperFirstLetter(key)}`));
|
|
12
|
-
}
|
|
13
|
-
return _keyMap;
|
|
14
|
-
};
|
|
15
|
-
export const toHttpHeaderKey = (key) => getFunctionRequestHeaderMap().get(key) ?? null;
|
|
16
|
-
export const fromHttpHeaderKey = (key) => getFunctionRequestHeaderMap()
|
|
17
|
-
.entries()
|
|
18
|
-
.find(([, keyString]) => keyString === key)?.[0] ?? null;
|
|
19
|
-
export const mapHttpToFunctionHeaders = (httpHeaders) => {
|
|
20
|
-
const results = {};
|
|
21
|
-
for (const [httpKey, value] of Object.entries(httpHeaders)) {
|
|
22
|
-
if (typeof value !== "string")
|
|
23
|
-
continue;
|
|
24
|
-
const functionkey = fromHttpHeaderKey(httpKey);
|
|
25
|
-
if (!functionkey)
|
|
26
|
-
continue;
|
|
27
|
-
results[functionkey] = value;
|
|
28
|
-
}
|
|
29
|
-
return results;
|
|
30
|
-
};
|
|
31
|
-
export const enrichHttpHeaders = (functionHeaders, httpHeaders) => {
|
|
32
|
-
for (const [_key, value] of Object.entries(functionHeaders)) {
|
|
33
|
-
const functionKey = _key;
|
|
34
|
-
const httpKey = toHttpHeaderKey(functionKey);
|
|
35
|
-
if (!httpKey)
|
|
36
|
-
continue;
|
|
37
|
-
httpHeaders[httpKey] = value;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=config.function.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.function.js","sourceRoot":"","sources":["../../src/config/config.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGzE,MAAM,CAAC,MAAM,sBAAsB,GAAqC;IACtE,MAAM,EAAE,SAAU;IAClB,UAAU,EAAE,SAAU;CACvB,CAAC;AAEF,IAAI,OAAO,GAA+B,IAAI,CAAC;AAE/C,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAGzC,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG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