@collective-intelligence/external-apps-server-sdk 0.1.17 → 0.1.19

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.
@@ -364,6 +364,22 @@ export type CiResourcesOptions = Readonly<{
364
364
  policy?: UserAuthScopePolicy;
365
365
  tenantUrl: string;
366
366
  }>;
367
+ export type RealtimeTicketOptions = Readonly<{
368
+ auth: Pick<ApplicationUserAuth, "getAccessToken">;
369
+ /** The CI organization the signed-in users belong to. */
370
+ organizationId: string;
371
+ /** The CI origin that mints tickets. */
372
+ tenantUrl: string;
373
+ /** The origin the browser opens the event stream on; defaults to `tenantUrl`. */
374
+ host?: string;
375
+ fetch?: typeof globalThis.fetch;
376
+ }>;
377
+ /** The ticket route answer: a single-use ticket and the stream it opens. */
378
+ export type RealtimeTicketResponse = Readonly<{
379
+ ticket: string;
380
+ expiresAt: string;
381
+ streamUrl: string;
382
+ }>;
367
383
  export type BffResourceMount = Readonly<{
368
384
  basePath: string;
369
385
  handler: (request: Request) => Promise<Response>;
@@ -376,12 +392,17 @@ export type ExternalApplicationBffCapabilities = Readonly<{
376
392
  }> & (Readonly<{
377
393
  authentication?: never;
378
394
  }> | ServiceCapabilityAuthorization);
395
+ /** The realtime ticket route `POST {basePath}/realtime/ticket`; `basePath` defaults to `/api`. */
396
+ export type ExternalApplicationBffRealtime = Omit<RealtimeTicketOptions, "auth"> & Readonly<{
397
+ basePath?: string;
398
+ }>;
379
399
  export type ExternalApplicationBffOptions = Readonly<{
380
400
  auth: ApplicationUserAuth;
381
401
  authBasePath?: string;
382
402
  capabilities?: ExternalApplicationBffCapabilities;
383
403
  ciResources?: Omit<CiResourcesOptions, "auth">;
384
404
  publicOrigin: string;
405
+ realtime?: ExternalApplicationBffRealtime;
385
406
  resources?: readonly BffResourceMount[];
386
407
  }>;
387
408
  export type ExternalApplicationBff = (request: Request) => Promise<Response>;
@@ -922,6 +943,6 @@ export type ResourceNextRouteHandlers = Readonly<{
922
943
  export declare const cookies: (request: Request) => string | null, createCiResourceMounts: (options: CiResourcesOptions) => {
923
944
  basePath: string;
924
945
  handler: (request: Request) => Promise<Response>;
925
- }[], createExternalApplicationBff: (options: ExternalApplicationBffOptions) => ExternalApplicationBff, createExternalApplicationBffNextHandlers: (options: ExternalApplicationBffOptions) => GatewayNextRouteHandlers, createFixedWorkflowRoute: <Input, Params = Record<string, never>>(options: FixedWorkflowRouteOptions<Input, Params>) => ((request: Request, params: Params) => Promise<Response>), createGatewayNextRouteHandlers: (kernel: GatewayRuntimeKernel) => GatewayNextRouteHandlers, createResourceNextRouteHandlers: <Value, Create = Value, Patch = Partial<Value>>(options: ResourceHttpHandlerOptions<Value, Create, Patch>) => ResourceNextRouteHandlers, headers: (request: Request) => Headers, publicOriginFromHeaders: (headerList: Headers, fallbackOrigin: string) => string, requestWithPublicOrigin: (request: Request, publicOrigin: string) => Request;
946
+ }[], createExternalApplicationBff: (options: ExternalApplicationBffOptions) => ExternalApplicationBff, createExternalApplicationBffNextHandlers: (options: ExternalApplicationBffOptions) => GatewayNextRouteHandlers, createFixedWorkflowRoute: <Input, Params = Record<string, never>>(options: FixedWorkflowRouteOptions<Input, Params>) => ((request: Request, params: Params) => Promise<Response>), createRealtimeTicketHandler: (options: RealtimeTicketOptions) => ((request: Request) => Promise<Response>), createGatewayNextRouteHandlers: (kernel: GatewayRuntimeKernel) => GatewayNextRouteHandlers, createResourceNextRouteHandlers: <Value, Create = Value, Patch = Partial<Value>>(options: ResourceHttpHandlerOptions<Value, Create, Patch>) => ResourceNextRouteHandlers, headers: (request: Request) => Headers, publicOriginFromHeaders: (headerList: Headers, fallbackOrigin: string) => string, requestWithPublicOrigin: (request: Request, publicOrigin: string) => Request;
926
947
 
927
948
  export {};