@dxos/functions 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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 (181) hide show
  1. package/README.md +4 -6
  2. package/dist/lib/neutral/index.mjs +475 -0
  3. package/dist/lib/neutral/index.mjs.map +7 -0
  4. package/dist/lib/neutral/meta.json +1 -0
  5. package/dist/types/src/index.d.ts +3 -9
  6. package/dist/types/src/index.d.ts.map +1 -1
  7. package/dist/types/src/protocol/functions-ai-http-client.d.ts +12 -0
  8. package/dist/types/src/protocol/functions-ai-http-client.d.ts.map +1 -0
  9. package/dist/types/src/protocol/index.d.ts +2 -0
  10. package/dist/types/src/protocol/index.d.ts.map +1 -0
  11. package/dist/types/src/protocol/protocol.d.ts +7 -0
  12. package/dist/types/src/protocol/protocol.d.ts.map +1 -0
  13. package/dist/types/src/protocol/protocol.test.d.ts +2 -0
  14. package/dist/types/src/protocol/protocol.test.d.ts.map +1 -0
  15. package/dist/types/src/sdk.d.ts +10 -0
  16. package/dist/types/src/sdk.d.ts.map +1 -0
  17. package/dist/types/src/services/credentials.d.ts +22 -39
  18. package/dist/types/src/services/credentials.d.ts.map +1 -1
  19. package/dist/types/src/services/function-invocation-service.d.ts +9 -20
  20. package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
  21. package/dist/types/src/services/index.d.ts +1 -6
  22. package/dist/types/src/services/index.d.ts.map +1 -1
  23. package/dist/types/src/services/queues.d.ts +1 -44
  24. package/dist/types/src/services/queues.d.ts.map +1 -1
  25. package/dist/types/src/services/tracing.d.ts +2 -54
  26. package/dist/types/src/services/tracing.d.ts.map +1 -1
  27. package/dist/types/src/types/index.d.ts +2 -0
  28. package/dist/types/src/types/index.d.ts.map +1 -0
  29. package/dist/types/src/types/url.d.ts +13 -0
  30. package/dist/types/src/types/url.d.ts.map +1 -0
  31. package/dist/types/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +25 -72
  33. package/src/index.ts +3 -9
  34. package/src/protocol/functions-ai-http-client.ts +67 -0
  35. package/src/{executor → protocol}/index.ts +1 -1
  36. package/src/protocol/protocol.test.ts +58 -0
  37. package/src/protocol/protocol.ts +292 -0
  38. package/src/sdk.ts +29 -0
  39. package/src/services/credentials.ts +89 -112
  40. package/src/services/function-invocation-service.ts +22 -71
  41. package/src/services/index.ts +1 -6
  42. package/src/services/queues.ts +1 -78
  43. package/src/services/tracing.ts +1 -134
  44. package/src/types/index.ts +5 -0
  45. package/src/types/url.ts +32 -0
  46. package/dist/lib/browser/bundler/index.mjs +0 -265
  47. package/dist/lib/browser/bundler/index.mjs.map +0 -7
  48. package/dist/lib/browser/chunk-C2Z7LCJ2.mjs +0 -649
  49. package/dist/lib/browser/chunk-C2Z7LCJ2.mjs.map +0 -7
  50. package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
  51. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
  52. package/dist/lib/browser/edge/index.mjs +0 -83
  53. package/dist/lib/browser/edge/index.mjs.map +0 -7
  54. package/dist/lib/browser/index.mjs +0 -1366
  55. package/dist/lib/browser/index.mjs.map +0 -7
  56. package/dist/lib/browser/meta.json +0 -1
  57. package/dist/lib/browser/testing/index.mjs +0 -129
  58. package/dist/lib/browser/testing/index.mjs.map +0 -7
  59. package/dist/lib/node-esm/bundler/index.mjs +0 -266
  60. package/dist/lib/node-esm/bundler/index.mjs.map +0 -7
  61. package/dist/lib/node-esm/chunk-AH3AZM2U.mjs +0 -651
  62. package/dist/lib/node-esm/chunk-AH3AZM2U.mjs.map +0 -7
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  64. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  65. package/dist/lib/node-esm/edge/index.mjs +0 -84
  66. package/dist/lib/node-esm/edge/index.mjs.map +0 -7
  67. package/dist/lib/node-esm/index.mjs +0 -1367
  68. package/dist/lib/node-esm/index.mjs.map +0 -7
  69. package/dist/lib/node-esm/meta.json +0 -1
  70. package/dist/lib/node-esm/testing/index.mjs +0 -130
  71. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  72. package/dist/types/src/bundler/bundler.d.ts +0 -49
  73. package/dist/types/src/bundler/bundler.d.ts.map +0 -1
  74. package/dist/types/src/bundler/bundler.test.d.ts +0 -2
  75. package/dist/types/src/bundler/bundler.test.d.ts.map +0 -1
  76. package/dist/types/src/bundler/index.d.ts +0 -2
  77. package/dist/types/src/bundler/index.d.ts.map +0 -1
  78. package/dist/types/src/edge/functions.d.ts +0 -17
  79. package/dist/types/src/edge/functions.d.ts.map +0 -1
  80. package/dist/types/src/edge/index.d.ts +0 -2
  81. package/dist/types/src/edge/index.d.ts.map +0 -1
  82. package/dist/types/src/errors.d.ts +0 -137
  83. package/dist/types/src/errors.d.ts.map +0 -1
  84. package/dist/types/src/examples/fib.d.ts +0 -7
  85. package/dist/types/src/examples/fib.d.ts.map +0 -1
  86. package/dist/types/src/examples/index.d.ts +0 -4
  87. package/dist/types/src/examples/index.d.ts.map +0 -1
  88. package/dist/types/src/examples/reply.d.ts +0 -3
  89. package/dist/types/src/examples/reply.d.ts.map +0 -1
  90. package/dist/types/src/examples/sleep.d.ts +0 -5
  91. package/dist/types/src/examples/sleep.d.ts.map +0 -1
  92. package/dist/types/src/executor/executor.d.ts +0 -14
  93. package/dist/types/src/executor/executor.d.ts.map +0 -1
  94. package/dist/types/src/executor/index.d.ts +0 -2
  95. package/dist/types/src/executor/index.d.ts.map +0 -1
  96. package/dist/types/src/handler.d.ts +0 -106
  97. package/dist/types/src/handler.d.ts.map +0 -1
  98. package/dist/types/src/schema.d.ts +0 -43
  99. package/dist/types/src/schema.d.ts.map +0 -1
  100. package/dist/types/src/services/database.d.ts +0 -63
  101. package/dist/types/src/services/database.d.ts.map +0 -1
  102. package/dist/types/src/services/event-logger.d.ts +0 -72
  103. package/dist/types/src/services/event-logger.d.ts.map +0 -1
  104. package/dist/types/src/services/function-invocation-service.test.d.ts +0 -2
  105. package/dist/types/src/services/function-invocation-service.test.d.ts.map +0 -1
  106. package/dist/types/src/services/local-function-execution.d.ts +0 -32
  107. package/dist/types/src/services/local-function-execution.d.ts.map +0 -1
  108. package/dist/types/src/services/remote-function-execution-service.d.ts +0 -20
  109. package/dist/types/src/services/remote-function-execution-service.d.ts.map +0 -1
  110. package/dist/types/src/services/service-container.d.ts +0 -56
  111. package/dist/types/src/services/service-container.d.ts.map +0 -1
  112. package/dist/types/src/services/service-registry.d.ts +0 -29
  113. package/dist/types/src/services/service-registry.d.ts.map +0 -1
  114. package/dist/types/src/services/service-registry.test.d.ts +0 -2
  115. package/dist/types/src/services/service-registry.test.d.ts.map +0 -1
  116. package/dist/types/src/testing/index.d.ts +0 -3
  117. package/dist/types/src/testing/index.d.ts.map +0 -1
  118. package/dist/types/src/testing/layer.d.ts +0 -17
  119. package/dist/types/src/testing/layer.d.ts.map +0 -1
  120. package/dist/types/src/testing/logger.d.ts +0 -5
  121. package/dist/types/src/testing/logger.d.ts.map +0 -1
  122. package/dist/types/src/testing/persist-database.test.d.ts +0 -2
  123. package/dist/types/src/testing/persist-database.test.d.ts.map +0 -1
  124. package/dist/types/src/testing/services.d.ts +0 -59
  125. package/dist/types/src/testing/services.d.ts.map +0 -1
  126. package/dist/types/src/trace.d.ts +0 -122
  127. package/dist/types/src/trace.d.ts.map +0 -1
  128. package/dist/types/src/translations.d.ts +0 -12
  129. package/dist/types/src/translations.d.ts.map +0 -1
  130. package/dist/types/src/triggers/index.d.ts +0 -4
  131. package/dist/types/src/triggers/index.d.ts.map +0 -1
  132. package/dist/types/src/triggers/input-builder.d.ts +0 -3
  133. package/dist/types/src/triggers/input-builder.d.ts.map +0 -1
  134. package/dist/types/src/triggers/invocation-tracer.d.ts +0 -35
  135. package/dist/types/src/triggers/invocation-tracer.d.ts.map +0 -1
  136. package/dist/types/src/triggers/trigger-dispatcher.d.ts +0 -74
  137. package/dist/types/src/triggers/trigger-dispatcher.d.ts.map +0 -1
  138. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts +0 -2
  139. package/dist/types/src/triggers/trigger-dispatcher.test.d.ts.map +0 -1
  140. package/dist/types/src/triggers/trigger-state-store.d.ts +0 -27
  141. package/dist/types/src/triggers/trigger-state-store.d.ts.map +0 -1
  142. package/dist/types/src/types.d.ts +0 -221
  143. package/dist/types/src/types.d.ts.map +0 -1
  144. package/dist/types/src/url.d.ts +0 -21
  145. package/dist/types/src/url.d.ts.map +0 -1
  146. package/src/bundler/bundler.test.ts +0 -58
  147. package/src/bundler/bundler.ts +0 -291
  148. package/src/bundler/index.ts +0 -5
  149. package/src/edge/functions.ts +0 -67
  150. package/src/edge/index.ts +0 -9
  151. package/src/errors.ts +0 -21
  152. package/src/examples/fib.ts +0 -31
  153. package/src/examples/index.ts +0 -7
  154. package/src/examples/reply.ts +0 -19
  155. package/src/examples/sleep.ts +0 -23
  156. package/src/executor/executor.ts +0 -57
  157. package/src/handler.ts +0 -222
  158. package/src/schema.ts +0 -68
  159. package/src/services/database.ts +0 -171
  160. package/src/services/event-logger.ts +0 -118
  161. package/src/services/function-invocation-service.test.ts +0 -79
  162. package/src/services/local-function-execution.ts +0 -150
  163. package/src/services/remote-function-execution-service.ts +0 -61
  164. package/src/services/service-container.ts +0 -114
  165. package/src/services/service-registry.test.ts +0 -42
  166. package/src/services/service-registry.ts +0 -59
  167. package/src/testing/index.ts +0 -6
  168. package/src/testing/layer.ts +0 -112
  169. package/src/testing/logger.ts +0 -16
  170. package/src/testing/persist-database.test.ts +0 -87
  171. package/src/testing/services.ts +0 -115
  172. package/src/trace.ts +0 -178
  173. package/src/translations.ts +0 -20
  174. package/src/triggers/index.ts +0 -7
  175. package/src/triggers/input-builder.ts +0 -35
  176. package/src/triggers/invocation-tracer.ts +0 -99
  177. package/src/triggers/trigger-dispatcher.test.ts +0 -651
  178. package/src/triggers/trigger-dispatcher.ts +0 -522
  179. package/src/triggers/trigger-state-store.ts +0 -60
  180. package/src/types.ts +0 -214
  181. package/src/url.ts +0 -55
