@dxos/functions 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33

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 (188) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/Trace.mjs +42 -0
  3. package/dist/lib/neutral/Trace.mjs.map +7 -0
  4. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  5. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  6. package/dist/lib/neutral/chunk-LI2RBI7V.mjs +49 -0
  7. package/dist/lib/neutral/chunk-LI2RBI7V.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-VOFFKJP4.mjs +178 -0
  9. package/dist/lib/neutral/chunk-VOFFKJP4.mjs.map +7 -0
  10. package/dist/lib/neutral/fib-WEAWVJIJ.mjs +23 -0
  11. package/dist/lib/neutral/fib-WEAWVJIJ.mjs.map +7 -0
  12. package/dist/lib/neutral/index.mjs +1082 -0
  13. package/dist/lib/neutral/index.mjs.map +7 -0
  14. package/dist/lib/neutral/meta.json +1 -0
  15. package/dist/lib/neutral/reply-AIAJ3PTW.mjs +19 -0
  16. package/dist/lib/neutral/reply-AIAJ3PTW.mjs.map +7 -0
  17. package/dist/lib/neutral/sleep-M4YMO6FP.mjs +15 -0
  18. package/dist/lib/neutral/sleep-M4YMO6FP.mjs.map +7 -0
  19. package/dist/types/src/Trace.d.ts +174 -0
  20. package/dist/types/src/Trace.d.ts.map +1 -0
  21. package/dist/types/src/errors.d.ts +179 -0
  22. package/dist/types/src/errors.d.ts.map +1 -0
  23. package/dist/types/src/example/definitions.d.ts +11 -0
  24. package/dist/types/src/example/definitions.d.ts.map +1 -0
  25. package/dist/types/src/example/fib.d.ts +8 -0
  26. package/dist/types/src/example/fib.d.ts.map +1 -0
  27. package/dist/types/src/example/forex-effect.d.ts +3 -0
  28. package/dist/types/src/example/forex-effect.d.ts.map +1 -0
  29. package/dist/types/src/example/index.d.ts +4 -0
  30. package/dist/types/src/example/index.d.ts.map +1 -0
  31. package/dist/types/src/example/reply.d.ts +4 -0
  32. package/dist/types/src/example/reply.d.ts.map +1 -0
  33. package/dist/types/src/example/sleep.d.ts +6 -0
  34. package/dist/types/src/example/sleep.d.ts.map +1 -0
  35. package/dist/types/src/index.d.ts +9 -6
  36. package/dist/types/src/index.d.ts.map +1 -1
  37. package/dist/types/src/process/Process.d.ts +246 -0
  38. package/dist/types/src/process/Process.d.ts.map +1 -0
  39. package/dist/types/src/process/ServiceResolver.d.ts +74 -0
  40. package/dist/types/src/process/ServiceResolver.d.ts.map +1 -0
  41. package/dist/types/src/process/StorageService.d.ts +58 -0
  42. package/dist/types/src/process/StorageService.d.ts.map +1 -0
  43. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  44. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  45. package/dist/types/src/protocol/index.d.ts +2 -0
  46. package/dist/types/src/protocol/index.d.ts.map +1 -0
  47. package/dist/types/src/protocol/protocol.d.ts +7 -0
  48. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  49. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  50. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  51. package/dist/types/src/sdk.d.ts +11 -0
  52. package/dist/types/src/sdk.d.ts.map +1 -0
  53. package/dist/types/src/services/credentials.d.ts +23 -3
  54. package/dist/types/src/services/credentials.d.ts.map +1 -1
  55. package/dist/types/src/services/function-invocation-service.d.ts +16 -0
  56. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -0
  57. package/dist/types/src/services/index.d.ts +4 -8
  58. package/dist/types/src/services/index.d.ts.map +1 -1
  59. package/dist/types/src/services/queues.d.ts +1 -17
  60. package/dist/types/src/services/queues.d.ts.map +1 -1
  61. package/dist/types/src/services/tracing.d.ts +4 -14
  62. package/dist/types/src/services/tracing.d.ts.map +1 -1
  63. package/dist/types/src/types/Script.d.ts +22 -0
  64. package/dist/types/src/types/Script.d.ts.map +1 -0
  65. package/dist/types/src/types/Trigger.d.ts +150 -0
  66. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  67. package/dist/types/src/types/TriggerEvent.d.ts +75 -0
  68. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  69. package/dist/types/src/types/index.d.ts +5 -0
  70. package/dist/types/src/types/index.d.ts.map +1 -0
  71. package/dist/types/src/types/url.d.ts +13 -0
  72. package/dist/types/src/types/url.d.ts.map +1 -0
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +32 -67
  75. package/src/Trace.ts +231 -0
  76. package/src/errors.ts +31 -0
  77. package/src/example/definitions.ts +49 -0
  78. package/src/example/fib.ts +23 -0
  79. package/src/example/forex-effect.ts +40 -0
  80. package/src/example/index.ts +12 -0
  81. package/src/example/reply.ts +19 -0
  82. package/src/example/sleep.ts +17 -0
  83. package/src/index.ts +9 -8
  84. package/src/process/Process.ts +489 -0
  85. package/src/process/ServiceResolver.ts +174 -0
  86. package/src/process/StorageService.ts +99 -0
  87. package/src/protocol/functions-ai-http-client.ts +67 -0
  88. package/src/{executor → protocol}/index.ts +1 -1
  89. package/src/protocol/protocol.test.ts +58 -0
  90. package/src/protocol/protocol.ts +283 -0
  91. package/src/sdk.ts +30 -0
  92. package/src/services/credentials.ts +108 -4
  93. package/src/services/function-invocation-service.ts +35 -0
  94. package/src/services/index.ts +4 -8
  95. package/src/services/queues.ts +1 -38
  96. package/src/services/tracing.ts +4 -23
  97. package/src/types/Script.ts +38 -0
  98. package/src/types/Trigger.ts +207 -0
  99. package/src/types/TriggerEvent.ts +62 -0
  100. package/src/types/index.ts +8 -0
  101. package/src/types/url.ts +32 -0
  102. package/dist/lib/browser/bundler/index.mjs +0 -247
  103. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  104. package/dist/lib/browser/chunk-54U464M4.mjs +0 -360
  105. package/dist/lib/browser/chunk-54U464M4.mjs.map +0 -7
  106. package/dist/lib/browser/edge/index.mjs +0 -69
  107. package/dist/lib/browser/edge/index.mjs.map +0 -7
  108. package/dist/lib/browser/index.mjs +0 -492
  109. package/dist/lib/browser/index.mjs.map +0 -7
  110. package/dist/lib/browser/meta.json +0 -1
  111. package/dist/lib/browser/testing/index.mjs +0 -79
  112. package/dist/lib/browser/testing/index.mjs.map +0 -7
  113. package/dist/lib/node-esm/bundler/index.mjs +0 -249
  114. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-XDSX35BS.mjs +0 -362
  116. package/dist/lib/node-esm/chunk-XDSX35BS.mjs.map +0 -7
  117. package/dist/lib/node-esm/edge/index.mjs +0 -71
  118. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  119. package/dist/lib/node-esm/index.mjs +0 -493
  120. package/dist/lib/node-esm/index.mjs.map +0 -7
  121. package/dist/lib/node-esm/meta.json +0 -1
  122. package/dist/lib/node-esm/testing/index.mjs +0 -80
  123. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  124. package/dist/types/src/bundler/bundler.d.ts +0 -50
  125. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  126. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  127. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  128. package/dist/types/src/bundler/index.d.ts +0 -2
  129. package/dist/types/src/bundler/index.d.ts.map +0 -1
  130. package/dist/types/src/edge/functions.d.ts +0 -16
  131. package/dist/types/src/edge/functions.d.ts.map +0 -1
  132. package/dist/types/src/edge/index.d.ts +0 -2
  133. package/dist/types/src/edge/index.d.ts.map +0 -1
  134. package/dist/types/src/executor/executor.d.ts +0 -8
  135. package/dist/types/src/executor/executor.d.ts.map +0 -1
  136. package/dist/types/src/executor/index.d.ts +0 -2
  137. package/dist/types/src/executor/index.d.ts.map +0 -1
  138. package/dist/types/src/handler.d.ts +0 -61
  139. package/dist/types/src/handler.d.ts.map +0 -1
  140. package/dist/types/src/schema.d.ts +0 -38
  141. package/dist/types/src/schema.d.ts.map +0 -1
  142. package/dist/types/src/services/ai.d.ts +0 -12
  143. package/dist/types/src/services/ai.d.ts.map +0 -1
  144. package/dist/types/src/services/database.d.ts +0 -15
  145. package/dist/types/src/services/database.d.ts.map +0 -1
  146. package/dist/types/src/services/event-logger.d.ts +0 -37
  147. package/dist/types/src/services/event-logger.d.ts.map +0 -1
  148. package/dist/types/src/services/function-call-service.d.ts +0 -16
  149. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  150. package/dist/types/src/services/service-container.d.ts +0 -46
  151. package/dist/types/src/services/service-container.d.ts.map +0 -1
  152. package/dist/types/src/services/tool-resolver.d.ts +0 -14
  153. package/dist/types/src/services/tool-resolver.d.ts.map +0 -1
  154. package/dist/types/src/testing/index.d.ts +0 -2
  155. package/dist/types/src/testing/index.d.ts.map +0 -1
  156. package/dist/types/src/testing/logger.d.ts +0 -5
  157. package/dist/types/src/testing/logger.d.ts.map +0 -1
  158. package/dist/types/src/testing/services.d.ts +0 -71
  159. package/dist/types/src/testing/services.d.ts.map +0 -1
  160. package/dist/types/src/trace.d.ts +0 -124
  161. package/dist/types/src/trace.d.ts.map +0 -1
  162. package/dist/types/src/translations.d.ts +0 -12
  163. package/dist/types/src/translations.d.ts.map +0 -1
  164. package/dist/types/src/types.d.ts +0 -411
  165. package/dist/types/src/types.d.ts.map +0 -1
  166. package/dist/types/src/url.d.ts +0 -17
  167. package/dist/types/src/url.d.ts.map +0 -1
  168. package/src/bundler/bundler.test.ts +0 -59
  169. package/src/bundler/bundler.ts +0 -292
  170. package/src/bundler/index.ts +0 -5
  171. package/src/edge/functions.ts +0 -64
  172. package/src/edge/index.ts +0 -9
  173. package/src/executor/executor.ts +0 -54
  174. package/src/handler.ts +0 -113
  175. package/src/schema.ts +0 -57
  176. package/src/services/ai.ts +0 -32
  177. package/src/services/database.ts +0 -50
  178. package/src/services/event-logger.ts +0 -87
  179. package/src/services/function-call-service.ts +0 -64
  180. package/src/services/service-container.ts +0 -127
  181. package/src/services/tool-resolver.ts +0 -31
  182. package/src/testing/index.ts +0 -5
  183. package/src/testing/logger.ts +0 -16
  184. package/src/testing/services.ts +0 -174
  185. package/src/trace.ts +0 -180
  186. package/src/translations.ts +0 -20
  187. package/src/types.ts +0 -211
  188. package/src/url.ts +0 -52
