gcf-common-lib 0.32.63 → 0.32.65
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/package.json +4 -4
- package/src/index.ts +5 -7
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gcf-common-lib",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.32.
|
|
4
|
+
"version": "0.32.65",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"branches": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=20"
|
|
13
13
|
},
|
|
14
14
|
"main": "src/index",
|
|
15
15
|
"scripts": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@google-cloud/pubsub": "^4.4.0",
|
|
24
24
|
"@google-cloud/storage": "^7.11.0",
|
|
25
|
-
"@tsconfig/
|
|
25
|
+
"@tsconfig/node20": "^20.1.4",
|
|
26
26
|
"@types/amqplib": "^0.10.5",
|
|
27
27
|
"@types/bluebird": "^3.5.42",
|
|
28
28
|
"@types/express": "^4.17.21",
|
|
29
29
|
"@types/lodash": "^4.17.1",
|
|
30
|
-
"@types/node": "^
|
|
30
|
+
"@types/node": "^20.17.22",
|
|
31
31
|
"amqplib": "^0.10.4",
|
|
32
32
|
"bluebird": "^3.7.2",
|
|
33
33
|
"lodash": "^4.17.21",
|
package/src/index.ts
CHANGED
|
@@ -38,20 +38,20 @@ export class GcfCommon {
|
|
|
38
38
|
|
|
39
39
|
static async process<T extends TResponse, E = TEvent>(
|
|
40
40
|
payload: TPayload<E>,
|
|
41
|
-
handler: (payload: TPayload<E>) => Promise<any> | any
|
|
41
|
+
handler: (payload: TPayload<E>) => Promise<any> | any,
|
|
42
42
|
timeoutSec = 535,
|
|
43
43
|
) {
|
|
44
44
|
const asyncHandler = async (p: TPayload<E>) => await handler(p);
|
|
45
45
|
return firstValueFrom(
|
|
46
|
-
defer(() => from(asyncHandler(payload))).pipe(first(), timeout({ first: ms({ s: timeoutSec }) })),
|
|
46
|
+
defer(() => from(asyncHandler({ ...payload }))).pipe(first(), timeout({ first: ms({ s: timeoutSec }) })),
|
|
47
47
|
)
|
|
48
48
|
.then(async res => {
|
|
49
49
|
// console.log('res:', res);
|
|
50
|
-
await this.response(payload, res as T).catch(noop);
|
|
50
|
+
await this.response({ ...payload }, res as T).catch(noop);
|
|
51
51
|
return res;
|
|
52
52
|
})
|
|
53
53
|
.catch(async (error: Error) => {
|
|
54
|
-
await this.response(payload, GcfCommon.buildResponse(error), { error: '1' }).catch(noop);
|
|
54
|
+
await this.response({ ...payload }, GcfCommon.buildResponse(error), { error: '1' }).catch(noop);
|
|
55
55
|
throw error;
|
|
56
56
|
});
|
|
57
57
|
}
|
|
@@ -162,9 +162,7 @@ export class GcfCommon {
|
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (payload?.request) {
|
|
165
|
+
} else if (payload?.request) {
|
|
168
166
|
metadataOrAttribute = this.getRequestMessage(payload.request)?.attributes;
|
|
169
167
|
}
|
|
170
168
|
|
package/tsconfig.json
CHANGED