@dxos/functions 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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 (39) hide show
  1. package/dist/lib/browser/{chunk-BCNGUHHW.mjs → chunk-IP657FIW.mjs} +2 -2
  2. package/dist/lib/browser/{chunk-PKOLPTSC.mjs → chunk-PWSDZCXB.mjs} +8 -10
  3. package/dist/lib/browser/chunk-PWSDZCXB.mjs.map +7 -0
  4. package/dist/lib/browser/index.mjs +2 -4
  5. package/dist/lib/browser/index.mjs.map +1 -1
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/testing/index.mjs +2 -2
  8. package/dist/lib/browser/types/index.mjs +1 -3
  9. package/dist/lib/node/{chunk-RYEY2RR2.cjs → chunk-2YCBLNMR.cjs} +12 -15
  10. package/dist/lib/node/chunk-2YCBLNMR.cjs.map +7 -0
  11. package/dist/lib/node/{chunk-UHWSNERM.cjs → chunk-3HCN2EE6.cjs} +15 -15
  12. package/dist/lib/node/index.cjs +15 -17
  13. package/dist/lib/node/index.cjs.map +1 -1
  14. package/dist/lib/node/meta.json +1 -1
  15. package/dist/lib/node/testing/index.cjs +7 -7
  16. package/dist/lib/node/types/index.cjs +10 -12
  17. package/dist/lib/node/types/index.cjs.map +2 -2
  18. package/dist/lib/node-esm/{chunk-TPGS4PIH.mjs → chunk-EK2U3CEM.mjs} +2 -2
  19. package/dist/lib/node-esm/{chunk-2UWB6JYW.mjs → chunk-WEI4UCRY.mjs} +8 -10
  20. package/dist/lib/node-esm/chunk-WEI4UCRY.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +2 -4
  22. package/dist/lib/node-esm/index.mjs.map +1 -1
  23. package/dist/lib/node-esm/meta.json +1 -1
  24. package/dist/lib/node-esm/testing/index.mjs +2 -2
  25. package/dist/lib/node-esm/types/index.mjs +1 -3
  26. package/dist/types/src/types/schema.d.ts +0 -7
  27. package/dist/types/src/types/schema.d.ts.map +1 -1
  28. package/dist/types/src/types/types.d.ts +18 -1
  29. package/dist/types/src/types/types.d.ts.map +1 -1
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +17 -17
  32. package/src/types/schema.ts +1 -5
  33. package/src/types/types.ts +8 -0
  34. package/dist/lib/browser/chunk-PKOLPTSC.mjs.map +0 -7
  35. package/dist/lib/node/chunk-RYEY2RR2.cjs.map +0 -7
  36. package/dist/lib/node-esm/chunk-2UWB6JYW.mjs.map +0 -7
  37. /package/dist/lib/browser/{chunk-BCNGUHHW.mjs.map → chunk-IP657FIW.mjs.map} +0 -0
  38. /package/dist/lib/node/{chunk-UHWSNERM.cjs.map → chunk-3HCN2EE6.cjs.map} +0 -0
  39. /package/dist/lib/node-esm/{chunk-TPGS4PIH.mjs.map → chunk-EK2U3CEM.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAO,CAAC,EAAe,MAAM,mBAAmB,CAAC;;;;;;AAGxE,qBAAa,QAAS,SAAQ,aAE5B;CAAG;;;;;;;;;;;;;;;;AAEL;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAW9B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;GAEG;AAEH,qBAAa,YAAa,SAAQ,iBAgBhC;CAAG"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAO,CAAC,EAAe,MAAM,mBAAmB,CAAC;;;;;;wBAOnE,EAAG,MAAM;;;;;;;wBAAT,EAAG,MAAM;;;AAJd;;GAEG;AACH,qBAAa,UAAW,SAAQ,eAW9B;CAAG;;;;;;;;;4BAVA,EAAG,MAAM;;;;;;;;;;;;;4BAAT,EAAG,MAAM;;;;;;AAYd;;GAEG;AAEH,qBAAa,YAAa,SAAQ,iBAgBhC;CAAG"}
@@ -7,7 +7,8 @@ import { S } from '@dxos/echo-schema';
7
7
  export declare enum TriggerKind {
8
8
  Timer = "timer",
9
9
  Webhook = "webhook",
10
- Subscription = "subscription"
10
+ Subscription = "subscription",
11
+ Email = "email"
11
12
  }
