@dxos/functions 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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 (55) hide show
  1. package/dist/lib/browser/bundler/index.mjs.map +3 -3
  2. package/dist/lib/browser/index.mjs +175 -32
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node/bundler/index.cjs.map +3 -3
  6. package/dist/lib/node/index.cjs +167 -30
  7. package/dist/lib/node/index.cjs.map +4 -4
  8. package/dist/lib/node/meta.json +1 -1
  9. package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
  10. package/dist/lib/node-esm/index.mjs +175 -32
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/types/src/bundler/bundler.d.ts.map +1 -1
  14. package/dist/types/src/executor/executor.d.ts +8 -0
  15. package/dist/types/src/executor/executor.d.ts.map +1 -0
  16. package/dist/types/src/executor/index.d.ts +2 -0
  17. package/dist/types/src/executor/index.d.ts.map +1 -0
  18. package/dist/types/src/handler.d.ts +7 -3
  19. package/dist/types/src/handler.d.ts.map +1 -1
  20. package/dist/types/src/index.d.ts +2 -0
  21. package/dist/types/src/index.d.ts.map +1 -1
  22. package/dist/types/src/schema.d.ts.map +1 -1
  23. package/dist/types/src/services/ai.d.ts +9 -0
  24. package/dist/types/src/services/ai.d.ts.map +1 -0
  25. package/dist/types/src/services/credentials.d.ts +30 -0
  26. package/dist/types/src/services/credentials.d.ts.map +1 -0
  27. package/dist/types/src/services/database.d.ts +9 -0
  28. package/dist/types/src/services/database.d.ts.map +1 -0
  29. package/dist/types/src/services/index.d.ts +7 -0
  30. package/dist/types/src/services/index.d.ts.map +1 -0
  31. package/dist/types/src/services/queues.d.ts +10 -0
  32. package/dist/types/src/services/queues.d.ts.map +1 -0
  33. package/dist/types/src/services/service-container.d.ts +25 -0
  34. package/dist/types/src/services/service-container.d.ts.map +1 -0
  35. package/dist/types/src/services/tracing.d.ts +15 -0
  36. package/dist/types/src/services/tracing.d.ts.map +1 -0
  37. package/dist/types/src/trace.d.ts +9 -8
  38. package/dist/types/src/trace.d.ts.map +1 -1
  39. package/dist/types/src/types.d.ts.map +1 -1
  40. package/package.json +20 -20
  41. package/src/bundler/bundler.ts +7 -1
  42. package/src/executor/executor.ts +47 -0
  43. package/src/executor/index.ts +5 -0
  44. package/src/handler.ts +8 -3
  45. package/src/index.ts +4 -0
  46. package/src/schema.ts +8 -9
  47. package/src/services/ai.ts +15 -0
  48. package/src/services/credentials.ts +55 -0
  49. package/src/services/database.ts +14 -0
  50. package/src/services/index.ts +10 -0
  51. package/src/services/queues.ts +16 -0
  52. package/src/services/service-container.ts +58 -0
  53. package/src/services/tracing.ts +27 -0
  54. package/src/trace.ts +4 -4
  55. package/src/types.ts +17 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.8.2-main.fbd8ed0",
3
+ "version": "0.8.2-staging.42af850",
4
4
  "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -42,7 +42,7 @@
42
42
  "src"
43
43
  ],
