Adapters
Tencent Cloud SCF
Tencent Cloud Serverless Cloud Function fronts HTTP with API Gateway's proxy integration: the function is invoked with a proxy event (httpMethod, path, headers, queryString, body) and returns { statusCode, headers, body, isBase64Encoded }. @stone-js/tencent-scf-http-adapter maps that to an intention, runs your kernel, and returns the response, so your routes run on SCF unchanged.
#Install
npm i @stone-js/tencent-scf-http-adapter#Enable it
Add the decorator (or the blueprint) to the manifest. Your routes, validation, cookies and request/response model are the runtime-agnostic ones from @stone-js/http-core; nothing in the domain changes.
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { TencentScfHttp } from '@stone-js/tencent-scf-http-adapter'
@TencentScfHttp() // Tencent SCF HTTP (API Gateway) trigger
@Routing()
@StoneApp({ name: 'tasks' })
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { tencentScfHttpAdapterBlueprint } from '@stone-js/tencent-scf-http-adapter'
export const App = defineStoneApp(
{ name: 'tasks' },
[routerBlueprint, tencentScfHttpAdapterBlueprint]
)#Register the handler
run() returns the (event, context) handler SCF invokes. Export it as the function entry point.
// The SCF function entry
exports.main_handler = await stoneApp.run()#Generic (non-HTTP) triggers
For triggers that are not HTTP, a COS object change, a CMQ/TDMQ message, a Timer or CKafka records, use the generic @stone-js/tencent-scf-adapter with @TencentScf(). The function is invoked with (event, context); the adapter normalizes it into an intention whose metadata carries the event payload, so one handler can dispatch on the trigger.
import { TencentScf } from '@stone-js/tencent-scf-adapter'
@TencentScf()
@StoneApp({ name: 'workers' })
export class Application {}On a thrown error the adapter rethrows by default so SCF applies its retry / dead-letter policy; opt out with stone.adapter.rethrowOnError = false.
#Deploy
Build the function output and deploy with Serverless Framework or the console. The per-invocation model matches the Continuum's per-event context exactly.
npm run build
serverless deploy#Triggers
| Package | Type | Description |
|---|---|---|
| @stone-js/tencent-scf-http-adapter | @TencentScfHttp | HTTP-triggered functions (API Gateway proxy event). Use with @Routing. |
| @stone-js/tencent-scf-adapter | @TencentScf | Generic event triggers (COS, CMQ/TDMQ, Timer, CKafka). |