12
13
  /**
13
14
  * Cron timer.
@@ -17,6 +18,10 @@ declare const TimerTriggerSchema: S.mutable<S.Struct<{
17
18
  cron: S.SchemaClass<string, string, never>;
18
19
  }>>;
19
20
  export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
21
+ declare const EmailTriggerSchema: S.mutable<S.Struct<{
22
+ type: S.Literal<[TriggerKind.Email]>;
23
+ }>>;
24
+ export type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;
20
25
  /**
21
26
  * Webhook.
22
27
  */
@@ -61,6 +66,8 @@ export declare const TriggerSchema: S.Union<[S.mutable<S.Struct<{
61
66
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
62
67
  delay: S.optional<S.SchemaClass<number, number, never>>;
63
68
  }>>;
69
+ }>>, S.mutable<S.Struct<{
70
+ type: S.Literal<[TriggerKind.Email]>;
64
71
  }>>]>;
65
72
  export type TriggerType = S.Schema.Type<typeof TriggerSchema>;
66
73
  /**
@@ -86,6 +93,8 @@ export declare const FunctionTriggerSchema: S.Struct<{
86
93
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
87
94
  delay: S.optional<S.SchemaClass<number, number, never>>;
88
95
  }>>;
96
+ }>>, S.mutable<S.Struct<{
97
+ type: S.Literal<[TriggerKind.Email]>;
89
98
  }>>]>>;
90
99
  meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
91
100
  }>;
@@ -110,6 +119,8 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
110
119
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
111
120
  delay: S.optional<S.SchemaClass<number, number, never>>;
112
121
  }>>;
122
+ }>>, S.mutable<S.Struct<{
123
+ type: S.Literal<[TriggerKind.Email]>;
113
124
  }>>]>>;
114
125
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
115
126
  }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
@@ -132,6 +143,8 @@ declare const FunctionTrigger_base: import("@dxos/echo-schema").TypedObjectProto
132
143
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
133
144
  delay: S.optional<S.SchemaClass<number, number, never>>;
134
145
  }>>;
146
+ }>>, S.mutable<S.Struct<{
147
+ type: S.Literal<[TriggerKind.Email]>;
135
148
  }>>]>>;
136
149
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
137
150
  }>>;
@@ -192,6 +205,8 @@ export declare const FunctionManifestSchema: S.Struct<{
192
205
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
193
206
  delay: S.optional<S.SchemaClass<number, number, never>>;
194
207
  }>>;
208
+ }>>, S.mutable<S.Struct<{
209
+ type: S.Literal<[TriggerKind.Email]>;
195
210
  }>>]>>;
196
211
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
197
212
  }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>> & import("@dxos/echo-schema").WithMeta, S.Struct.Encoded<{
@@ -214,6 +229,8 @@ export declare const FunctionManifestSchema: S.Struct<{
214
229
  deep: S.optional<S.SchemaClass<boolean, boolean, never>>;
215
230
  delay: S.optional<S.SchemaClass<number, number, never>>;
216
231
  }>>;
232
+ }>>, S.mutable<S.Struct<{
233
+ type: S.Literal<[TriggerKind.Email]>;
217
234
  }>>]>>;
218
235
  readonly meta: S.optional<S.mutable<S.Record$<typeof S.String, typeof S.Any>>>;
219
236
  }>, never>>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types/types.ts"],"names":[],"mappings":"AAIA,OAAO,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,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9E;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAGL;CAAG;;;;;;;;;;;;AAEnC;;;GAGG;AAEH,qBAAa,WAAY,SAAQ,gBAQ/B;CAAG;AAEL;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,iDAAiC,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.2"}
1
+ {"version":"5.7.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.7.5-main.9d26e3a",
3
+ "version": "0.7.5-main.e9bb01b",
4
4
  "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -54,26 +54,26 @@
54
54
  "get-port-please": "^3.1.1",
55
55
  "iso-did": "^1.6.0",
56
56
  "ws": "^8.14.2",
57
- "@dxos/async": "0.7.5-main.9d26e3a",
58
- "@dxos/client": "0.7.5-main.9d26e3a",
59
- "@dxos/echo-db": "0.7.5-main.9d26e3a",
60
- "@dxos/echo-protocol": "0.7.5-main.9d26e3a",
61
- "@dxos/edge-client": "0.7.5-main.9d26e3a",
62
- "@dxos/echo-schema": "0.7.5-main.9d26e3a",
63
- "@dxos/context": "0.7.5-main.9d26e3a",
64
- "@dxos/invariant": "0.7.5-main.9d26e3a",
65
- "@dxos/keys": "0.7.5-main.9d26e3a",
66
- "@dxos/live-object": "0.7.5-main.9d26e3a",
67
- "@dxos/node-std": "0.7.5-main.9d26e3a",
68
- "@dxos/log": "0.7.5-main.9d26e3a",
69
- "@dxos/protocols": "0.7.5-main.9d26e3a",
70
- "@dxos/schema": "0.7.5-main.9d26e3a",
71
- "@dxos/util": "0.7.5-main.9d26e3a"
57
+ "@dxos/async": "0.7.5-main.e9bb01b",
58
+ "@dxos/context": "0.7.5-main.e9bb01b",
59
+ "@dxos/client": "0.7.5-main.e9bb01b",
60
+ "@dxos/echo-schema": "0.7.5-main.e9bb01b",
61
+ "@dxos/echo-protocol": "0.7.5-main.e9bb01b",
62
+ "@dxos/echo-db": "0.7.5-main.e9bb01b",
63
+ "@dxos/edge-client": "0.7.5-main.e9bb01b",
64
+ "@dxos/invariant": "0.7.5-main.e9bb01b",
65
+ "@dxos/keys": "0.7.5-main.e9bb01b",
66
+ "@dxos/log": "0.7.5-main.e9bb01b",
67
+ "@dxos/live-object": "0.7.5-main.e9bb01b",
68
+ "@dxos/node-std": "0.7.5-main.e9bb01b",
69
+ "@dxos/protocols": "0.7.5-main.e9bb01b",
70
+ "@dxos/schema": "0.7.5-main.e9bb01b",
71
+ "@dxos/util": "0.7.5-main.e9bb01b"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/express": "^4.17.17",
75
75
  "@types/ws": "^7.4.0",
76
- "@dxos/agent": "0.7.5-main.9d26e3a"
76
+ "@dxos/agent": "0.7.5-main.e9bb01b"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public"
@@ -3,11 +3,7 @@
3
3
  //
4
4
 
5
5
  import { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';
6
-
7
- // TODO(burdon): Reconcile with plugin-markdown.
8
- export class TextType extends TypedObject({ typename: 'dxos.org/type/Text', version: '0.1.0' })({
9
- content: S.String,
10
- }) {}
6
+ import { TextType } from '@dxos/schema';
11
7
 
12
8
  /**
13
9
  * Source script.
@@ -13,6 +13,7 @@ export enum TriggerKind {
13
13
  Timer = 'timer',
14
14
  Webhook = 'webhook',
15
15
  Subscription = 'subscription',
16
+ Email = 'email',
16
17
  }
17
18
 
18
19
  // TODO(burdon): Rename prop kind.
@@ -31,6 +32,12 @@ const TimerTriggerSchema = S.Struct({
31
32
 
32
33
  export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
33
34
 
35
+ const EmailTriggerSchema = S.Struct({
36
+ type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),
37
+ }).pipe(S.mutable);
38
+
39
+ export type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;
40
+
34
41
  /**
35
42
  * Webhook.
36
43
  */