44
44
  "dependencies": {
45
- "@preact/signals-core": "^1.6.0",
45
+ "@preact/signals-core": "^1.9.0",
46
46
  "cron": "^3.1.6",
47
47
  "cron-schedule": "^5.0.4",
48
48
  "effect": "3.14.21",
@@ -51,28 +51,28 @@
51
51
  "get-port-please": "^3.1.1",
52
52
  "iso-did": "^1.6.0",
53
53
  "ws": "^8.14.2",
54
- "@dxos/assistant": "0.8.2-main.fbd8ed0",
55
- "@dxos/client": "0.8.2-main.fbd8ed0",
56
- "@dxos/async": "0.8.2-main.fbd8ed0",
57
- "@dxos/crypto": "0.8.2-main.fbd8ed0",
58
- "@dxos/context": "0.8.2-main.fbd8ed0",
59
- "@dxos/echo-db": "0.8.2-main.fbd8ed0",
60
- "@dxos/echo-protocol": "0.8.2-main.fbd8ed0",
61
- "@dxos/echo-schema": "0.8.2-main.fbd8ed0",
62
- "@dxos/edge-client": "0.8.2-main.fbd8ed0",
63
- "@dxos/invariant": "0.8.2-main.fbd8ed0",
64
- "@dxos/keys": "0.8.2-main.fbd8ed0",
65
- "@dxos/log": "0.8.2-main.fbd8ed0",
66
- "@dxos/node-std": "0.8.2-main.fbd8ed0",
67
- "@dxos/schema": "0.8.2-main.fbd8ed0",
68
- "@dxos/util": "0.8.2-main.fbd8ed0",
69
- "@dxos/live-object": "0.8.2-main.fbd8ed0",
70
- "@dxos/protocols": "0.8.2-main.fbd8ed0"
54
+ "@dxos/ai": "0.8.2-staging.42af850",
55
+ "@dxos/async": "0.8.2-staging.42af850",
56
+ "@dxos/client": "0.8.2-staging.42af850",
57
+ "@dxos/context": "0.8.2-staging.42af850",
58
+ "@dxos/echo-db": "0.8.2-staging.42af850",
59
+ "@dxos/echo-protocol": "0.8.2-staging.42af850",
60
+ "@dxos/echo-schema": "0.8.2-staging.42af850",
61
+ "@dxos/crypto": "0.8.2-staging.42af850",
62
+ "@dxos/invariant": "0.8.2-staging.42af850",
63
+ "@dxos/log": "0.8.2-staging.42af850",
64
+ "@dxos/edge-client": "0.8.2-staging.42af850",
65
+ "@dxos/live-object": "0.8.2-staging.42af850",
66
+ "@dxos/keys": "0.8.2-staging.42af850",
67
+ "@dxos/node-std": "0.8.2-staging.42af850",
68
+ "@dxos/schema": "0.8.2-staging.42af850",
69
+ "@dxos/util": "0.8.2-staging.42af850",
70
+ "@dxos/protocols": "0.8.2-staging.42af850"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/express": "^4.17.17",
74
74
  "@types/ws": "^7.4.0",
75
- "@dxos/agent": "0.8.2-main.fbd8ed0"
75
+ "@dxos/agent": "0.8.2-staging.42af850"
76
76
  },
77
77
  "publishConfig": {
78
78
  "access": "public"
@@ -171,7 +171,13 @@ export class Bundler {
171
171
  });
172
172
  }
173
173
 
