inngest
Version:
Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.
1 lines • 2.65 kB
Source Map (JSON)
{"version":3,"file":"InngestEndpointAdapter.cjs","names":["scopedOptions: SyncAdapterOptions","fn: Fn","properties: PropertyDescriptorMap"],"sources":["../../src/components/InngestEndpointAdapter.ts"],"sourcesContent":["import type { Inngest } from \"./Inngest.ts\";\nimport type {\n SyncAdapterOptions,\n SyncHandlerOptions,\n} from \"./InngestCommHandler.ts\";\n\nexport namespace InngestEndpointAdapter {\n export const Tag = \"Inngest.EndpointAdapter\" as const;\n\n /**\n * Options passed to the durable endpoint proxy handler factory.\n */\n export interface ProxyHandlerOptions {\n /**\n * The Inngest client to use for API requests and middleware.\n */\n client: Inngest.Like;\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: we don't care about the return\n export type Fn = (options: SyncHandlerOptions) => any;\n\n // biome-ignore lint/suspicious/noExplicitAny: we don't care about the return\n export type ProxyFn = (options: ProxyHandlerOptions) => any;\n\n export interface Like extends Fn {\n readonly [Symbol.toStringTag]: typeof Tag;\n withOptions: (options: SyncAdapterOptions) => Like;\n\n /**\n * Creates a proxy handler for fetching durable endpoint results from Inngest.\n *\n * This is used by `inngest.endpointProxy()` to create framework-specific\n * handlers that can poll for and decrypt results.\n */\n createProxyHandler?: ProxyFn;\n }\n\n export const create = <TFn extends Fn, TProxyFn extends ProxyFn | undefined>(\n rawFn: TFn,\n proxyFn?: TProxyFn,\n ): TFn &\n Like &\n (TProxyFn extends ProxyFn ? { createProxyHandler: TProxyFn } : object) => {\n const scopedOptions: SyncAdapterOptions = {};\n const fn: Fn = (options) => rawFn({ ...scopedOptions, ...options });\n\n const properties: PropertyDescriptorMap = {\n [Symbol.toStringTag]: { value: Tag },\n\n withOptions: {\n value: (options: SyncAdapterOptions) => {\n Object.assign(scopedOptions, options);\n return fn;\n },\n },\n };\n\n if (proxyFn) {\n properties[\"createProxyHandler\"] = { value: proxyFn };\n }\n\n return Object.defineProperties(fn, properties) as TFn &\n Like &\n (TProxyFn extends ProxyFn ? { createProxyHandler: TProxyFn } : object);\n };\n}\n"],"mappings":";;;;CAOS,MAAM,oCAAM;mCAgCjB,OACA,YAG0E;EAC1E,MAAMA,gBAAoC,EAAE;EAC5C,MAAMC,MAAU,YAAY,MAAM;GAAE,GAAG;GAAe,GAAG;GAAS,CAAC;EAEnE,MAAMC,aAAoC;IACvC,OAAO,cAAc,EAAE,OAAO,KAAK;GAEpC,aAAa,EACX,QAAQ,YAAgC;AACtC,WAAO,OAAO,eAAe,QAAQ;AACrC,WAAO;MAEV;GACF;AAED,MAAI,QACF,YAAW,wBAAwB,EAAE,OAAO,SAAS;AAGvD,SAAO,OAAO,iBAAiB,IAAI,WAAW"}