@dxos/functions 0.8.1-main.ae460ac → 0.8.1-staging.31c3ee1
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/{chunk-TMUL6AZC.mjs → chunk-HI7YZO2K.mjs} +27 -25
- package/dist/lib/browser/chunk-HI7YZO2K.mjs.map +7 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs +72 -0
- package/dist/lib/browser/chunk-LT4LR4VU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XK3NINVF.mjs → chunk-RVSG6WTL.mjs} +156 -19
- package/dist/lib/browser/chunk-RVSG6WTL.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +1 -9
- package/dist/lib/browser/index.mjs +16 -10
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/browser/types/index.mjs +19 -5
- package/dist/lib/node/{chunk-3J6FVYUV.cjs → chunk-DSUGRAAL.cjs} +164 -22
- package/dist/lib/node/chunk-DSUGRAAL.cjs.map +7 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs +94 -0
- package/dist/lib/node/chunk-NXZNXVT3.cjs.map +7 -0
- package/dist/lib/node/{chunk-BGDVH6JU.cjs → chunk-RXMCVAMJ.cjs} +40 -38
- package/dist/lib/node/chunk-RXMCVAMJ.cjs.map +7 -0
- package/dist/lib/node/edge/index.cjs +4 -12
- package/dist/lib/node/edge/index.cjs.map +2 -2
- package/dist/lib/node/index.cjs +35 -29
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +7 -7
- package/dist/lib/node/types/index.cjs +31 -17
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{chunk-QRMVAODA.mjs → chunk-HBD2FZXO.mjs} +156 -19
- package/dist/lib/node-esm/chunk-HBD2FZXO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs +72 -0
- package/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-V3VOPFP3.mjs → chunk-SQSJO5HI.mjs} +27 -25
- package/dist/lib/node-esm/chunk-SQSJO5HI.mjs.map +7 -0
- package/dist/lib/node-esm/edge/index.mjs +1 -9
- package/dist/lib/node-esm/index.mjs +16 -10
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/types/index.mjs +19 -5
- package/dist/types/src/edge/functions.d.ts +3 -12
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/handler.d.ts +1 -1
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +20 -26
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/trace.d.ts +103 -97
- package/dist/types/src/types/trace.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +7 -7
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/url.d.ts +11 -0
- package/dist/types/src/types/url.d.ts.map +1 -0
- package/package.json +20 -19
- package/src/edge/functions.ts +12 -71
- package/src/handler.ts +2 -2
- package/src/runtime/scheduler.test.ts +2 -1
- package/src/trigger/type/timer-trigger.ts +21 -18
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +7 -7
- package/src/types/trace.ts +120 -8
- package/src/types/types.ts +2 -1
- package/src/types/url.ts +47 -0
- package/dist/lib/browser/chunk-TMUL6AZC.mjs.map +0 -7
- package/dist/lib/browser/chunk-XK3NINVF.mjs.map +0 -7
- package/dist/lib/browser/chunk-YJEIETRB.mjs +0 -128
- package/dist/lib/browser/chunk-YJEIETRB.mjs.map +0 -7
- package/dist/lib/node/chunk-3J6FVYUV.cjs.map +0 -7
- package/dist/lib/node/chunk-BGDVH6JU.cjs.map +0 -7
- package/dist/lib/node/chunk-MZMHE4DC.cjs +0 -154
- package/dist/lib/node/chunk-MZMHE4DC.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-QRMVAODA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T2KBXTMR.mjs +0 -128
- package/dist/lib/node-esm/chunk-T2KBXTMR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V3VOPFP3.mjs.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": "
|
|
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.schemaRegistry;\n for (const type of types) {\n if (!registry.hasSchema(type)) {\n registry.addSchema([type]);\n }\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,UAAUC,SAAS;AAG5B,SAAsBC,iBAAiB;AAKvC,SAASC,WAAW;AAEpB,SAASC,qBAAqB;;AAoHvB,IAAMC,iBAAiB,CAAOC,WAAAA;AACnC,MAAI,CAACC,EAAEC,SAASF,OAAOG,WAAW,GAAG;AACnC,UAAM,IAAIC,MAAM,qCAAA;EAClB;AACA,MAAI,OAAOJ,OAAOK,YAAY,YAAY;AACxC,UAAM,IAAID,MAAM,4BAAA;EAClB;AAEA,SAAO;IACLE,aAAaN,OAAOM;IACpBH,aAAaH,OAAOG;IACpBI,cAAcP,OAAOO,gBAAgBN,EAAEO;IACvCH,SAASL,OAAOK;EAClB;AACF;AA2BO,IAAMI,sBAAsB,CACjCJ,SACAK,UAAAA;AAEA,SAAO,OAAO,EAAEC,OAAO,EAAEC,KAAI,GAAIC,SAASC,UAAU,GAAGC,KAAAA,MAAM;AAC3D,UAAM,EAAEC,OAAM,IAAKH;AACnB,UAAMI,QAAQL,KAAKM,WAAWF,OAAOG,OAAOC,IAAIC,UAAUC,KAAKV,KAAKM,QAAQ,CAAA,IAAKK;AACjF,QAAI,CAACN,OAAO;AACVO,UAAIC,MAAM,iBAAA,QAAA;;;;;;AACV,aAAOX,SAASY,OAAO,GAAA;IACzB;AAEAC,kBAAcV,OAAOP,KAAAA;AACrB,UAAMkB,UAAUX,QACZL,KAAKgB,SACDC,IAAyC,CAACC,OAAOb,MAAOc,GAAGC,cAAcF,EAAAA,CAAAA,EAC1EG,OAAOC,aAAAA,IACV,CAAA;AAEJ,QAAI,CAAC,CAACtB,KAAKM,YAAY,CAACD,OAAO;AAC7BO,UAAIW,KAAK,iBAAiB;QAAEvB;MAAK,GAAA;;;;;;IACnC,OAAO;AACLY,UAAIY,KAAK,WAAW;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
6
|
"names": ["Schema", "S", "PublicKey", "log", "isNonNullable", "defineFunction", "params", "S", "isSchema", "inputSchema", "Error", "handler", "description", "outputSchema", "Any", "subscriptionHandler", "types", "event", "data", "context", "response", "rest", "client", "space", "spaceKey", "spaces", "get", "PublicKey", "from", "undefined", "log", "error", "status", "registerTypes", "objects", "map", "id", "db", "getObjectById", "filter", "isNonNullable", "warn", "info", "key", "truncate", "length", "registry", "graph", "schemaRegistry", "type", "hasSchema", "addSchema"]
|
|
7
7
|
}
|
|
@@ -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":13907,"imports":[{"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":4417,"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":16526,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/core/functions/src/types/trace.ts":{"bytes":6233,"imports":[{"path":"@dxos/echo-schema","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/index.ts":{"bytes":661,"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"}],"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":14006,"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":4173,"imports":[{"path":"cron","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":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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/browser/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/browser/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","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":7319},"packages/core/functions/dist/lib/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":509},"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7875},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-TMUL6AZC.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","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","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerRegistry","TriggerSchema","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":3453},"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7185},"packages/core/functions/dist/lib/browser/chunk-YJEIETRB.mjs":{"imports":[{"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":["FUNCTIONS_PRESET_META_KEY","getInvocationUrl","getUserFunctionUrlInMetadata","incrementSemverPatch","publicKeyToDid","setUserFunctionUrlInMetadata","uploadWorkerFunction"],"inputs":{"packages/core/functions/src/edge/functions.ts":{"bytesInOutput":3390},"packages/core/functions/src/edge/index.ts":{"bytesInOutput":0}},"bytes":3708},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-TMUL6AZC.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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":2785},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7870},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5374},"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":18208},"packages/core/functions/dist/lib/browser/chunk-TMUL6AZC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":26827},"packages/core/functions/dist/lib/browser/chunk-TMUL6AZC.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs","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","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":898},"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":13994},"packages/core/functions/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":679},"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13919},"packages/core/functions/dist/lib/browser/chunk-XK3NINVF.mjs":{"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}],"exports":["FUNCTION_TYPES","FunctionDef","FunctionManifestSchema","FunctionTrigger","FunctionTriggerSchema","FunctionType","InvocationOutcome","InvocationTraceEvent","ScriptType","TraceEvent","TraceEventException","TraceEventLog","TriggerKind","TriggerSchema"],"inputs":{"packages/core/functions/src/types/schema.ts":{"bytesInOutput":1010},"packages/core/functions/src/types/index.ts":{"bytesInOutput":0},"packages/core/functions/src/types/types.ts":{"bytesInOutput":3644},"packages/core/functions/src/types/trace.ts":{"bytesInOutput":1485}},"bytes":6634},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":467}}}
|
|
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":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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/browser/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/browser/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","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":7319},"packages/core/functions/dist/lib/browser/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-LT4LR4VU.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":283},"packages/core/functions/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7894},"packages/core/functions/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-LT4LR4VU.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-HI7YZO2K.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","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":3623},"packages/core/functions/dist/lib/browser/chunk-LT4LR4VU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3277},"packages/core/functions/dist/lib/browser/chunk-LT4LR4VU.mjs":{"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":1859},"packages/core/functions/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/browser/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-HI7YZO2K.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","kind":"import-statement"},{"path":"get-port-please","kind":"import-statement","external":true},{"path":"@dxos/node-std/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":"@dxos/node-std/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":"@dxos/node-std/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":2785},"packages/core/functions/src/testing/types.ts":{"bytesInOutput":182},"packages/core/functions/src/runtime/dev-server.ts":{"bytesInOutput":7870},"packages/core/functions/src/runtime/index.ts":{"bytesInOutput":0},"packages/core/functions/src/runtime/scheduler.ts":{"bytesInOutput":5374},"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":18208},"packages/core/functions/dist/lib/browser/chunk-HI7YZO2K.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27170},"packages/core/functions/dist/lib/browser/chunk-HI7YZO2K.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs","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":14182},"packages/core/functions/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs","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":1075},"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22238},"packages/core/functions/dist/lib/browser/chunk-RVSG6WTL.mjs":{"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":10792},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/browser/chunk-XRCXIG74.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":467}}}
|
|
@@ -2,11 +2,11 @@ import "@dxos/node-std/globals";
|
|
|
2
2
|
import {
|
|
3
3
|
FunctionRegistry,
|
|
4
4
|
TriggerRegistry
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-HI7YZO2K.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FunctionDef,
|
|
8
8
|
FunctionTrigger
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-RVSG6WTL.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__require
|
|
12
12
|
} from "../chunk-XRCXIG74.mjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
import {
|
|
3
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
3
4
|
FUNCTION_TYPES,
|
|
4
5
|
FunctionDef,
|
|
5
6
|
FunctionManifestSchema,
|
|
@@ -7,16 +8,23 @@ import {
|
|
|
7
8
|
FunctionTriggerSchema,
|
|
8
9
|
FunctionType,
|
|
9
10
|
InvocationOutcome,
|
|
10
|
-
|
|
11
|
+
InvocationTraceEndEvent,
|
|
12
|
+
InvocationTraceEventType,
|
|
13
|
+
InvocationTraceStartEvent,
|
|
11
14
|
ScriptType,
|
|
12
15
|
TraceEvent,
|
|
13
16
|
TraceEventException,
|
|
14
17
|
TraceEventLog,
|
|
15
18
|
TriggerKind,
|
|
16
|
-
TriggerSchema
|
|
17
|
-
|
|
19
|
+
TriggerSchema,
|
|
20
|
+
createInvocationSpans,
|
|
21
|
+
getInvocationUrl,
|
|
22
|
+
getUserFunctionUrlInMetadata,
|
|
23
|
+
setUserFunctionUrlInMetadata
|
|
24
|
+
} from "../chunk-RVSG6WTL.mjs";
|
|
18
25
|
import "../chunk-XRCXIG74.mjs";
|
|
19
26
|
export {
|
|
27
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
20
28
|
FUNCTION_TYPES,
|
|
21
29
|
FunctionDef,
|
|
22
30
|
FunctionManifestSchema,
|
|
@@ -24,12 +32,18 @@ export {
|
|
|
24
32
|
FunctionTriggerSchema,
|
|
25
33
|
FunctionType,
|
|
26
34
|
InvocationOutcome,
|
|
27
|
-
|
|
35
|
+
InvocationTraceEndEvent,
|
|
36
|
+
InvocationTraceEventType,
|
|
37
|
+
InvocationTraceStartEvent,
|
|
28
38
|
ScriptType,
|
|
29
39
|
TraceEvent,
|
|
30
40
|
TraceEventException,
|
|
31
41
|
TraceEventLog,
|
|
32
42
|
TriggerKind,
|
|
33
|
-
TriggerSchema
|
|
43
|
+
TriggerSchema,
|
|
44
|
+
createInvocationSpans,
|
|
45
|
+
getInvocationUrl,
|
|
46
|
+
getUserFunctionUrlInMetadata,
|
|
47
|
+
setUserFunctionUrlInMetadata
|
|
34
48
|
};
|
|
35
49
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -16,8 +16,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_DSUGRAAL_exports = {};
|
|
20
|
+
__export(chunk_DSUGRAAL_exports, {
|
|
21
|
+
FUNCTIONS_PRESET_META_KEY: () => FUNCTIONS_PRESET_META_KEY,
|
|
21
22
|
FUNCTION_TYPES: () => FUNCTION_TYPES,
|
|
22
23
|
FunctionDef: () => FunctionDef,
|
|
23
24
|
FunctionManifestSchema: () => FunctionManifestSchema,
|
|
@@ -25,31 +26,39 @@ __export(chunk_3J6FVYUV_exports, {
|
|
|
25
26
|
FunctionTriggerSchema: () => FunctionTriggerSchema,
|
|
26
27
|
FunctionType: () => FunctionType,
|
|
27
28
|
InvocationOutcome: () => InvocationOutcome,
|
|
28
|
-
|
|
29
|
+
InvocationTraceEndEvent: () => InvocationTraceEndEvent,
|
|
30
|
+
InvocationTraceEventType: () => InvocationTraceEventType,
|
|
31
|
+
InvocationTraceStartEvent: () => InvocationTraceStartEvent,
|
|
29
32
|
ScriptType: () => ScriptType,
|
|
30
33
|
TraceEvent: () => TraceEvent,
|
|
31
34
|
TraceEventException: () => TraceEventException,
|
|
32
35
|
TraceEventLog: () => TraceEventLog,
|
|
33
36
|
TriggerKind: () => TriggerKind,
|
|
34
|
-
TriggerSchema: () => TriggerSchema
|
|
37
|
+
TriggerSchema: () => TriggerSchema,
|
|
38
|
+
createInvocationSpans: () => createInvocationSpans,
|
|
39
|
+
getInvocationUrl: () => getInvocationUrl,
|
|
40
|
+
getUserFunctionUrlInMetadata: () => getUserFunctionUrlInMetadata,
|
|
41
|
+
setUserFunctionUrlInMetadata: () => setUserFunctionUrlInMetadata
|
|
35
42
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(chunk_DSUGRAAL_exports);
|
|
37
44
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
38
45
|
var import_schema = require("@dxos/schema");
|
|
39
46
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
40
47
|
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
version: "0.1.0"
|
|
44
|
-
})({
|
|
48
|
+
var import_log = require("@dxos/log");
|
|
49
|
+
var ScriptType = import_echo_schema.S.Struct({
|
|
45
50
|
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
46
51
|
description: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
47
52
|
// TODO(burdon): Change to hash of deployed content.
|
|
48
53
|
// Whether source has changed since last deploy.
|
|
49
54
|
changed: import_echo_schema.S.optional(import_echo_schema.S.Boolean),
|
|
50
55
|
source: (0, import_echo_schema.Ref)(import_schema.TextType)
|
|
51
|
-
})
|
|
52
|
-
|
|
56
|
+
}).annotations({
|
|
57
|
+
[import_echo_schema.LabelAnnotationId]: "name"
|
|
58
|
+
}).pipe((0, import_echo_schema.EchoObject)({
|
|
59
|
+
typename: "dxos.org/type/Script",
|
|
60
|
+
version: "0.1.0"
|
|
61
|
+
}));
|
|
53
62
|
var FunctionType = class extends (0, import_echo_schema.TypedObject)({
|
|
54
63
|
typename: "dxos.org/type/Function",
|
|
55
64
|
version: "0.1.0"
|
|
@@ -149,7 +158,8 @@ var FunctionTriggerSchema = import_echo_schema2.S.Struct({
|
|
|
149
158
|
})),
|
|
150
159
|
// TODO(burdon): Flatten entire schema.
|
|
151
160
|
spec: import_echo_schema2.S.optional(TriggerSchema),
|
|
152
|
-
// TODO(burdon): Get
|
|
161
|
+
// TODO(burdon): Get schema as partial from function.
|
|
162
|
+
// TODO(wittjosiah): Rename to payload.
|
|
153
163
|
// The `meta` property is merged into the event data passed to the function.
|
|
154
164
|
meta: import_echo_schema2.S.optional(import_echo_schema2.S.mutable(import_echo_schema2.S.Record({
|
|
155
165
|
key: import_echo_schema2.S.String,
|
|
@@ -179,26 +189,47 @@ var FUNCTION_TYPES = [
|
|
|
179
189
|
FunctionDef,
|
|
180
190
|
FunctionTrigger
|
|
181
191
|
];
|
|
192
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/types/trace.ts";
|
|
182
193
|
var InvocationOutcome;
|
|
183
194
|
(function(InvocationOutcome2) {
|
|
184
195
|
InvocationOutcome2["SUCCESS"] = "success";
|
|
185
196
|
InvocationOutcome2["FAILURE"] = "failure";
|
|
197
|
+
InvocationOutcome2["PENDING"] = "pending";
|
|
186
198
|
})(InvocationOutcome || (InvocationOutcome = {}));
|
|
199
|
+
var InvocationTraceEventType;
|
|
200
|
+
(function(InvocationTraceEventType2) {
|
|
201
|
+
InvocationTraceEventType2["START"] = "start";
|
|
202
|
+
InvocationTraceEventType2["END"] = "end";
|
|
203
|
+
})(InvocationTraceEventType || (InvocationTraceEventType = {}));
|
|
187
204
|
var TraceEventException = import_echo_schema3.S.Struct({
|
|
188
205
|
timestampMs: import_echo_schema3.S.Number,
|
|
189
206
|
message: import_echo_schema3.S.String,
|
|
190
207
|
name: import_echo_schema3.S.String,
|
|
191
208
|
stack: import_echo_schema3.S.optional(import_echo_schema3.S.String)
|
|
192
209
|
});
|
|
193
|
-
var
|
|
210
|
+
var InvocationTraceStartEvent = import_echo_schema3.S.Struct({
|
|
211
|
+
/**
|
|
212
|
+
* Queue message id.
|
|
213
|
+
*/
|
|
194
214
|
id: import_echo_schema3.ObjectId,
|
|
215
|
+
type: import_echo_schema3.S.Literal("start"),
|
|
216
|
+
/**
|
|
217
|
+
* Invocation id, the same for invocation start and end events.
|
|
218
|
+
*/
|
|
219
|
+
invocationId: import_echo_schema3.ObjectId,
|
|
220
|
+
/**
|
|
221
|
+
* Event generation time.
|
|
222
|
+
*/
|
|
195
223
|
timestampMs: import_echo_schema3.S.Number,
|
|
196
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Data passed to function / workflow as an argument.
|
|
226
|
+
*/
|
|
227
|
+
// TODO(burdon): Input schema?
|
|
197
228
|
input: import_echo_schema3.S.Object,
|
|
198
|
-
durationMs: import_echo_schema3.S.Number,
|
|
199
229
|
/**
|
|
200
230
|
* Queue DXN for function/workflow invocation events.
|
|
201
231
|
*/
|
|
232
|
+
// TODO(burdon): Need reference type for queue. vs. string?
|
|
202
233
|
invocationTraceQueue: (0, import_echo_schema3.Ref)(import_echo_schema3.Expando),
|
|
203
234
|
/**
|
|
204
235
|
* DXN of the invoked function/workflow.
|
|
@@ -207,12 +238,32 @@ var InvocationTraceEvent = import_echo_schema3.S.Struct({
|
|
|
207
238
|
/**
|
|
208
239
|
* Present for automatic invocations.
|
|
209
240
|
*/
|
|
210
|
-
trigger: import_echo_schema3.S.optional((0, import_echo_schema3.Ref)(FunctionTrigger))
|
|
241
|
+
trigger: import_echo_schema3.S.optional((0, import_echo_schema3.Ref)(FunctionTrigger))
|
|
242
|
+
}).pipe((0, import_echo_schema3.EchoObject)({
|
|
243
|
+
typename: "dxos.org/type/InvocationTraceStart",
|
|
244
|
+
version: "0.1.0"
|
|
245
|
+
}));
|
|
246
|
+
var InvocationTraceEndEvent = import_echo_schema3.S.Struct({
|
|
247
|
+
/**
|
|
248
|
+
* Trace event id.
|
|
249
|
+
*/
|
|
250
|
+
id: import_echo_schema3.ObjectId,
|
|
251
|
+
type: import_echo_schema3.S.Literal("end"),
|
|
252
|
+
/**
|
|
253
|
+
* Invocation id, will be the same for invocation start and end.
|
|
254
|
+
*/
|
|
255
|
+
invocationId: import_echo_schema3.ObjectId,
|
|
211
256
|
/**
|
|
212
|
-
*
|
|
257
|
+
* Event generation time.
|
|
213
258
|
*/
|
|
259
|
+
// TODO(burdon): Remove ms suffix.
|
|
260
|
+
timestampMs: import_echo_schema3.S.Number,
|
|
261
|
+
outcome: import_echo_schema3.S.Enums(InvocationOutcome),
|
|
214
262
|
exception: import_echo_schema3.S.optional(TraceEventException)
|
|
215
|
-
}).pipe((0, import_echo_schema3.EchoObject)(
|
|
263
|
+
}).pipe((0, import_echo_schema3.EchoObject)({
|
|
264
|
+
typename: "dxos.org/type/InvocationTraceEnd",
|
|
265
|
+
version: "0.1.0"
|
|
266
|
+
}));
|
|
216
267
|
var TraceEventLog = import_echo_schema3.S.Struct({
|
|
217
268
|
timestampMs: import_echo_schema3.S.Number,
|
|
218
269
|
level: import_echo_schema3.S.String,
|
|
@@ -221,6 +272,7 @@ var TraceEventLog = import_echo_schema3.S.Struct({
|
|
|
221
272
|
});
|
|
222
273
|
var TraceEvent = import_echo_schema3.S.Struct({
|
|
223
274
|
id: import_echo_schema3.ObjectId,
|
|
275
|
+
// TODO(burdon): Need enum/numeric result (not string).
|
|
224
276
|
outcome: import_echo_schema3.S.String,
|
|
225
277
|
truncated: import_echo_schema3.S.Boolean,
|
|
226
278
|
/**
|
|
@@ -229,9 +281,93 @@ var TraceEvent = import_echo_schema3.S.Struct({
|
|
|
229
281
|
ingestionTimestampMs: import_echo_schema3.S.Number,
|
|
230
282
|
logs: import_echo_schema3.S.Array(TraceEventLog),
|
|
231
283
|
exceptions: import_echo_schema3.S.Array(TraceEventException)
|
|
232
|
-
}).pipe((0, import_echo_schema3.EchoObject)(
|
|
284
|
+
}).pipe((0, import_echo_schema3.EchoObject)({
|
|
285
|
+
typename: "dxos.org/type/TraceEvent",
|
|
286
|
+
version: "0.1.0"
|
|
287
|
+
}));
|
|
288
|
+
var createInvocationSpans = (items) => {
|
|
289
|
+
if (!items) {
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
const eventsByInvocationId = /* @__PURE__ */ new Map();
|
|
293
|
+
for (const event of items) {
|
|
294
|
+
if (!("invocationId" in event)) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const invocationId = event.invocationId;
|
|
298
|
+
const entry = eventsByInvocationId.get(invocationId) || {
|
|
299
|
+
start: void 0,
|
|
300
|
+
end: void 0
|
|
301
|
+
};
|
|
302
|
+
if (event.type === "start") {
|
|
303
|
+
entry.start = event;
|
|
304
|
+
} else if (event.type === "end") {
|
|
305
|
+
entry.end = event;
|
|
306
|
+
}
|
|
307
|
+
eventsByInvocationId.set(invocationId, entry);
|
|
308
|
+
}
|
|
309
|
+
const now = Date.now();
|
|
310
|
+
const result = [];
|
|
311
|
+
for (const [invocationId, { start, end }] of eventsByInvocationId.entries()) {
|
|
312
|
+
if (!start) {
|
|
313
|
+
import_log.log.warn("found end event without matching start", {
|
|
314
|
+
invocationId
|
|
315
|
+
}, {
|
|
316
|
+
F: __dxlog_file,
|
|
317
|
+
L: 158,
|
|
318
|
+
S: void 0,
|
|
319
|
+
C: (f, a) => f(...a)
|
|
320
|
+
});
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const isInProgress = end === void 0;
|
|
324
|
+
result.push({
|
|
325
|
+
id: invocationId,
|
|
326
|
+
timestampMs: start.timestampMs,
|
|
327
|
+
durationMs: isInProgress ? now - start.timestampMs : end.timestampMs - start.timestampMs,
|
|
328
|
+
outcome: end?.outcome ?? "pending",
|
|
329
|
+
exception: end?.exception,
|
|
330
|
+
input: start.input,
|
|
331
|
+
invocationTraceQueue: start.invocationTraceQueue,
|
|
332
|
+
invocationTarget: start.invocationTarget,
|
|
333
|
+
trigger: start.trigger
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return result;
|
|
337
|
+
};
|
|
338
|
+
var FUNCTIONS_META_KEY = "dxos.org/service/function";
|
|
339
|
+
var FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
340
|
+
var isSecure = (protocol) => {
|
|
341
|
+
return protocol === "https:" || protocol === "wss:";
|
|
342
|
+
};
|
|
343
|
+
var getUserFunctionUrlInMetadata = (meta) => {
|
|
344
|
+
return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
|
|
345
|
+
};
|
|
346
|
+
var setUserFunctionUrlInMetadata = (meta, functionUrl) => {
|
|
347
|
+
const key = meta.keys.find((key2) => key2.source === FUNCTIONS_META_KEY);
|
|
348
|
+
if (key) {
|
|
349
|
+
if (key.id !== functionUrl) {
|
|
350
|
+
throw new Error("Metadata mismatch");
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
meta.keys.push({
|
|
354
|
+
source: FUNCTIONS_META_KEY,
|
|
355
|
+
id: functionUrl
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
var getInvocationUrl = (functionUrl, edgeUrl, options = {}) => {
|
|
360
|
+
const baseUrl = new URL("functions/", edgeUrl);
|
|
361
|
+
const relativeUrl = functionUrl.replace(/^\//, "");
|
|
362
|
+
const url = new URL(`./${relativeUrl}`, baseUrl.toString());
|
|
363
|
+
options.spaceId && url.searchParams.set("spaceId", options.spaceId);
|
|
364
|
+
options.subjectId && url.searchParams.set("subjectId", options.subjectId);
|
|
365
|
+
url.protocol = isSecure(url.protocol) ? "https" : "http";
|
|
366
|
+
return url.toString();
|
|
367
|
+
};
|
|
233
368
|
// Annotate the CommonJS export names for ESM import in node:
|
|
234
369
|
0 && (module.exports = {
|
|
370
|
+
FUNCTIONS_PRESET_META_KEY,
|
|
235
371
|
FUNCTION_TYPES,
|
|
236
372
|
FunctionDef,
|
|
237
373
|
FunctionManifestSchema,
|
|
@@ -239,12 +375,18 @@ var TraceEvent = import_echo_schema3.S.Struct({
|
|
|
239
375
|
FunctionTriggerSchema,
|
|
240
376
|
FunctionType,
|
|
241
377
|
InvocationOutcome,
|
|
242
|
-
|
|
378
|
+
InvocationTraceEndEvent,
|
|
379
|
+
InvocationTraceEventType,
|
|
380
|
+
InvocationTraceStartEvent,
|
|
243
381
|
ScriptType,
|
|
244
382
|
TraceEvent,
|
|
245
383
|
TraceEventException,
|
|
246
384
|
TraceEventLog,
|
|
247
385
|
TriggerKind,
|
|
248
|
-
TriggerSchema
|
|
386
|
+
TriggerSchema,
|
|
387
|
+
createInvocationSpans,
|
|
388
|
+
getInvocationUrl,
|
|
389
|
+
getUserFunctionUrlInMetadata,
|
|
390
|
+
setUserFunctionUrlInMetadata
|
|
249
391
|
});
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
392
|
+
//# sourceMappingURL=chunk-DSUGRAAL.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts", "../../../src/types/trace.ts", "../../../src/types/url.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport const ScriptType = S.Struct({\n name: S.optional(S.String),\n description: S.optional(S.String),\n // TODO(burdon): Change to hash of deployed content.\n // Whether source has changed since last deploy.\n changed: S.optional(S.Boolean),\n source: Ref(TextType),\n})\n .annotations({ [LabelAnnotationId]: 'name' })\n .pipe(EchoObject({ typename: 'dxos.org/type/Script', version: '0.1.0' }));\n\nexport type ScriptType = S.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: S.NonEmptyString,\n version: S.String,\n\n description: S.optional(S.String),\n\n // Reference to a source script if it exists within ECHO.\n // TODO(burdon): Don't ref ScriptType directly (core).\n source: S.optional(Ref(ScriptType)),\n\n inputSchema: S.optional(JsonSchemaType),\n outputSchema: S.optional(JsonSchemaType),\n\n // Local binding to a function name.\n binding: S.optional(S.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AST, OptionsAnnotationId, RawObject, S, TypedObject, DXN } from '@dxos/echo-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\n// TODO(burdon): Rename prop kind.\nconst typeLiteralAnnotations = { [AST.TitleAnnotationId]: 'Type' };\n\n/**\n * Cron timer.\n */\nconst TimerTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),\n cron: S.String.annotations({\n [AST.TitleAnnotationId]: 'Cron',\n [AST.ExamplesAnnotationId]: ['0 0 * * *'],\n }),\n}).pipe(S.mutable);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst EmailTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),\n}).pipe(S.mutable);\n\nexport type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;\n\nconst QueueTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),\n queue: DXN,\n}).pipe(S.mutable);\n\nexport type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;\n\n/**\n * Webhook.\n */\nconst WebhookTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),\n method: S.optional(\n S.String.annotations({\n [AST.TitleAnnotationId]: 'Method',\n [OptionsAnnotationId]: ['GET', 'POST'],\n }),\n ),\n port: S.optional(\n S.Number.annotations({\n [AST.TitleAnnotationId]: 'Port',\n }),\n ),\n}).pipe(S.mutable);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\n// TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).\nconst QuerySchema = S.Struct({\n type: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Type' })),\n props: S.optional(S.Record({ key: S.String, value: S.Any })),\n}).annotations({ [AST.TitleAnnotationId]: 'Query' });\n\n/**\n * Subscription.\n */\nconst SubscriptionTriggerSchema = S.Struct({\n type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),\n // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.\n filter: QuerySchema,\n options: S.optional(\n S.Struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Nested' })),\n // Debounce changes (delay in ms).\n delay: S.optional(S.Number.annotations({ [AST.TitleAnnotationId]: 'Delay' })),\n }).annotations({ [AST.TitleAnnotationId]: 'Options' }),\n ),\n}).pipe(S.mutable);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\n/**\n * Trigger schema (discriminated union).\n */\nexport const TriggerSchema = S.Union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\n EmailTriggerSchema,\n QueueTriggerSchema,\n).annotations({\n [AST.TitleAnnotationId]: 'Trigger',\n});\n\nexport type TriggerType = S.Schema.Type<typeof TriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport const FunctionTriggerSchema = S.Struct({\n // TODO(burdon): What type does this reference.\n // TODO(wittjosiah): This should probably be a Ref?\n function: S.optional(S.String.annotations({ [AST.TitleAnnotationId]: 'Function' })),\n\n enabled: S.optional(S.Boolean.annotations({ [AST.TitleAnnotationId]: 'Enabled' })),\n\n // TODO(burdon): Flatten entire schema.\n spec: S.optional(TriggerSchema),\n\n // TODO(burdon): Get schema as partial from function.\n // TODO(wittjosiah): Rename to payload.\n // The `meta` property is merged into the event data passed to the function.\n meta: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),\n});\n\nexport type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;\n\n/**\n * Function trigger.\n */\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})(FunctionTriggerSchema.fields) {}\n\n/**\n * Function definition.\n * @deprecated (Use dxos.org/type/Function)\n */\n// TODO(burdon): Reconcile with FunctionType.\nexport class FunctionDef extends TypedObject({\n typename: 'dxos.org/type/FunctionDef',\n version: '0.1.0',\n})({\n uri: S.String,\n description: S.optional(S.String),\n route: S.String,\n handler: S.String,\n}) {}\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = S.Struct({\n functions: S.optional(S.mutable(S.Array(RawObject(FunctionDef)))),\n triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),\n});\n\nexport type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;\n\nexport const FUNCTION_TYPES = [FunctionDef, FunctionTrigger];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { EchoObject, Expando, ObjectId, Ref, S } 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 = S.Struct({\n timestampMs: S.Number,\n message: S.String,\n name: S.String,\n stack: S.optional(S.String),\n});\nexport type TraceEventException = S.Schema.Type<typeof TraceEventException>;\n\nexport const InvocationTraceStartEvent = S.Struct({\n /**\n * Queue message id.\n */\n id: ObjectId,\n type: S.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: S.Number,\n /**\n * Data passed to function / workflow as an argument.\n */\n // TODO(burdon): Input schema?\n input: S.Object,\n /**\n * Queue DXN for function/workflow invocation events.\n */\n // TODO(burdon): Need reference type for queue. vs. string?\n invocationTraceQueue: Ref(Expando),\n /**\n * DXN of the invoked function/workflow.\n */\n invocationTarget: Ref(Expando),\n /**\n * Present for automatic invocations.\n */\n trigger: S.optional(Ref(FunctionTrigger)),\n}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceStart', version: '0.1.0' }));\n\nexport type InvocationTraceStartEvent = S.Schema.Type<typeof InvocationTraceStartEvent>;\n\nexport const InvocationTraceEndEvent = S.Struct({\n /**\n * Trace event id.\n */\n id: ObjectId,\n type: S.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: S.Number,\n outcome: S.Enums(InvocationOutcome),\n exception: S.optional(TraceEventException),\n}).pipe(EchoObject({ typename: 'dxos.org/type/InvocationTraceEnd', version: '0.1.0' }));\n\nexport type InvocationTraceEndEvent = S.Schema.Type<typeof InvocationTraceEndEvent>;\n\nexport type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;\n\nexport const TraceEventLog = S.Struct({\n timestampMs: S.Number,\n level: S.String,\n message: S.String,\n context: S.optional(S.Object),\n});\n\nexport const TraceEvent = S.Struct({\n id: ObjectId,\n // TODO(burdon): Need enum/numeric result (not string).\n outcome: S.String,\n truncated: S.Boolean,\n /**\n * Time when the event was persisted.\n */\n ingestionTimestampMs: S.Number,\n logs: S.Array(TraceEventLog),\n exceptions: S.Array(TraceEventException),\n}).pipe(EchoObject({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));\n\nexport type TraceEvent = S.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<Expando>;\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 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\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAmF;AACnF,oBAAyB;ACDzB,IAAAA,sBAAyE;ACAzE,IAAAA,sBAAsD;AACtD,iBAAoB;AFKb,IAAMC,aAAaC,qBAAEC,OAAO;EACjCC,MAAMF,qBAAEG,SAASH,qBAAEI,MAAM;EACzBC,aAAaL,qBAAEG,SAASH,qBAAEI,MAAM;;;EAGhCE,SAASN,qBAAEG,SAASH,qBAAEO,OAAO;EAC7BC,YAAQC,wBAAIC,sBAAAA;AACd,CAAA,EACGC,YAAY;EAAE,CAACC,oCAAAA,GAAoB;AAAO,CAAA,EAC1CC,SAAKC,+BAAW;EAAEC,UAAU;EAAwBC,SAAS;AAAQ,CAAA,CAAA;AAOjE,IAAMC,eAAN,kBAA2BC,gCAAY;EAC5CH,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDd,MAAMF,qBAAEmB;EACRH,SAAShB,qBAAEI;EAEXC,aAAaL,qBAAEG,SAASH,qBAAEI,MAAM;;;EAIhCI,QAAQR,qBAAEG,aAASM,wBAAIV,UAAAA,CAAAA;EAEvBqB,aAAapB,qBAAEG,SAASkB,iCAAAA;EACxBC,cAActB,qBAAEG,SAASkB,iCAAAA;;EAGzBE,SAASvB,qBAAEG,SAASH,qBAAEI,MAAM;AAC9B,CAAA,EAAA;AAAI;;UClCQoB,cAAAA;;;;;;GAAAA,gBAAAA,cAAAA,CAAAA,EAAAA;AASZ,IAAMC,yBAAyB;EAAE,CAACC,wBAAIC,iBAAiB,GAAG;AAAO;AAKjE,IAAMC,qBAAqB5B,o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BAAkBqB,MAAMrB;MACxBC,SAASoB,MAAMpB;IACjB,CAAA;EACF;AAEA,SAAO0B;AACT;ACzKA,IAAMO,qBAAqB;AAEpB,IAAMC,4BAA4B;AAEzC,IAAMC,WAAW,CAACC,aAAAA;AAChB,SAAOA,aAAa,YAAYA,aAAa;AAC/C;AAEO,IAAMC,+BAA+B,CAACjE,SAAAA;AAC3C,SAAOA,KAAKkE,KAAKC,KAAK,CAACjF,QAAQA,IAAItC,WAAWiH,kBAAAA,GAAqBzC;AACrE;AAEO,IAAMgD,+BAA+B,CAACpE,MAAkBqE,gBAAAA;AAC7D,QAAMnF,MAAMc,KAAKkE,KAAKC,KAAK,CAACjF,SAAQA,KAAItC,WAAWiH,kBAAAA;AACnD,MAAI3E,KAAK;AACP,QAAIA,IAAIkC,OAAOiD,aAAa;AAC1B,YAAM,IAAIC,MAAM,mBAAA;IAClB;EACF,OAAO;AACLtE,SAAKkE,KAAKP,KAAK;MAAE/G,QAAQiH;MAAoBzC,IAAIiD;IAAY,CAAA;EAC/D;AACF;AAEO,IAAME,mBAAmB,CAACF,aAAqBG,SAAiBjF,UAA6B,CAAC,MAAC;AACpG,QAAMkF,UAAU,IAAIC,IAAI,cAAcF,OAAAA;AAGtC,QAAMG,cAAcN,YAAYO,QAAQ,OAAO,EAAA;AAC/C,QAAMC,MAAM,IAAIH,IAAI,KAAKC,WAAAA,IAAeF,QAAQK,SAAQ,CAAA;AACxDvF,UAAQwF,WAAWF,IAAIG,aAAa7B,IAAI,WAAW5D,QAAQwF,OAAO;AAClExF,UAAQ0F,aAAaJ,IAAIG,aAAa7B,IAAI,aAAa5D,QAAQ0F,SAAS;AACxEJ,MAAIb,WAAWD,SAASc,IAAIb,QAAQ,IAAI,UAAU;AAClD,SAAOa,IAAIC,SAAQ;AACrB;",
|
|
6
|
+
"names": ["import_echo_schema", "ScriptType", "S", "Struct", "name", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "TextType", "annotations", "LabelAnnotationId", "pipe", "EchoObject", "typename", "version", "FunctionType", "TypedObject", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "type", "Literal", "cron", "ExamplesAnnotationId", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "fields", "FunctionDef", "uri", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "InvocationOutcome", "InvocationTraceEventType", "TraceEventException", "timestampMs", "message", "stack", "InvocationTraceStartEvent", "id", "ObjectId", "invocationId", "input", "Object", "invocationTraceQueue", "Expando", "invocationTarget", "trigger", "InvocationTraceEndEvent", "outcome", "Enums", "exception", "TraceEventLog", "level", "context", "TraceEvent", "truncated", "ingestionTimestampMs", "logs", "exceptions", "createInvocationSpans", "items", "eventsByInvocationId", "Map", "event", "entry", "get", "start", "undefined", "end", "set", "now", "Date", "result", "entries", "log", "warn", "isInProgress", "push", "durationMs", "FUNCTIONS_META_KEY", "FUNCTIONS_PRESET_META_KEY", "isSecure", "protocol", "getUserFunctionUrlInMetadata", "keys", "find", "setUserFunctionUrlInMetadata", "functionUrl", "Error", "getInvocationUrl", "edgeUrl", "baseUrl", "URL", "relativeUrl", "replace", "url", "toString", "spaceId", "searchParams", "subjectId"]
|
|
7
|
+
}
|