@dxos/functions 0.8.3 → 0.8.4-main.28f8d3d

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 (118) hide show
  1. package/dist/lib/browser/bundler/index.mjs +22 -10
  2. package/dist/lib/browser/bundler/index.mjs.map +3 -3
  3. package/dist/lib/browser/chunk-M2OIFLGE.mjs +486 -0
  4. package/dist/lib/browser/chunk-M2OIFLGE.mjs.map +7 -0
  5. package/dist/lib/browser/edge/index.mjs +2 -2
  6. package/dist/lib/browser/edge/index.mjs.map +1 -1
  7. package/dist/lib/browser/index.mjs +51 -37
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/testing/index.mjs +39 -8
  11. package/dist/lib/browser/testing/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/bundler/index.mjs +22 -10
  13. package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
  14. package/dist/lib/node-esm/chunk-K7REX6H4.mjs +488 -0
  15. package/dist/lib/node-esm/chunk-K7REX6H4.mjs.map +7 -0
  16. package/dist/lib/node-esm/edge/index.mjs +2 -2
  17. package/dist/lib/node-esm/edge/index.mjs.map +1 -1
  18. package/dist/lib/node-esm/index.mjs +51 -37
  19. package/dist/lib/node-esm/index.mjs.map +3 -3
  20. package/dist/lib/node-esm/meta.json +1 -1
  21. package/dist/lib/node-esm/testing/index.mjs +39 -8
  22. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  23. package/dist/types/src/bundler/bundler.d.ts +1 -2
  24. package/dist/types/src/bundler/bundler.d.ts.map +1 -1
  25. package/dist/types/src/edge/functions.d.ts +1 -1
  26. package/dist/types/src/edge/functions.d.ts.map +1 -1
  27. package/dist/types/src/errors.d.ts +70 -0
  28. package/dist/types/src/errors.d.ts.map +1 -0
  29. package/dist/types/src/executor/executor.d.ts +3 -0
  30. package/dist/types/src/executor/executor.d.ts.map +1 -1
  31. package/dist/types/src/handler.d.ts +16 -15
  32. package/dist/types/src/handler.d.ts.map +1 -1
  33. package/dist/types/src/index.d.ts +1 -0
  34. package/dist/types/src/index.d.ts.map +1 -1
  35. package/dist/types/src/schema.d.ts +5 -5
  36. package/dist/types/src/services/credentials.d.ts +7 -3
  37. package/dist/types/src/services/credentials.d.ts.map +1 -1
  38. package/dist/types/src/services/database.d.ts +71 -3
  39. package/dist/types/src/services/database.d.ts.map +1 -1
  40. package/dist/types/src/services/event-logger.d.ts +65 -30
  41. package/dist/types/src/services/event-logger.d.ts.map +1 -1
  42. package/dist/types/src/services/index.d.ts +2 -2
  43. package/dist/types/src/services/index.d.ts.map +1 -1
  44. package/dist/types/src/services/local-function-execution.d.ts +12 -0
  45. package/dist/types/src/services/local-function-execution.d.ts.map +1 -0
  46. package/dist/types/src/services/queues.d.ts +32 -6
  47. package/dist/types/src/services/queues.d.ts.map +1 -1
  48. package/dist/types/src/services/remote-function-execution-service.d.ts +15 -0
  49. package/dist/types/src/services/remote-function-execution-service.d.ts.map +1 -0
  50. package/dist/types/src/services/service-container.d.ts +29 -17
  51. package/dist/types/src/services/service-container.d.ts.map +1 -1
  52. package/dist/types/src/services/service-registry.d.ts +29 -0
  53. package/dist/types/src/services/service-registry.d.ts.map +1 -0
  54. package/dist/types/src/services/service-registry.test.d.ts +2 -0
  55. package/dist/types/src/services/service-registry.test.d.ts.map +1 -0
  56. package/dist/types/src/services/tracing.d.ts +13 -2
  57. package/dist/types/src/services/tracing.d.ts.map +1 -1
  58. package/dist/types/src/testing/index.d.ts +1 -0
  59. package/dist/types/src/testing/index.d.ts.map +1 -1
  60. package/dist/types/src/testing/layer.d.ts +10 -0
  61. package/dist/types/src/testing/layer.d.ts.map +1 -0
  62. package/dist/types/src/testing/logger.d.ts +3 -3
  63. package/dist/types/src/testing/logger.d.ts.map +1 -1
  64. package/dist/types/src/testing/services.d.ts +55 -9
  65. package/dist/types/src/testing/services.d.ts.map +1 -1
  66. package/dist/types/src/trace.d.ts +3 -5
  67. package/dist/types/src/trace.d.ts.map +1 -1
  68. package/dist/types/src/translations.d.ts +9 -9
  69. package/dist/types/src/translations.d.ts.map +1 -1
  70. package/dist/types/src/types.d.ts +7 -7
  71. package/dist/types/src/types.d.ts.map +1 -1
  72. package/dist/types/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +36 -26
  74. package/src/bundler/bundler.test.ts +1 -1
  75. package/src/bundler/bundler.ts +26 -4
  76. package/src/edge/functions.ts +1 -1
  77. package/src/errors.ts +13 -0
  78. package/src/executor/executor.ts +20 -13
  79. package/src/handler.ts +34 -25
  80. package/src/index.ts +1 -0
  81. package/src/services/credentials.ts +47 -4
  82. package/src/services/database.ts +91 -3
  83. package/src/services/event-logger.ts +68 -37
  84. package/src/services/index.ts +2 -2
  85. package/src/services/local-function-execution.ts +74 -0
  86. package/src/services/queues.ts +51 -11
  87. package/src/services/{function-call-service.ts → remote-function-execution-service.ts} +7 -5
  88. package/src/services/service-container.ts +47 -42
  89. package/src/services/service-registry.test.ts +42 -0
  90. package/src/services/service-registry.ts +59 -0
  91. package/src/services/tracing.ts +19 -2
  92. package/src/testing/index.ts +1 -0
  93. package/src/testing/layer.ts +31 -0
  94. package/src/testing/logger.ts +4 -4
  95. package/src/testing/services.ts +97 -14
  96. package/src/trace.ts +3 -5
  97. package/src/translations.ts +4 -4
  98. package/src/types.ts +1 -1
  99. package/dist/lib/browser/chunk-WEFZUEL2.mjs +0 -300
  100. package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +0 -7
  101. package/dist/lib/node/bundler/index.cjs +0 -260
  102. package/dist/lib/node/bundler/index.cjs.map +0 -7
  103. package/dist/lib/node/chunk-IJAE7FZK.cjs +0 -320
  104. package/dist/lib/node/chunk-IJAE7FZK.cjs.map +0 -7
  105. package/dist/lib/node/edge/index.cjs +0 -94
  106. package/dist/lib/node/edge/index.cjs.map +0 -7
  107. package/dist/lib/node/index.cjs +0 -522
  108. package/dist/lib/node/index.cjs.map +0 -7
  109. package/dist/lib/node/meta.json +0 -1
  110. package/dist/lib/node/testing/index.cjs +0 -43
  111. package/dist/lib/node/testing/index.cjs.map +0 -7
  112. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +0 -302
  113. package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +0 -7
  114. package/dist/types/src/services/ai.d.ts +0 -12
  115. package/dist/types/src/services/ai.d.ts.map +0 -1
  116. package/dist/types/src/services/function-call-service.d.ts +0 -16
  117. package/dist/types/src/services/function-call-service.d.ts.map +0 -1
  118. package/src/services/ai.ts +0 -32
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../../../../src/bundler/bundler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAqB,KAAK,WAAW,EAAe,MAAM,cAAc,CAAC;AAMhF,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC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EF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IACnC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kBAInE,CAAC;AAEF;;GAEG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAE/C,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAwFpE,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;IA2B7C,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG;QACtC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE;CAaJ"}
@@ -1,6 +1,6 @@
1
1
  import { type DID } from 'iso-did/types';