@@ -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,137 +0,0 @@
1
- import { BaseError, type BaseErrorOptions } from '@dxos/errors';
2
- declare const ServiceNotAvailableError_base: {
3
- new (options?: BaseErrorOptions): {
4
- "__#private@#code": "SERVICE_NOT_AVAILABLE";
5
- "__#private@#context": Record<string, unknown>;
6
- readonly name: "SERVICE_NOT_AVAILABLE";
7
- readonly message: string;
8
- readonly code: "SERVICE_NOT_AVAILABLE";
9
- readonly _tag: "SERVICE_NOT_AVAILABLE";
10
- readonly context: Record<string, unknown>;
11
- stack?: string;
12
- cause?: unknown;
13
- };
14
- code: "SERVICE_NOT_AVAILABLE";
15
- is(error: unknown): error is BaseError;
16
- wrap(options?: Omit<BaseErrorOptions, "cause">): (error: unknown) => {
17
- "__#private@#code": "SERVICE_NOT_AVAILABLE";
18
- "__#private@#context": Record<string, unknown>;
19
- readonly name: "SERVICE_NOT_AVAILABLE";
20
- readonly message: string;
21
- readonly code: "SERVICE_NOT_AVAILABLE";
22
- readonly _tag: "SERVICE_NOT_AVAILABLE";
23
- readonly context: Record<string, unknown>;
24
- stack?: string;
25
- cause?: unknown;
26
- };
27
- extend<Code extends string = string>(code: Code, message?: string): 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(service: string, options?: Omit<BaseErrorOptions, 'context'>);
35
- }
36
- declare const FunctionNotFoundError_base: {
37
- new (options?: BaseErrorOptions): {
38
- "__#private@#code": "FUNCTION_NOT_FOUND";
39
- "__#private@#context": Record<string, unknown>;
40
- readonly name: "FUNCTION_NOT_FOUND";
41
- readonly message: string;
42
- readonly code: "FUNCTION_NOT_FOUND";
43
- readonly _tag: "FUNCTION_NOT_FOUND";
44
- readonly context: Record<string, unknown>;
45
- stack?: string;
46
- cause?: unknown;
47
- };
48
- code: "FUNCTION_NOT_FOUND";
49
- is(error: unknown): error is BaseError;
50
- wrap(options?: Omit<BaseErrorOptions, "cause">): (error: unknown) => {
51
- "__#private@#code": "FUNCTION_NOT_FOUND";
52
- "__#private@#context": Record<string, unknown>;
53
- readonly name: "FUNCTION_NOT_FOUND";
54
- readonly message: string;
55
- readonly code: "FUNCTION_NOT_FOUND";
56
- readonly _tag: "FUNCTION_NOT_FOUND";
57
- readonly context: Record<string, unknown>;
58
- stack?: string;
59
- cause?: unknown;
60
- };
61
- extend<Code extends string = string>(code: Code, message?: string): 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 FunctionNotFoundError extends FunctionNotFoundError_base {
68
- constructor(functionKey: string, options?: Omit<BaseErrorOptions, 'context'>);
69
- }
70
- declare const FunctionError_base: {
71
- new (options?: BaseErrorOptions): {
72
- "__#private@#code": "FUNCTION_ERROR";
73
- "__#private@#context": Record<string, unknown>;
74
- readonly name: "FUNCTION_ERROR";
75
- readonly message: string;
76
- readonly code: "FUNCTION_ERROR";
77
- readonly _tag: "FUNCTION_ERROR";
78
- readonly context: Record<string, unknown>;
79
- stack?: string;
80
- cause?: unknown;
81
- };
82
- code: "FUNCTION_ERROR";
83
- is(error: unknown): error is BaseError;
84
- wrap(options?: Omit<BaseErrorOptions, "cause">): (error: unknown) => {
85
- "__#private@#code": "FUNCTION_ERROR";
86
- "__#private@#context": Record<string, unknown>;
87
- readonly name: "FUNCTION_ERROR";
88
- readonly message: string;
89
- readonly code: "FUNCTION_ERROR";
90
- readonly _tag: "FUNCTION_ERROR";
91
- readonly context: Record<string, unknown>;
92
- stack?: string;
93
- cause?: unknown;
94
- };
95
- extend<Code extends string = string>(code: Code, message?: string): any;
96
- isError(error: unknown): error is Error;
97
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
98
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
99
- stackTraceLimit: number;
100
- };
101
- export declare class FunctionError extends FunctionError_base {
102
- }
103
- declare const TriggerStateNotFoundError_base: {
104
- new (options?: BaseErrorOptions): {
105
- "__#private@#code": "TRIGGER_STATE_NOT_FOUND";
106
- "__#private@#context": Record<string, unknown>;
107
- readonly name: "TRIGGER_STATE_NOT_FOUND";
108
- readonly message: string;
109
- readonly code: "TRIGGER_STATE_NOT_FOUND";
110
- readonly _tag: "TRIGGER_STATE_NOT_FOUND";
111
- readonly context: Record<string, unknown>;
112
- stack?: string;
113
- cause?: unknown;
114
- };
115
- code: "TRIGGER_STATE_NOT_FOUND";
116
- is(error: unknown): error is BaseError;
117
- wrap(options?: Omit<BaseErrorOptions, "cause">): (error: unknown) => {
118
- "__#private@#code": "TRIGGER_STATE_NOT_FOUND";
119
- "__#private@#context": Record<string, unknown>;
120
- readonly name: "TRIGGER_STATE_NOT_FOUND";
121
- readonly message: string;
122
- readonly code: "TRIGGER_STATE_NOT_FOUND";
123
- readonly _tag: "TRIGGER_STATE_NOT_FOUND";
124
- readonly context: Record<string, unknown>;
125
- stack?: string;
126
- cause?: unknown;
127
- };
128
- extend<Code extends string = string>(code: Code, message?: string): any;
129
- isError(error: unknown): error is Error;
130
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
131
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
132
- stackTraceLimit: number;
133
- };
134
- export declare class TriggerStateNotFoundError extends TriggerStateNotFoundError_base {
135
- }
136
- export {};
137
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/errors.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhE,qBAAa,wBAAyB,SAAQ,6BAAkE;gBAClG,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAGzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,qBAAa,qBAAsB,SAAQ,0BAA4D;gBACzF,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC;CAG7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,qBAAa,aAAc,SAAQ,kBAA+D;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErG,qBAAa,yBAA0B,SAAQ,8BAAsE;CAAG"}
@@ -1,7 +0,0 @@
1
- declare const _default: import("..").FunctionDefinition<{
2
- readonly iterations?: number | undefined;
3
- }, {
4
- readonly result: string;
5
- }>;
6
- export default _default;
7
- //# sourceMappingURL=fib.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/examples/fib.ts"],"names":[],"mappings":";;;;;AAQA,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,3 +0,0 @@
1
- declare const _default: import("..").FunctionDefinition<any, any>;
2
- export default _default;
3
- //# sourceMappingURL=reply.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/examples/reply.ts"],"names":[],"mappings":";AAQA,wBAUG"}
@@ -1,5 +0,0 @@
1
- declare const _default: import("..").FunctionDefinition<{
2
- readonly duration?: number | undefined;
3
- }, void>;
4
- export default _default;
5
- //# sourceMappingURL=sleep.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/examples/sleep.ts"],"names":[],"mappings":";;;AAQA,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":"AASA,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,106 +0,0 @@
1
- import { type Context, Effect, Schema, type Types } from 'effect';
2
- import { type EchoDatabase } from '@dxos/echo-db';
3
- import { type HasId } from '@dxos/echo-schema';
4
- import { type DXN, type SpaceId } from '@dxos/keys';
5
- import { type QueryResult } from '@dxos/protocols';
6
- import { FunctionType } from './schema';
7
- import { type Services } from './services';
8
- /**
9
- * Function handler.
10
- */
11
- export type FunctionHandler<TData = {}, TOutput = any> = (params: {
12
- /**
13
- * Services and context available to the function.
14
- */
15
- context: FunctionContext;
16
- /**
17
- * Data passed as the input to the function.
18
- * Must match the function's input schema.
19
- * This will be the payload from the trigger or other data passed into the function in a workflow.
20
- */
21
- data: TData;
22
- }) => TOutput | Promise<TOutput> | Effect.Effect<TOutput, any, Services>;
23
- /**
24
- * Function context.
25
- */
26
- export interface FunctionContext {
27
- /**
28
- * Space from which the function was invoked.
29
- */
30
- space: SpaceAPI | undefined;
31
- /**
32
- * Resolves a service available to the function.
33
- * @throws if the service is not available.
34
- */
35
- getService: <T extends Context.Tag<any, any>>(tag: T) => Context.Tag.Service<T>;
36
- getSpace: (spaceId: SpaceId) => Promise<SpaceAPI>;
37
- }
38
- export interface FunctionContextAi {
39
- run(model: string, inputs: any, options?: any): Promise<any>;
40
- }
41
- export interface QueuesAPI {
42
- queryQueue(queue: DXN, options?: {}): Promise<QueryResult>;
43
- insertIntoQueue(queue: DXN, objects: HasId[]): Promise<void>;
44
- }
45
- /**
46
- * Space interface available to functions.
47
- */
48
- export interface SpaceAPI {
49
- get id(): SpaceId;
50
- get db(): EchoDatabase;
51
- get queues(): QueuesAPI;
52
- }
53
- declare const typeId: unique symbol;
54
- export type FunctionDefinition<T = any, O = any> = {
55
- [typeId]: true;
56
- key: string;
57
- name: string;
58
- description?: string;
59
- inputSchema: Schema.Schema<T, any>;
60
- outputSchema?: Schema.Schema<O, any>;
61
- handler: FunctionHandler<T, O>;
62
- meta?: {
63
- /**
64
- * Tools that are projected from functions have this annotation.
65
- *
66
- * deployedFunctionId:
67
- * - Backend deployment ID assigned by the EDGE function service (typically a UUID).
68
- * - Used for remote invocation via `FunctionInvocationService` → `RemoteFunctionExecutionService`.
69
- * - Persisted on the corresponding ECHO `FunctionType` object's metadata under the
70
- * `FUNCTIONS_META_KEY` and retrieved with `getUserFunctionIdInMetadata`.
71
- */
72
- deployedFunctionId?: string;
73
- };
74
- };
75
- export declare const defineFunction: {
76
- <I, O>(params: {
77
- key: string;
78
- name: string;
79
- description?: string;
80
- inputSchema: Schema.Schema<I, any>;
81
- outputSchema?: Schema.Schema<O, any>;
82
- handler: Types.NoInfer<FunctionHandler<I, O>>;
83
- }): FunctionDefinition<I, O>;
84
- };
85
- export declare const FunctionDefinition: {
86
- make: <I, O>(params: {
87
- key: string;
88
- name: string;
89
- description?: string;
90
- inputSchema: Schema.Schema<I, any>;
91
- outputSchema?: Schema.Schema<O, any>;
92
- handler: Types.NoInfer<FunctionHandler<I, O>>;
93
- }) => FunctionDefinition<I, O>;
94
- isFunction: (value: unknown) => value is FunctionDefinition.Any;
95
- serialize: (functionDef: FunctionDefinition.Any) => FunctionType;
96
- deserialize: (functionObj: FunctionType) => FunctionDefinition.Any;
97
- };
98
- export declare namespace FunctionDefinition {
99
- type Any = FunctionDefinition<any, any>;
100
- type Input<T extends FunctionDefinition> = T extends FunctionDefinition<infer I, any> ? I : never;
101
- type Output<T extends FunctionDefinition> = T extends FunctionDefinition<any, infer O> ? O : never;
102
- }
103
- export declare const serializeFunction: (functionDef: FunctionDefinition<any, any>) => FunctionType;
104
- export declare const deserializeFunction: (functionObj: FunctionType) => FunctionDefinition<unknown, unknown>;
105
- export {};
106
- //# sourceMappingURL=handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGlE,OAAO,EAAE,KAAK,YAAY,EAA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MAAM,mBAAmB,GAAI,aAAa,YAAY,KAAG,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAelG,CAAC"}
@@ -1,43 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Type } from '@dxos/echo';
3
- import { Ref } from '@dxos/echo-schema';
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-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").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-schema").Ref$<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
30
- name?: string | undefined;
31
- description?: string | undefined;
32
- changed?: boolean | undefined;
33
- source: Ref<Type.OfKind<import("@dxos/echo-schema").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,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAmC,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGzE;;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;AACF,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG"}
@@ -1,63 +0,0 @@
1
- import { Context, Effect, Layer, Option, type Schema } from 'effect';
2
- import { type Filter, type Live, Obj, ObjectNotFoundError, type Query, type Ref, type Relation, type Type } from '@dxos/echo';
3
- import type { EchoDatabase, FlushOptions, OneShotQueryResult, QueryResult, SchemaRegistryQuery } from '@dxos/echo-db';
4
- import type { SchemaRegistryPreparedQuery } from '@dxos/echo-db';
5
- import type { EchoSchema } from '@dxos/echo-schema';
6
- import type { DXN } from '@dxos/keys';
7
- declare const DatabaseService_base: Context.TagClass<DatabaseService, "@dxos/functions/DatabaseService", {
8
- readonly db: EchoDatabase;
9
- }>;
10
- export declare class DatabaseService extends DatabaseService_base {
11
- static notAvailable: Layer.Layer<DatabaseService, never, never>;
12
- static make: (db: EchoDatabase) => Context.Tag.Service<DatabaseService>;
13
- static layer: (db: EchoDatabase) => Layer.Layer<DatabaseService>;
14
- /**
15
- * Resolves an object by its DXN.
16
- */
17
- static resolve: {
18
- (dxn: DXN): Effect.Effect<Obj.Any | Relation.Any, never, DatabaseService>;
19
- <S extends Type.Obj.Any | Type.Relation.Any>(dxn: DXN, schema: S): Effect.Effect<Schema.Schema.Type<S>, ObjectNotFoundError, DatabaseService>;
20
- };
21
- /**
22
- * Loads an object reference.
23
- */
24
- static load: <T>(ref: Ref.Ref<T>) => Effect.Effect<T, ObjectNotFoundError, never>;
25
- /**
26
- * Loads an object reference option.
27
- */
28
- static loadOption: <T>(ref: Ref.Ref<T>) => Effect.Effect<Option.Option<T>, never, never>;
29
- /**
30
- * @link EchoDatabase.add
31
- */
32
- static add: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<T, never, DatabaseService>;
33
- /**
34
- * @link EchoDatabase.remove
35
- */
36
- static remove: <T extends Obj.Any | Relation.Any>(obj: T) => Effect.Effect<void, never, DatabaseService>;
37
- /**
38
- * @link EchoDatabase.flush
39
- */
40
- static flush: (opts?: FlushOptions) => Effect.Effect<void, never, DatabaseService>;
41
- /**
42
- * @link EchoDatabase.getObjectById
43
- */
44
- static getObjectById: <T extends Obj.Any | Relation.Any>(id: string) => Effect.Effect<Live<T> | undefined, never, DatabaseService>;
45
- /**
46
- * Creates a `QueryResult` object that can be subscribed to.
47
- */
48
- static query: {
49
- <Q extends Query.Any>(query: Q): Effect.Effect<QueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
50
- <F extends Filter.Any>(filter: F): Effect.Effect<QueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
51
- };
52
- /**
53
- * Executes the query once and returns the results.
54
- */
55
- static runQuery: {
56
- <Q extends Query.Any>(query: Q): Effect.Effect<OneShotQueryResult<Live<Query.Type<Q>>>, never, DatabaseService>;
57
- <F extends Filter.Any>(filter: F): Effect.Effect<OneShotQueryResult<Live<Filter.Type<F>>>, never, DatabaseService>;
58
- };
59
- static schemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<SchemaRegistryPreparedQuery<EchoSchema>, never, DatabaseService>;
60
- static runSchemaQuery: <Q extends SchemaRegistryQuery>(query: Q) => Effect.Effect<EchoSchema[], never, DatabaseService>;
61
- }
62
- export {};
63
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../src/services/database.ts"],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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;
56
- readonly nodeId: string | undefined;
57
- }>;
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>;
67
- }
68
- export declare const logCustomEvent: (data: any) => Effect.Effect<void, never, ComputeEventLogger>;
69
- export declare const createDefectLogger: <A, E, R>() => ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>);
70
- export declare const createEventLogger: (level: LogLevel, message?: string) => Context.Tag.Service<ComputeEventLogger>;
71
- export {};
72
- //# sourceMappingURL=event-logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../../../src/services/event-logger.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAO,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAO,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;IA4B/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEjF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;GAEsD,CAAC;;kBAO9D,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;qBAAmB,MAAM,GAAG,SAAS;;AAL3F;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAGrC;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,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,32 +0,0 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- import { AiService } from '@dxos/ai';
3
- import { FunctionNotFoundError } from '../errors';
4
- import type { FunctionDefinition } from '../handler';
5
- import { CredentialsService } from './credentials';
6
- import { DatabaseService } from './database';
7
- import { type ComputeEventLogger } from './event-logger';
8
- import { QueueService } from './queues';
9
- import { RemoteFunctionExecutionService } from './remote-function-execution-service';
10
- import type { Services } from './service-container';
11
- import { type TracingService } from './tracing';
12
- /**
13
- * Services that are provided at the function call site.
14
- */
15
- export type InvocationServices = TracingService | ComputeEventLogger;
16
- declare const LocalFunctionExecutionService_base: Context.TagClass<LocalFunctionExecutionService, "@dxos/functions/LocalFunctionExecutionService", {
17
- invokeFunction<I, O>(functionDef: FunctionDefinition<I, O>, input: I): Effect.Effect<O, never, InvocationServices>;
18
- }>;
19
- export declare class LocalFunctionExecutionService extends LocalFunctionExecutionService_base {
20
- static layerLive: Layer.Layer<LocalFunctionExecutionService, never, DatabaseService | CredentialsService | QueueService | RemoteFunctionExecutionService | AiService.AiService | FunctionImplementationResolver>;
21
- static invokeFunction: <F extends FunctionDefinition.Any>(functionDef: F, input: FunctionDefinition.Input<F>) => Effect.Effect<FunctionDefinition.Output<F>, never, Services | LocalFunctionExecutionService>;
22
- }
23
- declare const FunctionImplementationResolver_base: Context.TagClass<FunctionImplementationResolver, "@dxos/functions/FunctionImplementationResolver", {
24
- resolveFunctionImplementation<I, O>(functionDef: FunctionDefinition<I, O>): Effect.Effect<FunctionDefinition<I, O>, FunctionNotFoundError>;
25
- }>;
26
- export declare class FunctionImplementationResolver extends FunctionImplementationResolver_base {
27
- static layerTest: ({ functions }: {
28
- functions: FunctionDefinition<any, any>[];
29
- }) => Layer.Layer<FunctionImplementationResolver, never, never>;
30
- }
31
- export {};
32
- //# 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,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,QAAQ,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,OAAO,EAAiB,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,kBAAkB,CAAC;;mBAOlD,CAAC,EAAE,CAAC,eAAe,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC;;AALtH,qBAAa,6BAA8B,SAAQ,kCAOhD;IACD,MAAM,CAAC,SAAS,iMA8Bd;IAEF,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,kBAAkB,CAAC,GAAG,EACtD,WAAW,EAAE,CAAC,EACd,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;;kCA+DiC,CAAC,EAAE,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,20 +0,0 @@
1
- import { Context, Effect, Layer } from 'effect';
2
- import type { SpaceId } from '@dxos/keys';
3
- declare const RemoteFunctionExecutionService_base: Context.TagClass<RemoteFunctionExecutionService, "@dxos/functions/RemoteFunctionExecutionService", {
4
- callFunction<I, O>(deployedFunctionId: string, input: I): Effect.Effect<O>;
5
- }>;
6
- /**
7
- * Allows calling into other functions.
8
- */
9
- export declare class RemoteFunctionExecutionService extends RemoteFunctionExecutionService_base {
10
- /**
11
- * @param baseUrl URL of the EDGE server.
12
- * @param spaceId - The space ID to invoke the function in. If not provided, the function will be without space context.
13
- * @returns
14
- */
15
- static fromClient(baseUrl: string, spaceId?: SpaceId): Layer.Layer<RemoteFunctionExecutionService>;
16
- static mock: () => Context.Tag.Service<RemoteFunctionExecutionService>;
17
- static layerMock: Layer.Layer<RemoteFunctionExecutionService, never, never>;
18
- }
19
- export {};
20
- //# 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,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,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"}