@dxos/functions 0.8.0 → 0.8.1-main.013e445

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.
Files changed (72) hide show
  1. package/dist/lib/browser/chunk-B747D6L6.mjs +72 -0
  2. package/dist/lib/browser/chunk-B747D6L6.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-6XYG2TNO.mjs → chunk-LHCAYQLL.mjs} +147 -21
  4. package/dist/lib/browser/chunk-LHCAYQLL.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-WI2RVE6E.mjs → chunk-OREUICVD.mjs} +27 -25
  6. package/dist/lib/browser/chunk-OREUICVD.mjs.map +7 -0
  7. package/dist/lib/browser/edge/index.mjs +1 -9
  8. package/dist/lib/browser/index.mjs +19 -11
  9. package/dist/lib/browser/index.mjs.map +2 -2
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/testing/index.mjs +2 -2
  12. package/dist/lib/browser/types/index.mjs +21 -5
  13. package/dist/lib/node/{chunk-MZMHE4DC.cjs → chunk-D4T2DS7U.cjs} +9 -69
  14. package/dist/lib/node/chunk-D4T2DS7U.cjs.map +7 -0
  15. package/dist/lib/node/{chunk-UNB65EWP.cjs → chunk-UQZH4J6S.cjs} +154 -22
  16. package/dist/lib/node/chunk-UQZH4J6S.cjs.map +7 -0
  17. package/dist/lib/node/{chunk-HH4ZO3YY.cjs → chunk-ZSHBAXJA.cjs} +40 -38
  18. package/dist/lib/node/chunk-ZSHBAXJA.cjs.map +7 -0
  19. package/dist/lib/node/edge/index.cjs +4 -12
  20. package/dist/lib/node/edge/index.cjs.map +2 -2
  21. package/dist/lib/node/index.cjs +39 -31
  22. package/dist/lib/node/index.cjs.map +2 -2
  23. package/dist/lib/node/meta.json +1 -1
  24. package/dist/lib/node/testing/index.cjs +7 -7
  25. package/dist/lib/node/types/index.cjs +32 -16
  26. package/dist/lib/node/types/index.cjs.map +2 -2
  27. package/dist/lib/node-esm/chunk-D43PP2YW.mjs +72 -0
  28. package/dist/lib/node-esm/chunk-D43PP2YW.mjs.map +7 -0
  29. package/dist/lib/node-esm/{chunk-A3BWJQVO.mjs → chunk-YCBKVXQU.mjs} +147 -21
  30. package/dist/lib/node-esm/chunk-YCBKVXQU.mjs.map +7 -0
  31. package/dist/lib/node-esm/{chunk-CM2LOG4A.mjs → chunk-ZX523EY4.mjs} +27 -25
  32. package/dist/lib/node-esm/chunk-ZX523EY4.mjs.map +7 -0
  33. package/dist/lib/node-esm/edge/index.mjs +1 -9
  34. package/dist/lib/node-esm/index.mjs +19 -11
  35. package/dist/lib/node-esm/index.mjs.map +2 -2
  36. package/dist/lib/node-esm/meta.json +1 -1
  37. package/dist/lib/node-esm/testing/index.mjs +2 -2
  38. package/dist/lib/node-esm/types/index.mjs +21 -5
  39. package/dist/types/src/edge/functions.d.ts +0 -9
  40. package/dist/types/src/edge/functions.d.ts.map +1 -1
  41. package/dist/types/src/handler.d.ts +2 -2
  42. package/dist/types/src/handler.d.ts.map +1 -1
  43. package/dist/types/src/trigger/type/timer-trigger.d.ts.map +1 -1
  44. package/dist/types/src/types/index.d.ts +1 -0
  45. package/dist/types/src/types/index.d.ts.map +1 -1
  46. package/dist/types/src/types/schema.d.ts +20 -26
  47. package/dist/types/src/types/schema.d.ts.map +1 -1
  48. package/dist/types/src/types/trace.d.ts +111 -80
  49. package/dist/types/src/types/trace.d.ts.map +1 -1
  50. package/dist/types/src/types/types.d.ts +7 -7
  51. package/dist/types/src/types/url.d.ts +11 -0
  52. package/dist/types/src/types/url.d.ts.map +1 -0
  53. package/package.json +20 -20
  54. package/src/edge/functions.ts +2 -63
  55. package/src/handler.ts +3 -3
  56. package/src/runtime/scheduler.test.ts +2 -1
  57. package/src/trigger/type/timer-trigger.ts +21 -18
  58. package/src/types/index.ts +1 -0
  59. package/src/types/schema.ts +8 -6
  60. package/src/types/trace.ts +115 -11
  61. package/src/types/url.ts +47 -0
  62. package/dist/lib/browser/chunk-6XYG2TNO.mjs.map +0 -7
  63. package/dist/lib/browser/chunk-WI2RVE6E.mjs.map +0 -7
  64. package/dist/lib/browser/chunk-YJEIETRB.mjs +0 -128
  65. package/dist/lib/browser/chunk-YJEIETRB.mjs.map +0 -7
  66. package/dist/lib/node/chunk-HH4ZO3YY.cjs.map +0 -7
  67. package/dist/lib/node/chunk-MZMHE4DC.cjs.map +0 -7
  68. package/dist/lib/node/chunk-UNB65EWP.cjs.map +0 -7
  69. package/dist/lib/node-esm/chunk-A3BWJQVO.mjs.map +0 -7
  70. package/dist/lib/node-esm/chunk-CM2LOG4A.mjs.map +0 -7
  71. package/dist/lib/node-esm/chunk-T2KBXTMR.mjs +0 -128
  72. package/dist/lib/node-esm/chunk-T2KBXTMR.mjs.map +0 -7
