@dxos/functions 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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.
- package/README.md +4 -6
- package/dist/lib/neutral/Trace.mjs +38 -0
- package/dist/lib/neutral/Trace.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5T7GOX2V.mjs +149 -0
- package/dist/lib/neutral/chunk-5T7GOX2V.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IVDUS56O.mjs +49 -0
- package/dist/lib/neutral/chunk-IVDUS56O.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/fib-N45KAC7C.mjs +23 -0
- package/dist/lib/neutral/fib-N45KAC7C.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/index.mjs +671 -634
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/reply-EUEPKNJF.mjs +19 -0
- package/dist/lib/neutral/reply-EUEPKNJF.mjs.map +7 -0
- package/dist/lib/neutral/sleep-PUK3D4FF.mjs +15 -0
- package/dist/lib/neutral/sleep-PUK3D4FF.mjs.map +7 -0
- package/dist/types/src/Trace.d.ts +155 -0
- package/dist/types/src/Trace.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/example/definitions.d.ts +11 -0
- package/dist/types/src/example/definitions.d.ts.map +1 -0
- package/dist/types/src/example/fib.d.ts +3 -2
- package/dist/types/src/example/fib.d.ts.map +1 -1
- package/dist/types/src/example/index.d.ts +3 -11
- package/dist/types/src/example/index.d.ts.map +1 -1
- package/dist/types/src/example/reply.d.ts +2 -1
- package/dist/types/src/example/reply.d.ts.map +1 -1
- package/dist/types/src/example/sleep.d.ts +3 -2
- package/dist/types/src/example/sleep.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/process/Process.d.ts +247 -0
- package/dist/types/src/process/Process.d.ts.map +1 -0
- package/dist/types/src/process/ServiceResolver.d.ts +74 -0
- package/dist/types/src/process/ServiceResolver.d.ts.map +1 -0
- package/dist/types/src/process/StorageService.d.ts +58 -0
- package/dist/types/src/process/StorageService.d.ts.map +1 -0
- package/dist/types/src/protocol/protocol.d.ts +2 -2
- package/dist/types/src/protocol/protocol.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +4 -104
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +2 -2
- package/dist/types/src/services/function-invocation-service.d.ts +6 -5
- package/dist/types/src/services/function-invocation-service.d.ts.map +1 -1
- package/dist/types/src/services/queues.d.ts +5 -2
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/tracing.d.ts +25 -2
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/types/Script.d.ts +4 -3
- package/dist/types/src/types/Script.d.ts.map +1 -1
- package/dist/types/src/types/Trigger.d.ts +40 -41
- package/dist/types/src/types/Trigger.d.ts.map +1 -1
- package/dist/types/src/types/TriggerEvent.d.ts +19 -18
- package/dist/types/src/types/TriggerEvent.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/url.d.ts +2 -2
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -20
- package/src/Trace.ts +202 -0
- package/src/errors.ts +1 -1
- package/src/example/definitions.ts +49 -0
- package/src/example/fib.ts +15 -24
- package/src/example/forex-effect.ts +1 -1
- package/src/example/index.ts +7 -8
- package/src/example/reply.ts +11 -13
- package/src/example/sleep.ts +9 -16
- package/src/index.ts +4 -0
- package/src/process/Process.ts +486 -0
- package/src/process/ServiceResolver.ts +174 -0
- package/src/process/StorageService.ts +99 -0
- package/src/protocol/protocol.test.ts +0 -1
- package/src/protocol/protocol.ts +33 -28
- package/src/sdk.ts +6 -256
- package/src/services/event-logger.ts +1 -1
- package/src/services/function-invocation-service.ts +7 -5
- package/src/services/queues.ts +11 -2
- package/src/services/tracing.ts +35 -2
- package/src/types/Script.ts +7 -3
- package/src/types/Trigger.ts +24 -13
- package/src/types/TriggerEvent.ts +22 -28
- package/src/types/index.ts +0 -1
- package/src/types/url.ts +2 -2
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -1230
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/types/src/operation-compatibility.test.d.ts +0 -2
- package/dist/types/src/operation-compatibility.test.d.ts.map +0 -1
- package/dist/types/src/types/Function.d.ts +0 -52
- package/dist/types/src/types/Function.d.ts.map +0 -1
- package/src/operation-compatibility.test.ts +0 -185
- package/src/types/Function.ts +0 -82
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
EventType,
|
|
3
|
+
OperationEnd,
|
|
4
|
+
OperationStart,
|
|
5
|
+
Trace_exports,
|
|
6
|
+
write,
|
|
7
|
+
writerLayerNoop
|
|
8
|
+
} from "./chunk-5T7GOX2V.mjs";
|
|
9
|
+
import {
|
|
10
|
+
Fibonacci,
|
|
11
|
+
Reply,
|
|
12
|
+
Sleep
|
|
13
|
+
} from "./chunk-IVDUS56O.mjs";
|
|
14
|
+
import {
|
|
15
|
+
__export
|
|
16
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
6
17
|
|
|
7
18
|
// src/errors.ts
|
|
8
19
|
import { BaseError } from "@dxos/errors";
|
|
@@ -12,7 +23,8 @@ var ServiceNotAvailableError = class extends BaseError.extend("ServiceNotAvailab
|
|
|
12
23
|
context: {
|
|
13
24
|
service
|
|
14
25
|
},
|
|
15
|
-
...options
|
|
26
|
+
...options,
|
|
27
|
+
message: `Service not available: ${service}`
|
|
16
28
|
});
|
|
17
29
|
}
|
|
18
30
|
};
|
|
@@ -31,539 +43,295 @@ var FunctionError = class extends BaseError.extend("FunctionError", "Function in
|
|
|
31
43
|
var TriggerStateNotFoundError = class extends BaseError.extend("TriggerStateNotFound", "Trigger state not found") {
|
|
32
44
|
};
|
|
33
45
|
|
|
34
|
-
// src/example/
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
// src/sdk.ts
|
|
39
|
-
import * as Effect from "effect/Effect";
|
|
40
|
-
import * as Schema5 from "effect/Schema";
|
|
41
|
-
import { Obj as Obj4, Type as Type5 } from "@dxos/echo";
|
|
42
|
-
import { assertArgument, failedInvariant } from "@dxos/invariant";
|
|
43
|
-
import { Operation } from "@dxos/operation";
|
|
46
|
+
// src/example/index.ts
|
|
47
|
+
import { OperationHandlerSet } from "@dxos/operation";
|
|
48
|
+
var ExampleHandlers = OperationHandlerSet.lazy(() => import("./fib-N45KAC7C.mjs"), () => import("./reply-EUEPKNJF.mjs"), () => import("./sleep-PUK3D4FF.mjs"));
|
|
44
49
|
|
|
45
|
-
// src/
|
|
46
|
-
var
|
|
47
|
-
__export(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
__export(Script_exports, {
|
|
59
|
-
Script: () => Script,
|
|
60
|
-
make: () => make
|
|
50
|
+
// src/process/Process.ts
|
|
51
|
+
var Process_exports = {};
|
|
52
|
+
__export(Process_exports, {
|
|
53
|
+
ExitedEvent: () => ExitedEvent,
|
|
54
|
+
ID: () => ID,
|
|
55
|
+
ProcessMonitorService: () => ProcessMonitorService,
|
|
56
|
+
ProcessTypeId: () => ProcessTypeId,
|
|
57
|
+
SpawnedEvent: () => SpawnedEvent,
|
|
58
|
+
State: () => State,
|
|
59
|
+
fromOperation: () => fromOperation,
|
|
60
|
+
isProcess: () => isProcess,
|
|
61
|
+
make: () => make,
|
|
62
|
+
prettyProcessTree: () => prettyProcessTree
|
|
61
63
|
});
|
|
64
|
+
import * as Context from "effect/Context";
|
|
65
|
+
import * as Effect from "effect/Effect";
|
|
62
66
|
import * as Schema from "effect/Schema";
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
source: Ref.make(Text.make(source))
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// src/types/Function.ts
|
|
85
|
-
var Function = Schema2.Struct({
|
|
86
|
-
/**
|
|
87
|
-
* Global registry ID.
|
|
88
|
-
* NOTE: The `key` property refers to the original registry entry.
|
|
89
|
-
*/
|
|
90
|
-
// TODO(burdon): Create Format type for DXN-like ids, such as this and schema type.
|
|
91
|
-
// TODO(dmaretskyi): Consider making it part of ECHO meta.
|
|
92
|
-
// TODO(dmaretskyi): Make required.
|
|
93
|
-
key: Schema2.optional(Schema2.String).annotations({
|
|
94
|
-
description: "Unique registration key for the blueprint"
|
|
95
|
-
}),
|
|
96
|
-
name: Schema2.NonEmptyString,
|
|
97
|
-
version: Schema2.String,
|
|
98
|
-
description: Schema2.optional(Schema2.String),
|
|
99
|
-
/**
|
|
100
|
-
* ISO date string of the last deployment.
|
|
101
|
-
*/
|
|
102
|
-
updated: Schema2.optional(Schema2.String),
|
|
103
|
-
// Reference to a source script if it exists within ECHO.
|
|
104
|
-
// TODO(burdon): Don't ref ScriptType directly (core).
|
|
105
|
-
source: Schema2.optional(Type2.Ref(Script)),
|
|
106
|
-
inputSchema: Schema2.optional(JsonSchema.JsonSchema),
|
|
107
|
-
outputSchema: Schema2.optional(JsonSchema.JsonSchema),
|
|
108
|
-
/**
|
|
109
|
-
* List of required services.
|
|
110
|
-
* Match the Context.Tag keys of the FunctionServices variants.
|
|
111
|
-
*/
|
|
112
|
-
services: Schema2.optional(Schema2.Array(Schema2.String)),
|
|
113
|
-
// Local binding to a function name.
|
|
114
|
-
binding: Schema2.optional(Schema2.String)
|
|
115
|
-
}).pipe(Type2.object({
|
|
116
|
-
typename: "dxos.org/type/Function",
|
|
117
|
-
version: "0.1.0"
|
|
118
|
-
}), Annotation2.LabelAnnotation.set([
|
|
119
|
-
"name"
|
|
120
|
-
]), SystemTypeAnnotation.set(true));
|
|
121
|
-
var make2 = (props) => Obj2.make(Function, props);
|
|
122
|
-
var setFrom = (target, source) => {
|
|
123
|
-
Obj2.change(target, (t) => {
|
|
124
|
-
t.key = source.key ?? target.key;
|
|
125
|
-
t.name = source.name ?? target.name;
|
|
126
|
-
t.version = source.version;
|
|
127
|
-
t.description = source.description;
|
|
128
|
-
t.updated = source.updated;
|
|
129
|
-
t.inputSchema = source.inputSchema ? JSON.parse(JSON.stringify(source.inputSchema)) : void 0;
|
|
130
|
-
t.outputSchema = source.outputSchema ? JSON.parse(JSON.stringify(source.outputSchema)) : void 0;
|
|
131
|
-
Obj2.getMeta(t).keys = JSON.parse(JSON.stringify(Obj2.getMeta(source).keys));
|
|
132
|
-
});
|
|
67
|
+
import { assertArgument } from "@dxos/invariant";
|
|
68
|
+
import { OperationHandlerSet as OperationHandlerSet2 } from "@dxos/operation";
|
|
69
|
+
var ID = Schema.String.pipe(Schema.brand("ProcessId"));
|
|
70
|
+
var ProcessTypeId = "~@dxos/functions/Process";
|
|
71
|
+
var isProcess = (executable) => typeof executable === "object" && executable !== null && ProcessTypeId in executable;
|
|
72
|
+
var make = (opts, create) => {
|
|
73
|
+
assertArgument(/^[a-z0-9]([a-z0-9.\-/]*[a-z0-9])?$/i.test(opts.key), "key", "Invalid key");
|
|
74
|
+
return {
|
|
75
|
+
[ProcessTypeId]: {},
|
|
76
|
+
...opts,
|
|
77
|
+
create: (ctx) => create(ctx).pipe(Effect.map((partial) => ({
|
|
78
|
+
onSpawn: () => Effect.void,
|
|
79
|
+
onInput: () => Effect.void,
|
|
80
|
+
onAlarm: () => Effect.void,
|
|
81
|
+
onChildEvent: () => Effect.void,
|
|
82
|
+
...partial
|
|
83
|
+
})))
|
|
84
|
+
};
|
|
133
85
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
86
|
+
var fromOperation = (op, handler) => make({
|
|
87
|
+
key: op.meta.key,
|
|
88
|
+
input: op.input,
|
|
89
|
+
output: op.output,
|
|
90
|
+
services: op.services
|
|
91
|
+
}, (ctx) => Effect.gen(function* () {
|
|
92
|
+
const semaphore = yield* Effect.makeSemaphore(1);
|
|
93
|
+
return {
|
|
94
|
+
onInput: (input) => Effect.gen(function* () {
|
|
95
|
+
yield* write(OperationStart, {
|
|
96
|
+
key: op.meta.key,
|
|
97
|
+
name: op.meta.name
|
|
98
|
+
});
|
|
99
|
+
const opHandler = yield* OperationHandlerSet2.getHandler(handler, op).pipe(Effect.orDie);
|
|
100
|
+
const output = yield* opHandler.handler(input).pipe(Effect.orDie);
|
|
101
|
+
ctx.submitOutput(output);
|
|
102
|
+
ctx.succeed();
|
|
103
|
+
yield* write(OperationEnd, {
|
|
104
|
+
key: op.meta.key,
|
|
105
|
+
name: op.meta.name,
|
|
106
|
+
outcome: "success"
|
|
107
|
+
});
|
|
108
|
+
}).pipe(Effect.catchAllDefect((defect) => Effect.gen(function* () {
|
|
109
|
+
const errorMessage = defect instanceof Error ? defect.message : String(defect);
|
|
110
|
+
yield* write(OperationEnd, {
|
|
111
|
+
key: op.meta.key,
|
|
112
|
+
name: op.meta.name,
|
|
113
|
+
outcome: "failure",
|
|
114
|
+
error: errorMessage
|
|
115
|
+
});
|
|
116
|
+
return yield* Effect.die(defect);
|
|
117
|
+
})), semaphore.withPermits(1))
|
|
118
|
+
};
|
|
119
|
+
}));
|
|
120
|
+
var State = /* @__PURE__ */ (function(State2) {
|
|
121
|
+
State2["RUNNING"] = "RUNNING";
|
|
122
|
+
State2["HYBERNATING"] = "HYBERNATING";
|
|
123
|
+
State2["IDLE"] = "IDLE";
|
|
124
|
+
State2["TERMINATING"] = "TERMINATING";
|
|
125
|
+
State2["TERMINATED"] = "TERMINATED";
|
|
126
|
+
State2["SUCCEEDED"] = "SUCCEEDED";
|
|
127
|
+
State2["FAILED"] = "FAILED";
|
|
128
|
+
return State2;
|
|
129
|
+
})({});
|
|
130
|
+
var ProcessMonitorService = class extends Context.Tag("@dxos/functions/ProcessMonitorService")() {
|
|
163
131
|
};
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var QueueSpec = Schema3.Struct({
|
|
168
|
-
kind: Schema3.Literal("queue").annotations(kindLiteralAnnotations),
|
|
169
|
-
// TODO(dmaretskyi): Change to a reference.
|
|
170
|
-
queue: DXN.Schema
|
|
171
|
-
}).pipe(Schema3.mutable);
|
|
172
|
-
var SubscriptionSpec = Schema3.Struct({
|
|
173
|
-
kind: Schema3.Literal("subscription").annotations(kindLiteralAnnotations),
|
|
174
|
-
query: Schema3.Struct({
|
|
175
|
-
raw: Schema3.optional(Schema3.String.annotations({
|
|
176
|
-
title: "Query"
|
|
177
|
-
})),
|
|
178
|
-
ast: QueryAST.Query
|
|
179
|
-
}).pipe(Schema3.mutable),
|
|
180
|
-
options: Schema3.optional(Schema3.Struct({
|
|
181
|
-
// Watch changes to object (not just creation).
|
|
182
|
-
deep: Schema3.optional(Schema3.Boolean.annotations({
|
|
183
|
-
title: "Nested"
|
|
184
|
-
})),
|
|
185
|
-
// Debounce changes (delay in ms).
|
|
186
|
-
delay: Schema3.optional(Schema3.Number.annotations({
|
|
187
|
-
title: "Delay"
|
|
188
|
-
}))
|
|
189
|
-
}).annotations({
|
|
190
|
-
title: "Options"
|
|
191
|
-
}))
|
|
192
|
-
}).pipe(Schema3.mutable);
|
|
193
|
-
var TimerSpec = Schema3.Struct({
|
|
194
|
-
kind: Schema3.Literal("timer").annotations(kindLiteralAnnotations),
|
|
195
|
-
cron: Schema3.String.annotations({
|
|
196
|
-
title: "Cron",
|
|
197
|
-
[SchemaAST.ExamplesAnnotationId]: [
|
|
198
|
-
"0 0 * * *"
|
|
199
|
-
]
|
|
200
|
-
})
|
|
201
|
-
}).pipe(Schema3.mutable);
|
|
202
|
-
var WebhookSpec = Schema3.Struct({
|
|
203
|
-
kind: Schema3.Literal("webhook").annotations(kindLiteralAnnotations),
|
|
204
|
-
method: Schema3.optional(Schema3.String.annotations({
|
|
205
|
-
title: "Method",
|
|
206
|
-
[OptionsAnnotationId]: [
|
|
207
|
-
"GET",
|
|
208
|
-
"POST"
|
|
209
|
-
]
|
|
210
|
-
})),
|
|
211
|
-
port: Schema3.optional(Schema3.Number.annotations({
|
|
212
|
-
title: "Port"
|
|
213
|
-
}))
|
|
214
|
-
}).pipe(Schema3.mutable);
|
|
215
|
-
var Spec = Schema3.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({
|
|
216
|
-
title: "Trigger"
|
|
132
|
+
var SpawnedEvent = EventType("process.spawned", {
|
|
133
|
+
schema: Schema.Void,
|
|
134
|
+
isEphemeral: false
|
|
217
135
|
});
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*/
|
|
222
|
-
// TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).
|
|
223
|
-
function: Schema3.optional(Type3.Ref(Expando.Expando).annotations({
|
|
224
|
-
title: "Function"
|
|
225
|
-
})),
|
|
226
|
-
/**
|
|
227
|
-
* Only used for workflowSchema.
|
|
228
|
-
* Specifies the input node in the circuit.
|
|
229
|
-
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
230
|
-
*/
|
|
231
|
-
inputNodeId: Schema3.optional(Schema3.String.annotations({
|
|
232
|
-
title: "Input Node ID"
|
|
233
|
-
})),
|
|
234
|
-
// TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)
|
|
235
|
-
// Need lint rule; or agent rule to require PR review for "boolean" key word.
|
|
236
|
-
enabled: Schema3.optional(Schema3.Boolean.annotations({
|
|
237
|
-
title: "Enabled"
|
|
238
|
-
})),
|
|
239
|
-
spec: Schema3.optional(Spec),
|
|
240
|
-
/**
|
|
241
|
-
* Passed as the input data to the function.
|
|
242
|
-
* Must match the function's input schema.
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* {
|
|
246
|
-
* item: '{{$.trigger.event}}',
|
|
247
|
-
* instructions: 'Summarize and perform entity-extraction'
|
|
248
|
-
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
249
|
-
* }
|
|
250
|
-
*/
|
|
251
|
-
input: Schema3.optional(Schema3.mutable(Schema3.Record({
|
|
252
|
-
key: Schema3.String,
|
|
253
|
-
value: Schema3.Any
|
|
254
|
-
})))
|
|
255
|
-
}).pipe(Type3.object({
|
|
256
|
-
typename: "dxos.org/type/Trigger",
|
|
257
|
-
version: "0.1.0"
|
|
258
|
-
}), SystemTypeAnnotation2.set(true));
|
|
259
|
-
var Trigger = TriggerSchema;
|
|
260
|
-
var make3 = (props) => Obj3.make(Trigger, props);
|
|
261
|
-
|
|
262
|
-
// src/types/TriggerEvent.ts
|
|
263
|
-
var TriggerEvent_exports = {};
|
|
264
|
-
__export(TriggerEvent_exports, {
|
|
265
|
-
EmailEvent: () => EmailEvent,
|
|
266
|
-
QueueEvent: () => QueueEvent,
|
|
267
|
-
SubscriptionEvent: () => SubscriptionEvent,
|
|
268
|
-
TimerEvent: () => TimerEvent,
|
|
269
|
-
TriggerEvent: () => TriggerEvent,
|
|
270
|
-
WebhookEvent: () => WebhookEvent
|
|
271
|
-
});
|
|
272
|
-
import * as Schema4 from "effect/Schema";
|
|
273
|
-
import { DXN as DXN2, Type as Type4 } from "@dxos/echo";
|
|
274
|
-
var EmailEvent = Schema4.mutable(Schema4.Struct({
|
|
275
|
-
from: Schema4.String,
|
|
276
|
-
to: Schema4.String,
|
|
277
|
-
subject: Schema4.String,
|
|
278
|
-
created: Schema4.String,
|
|
279
|
-
body: Schema4.String
|
|
280
|
-
}));
|
|
281
|
-
var QueueEvent = Schema4.mutable(Schema4.Struct({
|
|
282
|
-
queue: DXN2.Schema,
|
|
283
|
-
item: Schema4.Any,
|
|
284
|
-
cursor: Schema4.String
|
|
285
|
-
}));
|
|
286
|
-
var SubscriptionEvent = Schema4.Struct({
|
|
287
|
-
/**
|
|
288
|
-
* Type of the mutation.
|
|
289
|
-
*/
|
|
290
|
-
// TODO(dmaretskyi): Specify enum.
|
|
291
|
-
type: Schema4.String,
|
|
292
|
-
/**
|
|
293
|
-
* Reference to the object that was changed or created.
|
|
294
|
-
*/
|
|
295
|
-
subject: Type4.Ref(Type4.Obj),
|
|
296
|
-
/**
|
|
297
|
-
* @deprecated
|
|
298
|
-
*/
|
|
299
|
-
changedObjectId: Schema4.optional(Schema4.String)
|
|
300
|
-
}).pipe(Schema4.mutable);
|
|
301
|
-
var TimerEvent = Schema4.mutable(Schema4.Struct({
|
|
302
|
-
tick: Schema4.Number
|
|
303
|
-
}));
|
|
304
|
-
var WebhookEvent = Schema4.mutable(Schema4.Struct({
|
|
305
|
-
url: Schema4.String,
|
|
306
|
-
method: Schema4.Literal("GET", "POST"),
|
|
307
|
-
headers: Schema4.Record({
|
|
308
|
-
key: Schema4.String,
|
|
309
|
-
value: Schema4.String
|
|
136
|
+
var ExitedEvent = EventType("process.exited", {
|
|
137
|
+
schema: Schema.Struct({
|
|
138
|
+
outcome: Schema.Literal("succeeded", "failed", "terminated")
|
|
310
139
|
}),
|
|
311
|
-
|
|
312
|
-
})
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
var FUNCTIONS_META_KEY = "dxos.org/service/function";
|
|
317
|
-
var FUNCTIONS_PRESET_META_KEY = "dxos.org/service/function-preset";
|
|
318
|
-
var getUserFunctionIdInMetadata = (meta) => {
|
|
319
|
-
return meta.keys.find((key) => key.source === FUNCTIONS_META_KEY)?.id;
|
|
320
|
-
};
|
|
321
|
-
var setUserFunctionIdInMetadata = (meta, functionId) => {
|
|
322
|
-
const key = meta.keys.find((key2) => key2.source === FUNCTIONS_META_KEY);
|
|
323
|
-
if (key) {
|
|
324
|
-
if (key.id !== functionId) {
|
|
325
|
-
throw new Error("Metadata mismatch");
|
|
326
|
-
}
|
|
327
|
-
} else {
|
|
328
|
-
meta.keys.push({
|
|
329
|
-
source: FUNCTIONS_META_KEY,
|
|
330
|
-
id: functionId
|
|
331
|
-
});
|
|
140
|
+
isEphemeral: false
|
|
141
|
+
});
|
|
142
|
+
var prettyProcessTree = (tree) => {
|
|
143
|
+
if (tree.length === 0) {
|
|
144
|
+
return "";
|
|
332
145
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
146
|
+
const pidSet = new Set(tree.map((node) => node.pid));
|
|
147
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
148
|
+
const roots = [];
|
|
149
|
+
for (const node of tree) {
|
|
150
|
+
const parent = node.parentPid;
|
|
151
|
+
if (parent === null || !pidSet.has(parent)) {
|
|
152
|
+
roots.push(node);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
const key2 = String(parent);
|
|
156
|
+
const siblings = childrenByParent.get(key2) ?? [];
|
|
157
|
+
siblings.push(node);
|
|
158
|
+
childrenByParent.set(key2, siblings);
|
|
340
159
|
}
|
|
341
|
-
|
|
342
|
-
|
|
160
|
+
const byPid = (a, b) => String(a.pid).localeCompare(String(b.pid));
|
|
161
|
+
roots.sort(byPid);
|
|
162
|
+
for (const siblings of childrenByParent.values()) {
|
|
163
|
+
siblings.sort(byPid);
|
|
343
164
|
}
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
|
|
165
|
+
const formatLabel = (node) => {
|
|
166
|
+
const idShort = String(node.pid).slice(0, 6);
|
|
167
|
+
const parts = [
|
|
168
|
+
idShort,
|
|
169
|
+
node.state
|
|
170
|
+
];
|
|
171
|
+
if (node.params.name != null && node.params.name !== "") {
|
|
172
|
+
parts.push(node.params.name);
|
|
352
173
|
}
|
|
353
|
-
if (
|
|
354
|
-
|
|
355
|
-
if (stack[2] !== void 0) {
|
|
356
|
-
cache = stack[2].trim();
|
|
357
|
-
return cache;
|
|
358
|
-
}
|
|
174
|
+
if (node.error != null) {
|
|
175
|
+
parts.push(`(${node.error})`);
|
|
359
176
|
}
|
|
177
|
+
const { inputCount, outputCount, wallTime } = node.metrics;
|
|
178
|
+
parts.push(`[in:${inputCount} out:${outputCount} wall:${Math.round(wallTime)}ms]`);
|
|
179
|
+
return parts.join(" ");
|
|
360
180
|
};
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
if (
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
181
|
+
const lines = [];
|
|
182
|
+
const walk = (node, prefix, isLast, isRoot) => {
|
|
183
|
+
if (isRoot) {
|
|
184
|
+
lines.push(`- ${formatLabel(node)}`);
|
|
185
|
+
} else {
|
|
186
|
+
const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
187
|
+
lines.push(`${prefix}${branch}${formatLabel(node)}`);
|
|
367
188
|
}
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
name,
|
|
374
|
-
description,
|
|
375
|
-
inputSchema,
|
|
376
|
-
outputSchema,
|
|
377
|
-
handler: handlerWithSpan,
|
|
378
|
-
types: types ?? [],
|
|
379
|
-
services: !services ? [] : getServiceKeys(services)
|
|
189
|
+
const children = childrenByParent.get(String(node.pid)) ?? [];
|
|
190
|
+
const nextPrefix = isRoot ? " " : `${prefix}${isLast ? " " : "\u2502 "}`;
|
|
191
|
+
children.forEach((child, index) => {
|
|
192
|
+
walk(child, nextPrefix, index === children.length - 1, false);
|
|
193
|
+
});
|
|
380
194
|
};
|
|
195
|
+
for (const root of roots) {
|
|
196
|
+
walk(root, "", true, true);
|
|
197
|
+
}
|
|
198
|
+
return lines.join("\n");
|
|
381
199
|
};
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
200
|
+
|
|
201
|
+
// src/process/ServiceResolver.ts
|
|
202
|
+
var ServiceResolver_exports = {};
|
|
203
|
+
__export(ServiceResolver_exports, {
|
|
204
|
+
ServiceResolver: () => ServiceResolver,
|
|
205
|
+
compose: () => compose,
|
|
206
|
+
empty: () => empty2,
|
|
207
|
+
fromContext: () => fromContext,
|
|
208
|
+
fromRequirements: () => fromRequirements,
|
|
209
|
+
layerRequirements: () => layerRequirements,
|
|
210
|
+
make: () => make3,
|
|
211
|
+
resolve: () => resolve,
|
|
212
|
+
resolveAll: () => resolveAll,
|
|
213
|
+
succeed: () => succeed
|
|
214
|
+
});
|
|
215
|
+
import * as Context2 from "effect/Context";
|
|
216
|
+
import * as Effect2 from "effect/Effect";
|
|
217
|
+
import * as Either from "effect/Either";
|
|
218
|
+
import * as Layer from "effect/Layer";
|
|
219
|
+
import * as Option from "effect/Option";
|
|
220
|
+
var ServiceResolverTypeId = "~@dxos/functions/ServiceResolver";
|
|
221
|
+
var ServiceResolver = Context2.GenericTag("@dxos/functions/ServiceResolver");
|
|
222
|
+
var resolve = Effect2.serviceFunctionEffect(ServiceResolver, (_) => _.resolve);
|
|
223
|
+
var resolveAll = (tags, context) => Effect2.gen(function* () {
|
|
224
|
+
const services = yield* Effect2.forEach(tags, (tag) => resolve(tag, context).pipe(Effect2.map((service) => Context2.make(tag, service))));
|
|
225
|
+
return Context2.mergeAll(...services);
|
|
226
|
+
});
|
|
227
|
+
var succeed = (tag, getService) => {
|
|
228
|
+
return make3((tag1, context) => {
|
|
229
|
+
if (tag1.key !== tag.key) {
|
|
230
|
+
return Effect2.fail(new ServiceNotAvailableError(`Service not available: ${String(tag.key ?? tag)}`));
|
|
386
231
|
}
|
|
387
|
-
|
|
232
|
+
const service = getService(context);
|
|
233
|
+
return service;
|
|
388
234
|
});
|
|
389
235
|
};
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
236
|
+
var make3 = (resolveFn) => ({
|
|
237
|
+
[ServiceResolverTypeId]: ServiceResolverTypeId,
|
|
238
|
+
resolve: resolveFn
|
|
239
|
+
});
|
|
240
|
+
var fromContext = (ctx) => make3((tag, context) => Effect2.gen(function* () {
|
|
241
|
+
const service = Context2.getOption(ctx, tag);
|
|
242
|
+
if (Option.isNone(service)) {
|
|
243
|
+
return yield* Effect2.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
|
|
244
|
+
}
|
|
245
|
+
return service.value;
|
|
246
|
+
}));
|
|
247
|
+
var fromRequirements = (...tags) => Effect2.contextWith((parentCtx) => {
|
|
248
|
+
const available = new Set(tags.map((tag) => tag.key));
|
|
249
|
+
return make3((tag, context) => Effect2.gen(function* () {
|
|
250
|
+
let result = Context2.empty();
|
|
251
|
+
if (!available.has(tag.key)) {
|
|
252
|
+
return yield* Effect2.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
|
|
400
253
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
context: {},
|
|
405
|
-
data: input
|
|
406
|
-
});
|
|
407
|
-
if (Effect.isEffect(result)) {
|
|
408
|
-
return result;
|
|
254
|
+
const service = Context2.getOption(parentCtx, tag);
|
|
255
|
+
if (Option.isNone(service)) {
|
|
256
|
+
return yield* Effect2.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
|
|
409
257
|
}
|
|
410
|
-
|
|
411
|
-
|
|
258
|
+
return service.value;
|
|
259
|
+
}));
|
|
260
|
+
});
|
|
261
|
+
var layerRequirements = (...tags) => Layer.effect(ServiceResolver, fromRequirements(...tags));
|
|
262
|
+
var compose = (...resolvers) => make3((tag, context) => Effect2.gen(function* () {
|
|
263
|
+
for (const resolver of resolvers) {
|
|
264
|
+
const single = yield* resolver.resolve(tag, context).pipe(Effect2.either);
|
|
265
|
+
if (Either.isRight(single)) {
|
|
266
|
+
return single.right;
|
|
412
267
|
}
|
|
413
|
-
return Effect.succeed(result);
|
|
414
|
-
};
|
|
415
|
-
return {
|
|
416
|
-
...op,
|
|
417
|
-
handler: operationHandler
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
var FunctionDefinition = {
|
|
421
|
-
make: defineFunction,
|
|
422
|
-
isFunction: (value2) => {
|
|
423
|
-
return typeof value2 === "object" && value2 !== null && Symbol.for("@dxos/functions/FunctionDefinition") in value2;
|
|
424
|
-
},
|
|
425
|
-
serialize: (functionDef) => {
|
|
426
|
-
assertArgument(FunctionDefinition.isFunction(functionDef), "functionDef");
|
|
427
|
-
return serializeFunction(functionDef);
|
|
428
|
-
},
|
|
429
|
-
deserialize: (functionObj) => {
|
|
430
|
-
assertArgument(Obj4.instanceOf(Function_exports.Function, functionObj), "functionObj");
|
|
431
|
-
return deserializeFunction(functionObj);
|
|
432
|
-
},
|
|
433
|
-
toOperation
|
|
434
|
-
};
|
|
435
|
-
var serializeFunction = (functionDef) => {
|
|
436
|
-
const fn4 = Function_exports.make({
|
|
437
|
-
key: functionDef.key,
|
|
438
|
-
name: functionDef.name,
|
|
439
|
-
version: "0.1.0",
|
|
440
|
-
description: functionDef.description,
|
|
441
|
-
inputSchema: Type5.toJsonSchema(functionDef.inputSchema),
|
|
442
|
-
outputSchema: !functionDef.outputSchema ? void 0 : Type5.toJsonSchema(functionDef.outputSchema),
|
|
443
|
-
services: functionDef.services
|
|
444
|
-
});
|
|
445
|
-
if (functionDef.meta?.deployedFunctionId) {
|
|
446
|
-
Obj4.change(fn4, (fn5) => setUserFunctionIdInMetadata(Obj4.getMeta(fn5), functionDef.meta.deployedFunctionId));
|
|
447
268
|
}
|
|
448
|
-
return
|
|
269
|
+
return yield* Effect2.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
|
|
270
|
+
}));
|
|
271
|
+
var empty2 = make3((tag, context) => {
|
|
272
|
+
return Effect2.fail(new ServiceNotAvailableError(String(tag.key ?? tag)));
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// src/process/StorageService.ts
|
|
276
|
+
import * as Context3 from "effect/Context";
|
|
277
|
+
import * as Effect3 from "effect/Effect";
|
|
278
|
+
import * as Option2 from "effect/Option";
|
|
279
|
+
import * as Pipeable from "effect/Pipeable";
|
|
280
|
+
var StorageService = class extends Context3.Tag("@dxos/functions/StorageService")() {
|
|
449
281
|
};
|
|
450
|
-
var
|
|
282
|
+
var get = Effect3.serviceFunctionEffect(StorageService, (_) => _.get);
|
|
283
|
+
var set = Effect3.serviceFunctionEffect(StorageService, (_) => _.set);
|
|
284
|
+
var deleteKey = Effect3.serviceFunctionEffect(StorageService, (_) => _.delete);
|
|
285
|
+
var list = Effect3.serviceFunctionEffect(StorageService, (_) => _.list);
|
|
286
|
+
var clear = Effect3.serviceFunctionEffect(StorageService, (_) => _.clear);
|
|
287
|
+
var key = (schema, key2) => {
|
|
451
288
|
return {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
outputSchema: !functionObj.outputSchema ? void 0 : Type5.toEffectSchema(functionObj.outputSchema),
|
|
459
|
-
// TODO(dmaretskyi): This should throw error.
|
|
460
|
-
handler: () => {
|
|
461
|
-
},
|
|
462
|
-
services: functionObj.services ?? [],
|
|
463
|
-
types: [],
|
|
464
|
-
meta: {
|
|
465
|
-
deployedFunctionId: getUserFunctionIdInMetadata(Obj4.getMeta(functionObj))
|
|
289
|
+
key: key2,
|
|
290
|
+
get: get(schema, key2),
|
|
291
|
+
set: (value2) => set(schema, key2, value2),
|
|
292
|
+
delete: () => deleteKey(key2),
|
|
293
|
+
pipe(...args) {
|
|
294
|
+
return Pipeable.pipeArguments(this, arguments);
|
|
466
295
|
}
|
|
467
296
|
};
|
|
468
297
|
};
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
description: "Number of iterations",
|
|
478
|
-
default: 1e5
|
|
479
|
-
})
|
|
480
|
-
}),
|
|
481
|
-
outputSchema: Schema6.Struct({
|
|
482
|
-
result: Schema6.String
|
|
483
|
-
}),
|
|
484
|
-
handler: Effect2.fn(function* ({ data: { iterations = 1e5 } }) {
|
|
485
|
-
let a = 0n;
|
|
486
|
-
let b = 1n;
|
|
487
|
-
for (let i = 0; i < iterations; i++) {
|
|
488
|
-
a += b;
|
|
489
|
-
b = a - b;
|
|
298
|
+
var withDefault = (getDefault) => (key2) => {
|
|
299
|
+
return {
|
|
300
|
+
key: key2.key,
|
|
301
|
+
get: key2.get.pipe(Effect3.map(Option2.getOrElse(() => getDefault()))),
|
|
302
|
+
set: (value2) => key2.set(value2),
|
|
303
|
+
delete: () => key2.delete(),
|
|
304
|
+
pipe(...args) {
|
|
305
|
+
return Pipeable.pipeArguments(this, arguments);
|
|
490
306
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
};
|
|
494
|
-
})
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
// src/example/reply.ts
|
|
498
|
-
import * as Console from "effect/Console";
|
|
499
|
-
import * as Effect3 from "effect/Effect";
|
|
500
|
-
import * as Schema7 from "effect/Schema";
|
|
501
|
-
var reply_default = defineFunction({
|
|
502
|
-
key: "example.org/function/reply",
|
|
503
|
-
name: "Reply",
|
|
504
|
-
description: "Function that echoes the input",
|
|
505
|
-
inputSchema: Schema7.Any,
|
|
506
|
-
outputSchema: Schema7.Any,
|
|
507
|
-
handler: Effect3.fn(function* ({ data }) {
|
|
508
|
-
yield* Console.log("reply", {
|
|
509
|
-
data
|
|
510
|
-
});
|
|
511
|
-
return data;
|
|
512
|
-
})
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
// src/example/sleep.ts
|
|
516
|
-
import * as Effect4 from "effect/Effect";
|
|
517
|
-
import * as Schema8 from "effect/Schema";
|
|
518
|
-
var sleep_default = defineFunction({
|
|
519
|
-
key: "example.org/function/sleep",
|
|
520
|
-
name: "Sleep",
|
|
521
|
-
description: "Function that sleeps for a given amount of time",
|
|
522
|
-
inputSchema: Schema8.Struct({
|
|
523
|
-
duration: Schema8.optional(Schema8.Number).annotations({
|
|
524
|
-
description: "Milliseconds to sleep",
|
|
525
|
-
default: 1e5
|
|
526
|
-
})
|
|
527
|
-
}),
|
|
528
|
-
outputSchema: Schema8.Void,
|
|
529
|
-
handler: Effect4.fn(function* ({ data: { duration = 1e5 } }) {
|
|
530
|
-
yield* Effect4.sleep(duration);
|
|
531
|
-
})
|
|
532
|
-
});
|
|
533
|
-
|
|
534
|
-
// src/example/index.ts
|
|
535
|
-
(function(Example2) {
|
|
536
|
-
Example2.fib = fib_default;
|
|
537
|
-
Example2.reply = reply_default;
|
|
538
|
-
Example2.sleep = sleep_default;
|
|
539
|
-
})(Example || (Example = {}));
|
|
540
|
-
var Example;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
541
309
|
|
|
542
310
|
// src/services/credentials.ts
|
|
543
311
|
import * as HttpClient from "@effect/platform/HttpClient";
|
|
544
312
|
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
545
|
-
import * as
|
|
546
|
-
import * as
|
|
547
|
-
import * as
|
|
313
|
+
import * as Context4 from "effect/Context";
|
|
314
|
+
import * as Effect4 from "effect/Effect";
|
|
315
|
+
import * as Layer2 from "effect/Layer";
|
|
548
316
|
import * as Redacted from "effect/Redacted";
|
|
549
317
|
import { Query } from "@dxos/echo";
|
|
550
318
|
import { Database } from "@dxos/echo";
|
|
551
319
|
import { AccessToken } from "@dxos/types";
|
|
552
|
-
var CredentialsService = class _CredentialsService extends
|
|
553
|
-
static getCredential = (query) =>
|
|
320
|
+
var CredentialsService = class _CredentialsService extends Context4.Tag("@dxos/functions/CredentialsService")() {
|
|
321
|
+
static getCredential = (query) => Effect4.gen(function* () {
|
|
554
322
|
const credentials = yield* _CredentialsService;
|
|
555
|
-
return yield*
|
|
323
|
+
return yield* Effect4.promise(() => credentials.getCredential(query));
|
|
556
324
|
});
|
|
557
|
-
static getApiKey = (query) =>
|
|
325
|
+
static getApiKey = (query) => Effect4.gen(function* () {
|
|
558
326
|
const credential = yield* _CredentialsService.getCredential(query);
|
|
559
327
|
if (!credential.apiKey) {
|
|
560
328
|
throw new Error(`API key not found for service: ${query.service}`);
|
|
561
329
|
}
|
|
562
330
|
return Redacted.make(credential.apiKey);
|
|
563
331
|
});
|
|
564
|
-
static configuredLayer = (credentials) =>
|
|
565
|
-
static layerConfig = (credentials) =>
|
|
566
|
-
const serviceCredentials = yield*
|
|
332
|
+
static configuredLayer = (credentials) => Layer2.succeed(_CredentialsService, new ConfiguredCredentialsService(credentials));
|
|
333
|
+
static layerConfig = (credentials) => Layer2.effect(_CredentialsService, Effect4.gen(function* () {
|
|
334
|
+
const serviceCredentials = yield* Effect4.forEach(credentials, ({ service, apiKey }) => Effect4.gen(function* () {
|
|
567
335
|
return {
|
|
568
336
|
service,
|
|
569
337
|
apiKey: Redacted.value(yield* apiKey)
|
|
@@ -571,7 +339,7 @@ var CredentialsService = class _CredentialsService extends Context.Tag("@dxos/fu
|
|
|
571
339
|
}));
|
|
572
340
|
return new ConfiguredCredentialsService(serviceCredentials);
|
|
573
341
|
}));
|
|
574
|
-
static layerFromDatabase = ({ caching = false } = {}) =>
|
|
342
|
+
static layerFromDatabase = ({ caching = false } = {}) => Layer2.effect(_CredentialsService, Effect4.gen(function* () {
|
|
575
343
|
const dbService = yield* Database.Service;
|
|
576
344
|
const cache = /* @__PURE__ */ new Map();
|
|
577
345
|
const queryCredentials = async (query) => {
|
|
@@ -629,46 +397,49 @@ var withAuthorization = (token, kind) => HttpClient.mapRequest((request) => {
|
|
|
629
397
|
});
|
|
630
398
|
|
|
631
399
|
// src/services/event-logger.ts
|
|
632
|
-
import * as
|
|
633
|
-
import * as
|
|
634
|
-
import * as
|
|
635
|
-
import * as
|
|
636
|
-
import { Obj as
|
|
400
|
+
import * as Context6 from "effect/Context";
|
|
401
|
+
import * as Effect6 from "effect/Effect";
|
|
402
|
+
import * as Layer4 from "effect/Layer";
|
|
403
|
+
import * as Schema2 from "effect/Schema";
|
|
404
|
+
import { Obj as Obj2, Type } from "@dxos/echo";
|
|
637
405
|
import { invariant } from "@dxos/invariant";
|
|
638
|
-
import { LogLevel, log
|
|
406
|
+
import { LogLevel, log } from "@dxos/log";
|
|
639
407
|
|
|
640
408
|
// src/services/tracing.ts
|
|
641
|
-
import * as
|
|
642
|
-
import * as
|
|
643
|
-
import * as
|
|
409
|
+
import * as Context5 from "effect/Context";
|
|
410
|
+
import * as Effect5 from "effect/Effect";
|
|
411
|
+
import * as Layer3 from "effect/Layer";
|
|
644
412
|
import { AgentStatus } from "@dxos/ai";
|
|
645
|
-
import { Obj
|
|
413
|
+
import { Obj } from "@dxos/echo";
|
|
646
414
|
import { ObjectId } from "@dxos/keys";
|
|
647
415
|
import { Message } from "@dxos/types";
|
|
648
|
-
var TracingService = class _TracingService extends
|
|
416
|
+
var TracingService = class _TracingService extends Context5.Tag("@dxos/functions/TracingService")() {
|
|
649
417
|
static noop = {
|
|
650
418
|
getTraceContext: () => ({}),
|
|
651
419
|
write: () => {
|
|
652
420
|
},
|
|
653
|
-
|
|
421
|
+
ephemeral: () => {
|
|
422
|
+
},
|
|
423
|
+
traceInvocationStart: () => Effect5.sync(() => ({
|
|
654
424
|
invocationId: ObjectId.random(),
|
|
655
425
|
invocationTraceQueue: void 0
|
|
656
426
|
})),
|
|
657
|
-
traceInvocationEnd: () =>
|
|
427
|
+
traceInvocationEnd: () => Effect5.sync(() => {
|
|
658
428
|
})
|
|
659
429
|
};
|
|
660
|
-
static layerNoop =
|
|
430
|
+
static layerNoop = Layer3.succeed(_TracingService, _TracingService.noop);
|
|
661
431
|
/**
|
|
662
432
|
* Creates a TracingService layer that emits events to the parent tracing service.
|
|
663
433
|
*/
|
|
664
|
-
static layerSubframe = (mapContext) =>
|
|
434
|
+
static layerSubframe = (mapContext) => Layer3.effect(_TracingService, Effect5.gen(function* () {
|
|
665
435
|
const tracing = yield* _TracingService;
|
|
666
436
|
const context = mapContext(tracing.getTraceContext());
|
|
667
437
|
return {
|
|
668
438
|
write: (event, context2) => tracing.write(event, context2),
|
|
439
|
+
ephemeral: (event, context2) => tracing.ephemeral(event, context2),
|
|
669
440
|
getTraceContext: () => context,
|
|
670
|
-
traceInvocationStart: () =>
|
|
671
|
-
traceInvocationEnd: () =>
|
|
441
|
+
traceInvocationStart: () => Effect5.die("Tracing invocation inside another invocation is not supported."),
|
|
442
|
+
traceInvocationEnd: () => Effect5.die("Tracing invocation inside another invocation is not supported.")
|
|
672
443
|
};
|
|
673
444
|
}));
|
|
674
445
|
/**
|
|
@@ -683,18 +454,18 @@ var TracingService = class _TracingService extends Context2.Tag("@dxos/functions
|
|
|
683
454
|
/**
|
|
684
455
|
* Emit the current human-readable execution status.
|
|
685
456
|
*/
|
|
686
|
-
static emitStatus =
|
|
457
|
+
static emitStatus = Effect5.fnUntraced(function* (data) {
|
|
687
458
|
const tracing = yield* _TracingService;
|
|
688
|
-
tracing.write(
|
|
459
|
+
tracing.write(Obj.make(AgentStatus, {
|
|
689
460
|
parentMessage: tracing.getTraceContext().parentMessage,
|
|
690
461
|
toolCallId: tracing.getTraceContext().toolCallId,
|
|
691
462
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
692
463
|
...data
|
|
693
464
|
}), tracing.getTraceContext());
|
|
694
465
|
});
|
|
695
|
-
static emitConverationMessage =
|
|
466
|
+
static emitConverationMessage = Effect5.fnUntraced(function* (data) {
|
|
696
467
|
const tracing = yield* _TracingService;
|
|
697
|
-
tracing.write(
|
|
468
|
+
tracing.write(Obj.make(Message.Message, {
|
|
698
469
|
parentMessage: tracing.getTraceContext().parentMessage,
|
|
699
470
|
...data,
|
|
700
471
|
properties: {
|
|
@@ -703,47 +474,51 @@ var TracingService = class _TracingService extends Context2.Tag("@dxos/functions
|
|
|
703
474
|
}
|
|
704
475
|
}), tracing.getTraceContext());
|
|
705
476
|
});
|
|
477
|
+
static emitEphemeralMessage = Effect5.fnUntraced(function* (data) {
|
|
478
|
+
const tracing = yield* _TracingService;
|
|
479
|
+
tracing.ephemeral(data, tracing.getTraceContext());
|
|
480
|
+
});
|
|
706
481
|
};
|
|
707
482
|
var MESSAGE_PROPERTY_TOOL_CALL_ID = "toolCallId";
|
|
708
483
|
|
|
709
484
|
// src/services/event-logger.ts
|
|
710
485
|
var __dxlog_file = "/__w/dxos/dxos/packages/core/functions/src/services/event-logger.ts";
|
|
711
|
-
var ComputeEventPayload =
|
|
712
|
-
type:
|
|
713
|
-
nodeId:
|
|
486
|
+
var ComputeEventPayload = Schema2.Union(Schema2.Struct({
|
|
487
|
+
type: Schema2.Literal("begin-compute"),
|
|
488
|
+
nodeId: Schema2.String,
|
|
714
489
|
/**
|
|
715
490
|
* Names of the inputs begin computed.
|
|
716
491
|
*/
|
|
717
|
-
inputs:
|
|
718
|
-
}),
|
|
719
|
-
type:
|
|
720
|
-
nodeId:
|
|
492
|
+
inputs: Schema2.Array(Schema2.String)
|
|
493
|
+
}), Schema2.Struct({
|
|
494
|
+
type: Schema2.Literal("end-compute"),
|
|
495
|
+
nodeId: Schema2.String,
|
|
721
496
|
/**
|
|
722
497
|
* Names of the outputs computed.
|
|
723
498
|
*/
|
|
724
|
-
outputs:
|
|
725
|
-
}),
|
|
726
|
-
type:
|
|
727
|
-
nodeId:
|
|
728
|
-
property:
|
|
729
|
-
value:
|
|
730
|
-
}),
|
|
731
|
-
type:
|
|
732
|
-
nodeId:
|
|
733
|
-
property:
|
|
734
|
-
value:
|
|
735
|
-
}),
|
|
736
|
-
type:
|
|
737
|
-
nodeId:
|
|
738
|
-
event:
|
|
499
|
+
outputs: Schema2.Array(Schema2.String)
|
|
500
|
+
}), Schema2.Struct({
|
|
501
|
+
type: Schema2.Literal("compute-input"),
|
|
502
|
+
nodeId: Schema2.String,
|
|
503
|
+
property: Schema2.String,
|
|
504
|
+
value: Schema2.Any
|
|
505
|
+
}), Schema2.Struct({
|
|
506
|
+
type: Schema2.Literal("compute-output"),
|
|
507
|
+
nodeId: Schema2.String,
|
|
508
|
+
property: Schema2.String,
|
|
509
|
+
value: Schema2.Any
|
|
510
|
+
}), Schema2.Struct({
|
|
511
|
+
type: Schema2.Literal("custom"),
|
|
512
|
+
nodeId: Schema2.String,
|
|
513
|
+
event: Schema2.Any
|
|
739
514
|
}));
|
|
740
|
-
var ComputeEvent =
|
|
515
|
+
var ComputeEvent = Schema2.Struct({
|
|
741
516
|
payload: ComputeEventPayload
|
|
742
|
-
}).pipe(
|
|
743
|
-
typename: "dxos.
|
|
517
|
+
}).pipe(Type.object({
|
|
518
|
+
typename: "org.dxos.type.computeEvent",
|
|
744
519
|
version: "0.1.0"
|
|
745
520
|
}));
|
|
746
|
-
var ComputeEventLogger = class _ComputeEventLogger extends
|
|
521
|
+
var ComputeEventLogger = class _ComputeEventLogger extends Context6.Tag("@dxos/functions/ComputeEventLogger")() {
|
|
747
522
|
static noop = {
|
|
748
523
|
log: () => {
|
|
749
524
|
},
|
|
@@ -752,11 +527,11 @@ var ComputeEventLogger = class _ComputeEventLogger extends Context3.Tag("@dxos/f
|
|
|
752
527
|
/**
|
|
753
528
|
* Implements ComputeEventLogger using TracingService.
|
|
754
529
|
*/
|
|
755
|
-
static layerFromTracing =
|
|
530
|
+
static layerFromTracing = Layer4.effect(_ComputeEventLogger, Effect6.gen(function* () {
|
|
756
531
|
const tracing = yield* TracingService;
|
|
757
532
|
return {
|
|
758
533
|
log: (event) => {
|
|
759
|
-
tracing.write(
|
|
534
|
+
tracing.write(Obj2.make(ComputeEvent, {
|
|
760
535
|
payload: event
|
|
761
536
|
}), tracing.getTraceContext());
|
|
762
537
|
},
|
|
@@ -764,7 +539,7 @@ var ComputeEventLogger = class _ComputeEventLogger extends Context3.Tag("@dxos/f
|
|
|
764
539
|
};
|
|
765
540
|
}));
|
|
766
541
|
};
|
|
767
|
-
var logCustomEvent = (data) =>
|
|
542
|
+
var logCustomEvent = (data) => Effect6.gen(function* () {
|
|
768
543
|
const logger = yield* ComputeEventLogger;
|
|
769
544
|
if (!logger.nodeId) {
|
|
770
545
|
throw new Error("logCustomEvent must be called within a node compute function");
|
|
@@ -775,8 +550,8 @@ var logCustomEvent = (data) => Effect7.gen(function* () {
|
|
|
775
550
|
event: data
|
|
776
551
|
});
|
|
777
552
|
});
|
|
778
|
-
var createDefectLogger = () =>
|
|
779
|
-
|
|
553
|
+
var createDefectLogger = () => Effect6.catchAll((error) => Effect6.gen(function* () {
|
|
554
|
+
log.error("unhandled effect error", {
|
|
780
555
|
error
|
|
781
556
|
}, {
|
|
782
557
|
F: __dxlog_file,
|
|
@@ -788,11 +563,11 @@ var createDefectLogger = () => Effect7.catchAll((error) => Effect7.gen(function*
|
|
|
788
563
|
}));
|
|
789
564
|
var createEventLogger = (level, message = "event") => {
|
|
790
565
|
const logFunction = {
|
|
791
|
-
[LogLevel.WARN]:
|
|
792
|
-
[LogLevel.VERBOSE]:
|
|
793
|
-
[LogLevel.DEBUG]:
|
|
794
|
-
[LogLevel.INFO]:
|
|
795
|
-
[LogLevel.ERROR]:
|
|
566
|
+
[LogLevel.WARN]: log.warn,
|
|
567
|
+
[LogLevel.VERBOSE]: log.verbose,
|
|
568
|
+
[LogLevel.DEBUG]: log.debug,
|
|
569
|
+
[LogLevel.INFO]: log.info,
|
|
570
|
+
[LogLevel.ERROR]: log.error
|
|
796
571
|
}[level];
|
|
797
572
|
invariant(logFunction, void 0, {
|
|
798
573
|
F: __dxlog_file,
|
|
@@ -812,24 +587,25 @@ var createEventLogger = (level, message = "event") => {
|
|
|
812
587
|
};
|
|
813
588
|
|
|
814
589
|
// src/services/function-invocation-service.ts
|
|
815
|
-
import * as
|
|
816
|
-
import * as
|
|
817
|
-
import * as
|
|
818
|
-
var FunctionInvocationService = class _FunctionInvocationService extends
|
|
819
|
-
static layerNotAvailable =
|
|
820
|
-
invokeFunction: () =>
|
|
821
|
-
resolveFunction: () =>
|
|
590
|
+
import * as Context7 from "effect/Context";
|
|
591
|
+
import * as Effect7 from "effect/Effect";
|
|
592
|
+
import * as Layer5 from "effect/Layer";
|
|
593
|
+
var FunctionInvocationService = class _FunctionInvocationService extends Context7.Tag("@dxos/functions/FunctionInvocationService")() {
|
|
594
|
+
static layerNotAvailable = Layer5.succeed(_FunctionInvocationService, {
|
|
595
|
+
invokeFunction: () => Effect7.die("FunctionInvocationService is not avaialble."),
|
|
596
|
+
resolveFunction: () => Effect7.die("FunctionInvocationService is not available.")
|
|
822
597
|
});
|
|
823
|
-
static invokeFunction = (functionDef, input) =>
|
|
824
|
-
static resolveFunction = (
|
|
598
|
+
static invokeFunction = (functionDef, input) => Effect7.serviceFunctionEffect(_FunctionInvocationService, (service) => service.invokeFunction)(functionDef, input);
|
|
599
|
+
static resolveFunction = (key2) => Effect7.serviceFunctionEffect(_FunctionInvocationService, (service) => service.resolveFunction)(key2);
|
|
825
600
|
};
|
|
826
601
|
|
|
827
602
|
// src/services/queues.ts
|
|
828
|
-
import * as
|
|
829
|
-
import * as
|
|
830
|
-
import * as
|
|
831
|
-
|
|
832
|
-
|
|
603
|
+
import * as Context8 from "effect/Context";
|
|
604
|
+
import * as Effect8 from "effect/Effect";
|
|
605
|
+
import * as Layer6 from "effect/Layer";
|
|
606
|
+
import { createFeedServiceLayer } from "@dxos/echo-db";
|
|
607
|
+
var QueueService = class _QueueService extends Context8.Tag("@dxos/functions/QueueService")() {
|
|
608
|
+
static notAvailable = Layer6.succeed(_QueueService, {
|
|
833
609
|
queues: {
|
|
834
610
|
get(_dxn) {
|
|
835
611
|
throw new Error("Queues not available");
|
|
@@ -846,49 +622,294 @@ var QueueService = class _QueueService extends Context5.Tag("@dxos/functions/Que
|
|
|
846
622
|
queue
|
|
847
623
|
};
|
|
848
624
|
};
|
|
849
|
-
static layer = (queues, queue) =>
|
|
625
|
+
static layer = (queues, queue) => Layer6.succeed(_QueueService, _QueueService.make(queues, queue));
|
|
850
626
|
/**
|
|
851
627
|
* Gets a queue by its DXN.
|
|
852
628
|
*/
|
|
853
|
-
static getQueue = (dxn) => _QueueService.pipe(
|
|
629
|
+
static getQueue = (dxn) => _QueueService.pipe(Effect8.map(({ queues }) => queues.get(dxn)));
|
|
854
630
|
/**
|
|
855
631
|
* Creates a new queue.
|
|
856
632
|
*/
|
|
857
|
-
static createQueue = (options) => _QueueService.pipe(
|
|
858
|
-
static append = (queue, objects) =>
|
|
633
|
+
static createQueue = (options) => _QueueService.pipe(Effect8.map(({ queues }) => queues.create(options)));
|
|
634
|
+
static append = (queue, objects) => Effect8.promise(() => queue.append(objects));
|
|
859
635
|
};
|
|
860
|
-
var ContextQueueService = class _ContextQueueService extends
|
|
861
|
-
static layer = (queue) =>
|
|
636
|
+
var ContextQueueService = class _ContextQueueService extends Context8.Tag("@dxos/functions/ContextQueueService")() {
|
|
637
|
+
static layer = (queue) => Layer6.succeed(_ContextQueueService, {
|
|
862
638
|
queue
|
|
863
639
|
});
|
|
864
640
|
};
|
|
641
|
+
var feedServiceFromQueueServiceLayer = Layer6.unwrapEffect(Effect8.gen(function* () {
|
|
642
|
+
const { queues } = yield* QueueService;
|
|
643
|
+
return createFeedServiceLayer(queues);
|
|
644
|
+
}));
|
|
645
|
+
|
|
646
|
+
// src/types/Script.ts
|
|
647
|
+
var Script_exports = {};
|
|
648
|
+
__export(Script_exports, {
|
|
649
|
+
Script: () => Script,
|
|
650
|
+
make: () => make5
|
|
651
|
+
});
|
|
652
|
+
import * as Schema3 from "effect/Schema";
|
|
653
|
+
import { Annotation, Obj as Obj3, Ref, Type as Type2 } from "@dxos/echo";
|
|
654
|
+
import { FormInputAnnotation } from "@dxos/echo/internal";
|
|
655
|
+
import { Text } from "@dxos/schema";
|
|
656
|
+
var Script = Schema3.Struct({
|
|
657
|
+
name: Schema3.String.pipe(Schema3.optional),
|
|
658
|
+
description: Schema3.String.pipe(Schema3.optional),
|
|
659
|
+
// TODO(burdon): Change to hash of deployed content.
|
|
660
|
+
// Whether source has changed since last deploy.
|
|
661
|
+
changed: Schema3.Boolean.pipe(FormInputAnnotation.set(false), Schema3.optional),
|
|
662
|
+
source: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false))
|
|
663
|
+
}).pipe(Type2.object({
|
|
664
|
+
typename: "org.dxos.type.script",
|
|
665
|
+
version: "0.1.0"
|
|
666
|
+
}), Annotation.LabelAnnotation.set([
|
|
667
|
+
"name"
|
|
668
|
+
]), Annotation.IconAnnotation.set({
|
|
669
|
+
icon: "ph--code--regular",
|
|
670
|
+
hue: "sky"
|
|
671
|
+
}));
|
|
672
|
+
var make5 = ({ source = "", ...props } = {}) => Obj3.make(Script, {
|
|
673
|
+
...props,
|
|
674
|
+
source: Ref.make(Text.make({
|
|
675
|
+
content: source
|
|
676
|
+
}))
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
// src/types/Trigger.ts
|
|
680
|
+
var Trigger_exports = {};
|
|
681
|
+
__export(Trigger_exports, {
|
|
682
|
+
EmailSpec: () => EmailSpec,
|
|
683
|
+
Kinds: () => Kinds,
|
|
684
|
+
QueueSpec: () => QueueSpec,
|
|
685
|
+
Spec: () => Spec,
|
|
686
|
+
SubscriptionSpec: () => SubscriptionSpec,
|
|
687
|
+
TimerSpec: () => TimerSpec,
|
|
688
|
+
Trigger: () => Trigger,
|
|
689
|
+
WebhookSpec: () => WebhookSpec,
|
|
690
|
+
make: () => make6
|
|
691
|
+
});
|
|
692
|
+
import * as Schema4 from "effect/Schema";
|
|
693
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
694
|
+
import { Annotation as Annotation2, Obj as Obj4, QueryAST, Ref as Ref2, Type as Type3 } from "@dxos/echo";
|
|
695
|
+
import { OptionsAnnotationId, SystemTypeAnnotation } from "@dxos/echo/internal";
|
|
696
|
+
import { DXN } from "@dxos/keys";
|
|
697
|
+
var Kinds = [
|
|
698
|
+
"email",
|
|
699
|
+
"queue",
|
|
700
|
+
"subscription",
|
|
701
|
+
"timer",
|
|
702
|
+
"webhook"
|
|
703
|
+
];
|
|
704
|
+
var kindLiteralAnnotations = {
|
|
705
|
+
title: "Kind"
|
|
706
|
+
};
|
|
707
|
+
var EmailSpec = Schema4.Struct({
|
|
708
|
+
kind: Schema4.Literal("email").annotations(kindLiteralAnnotations)
|
|
709
|
+
});
|
|
710
|
+
var QueueSpec = Schema4.Struct({
|
|
711
|
+
kind: Schema4.Literal("queue").annotations(kindLiteralAnnotations),
|
|
712
|
+
// TODO(dmaretskyi): Rename to `feed` and change to a reference.
|
|
713
|
+
queue: DXN.Schema
|
|
714
|
+
});
|
|
715
|
+
var SubscriptionSpec = Schema4.Struct({
|
|
716
|
+
kind: Schema4.Literal("subscription").annotations(kindLiteralAnnotations),
|
|
717
|
+
query: Schema4.Struct({
|
|
718
|
+
raw: Schema4.optional(Schema4.String.annotations({
|
|
719
|
+
title: "Query"
|
|
720
|
+
})),
|
|
721
|
+
ast: QueryAST.Query
|
|
722
|
+
}),
|
|
723
|
+
options: Schema4.optional(Schema4.Struct({
|
|
724
|
+
// Watch changes to object (not just creation).
|
|
725
|
+
deep: Schema4.optional(Schema4.Boolean.annotations({
|
|
726
|
+
title: "Nested"
|
|
727
|
+
})),
|
|
728
|
+
// Debounce changes (delay in ms).
|
|
729
|
+
delay: Schema4.optional(Schema4.Number.annotations({
|
|
730
|
+
title: "Delay"
|
|
731
|
+
}))
|
|
732
|
+
}).annotations({
|
|
733
|
+
title: "Options"
|
|
734
|
+
}))
|
|
735
|
+
});
|
|
736
|
+
var TimerSpec = Schema4.Struct({
|
|
737
|
+
kind: Schema4.Literal("timer").annotations(kindLiteralAnnotations),
|
|
738
|
+
cron: Schema4.String.annotations({
|
|
739
|
+
title: "Cron",
|
|
740
|
+
[SchemaAST.ExamplesAnnotationId]: [
|
|
741
|
+
"0 0 * * *"
|
|
742
|
+
]
|
|
743
|
+
})
|
|
744
|
+
});
|
|
745
|
+
var WebhookSpec = Schema4.Struct({
|
|
746
|
+
kind: Schema4.Literal("webhook").annotations(kindLiteralAnnotations),
|
|
747
|
+
method: Schema4.optional(Schema4.String.annotations({
|
|
748
|
+
title: "Method",
|
|
749
|
+
[OptionsAnnotationId]: [
|
|
750
|
+
"GET",
|
|
751
|
+
"POST"
|
|
752
|
+
]
|
|
753
|
+
})),
|
|
754
|
+
port: Schema4.optional(Schema4.Number.annotations({
|
|
755
|
+
title: "Port"
|
|
756
|
+
}))
|
|
757
|
+
});
|
|
758
|
+
var Spec = Schema4.Union(EmailSpec, QueueSpec, SubscriptionSpec, TimerSpec, WebhookSpec).annotations({
|
|
759
|
+
title: "Trigger"
|
|
760
|
+
});
|
|
761
|
+
var TriggerSchema = Schema4.Struct({
|
|
762
|
+
/**
|
|
763
|
+
* Function or workflow to invoke.
|
|
764
|
+
*/
|
|
765
|
+
// TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).
|
|
766
|
+
function: Schema4.optional(Ref2.Ref(Obj4.Unknown).annotations({
|
|
767
|
+
title: "Function"
|
|
768
|
+
})),
|
|
769
|
+
/**
|
|
770
|
+
* Only used for workflowSchema.
|
|
771
|
+
* Specifies the input node in the circuit.
|
|
772
|
+
* @deprecated Remove and enforce a single input node in all compute graphSchema.
|
|
773
|
+
*/
|
|
774
|
+
inputNodeId: Schema4.optional(Schema4.String.annotations({
|
|
775
|
+
title: "Input Node ID"
|
|
776
|
+
})),
|
|
777
|
+
// TODO(burdon): NO BOOLEAN PROPERTIES (enabld/disabled/paused, etc.)
|
|
778
|
+
// Need lint rule; or agent rule to require PR review for "boolean" key word.
|
|
779
|
+
enabled: Schema4.optional(Schema4.Boolean.annotations({
|
|
780
|
+
title: "Enabled"
|
|
781
|
+
})),
|
|
782
|
+
spec: Schema4.optional(Spec),
|
|
783
|
+
concurrency: Schema4.optional(Schema4.Number.annotations({
|
|
784
|
+
title: "Concurrency",
|
|
785
|
+
default: 1,
|
|
786
|
+
description: "Maximum number of concurrent invocations of the trigger. For Feed triggers, this will process Feed items in parallel."
|
|
787
|
+
})),
|
|
788
|
+
/**
|
|
789
|
+
* Passed as the input data to the function.
|
|
790
|
+
* Must match the function's input schema.
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* {
|
|
794
|
+
* item: '{{event.item}}',
|
|
795
|
+
* instructions: 'Summarize and perform entity-extraction'
|
|
796
|
+
* mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
|
|
797
|
+
* }
|
|
798
|
+
*/
|
|
799
|
+
input: Schema4.optional(Schema4.Record({
|
|
800
|
+
key: Schema4.String,
|
|
801
|
+
value: Schema4.Any
|
|
802
|
+
}))
|
|
803
|
+
}).pipe(Type3.object({
|
|
804
|
+
typename: "org.dxos.type.trigger",
|
|
805
|
+
version: "0.1.0"
|
|
806
|
+
}), Annotation2.IconAnnotation.set({
|
|
807
|
+
icon: "ph--lightning--regular",
|
|
808
|
+
hue: "yellow"
|
|
809
|
+
}), SystemTypeAnnotation.set(true));
|
|
810
|
+
var Trigger = TriggerSchema;
|
|
811
|
+
var make6 = (props) => Obj4.make(Trigger, props);
|
|
812
|
+
|
|
813
|
+
// src/types/TriggerEvent.ts
|
|
814
|
+
var TriggerEvent_exports = {};
|
|
815
|
+
__export(TriggerEvent_exports, {
|
|
816
|
+
EmailEvent: () => EmailEvent,
|
|
817
|
+
QueueEvent: () => QueueEvent,
|
|
818
|
+
SubscriptionEvent: () => SubscriptionEvent,
|
|
819
|
+
TimerEvent: () => TimerEvent,
|
|
820
|
+
TriggerEvent: () => TriggerEvent,
|
|
821
|
+
WebhookEvent: () => WebhookEvent
|
|
822
|
+
});
|
|
823
|
+
import * as Schema5 from "effect/Schema";
|
|
824
|
+
import { DXN as DXN2, Obj as Obj5, Ref as Ref3 } from "@dxos/echo";
|
|
825
|
+
var EmailEvent = Schema5.Struct({
|
|
826
|
+
from: Schema5.String,
|
|
827
|
+
to: Schema5.String,
|
|
828
|
+
subject: Schema5.String,
|
|
829
|
+
created: Schema5.String,
|
|
830
|
+
body: Schema5.String
|
|
831
|
+
});
|
|
832
|
+
var QueueEvent = Schema5.Struct({
|
|
833
|
+
queue: DXN2.Schema,
|
|
834
|
+
item: Schema5.Any,
|
|
835
|
+
cursor: Schema5.String
|
|
836
|
+
});
|
|
837
|
+
var SubscriptionEvent = Schema5.Struct({
|
|
838
|
+
/**
|
|
839
|
+
* Type of the mutation.
|
|
840
|
+
*/
|
|
841
|
+
// TODO(dmaretskyi): Specify enum.
|
|
842
|
+
type: Schema5.String,
|
|
843
|
+
/**
|
|
844
|
+
* Reference to the object that was changed or created.
|
|
845
|
+
*/
|
|
846
|
+
subject: Ref3.Ref(Obj5.Unknown),
|
|
847
|
+
/**
|
|
848
|
+
* @deprecated
|
|
849
|
+
*/
|
|
850
|
+
changedObjectId: Schema5.optional(Schema5.String)
|
|
851
|
+
});
|
|
852
|
+
var TimerEvent = Schema5.Struct({
|
|
853
|
+
tick: Schema5.Number
|
|
854
|
+
});
|
|
855
|
+
var WebhookEvent = Schema5.Struct({
|
|
856
|
+
url: Schema5.String,
|
|
857
|
+
method: Schema5.Literal("GET", "POST"),
|
|
858
|
+
headers: Schema5.Record({
|
|
859
|
+
key: Schema5.String,
|
|
860
|
+
value: Schema5.String
|
|
861
|
+
}),
|
|
862
|
+
bodyText: Schema5.String
|
|
863
|
+
});
|
|
864
|
+
var TriggerEvent = Schema5.Union(EmailEvent, QueueEvent, SubscriptionEvent, TimerEvent, WebhookEvent);
|
|
865
|
+
|
|
866
|
+
// src/types/url.ts
|
|
867
|
+
var FUNCTIONS_META_KEY = "org.dxos.service.function";
|
|
868
|
+
var FUNCTIONS_PRESET_META_KEY = "org.dxos.service.function-preset";
|
|
869
|
+
var getUserFunctionIdInMetadata = (meta) => {
|
|
870
|
+
return meta.keys.find((key2) => key2.source === FUNCTIONS_META_KEY)?.id;
|
|
871
|
+
};
|
|
872
|
+
var setUserFunctionIdInMetadata = (meta, functionId) => {
|
|
873
|
+
const key2 = meta.keys.find((key3) => key3.source === FUNCTIONS_META_KEY);
|
|
874
|
+
if (key2) {
|
|
875
|
+
if (key2.id !== functionId) {
|
|
876
|
+
throw new Error("Metadata mismatch");
|
|
877
|
+
}
|
|
878
|
+
} else {
|
|
879
|
+
meta.keys.push({
|
|
880
|
+
source: FUNCTIONS_META_KEY,
|
|
881
|
+
id: functionId
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
};
|
|
865
885
|
|
|
866
886
|
// src/protocol/protocol.ts
|
|
867
887
|
import * as AnthropicClient from "@effect/ai-anthropic/AnthropicClient";
|
|
868
|
-
import * as
|
|
869
|
-
import * as
|
|
870
|
-
import * as
|
|
888
|
+
import * as Effect10 from "effect/Effect";
|
|
889
|
+
import * as Layer8 from "effect/Layer";
|
|
890
|
+
import * as Schema6 from "effect/Schema";
|
|
871
891
|
import * as SchemaAST2 from "effect/SchemaAST";
|
|
872
892
|
import { AiModelResolver, AiService } from "@dxos/ai";
|
|
873
893
|
import { AnthropicResolver } from "@dxos/ai/resolvers";
|
|
874
894
|
import { LifecycleState, Resource } from "@dxos/context";
|
|
875
|
-
import { Database as Database2,
|
|
895
|
+
import { Database as Database2, Feed, JsonSchema, Ref as Ref4 } from "@dxos/echo";
|
|
896
|
+
import { EchoClient, createFeedServiceLayer as createFeedServiceLayer2 } from "@dxos/echo-db";
|
|
876
897
|
import { refFromEncodedReference } from "@dxos/echo/internal";
|
|
877
|
-
import { EchoClient } from "@dxos/echo-db";
|
|
878
898
|
import { runAndForwardErrors } from "@dxos/effect";
|
|
879
|
-
import { assertState, failedInvariant
|
|
899
|
+
import { assertState, failedInvariant, invariant as invariant2 } from "@dxos/invariant";
|
|
880
900
|
import { PublicKey } from "@dxos/keys";
|
|
901
|
+
import { Operation } from "@dxos/operation";
|
|
881
902
|
|
|
882
903
|
// src/protocol/functions-ai-http-client.ts
|
|
883
904
|
import * as Headers from "@effect/platform/Headers";
|
|
884
905
|
import * as HttpClient2 from "@effect/platform/HttpClient";
|
|
885
906
|
import * as HttpClientError from "@effect/platform/HttpClientError";
|
|
886
907
|
import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
|
|
887
|
-
import * as
|
|
908
|
+
import * as Effect9 from "effect/Effect";
|
|
888
909
|
import * as FiberRef from "effect/FiberRef";
|
|
889
|
-
import * as
|
|
910
|
+
import * as Layer7 from "effect/Layer";
|
|
890
911
|
import * as Stream from "effect/Stream";
|
|
891
|
-
import { log as
|
|
912
|
+
import { log as log2 } from "@dxos/log";
|
|
892
913
|
import { ErrorCodec } from "@dxos/protocols";
|
|
893
914
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/functions/src/protocol/functions-ai-http-client.ts";
|
|
894
915
|
var requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
|
|
@@ -897,7 +918,7 @@ var FunctionsAiHttpClient = class _FunctionsAiHttpClient {
|
|
|
897
918
|
const context = fiber.getFiberRef(FiberRef.currentContext);
|
|
898
919
|
const options = context.unsafeMap.get(requestInitTagKey) ?? {};
|
|
899
920
|
const headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers;
|
|
900
|
-
const send = (body) =>
|
|
921
|
+
const send = (body) => Effect9.tryPromise({
|
|
901
922
|
try: () => service.fetch(new Request(url, {
|
|
902
923
|
...options,
|
|
903
924
|
method: request.method,
|
|
@@ -905,7 +926,7 @@ var FunctionsAiHttpClient = class _FunctionsAiHttpClient {
|
|
|
905
926
|
body
|
|
906
927
|
})),
|
|
907
928
|
catch: (cause) => {
|
|
908
|
-
|
|
929
|
+
log2.error("Failed to fetch", {
|
|
909
930
|
errorSerialized: ErrorCodec.encode(cause)
|
|
910
931
|
}, {
|
|
911
932
|
F: __dxlog_file2,
|
|
@@ -919,7 +940,7 @@ var FunctionsAiHttpClient = class _FunctionsAiHttpClient {
|
|
|
919
940
|
cause
|
|
920
941
|
});
|
|
921
942
|
}
|
|
922
|
-
}).pipe(
|
|
943
|
+
}).pipe(Effect9.map((response) => HttpClientResponse.fromWeb(request, response)));
|
|
923
944
|
switch (request.body._tag) {
|
|
924
945
|
case "Raw":
|
|
925
946
|
case "Uint8Array":
|
|
@@ -927,11 +948,11 @@ var FunctionsAiHttpClient = class _FunctionsAiHttpClient {
|
|
|
927
948
|
case "FormData":
|
|
928
949
|
return send(request.body.formData);
|
|
929
950
|
case "Stream":
|
|
930
|
-
return Stream.toReadableStreamEffect(request.body.stream).pipe(
|
|
951
|
+
return Stream.toReadableStreamEffect(request.body.stream).pipe(Effect9.flatMap(send));
|
|
931
952
|
}
|
|
932
953
|
return send(void 0);
|
|
933
954
|
});
|
|
934
|
-
static layer = (service) =>
|
|
955
|
+
static layer = (service) => Layer7.succeed(HttpClient2.HttpClient, _FunctionsAiHttpClient.make(service));
|
|
935
956
|
};
|
|
936
957
|
|
|
937
958
|
// src/protocol/protocol.ts
|
|
@@ -974,7 +995,7 @@ function _ts_dispose_resources(env) {
|
|
|
974
995
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
975
996
|
};
|
|
976
997
|
return (_ts_dispose_resources = function _ts_dispose_resources2(env2) {
|
|
977
|
-
function
|
|
998
|
+
function fail2(e) {
|
|
978
999
|
env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
|
|
979
1000
|
env2.hasError = true;
|
|
980
1001
|
}
|
|
@@ -986,12 +1007,12 @@ function _ts_dispose_resources(env) {
|
|
|
986
1007
|
if (r.dispose) {
|
|
987
1008
|
var result = r.dispose.call(r.value);
|
|
988
1009
|
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
989
|
-
|
|
1010
|
+
fail2(e);
|
|
990
1011
|
return next();
|
|
991
1012
|
});
|
|
992
1013
|
} else s |= 1;
|
|
993
1014
|
} catch (e) {
|
|
994
|
-
|
|
1015
|
+
fail2(e);
|
|
995
1016
|
}
|
|
996
1017
|
}
|
|
997
1018
|
if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
|
|
@@ -1002,20 +1023,21 @@ function _ts_dispose_resources(env) {
|
|
|
1002
1023
|
}
|
|
1003
1024
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/core/functions/src/protocol/protocol.ts";
|
|
1004
1025
|
var wrapFunctionHandler = (func) => {
|
|
1005
|
-
if (!
|
|
1006
|
-
throw new TypeError("
|
|
1026
|
+
if (!Operation.isOperationWithHandler(func)) {
|
|
1027
|
+
throw new TypeError("Expected operation with handler");
|
|
1007
1028
|
}
|
|
1029
|
+
const serviceTags = func.services.map((service) => service.key);
|
|
1008
1030
|
return {
|
|
1009
1031
|
meta: {
|
|
1010
|
-
key: func.key,
|
|
1011
|
-
name: func.name,
|
|
1012
|
-
description: func.description,
|
|
1013
|
-
inputSchema:
|
|
1014
|
-
outputSchema: func.
|
|
1015
|
-
services: func.services
|
|
1032
|
+
key: func.meta.key,
|
|
1033
|
+
name: func.meta.name,
|
|
1034
|
+
description: func.meta.description,
|
|
1035
|
+
inputSchema: JsonSchema.toJsonSchema(func.input),
|
|
1036
|
+
outputSchema: func.output === void 0 ? void 0 : JsonSchema.toJsonSchema(func.output),
|
|
1037
|
+
services: func.services.map((service) => service.key)
|
|
1016
1038
|
},
|
|
1017
1039
|
handler: async ({ data, context }) => {
|
|
1018
|
-
if ((
|
|
1040
|
+
if ((serviceTags.includes(Database2.Service.key) || serviceTags.includes(QueueService.key) || serviceTags.includes(Feed.FeedService.key)) && (!context.services.dataService || !context.services.queryService)) {
|
|
1019
1041
|
throw new FunctionError({
|
|
1020
1042
|
message: "Services not provided: dataService, queryService"
|
|
1021
1043
|
});
|
|
@@ -1027,9 +1049,9 @@ var wrapFunctionHandler = (func) => {
|
|
|
1027
1049
|
hasError: false
|
|
1028
1050
|
};
|
|
1029
1051
|
try {
|
|
1030
|
-
if (!SchemaAST2.isAnyKeyword(func.
|
|
1052
|
+
if (!SchemaAST2.isAnyKeyword(func.input.ast)) {
|
|
1031
1053
|
try {
|
|
1032
|
-
|
|
1054
|
+
Schema6.validateSync(func.input)(data);
|
|
1033
1055
|
} catch (error) {
|
|
1034
1056
|
throw new FunctionError({
|
|
1035
1057
|
message: "Invalid input schema",
|
|
@@ -1041,7 +1063,7 @@ var wrapFunctionHandler = (func) => {
|
|
|
1041
1063
|
if (func.types.length > 0) {
|
|
1042
1064
|
invariant2(funcContext.db, "Database is required for functions with types", {
|
|
1043
1065
|
F: __dxlog_file3,
|
|
1044
|
-
L:
|
|
1066
|
+
L: 73,
|
|
1045
1067
|
S: void 0,
|
|
1046
1068
|
A: [
|
|
1047
1069
|
"funcContext.db",
|
|
@@ -1050,17 +1072,13 @@ var wrapFunctionHandler = (func) => {
|
|
|
1050
1072
|
});
|
|
1051
1073
|
await funcContext.db.graph.schemaRegistry.register(func.types);
|
|
1052
1074
|
}
|
|
1053
|
-
const dataWithDecodedRefs = funcContext.db && !SchemaAST2.isAnyKeyword(func.
|
|
1054
|
-
let result = await func.handler(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
data: dataWithDecodedRefs
|
|
1058
|
-
});
|
|
1059
|
-
if (Effect11.isEffect(result)) {
|
|
1060
|
-
result = await runAndForwardErrors(result.pipe(Effect11.orDie, Effect11.provide(funcContext.createLayer())));
|
|
1075
|
+
const dataWithDecodedRefs = funcContext.db && !SchemaAST2.isAnyKeyword(func.input.ast) ? decodeRefsFromSchema(func.input.ast, data, funcContext.db) : data;
|
|
1076
|
+
let result = await func.handler(dataWithDecodedRefs);
|
|
1077
|
+
if (Effect10.isEffect(result)) {
|
|
1078
|
+
result = await runAndForwardErrors(result.pipe(Effect10.orDie, Effect10.provide(funcContext.createLayer())));
|
|
1061
1079
|
}
|
|
1062
|
-
if (func.
|
|
1063
|
-
|
|
1080
|
+
if (func.output && !SchemaAST2.isAnyKeyword(func.output.ast)) {
|
|
1081
|
+
Schema6.validateSync(func.output)(result);
|
|
1064
1082
|
}
|
|
1065
1083
|
return result;
|
|
1066
1084
|
} catch (e) {
|
|
@@ -1095,12 +1113,12 @@ var FunctionContext = class extends Resource {
|
|
|
1095
1113
|
async _open() {
|
|
1096
1114
|
await this.client?.open();
|
|
1097
1115
|
this.db = this.client && this.context.spaceId ? this.client.constructDatabase({
|
|
1098
|
-
spaceId: this.context.spaceId ??
|
|
1099
|
-
spaceKey: PublicKey.fromHex(this.context.spaceKey ??
|
|
1116
|
+
spaceId: this.context.spaceId ?? failedInvariant(),
|
|
1117
|
+
spaceKey: PublicKey.fromHex(this.context.spaceKey ?? failedInvariant("spaceKey missing in context")),
|
|
1100
1118
|
reactiveSchemaQuery: false,
|
|
1101
1119
|
preloadSchemaOnOpen: false
|
|
1102
1120
|
}) : void 0;
|
|
1103
|
-
await this.db?.setSpaceRoot(this.context.spaceRootUrl ??
|
|
1121
|
+
await this.db?.setSpaceRoot(this.context.spaceRootUrl ?? failedInvariant("spaceRootUrl missing in context"));
|
|
1104
1122
|
await this.db?.open();
|
|
1105
1123
|
this.queues = this.client && this.context.spaceId ? this.client.constructQueueFactory(this.context.spaceId) : void 0;
|
|
1106
1124
|
}
|
|
@@ -1110,31 +1128,41 @@ var FunctionContext = class extends Resource {
|
|
|
1110
1128
|
}
|
|
1111
1129
|
createLayer() {
|
|
1112
1130
|
assertState(this._lifecycleState === LifecycleState.OPEN, "FunctionContext is not open");
|
|
1113
|
-
const dbLayer = this.db ? Database2.
|
|
1131
|
+
const dbLayer = this.db ? Database2.layer(this.db) : Database2.notAvailable;
|
|
1114
1132
|
const queuesLayer = this.queues ? QueueService.layer(this.queues) : QueueService.notAvailable;
|
|
1133
|
+
const feedLayer = this.queues ? createFeedServiceLayer2(this.queues) : Feed.notAvailable;
|
|
1115
1134
|
const credentials = dbLayer ? CredentialsService.layerFromDatabase({
|
|
1116
1135
|
caching: true
|
|
1117
|
-
}).pipe(
|
|
1136
|
+
}).pipe(Layer8.provide(dbLayer)) : CredentialsService.configuredLayer([]);
|
|
1118
1137
|
const functionInvocationService = MockedFunctionInvocationService;
|
|
1119
1138
|
const tracing = TracingService.layerNoop;
|
|
1120
|
-
const aiLayer = this.context.services.functionsAiService ? AiModelResolver.AiModelResolver.buildAiService.pipe(
|
|
1139
|
+
const aiLayer = this.context.services.functionsAiService ? AiModelResolver.AiModelResolver.buildAiService.pipe(Layer8.provide(AnthropicResolver.make().pipe(Layer8.provide(AnthropicClient.layer({
|
|
1121
1140
|
// Note: It doesn't matter what is base url here, it will be proxied to ai gateway in edge.
|
|
1122
1141
|
apiUrl: "http://internal/provider/anthropic"
|
|
1123
|
-
}).pipe(
|
|
1124
|
-
return
|
|
1142
|
+
}).pipe(Layer8.provide(FunctionsAiHttpClient.layer(this.context.services.functionsAiService))))))) : AiService.notAvailable;
|
|
1143
|
+
return Layer8.mergeAll(
|
|
1144
|
+
dbLayer,
|
|
1145
|
+
queuesLayer,
|
|
1146
|
+
feedLayer,
|
|
1147
|
+
credentials,
|
|
1148
|
+
functionInvocationService,
|
|
1149
|
+
aiLayer,
|
|
1150
|
+
tracing,
|
|
1151
|
+
writerLayerNoop
|
|
1152
|
+
);
|
|
1125
1153
|
}
|
|
1126
1154
|
};
|
|
1127
|
-
var MockedFunctionInvocationService =
|
|
1128
|
-
invokeFunction: () =>
|
|
1129
|
-
resolveFunction: () =>
|
|
1155
|
+
var MockedFunctionInvocationService = Layer8.succeed(FunctionInvocationService, {
|
|
1156
|
+
invokeFunction: () => Effect10.die("Calling functions from functions is not implemented yet."),
|
|
1157
|
+
resolveFunction: () => Effect10.die("Not implemented.")
|
|
1130
1158
|
});
|
|
1131
1159
|
var decodeRefsFromSchema = (ast, value2, db) => {
|
|
1132
1160
|
if (value2 == null) {
|
|
1133
1161
|
return value2;
|
|
1134
1162
|
}
|
|
1135
1163
|
const encoded = SchemaAST2.encodedBoundAST(ast);
|
|
1136
|
-
if (
|
|
1137
|
-
if (
|
|
1164
|
+
if (Ref4.isRefType(encoded)) {
|
|
1165
|
+
if (Ref4.isRef(value2)) {
|
|
1138
1166
|
return value2;
|
|
1139
1167
|
}
|
|
1140
1168
|
if (typeof value2 === "object" && value2 !== null && typeof value2["/"] === "string") {
|
|
@@ -1156,9 +1184,9 @@ var decodeRefsFromSchema = (ast, value2, db) => {
|
|
|
1156
1184
|
...value2
|
|
1157
1185
|
};
|
|
1158
1186
|
for (const prop of SchemaAST2.getPropertySignatures(encoded)) {
|
|
1159
|
-
const
|
|
1160
|
-
if (
|
|
1161
|
-
result[
|
|
1187
|
+
const key2 = prop.name.toString();
|
|
1188
|
+
if (key2 in result) {
|
|
1189
|
+
result[key2] = decodeRefsFromSchema(prop.type, result[key2], db);
|
|
1162
1190
|
}
|
|
1163
1191
|
}
|
|
1164
1192
|
return result;
|
|
@@ -1198,32 +1226,41 @@ export {
|
|
|
1198
1226
|
ConfiguredCredentialsService,
|
|
1199
1227
|
ContextQueueService,
|
|
1200
1228
|
CredentialsService,
|
|
1201
|
-
|
|
1229
|
+
ExampleHandlers,
|
|
1202
1230
|
FUNCTIONS_META_KEY,
|
|
1203
1231
|
FUNCTIONS_PRESET_META_KEY,
|
|
1204
|
-
|
|
1205
|
-
FunctionDefinition,
|
|
1232
|
+
Fibonacci,
|
|
1206
1233
|
FunctionError,
|
|
1207
1234
|
FunctionInvocationService,
|
|
1208
1235
|
FunctionNotFoundError,
|
|
1209
1236
|
MESSAGE_PROPERTY_TOOL_CALL_ID,
|
|
1237
|
+
Process_exports as Process,
|
|
1210
1238
|
QueueService,
|
|
1239
|
+
Reply,
|
|
1211
1240
|
Script_exports as Script,
|
|
1212
1241
|
ServiceNotAvailableError,
|
|
1242
|
+
ServiceResolver_exports as ServiceResolver,
|
|
1243
|
+
Sleep,
|
|
1244
|
+
StorageService,
|
|
1245
|
+
Trace_exports as Trace,
|
|
1213
1246
|
TracingService,
|
|
1214
1247
|
Trigger_exports as Trigger,
|
|
1215
1248
|
TriggerEvent_exports as TriggerEvent,
|
|
1216
1249
|
TriggerStateNotFoundError,
|
|
1250
|
+
clear,
|
|
1217
1251
|
createDefectLogger,
|
|
1218
1252
|
createEventLogger,
|
|
1219
|
-
|
|
1220
|
-
|
|
1253
|
+
deleteKey,
|
|
1254
|
+
feedServiceFromQueueServiceLayer,
|
|
1255
|
+
get,
|
|
1221
1256
|
getUserFunctionIdInMetadata,
|
|
1257
|
+
key,
|
|
1258
|
+
list,
|
|
1222
1259
|
logCustomEvent,
|
|
1223
|
-
|
|
1260
|
+
set,
|
|
1224
1261
|
setUserFunctionIdInMetadata,
|
|
1225
|
-
toOperation,
|
|
1226
1262
|
withAuthorization,
|
|
1263
|
+
withDefault,
|
|
1227
1264
|
wrapFunctionHandler
|
|
1228
1265
|
};
|
|
1229
1266
|
//# sourceMappingURL=index.mjs.map
|