@@ -0,0 +1,58 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Option from 'effect/Option';
4
+ import * as Pipeable from 'effect/Pipeable';
5
+ import * as Schema from 'effect/Schema';
6
+ export interface Service {
7
+ /** Read a value by key. Returns `None` if key does not exist. */
8
+ get<S extends Schema.Schema<any, string, any>>(schema: S, key: string): Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, Schema.Schema.Context<S>>;
9
+ /** Write a value for the given key. */
10
+ set<S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>): Effect.Effect<void, never, Schema.Schema.Context<S>>;
11
+ /** Remove a key. */
12
+ delete(key: string): Effect.Effect<void>;
13
+ /** List all keys, optionally filtered by prefix. */
14
+ list(prefix?: string): Effect.Effect<readonly string[]>;
15
+ /** Remove all keys managed by this scoped store. */
16
+ clear(): Effect.Effect<void>;
17
+ }
18
+ declare const StorageService_base: Context.TagClass<StorageService, "@dxos/functions/StorageService", Service>;
19
+ /**
20
+ * Scoped key-value storage service for processes.
21
+ * Each process receives its own namespaced instance via the process manager.
22
+ * Construct a live implementation with `StorageService.layer` from `@dxos/functions-runtime`.
23
+ */
24
+ export declare class StorageService extends StorageService_base {
25
+ }
26
+ export declare const get: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Effect.Effect<Option.Option<Schema.Schema.Type<S>>, never, StorageService | Schema.Schema.Context<S>>;
27
+ export declare const set: <S extends Schema.Schema<any, string, any>>(schema: S, key: string, value: Schema.Schema.Type<S>) => Effect.Effect<void, never, StorageService | Schema.Schema.Context<S>>;
28
+ export declare const deleteKey: (key: string) => Effect.Effect<void, never, StorageService>;
29
+ export declare const list: (prefix?: string | undefined) => Effect.Effect<readonly string[], never, StorageService>;
30
+ export declare const clear: () => Effect.Effect<void, never, StorageService>;
31
+ /**
32
+ * Typed key in a storage service.
33
+ */
34
+ export interface Key<T> extends Pipeable.Pipeable {
35
+ readonly key: string;
36
+ get: Effect.Effect<Option.Option<T>, never, StorageService>;
37
+ set(value: T): Effect.Effect<void, never, StorageService>;
38
+ delete(): Effect.Effect<void, never, StorageService>;
39
+ }
40
+ /**
41
+ * Create a typed key in a storage service.
42
+ */
43
+ export declare const key: <S extends Schema.Schema<any, string, any>>(schema: S, key: string) => Key<Schema.Schema.Type<S>>;
44
+ /**
45
+ * Typed key in a storage service with a default value.
46
+ */
47
+ export interface KeyWithDefault<T, U> extends Pipeable.Pipeable {
48
+ readonly key: string;
49
+ get: Effect.Effect<T | U, never, StorageService>;
50
+ set(value: U): Effect.Effect<void, never, StorageService>;
51
+ delete(): Effect.Effect<void, never, StorageService>;
52
+ }
53
+ /**
54
+ * Assign a default value to a key if it is not present.
55
+ */
56
+ export declare const withDefault: <T>(getDefault: () => NoInfer<T>) => (key: Key<T>) => KeyWithDefault<T, T>;
57
+ export {};
58
+ //# sourceMappingURL=StorageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageService.d.ts","sourceRoot":"","sources":["../../../../src/process/StorageService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,OAAO;IACtB,iEAAiE;IACjE,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAC3C,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,MAA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AAE,CAAC,CAUjC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as HttpClient from '@effect/platform/HttpClient';
2
+ import * as Layer from 'effect/Layer';
3
+ import { type EdgeFunctionEnv } from '@dxos/protocols';
4
+ /**
5
+ * Copy pasted from https://github.com/Effect-TS/effect/blob/main/packages/platform/src/internal/fetchHttpClient.ts
6
+ */
7
+ export declare const requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
8
+ export declare class FunctionsAiHttpClient {
9
+ static make: (service: EdgeFunctionEnv.FunctionsAiService) => HttpClient.HttpClient;
10
+ static layer: (service: EdgeFunctionEnv.FunctionsAiService) => Layer.Layer<HttpClient.HttpClient, never, never>;
11
+ }
12
+ //# sourceMappingURL=functions-ai-http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions-ai-http-client.d.ts","sourceRoot":"","sources":["../../../../src/protocol/functions-ai-http-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAK1D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,iBAAiB,CAAC;AACnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,kDAAkD,CAAC;AAEjF,qBAAa,qBAAqB;IAChC,MAAM,CAAC,IAAI,YAAa,eAAe,CAAC,kBAAkB,2BAyCrD;IAEL,MAAM,CAAC,KAAK,YAAa,eAAe,CAAC,kBAAkB,sDACiB;CAC7E"}
@@ -0,0 +1,2 @@
1
+ export * from './protocol';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/protocol/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Operation } from '@dxos/operation';
2
+ import { type FunctionProtocol } from '@dxos/protocols';
3
+ /**
4
+ * Wraps a function handler made with `defineFunction` to a protocol that the functions-runtime expects.
5
+ */
6
+ export declare const wrapFunctionHandler: (func: Operation.WithHandler<Operation.Definition.Any>) => FunctionProtocol.Func;
7
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAQxD;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,KAAG,gBAAgB,CAAC,IAkF5G,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=protocol.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.test.d.ts","sourceRoot":"","sources":["../../../../src/protocol/protocol.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { type AiService } from '@dxos/ai';
2
+ import { type Database, type Feed } from '@dxos/echo';
3
+ import { type Trace } from '@dxos/functions';
4
+ import type { Operation } from '@dxos/operation';
5
+ import { type CredentialsService, type FunctionInvocationService, type QueueService } from './services';
6
+ /**
7
+ * Services that are available to invoked functions.
8
+ * @deprecated
9
+ */
10
+ export type FunctionServices = AiService.AiService | CredentialsService | Database.Service | QueueService | Feed.FeedService | Trace.TraceService | FunctionInvocationService | Operation.Service;
11
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAOxG;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,SAAS,CAAC,SAAS,GACnB,kBAAkB,GAClB,QAAQ,CAAC,OAAO,GAEhB,YAAY,GACZ,IAAI,CAAC,WAAW,GAChB,KAAK,CAAC,YAAY,GAClB,yBAAyB,GACzB,SAAS,CAAC,OAAO,CAAC"}
@@ -1,12 +1,18 @@
1
- import { Context } from 'effect';
2
- type CredentialQuery = {
1
+ import * as HttpClient from '@effect/platform/HttpClient';
2
+ import type * as Config from 'effect/Config';
3
+ import * as Context from 'effect/Context';
4
+ import * as Effect from 'effect/Effect';
5
+ import * as Layer from 'effect/Layer';
6
+ import * as Redacted from 'effect/Redacted';
7
+ import { Database } from '@dxos/echo';
8
+ export type CredentialQuery = {
3
9
  service?: string;
4
10
  };
5
11
  export type ServiceCredential = {
6
12
  service: string;
7
13
  apiKey?: string;
8
14
  };
9
- declare const CredentialsService_base: Context.TagClass<CredentialsService, "CredentialsService", {
15
+ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
10
16
  /**
11
17
  * Query all.
12
18
  */
@@ -18,6 +24,16 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "Cre
18
24
  getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
19
25
  }>;
20
26
  export declare class CredentialsService extends CredentialsService_base {
27
+ static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
28
+ static getApiKey: (query: CredentialQuery) => Effect.Effect<Redacted.Redacted<string>, never, CredentialsService>;
29
+ static configuredLayer: (credentials: ServiceCredential[]) => Layer.Layer<CredentialsService, never, never>;
30
+ static layerConfig: (credentials: {
31
+ service: string;
32
+ apiKey: Config.Config<Redacted.Redacted<string>>;
33
+ }[]) => Layer.Layer<CredentialsService, import("effect/ConfigError").ConfigError, never>;
34
+ static layerFromDatabase: ({ caching }?: {
35
+ caching?: boolean;
36
+ }) => Layer.Layer<CredentialsService, never, Database.Service>;
21
37
  }
22
38
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
23
39
  private readonly credentials;
@@ -26,5 +42,9 @@ export declare class ConfiguredCredentialsService implements Context.Tag.Service
26
42
  queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]>;