@@ -25,7 +25,7 @@ declare const EmailTriggerSchema: S.mutable<S.Struct<{
25
25
  export type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;
26
26
  declare const QueueTriggerSchema: S.mutable<S.Struct<{
27
27
  type: S.Literal<[TriggerKind.Queue]>;
28
- queue: S.refine<string, S.Schema<string, string, never>>;
28
+ queue: S.refine<string, typeof S.NonEmptyString>;
29
29
  }>>;
30
30
  export type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;
31
31
  /**
@@ -76,7 +76,7 @@ export declare const TriggerSchema: S.Union<[S.mutable<S.Struct<{
76
76
  type: S.Literal<[TriggerKind.Email]>;
77
77
  }>>, S.mutable<S.Struct<{
78
78
  type: S.Literal<[TriggerKind.Queue]>;
79
- queue: S.refine<string, S.Schema<string, string, never>>;
79
+ queue: S.refine<string, typeof S.NonEmptyString>;
80
80
  }>>]>;
81
81
  export type TriggerType = S.Schema.Type<typeof TriggerSchema>;
82
82
  /**
@@ -106,7 +106,7 @@ export declare const FunctionTriggerSchema: S.Struct<{
106
106
  type: S.Literal<[TriggerKind.Email]>;
107
107
  }>>, S.mutable<S.Struct<{
108
108
  type: S.Literal<[TriggerKind.Queue]>;
109
- queue: S.refine<string, S.Schema<string, string, never>>;
109
+ queue: S.refine<string, typeof S.NonEmptyString>;
110
110
  }>>]>>;
111
111
  meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
112
112
  }>;
@@ -135,7 +135,7 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
135
135
  type: S.Literal<[TriggerKind.Email]>;
136
136
  }>>, S.mutable<S.Struct<{
137
137
  type: S.Literal<[TriggerKind.Queue]>;
138
- queue: S.refine<string, S.Schema<string, string, never>>;
138
+ queue: S.refine<string, typeof S.NonEmptyString>;
139
139
  }>>]>>;
140
140
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
141
141
  }, import("@dxos/echo-schema").TypedObjectOptions>, S.Struct.Encoded<{
@@ -162,7 +162,7 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
162
162
  type: S.Literal<[TriggerKind.Email]>;
163
163
  }>>, S.mutable<S.Struct<{
164
164
  type: S.Literal<[TriggerKind.Queue]>;
165
- queue: S.refine<string, S.Schema<string, string, never>>;
165
+ queue: S.refine<string, typeof S.NonEmptyString>;
166
166
  }>>]>>;
167
167
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
168
168
  }>>;
@@ -227,7 +227,7 @@ export declare const FunctionManifestSchema: S.Struct<{
227
227
  type: S.Literal<[TriggerKind.Email]>;
228
228
  }>>, S.mutable<S.Struct<{
229
229
  type: S.Literal<[TriggerKind.Queue]>;
230
- queue: S.refine<string, S.Schema<string, string, never>>;
230
+ queue: S.refine<string, typeof S.NonEmptyString>;
231
231
  }>>]>>;
232
232
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
233
233
  }, import("@dxos/echo-schema").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, S.Struct.Encoded<{
@@ -254,7 +254,7 @@ export declare const FunctionManifestSchema: S.Struct<{
254
254
  type: S.Literal<[TriggerKind.Email]>;
255
255
  }>>, S.mutable<S.Struct<{
256
256
  type: S.Literal<[TriggerKind.Queue]>;
257
- queue: S.refine<string, S.Schema<string, string, never>>;
257
+ queue: S.refine<string, typeof S.NonEmptyString>;
258
258
  }>>]>>;
259
259
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
260
260
  }>, never>>>>;
@@ -0,0 +1,11 @@
1
+ import { type ObjectMeta } from '@dxos/echo-schema';
2
+ import { type SpaceId } from '@dxos/keys';
3
+ export declare const FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
4
+ export declare const getUserFunctionUrlInMetadata: (meta: ObjectMeta) => string | undefined;
5
+ export declare const setUserFunctionUrlInMetadata: (meta: ObjectMeta, functionUrl: string) => void;
6
+ export declare const getInvocationUrl: (functionUrl: string, edgeUrl: string, options?: InvocationOptions) => string;
7
+ export type InvocationOptions = {
8
+ spaceId?: SpaceId;
9
+ subjectId?: string;
10
+ };
11
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-main.013e445",
4
4
  "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -58,36 +58,36 @@
58
58
  "src"
59
59
  ],
60
60
  "dependencies": {
61
- "@effect/schema": "^0.75.5",
62
61
  "@preact/signals-core": "^1.6.0",
63
62
  "cron": "^3.1.6",
64
- "effect": "^3.12.3",
63
+ "cron-schedule": "^5.0.4",
64
+ "effect": "3.13.3",
65
65
  "esbuild-wasm": "^0.16.14",
66
66
  "express": "^4.19.2",
67
67
  "get-port-please": "^3.1.1",
68
68
  "iso-did": "^1.6.0",
69
69
  "ws": "^8.14.2",
70
- "@dxos/async": "0.8.0",
71
- "@dxos/client": "0.8.0",
72
- "@dxos/context": "0.8.0",
73
- "@dxos/crypto": "0.8.0",
74
- "@dxos/echo-db": "0.8.0",
75
- "@dxos/echo-protocol": "0.8.0",
76
- "@dxos/echo-schema": "0.8.0",
77
- "@dxos/edge-client": "0.8.0",
78
- "@dxos/invariant": "0.8.0",
79
- "@dxos/keys": "0.8.0",
80
- "@dxos/node-std": "0.8.0",
81
- "@dxos/live-object": "0.8.0",
82
- "@dxos/log": "0.8.0",
83
- "@dxos/protocols": "0.8.0",
84
- "@dxos/schema": "0.8.0",
85
- "@dxos/util": "0.8.0"
70
+ "@dxos/async": "0.8.1-main.013e445",
71
+ "@dxos/context": "0.8.1-main.013e445",
72
+ "@dxos/client": "0.8.1-main.013e445",
73
+ "@dxos/crypto": "0.8.1-main.013e445",
74
+ "@dxos/echo-protocol": "0.8.1-main.013e445",
75
+ "@dxos/echo-schema": "0.8.1-main.013e445",
76
+ "@dxos/echo-db": "0.8.1-main.013e445",
77
+ "@dxos/edge-client": "0.8.1-main.013e445",
78
+ "@dxos/invariant": "0.8.1-main.013e445",
79
+ "@dxos/keys": "0.8.1-main.013e445",
80
+ "@dxos/live-object": "0.8.1-main.013e445",
81
+ "@dxos/log": "0.8.1-main.013e445",
82
+ "@dxos/node-std": "0.8.1-main.013e445",
83
+ "@dxos/schema": "0.8.1-main.013e445",
84
+ "@dxos/protocols": "0.8.1-main.013e445",
85
+ "@dxos/util": "0.8.1-main.013e445"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/express": "^4.17.17",
89
89
  "@types/ws": "^7.4.0",
90
- "@dxos/agent": "0.8.0"
90
+ "@dxos/agent": "0.8.1-main.013e445"
91
91
  },
92
92
  "publishConfig": {
93
93
  "access": "public"
@@ -5,18 +5,13 @@
5
5
  import { type DID } from 'iso-did/types';
6
6
 
7
7
  import { type Client } from '@dxos/client';
8
- import { type ObjectMeta } from '@dxos/echo-schema';
9
- import { EdgeHttpClient, type EdgeIdentity } from '@dxos/edge-client';
8
+ import { createEdgeIdentity } from '@dxos/client/edge';
9
+ import { EdgeHttpClient } from '@dxos/edge-client';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import type { PublicKey, SpaceId } from '@dxos/keys';
12
12
  import { log } from '@dxos/log';
13
13
  import { type UploadFunctionResponseBody } from '@dxos/protocols';
14
14
 
15
- // TODO: use URL scheme for source?
16
- const FUNCTIONS_META_KEY = 'dxos.org/service/function';
17
-
18
- export const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';
19
-
20
15
  export type UploadWorkerArgs = {
21
16
  client: Client;
22
17
  name?: string;
@@ -52,57 +47,6 @@ export const uploadWorkerFunction = async ({
52
47
  return response;
53
48
  };
54
49
 
55
- export const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {
56
- return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
57
- };
58
-
59
- export const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {
60
- const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);
61
- if (key) {
62
- if (key.id !== functionUrl) {
63
- throw new Error('Metadata mismatch');
64
- }
65
- } else {
66
- meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });
67
- }
68
- };
69
-
70
- export const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {
71
- const baseUrl = new URL('functions/', edgeUrl);
72
-
73
- // Leading slashes cause the URL to be treated as an absolute path.
74
- const relativeUrl = functionUrl.replace(/^\//, '');
75
- const url = new URL(`./${relativeUrl}`, baseUrl.toString());
76
- options.spaceId && url.searchParams.set('spaceId', options.spaceId);
77
- options.subjectId && url.searchParams.set('subjectId', options.subjectId);
78
- url.protocol = isSecure(url.protocol) ? 'https' : 'http';
79
- return url.toString();
80
- };
81
-
82
- const isSecure = (protocol: string) => {
83
- return protocol === 'https:' || protocol === 'wss:';
84
- };
85
-
86
- const createEdgeIdentity = (client: Client): EdgeIdentity => {
87
- const identity = client.halo.identity.get();
88
- const device = client.halo.device;
89
- if (!identity || !device) {
90
- throw new Error('Identity not available');
91
- }
92
- return {
93
- identityKey: identity.identityKey.toHex(),
94
- peerKey: device.deviceKey.toHex(),
95
- presentCredentials: async ({ challenge }) => {
96
- const identityService = client.services.services.IdentityService!;
97
- const authCredential = await identityService.createAuthCredential();
98
- return identityService.signPresentation({
99
- presentation: { credentials: [authCredential] },
100
- nonce: challenge,
101
- });
102
- },
103
- };
104
- };
105
-
106
50
  export const incrementSemverPatch = (version: string): string => {
107
51
  const [major, minor, patch] = version.split('.');
108
52
  const patchNum = Number(patch);
@@ -113,8 +57,3 @@ export const incrementSemverPatch = (version: string): string => {
113
57
  export const publicKeyToDid = (key: PublicKey): DID => {
114
58
  return `did:key:${key.toHex()}`;
115
59
  };
116
-
117
- export type InvocationOptions = {
118
- spaceId?: SpaceId;
119
- subjectId?: string;
120
- };
package/src/handler.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from '@effect/schema';
5
+ import { Schema as S } from 'effect';
6
6
  import { type Effect } from 'effect';
7
7
 
8
8
  import { type Client, PublicKey } from '@dxos/client';
@@ -171,7 +171,7 @@ export type SubscriptionData = {
171
171
  // TODO(burdon): Evolve into plugin definition like Composer.
172
172
  export const subscriptionHandler = <TMeta>(
173
173
  handler: FunctionHandler<SubscriptionData, TMeta>,
174
- types?: S.Schema<any>[],
174
+ types?: S.Schema.AnyNoContext[],
175
175
  ): FunctionHandler<RawSubscriptionData, TMeta> => {
176
176
  return async ({ event: { data }, context, response, ...rest }) => {
177
177
  const { client } = context;
@@ -199,7 +199,7 @@ export const subscriptionHandler = <TMeta>(
199
199
  };
200
200
 
201
201
  // TODO(burdon): Evolve types as part of function metadata.
202
- const registerTypes = (space: Space, types: S.Schema<any>[] = []) => {
202
+ const registerTypes = (space: Space, types: S.Schema.AnyNoContext[] = []) => {
203
203
  const registry = space.db.graph.schemaRegistry;
204
204
  for (const type of types) {
205
205
  if (!registry.hasSchema(type)) {
@@ -16,7 +16,8 @@ import { TriggerRegistry } from '../trigger';
16
16
  import { TriggerKind, type FunctionManifest } from '../types';
17
17
 
18
18
  // TODO(burdon): Test we can add and remove triggers.
19
- describe('scheduler', () => {
19
+ // Flaky: https://cloud.nx.app/runs/uqhKOBA6JQ/task/functions%3Atest
20
+ describe.skip('scheduler', () => {
20
21
  let testBuilder: TestBuilder;
21
22
  let client: Client;
22
23
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { CronJob } from 'cron';
5
+ import { parseCronExpression } from 'cron-schedule';
6
6
 
7
7
  import { DeferredTask } from '@dxos/async';
8
8
  import { type Space } from '@dxos/client/echo';
@@ -24,22 +24,25 @@ export const createTimerTrigger: TriggerFactory<TimerTrigger> = async (
24
24
 
25
25
  let last = 0;
26
26
  let run = 0;
27
- // https://www.npmjs.com/package/cron#constructor
28
- const job = CronJob.from({
29
- cronTime: spec.cron,
30
- runOnInit: false,
31
- onTick: () => {
32
- // TODO(burdon): Check greater than 30s (use cron-parser).
33
- const now = Date.now();
34
- const delta = last ? now - last : 0;
35
- last = now;
36
-
37
- run++;
38
- log.info('tick', { space: space.key.truncate(), count: run, delta });
39
- task.schedule();
40
- },
41
- });
27
+ const schedule = parseCronExpression(spec.cron);
28
+ const getRunTimeout = () => Date.now() - schedule.getNextDate().getTime();
29
+ const runCron = () => {
30
+ if (ctx.disposed) {
31
+ return;
32
+ }
33
+ // TODO(burdon): Check greater than 30s (use cron-parser).
34
+ const now = Date.now();
35
+ const delta = last ? now - last : 0;
36
+ last = now;
37
+
38
+ run++;
39
+ log.info('tick', { space: space.key.truncate(), count: run, delta });
40
+ task.schedule();
41
+
42
+ timeout = setTimeout(runCron, getRunTimeout());
43
+ };
44
+
45
+ let timeout = setTimeout(runCron, getRunTimeout());
42
46
 
43
- job.start();
44
- ctx.onDispose(() => job.stop());
47
+ ctx.onDispose(() => clearTimeout(timeout));
45
48
  };
@@ -5,3 +5,4 @@
5
5
  export * from './schema';
6
6
  export * from './types';
7
7
  export * from './trace';
8
+ export * from './url';
@@ -2,23 +2,25 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';
5
+ import { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, S, TypedObject } from '@dxos/echo-schema';
6
6
  import { TextType } from '@dxos/schema';
7
7
 
8
8
  /**
9
9
  * Source script.
10
10
  */
11
- export class ScriptType extends TypedObject({
12
- typename: 'dxos.org/type/Script',
13
- version: '0.1.0',
14
- })({
11
+ export const ScriptType = S.Struct({
15
12
  name: S.optional(S.String),
16
13
  description: S.optional(S.String),
17
14
  // TODO(burdon): Change to hash of deployed content.
18
15
  // Whether source has changed since last deploy.
19
16
  changed: S.optional(S.Boolean),
20
17
  source: Ref(TextType),
21
- }) {}
18
+ })
19
+ .annotations({
20
+ [LabelAnnotationId]: 'name',
21
+ })
22
+ .pipe(EchoObject('dxos.org/type/Script', '0.1.0'));
23
+ export type ScriptType = S.Schema.Type<typeof ScriptType>;
22
24
 
23
25
  /**
24
26
  * Function deployment.
@@ -3,11 +3,46 @@
3
3
  //
4
4
 
5
5
  import { EchoObject, Expando, ObjectId, Ref, S } from '@dxos/echo-schema';
6
+ import { log } from '@dxos/log';
6
7
 
7
- import { FunctionTrigger } from './types';
8
+ import { FunctionTrigger, type FunctionTriggerType } from './types';
8
9
 
9
- export const InvocationTrace = S.Struct({
10
+ export enum InvocationOutcome {
11
+ SUCCESS = 'success',
12
+ FAILURE = 'failure',
13
+ }
14
+
15
+ export enum InvocationTraceEventType {
16
+ START = 'start',
17
+ END = 'end',
18
+ }
19
+
20
+ export const TraceEventException = S.Struct({
21
+ timestampMs: S.Number,
22
+ message: S.String,
23
+ name: S.String,
24
+ stack: S.optional(S.String),
25
+ });
26
+ export type TraceEventException = S.Schema.Type<typeof TraceEventException>;
27
+
28
+ export const InvocationTraceStartEvent = S.Struct({
29
+ /**
30
+ * Queue message id.
31
+ */
10
32
  id: ObjectId,
33
+ type: S.Literal(InvocationTraceEventType.START),
34
+ /**
35
+ * Invocation id, the same for invocation start and end events.
36
+ */
37
+ invocationId: ObjectId,
38
+ /**
39
+ * Event generation time.
40
+ */
41
+ timestampMs: S.Number,
42
+ /**
43
+ * Data passed to function / workflow as an argument.
44
+ */
45
+ input: S.Object,
11
46
  /**
12
47
  * Queue DXN for function/workflow invocation events.
13
48
  */
@@ -20,9 +55,31 @@ export const InvocationTrace = S.Struct({
20
55
  * Present for automatic invocations.
21
56
  */
22
57
  trigger: S.optional(Ref(FunctionTrigger)),
23
- }).pipe(EchoObject('dxos.org/type/InvocationTrace', '0.1.0'));
58
+ }).pipe(EchoObject('dxos.org/type/InvocationTraceStart', '0.1.0'));
59
+
60
+ export type InvocationTraceStartEvent = S.Schema.Type<typeof InvocationTraceStartEvent>;
61
+
62
+ export const InvocationTraceEndEvent = S.Struct({
63
+ /**
64
+ * Trace event id.
65
+ */
66
+ id: ObjectId,
67
+ type: S.Literal(InvocationTraceEventType.END),
68
+ /**
69
+ * Invocation id, will be the same for invocation start and end.
70
+ */
71
+ invocationId: ObjectId,
72
+ /**
73
+ * Event generation time.
74
+ */
75
+ timestampMs: S.Number,
76
+ outcome: S.Enums(InvocationOutcome),
77
+ exception: S.optional(TraceEventException),
78
+ }).pipe(EchoObject('dxos.org/type/InvocationTraceEnd', '0.1.0'));
24
79
 
