@ultrst-armada/kloks 1.21.1 → 1.22.0
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/.krusbl-release-attestation.json +3 -3
- package/package.json +4 -4
- package/packages/audio-midi/dist/{audioClipEngine-BOT33JKI.js → audioClipEngine-E5ODQNYR.js} +3 -2
- package/packages/audio-midi/dist/{audioInputManager-BLDGGLAR.js → audioInputManager-OOH3TOJ6.js} +2 -1
- package/packages/audio-midi/dist/{chunk-N55BWOC6.js → chunk-2U7VIADS.js} +1 -1
- package/packages/audio-midi/dist/{chunk-3GRGELA4.js → chunk-3FXNT6PF.js} +2 -2
- package/packages/audio-midi/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/audio-midi/dist/dist-XMSSRYDR.js +899 -0
- package/packages/audio-midi/dist/index.js +534 -75
- package/packages/audio-midi/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/audio-midi/package.json +1 -1
- package/packages/backend/dist/ai-inference/index.js +1 -0
- package/packages/backend/dist/ai-keys/index.js +1 -0
- package/packages/backend/dist/ai-models/index.js +1 -0
- package/packages/backend/dist/ai-provider/index.js +1 -0
- package/packages/backend/dist/ai-routing/index.js +1 -0
- package/packages/backend/dist/ai-tools/index.js +1 -0
- package/packages/backend/dist/api/index.js +1 -0
- package/packages/backend/dist/auth/index.js +1 -0
- package/packages/backend/dist/{chunk-RBF2OGMC.js → chunk-B3VJ4HDV.js} +4 -15
- package/packages/backend/dist/{chunk-OYVHKYJW.js → chunk-IJ5QNZCY.js} +1 -1
- package/packages/backend/dist/chunk-MWSYNRNZ.js +871 -0
- package/packages/backend/dist/{chunk-LCRK2QSY.js → chunk-NB2X3HEX.js} +13 -1
- package/packages/backend/dist/{chunk-KPLQLZHB.js → chunk-OB65KZ2M.js} +1 -1
- package/packages/backend/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/backend/dist/client/index.js +1 -0
- package/packages/backend/dist/connectivity/index.js +1 -0
- package/packages/backend/dist/control-plane/index.js +1 -0
- package/packages/backend/dist/development/index.js +3 -2
- package/packages/backend/dist/dist-XMSSRYDR.js +899 -0
- package/packages/backend/dist/index.js +14 -13
- package/packages/backend/dist/krnl-ai-services.js +3 -2
- package/packages/backend/dist/krnl-services.d.ts +8 -0
- package/packages/backend/dist/krnl-services.js +3 -2
- package/packages/backend/dist/services/index.d.ts +2 -3
- package/packages/backend/dist/services/index.js +3 -2
- package/packages/backend/dist/srkl/index.js +1 -0
- package/packages/backend/dist/storage/index.js +1 -0
- package/packages/backend/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/backend/dist/workspace/index.js +1 -0
- package/packages/backend/package.json +5 -5
- package/packages/client/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/fod/package.json +24 -13
- package/packages/functions/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/functions/dist/dist-XMSSRYDR.js +899 -0
- package/packages/functions/dist/index.d.ts +2 -0
- package/packages/functions/dist/index.js +581 -94
- package/packages/functions/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/functions/package.json +1 -1
- package/packages/orchestrations/package.json +3 -3
- package/packages/services/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/services/dist/dist-XMSSRYDR.js +899 -0
- package/packages/services/dist/index.d.ts +55 -8
- package/packages/services/dist/index.js +640 -85
- package/packages/services/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/services/package.json +1 -1
- package/packages/state-graph/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/state-graph/dist/dist-XMSSRYDR.js +899 -0
- package/packages/state-graph/dist/domain/index.js +1 -0
- package/packages/state-graph/dist/index.js +602 -119
- package/packages/state-graph/dist/rules/index.js +1 -0
- package/packages/state-graph/dist/spatial/index.js +1 -0
- package/packages/state-graph/dist/state/index.js +1 -0
- package/packages/state-graph/dist/store/index.js +1 -0
- package/packages/state-graph/dist/transformers.node-HWHOAE4H.js +43879 -0
- package/packages/state-graph/package.json +1 -1
- package/packages/backend/dist/chunk-TY32TUNI.js +0 -376
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@ultrst-armada+krnl@1.0.3/node_modules/@ultrst-armada/krnl/packages/core/dist/index.js
|
|
2
|
-
var ServiceStateStore = class {
|
|
3
|
-
state;
|
|
4
|
-
listeners = /* @__PURE__ */ new Set();
|
|
5
|
-
constructor(initialState) {
|
|
6
|
-
this.state = { ...initialState };
|
|
7
|
-
}
|
|
8
|
-
getState() {
|
|
9
|
-
return Object.freeze({ ...this.state });
|
|
10
|
-
}
|
|
11
|
-
setState(mutation) {
|
|
12
|
-
this.state = { ...this.state, ...mutation };
|
|
13
|
-
const snapshot = this.getState();
|
|
14
|
-
for (const listener of this.listeners) {
|
|
15
|
-
listener(snapshot, mutation);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
subscribe(listener) {
|
|
19
|
-
this.listeners.add(listener);
|
|
20
|
-
return () => {
|
|
21
|
-
this.listeners.delete(listener);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
reset(newState) {
|
|
25
|
-
this.state = { ...newState || {} };
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var ServiceEventBus = class {
|
|
29
|
-
handlers = /* @__PURE__ */ new Map();
|
|
30
|
-
on(event, handler) {
|
|
31
|
-
if (!this.handlers.has(event)) {
|
|
32
|
-
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
33
|
-
}
|
|
34
|
-
const set = this.handlers.get(event);
|
|
35
|
-
set.add(handler);
|
|
36
|
-
return () => {
|
|
37
|
-
set.delete(handler);
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
emit(event, payload) {
|
|
41
|
-
const set = this.handlers.get(event);
|
|
42
|
-
if (!set) return;
|
|
43
|
-
for (const handler of Array.from(set)) {
|
|
44
|
-
try {
|
|
45
|
-
handler(payload);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
console.error(`[ServiceEventBus] Handler error for '${event}':`, err);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
clear() {
|
|
52
|
-
this.handlers.clear();
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var TRANSITIONS = {
|
|
56
|
-
uninitialized: ["initializing"],
|
|
57
|
-
initializing: ["ready", "uninitialized"],
|
|
58
|
-
ready: ["starting"],
|
|
59
|
-
starting: ["running", "ready"],
|
|
60
|
-
running: ["stopping"],
|
|
61
|
-
stopping: ["stopped", "running"],
|
|
62
|
-
stopped: ["starting"]
|
|
63
|
-
};
|
|
64
|
-
var LifecycleManager = class {
|
|
65
|
-
status = "uninitialized";
|
|
66
|
-
getStatus() {
|
|
67
|
-
return this.status;
|
|
68
|
-
}
|
|
69
|
-
canTransitionTo(next) {
|
|
70
|
-
return TRANSITIONS[this.status].includes(next);
|
|
71
|
-
}
|
|
72
|
-
transitionTo(next) {
|
|
73
|
-
if (!this.canTransitionTo(next)) {
|
|
74
|
-
throw new Error("[Lifecycle] Invalid transition '" + this.status + "' -> '" + next + "'.");
|
|
75
|
-
}
|
|
76
|
-
this.status = next;
|
|
77
|
-
}
|
|
78
|
-
setStatus(next) {
|
|
79
|
-
this.transitionTo(next);
|
|
80
|
-
}
|
|
81
|
-
assertRunning(serviceName) {
|
|
82
|
-
if (this.status !== "running") {
|
|
83
|
-
throw new Error(
|
|
84
|
-
"[Service:" + serviceName + "] Cannot invoke operation while status is '" + this.status + "' (expected 'running')."
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
var ServiceInstance = class {
|
|
90
|
-
constructor(definition) {
|
|
91
|
-
this.definition = definition;
|
|
92
|
-
this.id = definition.id;
|
|
93
|
-
this.name = definition.name;
|
|
94
|
-
this.version = definition.version;
|
|
95
|
-
this.lifecycle = new LifecycleManager();
|
|
96
|
-
this.eventBus = new ServiceEventBus();
|
|
97
|
-
if (definition.state) {
|
|
98
|
-
this.stateStore = new ServiceStateStore(definition.state.initial);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
definition;
|
|
102
|
-
id;
|
|
103
|
-
name;
|
|
104
|
-
version;
|
|
105
|
-
stateStore;
|
|
106
|
-
eventBus;
|
|
107
|
-
lifecycle;
|
|
108
|
-
initialized = false;
|
|
109
|
-
disposed = false;
|
|
110
|
-
getDefinition() {
|
|
111
|
-
return this.definition;
|
|
112
|
-
}
|
|
113
|
-
getStatus() {
|
|
114
|
-
return this.lifecycle.getStatus();
|
|
115
|
-
}
|
|
116
|
-
async start() {
|
|
117
|
-
if (this.disposed) throw new Error("[Service:" + this.name + "] Cannot start a disposed service.");
|
|
118
|
-
const current = this.lifecycle.getStatus();
|
|
119
|
-
if (current === "running") return;
|
|
120
|
-
if (current === "initializing" || current === "starting" || current === "stopping") {
|
|
121
|
-
throw new Error("[Service:" + this.name + "] Cannot start while status is '" + current + "'.");
|
|
122
|
-
}
|
|
123
|
-
if (!this.initialized) {
|
|
124
|
-
this.lifecycle.transitionTo("initializing");
|
|
125
|
-
try {
|
|
126
|
-
await this.definition.lifecycle?.onInit?.();
|
|
127
|
-
this.initialized = true;
|
|
128
|
-
this.lifecycle.transitionTo("ready");
|
|
129
|
-
} catch (error) {
|
|
130
|
-
this.lifecycle.transitionTo("uninitialized");
|
|
131
|
-
throw error;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
this.lifecycle.transitionTo("starting");
|
|
135
|
-
try {
|
|
136
|
-
await this.definition.lifecycle?.onStart?.();
|
|
137
|
-
this.lifecycle.transitionTo("running");
|
|
138
|
-
} catch (error) {
|
|
139
|
-
this.lifecycle.transitionTo("ready");
|
|
140
|
-
throw error;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async stop() {
|
|
144
|
-
const current = this.lifecycle.getStatus();
|
|
145
|
-
if (current === "stopped") return;
|
|
146
|
-
if (current !== "running") {
|
|
147
|
-
throw new Error("[Service:" + this.name + "] Cannot stop while status is '" + current + "'.");
|
|
148
|
-
}
|
|
149
|
-
this.lifecycle.transitionTo("stopping");
|
|
150
|
-
try {
|
|
151
|
-
await this.definition.lifecycle?.onStop?.();
|
|
152
|
-
this.lifecycle.transitionTo("stopped");
|
|
153
|
-
} catch (error) {
|
|
154
|
-
this.lifecycle.transitionTo("running");
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
async dispose() {
|
|
159
|
-
if (this.disposed) return;
|
|
160
|
-
if (this.lifecycle.getStatus() === "running") await this.stop();
|
|
161
|
-
await this.definition.lifecycle?.onDispose?.();
|
|
162
|
-
this.disposed = true;
|
|
163
|
-
}
|
|
164
|
-
async call(op, input, ctx = {}) {
|
|
165
|
-
this.lifecycle.assertRunning(this.name);
|
|
166
|
-
const operation = this.definition.operations[op];
|
|
167
|
-
if (!operation) {
|
|
168
|
-
throw new Error("[Service:" + this.name + "] Operation '" + op + "' not found.");
|
|
169
|
-
}
|
|
170
|
-
return await operation.handler(input, ctx);
|
|
171
|
-
}
|
|
172
|
-
getState() {
|
|
173
|
-
return this.stateStore?.getState() ?? Object.freeze({});
|
|
174
|
-
}
|
|
175
|
-
setState(mutation) {
|
|
176
|
-
if (!this.stateStore) {
|
|
177
|
-
this.stateStore = new ServiceStateStore({ ...mutation });
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
this.stateStore.setState(mutation);
|
|
181
|
-
}
|
|
182
|
-
on(event, handler) {
|
|
183
|
-
return this.eventBus.on(event, handler);
|
|
184
|
-
}
|
|
185
|
-
emit(event, payload) {
|
|
186
|
-
this.eventBus.emit(event, payload);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var ServiceProxy = class {
|
|
190
|
-
constructor(definition, adapter, endpoint) {
|
|
191
|
-
this.definition = definition;
|
|
192
|
-
this.adapter = adapter;
|
|
193
|
-
this.endpoint = endpoint;
|
|
194
|
-
if (!definition) {
|
|
195
|
-
throw new Error("[ServiceProxy] Missing service definition.");
|
|
196
|
-
}
|
|
197
|
-
if (!adapter || typeof adapter.send !== "function") {
|
|
198
|
-
throw new Error("[ServiceProxy:" + (definition.name || "unknown") + "] Missing or invalid protocol adapter.");
|
|
199
|
-
}
|
|
200
|
-
if (!endpoint || typeof endpoint.address !== "string" || endpoint.address.length === 0) {
|
|
201
|
-
throw new Error("[ServiceProxy:" + (definition.name || "unknown") + "] Missing or invalid endpoint descriptor.");
|
|
202
|
-
}
|
|
203
|
-
this.id = definition.id;
|
|
204
|
-
this.name = definition.name;
|
|
205
|
-
this.version = definition.version;
|
|
206
|
-
this.stateCache = { ...definition.state?.initial ?? {} };
|
|
207
|
-
}
|
|
208
|
-
definition;
|
|
209
|
-
adapter;
|
|
210
|
-
endpoint;
|
|
211
|
-
id;
|
|
212
|
-
name;
|
|
213
|
-
version;
|
|
214
|
-
stateCache;
|
|
215
|
-
eventHandlers = /* @__PURE__ */ new Map();
|
|
216
|
-
lifecycle = new LifecycleManager();
|
|
217
|
-
disposed = false;
|
|
218
|
-
getDefinition() {
|
|
219
|
-
return this.definition;
|
|
220
|
-
}
|
|
221
|
-
getStatus() {
|
|
222
|
-
return this.lifecycle.getStatus();
|
|
223
|
-
}
|
|
224
|
-
async start() {
|
|
225
|
-
if (this.disposed) {
|
|
226
|
-
throw new Error("[ServiceProxy:" + this.name + "] Cannot start a disposed service proxy.");
|
|
227
|
-
}
|
|
228
|
-
const status = this.lifecycle.getStatus();
|
|
229
|
-
if (status === "running") return;
|
|
230
|
-
if (status === "stopping" || status === "starting" || status === "initializing") {
|
|
231
|
-
throw new Error("[ServiceProxy:" + this.name + "] Cannot start while status is '" + status + "'.");
|
|
232
|
-
}
|
|
233
|
-
if (status === "uninitialized") {
|
|
234
|
-
this.lifecycle.transitionTo("initializing");
|
|
235
|
-
this.lifecycle.transitionTo("ready");
|
|
236
|
-
}
|
|
237
|
-
this.lifecycle.transitionTo("starting");
|
|
238
|
-
this.lifecycle.transitionTo("running");
|
|
239
|
-
}
|
|
240
|
-
async stop() {
|
|
241
|
-
const status = this.lifecycle.getStatus();
|
|
242
|
-
if (status === "stopped") return;
|
|
243
|
-
if (status !== "running") {
|
|
244
|
-
throw new Error("[ServiceProxy:" + this.name + "] Cannot stop while status is '" + status + "'.");
|
|
245
|
-
}
|
|
246
|
-
this.lifecycle.transitionTo("stopping");
|
|
247
|
-
this.lifecycle.transitionTo("stopped");
|
|
248
|
-
}
|
|
249
|
-
async dispose() {
|
|
250
|
-
if (this.disposed) return;
|
|
251
|
-
if (this.lifecycle.getStatus() === "running") await this.stop();
|
|
252
|
-
this.disposed = true;
|
|
253
|
-
}
|
|
254
|
-
async call(op, input, ctx = {}) {
|
|
255
|
-
if (!this.definition.operations[op]) {
|
|
256
|
-
throw new Error("[ServiceProxy:" + this.name + "] Operation '" + op + "' not found.");
|
|
257
|
-
}
|
|
258
|
-
if (this.lifecycle.getStatus() !== "running") {
|
|
259
|
-
await this.start();
|
|
260
|
-
}
|
|
261
|
-
if (!this.adapter.send) {
|
|
262
|
-
throw new Error("[ServiceProxy:" + this.name + "] Adapter does not support send().");
|
|
263
|
-
}
|
|
264
|
-
const envelope = {
|
|
265
|
-
id: "req-" + Date.now() + "-" + Math.random().toString(36).slice(2, 7),
|
|
266
|
-
type: "request",
|
|
267
|
-
operation: op,
|
|
268
|
-
payload: input,
|
|
269
|
-
timestamp: Date.now()
|
|
270
|
-
};
|
|
271
|
-
const response = await this.adapter.send(this.endpoint, envelope);
|
|
272
|
-
if (response.error) {
|
|
273
|
-
throw new Error("[ServiceProxy:" + this.name + "] Remote error: " + response.error);
|
|
274
|
-
}
|
|
275
|
-
return response.payload;
|
|
276
|
-
}
|
|
277
|
-
getState() {
|
|
278
|
-
return Object.freeze({ ...this.stateCache });
|
|
279
|
-
}
|
|
280
|
-
setState(mutation) {
|
|
281
|
-
this.stateCache = { ...this.stateCache, ...mutation };
|
|
282
|
-
}
|
|
283
|
-
on(event, handler) {
|
|
284
|
-
if (!this.eventHandlers.has(event)) this.eventHandlers.set(event, /* @__PURE__ */ new Set());
|
|
285
|
-
const handlers = this.eventHandlers.get(event);
|
|
286
|
-
handlers.add(handler);
|
|
287
|
-
return () => handlers.delete(handler);
|
|
288
|
-
}
|
|
289
|
-
emit(event, payload) {
|
|
290
|
-
const handlers = this.eventHandlers.get(event);
|
|
291
|
-
if (!handlers) return;
|
|
292
|
-
for (const handler of Array.from(handlers)) {
|
|
293
|
-
try {
|
|
294
|
-
handler(payload);
|
|
295
|
-
} catch (error) {
|
|
296
|
-
console.error("[ServiceProxy:" + this.name + "] Event handler error for '" + event + "':", error);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
function assertRecord(value, field) {
|
|
302
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
303
|
-
throw new Error("[KrnlTS] Invalid service definition: '" + field + "' must be an object.");
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
function assertNonEmptyString(value, field) {
|
|
307
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
308
|
-
throw new Error("[KrnlTS] Invalid service definition: '" + field + "' must be a non-empty string.");
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
function validateServiceDefinition(definition) {
|
|
312
|
-
if (!definition || typeof definition !== "object") {
|
|
313
|
-
throw new Error("[KrnlTS] Invalid service definition: expected an object.");
|
|
314
|
-
}
|
|
315
|
-
assertNonEmptyString(definition.id, "id");
|
|
316
|
-
assertNonEmptyString(definition.name, "name");
|
|
317
|
-
assertNonEmptyString(definition.version, "version");
|
|
318
|
-
if (!definition.operations || typeof definition.operations !== "object") {
|
|
319
|
-
throw new Error("[Service:" + definition.name + "] Invalid operations: expected an object.");
|
|
320
|
-
}
|
|
321
|
-
for (const [key, operation] of Object.entries(definition.operations)) {
|
|
322
|
-
if (!operation || typeof operation !== "object") {
|
|
323
|
-
throw new Error("[Service:" + definition.name + "] Invalid operation '" + key + "'.");
|
|
324
|
-
}
|
|
325
|
-
assertNonEmptyString(operation.id, "operations." + key + ".id");
|
|
326
|
-
assertNonEmptyString(operation.name, "operations." + key + ".name");
|
|
327
|
-
if (operation.inputSchema !== void 0) assertRecord(operation.inputSchema, "operations." + key + ".inputSchema");
|
|
328
|
-
if (operation.outputSchema !== void 0) assertRecord(operation.outputSchema, "operations." + key + ".outputSchema");
|
|
329
|
-
if (typeof operation.handler !== "function") {
|
|
330
|
-
throw new Error("[Service:" + definition.name + "] Operation '" + key + "' must define a handler.");
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
for (const [key, event] of Object.entries(definition.events ?? {})) {
|
|
334
|
-
if (!event || typeof event !== "object") {
|
|
335
|
-
throw new Error("[Service:" + definition.name + "] Invalid event '" + key + "'.");
|
|
336
|
-
}
|
|
337
|
-
assertNonEmptyString(event.name, "events." + key + ".name");
|
|
338
|
-
}
|
|
339
|
-
for (const [key, schema] of Object.entries(definition.inputs ?? {})) assertRecord(schema, "inputs." + key);
|
|
340
|
-
for (const [key, schema] of Object.entries(definition.outputs ?? {})) assertRecord(schema, "outputs." + key);
|
|
341
|
-
if (definition.state?.schema !== void 0) assertRecord(definition.state.schema, "state.schema");
|
|
342
|
-
for (const capability of definition.capabilities ?? []) {
|
|
343
|
-
assertNonEmptyString(capability.id, "capability.id");
|
|
344
|
-
assertNonEmptyString(capability.name, "capability.name");
|
|
345
|
-
if (!Array.isArray(capability.protocols)) {
|
|
346
|
-
throw new Error("[Service:" + definition.name + "] Capability '" + capability.name + "' protocols must be an array.");
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
for (const dependency of definition.dependencies ?? []) {
|
|
350
|
-
assertNonEmptyString(dependency.serviceId, "dependency.serviceId");
|
|
351
|
-
}
|
|
352
|
-
return definition;
|
|
353
|
-
}
|
|
354
|
-
function createServiceDefinition(definition) {
|
|
355
|
-
return validateServiceDefinition(definition);
|
|
356
|
-
}
|
|
357
|
-
function createService(definition) {
|
|
358
|
-
return new ServiceInstance(validateServiceDefinition(definition));
|
|
359
|
-
}
|
|
360
|
-
function createServiceProxy(definition, adapter, endpoint) {
|
|
361
|
-
validateServiceDefinition(definition);
|
|
362
|
-
if (!adapter || typeof adapter.send !== "function") {
|
|
363
|
-
throw new Error("[ServiceProxy:" + definition.name + "] Adapter must implement send().");
|
|
364
|
-
}
|
|
365
|
-
if (!endpoint || typeof endpoint.address !== "string" || endpoint.address.length === 0) {
|
|
366
|
-
throw new Error("[ServiceProxy:" + definition.name + "] Endpoint must have an address.");
|
|
367
|
-
}
|
|
368
|
-
return new ServiceProxy(definition, adapter, endpoint);
|
|
369
|
-
}
|
|
370
|
-
var asyncHooks = globalThis.process?.getBuiltinModule?.("node:async_hooks");
|
|
371
|
-
|
|
372
|
-
export {
|
|
373
|
-
createServiceDefinition,
|
|
374
|
-
createService,
|
|
375
|
-
createServiceProxy
|
|
376
|
-
};
|