@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.
Files changed (3) hide show
  1. package/README.md +10 -5
  2. package/dist/index.js +30 -30
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -1,11 +1,16 @@
1
1
  # Stone.js - Tencent SCF Adapter
2
2
 
3
- [![npm](https://img.shields.io/npm/l/@stone-js/tencent-scf-adapter)](https://opensource.org/licenses/MIT)
4
- [![npm](https://img.shields.io/npm/v/@stone-js/tencent-scf-adapter)](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
5
- [![npm](https://img.shields.io/npm/dm/@stone-js/tencent-scf-adapter)](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
3
+ [![npm license](https://img.shields.io/npm/l/@stone-js/tencent-scf-adapter)](https://opensource.org/licenses/MIT)
4
+ [![npm version](https://img.shields.io/npm/v/@stone-js/tencent-scf-adapter)](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@stone-js/tencent-scf-adapter)](https://www.npmjs.com/package/@stone-js/tencent-scf-adapter)
6
6
  ![Maintenance](https://img.shields.io/maintenance/yes/2026)
7
- [![Build Status](https://github.com/stone-foundation/stone-js-tencent-scf-adapter/actions/workflows/main.yml/badge.svg)](https://github.com/stone-foundation/stone-js-tencent-scf-adapter/actions/workflows/main.yml)
8
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-tencent-scf-adapter&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-tencent-scf-adapter)
7
+ [![CI](https://github.com/stone-foundation/stone-js-framework/actions/workflows/ci.yml/badge.svg)](https://github.com/stone-foundation/stone-js-framework/actions/workflows/ci.yml)
8
+ [![Release](https://github.com/stone-foundation/stone-js-framework/actions/workflows/release.yml/badge.svg)](https://github.com/stone-foundation/stone-js-framework/actions/workflows/release.yml)
9
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-framework&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
10
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-framework&metric=coverage)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
11
+ [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/stone-foundation/stone-js-framework/blob/main/SECURITY.md)
12
+ [![CodeQL](https://github.com/stone-foundation/stone-js-framework/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/stone-foundation/stone-js-framework/security/code-scanning)
13
+ [![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg)](https://github.com/stone-foundation/stone-js-framework/network/updates)
9
14
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](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, defaultLoggerResolver, OutgoingResponse, defaultKernelResolver, isNotEmpty, classDecoratorLegacyWrapper, addBlueprint } from '@stone-js/core';
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.0",
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.0",
46
- "@stone-js/env": "0.8.0"
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.0"
49
+ "@stone-js/config": "0.8.2"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@commitlint/cli": "^19.8.1",