174
- analyzeSourceFileImports(code: string) {
174
+ analyzeSourceFileImports(code: string): {
175
+ defaultImportName: string;
176
+ namedImports: string[];
177
+ wildcardImportName: string;
178
+ moduleIdentifier: string;
179
+ quotes: string;
180
+ }[] {
175
181
  // TODO(dmaretskyi): Support import aliases and wildcard imports.
176
182
  const parsedImports = allMatches(IMPORT_REGEX, code);
177
183
  return parsedImports.map((capture) => {
@@ -0,0 +1,47 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Effect, Schema } from 'effect';
6
+
7
+ import type { SpaceId } from '@dxos/client/echo';
8
+
9
+ import type { FunctionContext, FunctionDefinition } from '../handler';
10
+ import type { ServiceContainer } from '../services';
11
+
12
+ export class FunctionExecutor {
13
+ constructor(private readonly _services: ServiceContainer) {}
14
+
15
+ // TODO(dmaretskyi): Invocation context: queue, space, etc...
16
+ async invoke<F extends FunctionDefinition<any, any>>(
17
+ fnDef: F,
18
+ input: F extends FunctionDefinition<infer I, infer _O> ? I : never,
19
+ ): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never> {
20
+ // Assert input matches schema
21
+ const assertInput = fnDef.inputSchema.pipe(Schema.asserts);
22
+ (assertInput as any)(input);
23
+
24
+ const context: FunctionContext = {
25
+ getService: this._services.getService.bind(this._services),
26
+ getSpace: async (_spaceId: SpaceId) => {
27
+ throw new Error('Not available. Use the database service instead.');
28
+ },
29
+ space: undefined,
30
+ get ai(): never {
31
+ throw new Error('Not available. Use the ai service instead.');
32
+ },
33
+ };
34
+
35
+ const result = await fnDef.handler({ context, data: input });
36
+
37
+ // Assert output matches schema
38
+ const assertOutput = fnDef.outputSchema?.pipe(Schema.asserts);
39
+ (assertOutput as any)(result);
40
+
41
+ if (Effect.isEffect(result)) {
42
+ return Effect.runPromise(result as any);
43
+ }
44
+
45
+ return result as any;
46
+ }
47
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './executor';
package/src/handler.ts CHANGED
@@ -2,10 +2,9 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
6
- import { type Effect } from 'effect';
5
+ import { Schema, type Context, type Effect } from 'effect';
7
6
 
8
- import { type AIServiceClient } from '@dxos/assistant';
7
+ import { type AIServiceClient } from '@dxos/ai';
9
8
  // import { type Space } from '@dxos/client/echo';
10
9
  import type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';
11
10
  import { type HasId } from '@dxos/echo-schema';
@@ -38,6 +37,12 @@ export type FunctionHandler<TData = {}, TOutput = any> = (params: {
38
37
  * Function context.
39
38
  */
40
39
  export interface FunctionContext {
40
+ /**
41
+ * Resolves a service available to the function.
42
+ * @throws if the service is not available.
43
+ */
44
+ getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
45
+
41
46
  getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
42
47
 
43
48
  /**
package/src/index.ts CHANGED
@@ -7,3 +7,7 @@ export * from './schema';
7
7
  export * from './trace';
8
8
  export * from './types';
9
9
  export * from './url';
10
+ export * from './services';
11
+ export * from './executor';
12
+
13
+ // Blow up cache
package/src/schema.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { Schema } from 'effect';
6
6
 
7
- import { EchoObject, JsonSchemaType, LabelAnnotationId, Ref, TypedObject } from '@dxos/echo-schema';
7
+ import { EchoObject, JsonSchemaType, LabelAnnotation, Ref, TypedObject } from '@dxos/echo-schema';
8
8
  import { DataType } from '@dxos/schema';
9
9
 
10
10
  /**
@@ -17,14 +17,13 @@ export const ScriptType = Schema.Struct({
17
17
  // Whether source has changed since last deploy.
18
18
  changed: Schema.optional(Schema.Boolean),
19
19
  source: Ref(DataType.Text),
20
- })
21
- .annotations({ [LabelAnnotationId]: 'name' })
22
- .pipe(
23
- EchoObject({
24
- typename: 'dxos.org/type/Script',
25
- version: '0.1.0',
26
- }),
27
- );
20
+ }).pipe(
21
+ EchoObject({
22
+ typename: 'dxos.org/type/Script',
23
+ version: '0.1.0',
24
+ }),
25
+ LabelAnnotation.set(['name']),
26
+ );
28
27
 
29
28
  export type ScriptType = Schema.Schema.Type<typeof ScriptType>;
30
29
 
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Context } from 'effect';
6
+
7
+ import type { AIServiceClient } from '@dxos/ai';
8
+
9
+ // TODO(burdon): Move to @dxos/ai.
10
+ export class AiService extends Context.Tag('AiService')<
11
+ AiService,
12
+ {
13
+ readonly client: AIServiceClient;
14
+ }
15
+ >() {}
@@ -0,0 +1,55 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Context } from 'effect';
6
+
7
+ type CredentialQuery = {
8
+ service?: string;
9
+ };
10
+
11
+ // TODO(dmaretskyi): Unify with other apis.
12
+ // packages/sdk/schema/src/common/access-token.ts
13
+ type ServiceCredential = {
14
+ service: string;
15
+
16
+ // TODO(dmaretskyi): Build out.
17
+ apiKey?: string;
18
+ };
19
+
20
+ export class CredentialsService extends Context.Tag('CredentialsService')<
21
+ CredentialsService,
22
+ {
23
+ /**
24
+ * Query all.
25
+ */
26
+ queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;
27
+
28
+ /**
29
+ * Get a single credential.
30
+ * @throws {Error} If no credential is found.
31
+ */
32
+ getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
33
+ }
34
+ >() {}
35
+
36
+ export class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
37
+ constructor(private readonly credentials: ServiceCredential[] = []) {}
38
+
39
+ addCredentials(credentials: ServiceCredential[]): ConfiguredCredentialsService {
40
+ this.credentials.push(...credentials);
41
+ return this;
42
+ }
43
+
44
+ async queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]> {
45
+ return this.credentials.filter((credential) => credential.service === query.service);
46
+ }
47
+
48
+ async getCredential(query: CredentialQuery): Promise<ServiceCredential> {
49
+ const credential = this.credentials.find((credential) => credential.service === query.service);
50
+ if (!credential) {
51
+ throw new Error(`Credential not found for service: ${query.service}`);
52
+ }
53
+ return credential;
54
+ }
55
+ }
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Context } from 'effect';
6
+
7
+ import type { EchoDatabase } from '@dxos/echo-db';
8
+
9
+ export class DatabaseService extends Context.Tag('DatabaseService')<
10
+ DatabaseService,
11
+ {
12
+ readonly db: EchoDatabase;
13
+ }
14
+ >() {}
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './ai';
6
+ export * from './database';
7
+ export * from './queues';
8
+ export * from './service-container';
9
+ export * from './credentials';
10
+ export * from './tracing';
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Context } from 'effect';
6
+
7
+ import type { Queue, QueueFactory } from '@dxos/echo-db';
8
+
9
+ export class QueuesService extends Context.Tag('QueuesService')<
10
+ QueuesService,
11
+ {
12
+ readonly contextQueue: Queue | undefined;
13
+
14
+ readonly queues: QueueFactory;
15
+ }
16
+ >() {}
@@ -0,0 +1,58 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Context } from 'effect';
6
+
7
+ import { AiService } from './ai';
8
+ import { CredentialsService } from './credentials';
9
+ import { DatabaseService } from './database';
10
+ import { QueuesService } from './queues';
11
+ import { TracingService } from './tracing';
12
+
13
+ export interface Services {
14
+ database: Context.Tag.Service<DatabaseService>;
15
+ ai: Context.Tag.Service<AiService>;
16
+ queues: Context.Tag.Service<QueuesService>;
17
+ credentials: Context.Tag.Service<CredentialsService>;
18
+ tracing: Context.Tag.Service<TracingService>;
19
+ }
20
+
21
+ const SERVICE_MAPPING: Record<string, keyof Services> = {
22
+ [DatabaseService.key]: 'database',
23
+ [AiService.key]: 'ai',
24
+ [QueuesService.key]: 'queues',
25
+ [CredentialsService.key]: 'credentials',
26
+ [TracingService.key]: 'tracing',
27
+ };
28
+
29
+ const DEFAULT_SERVICES: Partial<Services> = {
30
+ tracing: TracingService.noop,
31
+ };
32
+
33
+ export class ServiceContainer {
34
+ private _services: Partial<Services> = { ...DEFAULT_SERVICES };
35
+
36
+ /**
37
+ * Set services.
38
+ * @param services - Services to set.
39
+ * @returns The container instance.
40
+ */
41
+ setServices(services: Partial<Services>): this {
42
+ this._services = { ...this._services, ...services };
43
+ return this;
44
+ }
45
+
46
+ getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T> {
47
+ const serviceKey = SERVICE_MAPPING[tag.key];
48
+ const service = serviceKey != null ? this._services[serviceKey] : undefined;
49
+ if (!service) {
50
+ throw new Error(`Service not available: ${tag.key}`);
51
+ }
52
+ return service as Context.Tag.Service<T>;
53
+ }
54
+
55
+ clone(): ServiceContainer {
56
+ return new ServiceContainer().setServices({ ...this._services });
57
+ }
58
+ }
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Context } from 'effect';
6
+
7
+ import type { AnyEchoObject } from '@dxos/echo-schema';
8
+
9
+ export class TracingService extends Context.Tag('TracingService')<
10
+ TracingService,
11
+ {
12
+ /**
13
+ * Write an event to the tracing queue.
14
+ * @param event - The event to write. Must be an a typed object.
15
+ */
16
+ write(event: AnyEchoObject): void;
17
+ }
18
+ >() {
19
+ static noop: Context.Tag.Service<TracingService> = { write: () => {} };
20
+
21
+ static console: Context.Tag.Service<TracingService> = {
22
+ write: (event) => {
23
+ // eslint-disable-next-line no-console
24
+ console.log(event);
25
+ },
26
+ };
27
+ }
package/src/trace.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { Schema } from 'effect';
6
6
 
