@dxos/functions 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44

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 (57) hide show
  1. package/dist/lib/{browser → neutral}/index.mjs +450 -148
  2. package/dist/lib/neutral/index.mjs.map +7 -0
  3. package/dist/lib/neutral/meta.json +1 -0
  4. package/dist/types/src/errors.d.ts +24 -32
  5. package/dist/types/src/errors.d.ts.map +1 -1
  6. package/dist/types/src/operation-compatibility.test.d.ts +2 -0
  7. package/dist/types/src/operation-compatibility.test.d.ts.map +1 -0
  8. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  9. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  10. package/dist/types/src/protocol/protocol.d.ts.map +1 -1
  11. package/dist/types/src/sdk.d.ts +27 -2
  12. package/dist/types/src/sdk.d.ts.map +1 -1
  13. package/dist/types/src/services/credentials.d.ts +6 -4
  14. package/dist/types/src/services/credentials.d.ts.map +1 -1
  15. package/dist/types/src/services/event-logger.d.ts +25 -31
  16. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  17. package/dist/types/src/services/function-invocation-service.d.ts +5 -0
  18. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  19. package/dist/types/src/services/index.d.ts +0 -1
  20. package/dist/types/src/services/index.d.ts.map +1 -1
  21. package/dist/types/src/services/queues.d.ts +4 -4
  22. package/dist/types/src/services/queues.d.ts.map +1 -1
  23. package/dist/types/src/services/tracing.d.ts +37 -3
  24. package/dist/types/src/services/tracing.d.ts.map +1 -1
  25. package/dist/types/src/types/Function.d.ts +40 -46
  26. package/dist/types/src/types/Function.d.ts.map +1 -1
  27. package/dist/types/src/types/Script.d.ts +9 -16
  28. package/dist/types/src/types/Script.d.ts.map +1 -1
  29. package/dist/types/src/types/Trigger.d.ts +58 -76
  30. package/dist/types/src/types/Trigger.d.ts.map +1 -1
  31. package/dist/types/src/types/TriggerEvent.d.ts +43 -13
  32. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -1
  33. package/dist/types/src/types/url.d.ts +4 -3
  34. package/dist/types/src/types/url.d.ts.map +1 -1
  35. package/dist/types/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +23 -17
  37. package/src/errors.ts +4 -4
  38. package/src/operation-compatibility.test.ts +185 -0
  39. package/src/protocol/functions-ai-http-client.ts +67 -0
  40. package/src/protocol/protocol.ts +184 -67
  41. package/src/sdk.ts +68 -5
  42. package/src/services/credentials.ts +31 -15
  43. package/src/services/event-logger.ts +2 -2
  44. package/src/services/function-invocation-service.ts +14 -0
  45. package/src/services/index.ts +0 -2
  46. package/src/services/queues.ts +5 -7
  47. package/src/services/tracing.ts +63 -4
  48. package/src/types/Function.ts +28 -8
  49. package/src/types/Script.ts +8 -7
  50. package/src/types/Trigger.ts +18 -14
  51. package/src/types/TriggerEvent.ts +29 -29
  52. package/src/types/url.ts +4 -3
  53. package/dist/lib/browser/index.mjs.map +0 -7
  54. package/dist/lib/browser/meta.json +0 -1
  55. package/dist/lib/node-esm/index.mjs +0 -928
  56. package/dist/lib/node-esm/index.mjs.map +0 -7
  57. package/dist/lib/node-esm/meta.json +0 -1
@@ -1,21 +1,19 @@
1
1
  import * as Schema from 'effect/Schema';
2
- import { Type } from '@dxos/echo';
3
- export type TriggerEvent = EmailEvent | QueueEvent | SubscriptionEvent | TimerEvent | WebhookEvent;
4
- export declare const EmailEvent: Schema.mutable<Schema.Struct<{
2
+ export declare const EmailEvent: Schema.Struct<{
5
3
  from: typeof Schema.String;
6
4
  to: typeof Schema.String;
7
5
  subject: typeof Schema.String;
8
6
  created: typeof Schema.String;
9
7
  body: typeof Schema.String;
10
- }>>;
8
+ }>;
11
9
  export type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;
12
- export declare const QueueEvent: Schema.mutable<Schema.Struct<{
10
+ export declare const QueueEvent: Schema.Struct<{
13
11
  queue: Schema.refine<string, typeof Schema.NonEmptyString>;
14
12
  item: typeof Schema.Any;
15
13
  cursor: typeof Schema.String;
16
- }>>;
14
+ }>;
17
15
  export type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;
