@collective-intelligence/external-apps-server-sdk 0.1.18 → 0.1.21

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.
@@ -747,6 +747,22 @@ export type CiResourcesOptions = Readonly<{
747
747
  policy?: UserAuthScopePolicy;
748
748
  tenantUrl: string;
749
749
  }>;
750
+ export type RealtimeTicketOptions = Readonly<{
751
+ auth: Pick<ApplicationUserAuth, "getAccessToken">;
752
+ /** The CI organization the signed-in users belong to. */
753
+ organizationId: string;
754
+ /** The CI origin that mints tickets. */
755
+ tenantUrl: string;
756
+ /** The origin the browser opens the event stream on; defaults to `tenantUrl`. */
757
+ host?: string;
758
+ fetch?: typeof globalThis.fetch;
759
+ }>;
760
+ /** The ticket route answer: a single-use ticket and the stream it opens. */
761
+ export type RealtimeTicketResponse = Readonly<{
762
+ ticket: string;
763
+ expiresAt: string;
764
+ streamUrl: string;
765
+ }>;
750
766
  export type BffResourceMount = Readonly<{
751
767
  basePath: string;
752
768
  handler: (request: Request) => Promise<Response>;
@@ -759,12 +775,17 @@ export type ExternalApplicationBffCapabilities = Readonly<{
759
775
  }> & (Readonly<{
760
776
  authentication?: never;
761
777
  }> | ServiceCapabilityAuthorization);
778
+ /** The realtime ticket route `POST {basePath}/realtime/ticket`; `basePath` defaults to `/api`. */
779
+ export type ExternalApplicationBffRealtime = Omit<RealtimeTicketOptions, "auth"> & Readonly<{
780
+ basePath?: string;
781
+ }>;
762
782
  export type ExternalApplicationBffOptions = Readonly<{
763
783
  auth: ApplicationUserAuth;
764
784
  authBasePath?: string;
765
785
  capabilities?: ExternalApplicationBffCapabilities;
766
786
  ciResources?: Omit<CiResourcesOptions, "auth">;
767
787
  publicOrigin: string;
788
+ realtime?: ExternalApplicationBffRealtime;
768
789
  resources?: readonly BffResourceMount[];
769
790
  }>;
770
791
  export type ExternalApplicationBff = (request: Request) => Promise<Response>;
@@ -792,6 +813,6 @@ export type GatewayRuntimeKernel = Pick<GatewayKernel, "handle">;
792
813
  export declare const cookies: (request: Request) => string | null, createCiResourceMounts: (options: CiResourcesOptions) => {
793
814
  basePath: string;
794
815
  handler: (request: Request) => Promise<Response>;
795
- }[], createExternalApplicationBff: (options: ExternalApplicationBffOptions) => ExternalApplicationBff, createFixedWorkflowRoute: <Input, Params = Record<string, never>>(options: FixedWorkflowRouteOptions<Input, Params>) => ((request: Request, params: Params) => Promise<Response>), createGatewayWebHandler: (kernel: GatewayRuntimeKernel) => GatewayWebHandler, headers: (request: Request) => Headers, publicOriginFromHeaders: (headerList: Headers, fallbackOrigin: string) => string, requestWithPublicOrigin: (request: Request, publicOrigin: string) => Request;
816
+ }[], createExternalApplicationBff: (options: ExternalApplicationBffOptions) => ExternalApplicationBff, createFixedWorkflowRoute: <Input, Params = Record<string, never>>(options: FixedWorkflowRouteOptions<Input, Params>) => ((request: Request, params: Params) => Promise<Response>), createRealtimeTicketHandler: (options: RealtimeTicketOptions) => ((request: Request) => Promise<Response>), createGatewayWebHandler: (kernel: GatewayRuntimeKernel) => GatewayWebHandler, headers: (request: Request) => Headers, publicOriginFromHeaders: (headerList: Headers, fallbackOrigin: string) => string, requestWithPublicOrigin: (request: Request, publicOrigin: string) => Request;
796
817
 
797
818
  export {};