@dxos/functions 0.8.4-main.ead640a → 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 (204) hide show
  1. package/dist/lib/neutral/index.mjs +1229 -0
  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 +44 -60
  5. package/dist/types/src/errors.d.ts.map +1 -1
  6. package/dist/types/src/{examples → example}/fib.d.ts +1 -1
  7. package/dist/types/src/example/fib.d.ts.map +1 -0
  8. package/dist/types/src/example/forex-effect.d.ts +3 -0
  9. package/dist/types/src/example/forex-effect.d.ts.map +1 -0
  10. package/dist/types/src/example/index.d.ts +12 -0
  11. package/dist/types/src/example/index.d.ts.map +1 -0
  12. package/dist/types/src/{examples → example}/reply.d.ts +1 -1
  13. package/dist/types/src/example/reply.d.ts.map +1 -0
  14. package/dist/types/src/{examples → example}/sleep.d.ts +1 -1
  15. package/dist/types/src/example/sleep.d.ts.map +1 -0
  16. package/dist/types/src/index.d.ts +4 -8
  17. package/dist/types/src/index.d.ts.map +1 -1
  18. package/dist/types/src/operation-compatibility.test.d.ts +2 -0
  19. package/dist/types/src/operation-compatibility.test.d.ts.map +1 -0
  20. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  21. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  22. package/dist/types/src/protocol/index.d.ts +2 -0
  23. package/dist/types/src/protocol/index.d.ts.map +1 -0
  24. package/dist/types/src/protocol/protocol.d.ts +7 -0
  25. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  26. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  27. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  28. package/dist/types/src/sdk.d.ts +114 -0
  29. package/dist/types/src/sdk.d.ts.map +1 -0
  30. package/dist/types/src/services/credentials.d.ts +6 -4
  31. package/dist/types/src/services/credentials.d.ts.map +1 -1
  32. package/dist/types/src/services/event-logger.d.ts +33 -27
  33. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  34. package/dist/types/src/services/function-invocation-service.d.ts +7 -19
  35. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  36. package/dist/types/src/services/index.d.ts +2 -4
  37. package/dist/types/src/services/index.d.ts.map +1 -1
  38. package/dist/types/src/services/queues.d.ts +4 -4
  39. package/dist/types/src/services/queues.d.ts.map +1 -1
  40. package/dist/types/src/services/tracing.d.ts +41 -12
  41. package/dist/types/src/services/tracing.d.ts.map +1 -1
  42. package/dist/types/src/types/Function.d.ts +52 -0
  43. package/dist/types/src/types/Function.d.ts.map +1 -0
  44. package/dist/types/src/types/Script.d.ts +21 -0
  45. package/dist/types/src/types/Script.d.ts.map +1 -0
  46. package/dist/types/src/types/Trigger.d.ts +121 -0
  47. package/dist/types/src/types/Trigger.d.ts.map +1 -0
  48. package/dist/types/src/types/TriggerEvent.d.ts +74 -0
  49. package/dist/types/src/types/TriggerEvent.d.ts.map +1 -0
  50. package/dist/types/src/types/index.d.ts +6 -0
  51. package/dist/types/src/types/index.d.ts.map +1 -0
  52. package/dist/types/src/types/url.d.ts +13 -0
  53. package/dist/types/src/types/url.d.ts.map +1 -0
  54. package/dist/types/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +24 -63
  56. package/src/errors.ts +4 -4
  57. package/src/{examples → example}/fib.ts +1 -1
  58. package/src/example/forex-effect.ts +40 -0
  59. package/src/example/index.ts +13 -0
  60. package/src/{examples → example}/reply.ts +1 -1
  61. package/src/{examples → example}/sleep.ts +1 -1
  62. package/src/index.ts +4 -8
  63. package/src/operation-compatibility.test.ts +185 -0
  64. package/src/protocol/functions-ai-http-client.ts +67 -0
  65. package/src/{executor → protocol}/index.ts +1 -1
  66. package/src/protocol/protocol.test.ts +59 -0
  67. package/src/protocol/protocol.ts +262 -0
  68. package/src/sdk.ts +289 -0
  69. package/src/services/credentials.ts +32 -17
  70. package/src/services/event-logger.ts +10 -4
  71. package/src/services/function-invocation-service.ts +23 -70
  72. package/src/services/index.ts +2 -4
  73. package/src/services/queues.ts +5 -7
  74. package/src/services/tracing.ts +68 -44
  75. package/src/types/Function.ts +82 -0
  76. package/src/types/Script.ts +34 -0
  77. package/src/types/Trigger.ts +143 -0
  78. package/src/types/TriggerEvent.ts +62 -0
  79. package/src/types/index.ts +9 -0
  80. package/src/types/url.ts +32 -0
  81. package/dist/lib/browser/bundler/index.mjs +0 -269
  82. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
  84. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
  85. package/dist/lib/browser/chunk-LKYT2SAL.mjs +0 -665
  86. package/dist/lib/browser/chunk-LKYT2SAL.mjs.map +0 -7
  87. package/dist/lib/browser/edge/index.mjs +0 -83
  88. package/dist/lib/browser/edge/index.mjs.map +0 -7
  89. package/dist/lib/browser/index.mjs +0 -1395
  90. package/dist/lib/browser/index.mjs.map +0 -7
  91. package/dist/lib/browser/meta.json +0 -1
  92. package/dist/lib/browser/testing/index.mjs +0 -131
  93. package/dist/lib/browser/testing/index.mjs.map +0 -7
  94. package/dist/lib/node-esm/bundler/index.mjs +0 -270
  95. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  96. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  97. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  98. package/dist/lib/node-esm/chunk-NAQIKLZB.mjs +0 -667
  99. package/dist/lib/node-esm/chunk-NAQIKLZB.mjs.map +0 -7
  100. package/dist/lib/node-esm/edge/index.mjs +0 -84
  101. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  102. package/dist/lib/node-esm/index.mjs +0 -1396
  103. package/dist/lib/node-esm/index.mjs.map +0 -7
  104. package/dist/lib/node-esm/meta.json +0 -1
  105. package/dist/lib/node-esm/testing/index.mjs +0 -132
  106. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  107. package/dist/types/src/bundler/bundler.d.ts +0 -49
  108. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  109. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  110. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  111. package/dist/types/src/bundler/index.d.ts +0 -2
  112. package/dist/types/src/bundler/index.d.ts.map +0 -1
  113. package/dist/types/src/edge/functions.d.ts +0 -17
  114. package/dist/types/src/edge/functions.d.ts.map +0 -1
  115. package/dist/types/src/edge/index.d.ts +0 -2
  116. package/dist/types/src/edge/index.d.ts.map +0 -1
  117. package/dist/types/src/examples/fib.d.ts.map +0 -1
  118. package/dist/types/src/examples/index.d.ts +0 -4
  119. package/dist/types/src/examples/index.d.ts.map +0 -1
  120. package/dist/types/src/examples/reply.d.ts.map +0 -1
  121. package/dist/types/src/examples/sleep.d.ts.map +0 -1
  122. package/dist/types/src/executor/executor.d.ts +0 -14
  123. package/dist/types/src/executor/executor.d.ts.map +0 -1
  124. package/dist/types/src/executor/index.d.ts +0 -2
  125. package/dist/types/src/executor/index.d.ts.map +0 -1
  126. package/dist/types/src/handler.d.ts +0 -109
  127. package/dist/types/src/handler.d.ts.map +0 -1
  128. package/dist/types/src/schema.d.ts +0 -43
  129. package/dist/types/src/schema.d.ts.map +0 -1
  130. package/dist/types/src/services/database.d.ts +0 -67
  131. package/dist/types/src/services/database.d.ts.map +0 -1
  132. package/dist/types/src/services/function-invocation-service.test.d.ts +0 -2
  133. package/dist/types/src/services/function-invocation-service.test.d.ts.map +0 -1
  134. package/dist/types/src/services/local-function-execution.d.ts +0 -34
  135. package/dist/types/src/services/local-function-execution.d.ts.map +0 -1
  136. package/dist/types/src/services/remote-function-execution-service.d.ts +0 -22
  137. package/dist/types/src/services/remote-function-execution-service.d.ts.map +0 -1
  138. package/dist/types/src/services/service-container.d.ts +0 -57
  139. package/dist/types/src/services/service-container.d.ts.map +0 -1
  140. package/dist/types/src/services/service-registry.d.ts +0 -31
  141. package/dist/types/src/services/service-registry.d.ts.map +0 -1
  142. package/dist/types/src/services/service-registry.test.d.ts +0 -2
  143. package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
  144. package/dist/types/src/testing/index.d.ts +0 -3
  145. package/dist/types/src/testing/index.d.ts.map +0 -1
  146. package/dist/types/src/testing/layer.d.ts +0 -18
  147. package/dist/types/src/testing/layer.d.ts.map +0 -1
  148. package/dist/types/src/testing/logger.d.ts +0 -5
  149. package/dist/types/src/testing/logger.d.ts.map +0 -1
  150. package/dist/types/src/testing/persist-database.test.d.ts +0 -2
  151. package/dist/types/src/testing/persist-database.test.d.ts.map +0 -1
  152. package/dist/types/src/testing/services.d.ts +0 -59
  153. package/dist/types/src/testing/services.d.ts.map +0 -1
  154. package/dist/types/src/trace.d.ts +0 -122
  155. package/dist/types/src/trace.d.ts.map +0 -1
  156. package/dist/types/src/translations.d.ts +0 -12
  157. package/dist/types/src/translations.d.ts.map +0 -1
  158. package/dist/types/src/triggers/index.d.ts +0 -4
  159. package/dist/types/src/triggers/index.d.ts.map +0 -1
  160. package/dist/types/src/triggers/input-builder.d.ts +0 -3
  161. package/dist/types/src/triggers/input-builder.d.ts.map +0 -1
  162. package/dist/types/src/triggers/invocation-tracer.d.ts +0 -37
  163. package/dist/types/src/triggers/invocation-tracer.d.ts.map +0 -1
  164. package/dist/types/src/triggers/trigger-dispatcher.d.ts +0 -78
  165. package/dist/types/src/triggers/trigger-dispatcher.d.ts.map +0 -1
  166. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts +0 -2
  167. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts.map +0 -1
  168. package/dist/types/src/triggers/trigger-state-store.d.ts +0 -28
  169. package/dist/types/src/triggers/trigger-state-store.d.ts.map +0 -1
  170. package/dist/types/src/types.d.ts +0 -230
  171. package/dist/types/src/types.d.ts.map +0 -1
  172. package/dist/types/src/url.d.ts +0 -21
  173. package/dist/types/src/url.d.ts.map +0 -1
  174. package/src/bundler/bundler.test.ts +0 -58
  175. package/src/bundler/bundler.ts +0 -295
  176. package/src/bundler/index.ts +0 -5
  177. package/src/edge/functions.ts +0 -67
  178. package/src/edge/index.ts +0 -9
  179. package/src/examples/index.ts +0 -7
  180. package/src/executor/executor.ts +0 -58
  181. package/src/handler.ts +0 -225
  182. package/src/schema.ts +0 -71
  183. package/src/services/database.ts +0 -175
  184. package/src/services/function-invocation-service.test.ts +0 -81
  185. package/src/services/local-function-execution.ts +0 -153
  186. package/src/services/remote-function-execution-service.ts +0 -63
  187. package/src/services/service-container.ts +0 -115
  188. package/src/services/service-registry.test.ts +0 -45
  189. package/src/services/service-registry.ts +0 -63
  190. package/src/testing/index.ts +0 -6
  191. package/src/testing/layer.ts +0 -114
  192. package/src/testing/logger.ts +0 -17
  193. package/src/testing/persist-database.test.ts +0 -87
  194. package/src/testing/services.ts +0 -115
  195. package/src/trace.ts +0 -178
  196. package/src/translations.ts +0 -20
  197. package/src/triggers/index.ts +0 -7
  198. package/src/triggers/input-builder.ts +0 -35
  199. package/src/triggers/invocation-tracer.ts +0 -101
  200. package/src/triggers/trigger-dispatcher.test.ts +0 -665
  201. package/src/triggers/trigger-dispatcher.ts +0 -533
  202. package/src/triggers/trigger-state-store.ts +0 -61
  203. package/src/types.ts +0 -218
  204. package/src/url.ts +0 -55
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundler.test.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export * from './bundler';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC"}
@@ -1,17 +0,0 @@
1
- import { type DID } from 'iso-did/types';
2
- import { type Client } from '@dxos/client';
3
- import { type PublicKey } from '@dxos/keys';
4
- import { type UploadFunctionResponseBody } from '@dxos/protocols';
5
- export type UploadWorkerArgs = {
6
- client: Client;
7
- version: string;
8
- name?: string;
9
- functionId?: string;
10
- ownerPublicKey: PublicKey;
11
- entryPoint: string;
12
- assets: Record<string, Uint8Array>;
13
- };
14
- export declare const uploadWorkerFunction: ({ client, version, name, functionId, ownerPublicKey, entryPoint, assets, }: UploadWorkerArgs) => Promise<UploadFunctionResponseBody>;
15
- export declare const incrementSemverPatch: (version: string) => string;
16
- export declare const publicKeyToDid: (key: PublicKey) => DID;
17
- //# sourceMappingURL=functions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/edge/functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,SAAS,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,4EAQxC,gBAAgB,KAAG,OAAO,CAAC,0BAA0B,CAsBvD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,MAKtD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,KAAG,GAE/C,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './functions';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/edge/index.ts"],"names":[],"mappings":"AAQA,cAAc,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/examples/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
@@ -1,4 +0,0 @@
1
- export { default as fib } from './fib';
2
- export { default as reply } from './reply';
3
- export { default as sleep } from './sleep';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/examples/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/examples/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/examples/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
@@ -1,14 +0,0 @@
1
- import type { FunctionDefinition } from '../handler';
2
- import type { ServiceContainer } from '../services';
3
- /**
4
- * @deprecated Use `FunctionInvocationService`
5
- */
6
- export declare class FunctionExecutor {
7
- private readonly _services;
8
- constructor(_services: ServiceContainer);
9
- /**
10
- * Invoke function.
11
- */
12
- invoke<F extends FunctionDefinition<any, any>>(functionDef: F, input: F extends FunctionDefinition<infer I, infer _O> ? I : never): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never>;
13
- }
14
- //# sourceMappingURL=executor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,aAAa,CAAC;AAE9D;;GAEG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAExD;;OAEG;IAEG,MAAM,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,WAAW,EAAE,CAAC,EACd,KAAK,EAAE,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,GACjE,OAAO,CAAC,CAAC,SAAS,kBAAkB,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CA+BxE"}
@@ -1,2 +0,0 @@
1
- export * from './executor';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/executor/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC"}
@@ -1,109 +0,0 @@
1
- import type * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import * as Schema from 'effect/Schema';
4
- import type * as Types from 'effect/Types';
5
- import { type HasId } from '@dxos/echo/internal';
6
- import { type EchoDatabase } from '@dxos/echo-db';
7
- import { type DXN, type SpaceId } from '@dxos/keys';
8
- import { type QueryResult } from '@dxos/protocols';
9
- import { FunctionType } from './schema';
10
- import { type Services } from './services';
11
- /**
12
- * Function handler.
13
- */
14
- export type FunctionHandler<TData = {}, TOutput = any> = (params: {
15
- /**
16
- * Services and context available to the function.
17
- */
18
- context: FunctionContext;
19
- /**
20
- * Data passed as the input to the function.
21
- * Must match the function's input schema.
22
- * This will be the payload from the trigger or other data passed into the function in a workflow.
23
- */
24
- data: TData;
25
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;
26
- /**
27
- * Function context.
28
- */
29
- export interface FunctionContext {
30
- /**
31
- * Space from which the function was invoked.
32
- */
33
- space: SpaceAPI | undefined;
34
- /**
35
- * Resolves a service available to the function.
36
- * @throws if the service is not available.
37
- */
38
- getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
39
- getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
40
- }
41
- export interface FunctionContextAi {
42
- run(model: string, inputs: any, options?: any): Promise<any>;
43
- }
44
- export interface QueuesAPI {
45
- queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;
46
- insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;
47
- }
48
- /**
49
- * Space interface available to functions.
50
- */
51
- export interface SpaceAPI {
52
- get id(): SpaceId;
53
- get db(): EchoDatabase;
54
- get queues(): QueuesAPI;
55
- }
56
- declare const typeId: unique symbol;
57
- export type FunctionDefinition<T = any, O = any> = {
58
- [typeId]: true;
59
- key: string;
60
- name: string;
61
- description?: string;
62
- inputSchema: Schema.Schema<T, any>;
63
- outputSchema?: Schema.Schema<O, any>;
64
- handler: FunctionHandler<T, O>;
65
- meta?: {
66
- /**
67
- * Tools that are projected from functions have this annotation.
68
- *
69
- * deployedFunctionId:
70
- * - Backend deployment ID assigned by the EDGE function service (typically a UUID).
71
- * - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.
72
- * - Persisted on the corresponding ECHO `FunctionType` object's metadata under the
73
- * `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.
74
- */
75
- deployedFunctionId?: string;
76
- };
77
- };
78
- export declare const defineFunction: {
79
- <I, O>(params: {
80
- key: string;
81
- name: string;
82
- description?: string;
83
- inputSchema: Schema.Schema<I, any>;
84
- outputSchema?: Schema.Schema<O, any>;
85
- handler: Types.NoInfer<FunctionHandler<I, O>>;
86
- }): FunctionDefinition<I, O>;
87
- };
88
- export declare const FunctionDefinition: {
89
- make: <I, O>(params: {
90
- key: string;
91
- name: string;
92
- description?: string;
93
- inputSchema: Schema.Schema<I, any>;
94
- outputSchema?: Schema.Schema<O, any>;
95
- handler: Types.NoInfer<FunctionHandler<I, O>>;
96
- }) => FunctionDefinition<I, O>;
97
- isFunction: (value: unknown) => value is FunctionDefinition.Any;
98
- serialize: (functionDef: FunctionDefinition.Any) => FunctionType;
99
- deserialize: (functionObj: FunctionType) => FunctionDefinition.Any;
100
- };
101
- export declare namespace FunctionDefinition {
102
- type Any = FunctionDefinition<any, any>;
103
- type Input<T extends FunctionDefinition> = T extends FunctionDefinition<infer I, any> ? I : never;
104
- type Output<T extends FunctionDefinition> = T extends FunctionDefinition<any, infer O> ? O : never;
105
- }
106
- export declare const serializeFunction: (functionDef: FunctionDefinition<any, any>) => FunctionType;
107
- export declare const deserializeFunction: (functionObj: FunctionType) => FunctionDefinition<unknown, unknown>;
108
- export {};
109
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQ3C;;GAEG;AACH,MAAM,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EAAE,GAAG,CAAC,CAAC;QACnC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/C,KAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;wBAmDR,OAAO,KAAG,KAAK,IAAI,kBAAkB,CAAC,GAAG;6BAGpC,kBAAkB,CAAC,GAAG,KAAG,YAAY;+BAInC,YAAY,KAAG,kBAAkB,CAAC,GAAG;CAIjE,CAAC;AACF,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,KAAY,GAAG,GAAG,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/C,KAAY,KAAK,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzG,KAAY,MAAM,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAC3G;AAED,eAAO,MAAM,iBAAiB,GAAI,aAAa,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,KAAG,YAa7E,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAa,YAAY,KAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAelG,CAAC"}
@@ -1,43 +0,0 @@
1
- import * as Schema from 'effect/Schema';
2
- import { Type } from '@dxos/echo';
3
- import { Ref } from '@dxos/echo/internal';
4
- /**
5
- * Source script.
6
- */
7
- export declare const ScriptType: Type.obj<Schema.Struct<{
8
- name: Schema.optional<typeof Schema.String>;
9
- description: Schema.optional<typeof Schema.String>;
10
- changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo/internal").Ref$<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
12
- content: string;
13
- }>;
14
- }>>;
15
- export interface ScriptType extends Schema.Schema.Type<typeof ScriptType> {
16
- }
17
- /**
18
- * Function deployment.
19
- */
20
- export declare const FunctionType: Type.obj<Schema.Struct<{
21
- /**
22
- * Global registry ID.
23
- * NOTE: The `key` property refers to the original registry entry.
24
- */
25
- key: Schema.optional<typeof Schema.String>;
26
- name: typeof Schema.NonEmptyString;
27
- version: typeof Schema.String;
28
- description: Schema.optional<typeof Schema.String>;
29
- source: Schema.optional<import("@dxos/echo/internal").Ref$<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
30
- name?: string | undefined;
31
- description?: string | undefined;
32
- changed?: boolean | undefined;
33
- source: Ref<Type.OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
34
- content: string;
35
- }>;
36
- }>>;
37
- inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
38
- outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
39
- binding: Schema.optional<typeof Schema.String>;
40
- }>>;
41
- export interface FunctionType extends Schema.Schema.Type<typeof FunctionType> {
42
- }
43
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/schema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAK3E;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;GAatB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB;;;OAGG;;;;;;;;;;;;;;;;GA6BJ,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1,67 +0,0 @@
1
- import * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import * as Layer from 'effect/Layer';
4
- import * as Option from 'effect/Option';
5
- import type * as Schema from 'effect/Schema';
6
- import { type Filter, type Live, Obj, ObjectNotFoundError, type Query, type Ref, type Relation, type Type } from '@dxos/echo';
7
- import type { EchoSchema } from '@dxos/echo/internal';
8
- import type { EchoDatabase, FlushOptions, OneShotQueryResult, QueryResult, SchemaRegistryQuery } from '@dxos/echo-db';
9
- import type { SchemaRegistryPreparedQuery } from '@dxos/echo-db';
10
- import type { DXN } from '@dxos/keys';
11
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/functions/DatabaseService", {
12
- readonly db: EchoDatabase;
13
- }>;
14
- export declare class DatabaseService extends DatabaseService_base {
15
- static notAvailable: Layer.Layer<DatabaseService, never, never>;
16
- static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
17
- static layer: (db: EchoDatabase) => Layer.Layer<DatabaseService>;
18
- /**
19
- * Resolves an object by its DXN.
20
- */
21
- static resolve: {
22
- (dxn: DXN): Effect.Effect<Obj.Any | Relation.Any, never, DatabaseService>;
23
- <S extends Type.Obj.Any | Type.Relation.Any>(dxn: DXN, schema: S): Effect.Effect<Schema.Schema.Type<S>, ObjectNotFoundError, DatabaseService>;
24
- };
25
- /**
26
- * Loads an object reference.
27
- */
28
- static load: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, ObjectNotFoundError, never>;
29
- /**
30
- * Loads an object reference option.
31
- */
32
- static loadOption: <T>(ref: Ref.Ref<T>) => Effect.Effect<Option.Option<T>, never, never>;
33
- /**
34
- * @link EchoDatabase.add
35
- */
36
- static add: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<T, never, DatabaseService>;
37
- /**
38
- * @link EchoDatabase.remove
39
- */
40
- static remove: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<void, never, DatabaseService>;
41
- /**
42
- * @link EchoDatabase.flush
43
- */
44
- static flush: (opts?: FlushOptions) => Effect.Effect<void, never, DatabaseService>;
45
- /**
46
- * @link EchoDatabase.getObjectById
47
- */
48
- static getObjectById: <T extends Obj.Any | Relation.Any>(id: string) => Effect.Effect<Live<T> | undefined, never, DatabaseService>;
49
- /**
50
- * Creates a `QueryResult` object that can be subscribed to.
51
- */
52
- static query: {
53
- <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
54
- <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
55
- };
56
- /**
57
- * Executes the query once and returns the results.
58
- */
59
- static runQuery: {
60
- <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
61
- <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
62
- };
63
- static schemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<SchemaRegistryPreparedQuery<EchoSchema>, never, DatabaseService>;
64
- static runSchemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<EchoSchema[], never, DatabaseService>;
65
- }
66
- export {};
67
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,EACL,KAAK,MAA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AAS,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;KAC7G,CAIG;IAEJ;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE;QACf,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;QAChH,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;KACpH,CAGG;IAEJ,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,mBAAmB,EACjD,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAI7E;IAEJ,MAAM,CAAC,cAAc,GAAI,CAAC,SAAS,mBAAmB,EACpD,OAAO,CAAC,KACP,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,CAGlD;CACL"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=function-invocation-service.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-invocation-service.test.d.ts","sourceRoot":"","sources":["../../../../src/services/function-invocation-service.test.ts"],"names":[],"mappings":""}
@@ -1,34 +0,0 @@
1
- import * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import * as Layer from 'effect/Layer';
4
- import { AiService } from '@dxos/ai';
5
- import { FunctionNotFoundError } from '../errors';
6
- import type { FunctionDefinition } from '../handler';
7
- import { CredentialsService } from './credentials';
8
- import { DatabaseService } from './database';
9
- import { type ComputeEventLogger } from './event-logger';
10
- import { QueueService } from './queues';
11
- import { RemoteFunctionExecutionService } from './remote-function-execution-service';
12
- import { type Services } from './service-container';
13
- import { type TracingService } from './tracing';
14
- /**
15
- * Services that are provided at the function call site.
16
- */
17
- export type InvocationServices = TracingService | ComputeEventLogger;
18
- declare const LocalFunctionExecutionService_base: Context.TagClass<LocalFunctionExecutionService, "@dxos/functions/LocalFunctionExecutionService", {
19
- invokeFunction<I, O>(functionDef: FunctionDefinition<I, O>, input: I): Effect.Effect<O, never, InvocationServices>;
20
- }>;
21
- export declare class LocalFunctionExecutionService extends LocalFunctionExecutionService_base {
22
- static layerLive: Layer.Layer<LocalFunctionExecutionService, never, DatabaseService | CredentialsService | QueueService | RemoteFunctionExecutionService | AiService.AiService | FunctionImplementationResolver>;
23
- static invokeFunction: <F extends FunctionDefinition.Any>(functionDef: F, input: FunctionDefinition.Input<F>) => Effect.Effect<FunctionDefinition.Output<F>, never, Services | LocalFunctionExecutionService>;
24
- }
25
- declare const FunctionImplementationResolver_base: Context.TagClass<FunctionImplementationResolver, "@dxos/functions/FunctionImplementationResolver", {
26
- resolveFunctionImplementation<I, O>(functionDef: FunctionDefinition<I, O>): Effect.Effect<FunctionDefinition<I, O>, FunctionNotFoundError>;
27
- }>;
28
- export declare class FunctionImplementationResolver extends FunctionImplementationResolver_base {
29
- static layerTest: ({ functions }: {
30
- functions: FunctionDefinition<any, any>[];
31
- }) => Layer.Layer<FunctionImplementationResolver, never, never>;
32
- }
33
- export {};
34
- //# sourceMappingURL=local-function-execution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-function-execution.d.ts","sourceRoot":"","sources":["../../../../src/services/local-function-execution.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAA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AE,CAAC,eACnB,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,CAAC;;AALrE,qBAAa,8BAA+B,SAAQ,mCAOjD;IACD,MAAM,CAAC,SAAS,GAAI,eAAe;QAAE,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,+DAS3E;CACN"}
@@ -1,22 +0,0 @@
1
- import * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import * as Layer from 'effect/Layer';
4
- import type { SpaceId } from '@dxos/keys';
5
- declare const RemoteFunctionExecutionService_base: Context.TagClass<RemoteFunctionExecutionService, "@dxos/functions/RemoteFunctionExecutionService", {
6
- callFunction<I, O>(deployedFunctionId: string, input: I): Effect.Effect<O>;
7
- }>;
8
- /**
9
- * Allows calling into other functions.
10
- */
11
- export declare class RemoteFunctionExecutionService extends RemoteFunctionExecutionService_base {
12
- /**
13
- * @param baseUrl URL of the EDGE server.
14
- * @param spaceId - The space ID to invoke the function in. If not provided, the function will be without space context.
15
- * @returns
16
- */
17
- static fromClient(baseUrl: string, spaceId?: SpaceId): Layer.Layer<RemoteFunctionExecutionService>;
18
- static mock: () => Context.Tag.Service<RemoteFunctionExecutionService>;
19
- static layerMock: Layer.Layer<RemoteFunctionExecutionService, never, never>;
20
- }
21
- export {};
22
- //# sourceMappingURL=remote-function-execution-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-function-execution-service.d.ts","sourceRoot":"","sources":["../../../../src/services/remote-function-execution-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;iBAWzB,CAAC,EAAE,CAAC,sBAAsB,MAAM,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;;AAN9E;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,mCAKjD;IACD;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,8BAA8B,CAAC;IA2BlG,MAAM,CAAC,IAAI,QAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAKnE;IAEF,MAAM,CAAC,SAAS,4DAAwF;CACzG"}
@@ -1,57 +0,0 @@
1
- import type * as Context from 'effect/Context';
2
- import * as Layer from 'effect/Layer';
3
- import { AiService } from '@dxos/ai';
4
- import { CredentialsService } from './credentials';
5
- import { DatabaseService } from './database';
6
- import { ComputeEventLogger } from './event-logger';
7
- import { QueueService } from './queues';
8
- import { RemoteFunctionExecutionService } from './remote-function-execution-service';
9
- import { TracingService } from './tracing';
10
- /**
11
- * List of all services.
12
- */
13
- declare const SERVICES: {
14
- readonly ai: typeof AiService.AiService;
15
- readonly credentials: typeof CredentialsService;
16
- readonly database: typeof DatabaseService;
17
- readonly eventLogger: typeof ComputeEventLogger;
18
- readonly functionCallService: typeof RemoteFunctionExecutionService;
19
- readonly queues: typeof QueueService;
20
- readonly tracing: typeof TracingService;
21
- };
22
- /**
23
- * Mapping of service names to their tags.
24
- */
25
- export type ServiceTagRecord = {
26
- [K in keyof typeof SERVICES]: (typeof SERVICES)[K] extends {
27
- new (_: never): infer T;
28
- } ? T : never;
29
- };
30
- /**
31
- * Mapping of service names to their runtime types.
32
- */
33
- export type ServiceRecord = {
34
- [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;
35
- };
36
- /**
37
- * Union of all services tags.
38
- */
39
- export type Services = ServiceTagRecord[keyof ServiceTagRecord];
40
- export declare const SERVICE_TAGS: Context.Tag<any, any>[];
41
- /**
42
- * @deprecated
43
- */
44
- export declare class ServiceContainer {
45
- private _services;
46
- /**
47
- * Set services.
48
- * @param services - Services to set.
49
- * @returns The container instance.
50
- */
51
- setServices(services: Partial<ServiceRecord>): this;
52
- getService<Id, T>(tag: Context.Tag<Id, T>): T;
53
- clone(): ServiceContainer;
54
- createLayer(): Layer.Layer<Services>;
55
- }
56
- export {};
57
- //# sourceMappingURL=service-container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../src/services/service-container.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAgC,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3C;;GAEG;AACH,QAAA,MAAM,QAAQ;;;;;;;;CAQyD,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;KAC5B,CAAC,IAAI,MAAM,OAAO,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,KAAK;CACnG,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACxE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,gBAAgB,CAAC,CAAC;AAMhE,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAA4B,CAAC;AAM7E;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAmD;IAEpE;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAKnD,UAAU,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAU7C,KAAK,IAAI,gBAAgB;IAKzB,WAAW,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;CAsBrC"}
@@ -1,31 +0,0 @@
1
- import * as Context from 'effect/Context';
2
- import * as Effect from 'effect/Effect';
3
- import type * as Option from 'effect/Option';
4
- import { ServiceNotAvailableError } from '../errors';
5
- export declare namespace ServiceRegistry {
6
- interface Service {
7
- resolve: <T extends Context.Tag<any, any>>(tag: T) => Option.Option<Context.Tag.Service<T>>;
8
- }
9
- }
10
- declare const ServiceRegistry_base: Context.TagClass<ServiceRegistry, "@dxos/functions/ServiceRegistry", ServiceRegistry.Service>;
11
- export declare class ServiceRegistry extends ServiceRegistry_base {
12
- /**
13
- * Resolves the service from the registry.
14
- * @param tag Service tag to resolve.
15
- * @throws {@link ServiceNotAvailableError} if the service is not found.
16
- * @returns Effect that resolve to the service.
17
- */
18
- static resolve: <T extends Context.Tag<any, any>>(tag: T) => Effect.Effect<T, ServiceNotAvailableError, ServiceRegistry>;
19
- static provide: {
20
- <Tags extends [Context.Tag<any, any>, ...Context.Tag<any, any>[]]>(...tags: Tags): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E | ServiceNotAvailableError, Exclude<R, {
21
- [K in keyof Tags]: Context.Tag.Identifier<Tags[K]>;
22
- }[number]> | ServiceRegistry>;
23
- };
24
- static provideOrDie: {
25
- <Tags extends [Context.Tag<any, any>, ...Context.Tag<any, any>[]]>(...tags: Tags): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, {
26
- [K in keyof Tags]: Context.Tag.Identifier<Tags[K]>;
27
- }[number]> | ServiceRegistry>;
28
- };
29
- }
30
- export {};
31
- //# sourceMappingURL=service-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../../../../src/services/service-registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,OAAO;QACtB,OAAO,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7F;CACF;;AAED,qBAAa,eAAgB,SAAQ,oBAGlC;IACD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9C,GAAG,EAAE,CAAC,KACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,wBAAwB,EAAE,eAAe,CAAC,CAI5D;IAEJ,MAAM,CAAC,OAAO,EAAE;QACd,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAC/D,GAAG,IAAI,EAAE,IAAI,GACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAChB,CAAC,EACD,CAAC,GAAG,wBAAwB,EAC5B,OAAO,CAAC,CAAC,EAAE;aAAG,CAAC,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAAE,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAC7F,CAAC;KACH,CAC8G;IAE/G,MAAM,CAAC,YAAY,EAAE;QACnB,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAC/D,GAAG,IAAI,EAAE,IAAI,GACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3B,MAAM,CAAC,MAAM,CAChB,CAAC,EACD,CAAC,EACD,OAAO,CAAC,CAAC,EAAE;aAAG,CAAC,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAAE,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAC7F,CAAC;KACH,CAGG;CACL"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=service-registry.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service-registry.test.d.ts","sourceRoot":"","sources":["../../../../src/services/service-registry.test.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export * from './services';
2
- export * from './layer';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,18 +0,0 @@
1
- import * as Effect from 'effect/Effect';
2
- import * as Layer from 'effect/Layer';
3
- import type * as Schema from 'effect/Schema';
4
- import type { EchoHostIndexingConfig } from '@dxos/echo-pipeline';
5
- import { PublicKey } from '@dxos/keys';
6
- import { DatabaseService, QueueService } from '../services';
7
- export declare const testStoragePath: ({ name }: {
8
- name?: string;
9
- }) => string;
10
- export type TestDatabaseOptions = {
11
- indexing?: Partial<EchoHostIndexingConfig>;
12
- types?: Schema.Schema.AnyNoContext[];
13
- spaceKey?: PublicKey;
14
- storagePath?: string;
15
- onInit?: () => Effect.Effect<void, never, DatabaseService | QueueService>;
16
- };
17
- export declare const TestDatabaseLayer: ({ indexing, types, spaceKey, storagePath, onInit }?: TestDatabaseOptions) => Layer.Layer<DatabaseService | QueueService, never, never>;
18
- //# sourceMappingURL=layer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../src/testing/layer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAI7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI5D,eAAO,MAAM,eAAe,GAAI,UAAuC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,WAEvF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,GAAG,YAAY,CAAC,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,qDAAoD,mBAAwB,8DA+E3G,CAAC"}
@@ -1,5 +0,0 @@
1
- import type * as Context from 'effect/Context';
2
- import { type ComputeEventLogger } from '../services';
3
- export declare const noopLogger: Context.Tag.Service<ComputeEventLogger>;
4
- export declare const consoleLogger: Context.Tag.Service<ComputeEventLogger>;
5
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/testing/logger.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAK/C,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAG9D,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAoC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=persist-database.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"persist-database.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/persist-database.test.ts"],"names":[],"mappings":""}