18
- export declare const SubscriptionEvent: Schema.mutable<Schema.Struct<{
16
+ export declare const SubscriptionEvent: Schema.Struct<{
19
17
  /**
20
18
  * Type of the mutation.
21
19
  */
@@ -23,22 +21,54 @@ export declare const SubscriptionEvent: Schema.mutable<Schema.Struct<{
23
21
  /**
24
22
  * Reference to the object that was changed or created.
25
23
  */
26
- subject: Type.ref<Type.obj<Schema.Struct<{}>>>;
24
+ subject: import("@dxos/echo/internal").RefSchema<any>;
27
25
  /**
28
26
  * @deprecated
29
27
  */
30
28
  changedObjectId: Schema.optional<typeof Schema.String>;
31
- }>>;
29
+ }>;
32
30
  export type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;
33
- export declare const TimerEvent: Schema.mutable<Schema.Struct<{
31
+ export declare const TimerEvent: Schema.Struct<{
34
32
  tick: typeof Schema.Number;
35
- }>>;
33
+ }>;
36
34
  export type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;
37
- export declare const WebhookEvent: Schema.mutable<Schema.Struct<{
35
+ export declare const WebhookEvent: Schema.Struct<{
38
36
  url: typeof Schema.String;
39
37
  method: Schema.Literal<["GET", "POST"]>;
40
38
  headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
41
39
  bodyText: typeof Schema.String;
42
- }>>;
40
+ }>;
43
41
  export type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;
42
+ export declare const TriggerEvent: Schema.Union<[Schema.Struct<{
43
+ from: typeof Schema.String;
44
+ to: typeof Schema.String;
45
+ subject: typeof Schema.String;
46
+ created: typeof Schema.String;
47
+ body: typeof Schema.String;
48
+ }>, Schema.Struct<{
49
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
50
+ item: typeof Schema.Any;
51
+ cursor: typeof Schema.String;
52
+ }>, Schema.Struct<{
53
+ /**
54
+ * Type of the mutation.
55
+ */
56
+ type: typeof Schema.String;
57
+ /**
58
+ * Reference to the object that was changed or created.
59
+ */
60
+ subject: import("@dxos/echo/internal").RefSchema<any>;
61
+ /**
62
+ * @deprecated
63
+ */
64
+ changedObjectId: Schema.optional<typeof Schema.String>;
65
+ }>, Schema.Struct<{
66
+ tick: typeof Schema.Number;
67
+ }>, Schema.Struct<{
68
+ url: typeof Schema.String;
69
+ method: Schema.Literal<["GET", "POST"]>;
70
+ headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
71
+ bodyText: typeof Schema.String;
72
+ }>]>;
73
+ export type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;
44
74
  //# sourceMappingURL=TriggerEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TriggerEvent.d.ts","sourceRoot":"","sources":["../../../../src/types/TriggerEvent.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAY,IAAI,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,GAAG,UAAU,GAAG,YAAY,CAAC;AAGnG,eAAO,MAAM,UAAU;;;;;;GAQtB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,UAAU;;;;GAMtB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,iBAAiB;IAC5B;;OAEG;;IAIH;;OAEG;;IAGH;;OAEG;;GAEkB,CAAC;AACxB,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7E,eAAO,MAAM,UAAU;;GAAyD,CAAC;AACjF,MAAM,MAAM,UAA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"}
@@ -1,12 +1,13 @@
1
- import { type ObjectMeta } from '@dxos/echo/internal';
1
+ import { type Obj } from '@dxos/echo';
2
2
  export declare const FUNCTIONS_META_KEY = "dxos.org/service/function";
3
3
  export declare const FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
4
4
  /**
5
5
  * NOTE: functionId is backend ID, not ECHO object id.
6
6
  */
7
- export declare const getUserFunctionIdInMetadata: (meta: ObjectMeta) => string | undefined;
7
+ export declare const getUserFunctionIdInMetadata: (meta: Obj.ReadonlyMeta) => string | undefined;
8
8
  /**
9
9
  * NOTE: functionId is backend ID, not ECHO object id.
10
+ * Must be called inside Obj.changeMeta() since it mutates the meta.
10
11
  */
11
- export declare const setUserFunctionIdInMetadata: (meta: ObjectMeta, functionId: string) => void;
12
+ export declare const setUserFunctionIdInMetadata: (meta: Obj.Meta, functionId: string) => void;
12
13
  //# sourceMappingURL=url.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/types/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,UAAU,uBAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,UAAU,EAAE,YAAY,MAAM,SAS/E,CAAC"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/types/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,GAAG,CAAC,YAAY,uBAEjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,GAAG,CAAC,IAAI,EAAE,YAAY,MAAM,SAS7E,CAAC"}