@stone-js/tencent-scf-adapter 0.8.0 → 0.8.2
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/README.md +10 -5
- package/dist/index.js +30 -30
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# Stone.js - Tencent SCF Adapter
|
|
2
2
|
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
|
|
5
|
-
[](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
|
|
5
|
+
[](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
|
|
6
6
|

|
|
7
|
-
[](https://github.com/stone-foundation/stone-js-framework/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/stone-foundation/stone-js-framework/actions/workflows/release.yml)
|
|
9
|
+
[](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
|
|
10
|
+
[](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
|
|
11
|
+
[](https://github.com/stone-foundation/stone-js-framework/blob/main/SECURITY.md)
|
|
12
|
+
[](https://github.com/stone-foundation/stone-js-framework/security/code-scanning)
|
|
13
|
+
[](https://github.com/stone-foundation/stone-js-framework/network/updates)
|
|
9
14
|
[](https://conventionalcommits.org)
|
|
10
15
|
|
|
11
16
|
The **Tencent SCF Adapter** lets your Stone.js application run on **event-driven** Tencent Cloud Serverless Cloud Function, beyond HTTP. It normalizes any non-HTTP trigger (COS, CMQ/TDMQ, Timer, CKafka) into a Stone.js `IncomingEvent`, fully aligned with the Continuum Architecture.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
import { IntegrationError, Adapter, AdapterEventBuilder, IncomingEvent,
|
|
2
|
-
import { getString } from '@stone-js/env';
|
|
1
|
+
import { defaultLoggerResolver, IntegrationError, Adapter, AdapterEventBuilder, IncomingEvent, OutgoingResponse, defaultKernelResolver, isNotEmpty, classDecoratorLegacyWrapper, addBlueprint } from '@stone-js/core';
|
|
3
2
|
import { cloneValue, deepMerge } from '@stone-js/config';
|
|
3
|
+
import { getString } from '@stone-js/env';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Class representing an TencentScfErrorHandler.
|
|
7
|
+
*/
|
|
8
|
+
class TencentScfErrorHandler {
|
|
9
|
+
logger;
|
|
10
|
+
/**
|
|
11
|
+
* Create an TencentScfErrorHandler.
|
|
12
|
+
*
|
|
13
|
+
* @param options - TencentScfErrorHandler options.
|
|
14
|
+
*/
|
|
15
|
+
constructor({ blueprint }) {
|
|
16
|
+
this.logger = blueprint.get('stone.logger.resolver', defaultLoggerResolver)(blueprint);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Handle an error.
|
|
20
|
+
*
|
|
21
|
+
* @param error - The error to handle.
|
|
22
|
+
* @param context - The context of the adapter.
|
|
23
|
+
* @returns The raw response builder.
|
|
24
|
+
*/
|
|
25
|
+
handle(error, context) {
|
|
26
|
+
this.logger.error(error.message, { error });
|
|
27
|
+
return context
|
|
28
|
+
.rawResponseBuilder
|
|
29
|
+
.add('statusCode', 500);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
4
32
|
|
|
5
33
|
/**
|
|
6
34
|
* Wrapper for generic raw responses.
|
|
@@ -215,34 +243,6 @@ class TencentScfAdapter extends Adapter {
|
|
|
215
243
|
*/
|
|
216
244
|
const TENCENT_SCF_PLATFORM = 'tencent_scf';
|
|
217
245
|
|
|
218
|
-
/**
|
|
219
|
-
* Class representing an TencentScfErrorHandler.
|
|
220
|
-
*/
|
|
221
|
-
class TencentScfErrorHandler {
|
|
222
|
-
logger;
|
|
223
|
-
/**
|
|
224
|
-
* Create an TencentScfErrorHandler.
|
|
225
|
-
*
|
|
226
|
-
* @param options - TencentScfErrorHandler options.
|
|
227
|
-
*/
|
|
228
|
-
constructor({ blueprint }) {
|
|
229
|
-
this.logger = blueprint.get('stone.logger.resolver', defaultLoggerResolver)(blueprint);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Handle an error.
|
|
233
|
-
*
|
|
234
|
-
* @param error - The error to handle.
|
|
235
|
-
* @param context - The context of the adapter.
|
|
236
|
-
* @returns The raw response builder.
|
|
237
|
-
*/
|
|
238
|
-
handle(error, context) {
|
|
239
|
-
this.logger.error(error.message, { error });
|
|
240
|
-
return context
|
|
241
|
-
.rawResponseBuilder
|
|
242
|
-
.add('statusCode', 500);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
246
|
/**
|
|
247
247
|
* Adapter resolver for generic Tencent SCF adapter.
|
|
248
248
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stone-js/tencent-scf-adapter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "General-purpose Tencent Cloud SCF adapter for Stone.js, run any app on event-driven Serverless Cloud Function triggers, beyond HTTP. Supports COS, CMQ/TDMQ, Timer and CKafka.",
|
|
5
5
|
"author": "Mr. Stone <evensstone@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"node": ">=18.17.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@stone-js/core": "0.8.
|
|
46
|
-
"@stone-js/env": "0.8.
|
|
45
|
+
"@stone-js/core": "0.8.2",
|
|
46
|
+
"@stone-js/env": "0.8.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@stone-js/config": "0.8.
|
|
49
|
+
"@stone-js/config": "0.8.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@commitlint/cli": "^19.8.1",
|