@dxos/functions 0.8.1 → 0.8.2-main.12df754
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-RVSG6WTL.mjs → chunk-2YE6S7XY.mjs} +3 -1
- package/dist/lib/{node-esm/chunk-HBD2FZXO.mjs.map → browser/chunk-2YE6S7XY.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-HI7YZO2K.mjs → chunk-7CHDHCV3.mjs} +6 -6
- package/dist/lib/browser/chunk-7CHDHCV3.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -5
- 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 +3 -1
- package/dist/lib/node/{chunk-RXMCVAMJ.cjs → chunk-FBIUZ7SD.cjs} +15 -15
- package/dist/lib/node/chunk-FBIUZ7SD.cjs.map +7 -0
- package/dist/lib/node/{chunk-DSUGRAAL.cjs → chunk-SV5NRE5L.cjs} +7 -4
- package/dist/lib/node/{chunk-DSUGRAAL.cjs.map → chunk-SV5NRE5L.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +32 -30
- 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 +24 -22
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{chunk-HBD2FZXO.mjs → chunk-3XMJFSID.mjs} +3 -1
- package/dist/lib/{browser/chunk-RVSG6WTL.mjs.map → node-esm/chunk-3XMJFSID.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-SQSJO5HI.mjs → chunk-C6YINTWG.mjs} +6 -6
- package/dist/lib/node-esm/chunk-C6YINTWG.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +7 -5
- 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 +3 -1
- package/dist/types/src/function/function-registry.d.ts.map +1 -1
- package/dist/types/src/handler.d.ts +4 -3
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -1
- package/dist/types/src/types/url.d.ts +6 -0
- package/dist/types/src/types/url.d.ts.map +1 -1
- package/package.json +19 -18
- package/src/function/function-registry.test.ts +3 -3
- package/src/function/function-registry.ts +2 -2
- package/src/handler.ts +4 -3
- package/src/runtime/scheduler.test.ts +2 -2
- package/src/testing/functions-integration.test.ts +4 -4
- package/src/trigger/trigger-registry.test.ts +6 -6
- package/src/trigger/trigger-registry.ts +2 -2
- package/src/types/url.ts +5 -0
- package/dist/lib/browser/chunk-HI7YZO2K.mjs.map +0 -7
- package/dist/lib/node/chunk-RXMCVAMJ.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-SQSJO5HI.mjs.map +0 -7
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
TriggerRegistry,
|
|
10
10
|
createSubscriptionTrigger,
|
|
11
11
|
createTimerTrigger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-C6YINTWG.mjs";
|
|
13
13
|
import {
|
|
14
14
|
FUNCTIONS_PRESET_META_KEY,
|
|
15
15
|
FUNCTION_TYPES,
|
|
@@ -31,8 +31,9 @@ import {
|
|
|
31
31
|
createInvocationSpans,
|
|
32
32
|
getInvocationUrl,
|
|
33
33
|
getUserFunctionUrlInMetadata,
|
|
34
|
+
makeFunctionUrl,
|
|
34
35
|
setUserFunctionUrlInMetadata
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3XMJFSID.mjs";
|
|
36
37
|
import "./chunk-DHGBFXSZ.mjs";
|
|
37
38
|
|
|
38
39
|
// packages/core/functions/src/handler.ts
|
|
@@ -62,7 +63,7 @@ var subscriptionHandler = (handler, types) => {
|
|
|
62
63
|
if (!space) {
|
|
63
64
|
log.error("Invalid space", void 0, {
|
|
64
65
|
F: __dxlog_file,
|
|
65
|
-
L:
|
|
66
|
+
L: 181,
|
|
66
67
|
S: void 0,
|
|
67
68
|
C: (f, a) => f(...a)
|
|
68
69
|
});
|
|
@@ -75,7 +76,7 @@ var subscriptionHandler = (handler, types) => {
|
|
|
75
76
|
data
|
|
76
77
|
}, {
|
|
77
78
|
F: __dxlog_file,
|
|
78
|
-
L:
|
|
79
|
+
L: 193,
|
|
79
80
|
S: void 0,
|
|
80
81
|
C: (f, a) => f(...a)
|
|
81
82
|
});
|
|
@@ -85,7 +86,7 @@ var subscriptionHandler = (handler, types) => {
|
|
|
85
86
|
objects: objects?.length
|
|
86
87
|
}, {
|
|
87
88
|
F: __dxlog_file,
|
|
88
|
-
L:
|
|
89
|
+
L: 195,
|
|
89
90
|
S: void 0,
|
|
90
91
|
C: (f, a) => f(...a)
|
|
91
92
|
});
|
|
@@ -141,6 +142,7 @@ export {
|
|
|
141
142
|
getInvocationUrl,
|
|
142
143
|
getUserFunctionUrlInMetadata,
|
|
143
144
|
incrementSemverPatch,
|
|
145
|
+
makeFunctionUrl,
|
|
144
146
|
publicKeyToDid,
|
|
145
147
|
setUserFunctionUrlInMetadata,
|
|
146
148
|
subscriptionHandler,
|
|
@@ -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
|
|
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 AIServiceClient } from '@dxos/assistant';\nimport { type Client, PublicKey } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';\nimport { type HasId } from '@dxos/echo-schema';\nimport { type SpaceId, 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: AIServiceClient;\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;AAI5B,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":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-esm/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/node-esm/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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":7378},"packages/core/functions/dist/lib/node-esm/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":342},"packages/core/functions/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7894},"packages/core/functions/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-SQSJO5HI.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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":3682},"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3277},"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.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":1918},"packages/core/functions/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-SQSJO5HI.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs","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":18237},"packages/core/functions/dist/lib/node-esm/chunk-SQSJO5HI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27170},"packages/core/functions/dist/lib/node-esm/chunk-SQSJO5HI.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.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":14241},"packages/core/functions/dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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":1134},"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22238},"packages/core/functions/dist/lib/node-esm/chunk-HBD2FZXO.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":10851},"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":526}}}
|
|
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":6184,"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":12992,"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":14102,"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":28453,"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-esm/bundler/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14437},"packages/core/functions/dist/lib/node-esm/bundler/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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":7378},"packages/core/functions/dist/lib/node-esm/edge/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/edge/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs","kind":"import-statement"}],"exports":["incrementSemverPatch","publicKeyToDid","uploadWorkerFunction"],"entryPoint":"packages/core/functions/src/edge/index.ts","inputs":{},"bytes":342},"packages/core/functions/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7950},"packages/core/functions/dist/lib/node-esm/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-C6YINTWG.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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","makeFunctionUrl","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":3720},"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3277},"packages/core/functions/dist/lib/node-esm/chunk-O2SXVYU5.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":1918},"packages/core/functions/dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":32290},"packages/core/functions/dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-C6YINTWG.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs","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":18237},"packages/core/functions/dist/lib/node-esm/chunk-C6YINTWG.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":27154},"packages/core/functions/dist/lib/node-esm/chunk-C6YINTWG.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.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":3042},"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":7532},"packages/core/functions/src/trigger/type/index.ts":{"bytesInOutput":0},"packages/core/functions/src/trigger/index.ts":{"bytesInOutput":0}},"bytes":14231},"packages/core/functions/dist/lib/node-esm/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/types/index.mjs":{"imports":[{"path":"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.mjs","kind":"import-statement"},{"path":"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.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","makeFunctionUrl","setUserFunctionUrlInMetadata"],"entryPoint":"packages/core/functions/src/types/index.ts","inputs":{},"bytes":1172},"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22526},"packages/core/functions/dist/lib/node-esm/chunk-3XMJFSID.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","makeFunctionUrl","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":1209}},"bytes":10941},"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/core/functions/dist/lib/node-esm/chunk-DHGBFXSZ.mjs":{"imports":[],"exports":["__require"],"inputs":{},"bytes":526}}}
|
|
@@ -2,11 +2,11 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
FunctionRegistry,
|
|
4
4
|
TriggerRegistry
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-C6YINTWG.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FunctionDef,
|
|
8
8
|
FunctionTrigger
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-3XMJFSID.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__require
|
|
12
12
|
} from "../chunk-DHGBFXSZ.mjs";
|
|
@@ -20,8 +20,9 @@ import {
|
|
|
20
20
|
createInvocationSpans,
|
|
21
21
|
getInvocationUrl,
|
|
22
22
|
getUserFunctionUrlInMetadata,
|
|
23
|
+
makeFunctionUrl,
|
|
23
24
|
setUserFunctionUrlInMetadata
|
|
24
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-3XMJFSID.mjs";
|
|
25
26
|
import "../chunk-DHGBFXSZ.mjs";
|
|
26
27
|
export {
|
|
27
28
|
FUNCTIONS_PRESET_META_KEY,
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
createInvocationSpans,
|
|
45
46
|
getInvocationUrl,
|
|
46
47
|
getUserFunctionUrlInMetadata,
|
|
48
|
+
makeFunctionUrl,
|
|
47
49
|
setUserFunctionUrlInMetadata
|
|
48
50
|
};
|
|
49
51
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-registry.d.ts","sourceRoot":"","sources":["../../../../src/function/function-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"function-registry.d.ts","sourceRoot":"","sources":["../../../../src/function/function-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,QAAQ;IAKhC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA4D;IAEhG,SAAgB,UAAU,kCAAyC;gBAEtC,OAAO,EAAE,MAAM;IAIrC,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,EAAE;IAIzC,cAAc,IAAI,WAAW,EAAE;IAUtC;;;OAGG;IACU,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAoBnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;cAiCtB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAI3D"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import { type Effect } from 'effect';
|
|
3
|
+
import { type AIServiceClient } from '@dxos/assistant';
|
|
3
4
|
import { type Client } from '@dxos/client';
|
|
4
|
-
import { type Space
|
|
5
|
+
import { type Space } from '@dxos/client/echo';
|
|
5
6
|
import type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';
|
|
6
7
|
import { type HasId } from '@dxos/echo-schema';
|
|
7
|
-
import { type DXN } from '@dxos/keys';
|
|
8
|
+
import { type SpaceId, type DXN } from '@dxos/keys';
|
|
8
9
|
import { type QueryResult } from '@dxos/protocols';
|
|
9
10
|
/**
|
|
10
11
|
* Function handler.
|
|
@@ -26,7 +27,7 @@ export interface FunctionContext {
|
|
|
26
27
|
* Space from which the function was invoked.
|
|
27
28
|
*/
|
|
28
29
|
space: SpaceAPI | undefined;
|
|
29
|
-
ai:
|
|
30
|
+
ai: AIServiceClient;
|
|
30
31
|
/**
|
|
31
32
|
* @deprecated
|
|
32
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,KAAK,MAAM,EAAa,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQnD;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE;IAC5E,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnC;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAElD;;OAEG;IACH,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAE5B,EAAE,EAAE,eAAe,CAAC;IAEpB;;OAEG;IAEH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAEhC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9D;AAED;;GAEG;AAEH,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,IAAI;IAClD,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,EAAE,IAAI;IAC1C,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACxC,CAAC;AAQF,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,IAAI,IAAI,YAAY,CAAC;IACzB,IAAI,EAAE,IAAI,YAAY,CAAC;IAEvB,IAAI,MAAM,IAAI,SAAS,CAAC;CACzB;AAOD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAChC,OAAO,EAAE,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CACrC,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,UAAU,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,kBAczE,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;CACrC,CAAC;AAEF;;;;;;;;;GASG;AAEH,eAAO,MAAM,mBAAmB,GAAI,KAAK,WAC9B,eAAe,CAAC,gBAAgB,EAAE,KAAK,CAAC,UACzC,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,KAC9B,eAAe,CAAC,mBAAmB,EAAE,KAAK,CAwB5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"trigger-registry.d.ts","sourceRoot":"","sources":["../../../../src/trigger/trigger-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAyB,KAAK,KAAK,EAAsB,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtG,KAAK,YAAY,GAAG,MAAM,CAAC;AAE3B,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAGtE,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,WAAW,EAAE,OAAO,GAAG,GAAG,IAAI,CACpE,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,OAAO,KACd,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AASlF,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAOF,qBAAa,eAAgB,SAAQ,QAAQ;IAOzC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAP5B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAkE;IAEtG,SAAgB,UAAU,sBAA6B;IACvD,SAAgB,OAAO,sBAA6B;gBAGjC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,iBAAiB,YAAA;IAKxC,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,EAAE;IAIlD,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,EAAE;IAI3D;;OAEG;IACU,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBvG;;OAEG;IACU,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;cAoCrD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;cA8BtB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1D,OAAO,CAAC,kBAAkB;YAiBZ,sBAAsB;IA0BpC,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -3,6 +3,12 @@ import { type SpaceId } from '@dxos/keys';
|
|
|
3
3
|
export declare const FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
4
4
|
export declare const getUserFunctionUrlInMetadata: (meta: ObjectMeta) => string | undefined;
|
|
5
5
|
export declare const setUserFunctionUrlInMetadata: (meta: ObjectMeta, functionUrl: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* NOTE: functionId is backend ID, not ECHO object id.
|
|
8
|
+
*/
|
|
9
|
+
export declare const makeFunctionUrl: (spaceId: SpaceId, fn: {
|
|
10
|
+
functionId: string;
|
|
11
|
+
}) => string;
|
|
6
12
|
export declare const getInvocationUrl: (functionUrl: string, edgeUrl: string, options?: InvocationOptions) => string;
|
|
7
13
|
export type InvocationOptions = {
|
|
8
14
|
spaceId?: SpaceId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/types/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAEF,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/types/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,OAAO,MAAM;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAmC,CAAC;AAEhH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/functions",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2-main.12df754",
|
|
4
4
|
"description": "Functions API and runtime.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -67,27 +67,28 @@
|
|
|
67
67
|
"get-port-please": "^3.1.1",
|
|
68
68
|
"iso-did": "^1.6.0",
|
|
69
69
|
"ws": "^8.14.2",
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/echo-protocol": "0.8.
|
|
76
|
-
"@dxos/echo-
|
|
77
|
-
"@dxos/edge-client": "0.8.
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/keys": "0.8.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
70
|
+
"@dxos/assistant": "0.8.2-main.12df754",
|
|
71
|
+
"@dxos/async": "0.8.2-main.12df754",
|
|
72
|
+
"@dxos/client": "0.8.2-main.12df754",
|
|
73
|
+
"@dxos/context": "0.8.2-main.12df754",
|
|
74
|
+
"@dxos/crypto": "0.8.2-main.12df754",
|
|
75
|
+
"@dxos/echo-protocol": "0.8.2-main.12df754",
|
|
76
|
+
"@dxos/echo-db": "0.8.2-main.12df754",
|
|
77
|
+
"@dxos/edge-client": "0.8.2-main.12df754",
|
|
78
|
+
"@dxos/echo-schema": "0.8.2-main.12df754",
|
|
79
|
+
"@dxos/invariant": "0.8.2-main.12df754",
|
|
80
|
+
"@dxos/keys": "0.8.2-main.12df754",
|
|
81
|
+
"@dxos/live-object": "0.8.2-main.12df754",
|
|
82
|
+
"@dxos/log": "0.8.2-main.12df754",
|
|
83
|
+
"@dxos/node-std": "0.8.2-main.12df754",
|
|
84
|
+
"@dxos/util": "0.8.2-main.12df754",
|
|
85
|
+
"@dxos/protocols": "0.8.2-main.12df754",
|
|
86
|
+
"@dxos/schema": "0.8.2-main.12df754"
|
|
86
87
|
},
|
|
87
88
|
"devDependencies": {
|
|
88
89
|
"@types/express": "^4.17.17",
|
|
89
90
|
"@types/ws": "^7.4.0",
|
|
90
|
-
"@dxos/agent": "0.8.
|
|
91
|
+
"@dxos/agent": "0.8.2-main.12df754"
|
|
91
92
|
},
|
|
92
93
|
"publishConfig": {
|
|
93
94
|
"access": "public"
|
|
@@ -9,7 +9,7 @@ import { type Client } from '@dxos/client';
|
|
|
9
9
|
import { TestBuilder } from '@dxos/client/testing';
|
|
10
10
|
import { Context } from '@dxos/context';
|
|
11
11
|
import { Filter } from '@dxos/echo-db';
|
|
12
|
-
import {
|
|
12
|
+
import { live } from '@dxos/live-object';
|
|
13
13
|
import { range } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { FunctionRegistry } from './function-registry';
|
|
@@ -67,7 +67,7 @@ describe('function registry', () => {
|
|
|
67
67
|
const client = (await createInitializedClients(testBuilder))[0];
|
|
68
68
|
const registry = createRegistry(client);
|
|
69
69
|
const space = await client.spaces.create();
|
|
70
|
-
const existing = space.db.add(
|
|
70
|
+
const existing = space.db.add(live(FunctionDef, testManifest.functions![0]));
|
|
71
71
|
await registry.register(space, testManifest.functions);
|
|
72
72
|
const { objects: definitions } = await space.db.query(Filter.schema(FunctionDef)).run();
|
|
73
73
|
expect(definitions.length).to.eq(1);
|
|
@@ -80,7 +80,7 @@ describe('function registry', () => {
|
|
|
80
80
|
const client = (await createInitializedClients(testBuilder))[0];
|
|
81
81
|
const registry = createRegistry(client);
|
|
82
82
|
const space = await client.spaces.create();
|
|
83
|
-
const definitions = range(3, () =>
|
|
83
|
+
const definitions = range(3, () => live(FunctionDef, testManifest.functions![0]));
|
|
84
84
|
definitions.forEach((def) => space.db.add(def));
|
|
85
85
|
|
|
86
86
|
const functionRegistered = new Trigger<FunctionDef[]>();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import { type Client } from '@dxos/client';
|
|
7
|
-
import {
|
|
7
|
+
import { live, Filter, type Space } from '@dxos/client/echo';
|
|
8
8
|
import { type Context, Resource } from '@dxos/context';
|
|
9
9
|
import { PublicKey } from '@dxos/keys';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
@@ -57,7 +57,7 @@ export class FunctionRegistry extends Resource {
|
|
|
57
57
|
const { objects: existing } = await space.db.query(Filter.schema(FunctionDef)).run();
|
|
58
58
|
const { added } = diff(existing, functions, (a, b) => a.uri === b.uri);
|
|
59
59
|
// TODO(burdon): Update existing templates.
|
|
60
|
-
added.forEach((def) => space.db.add(
|
|
60
|
+
added.forEach((def) => space.db.add(live(FunctionDef, def)));
|
|
61
61
|
|
|
62
62
|
if (added.length > 0) {
|
|
63
63
|
await space.db.flush({ indexes: true, updates: true });
|
package/src/handler.ts
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { Schema as S } from 'effect';
|
|
6
6
|
import { type Effect } from 'effect';
|
|
7
7
|
|
|
8
|
+
import { type AIServiceClient } from '@dxos/assistant';
|
|
8
9
|
import { type Client, PublicKey } from '@dxos/client';
|
|
9
|
-
import { type Space
|
|
10
|
+
import { type Space } from '@dxos/client/echo';
|
|
10
11
|
import type { CoreDatabase, EchoDatabase, ReactiveEchoObject } from '@dxos/echo-db';
|
|
11
12
|
import { type HasId } from '@dxos/echo-schema';
|
|
12
|
-
import { type DXN } from '@dxos/keys';
|
|
13
|
+
import { type SpaceId, type DXN } from '@dxos/keys';
|
|
13
14
|
import { log } from '@dxos/log';
|
|
14
15
|
import { type QueryResult } from '@dxos/protocols';
|
|
15
16
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -42,7 +43,7 @@ export interface FunctionContext {
|
|
|
42
43
|
*/
|
|
43
44
|
space: SpaceAPI | undefined;
|
|
44
45
|
|
|
45
|
-
ai:
|
|
46
|
+
ai: AIServiceClient;
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* @deprecated
|
|
@@ -7,7 +7,7 @@ import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { type Client } from '@dxos/client';
|
|
9
9
|
import { TestBuilder } from '@dxos/client/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { live } from '@dxos/live-object';
|
|
11
11
|
|
|
12
12
|
import { Scheduler, type SchedulerOptions } from './scheduler';
|
|
13
13
|
import { FunctionRegistry } from '../function';
|
|
@@ -143,7 +143,7 @@ describe.skip('scheduler', () => {
|
|
|
143
143
|
|
|
144
144
|
setTimeout(() => {
|
|
145
145
|
const space = client.spaces.default;
|
|
146
|
-
const object =
|
|
146
|
+
const object = live(TestType, { title: 'Hello world!' });
|
|
147
147
|
space.db.add(object);
|
|
148
148
|
}, 100);
|
|
149
149
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
-
import {
|
|
8
|
+
import { live } from '@dxos/client/echo';
|
|
9
9
|
import { TestBuilder } from '@dxos/client/testing';
|
|
10
10
|
|
|
11
11
|
import { initFunctionsPlugin } from './plugin-init';
|
|
@@ -34,10 +34,10 @@ describe.skip('functions e2e', () => {
|
|
|
34
34
|
await inviteMember(space, functionRuntime.client);
|
|
35
35
|
|
|
36
36
|
const uri = 'example.com/function/test';
|
|
37
|
-
space.db.add(
|
|
37
|
+
space.db.add(live(FunctionDef, { uri, route: '/test', handler: 'test' }));
|
|
38
38
|
const triggerMeta: FunctionTrigger['meta'] = { name: 'DXOS' };
|
|
39
39
|
space.db.add(
|
|
40
|
-
|
|
40
|
+
live(FunctionTrigger, {
|
|
41
41
|
function: uri,
|
|
42
42
|
enabled: true,
|
|
43
43
|
meta: triggerMeta,
|
|
@@ -55,7 +55,7 @@ describe.skip('functions e2e', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
await functionRuntime.waitForActiveTriggers(space);
|
|
58
|
-
const addedObject = space.db.add(
|
|
58
|
+
const addedObject = space.db.add(live(TestType, { title: '42' }));
|
|
59
59
|
|
|
60
60
|
const callArgs = await called.wait();
|
|
61
61
|
expect(callArgs.meta).to.deep.eq(triggerMeta);
|
|
@@ -11,7 +11,7 @@ import { TestBuilder } from '@dxos/client/testing';
|
|
|
11
11
|
import { Context } from '@dxos/context';
|
|
12
12
|
import { Filter } from '@dxos/echo-db';
|
|
13
13
|
import { splitMeta } from '@dxos/echo-schema';
|
|
14
|
-
import {
|
|
14
|
+
import { live } from '@dxos/live-object';
|
|
15
15
|
import { range } from '@dxos/util';
|
|
16
16
|
|
|
17
17
|
import { TriggerRegistry } from './trigger-registry';
|
|
@@ -85,7 +85,7 @@ describe('trigger registry', () => {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
test('set meta', () => {
|
|
88
|
-
const trigger =
|
|
88
|
+
const trigger = live(FunctionTrigger, {
|
|
89
89
|
function: 'example.com/function/webhook-test',
|
|
90
90
|
spec: {
|
|
91
91
|
type: TriggerKind.Webhook,
|
|
@@ -156,13 +156,13 @@ describe('trigger registry', () => {
|
|
|
156
156
|
return 200;
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
space.db.add(
|
|
159
|
+
space.db.add(live(TestType, { title: '1' }));
|
|
160
160
|
await sleep(110);
|
|
161
161
|
expect(count).to.eq(1);
|
|
162
162
|
|
|
163
163
|
space.db.remove(echoTrigger);
|
|
164
164
|
await sleep(110);
|
|
165
|
-
space.db.add(
|
|
165
|
+
space.db.add(live(TestType, { title: '2' }));
|
|
166
166
|
await sleep(20);
|
|
167
167
|
expect(count).to.eq(1);
|
|
168
168
|
});
|
|
@@ -185,7 +185,7 @@ describe('trigger registry', () => {
|
|
|
185
185
|
|
|
186
186
|
await registry.close();
|
|
187
187
|
|
|
188
|
-
space.db.add(
|
|
188
|
+
space.db.add(live(TestType, { title: '1' }));
|
|
189
189
|
await sleep(20);
|
|
190
190
|
expect(count).to.eq(0);
|
|
191
191
|
});
|
|
@@ -265,7 +265,7 @@ describe('trigger registry', () => {
|
|
|
265
265
|
const createTriggers = (space: Space, count: number) => {
|
|
266
266
|
const triggers = range(count, () => {
|
|
267
267
|
const { meta, object } = splitMeta(manifest.triggers![0]);
|
|
268
|
-
return
|
|
268
|
+
return live(FunctionTrigger, object, meta);
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
triggers.forEach((trigger) => space.db.add(trigger));
|