25
- export type InvocationTraceEvent = S.Schema.Type<typeof InvocationTrace>;
80
+ export type InvocationTraceEndEvent = S.Schema.Type<typeof InvocationTraceEndEvent>;
81
+
82
+ export type InvocationTraceEvent = InvocationTraceStartEvent | InvocationTraceEndEvent;
26
83
 
27
84
  export const TraceEventLog = S.Struct({
28
85
  timestampMs: S.Number,
@@ -31,19 +88,66 @@ export const TraceEventLog = S.Struct({
31
88
  context: S.optional(S.Object),
32
89
  });
33
90
 
34
- export const TraceEventException = S.Struct({
35
- timestampMs: S.Number,
36
- message: S.String,
37
- name: S.String,
38
- stack: S.optional(S.String),
39
- });
40
-
41
91
  export const TraceEvent = S.Struct({
42
92
  id: ObjectId,
43
93
  outcome: S.String,
44
94
  truncated: S.Boolean,
95
+ /**
96
+ * Time when the event was persisted.
97
+ */
98
+ ingestionTimestampMs: S.Number,
45
99
  logs: S.Array(TraceEventLog),
46
100
  exceptions: S.Array(TraceEventException),
47
101
  }).pipe(EchoObject('dxos.org/type/TraceEvent', '0.1.0'));
48
102
 
49
103
  export type TraceEvent = S.Schema.Type<typeof TraceEvent>;
104
+
105
+ /**
106
+ * TODO: remove
107
+ * Deprecated InvocationTrace event format.
108
+ */
109
+ export type InvocationSpan = {
110
+ id: string;
111
+ timestampMs: number;
112
+ outcome: InvocationOutcome;
113
+ input: object;
114
+ durationMs: number;
115
+ invocationTraceQueue: Ref<Expando>;
116
+ invocationTarget: Ref<Expando>;
117
+ trigger?: Ref<FunctionTriggerType>;
118
+ exception?: TraceEventException;
119
+ };
120
+
121
+ export const createInvocationSpans = (items?: InvocationTraceEvent[]): InvocationSpan[] => {
122
+ if (!items) {
123
+ return [];
124
+ }
125
+ const startEvents = new Map<ObjectId, InvocationTraceStartEvent>();
126
+ const result: InvocationSpan[] = [];
127
+ for (const item of items) {
128
+ if (item.type === InvocationTraceEventType.START) {
129
+ startEvents.set(item.invocationId, item);
130
+ } else if (item.type === InvocationTraceEventType.END) {
131
+ const matchingStart = startEvents.get(item.invocationId);
132
+ if (!matchingStart) {
133
+ log.warn('end event without matching start', { item });
134
+ continue;
135
+ }
136
+ result.push({
137
+ id: item.invocationId,
138
+ durationMs: item.timestampMs - matchingStart.timestampMs,
139
+ timestampMs: item.timestampMs,
140
+ outcome: item.outcome,
141
+ exception: item.exception,
142
+ trigger: matchingStart.trigger,
143
+ input: matchingStart.input,
144
+ invocationTraceQueue: matchingStart.invocationTraceQueue,
145
+ invocationTarget: matchingStart.invocationTarget,
146
+ });
147
+ } else {
148
+ // TODO: remove, the deprecated InvocationTrace format is no longer produced by functions backend
149
+ result.push(item as InvocationSpan);
150
+ }
151
+ }
152
+ return result;
153
+ };
@@ -0,0 +1,47 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ObjectMeta } from '@dxos/echo-schema';
6
+ import { type SpaceId } from '@dxos/keys';
7
+
8
+ // TODO: use URL scheme for source?
9
+ const FUNCTIONS_META_KEY = 'dxos.org/service/function';
10
+
11
+ export const FUNCTIONS_PRESET_META_KEY = 'dxos.org/service/function-preset';
12
+
13
+ const isSecure = (protocol: string) => {
14
+ return protocol === 'https:' || protocol === 'wss:';
15
+ };
16
+
17
+ export const getUserFunctionUrlInMetadata = (meta: ObjectMeta) => {
18
+ return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
19
+ };
20
+
21
+ export const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: string) => {
22
+ const key = meta.keys.find((key) => key.source === FUNCTIONS_META_KEY);
23
+ if (key) {
24
+ if (key.id !== functionUrl) {
25
+ throw new Error('Metadata mismatch');
26
+ }
27
+ } else {
28
+ meta.keys.push({ source: FUNCTIONS_META_KEY, id: functionUrl });
29
+ }
30
+ };
31
+
32
+ export const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {
33
+ const baseUrl = new URL('functions/', edgeUrl);
34
+
35
+ // Leading slashes cause the URL to be treated as an absolute path.
36
+ const relativeUrl = functionUrl.replace(/^\//, '');
37
+ const url = new URL(`./${relativeUrl}`, baseUrl.toString());
38
+ options.spaceId && url.searchParams.set('spaceId', options.spaceId);
39
+ options.subjectId && url.searchParams.set('subjectId', options.subjectId);
40
+ url.protocol = isSecure(url.protocol) ? 'https' : 'http';
41
+ return url.toString();
42
+ };
43
+
44
+ export type InvocationOptions = {
45
+ spaceId?: SpaceId;
46
+ subjectId?: string;
47
+ };
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts", "../../../src/types/trace.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\nimport { TextType } from '@dxos/schema';\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\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\n/**\n * Function deployment.\n */\n// TODO(burdon): Move to core/functions.\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 meta from function.\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';\n\nimport { FunctionTrigger } from './types';\n\nexport const InvocationTrace = S.Struct({\n id: ObjectId,\n /**\n * Queue DXN for function/workflow invocation events.\n */\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('dxos.org/type/InvocationTrace', '0.1.0'));\n\nexport type InvocationTraceEvent = S.Schema.Type<typeof InvocationTrace>;\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 TraceEventException = S.Struct({\n timestampMs: S.Number,\n message: S.String,\n name: S.String,\n stack: S.optional(S.String),\n});\n\nexport const TraceEvent = S.Struct({\n id: ObjectId,\n outcome: S.String,\n truncated: S.Boolean,\n logs: S.Array(TraceEventLog),\n exceptions: S.Array(TraceEventException),\n}).pipe(EchoObject('dxos.org/type/TraceEvent', '0.1.0'));\n\nexport type TraceEvent = S.Schema.Type<typeof TraceEvent>;\n"],
5
- "mappings": ";;;AAIA,SAASA,gBAAgBC,K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MC,UAAUb,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAIO,IAAMe,iBAAiB;EAACV;EAAaL;;;;AC7J5C,SAASgB,YAAYC,SAASC,UAAUC,OAAAA,MAAKC,KAAAA,UAAS;AAI/C,IAAMC,kBAAkBC,GAAEC,OAAO;EACtCC,IAAIC;;;;EAIJC,sBAAsBC,KAAIC,OAAAA;;;;EAI1BC,kBAAkBF,KAAIC,OAAAA;;;;EAItBE,SAASR,GAAES,SAASJ,KAAIK,eAAAA,CAAAA;AAC1B,CAAA,EAAGC,KAAKC,WAAW,iCAAiC,OAAA,CAAA;AAI7C,IAAMC,gBAAgBb,GAAEC,OAAO;EACpCa,aAAad,GAAEe;EACfC,OAAOhB,GAAEiB;EACTC,SAASlB,GAAEiB;EACXE,SAASnB,GAAES,SAAST,GAAEoB,MAAM;AAC9B,CAAA;AAEO,IAAMC,sBAAsBrB,GAAEC,OAAO;EAC1Ca,aAAad,GAAEe;EACfG,SAASlB,GAAEiB;EACXK,MAAMtB,GAAEiB;EACRM,OAAOvB,GAAES,SAAST,GAAEiB,MAAM;AAC5B,CAAA;AAEO,IAAMO,aAAaxB,GAAEC,OAAO;EACjCC,IAAIC;EACJsB,SAASzB,GAAEiB;EACXS,WAAW1B,GAAE2B;EACbC,MAAM5B,GAAE6B,MAAMhB,aAAAA;EACdiB,YAAY9B,GAAE6B,MAAMR,mBAAAA;AACtB,CAAA,EAAGV,KAAKC,WAAW,4BAA4B,OAAA,CAAA;",
6
- "names": ["JsonSchemaType", "Ref", "S", "TypedObject", "TextType", "ScriptType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "description", "changed", "Boolean", "source", "Ref", "TextType", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "outputSchema", "binding", "AST", "OptionsAnnotationId", "RawObject", "S", "TypedObject", "DXN", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "S", "Struct", "type", "Literal", "annotations", "cron", "String", "ExamplesAnnotationId", "pipe", "mutable", "EmailTriggerSchema", "QueueTriggerSchema", "queue", "DXN", "WebhookTriggerSchema", "method", "optional", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "Boolean", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "TypedObject", "typename", "version", "fields", "FunctionDef", "uri", "description", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES", "EchoObject", "Expando", "ObjectId", "Ref", "S", "InvocationTrace", "S", "Struct", "id", "ObjectId", "invocationTraceQueue", "Ref", "Expando", "invocationTarget", "trigger", "optional", "FunctionTrigger", "pipe", "EchoObject", "TraceEventLog", "timestampMs", "Number", "level", "String", "message", "context", "Object", "TraceEventException", "name", "stack", "TraceEvent", "outcome", "truncated", "Boolean", "logs", "Array", "exceptions"]
7
- }