@dxos/functions 0.8.1 → 0.8.2-main.10c050d
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.
- package/dist/lib/browser/bundler/index.mjs +0 -3
- package/dist/lib/browser/bundler/index.mjs.map +3 -3
- package/dist/lib/browser/edge/index.mjs +63 -7
- package/dist/lib/browser/edge/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +513 -100
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/bundler/index.cjs +0 -1
- package/dist/lib/node/bundler/index.cjs.map +3 -3
- package/dist/lib/node/edge/index.cjs +65 -5
- package/dist/lib/node/edge/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +519 -92
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/bundler/index.mjs +0 -1
- package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
- package/dist/lib/node-esm/edge/index.mjs +64 -6
- package/dist/lib/node-esm/edge/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +513 -98
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/bundler/bundler.d.ts.map +1 -1
- package/dist/types/src/edge/functions.d.ts +3 -3
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/edge/index.d.ts.map +1 -1
- package/dist/types/src/executor/executor.d.ts +8 -0
- package/dist/types/src/executor/executor.d.ts.map +1 -0
- package/dist/types/src/executor/index.d.ts +2 -0
- package/dist/types/src/executor/index.d.ts.map +1 -0
- package/dist/types/src/handler.d.ts +23 -67
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/schema.d.ts +57 -0
- package/dist/types/src/schema.d.ts.map +1 -0
- package/dist/types/src/services/ai.d.ts +9 -0
- package/dist/types/src/services/ai.d.ts.map +1 -0
- package/dist/types/src/services/credentials.d.ts +30 -0
- package/dist/types/src/services/credentials.d.ts.map +1 -0
- package/dist/types/src/services/database.d.ts +9 -0
- package/dist/types/src/services/database.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +7 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/services/queues.d.ts +10 -0
- package/dist/types/src/services/queues.d.ts.map +1 -0
- package/dist/types/src/services/service-container.d.ts +25 -0
- package/dist/types/src/services/service-container.d.ts.map +1 -0
- package/dist/types/src/services/tracing.d.ts +15 -0
- package/dist/types/src/services/tracing.d.ts.map +1 -0
- package/dist/types/src/trace.d.ts +149 -0
- package/dist/types/src/trace.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +407 -0
- package/dist/types/src/types.d.ts.map +1 -0
- package/dist/types/src/{types/url.d.ts → url.d.ts} +6 -0
- package/dist/types/src/url.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -36
- package/src/bundler/bundler.ts +7 -1
- package/src/edge/functions.ts +7 -4
- package/src/edge/index.ts +4 -0
- package/src/executor/executor.ts +47 -0
- package/src/executor/index.ts +5 -0
- package/src/handler.ts +29 -125
- package/src/index.ts +8 -5
- package/src/schema.ts +52 -0
- package/src/services/ai.ts +15 -0
- package/src/services/credentials.ts +55 -0
- package/src/services/database.ts +14 -0
- package/src/services/index.ts +10 -0
- package/src/services/queues.ts +16 -0
- package/src/services/service-container.ts +58 -0
- package/src/services/tracing.ts +27 -0
- package/src/{types/trace.ts → trace.ts} +37 -35
- package/src/translations.ts +1 -1
- package/src/types.ts +211 -0
- package/src/{types/url.ts → url.ts} +5 -0
- package/dist/lib/browser/chunk-HI7YZO2K.mjs +0 -482
- package/dist/lib/browser/chunk-HI7YZO2K.mjs.map +0 -7
- package/dist/lib/browser/chunk-LT4LR4VU.mjs +0 -72
- package/dist/lib/browser/chunk-LT4LR4VU.mjs.map +0 -7
- package/dist/lib/browser/chunk-RVSG6WTL.mjs +0 -358
- package/dist/lib/browser/chunk-RVSG6WTL.mjs.map +0 -7
- package/dist/lib/browser/chunk-XRCXIG74.mjs +0 -12
- package/dist/lib/browser/chunk-XRCXIG74.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -670
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -49
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/chunk-DSUGRAAL.cjs +0 -392
- package/dist/lib/node/chunk-DSUGRAAL.cjs.map +0 -7
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs +0 -34
- package/dist/lib/node/chunk-JEQ2X3Z6.cjs.map +0 -7
- package/dist/lib/node/chunk-NXZNXVT3.cjs +0 -94
- package/dist/lib/node/chunk-NXZNXVT3.cjs.map +0 -7
- package/dist/lib/node/chunk-RXMCVAMJ.cjs +0 -496
- package/dist/lib/node/chunk-RXMCVAMJ.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -687
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -70
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs +0 -12
- package/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HBD2FZXO.mjs +0 -358
- package/dist/lib/node-esm/chunk-HBD2FZXO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs +0 -72
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SQSJO5HI.mjs +0 -482
- package/dist/lib/node-esm/chunk-SQSJO5HI.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -670
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -49
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/browser/index.d.ts +0 -2
- package/dist/types/src/browser/index.d.ts.map +0 -1
- package/dist/types/src/function/function-registry.d.ts +0 -25
- package/dist/types/src/function/function-registry.d.ts.map +0 -1
- package/dist/types/src/function/function-registry.test.d.ts +0 -2
- package/dist/types/src/function/function-registry.test.d.ts.map +0 -1
- package/dist/types/src/function/index.d.ts +0 -2
- package/dist/types/src/function/index.d.ts.map +0 -1
- package/dist/types/src/runtime/dev-server.d.ts +0 -52
- package/dist/types/src/runtime/dev-server.d.ts.map +0 -1
- package/dist/types/src/runtime/dev-server.test.d.ts +0 -2
- package/dist/types/src/runtime/dev-server.test.d.ts.map +0 -1
- package/dist/types/src/runtime/index.d.ts +0 -3
- package/dist/types/src/runtime/index.d.ts.map +0 -1
- package/dist/types/src/runtime/scheduler.d.ts +0 -34
- package/dist/types/src/runtime/scheduler.d.ts.map +0 -1
- package/dist/types/src/runtime/scheduler.test.d.ts +0 -2
- package/dist/types/src/runtime/scheduler.test.d.ts.map +0 -1
- package/dist/types/src/testing/functions-integration.test.d.ts +0 -2
- package/dist/types/src/testing/functions-integration.test.d.ts.map +0 -1
- package/dist/types/src/testing/index.d.ts +0 -5
- package/dist/types/src/testing/index.d.ts.map +0 -1
- package/dist/types/src/testing/manifest.d.ts +0 -3
- package/dist/types/src/testing/manifest.d.ts.map +0 -1
- package/dist/types/src/testing/plugin-init.d.ts +0 -6
- package/dist/types/src/testing/plugin-init.d.ts.map +0 -1
- package/dist/types/src/testing/setup.d.ts +0 -15
- package/dist/types/src/testing/setup.d.ts.map +0 -1
- package/dist/types/src/testing/test/handler.d.ts +0 -4
- package/dist/types/src/testing/test/handler.d.ts.map +0 -1
- package/dist/types/src/testing/test/index.d.ts +0 -3
- package/dist/types/src/testing/test/index.d.ts.map +0 -1
- package/dist/types/src/testing/types.d.ts +0 -10
- package/dist/types/src/testing/types.d.ts.map +0 -1
- package/dist/types/src/testing/util.d.ts +0 -5
- package/dist/types/src/testing/util.d.ts.map +0 -1
- package/dist/types/src/trigger/index.d.ts +0 -3
- package/dist/types/src/trigger/index.d.ts.map +0 -1
- package/dist/types/src/trigger/trigger-registry.d.ts +0 -38
- package/dist/types/src/trigger/trigger-registry.d.ts.map +0 -1
- package/dist/types/src/trigger/trigger-registry.test.d.ts +0 -2
- package/dist/types/src/trigger/trigger-registry.test.d.ts.map +0 -1
- package/dist/types/src/trigger/type/index.d.ts +0 -3
- package/dist/types/src/trigger/type/index.d.ts.map +0 -1
- package/dist/types/src/trigger/type/subscription-trigger.d.ts +0 -4
- package/dist/types/src/trigger/type/subscription-trigger.d.ts.map +0 -1
- package/dist/types/src/trigger/type/timer-trigger.d.ts +0 -4
- package/dist/types/src/trigger/type/timer-trigger.d.ts.map +0 -1
- package/dist/types/src/trigger/type/webhook-trigger.d.ts +0 -4
- package/dist/types/src/trigger/type/webhook-trigger.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -5
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -53
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/trace.d.ts +0 -146
- package/dist/types/src/types/trace.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -265
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/dist/types/src/types/url.d.ts.map +0 -1
- package/dist/types/tools/schema.d.ts +0 -2
- package/dist/types/tools/schema.d.ts.map +0 -1
- package/schema/functions.json +0 -211
- package/src/browser/index.ts +0 -5
- package/src/function/function-registry.test.ts +0 -118
- package/src/function/function-registry.ts +0 -104
- package/src/function/index.ts +0 -5
- package/src/runtime/dev-server.test.ts +0 -79
- package/src/runtime/dev-server.ts +0 -240
- package/src/runtime/index.ts +0 -6
- package/src/runtime/scheduler.test.ts +0 -152
- package/src/runtime/scheduler.ts +0 -170
- package/src/testing/functions-integration.test.ts +0 -65
- package/src/testing/index.ts +0 -8
- package/src/testing/manifest.ts +0 -15
- package/src/testing/plugin-init.ts +0 -20
- package/src/testing/setup.ts +0 -109
- package/src/testing/test/handler.ts +0 -15
- package/src/testing/test/index.ts +0 -7
- package/src/testing/types.ts +0 -9
- package/src/testing/util.ts +0 -26
- package/src/trigger/index.ts +0 -6
- package/src/trigger/trigger-registry.test.ts +0 -278
- package/src/trigger/trigger-registry.ts +0 -218
- package/src/trigger/type/index.ts +0 -7
- package/src/trigger/type/subscription-trigger.ts +0 -84
- package/src/trigger/type/timer-trigger.ts +0 -48
- package/src/trigger/type/webhook-trigger.ts +0 -48
- package/src/types/index.ts +0 -8
- package/src/types/schema.ts +0 -46
- package/src/types/types.ts +0 -163
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/handler.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\nimport { type Effect } from 'effect';\n\nimport { type Client, PublicKey } from '@dxos/client';\nimport { type Space, type SpaceId } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type QueryResult } from '@dxos/protocols';\nimport { isNonNullable } from '@dxos/util';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TMeta = {}, TOutput = any> = (params: {\n context: FunctionContext;\n event: FunctionEvent<TData, TMeta>;\n /**\n * @deprecated\n */\n response: FunctionResponse;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: FunctionContextAi;\n\n /**\n * @deprecated\n */\n // TODO(burdon): Limit access to individual space.\n client: Client;\n /**\n * @deprecated\n */\n // TODO(burdon): Replace with storage service abstraction.\n dataDir?: string;\n}\n\nexport interface FunctionContextAi {\n // TODO(dmaretskyi): Refer to cloudflare AI docs for more comprehensive typedefs.\n run(model: string, inputs: any, options?: any): Promise<any>;\n}\n\n/**\n * Event payload.\n */\n// TODO(dmaretskyi): Update type definitions to match the actual payload.\nexport type FunctionEvent<TData = {}, TMeta = {}> = {\n data: FunctionEventMeta<TMeta> & TData;\n};\n\n/**\n * Metadata from trigger.\n */\nexport type FunctionEventMeta<TMeta = {}> = {\n meta: TMeta;\n};\n\n/**\n * Function response.\n */\nexport type FunctionResponse = {\n status(code: number): FunctionResponse;\n};\n\n//\n// API.\n//\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;\n insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;\n}\n\n/**\n * Space interface available to functions.\n */\nexport interface SpaceAPI {\n get id(): SpaceId;\n /**\n * @deprecated\n */\n get crud(): CoreDatabase;\n get db(): EchoDatabase;\n // TODO(dmaretskyi): Align with echo api --- queues.get(id).append(items);\n get queues(): QueuesAPI;\n}\n\n// TODO(wittjosiah): Fix this.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition = {\n description?: string;\n inputSchema: S.Schema.AnyNoContext;\n outputSchema?: S.Schema.AnyNoContext;\n handler: FunctionHandler<any>;\n};\n\nexport type DefineFunctionParams<T, O = any> = {\n description?: string;\n inputSchema: S.Schema<T, any>;\n outputSchema?: S.Schema<O, any>;\n handler: FunctionHandler<T, any, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>(params: DefineFunctionParams<T, O>): FunctionDefinition => {\n if (!S.isSchema(params.inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof params.handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n return {\n description: params.description,\n inputSchema: params.inputSchema,\n outputSchema: params.outputSchema ?? S.Any,\n handler: params.handler,\n };\n};\n\n//\n// Subscription utils.\n//\n\nexport type RawSubscriptionData = {\n spaceKey?: string;\n objects?: string[];\n};\n\nexport type SubscriptionData = {\n space?: Space;\n objects?: ReactiveEchoObject<any>[];\n};\n\n/**\n * Handler wrapper for subscription events; extracts space and objects.\n *\n * To test:\n * ```\n * curl -s -X POST -H \"Content-Type: application/json\" --data '{\"space\": \"0446...1cbb\"}' http://localhost:7100/dev/email-extractor\n * ```\n *\n * NOTE: Get space key from devtools or `dx space list --json`\n */\n// TODO(burdon): Evolve into plugin definition like Composer.\nexport const subscriptionHandler = <TMeta>(\n handler: FunctionHandler<SubscriptionData, TMeta>,\n types?: S.Schema.AnyNoContext[],\n): FunctionHandler<RawSubscriptionData, TMeta> => {\n return async ({ event: { data }, context, response, ...rest }) => {\n const { client } = context;\n const space = data.spaceKey ? client.spaces.get(PublicKey.from(data.spaceKey)) : undefined;\n if (!space) {\n log.error('Invalid space');\n return response.status(500);\n }\n\n registerTypes(space, types);\n const objects = space\n ? data.objects\n ?.map<ReactiveEchoObject<any> | undefined>((id) => space!.db.getObjectById(id))\n .filter(isNonNullable)\n : [];\n\n if (!!data.spaceKey && !space) {\n log.warn('invalid space', { data });\n } else {\n log.info('handler', { space: space?.key.truncate(), objects: objects?.length });\n }\n\n return handler({ event: { data: { ...data, space, objects } }, context, response, ...rest });\n };\n};\n\n// TODO(burdon): Evolve types as part of function metadata.\nconst registerTypes = (space: Space, types: S.Schema.AnyNoContext[] = []) => {\n const registry = space.db.graph.schemaReg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W;QAAEnB,OAAOA,OAAOoB,IAAIC,SAAAA;QAAYV,SAASA,SAASW;MAAO,GAAA;;;;;;IAC/E;AAEA,WAAOlC,QAAQ;MAAEM,OAAO;QAAEC,MAAM;UAAE,GAAGA;UAAMK;UAAOW;QAAQ;MAAE;MAAGf;MAASC;MAAU,GAAGC;IAAK,CAAA;EAC5F;AACF;AAGA,IAAMY,gBAAgB,CAACV,OAAcP,QAAiC,CAAA,MAAE;AACtE,QAAM8B,WAAWvB,MAAMc,GAAGU,MAAMC;AAChC,aAAWC,QAAQjC,OAAO;AACxB,QAAI,CAAC8B,SAASI,UAAUD,IAAAA,GAAO;AAC7BH,eAASK,UAAU;QAACF;OAAK;IAC3B;EACF;AACF;",
|
|
6
|
-
"names": ["defineFunction", "params", "
|
|
3
|
+
"sources": ["../../../src/handler.ts", "../../../src/schema.ts", "../../../src/trace.ts", "../../../src/types.ts", "../../../src/url.ts", "../../../src/services/ai.ts", "../../../src/services/database.ts", "../../../src/services/queues.ts", "../../../src/services/credentials.ts", "../../../src/services/tracing.ts", "../../../src/services/service-container.ts", "../../../src/executor/executor.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, type Context, type Effect } from 'effect';\n\nimport { type AIServiceClient } from '@dxos/ai';\n// import { type Space } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type SpaceId, type DXN } from '@dxos/keys';\nimport { type QueryResult } from '@dxos/protocols';\n\n// TODO(burdon): Model after http request. Ref Lambda/OpenFaaS.\n// https://docs.aws.amazon.com/lambda/latest/dg/typescript-handler.html\n// https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#functions\n// https://www.npmjs.com/package/aws-lambda\n\n/**\n * Function handler.\n */\nexport type FunctionHandler<TData = {}, TOutput = any> = (params: {\n /**\n * Services and context available to the function.\n */\n context: FunctionContext;\n\n /**\n * Data passed as the input to the function.\n * Must match the function's input schema.\n * This will be the payload from the trigger or other data passed into the function in a workflow.\n */\n data: TData;\n}) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;\n\n/**\n * Function context.\n */\nexport interface FunctionContext {\n /**\n * Resolves a service available to the function.\n * @throws if the service is not available.\n */\n getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;\n\n getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;\n\n /**\n * Space from which the function was invoked.\n */\n space: SpaceAPI | undefined;\n\n ai: AIServiceClient;\n}\n\nexport interface FunctionContextAi {\n // TODO(dmaretskyi): Refer to cloudflare AI docs for more comprehensive typedefs.\n run(model: string, inputs: any, options?: any): Promise<any>;\n}\n\n//\n// API.\n//\n\n// TODO(dmaretskyi): Temporary API to get the queues working.\n// TODO(dmaretskyi): To be replaced with integrating queues into echo.\nexport interface QueuesAPI {\n queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;\n insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;\n}\n\n/**\n * Space interface available to functions.\n */\nexport interface SpaceAPI {\n get id(): SpaceId;\n /**\n * @deprecated\n */\n get crud(): CoreDatabase;\n get db(): EchoDatabase;\n // TODO(dmaretskyi): Align with echo api --- queues.get(id).append(items);\n get queues(): QueuesAPI;\n}\n\n// TODO(wittjosiah): Queues are incompatible.\nconst __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {\n // const _: SpaceAPI = {} as Space;\n};\n\nexport type FunctionDefinition<T = {}, O = any> = {\n description?: string;\n inputSchema: Schema.Schema<T, any>;\n outputSchema?: Schema.Schema<O, any>;\n handler: FunctionHandler<T, O>;\n};\n\n// TODO(dmaretskyi): Bind input type to function handler.\nexport const defineFunction = <T, O>(params: FunctionDefinition<T, O>): FunctionDefinition<T, O> => {\n if (!Schema.isSchema(params.inputSchema)) {\n throw new Error('Input schema must be a valid schema');\n }\n if (typeof params.handler !== 'function') {\n throw new Error('Handler must be a function');\n }\n\n return {\n description: params.description,\n inputSchema: params.inputSchema,\n outputSchema: params.outputSchema ?? Schema.Any,\n handler: params.handler,\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { EchoObject, JsonSchemaType, LabelAnnotation, Ref, TypedObject } from '@dxos/echo-schema';\nimport { DataType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const ScriptType = Schema.Struct({\n name: Schema.optional(Schema.String),\n description: Schema.optional(Schema.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: Schema.optional(Schema.Boolean),\n source: Ref(DataType.Text),\n}).pipe(\n EchoObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n\nexport type ScriptType = Schema.Schema.Type<typeof ScriptType>;\n\n/**\n * Function deployment.\n */\nexport class FunctionType extends TypedObject({\n typename: 'dxos.org/type/Function',\n version: '0.1.0',\n})({\n // TODO(burdon): Rename to id/uri?\n name: Schema.NonEmptyString,\n version: Schema.String,\n\n description: Schema.optional(Schema.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: Schema.optional(Ref(ScriptType)),\n\n inputSchema: Schema.optional(JsonSchemaType),\n outputSchema: Schema.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: Schema.optional(Schema.String),\n}) {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Queue } from '@dxos/echo-db';\nimport { EchoObject, Expando, ObjectId, Ref } from '@dxos/echo-schema';\nimport { log } from '@dxos/log';\n\nimport { FunctionTrigger, type FunctionTriggerType } from './types';\n\nexport enum InvocationOutcome {\n SUCCESS = 'success',\n FAILURE = 'failure',\n PENDING = 'pending',\n}\n\n// TODO(burdon): Convert to extensible discriminated union of EDGE events.\nexport enum InvocationTraceEventType {\n START = 'start',\n END = 'end',\n}\n\nexport const TraceEventException = Schema.Struct({\n timestampMs: Schema.Number,\n message: Schema.String,\n name: Schema.String,\n stack: Schema.optional(Schema.String),\n});\nexport type TraceEventException = Schema.Schema.Type<typeof TraceEventException>;\n\nexport const InvocationTraceStartEvent = Schema.Struct({\n /**\n * Queue message id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.START),\n /**\n * Invocation id, the same for invocation start and end events.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n timestampMs: Schema.Number,\n /**\n * Data passed to function / workflow as an argument.\n */\n // TODO(burdon): Input schema?\n input: Schema.Object,\n /**\n * Queue for function/workflow invocation events.\n */\n invocationTraceQueue: Ref(Queue),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Ref(Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: Schema.optional(Ref(FunctionTrigger)),\n}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceStart', version: '0.1.0' }));\n\nexport type InvocationTraceStartEvent = Schema.Schema.Type<typeof InvocationTraceStartEvent>;\n\nexport const InvocationTraceEndEvent = Schema.Struct({\n /**\n * Trace event id.\n */\n id: ObjectId,\n type: Schema.Literal(InvocationTraceEventType.END),\n /**\n * Invocation id, will be the same for invocation start and end.\n */\n invocationId: ObjectId,\n /**\n * Event generation time.\n */\n // TODO(burdon): Remove ms suffix.\n timestampMs: Schema.Number,\n outcome: Schema.Enums(InvocationOutcome),\n exception: Schema.optional(TraceEventException),\n}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceEnd', version: '0.1.0' }));\n\nexport type InvocationTraceEndEvent = Schema.Schema.Type<typeof InvocationTraceEndEvent>;\n\nexport type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;\n\nexport const TraceEventLog = Schema.Struct({\n timestampMs: Schema.Number,\n level: Schema.String,\n message: Schema.String,\n context: Schema.optional(Schema.Object),\n});\n\nexport const TraceEvent = Schema.Struct({\n id: ObjectId,\n // TODO(burdon): Need enum/numeric result (not string).\n outcome: Schema.String,\n truncated: Schema.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: Schema.Number,\n logs: Schema.Array(TraceEventLog),\n exceptions: Schema.Array(TraceEventException),\n}).pipe(EchoObject({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));\n\nexport type TraceEvent = Schema.Schema.Type<typeof TraceEvent>;\n\n/**\n * Deprecated InvocationTrace event format.\n * @deprecated\n */\n// TODO(burdon): Remove.\nexport type InvocationSpan = {\n id: string;\n timestampMs: number;\n outcome: InvocationOutcome;\n input: object;\n durationMs: number;\n invocationTraceQueue: Ref<Queue>;\n invocationTarget: Ref<Expando>;\n trigger?: Ref<FunctionTriggerType>;\n exception?: TraceEventException;\n};\n\nexport const createInvocationSpans = (items?: InvocationTraceEvent[]): InvocationSpan[] => {\n if (!items) {\n return [];\n }\n\n const eventsByInvocationId = new Map<string, { start?: InvocationTraceStartEvent; end?: InvocationTraceEndEvent }>();\n for (const event of items) {\n if (!('invocationId' in event)) {\n // Skip legacy format entries.\n continue;\n }\n\n const invocationId = event.invocationId;\n const entry = eventsByInvocationId.get(invocationId) || { start: undefined, end: undefined };\n if (event.type === InvocationTraceEventType.START) {\n entry.start = event as InvocationTraceStartEvent;\n } else if (event.type === InvocationTraceEventType.END) {\n entry.end = event as InvocationTraceEndEvent;\n }\n\n eventsByInvocationId.set(invocationId, entry);\n }\n\n const now = Date.now();\n const result: InvocationSpan[] = [];\n\n // Create spans for each invocation\n for (const [invocationId, { start, end }] of eventsByInvocationId.entries()) {\n if (!start) {\n // No start event, can't create a meaningful span\n log.warn('found end event without matching start', { invocationId });\n continue;\n }\n\n const isInProgress = end === undefined;\n\n result.push({\n id: invocationId,\n timestampMs: start.timestampMs,\n durationMs: isInProgress ? now - start.timestampMs : end!.timestampMs - start.timestampMs,\n outcome: end?.outcome ?? InvocationOutcome.PENDING,\n exception: end?.exception,\n input: start.input,\n invocationTraceQueue: start.invocationTraceQueue,\n invocationTarget: start.invocationTarget,\n trigger: start.trigger,\n });\n }\n\n return result;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema, SchemaAST } from 'effect';\n\nimport { Expando, OptionsAnnotationId, TypedObject, Ref, RawObject } from '@dxos/echo-schema';\nimport { DXN } from '@dxos/keys';\n\nimport { FunctionType } from './schema';\n\n/**\n * Type discriminator for TriggerType.\n * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport enum TriggerKind {\n Timer = 'timer',\n Webhook = 'webhook',\n Subscription = 'subscription',\n Email = 'email',\n Queue = 'queue',\n}\n\nconst kindLiteralAnnotations = { title: 'Kind' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Timer).annotations(kindLiteralAnnotations),\n cron: Schema.String.annotations({\n title: 'Cron',\n [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(Schema.mutable);\nexport type TimerTrigger = Schema.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Email).annotations(kindLiteralAnnotations),\n}).pipe(Schema.mutable);\nexport type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Queue).annotations(kindLiteralAnnotations),\n queue: DXN.Schema,\n}).pipe(Schema.mutable);\nexport type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Webhook).annotations(kindLiteralAnnotations),\n method: Schema.optional(\n Schema.String.annotations({\n title: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: Schema.optional(\n Schema.Number.annotations({\n title: 'Port',\n }),\n ),\n}).pipe(Schema.mutable);\nexport type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = Schema.Struct({\n type: Schema.optional(Schema.String.annotations({ title: 'Type' })),\n props: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n}).annotations({ title: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = Schema.Struct({\n kind: Schema.Literal(TriggerKind.Subscription).annotations(kindLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: Schema.optional(\n Schema.Struct({\n // Watch changes to object (not just creation).\n deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),\n }).annotations({ title: 'Options' }),\n ),\n}).pipe(Schema.mutable);\nexport type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = Schema.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n title: 'Trigger',\n});\nexport type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;\n\nexport type EventType =\n | EmailTriggerOutput\n | WebhookTriggerOutput\n | QueueTriggerOutput\n | SubscriptionTriggerOutput\n | TimerTriggerOutput;\n\n// TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).\nexport const EmailTriggerOutput = Schema.mutable(\n Schema.Struct({\n from: Schema.String,\n to: Schema.String,\n subject: Schema.String,\n created: Schema.String,\n body: Schema.String,\n }),\n);\nexport type EmailTriggerOutput = Schema.Schema.Type<typeof EmailTriggerOutput>;\n\nexport const WebhookTriggerOutput = Schema.mutable(\n Schema.Struct({\n url: Schema.String,\n method: Schema.Literal('GET', 'POST'),\n headers: Schema.Record({ key: Schema.String, value: Schema.String }),\n bodyText: Schema.String,\n }),\n);\nexport type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutput>;\n\nexport const QueueTriggerOutput = Schema.mutable(\n Schema.Struct({\n queue: DXN.Schema,\n item: Schema.Any,\n cursor: Schema.String,\n }),\n);\nexport type QueueTriggerOutput = Schema.Schema.Type<typeof QueueTriggerOutput>;\n\nexport const SubscriptionTriggerOutput = Schema.mutable(\n Schema.Struct({ type: Schema.String, changedObjectId: Schema.String }),\n);\nexport type SubscriptionTriggerOutput = Schema.Schema.Type<typeof SubscriptionTriggerOutput>;\n\nexport const TimerTriggerOutput = Schema.mutable(Schema.Struct({ tick: Schema.Number }));\nexport type TimerTriggerOutput = Schema.Schema.Type<typeof TimerTriggerOutput>;\n\n/**\n * Function trigger.\n * Function is invoked with the `payload` passed as input data.\n * The event that triggers the function is available in the function context.\n */\nexport const FunctionTriggerSchema = Schema.Struct({\n /**\n * Function or workflow to invoke.\n */\n // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).\n function: Schema.optional(Ref(Expando).annotations({ title: 'Function' })),\n\n /**\n * Only used for workflowSchema.\n * Specifies the input node in the circuit.\n * @deprecated Remove and enforce a single input node in all compute graphSchema.\n */\n inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),\n\n enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),\n\n spec: Schema.optional(TriggerSchema),\n\n /**\n * Passed as the input data to the function.\n * Must match the function's input schema.\n *\n * @example\n * {\n * item: '{{$.trigger.event}}',\n * instructions: 'Summarize and perform entity-extraction'\n * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }\n * }\n */\n input: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any }))),\n});\n\nexport type FunctionTriggerType = Schema.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.2.0',\n})(FunctionTriggerSchema.fields) {}\n\n// TODO(wittjosiah): Remove?\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = Schema.Struct({\n functions: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionType)))),\n triggers: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionTrigger)))),\n});\nexport type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionType, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ObjectMeta } from '@dxos/echo-schema';\nimport { type SpaceId } from '@dxos/keys';\n\n// TODO: use URL scheme for source?\nconst FUNCTIONS_META_KEY = 'dxos.org/service/function';\n\nexport const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\nexport const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {\n return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;\n};\n\nexport const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {\n const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);\n if (key) {\n if (key.id !== functionUrl) {\n throw new Error('Metadata mismatch');\n }\n } else {\n meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });\n }\n};\n\n/**\n * NOTE: functionId is backend ID, not ECHO object id.\n */\nexport const makeFunctionUrl = (fn: { functionId: string }) => `/${fn.functionId}`;\n\nexport const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {\n const baseUrl = new URL('functions/', edgeUrl);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = functionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n options.spaceId && url.searchParams.set('spaceId', options.spaceId);\n options.subjectId && url.searchParams.set('subjectId', options.subjectId);\n url.protocol = isSecure(url.protocol) ? 'https' : 'http';\n return url.toString();\n};\n\nexport type InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { AIServiceClient } from '@dxos/ai';\n\n// TODO(burdon): Move to @dxos/ai.\nexport class AiService extends Context.Tag('AiService')<\n AiService,\n {\n readonly client: AIServiceClient;\n }\n>() {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { EchoDatabase } from '@dxos/echo-db';\n\nexport class DatabaseService extends Context.Tag('DatabaseService')<\n DatabaseService,\n {\n readonly db: EchoDatabase;\n }\n>() {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { Queue, QueueFactory } from '@dxos/echo-db';\n\nexport class QueuesService extends Context.Tag('QueuesService')<\n QueuesService,\n {\n readonly contextQueue: Queue | undefined;\n\n readonly queues: QueueFactory;\n }\n>() {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\ntype CredentialQuery = {\n service?: string;\n};\n\n// TODO(dmaretskyi): Unify with other apis.\n// packages/sdk/schema/src/common/access-token.ts\ntype ServiceCredential = {\n service: string;\n\n // TODO(dmaretskyi): Build out.\n apiKey?: string;\n};\n\nexport class CredentialsService extends Context.Tag('CredentialsService')<\n CredentialsService,\n {\n /**\n * Query all.\n */\n queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;\n\n /**\n * Get a single credential.\n * @throws {Error} If no credential is found.\n */\n getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;\n }\n>() {}\n\nexport class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {\n constructor(private readonly credentials: ServiceCredential[] = []) {}\n\n addCredentials(credentials: ServiceCredential[]): ConfiguredCredentialsService {\n this.credentials.push(...credentials);\n return this;\n }\n\n async queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]> {\n return this.credentials.filter((credential) => credential.service === query.service);\n }\n\n async getCredential(query: CredentialQuery): Promise<ServiceCredential> {\n const credential = this.credentials.find((credential) => credential.service === query.service);\n if (!credential) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n return credential;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { AnyEchoObject } from '@dxos/echo-schema';\n\nexport class TracingService extends Context.Tag('TracingService')<\n TracingService,\n {\n /**\n * Write an event to the tracing queue.\n * @param event - The event to write. Must be an a typed object.\n */\n write(event: AnyEchoObject): void;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = { write: () => {} };\n\n static console: Context.Tag.Service<TracingService> = {\n write: (event) => {\n // eslint-disable-next-line no-console\n console.log(event);\n },\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context } from 'effect';\n\nimport { AiService } from './ai';\nimport { CredentialsService } from './credentials';\nimport { DatabaseService } from './database';\nimport { QueuesService } from './queues';\nimport { TracingService } from './tracing';\n\nexport interface Services {\n database: Context.Tag.Service<DatabaseService>;\n ai: Context.Tag.Service<AiService>;\n queues: Context.Tag.Service<QueuesService>;\n credentials: Context.Tag.Service<CredentialsService>;\n tracing: Context.Tag.Service<TracingService>;\n}\n\nconst SERVICE_MAPPING: Record<string, keyof Services> = {\n [DatabaseService.key]: 'database',\n [AiService.key]: 'ai',\n [QueuesService.key]: 'queues',\n [CredentialsService.key]: 'credentials',\n [TracingService.key]: 'tracing',\n};\n\nconst DEFAULT_SERVICES: Partial<Services> = {\n tracing: TracingService.noop,\n};\n\nexport class ServiceContainer {\n private _services: Partial<Services> = { ...DEFAULT_SERVICES };\n\n /**\n * Set services.\n * @param services - Services to set.\n * @returns The container instance.\n */\n setServices(services: Partial<Services>): this {\n this._services = { ...this._services, ...services };\n return this;\n }\n\n getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T> {\n const serviceKey = SERVICE_MAPPING[tag.key];\n const service = serviceKey != null ? this._services[serviceKey] : undefined;\n if (!service) {\n throw new Error(`Service not available: ${tag.key}`);\n }\n return service as Context.Tag.Service<T>;\n }\n\n clone(): ServiceContainer {\n return new ServiceContainer().setServices({ ...this._services });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, Schema } from 'effect';\n\nimport type { SpaceId } from '@dxos/client/echo';\n\nimport type { FunctionContext, FunctionDefinition } from '../handler';\nimport type { ServiceContainer } from '../services';\n\nexport class FunctionExecutor {\n constructor(private readonly _services: ServiceContainer) {}\n\n // TODO(dmaretskyi): Invocation context: queue, space, etc...\n async invoke<F extends FunctionDefinition<any, any>>(\n fnDef: F,\n input: F extends FunctionDefinition<infer I, infer _O> ? I : never,\n ): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never> {\n // Assert input matches schema\n const assertInput = fnDef.inputSchema.pipe(Schema.asserts);\n (assertInput as any)(input);\n\n const context: FunctionContext = {\n getService: this._services.getService.bind(this._services),\n getSpace: async (_spaceId: SpaceId) => {\n throw new Error('Not available. Use the database service instead.');\n },\n space: undefined,\n get ai(): never {\n throw new Error('Not available. Use the ai service instead.');\n },\n };\n\n const result = await fnDef.handler({ context, data: input });\n\n // Assert output matches schema\n const assertOutput = fnDef.outputSchema?.pipe(Schema.asserts);\n (assertOutput as any)(result);\n\n if (Effect.isEffect(result)) {\n return Effect.runPromise(result as any);\n }\n\n return result as any;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAAkD;ACAlD,IAAAA,iBAAuB;AAEvB,yBAA8E;AAC9E,oBAAyB;ACHzB,IAAAA,iBAAuB;AAEvB,qBAAsB;AACtB,IAAAC,sBAAmD;AACnD,iBAAoB;ACJpB,IAAAD,iBAAkC;AAElC,IAAAC,sBAA0E;AAC1E,kBAAoB;AEHpB,IAAAD,iBAAwB;ACAxB,IAAAA,iBAAwB;ACAxB,IAAAA,iBAAwB;ACAxB,IAAAA,iBAAwB;ACAxB,IAAAA,iBAAw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AM8G,cAAcD,MAAMjM,YAAYiB,KAAKnB,gBAAAA,OAAOqM,OAAO;AACxDD,gBAAoB9G,KAAAA;AAErB,UAAM8B,UAA2B;MAC/ByE,YAAY,KAAKH,UAAUG,WAAWS,KAAK,KAAKZ,SAAS;MACzDa,UAAU,OAAOC,aAAAA;AACf,cAAM,IAAIrM,MAAM,kDAAA;MAClB;MACAsM,OAAOvE;MACP,IAAIwE,KAAY;AACd,cAAM,IAAIvM,MAAM,4CAAA;MAClB;IACF;AAEA,UAAMmI,SAAS,MAAM6D,MAAM/L,QAAQ;MAAEgH;MAASuF,MAAMrH;IAAM,CAAA;AAG1D,UAAMsH,eAAeT,MAAM7L,cAAca,KAAKnB,gBAAAA,OAAOqM,OAAO;AAC3DO,iBAAqBtE,MAAAA;AAEtB,QAAIuE,uBAAOC,SAASxE,MAAAA,GAAS;AAC3B,aAAOuE,uBAAOE,WAAWzE,MAAAA;IAC3B;AAEA,WAAOA;EACT;AACF;",
|
|
6
|
+
"names": ["import_effect", "import_echo_schema", "defineFunction", "params", "Schema", "isSchema", "inputSchema", "Error", "handler", "description", "outputSchema", "Any", "ScriptType", "Struct", "name", "optional", "String", "changed", "Boolean", "source", "Ref", "DataType", "Text", "pipe", "EchoObject", "typename", "version", "LabelAnnotation", "set", "FunctionType", "TypedObject", "NonEmptyString", "JsonSchemaType", "binding", "TriggerKind", "kindLiteralAnnotations", "title", "TimerTriggerSchema", "kind", "Literal", "annotations", "cron", "SchemaAST", "ExamplesAnnotationId", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "type", "props", "Record", "key", "value", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "EmailTriggerOutput", "from", "to", "subject", "created", "body", "WebhookTriggerOutput", "url", "headers", "bodyText", "QueueTriggerOutput", "item", "cursor", "SubscriptionTriggerOutput", "changedObjectId", "TimerTriggerOutput", "tick", "FunctionTriggerSchema", "function", "Expando", "inputNodeId", "enabled", "spec", "input", "FunctionTrigger", "fields", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "InvocationTraceEventType", "TraceEventException", "timestampMs", "message", "stack", "InvocationTraceStartEvent", "id", "ObjectId", "invocationId", "Object", "invocationTraceQueue", "Queue", "invocationTarget", "trigger", "InvocationTraceEndEvent", "outcome", "Enums", "exception", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "ingestionTimestampMs", "logs", "exceptions", "createInvocationSpans", "items", "eventsByInvocationId", "Map", "event", "entry", "get", "start", "undefined", "end", "now", "Date", "result", "entries", "log", "warn", "isInProgress", "push", "durationMs", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "isSecure", "protocol", "getUserFunctionUrlInMetadata", "meta", "keys", "find", "setUserFunctionUrlInMetadata", "functionUrl", "makeFunctionUrl", "fn", "functionId", "getInvocationUrl", "edgeUrl", "baseUrl", "URL", "relativeUrl", "replace", "toString", "spaceId", "searchParams", "subjectId", "AiService", "Context", "Tag", "DatabaseService", "QueuesService", "CredentialsService", "ConfiguredCredentialsService", "credentials", "addCredentials", "queryCredentials", "query", "credential", "service", "getCredential", "TracingService", "noop", "write", "console", "SERVICE_MAPPING", "DEFAULT_SERVICES", "tracing", "ServiceContainer", "_services", "setServices", "services", "getService", "tag", "serviceKey", "clone", "FunctionExecutor", "invoke", "fnDef", "assertInput", "asserts", "bind", "getSpace", "_spaceId", "space", "ai", "data", "assertOutput", "Effect", "isEffect", "runPromise"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30383,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":502,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":6587,"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":501,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/types/schema.ts":{"bytes":4797,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/types.ts":{"bytes":16679,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":16307,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/types/url.ts":{"bytes":5599,"imports":[],"format":"esm"},"packages/core/functions/src/types/index.ts":{"bytes":740,"imports":[{"path":"packages/core/functions/src/types/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/types/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/types/trace.ts","kind":"import-statement","original":"./trace"},{"path":"packages/core/functions/src/types/url.ts","kind":"import-statement","original":"./url"}],"format":"esm"},"packages/core/functions/src/function/function-registry.ts":{"bytes":13004,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/function/index.ts":{"bytes":529,"imports":[{"path":"packages/core/functions/src/function/function-registry.ts","kind":"import-statement","original":"./function-registry"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":14030,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytes":10314,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytes":4673,"imports":[{"path":"cron-schedule","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/trigger/type/index.ts":{"bytes":751,"imports":[{"path":"packages/core/functions/src/trigger/type/subscription-trigger.ts","kind":"import-statement","original":"./subscription-trigger"},{"path":"packages/core/functions/src/trigger/type/timer-trigger.ts","kind":"import-statement","original":"./timer-trigger"}],"format":"esm"},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytes":28465,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/trigger/index.ts":{"bytes":603,"imports":[{"path":"packages/core/functions/src/trigger/trigger-registry.ts","kind":"import-statement","original":"./trigger-registry"},{"path":"packages/core/functions/src/trigger/type/index.ts","kind":"import-statement","original":"./type"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":920,"imports":[{"path":"packages/core/functions/src/edge/index.ts","kind":"import-statement","original":"./edge"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"./function"},{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"./trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/testing/types.ts":{"bytes":1131,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/dev-server.ts":{"bytes":28958,"imports":[{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/scheduler.ts":{"bytes":21200,"imports":[{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/runtime/index.ts":{"bytes":598,"imports":[{"path":"packages/core/functions/src/runtime/dev-server.ts","kind":"import-statement","original":"./dev-server"},{"path":"packages/core/functions/src/runtime/scheduler.ts","kind":"import-statement","original":"./scheduler"}],"format":"esm"},"packages/core/functions/src/testing/setup.ts":{"bytes":12707,"imports":[{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/function/index.ts","kind":"import-statement","original":"../function"},{"path":"packages/core/functions/src/runtime/index.ts","kind":"import-statement","original":"../runtime"},{"path":"packages/core/functions/src/trigger/index.ts","kind":"import-statement","original":"../trigger"},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/util.ts":{"bytes":4310,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/core/functions/src/testing/manifest.ts":{"bytes":1139,"imports":[],"format":"esm"},"packages/core/functions/src/testing/index.ts":{"bytes":749,"imports":[{"path":"packages/core/functions/src/testing/setup.ts","kind":"import-statement","original":"./setup"},{"path":"packages/core/functions/src/testing/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/testing/util.ts","kind":"import-statement","original":"./util"},{"path":"packages/core/functions/src/testing/manifest.ts","kind":"import-statement","original":"./manifest"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14436},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7286},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/edge/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":250},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7893},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionRegistry","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","createInvocationSpans","createSubscriptionTrigger","createTimerTrigger","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","subscriptionHandler","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/handler.ts":{"bytesInOutput":2076}},"bytes":3590},"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3275},"packages/core/functions/dist/lib/node/chunk-NXZNXVT3.cjs":{"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":1654},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1825},"packages/core/functions/dist/lib/node/testing/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32289},"packages/core/functions/dist/lib/node/testing/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"express","kind":"import-statement","external":true},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"exports":["TestType","createFunctionRuntime","createInitializedClients","inviteMember","startFunctionsHost","testFunctionManifest","triggerWebhook"],"entryPoint":"packages/core/functions/src/testing/index.ts","inputs":{"packages/core/functions/src/testing/setup.ts":{"bytesInOutput":2775},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7860},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5364},"packages/core/functions/src/testing/index.ts":{"bytesInOutput":0},"packages/core/functions/src/testing/util.ts":{"bytesInOutput":1067},"packages/core/functions/src/testing/manifest.ts":{"bytesInOutput":146}},"bytes":18145},"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27169},"packages/core/functions/dist/lib/node/chunk-RXMCVAMJ.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"cron-schedule","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["FunctionRegistry","TriggerRegistry","createSubscriptionTrigger","createTimerTrigger"],"inputs":{"packages/core/functions/src/function/function-registry.ts":{"bytesInOutput":3046},"packages/core/functions/src/function/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/type/subscription-trigger.ts":{"bytesInOutput":2007},"packages/core/functions/src/trigger/type/timer-trigger.ts":{"bytesInOutput":1086},"packages/core/functions/src/trigger/trigger-registry.ts":{"bytesInOutput":7538},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":14149},"packages/core/functions/dist/lib/node/types/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/types/index.cjs":{"imports":[{"path":"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","createInvocationSpans","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":1042},"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22236},"packages/core/functions/dist/lib/node/chunk-DSUGRAAL.cjs":{"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema","createInvocationSpans","getInvocationUrl","getUserFunctionUrlInMetadata","setUserFunctionUrlInMetadata"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1084},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3699},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":4133},"packages/core/functions/src/types/url.ts":{"bytesInOutput":1138}},"bytes":10758},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node/chunk-JEQ2X3Z6.cjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":434}}}
|
|
1
|
+
{"inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytes":30207,"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/bundler/index.ts":{"bytes":470,"imports":[{"path":"packages/core/functions/src/bundler/bundler.ts","kind":"import-statement","original":"./bundler"}],"format":"esm"},"packages/core/functions/src/edge/functions.ts":{"bytes":6609,"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/edge/index.ts":{"bytes":877,"imports":[{"path":"packages/core/functions/src/edge/functions.ts","kind":"import-statement","original":"./functions"}],"format":"esm"},"packages/core/functions/src/handler.ts":{"bytes":6306,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/schema.ts":{"bytes":5008,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types.ts":{"bytes":21482,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"}],"format":"esm"},"packages/core/functions/src/trace.ts":{"bytes":16661,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/core/functions/src/url.ts":{"bytes":6002,"imports":[],"format":"esm"},"packages/core/functions/src/services/ai.ts":{"bytes":1000,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/database.ts":{"bytes":951,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/queues.ts":{"bytes":1013,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/credentials.ts":{"bytes":4258,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/tracing.ts":{"bytes":1894,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/services/service-container.ts":{"bytes":5446,"imports":[{"path":"packages/core/functions/src/services/ai.ts","kind":"import-statement","original":"./ai"},{"path":"packages/core/functions/src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/functions/src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"packages/core/functions/src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"packages/core/functions/src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"packages/core/functions/src/services/index.ts":{"bytes":927,"imports":[{"path":"packages/core/functions/src/services/ai.ts","kind":"import-statement","original":"./ai"},{"path":"packages/core/functions/src/services/database.ts","kind":"import-statement","original":"./database"},{"path":"packages/core/functions/src/services/queues.ts","kind":"import-statement","original":"./queues"},{"path":"packages/core/functions/src/services/service-container.ts","kind":"import-statement","original":"./service-container"},{"path":"packages/core/functions/src/services/credentials.ts","kind":"import-statement","original":"./credentials"},{"path":"packages/core/functions/src/services/tracing.ts","kind":"import-statement","original":"./tracing"}],"format":"esm"},"packages/core/functions/src/executor/executor.ts":{"bytes":4794,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/executor/index.ts":{"bytes":472,"imports":[{"path":"packages/core/functions/src/executor/executor.ts","kind":"import-statement","original":"./executor"}],"format":"esm"},"packages/core/functions/src/index.ts":{"bytes":1022,"imports":[{"path":"packages/core/functions/src/handler.ts","kind":"import-statement","original":"./handler"},{"path":"packages/core/functions/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/core/functions/src/trace.ts","kind":"import-statement","original":"./trace"},{"path":"packages/core/functions/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/core/functions/src/url.ts","kind":"import-statement","original":"./url"},{"path":"packages/core/functions/src/services/index.ts","kind":"import-statement","original":"./services"},{"path":"packages/core/functions/src/executor/index.ts","kind":"import-statement","original":"./executor"}],"format":"esm"}},"outputs":{"packages/core/functions/dist/lib/node/bundler/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14572},"packages/core/functions/dist/lib/node/bundler/index.cjs":{"imports":[{"path":"esbuild-wasm","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Bundler","initializeBundler"],"entryPoint":"packages/core/functions/src/bundler/index.ts","inputs":{"packages/core/functions/src/bundler/bundler.ts":{"bytesInOutput":7125},"packages/core/functions/src/bundler/index.ts":{"bytesInOutput":0}},"bytes":7253},"packages/core/functions/dist/lib/node/edge/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3361},"packages/core/functions/dist/lib/node/edge/index.cjs":{"imports":[{"path":"@dxos/client/edge","kind":"import-statement","external":true},{"path":"@dxos/edge-client","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":1692},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":1853},"packages/core/functions/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":39161},"packages/core/functions/dist/lib/node/index.cjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/schema","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["AiService","ConfiguredCredentialsService","CredentialsService","DatabaseService","EmailTriggerOutput","FUNCTIONS_PRESET_META_KEY","FUNCTION_TYPES","FunctionExecutor","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEndEvent","InvocationTraceEventType","InvocationTraceStartEvent","QueueTriggerOutput","QueuesService","ScriptType","ServiceContainer","SubscriptionTriggerOutput","TimerTriggerOutput","TraceEvent","TraceEventException","TraceEventLog","TracingService","TriggerKind","TriggerSchema","WebhookTriggerOutput","createInvocationSpans","defineFunction","getInvocationUrl","getUserFunctionUrlInMetadata","makeFunctionUrl","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/index.ts","inputs":{"packages/core/functions/src/handler.ts":{"bytesInOutput":453},"packages/core/functions/src/index.ts":{"bytesInOutput":0},"packages/core/functions/src/schema.ts":{"bytesInOutput":1212},"packages/core/functions/src/trace.ts":{"bytesInOutput":4282},"packages/core/functions/src/types.ts":{"bytesInOutput":4749},"packages/core/functions/src/url.ts":{"bytesInOutput":1189},"packages/core/functions/src/services/ai.ts":{"bytesInOutput":96},"packages/core/functions/src/services/index.ts":{"bytesInOutput":0},"packages/core/functions/src/services/database.ts":{"bytesInOutput":121},"packages/core/functions/src/services/queues.ts":{"bytesInOutput":117},"packages/core/functions/src/services/credentials.ts":{"bytesInOutput":737},"packages/core/functions/src/services/tracing.ts":{"bytesInOutput":293},"packages/core/functions/src/services/service-container.ts":{"bytesInOutput":967},"packages/core/functions/src/executor/executor.ts":{"bytesInOutput":949},"packages/core/functions/src/executor/index.ts":{"bytesInOutput":0}},"bytes":16595}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/bundler/bundler.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type BuildOptions } from 'esbuild';\nimport { build, initialize, type BuildResult, type Plugin } from 'esbuild-wasm';\n\nimport { subtleCrypto } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nexport type Import = {\n moduleUrl: string;\n defaultImport: boolean;\n namedImports: string[];\n};\n\nexport type BundleOptions = {\n /**\n * Path to the source file on the local file system.\n * If provided, the path will be used instead of the `source` code.\n */\n path?: string;\n\n /**\n * Source code to bundle.\n * Required if `path` is not provided.\n */\n source?: string;\n};\n\nexport type BundleResult = {\n timestamp: number;\n sourceHash?: Buffer;\n imports?: Import[];\n bundle?: string;\n error?: any;\n};\n\nexport type BundlerOptions = {\n platform: BuildOptions['platform'];\n sandboxedModules: string[];\n remoteModules: Record<string, string>;\n};\n\nlet initialized: Promise<void>;\nexport const initializeBundler = async (options: { wasmUrl: string }) => {\n await (initialized ??= initialize({\n wasmURL: options.wasmUrl,\n }));\n};\n\n/**\n * ESBuild bundler.\n */\nexport class Bundler {\n constructor(private readonly _options: BundlerOptions) {}\n\n async bundle({ path, source }: BundleOptions): Promise<BundleResult> {\n const { sandboxedModules: providedModules, ...options } = this._options;\n\n const createResult = async (result?: Partial<BundleResult>) => {\n return {\n timestamp: Date.now(),\n sourceHash: source ? Buffer.from(await subtleCrypto.digest('SHA-256', Buffer.from(source))) : undefined,\n ...result,\n };\n };\n\n if (this._options.platform === 'browser') {\n invariant(initialized, 'Compiler not initialized.');\n await initialized;\n }\n\n const imports = source ? analyzeSourceFileImports(source) : [];\n\n // https://esbuild.github.io/api/#build\n try {\n const result = await build({\n platform: options.platform,\n conditions: ['workerd', 'browser'],\n metafile: true,\n write: false,\n entryPoints: [path ?? 'memory:main.tsx'],\n bundle: true,\n format: 'esm',\n plugins: [\n {\n name: 'memory',\n setup: (build) => {\n build.onResolve({ filter: /^\\.\\/runtime\\.js$/ }, ({ path }) => {\n return { path, external: true };\n });\n\n build.onResolve({ filter: /^dxos:functions$/ }, ({ path }) => {\n return { path: './runtime.js', external: true };\n });\n\n build.onResolve({ filter: /^memory:/ }, ({ path }) => {\n return { path: path.split(':')[1], namespace: 'memory' };\n });\n\n build.onLoad({ filter: /.*/, namespace: 'memory' }, ({ path }) => {\n if (path === 'main.tsx') {\n return {\n contents: source,\n loader: 'tsx',\n };\n }\n });\n\n for (const module of providedModules) {\n build.onResolve({ filter: new RegExp(`^${module}$`) }, ({ path }) => {\n return { path, namespace: 'injected-module' };\n });\n }\n\n build.onLoad({ filter: /.*/, namespace: 'injected-module' }, ({ path }) => {\n const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];\n return {\n contents: `\n const { ${namedImports.join(',')} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];\n export { ${namedImports.join(',')} };\n export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;\n `,\n loader: 'tsx',\n };\n });\n },\n },\n httpPlugin,\n ],\n });\n\n log('compile complete', result.metafile);\n\n return await createResult({\n imports: this.analyzeImports(result),\n bundle: result.outputFiles![0].text,\n });\n } catch (err) {\n return await createResult({ error: err });\n }\n }\n\n // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.\n analyzeImports(result: BuildResult): Import[] {\n invariant(result.outputFiles);\n\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);\n return Object.values(result.metafile!.outputs)[0].imports.map((entry): Import => {\n const namedImports: string[] = [];\n\n const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);\n if (parsedImport?.[2]) {\n NAMED_IMPORTS_REGEX.lastIndex = 0;\n const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);\n if (namedImportsMatch) {\n namedImportsMatch[1].split(',').forEach((importName) => {\n namedImports.push(importName.trim());\n });\n }\n }\n\n return {\n moduleUrl: entry.path,\n defaultImport: !!parsedImport?.[1],\n namedImports,\n };\n });\n }\n\n analyzeSourceFileImports(code: string) {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]?.split(',').map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n }\n}\n\n// https://regex101.com/r/FEN5ks/1\n// https://stackoverflow.com/a/73265022\n// $1 = default import name (can be non-existent)\n// $2 = destructured exports (can be non-existent)\n// $3 = wildcard import name (can be non-existent)\n// $4 = module identifier\n// $5 = quotes used (either ' or \")\nconst IMPORT_REGEX =\n /import(?:(?:(?:[ \\n\\t]+([^ *\\n\\t{},]+)[ \\n\\t]*(?:,|[ \\n\\t]+))?([ \\n\\t]*{(?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+})?[ \\n\\t]*)|[ \\n\\t]*\\*[ \\n\\t]*as[ \\n\\t]+([^ \\n\\t{}]+)[ \\n\\t]+)from[ \\n\\t]*(?:['\"])([^'\"\\n]+)(['\"])/gm;\n\nconst NAMED_IMPORTS_REGEX = /[ \\n\\t]*{((?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+)}[ \\n\\t]*/gm;\n\nconst allMatches = (regex: RegExp, str: string) => {\n regex.lastIndex = 0;\n\n let match;\n const matches = [];\n while ((match = regex.exec(str))) {\n matches.push(match);\n }\n\n return matches;\n};\n\ntype ParsedImport = {\n defaultImportName?: string;\n namedImports: string[];\n wildcardImportName?: string;\n moduleIdentifier: string;\n quotes: string;\n};\n\nconst analyzeSourceFileImports = (code: string): ParsedImport[] => {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]\n ?.trim()\n .slice(1, -1)\n .split(',')\n .map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n};\n\nconst httpPlugin: Plugin = {\n name: 'http',\n setup: (build) => {\n // Intercept import paths starting with \"http:\" and \"https:\" so esbuild doesn't attempt to map them to a file system location.\n // Tag them with the \"http-url\" namespace to associate them with this plugin.\n build.onResolve({ filter: /^https?:\\/\\// }, (args) => ({\n path: args.path,\n namespace: 'http-url',\n }));\n\n // We also want to intercept all import paths inside downloaded files and resolve them against the original URL.\n // All of these files will be in the \"http-url\" namespace.\n // Make sure to keep the newly resolved URL in the \"http-url\" namespace so imports inside it will also be resolved as URLs recursively.\n build.onResolve({ filter: /.*/, namespace: 'http-url' }, (args) => ({\n path: new URL(args.path, args.importer).toString(),\n namespace: 'http-url',\n }));\n\n // When a URL is loaded, we want to actually download the content from the internet.\n // This has just enough logic to be able to handle the example import from unpkg.com but in reality this would probably need to be more complex.\n build.onLoad({ filter: /.*/, namespace: 'http-url' }, async (args) => {\n const response = await fetch(args.path);\n return { contents: await response.text(), loader: 'jsx' };\n });\n },\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["build", "initialize", "subtleCrypto", "invariant", "log", "initialized", "initializeBundler", "options", "wasmURL", "wasmUrl", "Bundler", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type BuildOptions } from 'esbuild';\nimport { build, initialize, type BuildResult, type Plugin } from 'esbuild-wasm';\n\nimport { subtleCrypto } from '@dxos/crypto';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nexport type Import = {\n moduleUrl: string;\n defaultImport: boolean;\n namedImports: string[];\n};\n\nexport type BundleOptions = {\n /**\n * Path to the source file on the local file system.\n * If provided, the path will be used instead of the `source` code.\n */\n path?: string;\n\n /**\n * Source code to bundle.\n * Required if `path` is not provided.\n */\n source?: string;\n};\n\nexport type BundleResult = {\n timestamp: number;\n sourceHash?: Buffer;\n imports?: Import[];\n bundle?: string;\n error?: any;\n};\n\nexport type BundlerOptions = {\n platform: BuildOptions['platform'];\n sandboxedModules: string[];\n remoteModules: Record<string, string>;\n};\n\nlet initialized: Promise<void>;\nexport const initializeBundler = async (options: { wasmUrl: string }) => {\n await (initialized ??= initialize({\n wasmURL: options.wasmUrl,\n }));\n};\n\n/**\n * ESBuild bundler.\n */\nexport class Bundler {\n constructor(private readonly _options: BundlerOptions) {}\n\n async bundle({ path, source }: BundleOptions): Promise<BundleResult> {\n const { sandboxedModules: providedModules, ...options } = this._options;\n\n const createResult = async (result?: Partial<BundleResult>) => {\n return {\n timestamp: Date.now(),\n sourceHash: source ? Buffer.from(await subtleCrypto.digest('SHA-256', Buffer.from(source))) : undefined,\n ...result,\n };\n };\n\n if (this._options.platform === 'browser') {\n invariant(initialized, 'Compiler not initialized.');\n await initialized;\n }\n\n const imports = source ? analyzeSourceFileImports(source) : [];\n\n // https://esbuild.github.io/api/#build\n try {\n const result = await build({\n platform: options.platform,\n conditions: ['workerd', 'browser'],\n metafile: true,\n write: false,\n entryPoints: [path ?? 'memory:main.tsx'],\n bundle: true,\n format: 'esm',\n plugins: [\n {\n name: 'memory',\n setup: (build) => {\n build.onResolve({ filter: /^\\.\\/runtime\\.js$/ }, ({ path }) => {\n return { path, external: true };\n });\n\n build.onResolve({ filter: /^dxos:functions$/ }, ({ path }) => {\n return { path: './runtime.js', external: true };\n });\n\n build.onResolve({ filter: /^memory:/ }, ({ path }) => {\n return { path: path.split(':')[1], namespace: 'memory' };\n });\n\n build.onLoad({ filter: /.*/, namespace: 'memory' }, ({ path }) => {\n if (path === 'main.tsx') {\n return {\n contents: source,\n loader: 'tsx',\n };\n }\n });\n\n for (const module of providedModules) {\n build.onResolve({ filter: new RegExp(`^${module}$`) }, ({ path }) => {\n return { path, namespace: 'injected-module' };\n });\n }\n\n build.onLoad({ filter: /.*/, namespace: 'injected-module' }, ({ path }) => {\n const namedImports = imports.find((entry) => entry.moduleIdentifier === path)?.namedImports ?? [];\n return {\n contents: `\n const { ${namedImports.join(',')} } = window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}];\n export { ${namedImports.join(',')} };\n export default window.__DXOS_SANDBOX_MODULES__[${JSON.stringify(path)}].default;\n `,\n loader: 'tsx',\n };\n });\n },\n },\n httpPlugin,\n ],\n });\n\n log('compile complete', result.metafile);\n\n return await createResult({\n imports: this.analyzeImports(result),\n bundle: result.outputFiles![0].text,\n });\n } catch (err) {\n return await createResult({ error: err });\n }\n }\n\n // TODO(dmaretskyi): In the future we can replace the compiler with SWC with plugins running in WASM.\n analyzeImports(result: BuildResult): Import[] {\n invariant(result.outputFiles);\n\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, result.outputFiles[0].text);\n return Object.values(result.metafile!.outputs)[0].imports.map((entry): Import => {\n const namedImports: string[] = [];\n\n const parsedImport = parsedImports.find((capture) => capture?.[4] === entry.path);\n if (parsedImport?.[2]) {\n NAMED_IMPORTS_REGEX.lastIndex = 0;\n const namedImportsMatch = NAMED_IMPORTS_REGEX.exec(parsedImport[2]);\n if (namedImportsMatch) {\n namedImportsMatch[1].split(',').forEach((importName) => {\n namedImports.push(importName.trim());\n });\n }\n }\n\n return {\n moduleUrl: entry.path,\n defaultImport: !!parsedImport?.[1],\n namedImports,\n };\n });\n }\n\n analyzeSourceFileImports(code: string): {\n defaultImportName: string;\n namedImports: string[];\n wildcardImportName: string;\n moduleIdentifier: string;\n quotes: string;\n }[] {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]?.split(',').map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n }\n}\n\n// https://regex101.com/r/FEN5ks/1\n// https://stackoverflow.com/a/73265022\n// $1 = default import name (can be non-existent)\n// $2 = destructured exports (can be non-existent)\n// $3 = wildcard import name (can be non-existent)\n// $4 = module identifier\n// $5 = quotes used (either ' or \")\nconst IMPORT_REGEX =\n /import(?:(?:(?:[ \\n\\t]+([^ *\\n\\t{},]+)[ \\n\\t]*(?:,|[ \\n\\t]+))?([ \\n\\t]*{(?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+})?[ \\n\\t]*)|[ \\n\\t]*\\*[ \\n\\t]*as[ \\n\\t]+([^ \\n\\t{}]+)[ \\n\\t]+)from[ \\n\\t]*(?:['\"])([^'\"\\n]+)(['\"])/gm;\n\nconst NAMED_IMPORTS_REGEX = /[ \\n\\t]*{((?:[ \\n\\t]*[^ \\n\\t\"'{}]+[ \\n\\t]*,?)+)}[ \\n\\t]*/gm;\n\nconst allMatches = (regex: RegExp, str: string) => {\n regex.lastIndex = 0;\n\n let match;\n const matches = [];\n while ((match = regex.exec(str))) {\n matches.push(match);\n }\n\n return matches;\n};\n\ntype ParsedImport = {\n defaultImportName?: string;\n namedImports: string[];\n wildcardImportName?: string;\n moduleIdentifier: string;\n quotes: string;\n};\n\nconst analyzeSourceFileImports = (code: string): ParsedImport[] => {\n // TODO(dmaretskyi): Support import aliases and wildcard imports.\n const parsedImports = allMatches(IMPORT_REGEX, code);\n return parsedImports.map((capture) => {\n return {\n defaultImportName: capture[1],\n namedImports: capture[2]\n ?.trim()\n .slice(1, -1)\n .split(',')\n .map((importName) => importName.trim()),\n wildcardImportName: capture[3],\n moduleIdentifier: capture[4],\n quotes: capture[5],\n };\n });\n};\n\nconst httpPlugin: Plugin = {\n name: 'http',\n setup: (build) => {\n // Intercept import paths starting with \"http:\" and \"https:\" so esbuild doesn't attempt to map them to a file system location.\n // Tag them with the \"http-url\" namespace to associate them with this plugin.\n build.onResolve({ filter: /^https?:\\/\\// }, (args) => ({\n path: args.path,\n namespace: 'http-url',\n }));\n\n // We also want to intercept all import paths inside downloaded files and resolve them against the original URL.\n // All of these files will be in the \"http-url\" namespace.\n // Make sure to keep the newly resolved URL in the \"http-url\" namespace so imports inside it will also be resolved as URLs recursively.\n build.onResolve({ filter: /.*/, namespace: 'http-url' }, (args) => ({\n path: new URL(args.path, args.importer).toString(),\n namespace: 'http-url',\n }));\n\n // When a URL is loaded, we want to actually download the content from the internet.\n // This has just enough logic to be able to handle the example import from unpkg.com but in reality this would probably need to be more complex.\n build.onLoad({ filter: /.*/, namespace: 'http-url' }, async (args) => {\n const response = await fetch(args.path);\n return { contents: await response.text(), loader: 'jsx' };\n });\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;AAKA,SAASA,OAAOC,kBAAiD;AAEjE,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,WAAW;;AAoCpB,IAAIC;AACG,IAAMC,oBAAoB,OAAOC,YAAAA;AACtC,SAAOF,gBAAgBJ,WAAW;IAChCO,SAASD,QAAQE;EACnB,CAAA;AACF;AAKO,IAAMC,UAAN,MAAMA;EACX,YAA6BC,UAA0B;SAA1BA,WAAAA;EAA2B;EAExD,MAAMC,OAAO,EAAEC,MAAMC,OAAM,GAA0C;AACnE,UAAM,EAAEC,kBAAkBC,iBAAiB,GAAGT,QAAAA,IAAY,KAAKI;AAE/D,UAAMM,eAAe,OAAOC,WAAAA;AAC1B,aAAO;QACLC,WAAWC,KAAKC,IAAG;QACnBC,YAAYR,SAASS,OAAOC,KAAK,MAAMtB,aAAauB,OAAO,WAAWF,OAAOC,KAAKV,MAAAA,CAAAA,CAAAA,IAAYY;QAC9F,GAAGR;MACL;IACF;AAEA,QAAI,KAAKP,SAASgB,aAAa,WAAW;AACxCxB,gBAAUE,aAAa,6BAAA;;;;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F,CAAA;AACF;AAEA,IAAMd,aAAqB;EACzBnB,MAAM;EACNC,OAAO,CAACrC,WAAAA;AAGNA,IAAAA,OAAMsC,UAAU;MAAEC,QAAQ;IAAe,GAAG,CAACkD,UAAU;MACrD5E,MAAM4E,KAAK5E;MACX6B,WAAW;IACb,EAAA;AAKA1C,IAAAA,OAAMsC,UAAU;MAAEC,QAAQ;MAAMG,WAAW;IAAW,GAAG,CAAC+C,UAAU;MAClE5E,MAAM,IAAI6E,IAAID,KAAK5E,MAAM4E,KAAKE,QAAQ,EAAEC,SAAQ;MAChDlD,WAAW;IACb,EAAA;AAIA1C,IAAAA,OAAM2C,OAAO;MAAEJ,QAAQ;MAAMG,WAAW;IAAW,GAAG,OAAO+C,SAAAA;AAC3D,YAAMI,WAAW,MAAMC,MAAML,KAAK5E,IAAI;AACtC,aAAO;QAAE+B,UAAU,MAAMiD,SAASnC,KAAI;QAAIb,QAAQ;MAAM;IAC1D,CAAA;EACF;AACF;",
|
|
6
|
+
"names": ["build", "initialize", "subtleCrypto", "invariant", "log", "initialized", "initializeBundler", "options", "wasmURL", "wasmUrl", "Bundler", "_options", "bundle", "path", "source", "sandboxedModules", "providedModules", "createResult", "result", "timestamp", "Date", "now", "sourceHash", "Buffer", "from", "digest", "undefined", "platform", "imports", "analyzeSourceFileImports", "conditions", "metafile", "write", "entryPoints", "format", "plugins", "name", "setup", "onResolve", "filter", "external", "split", "namespace", "onLoad", "contents", "loader", "module", "RegExp", "namedImports", "find", "entry", "moduleIdentifier", "join", "JSON", "stringify", "httpPlugin", "analyzeImports", "outputFiles", "text", "err", "error", "parsedImports", "allMatches", "IMPORT_REGEX", "Object", "values", "outputs", "map", "parsedImport", "capture", "NAMED_IMPORTS_REGEX", "lastIndex", "namedImportsMatch", "exec", "forEach", "importName", "push", "trim", "moduleUrl", "defaultImport", "code", "defaultImportName", "wildcardImportName", "quotes", "regex", "str", "match", "matches", "slice", "args", "URL", "importer", "toString", "response", "fetch"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,68 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "
|
|
7
|
-
import "
|
|
2
|
+
|
|
3
|
+
// packages/core/functions/src/edge/functions.ts
|
|
4
|
+
import { createEdgeIdentity } from "@dxos/client/edge";
|
|
5
|
+
import { EdgeHttpClient } from "@dxos/edge-client";
|
|
6
|
+
import { invariant } from "@dxos/invariant";
|
|
7
|
+
import { log } from "@dxos/log";
|
|
8
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/edge/functions.ts";
|
|
9
|
+
var uploadWorkerFunction = async ({ client, version, source, name, functionId, ownerPublicKey }) => {
|
|
10
|
+
const edgeUrl = client.config.values.runtime?.services?.edge?.url;
|
|
11
|
+
invariant(edgeUrl, "Edge is not configured.", {
|
|
12
|
+
F: __dxlog_file,
|
|
13
|
+
L: 33,
|
|
14
|
+
S: void 0,
|
|
15
|
+
A: [
|
|
16
|
+
"edgeUrl",
|
|
17
|
+
"'Edge is not configured.'"
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
const edgeClient = new EdgeHttpClient(edgeUrl);
|
|
21
|
+
const edgeIdentity = createEdgeIdentity(client);
|
|
22
|
+
edgeClient.setIdentity(edgeIdentity);
|
|
23
|
+
const response = await edgeClient.uploadFunction({
|
|
24
|
+
functionId
|
|
25
|
+
}, {
|
|
26
|
+
name,
|
|
27
|
+
version,
|
|
28
|
+
script: source,
|
|
29
|
+
ownerPublicKey: ownerPublicKey.toHex()
|
|
30
|
+
});
|
|
31
|
+
log.info("Uploaded", {
|
|
32
|
+
identityKey: edgeIdentity.identityKey,
|
|
33
|
+
functionId,
|
|
34
|
+
name,
|
|
35
|
+
source: source.length,
|
|
36
|
+
response
|
|
37
|
+
}, {
|
|
38
|
+
F: __dxlog_file,
|
|
39
|
+
L: 43,
|
|
40
|
+
S: void 0,
|
|
41
|
+
C: (f, a) => f(...a)
|
|
42
|
+
});
|
|
43
|
+
return response;
|
|
44
|
+
};
|
|
45
|
+
var incrementSemverPatch = (version) => {
|
|
46
|
+
const [major, minor, patch] = version.split(".");
|
|
47
|
+
const patchNum = Number(patch);
|
|
48
|
+
invariant(!Number.isNaN(patchNum), `Unexpected function version format: ${version}`, {
|
|
49
|
+
F: __dxlog_file,
|
|
50
|
+
L: 57,
|
|
51
|
+
S: void 0,
|
|
52
|
+
A: [
|
|
53
|
+
"!Number.isNaN(patchNum)",
|
|
54
|
+
"`Unexpected function version format: ${version}`"
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
return [
|
|
58
|
+
major,
|
|
59
|
+
minor,
|
|
60
|
+
String(patchNum + 1)
|
|
61
|
+
].join(".");
|
|
62
|
+
};
|
|
63
|
+
var publicKeyToDid = (key) => {
|
|
64
|
+
return `did:key:${key.toHex()}`;
|
|
65
|
+
};
|
|
8
66
|
export {
|
|
9
67
|
incrementSemverPatch,
|
|
10
68
|
publicKeyToDid,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [],
|
|
4
|
-
"sourcesContent": [],
|
|
5
|
-
"mappings": "",
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../../../../src/edge/functions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type DID } from 'iso-did/types';\n\nimport { type Client } from '@dxos/client';\nimport { createEdgeIdentity } from '@dxos/client/edge';\nimport { EdgeHttpClient } from '@dxos/edge-client';\nimport { invariant } from '@dxos/invariant';\nimport type { PublicKey } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type UploadFunctionResponseBody } from '@dxos/protocols';\n\nexport type UploadWorkerArgs = {\n client: Client;\n source: string;\n version: string;\n name?: string;\n functionId?: string;\n ownerPublicKey: PublicKey;\n};\n\nexport const uploadWorkerFunction = async ({\n client,\n version,\n source,\n name,\n functionId,\n ownerPublicKey,\n}: UploadWorkerArgs): Promise<UploadFunctionResponseBody> => {\n const edgeUrl = client.config.values.runtime?.services?.edge?.url;\n invariant(edgeUrl, 'Edge is not configured.');\n const edgeClient = new EdgeHttpClient(edgeUrl);\n const edgeIdentity = createEdgeIdentity(client);\n edgeClient.setIdentity(edgeIdentity);\n const response = await edgeClient.uploadFunction(\n { functionId },\n { name, version, script: source, ownerPublicKey: ownerPublicKey.toHex() },\n );\n\n // TODO(burdon): Edge service log.\n log.info('Uploaded', {\n identityKey: edgeIdentity.identityKey,\n functionId,\n name,\n source: source.length,\n response,\n });\n\n return response;\n};\n\nexport const incrementSemverPatch = (version: string): string => {\n const [major, minor, patch] = version.split('.');\n const patchNum = Number(patch);\n invariant(!Number.isNaN(patchNum), `Unexpected function version format: ${version}`);\n return [major, minor, String(patchNum + 1)].join('.');\n};\n\n// TODO(burdon): Factor out.\nexport const publicKeyToDid = (key: PublicKey): DID => {\n return `did:key:${key.toHex()}`;\n};\n"],
|
|
5
|
+
"mappings": ";;;AAOA,SAASA,0BAA0B;AACnC,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAE1B,SAASC,WAAW;;AAYb,IAAMC,uBAAuB,OAAO,EACzCC,QACAC,SACAC,QACAC,MACAC,YACAC,eAAc,MACG;AACjB,QAAMC,UAAUN,OAAOO,OAAOC,OAAOC,SAASC,UAAUC,MAAMC;AAC9Df,YAAUS,SAAS,2BAAA;;;;;;;;;AACnB,QAAMO,aAAa,IAAIjB,eAAeU,OAAAA;AACtC,QAAMQ,eAAenB,mBAAmBK,MAAAA;AACxCa,aAAWE,YAAYD,YAAAA;AACvB,QAAME,WAAW,MAAMH,WAAWI,eAChC;IAAEb;EAAW,GACb;IAAED;IAAMF;IAASiB,QAAQhB;IAAQG,gBAAgBA,eAAec,MAAK;EAAG,CAAA;AAI1ErB,MAAIsB,KAAK,YAAY;IACnBC,aAAaP,aAAaO;IAC1BjB;IACAD;IACAD,QAAQA,OAAOoB;IACfN;EACF,GAAA;;;;;;AAEA,SAAOA;AACT;AAEO,IAAMO,uBAAuB,CAACtB,YAAAA;AACnC,QAAM,CAACuB,OAAOC,OAAOC,KAAAA,IAASzB,QAAQ0B,MAAM,GAAA;AAC5C,QAAMC,WAAWC,OAAOH,KAAAA;AACxB7B,YAAU,CAACgC,OAAOC,MAAMF,QAAAA,GAAW,uCAAuC3B,OAAAA,IAAS;;;;;;;;;AACnF,SAAO;IAACuB;IAAOC;IAAOM,OAAOH,WAAW,CAAA;IAAII,KAAK,GAAA;AACnD;AAGO,IAAMC,iBAAiB,CAACC,QAAAA;AAC7B,SAAO,WAAWA,IAAIf,MAAK,CAAA;AAC7B;",
|
|
6
|
+
"names": ["createEdgeIdentity", "EdgeHttpClient", "invariant", "log", "uploadWorkerFunction", "client", "version", "source", "name", "functionId", "ownerPublicKey", "edgeUrl", "config", "values", "runtime", "services", "edge", "url", "edgeClient", "edgeIdentity", "setIdentity", "response", "uploadFunction", "script", "toHex", "info", "identityKey", "length", "incrementSemverPatch", "major", "minor", "patch", "split", "patchNum", "Number", "isNaN", "String", "join", "publicKeyToDid", "key"]
|
|
7
7
|
}
|