Stone.js API
    Preparing search index...

    Alibaba FC Adapter for Stone.js.

    The AlibabaFcAdapter provides seamless integration between Stone.js applications and the Alibaba FC environment. It processes incoming events from Alibaba FC, transforms them into IncomingEvent instances, and returns a RawResponse.

    This adapter ensures compatibility with Alibaba FC's execution model and abstracts the event handling process for Stone.js developers.

    The type of the raw event received from Alibaba FC.

    The type of the response to send back to Alibaba FC.

    The Alibaba FC execution context type.

    The type of the processed incoming event.

    Options used to create an incoming event.

    The type of the outgoing response after processing.

    Context type specific to the adapter.

    import { AlibabaFcAdapter } from '@stone-js/alibaba-fc-adapter';

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

    const handler = await adapter.run();

    export { handler };

    Hierarchy

    Index
    • Create an Adapter.

      Parameters

      • blueprint: IBlueprint

        The blueprint to create the adapter.

      Returns AlibabaFcAdapter

    blueprint: IBlueprint
    hooks: AdapterHookType<AlibabaFcAdapterContext, RawResponse>
    middleware: AdapterMixedPipeType<AlibabaFcAdapterContext, RawResponse>[]
    resolvedErrorHandlers: Record<
        string,
        IAdapterErrorHandler<RawEventType, RawResponseType, ExecutionContextType>,
    >
    • Build the raw response.

      Parameters

      • context: AlibabaFcAdapterContext

        The event context.

      • OptionaleventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

        The event handler to be run.

      Returns Promise<RawResponse>

      The raw response wrapper.

    • Processes an incoming Alibaba FC event.

      This method transforms the raw Alibaba FC event into a Stone.js IncomingEvent, processes it through the pipeline, and generates a RawResponse to send back.

      Parameters

      • rawEvent: AlibabaFcEvent

        The raw Alibaba FC event to be processed.

      • executionContext: AlibabaFcContext

        The Alibaba FC execution context for the event.

      Returns Promise<RawResponse>

      A promise resolving to the processed RawResponse.

    • Execute the event handler lifecycle hooks.

      Parameters

      • hook: KernelHookName

        The hook to execute.

      • eventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

        The event handler to be run.

      Returns Promise<void>

    • Execute adapter lifecycle hooks.

      Parameters

      • name: AdapterHookName

        The hook's name.

      • Optionalcontext: AlibabaFcAdapterContext

        The event context.

      • Optionalerror: any

        The error to handle.

      Returns Promise<void>

    • Handle error.

      Parameters

      Returns Promise<AdapterEventBuilderType<RawResponse>>

      The raw response.

    • Handle the event.

      Parameters

      • context: AlibabaFcAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

        The event handler to be run.

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

      The raw response wrapper.

    • Initializes the adapter and validates its execution context.

      Ensures the adapter is running in an Alibaba FC environment. If not, it throws an error to prevent misuse.

      Returns Promise<void>

      If executed outside an Alibaba FC context (e.g., browser).

    • Get the event handler for the adapter.

      Returns AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

      The event handler for the adapter.

      If the event handler is missing.

    • Executes the adapter and provides an Alibaba FC-compatible handler function.

      The run method initializes the adapter and returns a handler function that Alibaba FC can invoke. This handler processes events, manages context, and returns the appropriate response.

      Type Parameters

      Returns Promise<ExecutionResultType>

      A promise resolving to the Alibaba FC handler function.

      If used outside the Alibaba FC environment.

    • Send the raw event through the destination.

      Parameters

      • context: AlibabaFcAdapterContext

        The event context.

      • eventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

        The event handler to be run.

      Returns Promise<RawResponse>

      Platform-specific response.

      IntegrationError

    • Validate the context and event handler.

      Parameters

      • context: AlibabaFcAdapterContext

        The context to validate.

      • eventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>

        The event handler to validate.

      Returns void

      IntegrationError

    • Creates an instance of the AlibabaFcAdapter.

      Parameters

      • blueprint: IBlueprint

        The application blueprint.

      Returns AlibabaFcAdapter

      A new instance of AlibabaFcAdapter.

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