Stone.js API
    Preparing search index...

    Tencent SCF HTTP Adapter for Stone.js.

    The TencentScfHttpAdapter extends the functionality of the Stone.js Adapter to provide seamless integration with Tencent SCF for HTTP-based events. This adapter transforms incoming HTTP events from Tencent SCF into IncomingHttpEvent instances and produces a RawHttpResponse as output.

    This adapter simplifies the process of handling HTTP events within Tencent SCF while adhering to the Stone.js framework's event-driven architecture.

    The type of the raw HTTP event from Tencent SCF.

    The type of the raw HTTP response to send back.

    The Tencent SCF execution context type.

    The type of the processed incoming HTTP event.

    Options used to create an incoming HTTP event.

    The type of the outgoing HTTP response after processing.

    Context type specific to the HTTP adapter.

    import { TencentScfHttpAdapter } from '@stone-js/tencent-scf-http-adapter';

    const adapter = TencentScfHttpAdapter.create({...});

    const handler = await adapter.run();

    export { handler };

    Hierarchy

    Index
    • Create an Adapter.

      Parameters

      • blueprint: IBlueprint

        The blueprint to create the adapter.

      Returns TencentScfHttpAdapter

    blueprint: IBlueprint
    middleware: AdapterMixedPipeType<
        TencentScfHttpAdapterContext,
        RawHttpResponseOptions,
    >[]
    resolvedErrorHandlers: Record<
        string,
        IAdapterErrorHandler<RawEventType, RawResponseType, ExecutionContextType>,
    >
    • Build the raw response.

      Parameters

      • context: TencentScfHttpAdapterContext

        The event context.

      • OptionaleventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<RawHttpResponseOptions>

      The raw response wrapper.

    • Processes an incoming Tencent SCF HTTP event.

      Converts a raw Tencent SCF HTTP event into an IncomingHttpEvent, processes it through the Stone.js pipeline, and generates a RawHttpResponse to send back.

      Parameters

      Returns Promise<RawHttpResponseOptions>

      A promise resolving to the processed RawHttpResponse.

    • Execute the event handler lifecycle hooks.

      Parameters

      • hook: KernelHookName

        The hook to execute.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<void>

    • Execute adapter lifecycle hooks.

      Parameters

      • name: AdapterHookName

        The hook's name.

      • Optionalcontext: TencentScfHttpAdapterContext

        The event context.

      • Optionalerror: any

        The error to handle.

      Returns Promise<void>

    • Handle the event.

      Parameters

      • context: TencentScfHttpAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<
          IAdapterEventBuilder<
              RawResponseOptions,
              IRawResponseWrapper<RawHttpResponseOptions>,
          >,
      >

      The raw response wrapper.

    • Initializes the adapter and validates its execution context.

      Ensures that the adapter is running in an Tencent SCF environment. Throws an error if it detects that the adapter is being used in an unsupported environment (e.g., a browser).

      Returns Promise<void>

      If executed outside an Tencent SCF environment.

    • Get the event handler for the adapter.

      Returns AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

      The event handler for the adapter.

      If the event handler is missing.

    • Send the raw event through the destination.

      Parameters

      • context: TencentScfHttpAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to be run.

      Returns Promise<RawHttpResponseOptions>

      Platform-specific response.

      IntegrationError

    • Validate the context and event handler.

      Parameters

      • context: TencentScfHttpAdapterContext

        The context to validate.

      • eventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>

        The event handler to validate.

      Returns void

      IntegrationError

    • Creates an instance of the TencentScfHttpAdapter.

      Parameters

      • blueprint: IBlueprint

        The application blueprint.

      Returns TencentScfHttpAdapter

      A new instance of TencentScfHttpAdapter.

      const adapter = TencentScfHttpAdapter.create(blueprint);
      await adapter.run();