7
+ import { Queue } from '@dxos/echo-db';
7
8
  import { EchoObject, Expando, ObjectId, Ref } from '@dxos/echo-schema';
8
9
  import { log } from '@dxos/log';
9
10
 
@@ -49,10 +50,9 @@ export const InvocationTraceStartEvent = Schema.Struct({
49
50
  // TODO(burdon): Input schema?
50
51
  input: Schema.Object,
51
52
  /**
52
- * Queue DXN for function/workflow invocation events.
53
+ * Queue for function/workflow invocation events.
53
54
  */
54
- // TODO(burdon): Need reference type for queue. vs. string?
55
- invocationTraceQueue: Ref(Expando),
55
+ invocationTraceQueue: Ref(Queue),
56
56
  /**
57
57
  * DXN of the invoked function/workflow.
58
58
  */
@@ -121,7 +121,7 @@ export type InvocationSpan = {
121
121
  outcome: InvocationOutcome;
122
122
  input: object;
123
123
  durationMs: number;
124
- invocationTraceQueue: Ref<Expando>;
124
+ invocationTraceQueue: Ref<Queue>;
125
125
  invocationTarget: Ref<Expando>;
126
126
  trigger?: Ref<FunctionTriggerType>;
127
127
  exception?: TraceEventException;
package/src/types.ts CHANGED
@@ -4,7 +4,8 @@
4
4
 
5
5
  import { Schema, SchemaAST } from 'effect';
6
6
 
7
- import { Expando, OptionsAnnotationId, TypedObject, DXN, Ref, RawObject } from '@dxos/echo-schema';
7
+ import { Expando, OptionsAnnotationId, TypedObject, Ref, RawObject } from '@dxos/echo-schema';
8
+ import { DXN } from '@dxos/keys';
8
9
 
9
10
  import { FunctionType } from './schema';
10
11
 
@@ -21,7 +22,7 @@ export enum TriggerKind {
21
22
  Queue = 'queue',
22
23
  }
23
24
 
24
- const kindLiteralAnnotations = { [SchemaAST.TitleAnnotationId]: 'Kind' };
25
+ const kindLiteralAnnotations = { title: 'Kind' };
25
26
 
26
27
  /**
27
28
  * Cron timer.
@@ -29,7 +30,7 @@ const kindLiteralAnnotations = { [SchemaAST.TitleAnnotationId]: 'Kind' };
29
30
  const TimerTriggerSchema = Schema.Struct({
30
31
  kind: Schema.Literal(TriggerKind.Timer).annotations(kindLiteralAnnotations),
31
32
  cron: Schema.String.annotations({
32
- [SchemaAST.TitleAnnotationId]: 'Cron',
33
+ title: 'Cron',
33
34
  [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],
34
35
  }),
35
36
  }).pipe(Schema.mutable);
@@ -42,7 +43,7 @@ export type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;
42
43
 
43
44
  const QueueTriggerSchema = Schema.Struct({
44
45
  kind: Schema.Literal(TriggerKind.Queue).annotations(kindLiteralAnnotations),
45
- queue: DXN,
46
+ queue: DXN.Schema,
46
47
  }).pipe(Schema.mutable);
47
48
  export type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;
48
49
 
@@ -53,13 +54,13 @@ const WebhookTriggerSchema = Schema.Struct({
53
54
  kind: Schema.Literal(TriggerKind.Webhook).annotations(kindLiteralAnnotations),
54
55
  method: Schema.optional(
55
56
  Schema.String.annotations({
56
- [SchemaAST.TitleAnnotationId]: 'Method',
57
+ title: 'Method',
57
58
  [OptionsAnnotationId]: ['GET', 'POST'],
58
59
  }),
59
60
  ),
60
61
  port: Schema.optional(
61
62
  Schema.Number.annotations({
62
- [SchemaAST.TitleAnnotationId]: 'Port',
63
+ title: 'Port',
63
64
  }),
64
65
  ),
65
66
  }).pipe(Schema.mutable);
@@ -67,9 +68,9 @@ export type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;
67
68
 
68
69
  // TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).
69
70
  const QuerySchema = Schema.Struct({
70
- type: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Type' })),
71
+ type: Schema.optional(Schema.String.annotations({ title: 'Type' })),
71
72
  props: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
72
- }).annotations({ [SchemaAST.TitleAnnotationId]: 'Query' });
73
+ }).annotations({ title: 'Query' });
73
74
 
74
75
  /**
75
76
  * Subscription.
@@ -81,10 +82,10 @@ const SubscriptionTriggerSchema = Schema.Struct({
81
82
  options: Schema.optional(
82
83
  Schema.Struct({
83
84
  // Watch changes to object (not just creation).
84
- deep: Schema.optional(Schema.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Nested' })),
85
+ deep: Schema.optional(Schema.Boolean.annotations({ title: 'Nested' })),
85
86
  // Debounce changes (delay in ms).
86
- delay: Schema.optional(Schema.Number.annotations({ [SchemaAST.TitleAnnotationId]: 'Delay' })),
87
- }).annotations({ [SchemaAST.TitleAnnotationId]: 'Options' }),
87
+ delay: Schema.optional(Schema.Number.annotations({ title: 'Delay' })),
88
+ }).annotations({ title: 'Options' }),
88
89
  ),
89
90
  }).pipe(Schema.mutable);
90
91
  export type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;
@@ -99,7 +100,7 @@ export const TriggerSchema = Schema.Union(
99
100
  EmailTriggerSchema,
100
101
  QueueTriggerSchema,
101
102
  ).annotations({
102
- [SchemaAST.TitleAnnotationId]: 'Trigger',
103
+ title: 'Trigger',
103
104
  });
104
105
  export type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;
105
106
 
@@ -134,7 +135,7 @@ export type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutpu
134
135
 
135
136
  export const QueueTriggerOutput = Schema.mutable(
136
137
  Schema.Struct({
137
- queue: DXN,
138
+ queue: DXN.Schema,
138
139
  item: Schema.Any,
139
140
  cursor: Schema.String,
140
141
  }),
@@ -159,16 +160,16 @@ export const FunctionTriggerSchema = Schema.Struct({
159
160
  * Function or workflow to invoke.
160
161
  */
161
162
  // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).
162
- function: Schema.optional(Ref(Expando).annotations({ [SchemaAST.TitleAnnotationId]: 'Function' })),
163
+ function: Schema.optional(Ref(Expando).annotations({ title: 'Function' })),
163
164
 
164
165
  /**
165
166
  * Only used for workflowSchema.
166
167
  * Specifies the input node in the circuit.
167
168
  * @deprecated Remove and enforce a single input node in all compute graphSchema.
168
169
  */
169
- inputNodeId: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Input Node ID' })),
170
+ inputNodeId: Schema.optional(Schema.String.annotations({ title: 'Input Node ID' })),
170
171
 
171
- enabled: Schema.optional(Schema.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Enabled' })),
172
+ enabled: Schema.optional(Schema.Boolean.annotations({ title: 'Enabled' })),
172
173
 
173
174
  spec: Schema.optional(TriggerSchema),
174
175