2
2
  import { type Client } from '@dxos/client';
3
- import type { PublicKey } from '@dxos/keys';
3
+ import { type PublicKey } from '@dxos/keys';
4
4
  import { type UploadFunctionResponseBody } from '@dxos/protocols';
5
5
  export type UploadWorkerArgs = {
6
6
  client: Client;
@@ -1 +1 @@
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,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,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GAE/C,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { BaseError } from '@dxos/errors';
2
+ declare const ServiceNotAvailableError_base: {
3
+ new (message: string, options?: import("@dxos/errors").BaseErrorOptions): {
4
+ #code: "SERVICE_NOT_AVAILABLE";
5
+ #context: Record<string, unknown>;
6
+ readonly name: "SERVICE_NOT_AVAILABLE";
7
+ readonly code: "SERVICE_NOT_AVAILABLE";
8
+ readonly _tag: "SERVICE_NOT_AVAILABLE";
9
+ readonly context: Record<string, unknown>;
10
+ message: string;
11
+ stack?: string;
12
+ cause?: unknown;
13
+ };
14
+ code: "SERVICE_NOT_AVAILABLE";
15
+ is(error: unknown): error is BaseError;
16
+ wrap(message: string, options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause">): (error: unknown) => {
17
+ #code: "SERVICE_NOT_AVAILABLE";
18
+ #context: Record<string, unknown>;
19
+ readonly name: "SERVICE_NOT_AVAILABLE";
20
+ readonly code: "SERVICE_NOT_AVAILABLE";
21
+ readonly _tag: "SERVICE_NOT_AVAILABLE";
22
+ readonly context: Record<string, unknown>;
23
+ message: string;
24
+ stack?: string;
25
+ cause?: unknown;
26
+ };
27
+ extend<Code extends string>(code: Code): any;
28
+ isError(error: unknown): error is Error;
29
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
30
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
31
+ stackTraceLimit: number;
32
+ };
33
+ export declare class ServiceNotAvailableError extends ServiceNotAvailableError_base {
34
+ constructor(serviceName: string);
35
+ }
36
+ declare const FunctionError_base: {
37
+ new (message: string, options?: import("@dxos/errors").BaseErrorOptions): {
38
+ #code: "FUNCTION_ERROR";
39
+ #context: Record<string, unknown>;
40
+ readonly name: "FUNCTION_ERROR";
41
+ readonly code: "FUNCTION_ERROR";
42
+ readonly _tag: "FUNCTION_ERROR";
43
+ readonly context: Record<string, unknown>;
44
+ message: string;
45
+ stack?: string;
46
+ cause?: unknown;
47
+ };
48
+ code: "FUNCTION_ERROR";
49
+ is(error: unknown): error is BaseError;
50
+ wrap(message: string, options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause">): (error: unknown) => {
51
+ #code: "FUNCTION_ERROR";
52
+ #context: Record<string, unknown>;
53
+ readonly name: "FUNCTION_ERROR";
54
+ readonly code: "FUNCTION_ERROR";
55
+ readonly _tag: "FUNCTION_ERROR";
56
+ readonly context: Record<string, unknown>;
57
+ message: string;
58
+ stack?: string;
59
+ cause?: unknown;
60
+ };
61
+ extend<Code extends string>(code: Code): any;
62
+ isError(error: unknown): error is Error;
63
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
64
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
65
+ stackTraceLimit: number;
66
+ };
67
+ export declare class FunctionError extends FunctionError_base {
68
+ }
69
+ export {};
70
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,qBAAa,wBAAyB,SAAQ,6BAAyC;gBACzE,WAAW,EAAE,MAAM;CAGhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,qBAAa,aAAc,SAAQ,kBAAkC;CAAG"}
@@ -3,6 +3,9 @@ import type { ServiceContainer } from '../services';
3
3
  export declare class FunctionExecutor {
4
4
  private readonly _services;
5
5
  constructor(_services: ServiceContainer);
6
+ /**
7
+ *
8
+ */
6
9
  invoke<F extends FunctionDefinition<any, any>>(fnDef: F, input: F extends FunctionDefinition<infer I, infer _O> ? I : never): Promise<F extends FunctionDefinition<infer _I, infer O> ? O : never>;
7
10
  }
8
11
  //# sourceMappingURL=executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,gBAAgB;IAGlD,MAAM,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,KAAK,EAAE,CAAC,EACR,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;CA4BxE"}
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../../src/executor/executor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,aAAa,CAAC;AAE9D,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,KAAK,EAAE,CAAC,EACR,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,9 +1,9 @@
1
- import { Schema, type Context, type Effect } from 'effect';
2
- import { type AiServiceClient } from '@dxos/ai';
3
- import type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';
1
+ import { type Context, type Effect, Schema } from 'effect';
2
+ import { type EchoDatabase } from '@dxos/echo-db';
4
3
  import { type HasId } from '@dxos/echo-schema';
5
- import { type SpaceId, type DXN } from '@dxos/keys';
4
+ import { type DXN, type SpaceId } from '@dxos/keys';
6
5
  import { type QueryResult } from '@dxos/protocols';
6
+ import type { Services } from './services';
7
7
  /**
8
8
  * Function handler.
9
9
  */
@@ -18,22 +18,21 @@ export type FunctionHandler<TData = {}, TOutput = any> = (params: {
18
18
  * This will be the payload from the trigger or other data passed into the function in a workflow.
19
19
  */
20
20
  data: TData;
21
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any>;
21
+ }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;
22
22
  /**
23
23
  * Function context.
24
24
  */
25
25
  export interface FunctionContext {
26
+ /**
27
+ * Space from which the function was invoked.
28
+ */
29
+ space: SpaceAPI | undefined;
26
30
  /**
27
31
  * Resolves a service available to the function.
28
32
  * @throws if the service is not available.
29
33
  */
30
34
  getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
31
35
  getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
32
- /**
33
- * Space from which the function was invoked.
34
- */
35
- space: SpaceAPI | undefined;
36
- ai: AiServiceClient;
37
36
  }
38
37
  export interface FunctionContextAi {
39
38
  run(model: string, inputs: any, options?: any): Promise<any>;
@@ -47,18 +46,20 @@ export interface QueuesAPI {
47
46
  */
48
47
  export interface SpaceAPI {
49
48
  get id(): SpaceId;
50
- /**
51
- * @deprecated
52
- */
53
- get crud(): CoreDatabase;
54
49
  get db(): EchoDatabase;
55
50
  get queues(): QueuesAPI;
56
51
  }
57
52
  export type FunctionDefinition<T = {}, O = any> = {
53
+ name: string;
58
54
  description?: string;
59
55
  inputSchema: Schema.Schema<T, any>;
60
56
  outputSchema?: Schema.Schema<O, any>;
61
57
  handler: FunctionHandler<T, O>;
62
58
  };
63
- export declare const defineFunction: <T, O>(params: FunctionDefinition<T, O>) => FunctionDefinition<T, O>;
59
+ export declare const defineFunction: <T, O>({ name, description, inputSchema, outputSchema, handler, }: FunctionDefinition<T, O>) => FunctionDefinition<T, O>;
60
+ export declare namespace FunctionDefinition {
61
+ type Any = FunctionDefinition<any, any>;
62
+ type Input<T extends FunctionDefinition> = T extends FunctionDefinition<infer I, any> ? I : never;
63
+ type Output<T extends FunctionDefinition> = T extends FunctionDefinition<any, infer O> ? O : never;
64
+ }
64
65
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOnD;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE;IAChE;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,IAAI,EAAE,KAAK,CAAC;CACb,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,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AY,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"}
@@ -5,4 +5,5 @@ export * from './types';
5
5
  export * from './url';
6
6
  export * from './services';
7
7
  export * from './executor';
8
+ export * from './errors';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -8,7 +8,7 @@ export declare const ScriptType: Type.obj<Schema.Struct<{
8
8
  name: Schema.optional<typeof Schema.String>;
9
9
  description: Schema.optional<typeof Schema.String>;
10
10
  changed: Schema.optional<typeof Schema.Boolean>;
11
- source: import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
11
+ source: import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
12
12
  content: string;
13
13
  }>;
14
14
  }>>;
@@ -21,13 +21,13 @@ export declare const FunctionType: Type.obj<Schema.Struct<{
21
21
  name: typeof Schema.NonEmptyString;
22
22
  version: typeof Schema.String;
23
23
  description: Schema.optional<typeof Schema.String>;
24
- source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<Type.Kind.Object> & {
25
- name?: string | undefined;
24
+ source: Schema.optional<import("@dxos/echo-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
26
25
  description?: string | undefined;
27
- changed?: boolean | undefined;
28
- source: Ref<Type.OfKind<Type.Kind.Object> & {
26
+ source: Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
29
27
  content: string;
30
28
  }>;
29
+ name?: string | undefined;
30
+ changed?: boolean | undefined;
31
31
  }>>;
32
32
  inputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
33
33
  outputSchema: Schema.optional<Schema.Schema<Type.JsonSchema, Type.JsonSchema, never>>;
@@ -1,12 +1,13 @@
1
- import { Context } from 'effect';
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import { DatabaseService } from './database';
2
3
  type CredentialQuery = {
3
4
  service?: string;
4
5
  };
5
- type ServiceCredential = {
6
+ export type ServiceCredential = {
6
7
  service: string;
7
8
  apiKey?: string;
8
9
  };
9
- declare const CredentialsService_base: Context.TagClass<CredentialsService, "CredentialsService", {
10
+ declare const CredentialsService_base: Context.TagClass<CredentialsService, "@dxos/functions/CredentialsService", {
10
11
  /**
11
12
  * Query all.
12
13
  */
@@ -18,6 +19,9 @@ declare const CredentialsService_base: Context.TagClass<CredentialsService, "Cre
18
19
  getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;
19
20
  }>;
20
21
  export declare class CredentialsService extends CredentialsService_base {
22
+ static getCredential: (query: CredentialQuery) => Effect.Effect<ServiceCredential, never, CredentialsService>;
23
+ static configuredLayer: (credentials: ServiceCredential[]) => Layer.Layer<CredentialsService, never, never>;
24
+ static layerFromDatabase: () => Layer.Layer<CredentialsService, never, DatabaseService>;
21
25
  }
22
26
  export declare class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {
23
27
  private readonly credentials;
@@ -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,KAAK,iBAAiB,GAAG;IACvB,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;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOxE"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/services/credentials.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAKhD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,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;IACD,MAAM,CAAC,aAAa,GAAI,OAAO,eAAe,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAIvG;IAEL,MAAM,CAAC,eAAe,GAAI,aAAa,iBAAiB,EAAE,mDACyB;IAEnF,MAAM,CAAC,iBAAiB,gEA2BpB;CACL;AAED,qBAAa,4BAA6B,YAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC;IAC9E,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,iBAAiB,EAAO;IAElE,cAAc,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,4BAA4B;IAKxE,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAItE,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAOxE"}
@@ -1,11 +1,79 @@
1
- import { Context, Layer } from 'effect';
2
- import type { EchoDatabase } from '@dxos/echo-db';
3
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "DatabaseService", {
1
+ import { Context, Effect, Layer, type Schema } from 'effect';
2
+ import { type Filter, type Live, Obj, type Query, type Ref, type Relation, type Type } from '@dxos/echo';
3
+ import type { EchoDatabase, FlushOptions, OneShotQueryResult, QueryResult } from '@dxos/echo-db';
4
+ import { BaseError } from '@dxos/errors';
5
+ import type { DXN } from '@dxos/keys';
6
+ declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/functions/DatabaseService", {
4
7
  readonly db: EchoDatabase;
5
8
  }>;
6
9
  export declare class DatabaseService extends DatabaseService_base {
7
10
  static notAvailable: Layer.Layer<DatabaseService, never, never>;
8
11
  static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
12
+ static layer: (db: EchoDatabase) => Layer.Layer<DatabaseService>;
13
+ /**
14
+ * Resolves an object by its DXN.
15
+ */
16
+ static resolve: {
17
+ (dxn: DXN): Effect.Effect<Obj.Any | Relation.Any, never, DatabaseService>;
18
+ <S extends Type.Obj.Any | Type.Relation.Any>(dxn: DXN, schema: S): Effect.Effect<Schema.Schema.Type<S>, ObjectNotFoundError, DatabaseService>;
19
+ };
20
+ /**
21
+ * Loads an object reference.
22
+ */
23
+ static load: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, never, never>;
24
+ /**
25
+ * Creates a `QueryResult` object that can be subscribed to.
26
+ */
27
+ static query: {
28
+ <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
29
+ <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
30
+ };
31
+ /**
32
+ * Executes the query once and returns the results.
33
+ */
34
+ static runQuery: {
35
+ <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
36
+ <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
37
+ };
38
+ /**
39
+ * Adds an object to the database.
40
+ */
41
+ static add: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<T, never, DatabaseService>;
42
+ static flush: (opts?: FlushOptions) => Effect.Effect<void, never, DatabaseService>;
43
+ }
44
+ declare const ObjectNotFoundError_base: {
45
+ new (message: string, options?: import("@dxos/errors").BaseErrorOptions): {
46
+ #code: "OBJECT_NOT_FOUND";
47
+ #context: Record<string, unknown>;
48
+ readonly name: "OBJECT_NOT_FOUND";
49
+ readonly code: "OBJECT_NOT_FOUND";
50
+ readonly _tag: "OBJECT_NOT_FOUND";
51
+ readonly context: Record<string, unknown>;
52
+ message: string;
53
+ stack?: string;
54
+ cause?: unknown;
55
+ };
56
+ code: "OBJECT_NOT_FOUND";
57
+ is(error: unknown): error is BaseError;
58
+ wrap(message: string, options?: Omit<import("@dxos/errors").BaseErrorOptions, "cause">): (error: unknown) => {
59
+ #code: "OBJECT_NOT_FOUND";
60
+ #context: Record<string, unknown>;
61
+ readonly name: "OBJECT_NOT_FOUND";
62
+ readonly code: "OBJECT_NOT_FOUND";
63
+ readonly _tag: "OBJECT_NOT_FOUND";
64
+ readonly context: Record<string, unknown>;
65
+ message: string;
66
+ stack?: string;
67
+ cause?: unknown;
68
+ };
69
+ extend<Code extends string>(code: Code): any;
70
+ isError(error: unknown): error is Error;
71
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
72
+ prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
73
+ stackTraceLimit: number;
74
+ };
75
+ declare class ObjectNotFoundError extends ObjectNotFoundError_base {
76
+ constructor(context?: Record<string, unknown>);
9
77
  }
10
78
  export {};
11
79
  //# sourceMappingURL=database.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;iBAKjC,YAAY;;AAH7B,qBAAa,eAAgB,SAAQ,oBAKlC;IACD,MAAM,CAAC,YAAY,6CAIhB;IAEH,MAAM,CAAC,IAAI,GAAI,IAAI,YAAY,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAMpE;CACH"}
1
+ {"version":3,"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AC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CACrC;IAE5D,MAAM,CAAC,KAAK,GAAI,OAAO,YAAY,iDACsD;CAC1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGD,cAAM,mBAAoB,SAAQ,wBAAoC;gBACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9C"}
@@ -1,37 +1,72 @@
1
- import { Effect, Context } from 'effect';
1
+ import { Context, Effect, Layer, Schema } from 'effect';
2
+ import { Type } from '@dxos/echo';
2
3
  import { LogLevel } from '@dxos/log';
3
- export type ComputeEvent = {
4
- type: 'begin-compute';
5
- nodeId: string;
6
- inputs: Record<string, any>;
7
- } | {
8
- type: 'end-compute';
9
- nodeId: string;
10
- outputs: Record<string, any>;
11
- } | {
12
- type: 'compute-input';
13
- nodeId: string;
14
- property: string;
15
- value: any;
16
- } | {
17
- type: 'compute-output';
18
- nodeId: string;
19
- property: string;
20
- value: any;
21
- } | {
22
- type: 'custom';
23
- nodeId: string;
24
- event: any;
25
- };
26
- declare const EventLogger_base: Context.TagClass<EventLogger, "EventLogger", {
27
- readonly log: (event: ComputeEvent) => void;
4
+ import { TracingService } from './tracing';
5
+ export declare const ComputeEventPayload: Schema.Union<[Schema.Struct<{
6
+ type: Schema.Literal<["begin-compute"]>;
7
+ nodeId: typeof Schema.String;
8
+ inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
9
+ }>, Schema.Struct<{
10
+ type: Schema.Literal<["end-compute"]>;
11
+ nodeId: typeof Schema.String;
12
+ outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
13
+ }>, Schema.Struct<{
14
+ type: Schema.Literal<["compute-input"]>;
15
+ nodeId: typeof Schema.String;
16
+ property: typeof Schema.String;
17
+ value: typeof Schema.Any;
18
+ }>, Schema.Struct<{
19
+ type: Schema.Literal<["compute-output"]>;
20
+ nodeId: typeof Schema.String;
21
+ property: typeof Schema.String;
22
+ value: typeof Schema.Any;
23
+ }>, Schema.Struct<{
24
+ type: Schema.Literal<["custom"]>;
25
+ nodeId: typeof Schema.String;
26
+ event: typeof Schema.Any;
27
+ }>]>;
28
+ export type ComputeEventPayload = Schema.Schema.Type<typeof ComputeEventPayload>;
29
+ export declare const ComputeEvent: Type.obj<Schema.Struct<{
30
+ payload: Schema.Union<[Schema.Struct<{
31
+ type: Schema.Literal<["begin-compute"]>;
32
+ nodeId: typeof Schema.String;
33
+ inputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
34
+ }>, Schema.Struct<{
35
+ type: Schema.Literal<["end-compute"]>;
36
+ nodeId: typeof Schema.String;
37
+ outputs: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
38
+ }>, Schema.Struct<{
39
+ type: Schema.Literal<["compute-input"]>;
40
+ nodeId: typeof Schema.String;
41
+ property: typeof Schema.String;
42
+ value: typeof Schema.Any;
43
+ }>, Schema.Struct<{
44
+ type: Schema.Literal<["compute-output"]>;
45
+ nodeId: typeof Schema.String;
46
+ property: typeof Schema.String;
47
+ value: typeof Schema.Any;
48
+ }>, Schema.Struct<{
49
+ type: Schema.Literal<["custom"]>;
50
+ nodeId: typeof Schema.String;
51
+ event: typeof Schema.Any;
52
+ }>]>;
53
+ }>>;
54
+ declare const ComputeEventLogger_base: Context.TagClass<ComputeEventLogger, "@dxos/functions/ComputeEventLogger", {
55
+ readonly log: (event: ComputeEventPayload) => void;
28
56
  readonly nodeId: string | undefined;
29
57
  }>;
30
- export declare class EventLogger extends EventLogger_base {
31
- static noop: Context.Tag.Service<EventLogger>;
58
+ /**
59
+ * Logs event for the compute workflows.
60
+ */
61
+ export declare class ComputeEventLogger extends ComputeEventLogger_base {
62
+ static noop: Context.Tag.Service<ComputeEventLogger>;
63
+ /**
64
+ * Implements ComputeEventLogger using TracingService.
65
+ */
66
+ static layerFromTracing: Layer.Layer<ComputeEventLogger, never, TracingService>;
32
67
  }
33
- export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, EventLogger>;
68
+ export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
34
69
  export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
35
- export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<EventLogger>;
70
+ export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
36
71
  export {};
37
72
  //# sourceMappingURL=event-logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAAO,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ,CAAC;;kBAIY,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;qBAA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IACD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAGlD;IAEF;;OAEG;IACH,MAAM,CAAC,gBAAgB,yDAWrB;CACH;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,mDAWpC,CAAC;AAEL,eAAO,MAAM,kBAAkB,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,OAAK,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMrG,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,UAAS,MAAgB,KACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAiBxC,CAAC"}
@@ -1,9 +1,9 @@
1
- export * from './ai';
2
1
  export * from './database';
3
2
  export * from './queues';
4
3
  export * from './service-container';
5
4
  export * from './credentials';
6
5
  export * from './tracing';
7
6
  export * from './event-logger';
8
- export * from './function-call-service';
7
+ export * from './remote-function-execution-service';
8
+ export * from './local-function-execution';
9
9
  //# 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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/index.ts"],"names":[],"mappings":"AAIA,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,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import type { FunctionDefinition } from '../handler';
3
+ import type { Services } from './service-container';
4
+ declare const LocalFunctionExecutionService_base: Context.TagClass<LocalFunctionExecutionService, "@dxos/functions/LocalFunctionExecutionService", {
5
+ invokeFunction(fnDef: FunctionDefinition<any, any>, input: unknown): Effect.Effect<unknown, never, Services>;
6
+ }>;
7
+ export declare class LocalFunctionExecutionService extends LocalFunctionExecutionService_base {
8
+ static layer: Layer.Layer<LocalFunctionExecutionService, never, never>;
9
+ static invokeFunction: <F extends FunctionDefinition.Any>(fnDef: F, input: FunctionDefinition.Input<F>) => Effect.Effect<FunctionDefinition.Output<F>, never, Services | LocalFunctionExecutionService>;
10
+ }
11
+ export {};
12
+ //# sourceMappingURL=local-function-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-function-execution.d.ts","sourceRoot":"","sources":["../../../../src/services/local-function-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAKxD,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;;0BAO1B,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;;AALhH,qBAAa,6BAA8B,SAAQ,kCAOhD;IACD,MAAM,CAAC,KAAK,2DAET;IAEH,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EACtD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,KAC/B,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,GAAG,6BAA6B,CAAC,CACH;CAC/F"}
@@ -1,18 +1,44 @@
1
- import { Context, Layer } from 'effect';
2
- import type { Queue, QueueFactory } from '@dxos/echo-db';
3
- declare const QueueService_base: Context.TagClass<QueueService, "QueueService", {
1
+ import { Context, Effect, Layer } from 'effect';
2
+ import type { Obj, Relation } from '@dxos/echo';
3
+ import type { Queue, QueueAPI, QueueFactory } from '@dxos/echo-db';
4
+ import type { DXN, QueueSubspaceTag } from '@dxos/keys';
5
+ declare const QueueService_base: Context.TagClass<QueueService, "@dxos/functions/QueueService", {
4
6
  /**
5
7
  * API to access the queues.
6
8
  */
7
- readonly queues: QueueFactory;
9
+ readonly queues: QueueAPI;
8
10
  /**
9
11
  * The queue that is used to store the context of the current research.
12
+ * @deprecated Use `ContextQueueService` instead.
10
13
  */
11
- readonly contextQueue: Queue | undefined;
14
+ readonly queue: Queue | undefined;
12
15
  }>;
16
+ /**
17
+ * Gives access to all queues.
18
+ */
13
19
  export declare class QueueService extends QueueService_base {
14
20
  static notAvailable: Layer.Layer<QueueService, never, never>;
15
- static make: (queues: QueueFactory, contextQueue: Queue | undefined) => Context.Tag.Service<QueueService>;
21
+ static make: (queues: QueueFactory, queue?: Queue) => Context.Tag.Service<QueueService>;
22
+ static layer: (queues: QueueFactory, queue?: Queue) => Layer.Layer<QueueService>;
23
+ /**
24
+ * Gets a queue by its DXN.
25
+ */
26
+ static getQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(dxn: DXN) => Effect.Effect<Queue<T>, never, QueueService>;
27
+ /**
28
+ * Creates a new queue.
29
+ */
30
+ static createQueue: <T extends Obj.Any | Relation.Any = Obj.Any | Relation.Any>(options?: {
31
+ subspaceTag?: QueueSubspaceTag;
32
+ }) => Effect.Effect<Queue<T>, never, QueueService>;
33
+ }
34
+ declare const ContextQueueService_base: Context.TagClass<ContextQueueService, "@dxos/functions/ContextQueueService", {
35
+ readonly queue: Queue;
36
+ }>;
37
+ /**
38
+ * Gives access to a specific queue passed as a context.
39
+ */
40
+ export declare class ContextQueueService extends ContextQueueService_base {
41
+ static layer: (queue: Queue) => Layer.Layer<ContextQueueService, never, never>;
16
42
  }
17
43
  export {};
18
44
  //# 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,YAAY,EAAE,MAAM,eAAe,CAAC;;IAKrD;;OAEG;qBACc,YAAY;IAE7B;;OAEG;2BAEoB,KAAK,GAAG,SAAS;;AAZ5C,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAKhB;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,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;;IAQpD;;OAEG;qBACc,QAAQ;IAEzB;;;OAGG;oBACa,KAAK,GAAG,SAAS;;AAfrC;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAc/B;IACD,MAAM,CAAC,YAAY,0CAUhB;IAEH,MAAM,CAAC,IAAI,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAKpF;IAEF,MAAM,CAAC,KAAK,GAAI,QAAQ,YAAY,EAAE,QAAQ,KAAK,KAAG,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CACf;IAEhE;;OAEG;IACH,MAAM,CAAC,QAAQ,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAC1E,KAAK,GAAG,KACP,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAsE;IAErH;;OAEG;IACH,MAAM,CAAC,WAAW,GAAI,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU;QACzF,WAAW,CAAC,EAAE,gBAAgB,CAAC;KAChC,KAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAC2B;CAC5E;;oBAQmB,KAAK;;AANzB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAKtC;IACD,MAAM,CAAC,KAAK,GAAI,OAAO,KAAK,oDAAmD;CAChF"}
@@ -0,0 +1,15 @@
1
+ import { Context, Layer } from 'effect';
2
+ import type { SpaceId } from '@dxos/keys';
3
+ declare const RemoteFunctionExecutionService_base: Context.TagClass<RemoteFunctionExecutionService, "@dxos/functions/RemoteFunctionExecutionService", {
4
+ callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;
5
+ }>;
6
+ /**
7
+ * Allows calling into other functions.
8
+ */
9
+ export declare class RemoteFunctionExecutionService extends RemoteFunctionExecutionService_base {
10
+ static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<RemoteFunctionExecutionService>;
11
+ static mock: () => Context.Tag.Service<RemoteFunctionExecutionService>;
12
+ static mockLayer: Layer.Layer<RemoteFunctionExecutionService, never, never>;
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=remote-function-execution-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-function-execution-service.d.ts","sourceRoot":"","sources":["../../../../src/services/remote-function-execution-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;;qCAQL,MAAM,SAAS,GAAG,YAAY,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;;AANzF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,mCAKjD;IACD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC;IAiBzG,MAAM,CAAC,IAAI,QAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAMnE;IAEF,MAAM,CAAC,SAAS,4DAAwF;CACzG"}