@@ -84,6 +91,7 @@ export const TriggerSchema = S.Union(
84
91
  TimerTriggerSchema,
85
92
  WebhookTriggerSchema,
86
93
  SubscriptionTriggerSchema,
94
+ EmailTriggerSchema,
87
95
  ).annotations({
88
96
  [AST.TitleAnnotationId]: 'Trigger',
89
97
  });
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Reconcile with plugin-markdown.\nexport class TextType extends TypedObject({ typename: 'dxos.org/type/Text', version: '0.1.0' })({\n content: S.String,\n}) {}\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n // TODO(burdon): Change to URI?\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 // 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\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 } 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}\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\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 //\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\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 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"],
5
- "mappings": ";;;AAIA,SAASA,gBAAgBC,KAAKC,GAAGC,mBAAmB;AAG7C,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,SAASC,EAAEC;AACb,CAAA,EAAA;AAAI;AAKG,IAAMC,aAAN,cAAyBN,YAAY;EAC1CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDK,MAAMH,EAAEI,SAASJ,EAAEC,MAAM;EACzBI,aAAaL,EAAEI,SAASJ,EAAEC,MAAM;;;EAGhCK,SAASN,EAAEI,SAASJ,EAAEO,OAAO;EAC7BC,QAAQC,IAAId,QAAAA;AACd,CAAA,EAAA;AAAI;AAMG,IAAMe,eAAN,cAA2Bd,YAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDK,MAAMH,EAAEW;EACRb,SAASE,EAAEC;;;EAIXO,QAAQR,EAAEI,SAASK,IAAIP,UAAAA,CAAAA;EAEvBU,aAAaZ,EAAEI,SAASS,cAAAA;;EAGxBC,SAASd,EAAEI,SAASJ,EAAEC,MAAM;AAC9B,CAAA,EAAA;AAAI;;;AC3CJ,SAASc,KAAKC,qBAAqBC,WAAWC,KAAAA,IAAGC,eAAAA,oBAAmB;;UAOxDC,cAAAA;;;;GAAAA,gBAAAA,cAAAA,CAAAA,EAAAA;AAOZ,IAAMC,yBAAyB;EAAE,CAACC,IAAIC,iBAAiB,GAAG;AAAO;AAKjE,IAAMC,qBAAqBC,GAAEC,OAAO;EAClCC,MAAMF,GAAEG,Q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Ub,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAIO,IAAMe,iBAAiB;EAACV;EAAaL;;",
6
- "names": ["JsonSchemaType", "Ref", "S", "TypedObject", "TextType", "TypedObject", "typename", "version", "content", "S", "String", "ScriptType", "name", "optional", "description", "changed", "Boolean", "source", "Ref", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "binding", "AST", "OptionsAnnotationId", "RawObject", "S", "TypedObject", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "S", "Struct", "type", "Literal", "annotations", "cron", "String", "ExamplesAnnotationId", "pipe", "mutable", "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"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Reconcile with plugin-markdown.\nexport class TextType extends TypedObject({ typename: 'dxos.org/type/Text', version: '0.1.0' })({\n content: S.String,\n}) {}\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n // TODO(burdon): Change to URI?\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 // 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\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 } 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}\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\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 //\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\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 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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAoD;ACApD,IAAAA,sBAAoE;ADG7D,IAAMC,WAAN,kBAAuBC,gCAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,SAASC,qBAAEC;AACb,CAAA,EAAA;AAAI;AAKG,IAAMC,aAAN,kBAAyBN,gCAAY;EAC1CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDK,MAAMH,qBAAEI,SAASJ,qBAAEC,MAAM;EACzBI,aAAaL,qBAAEI,SAASJ,qBAAEC,MAAM;;;EAGhCK,SAASN,qBAAEI,SAASJ,qBAAEO,OAAO;EAC7BC,YAAQC,wBAAId,QAAAA;AACd,CAAA,EAAA;AAAI;AAMG,IAAMe,eAAN,kBAA2Bd,gCAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;;EAEDK,MAAMH,qBAAEW;EACRb,SAASE,qBAAEC;;;EAIXO,QAAQR,qBAAEI,aAASK,wBAAIP,UAAAA,CAAAA;EAEvBU,aAAaZ,qBAAEI,SAASS,iCAAAA;;EAGxBC,SAASd,qBAAEI,SAASJ,qBAAEC,MAAM;AAC9B,CAAA,EAAA;AAAI;;UCpCQc,cAAAA;;;;GAAAA,gBAAAA,cA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CAAA;AACpE,CAAA;AAOO,IAAMa,kBAAN,kBAA8BvD,oBAAAA,aAAY;EAC/CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGgD,sBAAsBM,MAAM,EAAA;AAAG;AAO3B,IAAMC,cAAN,kBAA0BzD,oBAAAA,aAAY;EAC3CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDwD,KAAKtD,oBAAAA,EAAEC;EACPI,aAAaL,oBAAAA,EAAEI,SAASJ,oBAAAA,EAAEC,MAAM;EAChCsD,OAAOvD,oBAAAA,EAAEC;EACTuD,SAASxD,oBAAAA,EAAEC;AACb,CAAA,EAAA;AAAI;AAKG,IAAMwD,yBAAyBzD,oBAAAA,EAAEoB,OAAO;EAC7CsC,WAAW1D,oBAAAA,EAAEI,SAASJ,oBAAAA,EAAE2B,QAAQ3B,oBAAAA,EAAE2D,UAAMC,+BAAUP,WAAAA,CAAAA,CAAAA,CAAAA;EAClDQ,UAAU7D,oBAAAA,EAAEI,SAASJ,oBAAAA,EAAE2B,QAAQ3B,oBAAAA,EAAE2D,UAAMC,+BAAUT,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAIO,IAAMW,iBAAiB;EAACT;EAAaF;;",
6
- "names": ["import_echo_schema", "TextType", "TypedObject", "typename", "version", "content", "S", "String", "ScriptType", "name", "optional", "description", "changed", "Boolean", "source", "Ref", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "binding", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "Struct", "type", "Literal", "annotations", "cron", "ExamplesAnnotationId", "pipe", "mutable", "WebhookTriggerSchema", "method", "OptionsAnnotationId", "port", "Number", "QuerySchema", "props", "Record", "key", "value", "Any", "SubscriptionTriggerSchema", "filter", "options", "deep", "delay", "TriggerSchema", "Union", "FunctionTriggerSchema", "function", "enabled", "spec", "meta", "FunctionTrigger", "fields", "FunctionDef", "uri", "route", "handler", "FunctionManifestSchema", "functions", "Array", "RawObject", "triggers", "FUNCTION_TYPES"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { JsonSchemaType, Ref, S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Reconcile with plugin-markdown.\nexport class TextType extends TypedObject({ typename: 'dxos.org/type/Text', version: '0.1.0' })({\n content: S.String,\n}) {}\n\n/**\n * Source script.\n */\nexport class ScriptType extends TypedObject({\n typename: 'dxos.org/type/Script',\n version: '0.1.0',\n})({\n // TODO(burdon): Change to URI?\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 // 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\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 } 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}\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\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 //\n TimerTriggerSchema,\n WebhookTriggerSchema,\n SubscriptionTriggerSchema,\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 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"],
5
- "mappings": ";;;AAIA,SAASA,gBAAgBC,KAAKC,GAAGC,mBAAmB;AAG7C,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,SAASC,EAAEC;AACb,CAAA,EAAA;AAAI;AAKG,IAAMC,aAAN,cAAyBN,YAAY;EAC1CC,UAAU;EACVC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AAiB,GAAG;EAAU,CAAA,CAAA;;EAG/EmC,MAAMjC,GAAEY,SAASgB,aAAAA;;;EAIjBM,MAAMlC,GAAEY,SAASZ,GAAES,QAAQT,GAAEkB,OAAO;IAAEC,KAAKnB,GAAEM;IAAQc,OAAOpB,GAAEqB;EAAI,CAAA,CAAA,CAAA;AACpE,CAAA;AAOO,IAAMc,kBAAN,cAA8BC,aAAY;EAC/CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGR,sBAAsBS,MAAM,EAAA;AAAG;AAO3B,IAAMC,cAAN,cAA0BJ,aAAY;EAC3CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDG,KAAKzC,GAAEM;EACPoC,aAAa1C,GAAEY,SAASZ,GAAEM,MAAM;EAChCqC,OAAO3C,GAAEM;EACTsC,SAAS5C,GAAEM;AACb,CAAA,EAAA;AAAI;AAKG,IAAMuC,yBAAyB7C,GAAEC,OAAO;EAC7C6C,WAAW9C,GAAEY,SAASZ,GAAES,QAAQT,GAAE+C,MAAMC,UAAUR,WAAAA,CAAAA,CAAAA,CAAAA;EAClDS,UAAUjD,GAAEY,SAASZ,GAAES,QAAQT,GAAE+C,MAAMC,UAAUb,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAIO,IAAMe,iBAAiB;EAACV;EAAaL;;",
6
- "names": ["JsonSchemaType", "Ref", "S", "TypedObject", "TextType", "TypedObject", "typename", "version", "content", "S", "String", "ScriptType", "name", "optional", "description", "changed", "Boolean", "source", "Ref", "FunctionType", "NonEmptyString", "inputSchema", "JsonSchemaType", "binding", "AST", "OptionsAnnotationId", "RawObject", "S", "TypedObject", "TriggerKind", "typeLiteralAnnotations", "AST", "TitleAnnotationId", "TimerTriggerSchema", "S", "Struct", "type", "Literal", "annotations", "cron", "String", "ExamplesAnnotationId", "pipe", "mutable", "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"]
7
- }