27
43
  getCredential(query: CredentialQuery): Promise<ServiceCredential>;
28
44
  }
45
+ /**
46
+ * Maps the request to include the given token in the Authorization header.
47
+ */
48
+ export declare const withAuthorization: (token: string, kind?: 'Bearer' | 'Basic') => <E, R>(self: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>;
29
49
  export {};
30
50
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAGhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;;IAKE;;OAEG;sBACe,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAE1E;;;OAGG;mBACY,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,iBAAiB,CAAC;;AAZzE,qBAAa,kBAAmB,SAAQ,uBAcrC;CAAG;AAEN,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;g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QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAO3G;IAEL,MAAM,CAAC,eAAe,gBAAiB,iBAAiB,EAAE,mDACyB;IAEnF,MAAM,CAAC,WAAW,gBACH;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;KAClD,EAAE,sFAgBD;IAEJ,MAAM,CAAC,iBAAiB,iBAAyB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,8DA0ClE;CACL;AAED,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAxC,YAA6B,WAAW,GAAE,iBAAiB,EAAO,EAAI;IAEtE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B,CAG7E;IAEK,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAE3E;IAEK,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAOtE;CACF;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,SAAS,QAAQ,GAAG,OAAO,uFAItE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import * as Context from 'effect/Context';
2
+ import * as Effect from 'effect/Effect';
3
+ import * as Layer from 'effect/Layer';
4
+ import { Operation } from '@dxos/operation';
5
+ import type { FunctionNotFoundError } from '../errors';
6
+ declare const FunctionInvocationService_base: Context.TagClass<FunctionInvocationService, "@dxos/functions/FunctionInvocationService", {
7
+ invokeFunction<I, O>(functionDef: Operation.Definition<I, O, any>, input: I): Effect.Effect<O>;
8
+ resolveFunction(key: string): Effect.Effect<Operation.Definition.Any, FunctionNotFoundError>;
9
+ }>;
10
+ export declare class FunctionInvocationService extends FunctionInvocationService_base {
11
+ static layerNotAvailable: Layer.Layer<FunctionInvocationService, never, never>;
12
+ static invokeFunction: <I, O>(functionDef: Operation.Definition<I, O, any>, input: I) => Effect.Effect<O, never, FunctionInvocationService>;
13
+ static resolveFunction: (key: string) => Effect.Effect<Operation.Definition.Any, FunctionNotFoundError, FunctionInvocationService>;
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=function-invocation-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-invocation-service.d.ts","sourceRoot":"","sources":["../../../../src/services/function-invocation-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;;mBAKpC,CAAC,EAAE,CAAC,eAAe,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;yBAEzE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,qBAAqB,CAAC;;AALhG,qBAAa,yBAA0B,SAAQ,8BAO5C;IACD,MAAM,CAAC,iBAAiB,uDAGrB;IAEH,MAAM,CAAC,cAAc,GAAI,CAAC,EAAE,CAAC,eACd,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SACrC,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,CAAC,CAC8D;IAEnH,MAAM,CAAC,eAAe,QACf,MAAM,KACV,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,qBAAqB,EAAE,yBAAyB,CAAC,CACS;CACtG"}
@@ -1,10 +1,6 @@
1
- export * from './ai';
2
- export * from './database';
3
- export * from './queues';
4
- export * from './service-container';
5
1
  export * from './credentials';
6
- export * from './tracing';
7
- export * from './event-logger';
8
- export * from './function-call-service';
9
- export * from './tool-resolver';
2
+ export { ConfiguredCredentialsService, type ServiceCredential } from './credentials';
3
+ export * from './function-invocation-service';
4
+ export * from './queues';
5
+ export { MESSAGE_PROPERTY_TOOL_CALL_ID } from './tracing';
10
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACrF,cAAc,+BAA+B,CAAC;AAC9C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC"}
@@ -1,18 +1,2 @@
1
- import { Context, Layer } from 'effect';
2
- import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
3
- declare const QueueService_base: Context.TagClass<QueueService, "QueueService", {
4
- /**
5
- * API to access the queues.
6
- */
7
- readonly queues: QueueAPI;
8
- /**
9
- * The queue that is used to store the context of the current research.
10
- */
11
- readonly contextQueue: Queue | undefined;
12
- }>;
13
- export declare class QueueService extends QueueService_base {
14
- static notAvailable: Layer.Layer<QueueService, never, never>;
15
- static make: (queues: QueueFactory, contextQueue: Queue | undefined) => Context.Tag.Service<QueueService>;
16
- }
17
- export {};
1
+ export { ContextQueueService, QueueService, feedServiceFromQueueServiceLayer } from '@dxos/echo-db';
18
2
  //# sourceMappingURL=queues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;IAK/D;;OAEG;qBACc,QAAQ;IAEzB;;OAEG;2BAEoB,KAAK,GAAG,SAAS;;AAZ5C,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAUhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,cAAc,KAAK,GAAG,SAAS,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAKtG;CACH"}
1
+ {"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../../../../src/services/queues.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC"}
@@ -1,15 +1,5 @@
1
- import { Context } from 'effect';
2
- import type { AnyEchoObject } from '@dxos/echo-schema';
3
- declare const TracingService_base: Context.TagClass<TracingService, "TracingService", {
4
- /**
5
- * Write an event to the tracing queue.
6
- * @param event - The event to write. Must be an a typed object.
7
- */
8
- write(event: AnyEchoObject): void;
9
- }>;
10
- export declare class TracingService extends TracingService_base {
11
- static noop: Context.Tag.Service<TracingService>;
12
- static console: Context.Tag.Service<TracingService>;
13
- }
14
- export {};
1
+ /**
2
+ * Goes into {@link Message['properties']}
3
+ */
4
+ export declare const MESSAGE_PROPERTY_TOOL_CALL_ID: 'toolCallId';
15
5
  //# sourceMappingURL=tracing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/services/tracing.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;IAKnD;;;OAGG;iBACU,aAAa,GAAG,IAAI;;AAPrC,qBAAa,cAAe,SAAQ,mBASjC;IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAuB;IAEvE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAKjD;CACH"}
1
+ {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../../src/services/tracing.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAG,YAAqB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Type } from '@dxos/echo';
3
+ /**
4
+ * Source script.
5
+ */
6
+ export declare const Script: Type.Obj<{
7
+ readonly name?: string | undefined;
8
+ readonly description?: string | undefined;
9
+ readonly changed?: boolean | undefined;
10
+ readonly source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
11
+ readonly name?: string | undefined;
12
+ readonly content: string;
13
+ }>;
14
+ }, Schema.Struct.Fields>;
15
+ export interface Script extends Schema.Schema.Type<typeof Script> {
16
+ }
17
+ type Props = Omit<Obj.MakeProps<typeof Script>, 'source'> & {
18
+ source?: string;
19
+ };
20
+ export declare const make: ({ source, ...props }?: Props) => Script;
21
+ export {};
22
+ //# sourceMappingURL=Script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Script.d.ts","sourceRoot":"","sources":["../../../../src/types/Script.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAc,GAAG,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;wBAiBlB,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC;CAAG;AAEpE,KAAK,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,eAAO,MAAM,IAAI,0BAA+B,KAAK,KAAQ,MACqB,CAAC"}
@@ -0,0 +1,150 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Feed, Obj, QueryAST, Type, type Query } from '@dxos/echo';
3
+ /**
4
+ * Type discriminator for TriggerType.
5
+ * Every spec has a type field of type TriggerKind that we can use to understand which type we're working with.
6
+ * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
7
+ */
8
+ export declare const Kinds: readonly ['email', 'queue', 'subscription', 'timer', 'webhook'];
9
+ export type Kind = (typeof Kinds)[number];
10
+ export declare const EmailSpec: Schema.Struct<{
11
+ kind: Schema.Literal<["email"]>;
12
+ }>;
13
+ export type EmailSpec = Schema.Schema.Type<typeof EmailSpec>;
14
+ /**
15
+ * Construct an Email trigger spec.
16
+ */
17
+ export declare const specEmail: () => EmailSpec;
18
+ export declare const QueueSpec: Schema.Struct<{
19
+ kind: Schema.Literal<["queue"]>;
20
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
21
+ }>;
22
+ export type QueueSpec = Schema.Schema.Type<typeof QueueSpec>;
23
+ /**
24
+ * Construct a Queue trigger spec from a queue DXN string.
25
+ */
26
+ export declare const specQueue: (queueDxn: string) => QueueSpec;
27
+ /**
28
+ * Construct a Queue trigger spec from a Feed object.
29
+ */
30
+ export declare const specFeed: (feed: Feed.Feed) => QueueSpec;
31
+ /**
32
+ * Subscription.
33
+ */
34
+ export declare const SubscriptionSpec: Schema.Struct<{
35
+ kind: Schema.Literal<["subscription"]>;
36
+ query: Schema.Struct<{
37
+ raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
38
+ ast: Schema.Schema<QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, never>;
39
+ }>;
40
+ options: Schema.optional<Schema.Struct<{
41
+ deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
42
+ delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
43
+ }>>;
44
+ }>;
45
+ export type SubscriptionSpec = Schema.Schema.Type<typeof SubscriptionSpec>;
46
+ /**
47
+ * Construct a Subscription trigger spec from a Query object.
48
+ */
49
+ export declare const specSubscription: (query: Query.Query<any>, options?: {
50
+ deep?: boolean;
51
+ delay?: number;
52
+ }) => SubscriptionSpec;
53
+ /**
54
+ * Cron timer.
55
+ */
56
+ export declare const TimerSpec: Schema.Struct<{
57
+ kind: Schema.Literal<["timer"]>;
58
+ cron: Schema.SchemaClass<string, string, never>;
59
+ }>;
60
+ export type TimerSpec = Schema.Schema.Type<typeof TimerSpec>;
61
+ /**
62
+ * Construct a Timer trigger spec from a cron string.
63
+ */
64
+ export declare const specTimer: (cron: string) => TimerSpec;
65
+ /**
66
+ * Webhook.
67
+ */
68
+ export declare const WebhookSpec: Schema.Struct<{
69
+ kind: Schema.Literal<["webhook"]>;
70
+ method: Schema.optional<Schema.SchemaClass<string, string, never>>;
71
+ port: Schema.optional<Schema.SchemaClass<number, number, never>>;
72
+ }>;
73
+ export type WebhookSpec = Schema.Schema.Type<typeof WebhookSpec>;
74
+ /**
75
+ * Construct a Webhook trigger spec from a method and port.
76
+ */
77
+ export declare const specWebhook: (opts?: {
78
+ method?: string;
79
+ port?: number;
80
+ }) => WebhookSpec;
81
+ /**
82
+ * Trigger schema.
83
+ */
84
+ export declare const Spec: Schema.Union<[Schema.Struct<{
85
+ kind: Schema.Literal<["email"]>;
86
+ }>, Schema.Struct<{
87
+ kind: Schema.Literal<["queue"]>;
88
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
89
+ }>, Schema.Struct<{
90
+ kind: Schema.Literal<["subscription"]>;
91
+ query: Schema.Struct<{
92
+ raw: Schema.optional<Schema.SchemaClass<string, string, never>>;
93
+ ast: Schema.Schema<QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause, never>;
94
+ }>;
95
+ options: Schema.optional<Schema.Struct<{
96
+ deep: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
97
+ delay: Schema.optional<Schema.SchemaClass<number, number, never>>;
98
+ }>>;
99
+ }>, Schema.Struct<{
100
+ kind: Schema.Literal<["timer"]>;
101
+ cron: Schema.SchemaClass<string, string, never>;
102
+ }>, Schema.Struct<{
103
+ kind: Schema.Literal<["webhook"]>;
104
+ method: Schema.optional<Schema.SchemaClass<string, string, never>>;
105
+ port: Schema.optional<Schema.SchemaClass<number, number, never>>;
106
+ }>]>;
107
+ export type Spec = Schema.Schema.Type<typeof Spec>;
108
+ /**
109
+ * Function trigger.
110
+ * Function is invoked with the `payload` passed as input data.
111
+ * The event that triggers the function is available in the function context.
112
+ */
113
+ declare const TriggerSchema: Type.Obj<{
114
+ readonly function?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown> | undefined;
115
+ readonly inputNodeId?: string | undefined;
116
+ readonly enabled?: boolean | undefined;
117
+ readonly spec?: {
118
+ readonly kind: "email";
119
+ } | {
120
+ readonly kind: "queue";
121
+ readonly queue: string;
122
+ } | {
123
+ readonly kind: "subscription";
124
+ readonly query: {
125
+ readonly raw?: string | undefined;
126
+ readonly ast: QueryAST.QueryFilterClause | QueryAST.QueryFromClause | QueryAST.QueryHierarchyTraversalClause | QueryAST.QueryIncomingReferencesClause | QueryAST.QueryLimitClause | QueryAST.QueryOptionsClause | QueryAST.QueryOrderClause | QueryAST.QueryReferenceTraversalClause | QueryAST.QueryRelationClause | QueryAST.QueryRelationTraversalClause | QueryAST.QuerySelectClause | QueryAST.QuerySetDifferenceClause | QueryAST.QueryUnionClause;
127
+ };
128
+ readonly options?: {
129
+ readonly deep?: boolean | undefined;
130
+ readonly delay?: number | undefined;
131
+ } | undefined;
132
+ } | {
133
+ readonly kind: "timer";
134
+ readonly cron: string;
135
+ } | {
136
+ readonly kind: "webhook";
137
+ readonly method?: string | undefined;
138
+ readonly port?: number | undefined;
139
+ } | undefined;
140
+ readonly concurrency?: number | undefined;
141
+ readonly input?: {
142
+ readonly [x: string]: any;
143
+ } | undefined;
144
+ }, Schema.Struct.Fields>;
145
+ export interface Trigger extends Schema.Schema.Type<typeof TriggerSchema> {
146
+ }
147
+ export declare const Trigger: Type.Obj<Trigger>;
148
+ export declare const make: (props: Obj.MakeProps<typeof Trigger>) => Obj.OfShape<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Trigger>;
149
+ export {};
150
+ //# sourceMappingURL=Trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../../src/types/Trigger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAc,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAO,IAAI,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAKpF;;;;GAIG;AACH,eAAO,MAAM,KAAK,YAAI,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AACrF,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAI1C,eAAO,MAAM,SAAS;;EAEpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,SAAS,QAAO,SAAgC,CAAC;AAI9D,eAAO,MAAM,SAAS;;;EAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,SAAS,aAAc,MAAM,KAAG,SAG3C,CAAC;A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C,OAAO,aAAa,CAAC;CAAG;AAC5E,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAwB,CAAC;AAE/D,eAAO,MAAM,IAAI,UAAW,GAAG,CAAC,SAAS,CAAC,OAAO,OAAO,CAAC,+GAA6B,CAAC"}
@@ -0,0 +1,75 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj, Ref } from '@dxos/echo';
3
+ export declare const EmailEvent: Schema.Struct<{
4
+ from: typeof Schema.String;
5
+ to: typeof Schema.String;
6
+ subject: typeof Schema.String;
7
+ created: typeof Schema.String;
8
+ body: typeof Schema.String;
9
+ }>;
10
+ export type EmailEvent = Schema.Schema.Type<typeof EmailEvent>;
11
+ export declare const QueueEvent: Schema.Struct<{
12
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
13
+ item: typeof Schema.Any;
14
+ cursor: typeof Schema.String;
15
+ }>;
16
+ export type QueueEvent = Schema.Schema.Type<typeof QueueEvent>;
17
+ export declare const SubscriptionEvent: Schema.Struct<{
18
+ /**
19
+ * Type of the mutation.
20
+ */
21
+ type: typeof Schema.String;
22
+ /**
23
+ * Reference to the object that was changed or created.
24
+ */
25
+ subject: Ref.RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
26
+ /**
27
+ * @deprecated
28
+ */
29
+ changedObjectId: Schema.optional<typeof Schema.String>;
30
+ }>;
31
+ export type SubscriptionEvent = Schema.Schema.Type<typeof SubscriptionEvent>;
32
+ export declare const TimerEvent: Schema.Struct<{
33
+ tick: typeof Schema.Number;
34
+ }>;
35
+ export type TimerEvent = Schema.Schema.Type<typeof TimerEvent>;
36
+ export declare const WebhookEvent: Schema.Struct<{
37
+ url: typeof Schema.String;
38
+ method: Schema.Literal<["GET", "POST"]>;
39
+ headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
40
+ bodyText: typeof Schema.String;
41
+ }>;
42
+ export type WebhookEvent = Schema.Schema.Type<typeof WebhookEvent>;
43
+ export declare const TriggerEvent: Schema.Union<[Schema.Struct<{
44
+ from: typeof Schema.String;
45
+ to: typeof Schema.String;
46
+ subject: typeof Schema.String;
47
+ created: typeof Schema.String;
48
+ body: typeof Schema.String;
49
+ }>, Schema.Struct<{
50
+ queue: Schema.refine<string, typeof Schema.NonEmptyString>;
51
+ item: typeof Schema.Any;
52
+ cursor: typeof Schema.String;
53
+ }>, Schema.Struct<{
54
+ /**
55
+ * Type of the mutation.
56
+ */
57
+ type: typeof Schema.String;
58
+ /**
59
+ * Reference to the object that was changed or created.
60
+ */
61
+ subject: Ref.RefSchema<import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object> & Obj.Unknown>;
62
+ /**
63
+ * @deprecated
64
+ */
65
+ changedObjectId: Schema.optional<typeof Schema.String>;
66
+ }>, Schema.Struct<{
67
+ tick: typeof Schema.Number;
68
+ }>, Schema.Struct<{
69
+ url: typeof Schema.String;
70
+ method: Schema.Literal<["GET", "POST"]>;
71
+ headers: Schema.Record$<typeof Schema.String, typeof Schema.String>;
72
+ bodyText: typeof Schema.String;
73
+ }>]>;
74
+ export type TriggerEvent = Schema.Schema.Type<typeof TriggerEvent>;
75
+ //# sourceMappingURL=TriggerEvent.d.ts.map
@@ -0,0 +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,EAAO,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAQ3C,eAAO,MAAM,UAAU;;;;;;EAMrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,UAAU;;;;EAIrB,CAAC;AACH,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;;EAEH,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7E,eAAO,MAAM,UAAU;;EAAyC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,eAAO,MAAM,YAAY;;;;;EAKvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAEnE,eAAO,MAAM,YAAY;;;;;;;;;;;IA7BvB;;OAEG;;IAIH;;OAEG;;IAGH;;OAEG;;;;;;;;;IAgBwG,CAAC;AAC9G,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * as Script from './Script';
2
+ export * as Trigger from './Trigger';
3
+ export * as TriggerEvent from './TriggerEvent';
4
+ export * from './url';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,cAAc,OAAO,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type Obj } from '@dxos/echo';
2
+ export declare const FUNCTIONS_META_KEY = "org.dxos.service.function";
3
+ export declare const FUNCTIONS_PRESET_META_KEY = "org.dxos.service.function-preset";
4
+ /**
5
+ * NOTE: functionId is backend ID, not ECHO object id.
6
+ */
7
+ export declare const getUserFunctionIdInMetadata: (meta: Obj.ReadonlyMeta) => string | undefined;
8
+ /**
9
+ * NOTE: functionId is backend ID, not ECHO object id.
10
+ * Must be called inside Obj.update() since it mutates the meta.
11
+ */
12
+ export declare const setUserFunctionIdInMetadata: (meta: Obj.Meta, functionId: string) => void;
13
+ //# 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,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,2BAA2B,SAAU,GAAG,CAAC,YAAY,uBAEjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,SAAU,GAAG,CAAC,IAAI,cAAc,MAAM,SAS7E,CAAC"}