brass-runtime 1.14.0 → 1.16.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/README.md +410 -135
- package/dist/agent/cli/main.cjs +49 -43
- package/dist/agent/cli/main.js +11 -5
- package/dist/agent/cli/main.mjs +11 -5
- package/dist/agent/index.cjs +8 -3
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -2
- package/dist/agent/index.mjs +7 -2
- package/dist/{chunk-BMRF4FN6.js → chunk-2WC63LJK.mjs} +68 -242
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-45F7OKGT.cjs +104 -0
- package/dist/chunk-5YOQOXEQ.cjs +2491 -0
- package/dist/chunk-7HUOJA4W.cjs +493 -0
- package/dist/{chunk-4N2JEK4H.mjs → chunk-7LVI2GIN.js} +252 -495
- package/dist/chunk-7TL2LHQJ.js +2491 -0
- package/dist/chunk-7V4KY4RL.mjs +104 -0
- package/dist/chunk-7XOPAB5Q.js +2143 -0
- package/dist/chunk-CCKHV5BT.mjs +193 -0
- package/dist/chunk-CY33PGEX.mjs +1110 -0
- package/dist/chunk-DJQ7OMMB.cjs +144 -0
- package/dist/chunk-F5EUMJL7.mjs +2143 -0
- package/dist/chunk-FM4W4QPL.js +193 -0
- package/dist/chunk-G3XGCZDQ.js +131 -0
- package/dist/{chunk-JT7D6M5H.js → chunk-G6IQOE4P.mjs} +252 -495
- package/dist/chunk-GOV47PPB.mjs +552 -0
- package/dist/chunk-H55LI6WY.js +93 -0
- package/dist/chunk-IJT6RRQ5.cjs +93 -0
- package/dist/chunk-J3H54ZRV.mjs +131 -0
- package/dist/chunk-JF4XXPZ5.cjs +552 -0
- package/dist/chunk-JNFRRJYH.cjs +2143 -0
- package/dist/chunk-JX3LZQJH.cjs +354 -0
- package/dist/chunk-K2T3DV26.mjs +93 -0
- package/dist/chunk-KCPT2D6G.js +552 -0
- package/dist/chunk-MWXMNYJS.cjs +1110 -0
- package/dist/{chunk-XTMZTVIT.cjs → chunk-N6VHMOWB.cjs} +140 -134
- package/dist/{chunk-WJESVBWN.js → chunk-NC5SDRYE.js} +16 -10
- package/dist/chunk-NOYZIMUJ.mjs +144 -0
- package/dist/chunk-NYL4D7SK.cjs +131 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/{chunk-UWMMYKVK.mjs → chunk-OOGJ73B6.js} +68 -242
- package/dist/chunk-PNVFW245.js +144 -0
- package/dist/chunk-PRWCB3QL.mjs +2491 -0
- package/dist/chunk-QY5FKYEQ.js +1110 -0
- package/dist/chunk-ROJC3NBJ.js +104 -0
- package/dist/chunk-SPUEME2B.cjs +343 -0
- package/dist/chunk-TDVMADDN.js +343 -0
- package/dist/chunk-TVN5I4U6.cjs +193 -0
- package/dist/chunk-U5KWK3PX.mjs +343 -0
- package/dist/chunk-VFIUZG7J.mjs +354 -0
- package/dist/{chunk-BKBFSOGT.cjs → chunk-WQ5QNU5R.cjs} +460 -703
- package/dist/chunk-XDZOO4L5.js +354 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/{chunk-MQF7HZ7Y.mjs → chunk-ZGLD4TVZ.mjs} +16 -10
- package/dist/client-CtFmoDvM.d.ts +645 -0
- package/dist/core/index.cjs +284 -0
- package/dist/core/index.d.ts +567 -0
- package/dist/core/index.js +284 -0
- package/dist/core/index.mjs +284 -0
- package/dist/{effect-DM56H743.d.ts → effect-CGNl5Rqp.d.ts} +118 -11
- package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
- package/dist/effectRunner-A4CHJXJI.js +8 -0
- package/dist/effectRunner-OPUF6QRN.mjs +8 -0
- package/dist/http/index.cjs +4130 -890
- package/dist/http/index.d.ts +2289 -219
- package/dist/http/index.js +4116 -876
- package/dist/http/index.mjs +4116 -876
- package/dist/http/testing.cjs +159 -0
- package/dist/http/testing.d.ts +42 -0
- package/dist/http/testing.js +159 -0
- package/dist/http/testing.mjs +159 -0
- package/dist/index.cjs +305 -1168
- package/dist/index.d.ts +9 -701
- package/dist/index.js +176 -1039
- package/dist/index.mjs +176 -1039
- package/dist/observability/index.cjs +677 -0
- package/dist/observability/index.d.ts +79 -0
- package/dist/observability/index.js +677 -0
- package/dist/observability/index.mjs +677 -0
- package/dist/schedule-Fque9Abz.d.ts +70 -0
- package/dist/schema/index.cjs +25 -0
- package/dist/schema/index.d.ts +177 -0
- package/dist/schema/index.js +25 -0
- package/dist/schema/index.mjs +25 -0
- package/dist/server-C8hDXA74.d.ts +674 -0
- package/dist/stream-dvSs0QS5.d.ts +74 -0
- package/dist/tracer-B5tRH9H7.d.ts +230 -0
- package/dist/tracing-Dt9S_6V8.d.ts +148 -0
- package/package.json +37 -3
- package/dist/chunk-SKVY72E5.cjs +0 -667
- package/dist/stream-Oqe6WeLE.d.ts +0 -173
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var _chunkSKVY72E5cjs = require('./chunk-SKVY72E5.cjs');
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
|
|
@@ -39,6 +38,7 @@ var _chunkSKVY72E5cjs = require('./chunk-SKVY72E5.cjs');
|
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
|
|
41
|
+
var _chunkMWXMNYJScjs = require('./chunk-MWXMNYJS.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -71,6 +71,7 @@ var _chunkSKVY72E5cjs = require('./chunk-SKVY72E5.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
var _chunkJF4XXPZ5cjs = require('./chunk-JF4XXPZ5.cjs');
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
|
|
@@ -91,12 +92,14 @@ var _chunkSKVY72E5cjs = require('./chunk-SKVY72E5.cjs');
|
|
|
91
92
|
|
|
92
93
|
|
|
93
94
|
|
|
95
|
+
var _chunk7HUOJA4Wcjs = require('./chunk-7HUOJA4W.cjs');
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
|
|
102
|
+
var _chunk45F7OKGTcjs = require('./chunk-45F7OKGT.cjs');
|
|
100
103
|
|
|
101
104
|
|
|
102
105
|
|
|
@@ -104,1008 +107,113 @@ var _chunkSKVY72E5cjs = require('./chunk-SKVY72E5.cjs');
|
|
|
104
107
|
|
|
105
108
|
|
|
106
109
|
|
|
110
|
+
var _chunkJX3LZQJHcjs = require('./chunk-JX3LZQJH.cjs');
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var _chunkNYL4D7SKcjs = require('./chunk-NYL4D7SK.cjs');
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
var _chunkTVN5I4U6cjs = require('./chunk-TVN5I4U6.cjs');
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
107
125
|
|
|
108
126
|
|
|
109
127
|
|
|
110
128
|
|
|
111
|
-
var _chunkBKBFSOGTcjs = require('./chunk-BKBFSOGT.cjs');
|
|
112
129
|
|
|
113
|
-
// src/core/types/cancel.ts
|
|
114
|
-
function makeCancelToken() {
|
|
115
|
-
let cancelled = false;
|
|
116
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
117
|
-
const cancel = () => {
|
|
118
|
-
if (cancelled) return;
|
|
119
|
-
cancelled = true;
|
|
120
|
-
listeners.forEach((f) => f());
|
|
121
|
-
listeners.clear();
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
isCancelled: () => cancelled,
|
|
125
|
-
onCancel: (f) => {
|
|
126
|
-
if (cancelled) {
|
|
127
|
-
try {
|
|
128
|
-
f();
|
|
129
|
-
} catch (e2) {
|
|
130
|
-
}
|
|
131
|
-
return () => {
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
listeners.add(f);
|
|
135
|
-
return () => {
|
|
136
|
-
listeners.delete(f);
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
cancel
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function linkAbortController(token, ac) {
|
|
143
|
-
return token.onCancel(() => ac.abort());
|
|
144
|
-
}
|
|
145
130
|
|
|
146
|
-
// src/core/runtime/resource.ts
|
|
147
|
-
function bracket(acquire, use, release) {
|
|
148
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (env, cb) => {
|
|
149
|
-
const runtime = _chunkBKBFSOGTcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
150
|
-
const scope = new (0, _chunkBKBFSOGTcjs.Scope)(runtime);
|
|
151
|
-
const acquireFiber = scope.fork(acquire);
|
|
152
|
-
acquireFiber.join((acquireExit) => {
|
|
153
|
-
if (acquireExit._tag === "Failure") {
|
|
154
|
-
scope.close(acquireExit);
|
|
155
|
-
cb(acquireExit);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const resource = acquireExit.value;
|
|
159
|
-
const useFiber = scope.fork(use(resource));
|
|
160
|
-
useFiber.join((useExit) => {
|
|
161
|
-
const releaseEffect = safeRelease(release, resource, useExit);
|
|
162
|
-
const releaseFiber = runtime.fork(releaseEffect);
|
|
163
|
-
releaseFiber.join(() => {
|
|
164
|
-
scope.close(useExit);
|
|
165
|
-
cb(useExit);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
return () => {
|
|
170
|
-
scope.close(_chunkBKBFSOGTcjs.Exit.failCause(_chunkBKBFSOGTcjs.Cause.interrupt()));
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function safeRelease(release, resource, exit) {
|
|
175
|
-
return _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
176
|
-
(() => {
|
|
177
|
-
try {
|
|
178
|
-
return release(resource, exit);
|
|
179
|
-
} catch (e3) {
|
|
180
|
-
return _chunkBKBFSOGTcjs.unit.call(void 0, );
|
|
181
|
-
}
|
|
182
|
-
})(),
|
|
183
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, ),
|
|
184
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, )
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
function ensuring(effect, finalizer) {
|
|
188
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (env, cb) => {
|
|
189
|
-
const runtime = _chunkBKBFSOGTcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
190
|
-
const fiber = runtime.fork(effect);
|
|
191
|
-
fiber.join((exit) => {
|
|
192
|
-
const fin = _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
193
|
-
(() => {
|
|
194
|
-
try {
|
|
195
|
-
return finalizer(exit);
|
|
196
|
-
} catch (e4) {
|
|
197
|
-
return _chunkBKBFSOGTcjs.unit.call(void 0, );
|
|
198
|
-
}
|
|
199
|
-
})(),
|
|
200
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, ),
|
|
201
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, )
|
|
202
|
-
);
|
|
203
|
-
runtime.fork(fin).join(() => {
|
|
204
|
-
cb(exit);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
return () => {
|
|
208
|
-
fiber.interrupt();
|
|
209
|
-
};
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
function managed(acquire, release) {
|
|
213
|
-
return {
|
|
214
|
-
_tag: "Managed",
|
|
215
|
-
acquire,
|
|
216
|
-
release: (resource, exit) => release(resource, exit)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
function useManaged(m, body) {
|
|
220
|
-
return bracket(m.acquire, body, m.release);
|
|
221
|
-
}
|
|
222
|
-
function managedAll(manageds) {
|
|
223
|
-
const acquire = _chunkBKBFSOGTcjs.async.call(void 0, (env, cb) => {
|
|
224
|
-
const runtime = _chunkBKBFSOGTcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
225
|
-
const resources = [];
|
|
226
|
-
let i = 0;
|
|
227
|
-
const acquireNext = () => {
|
|
228
|
-
if (i >= manageds.length) {
|
|
229
|
-
cb({ _tag: "Success", value: resources });
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const m = manageds[i];
|
|
233
|
-
const fiber = runtime.fork(m.acquire);
|
|
234
|
-
fiber.join((exit) => {
|
|
235
|
-
if (exit._tag === "Failure") {
|
|
236
|
-
releaseAcquired(runtime, manageds, resources, exit).then(() => {
|
|
237
|
-
cb(exit);
|
|
238
|
-
});
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
resources.push(exit.value);
|
|
242
|
-
i++;
|
|
243
|
-
acquireNext();
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
acquireNext();
|
|
247
|
-
});
|
|
248
|
-
const release = (resources, exit) => {
|
|
249
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
250
|
-
const runtime = _chunkBKBFSOGTcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
251
|
-
releaseAcquired(runtime, manageds, resources, exit).then(() => {
|
|
252
|
-
cb({ _tag: "Success", value: void 0 });
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
};
|
|
256
|
-
return { _tag: "Managed", acquire, release };
|
|
257
|
-
}
|
|
258
|
-
async function releaseAcquired(runtime, manageds, resources, exit) {
|
|
259
|
-
for (let i = resources.length - 1; i >= 0; i--) {
|
|
260
|
-
try {
|
|
261
|
-
const m = manageds[i];
|
|
262
|
-
await new Promise((resolve) => {
|
|
263
|
-
const releaseEff = _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
264
|
-
m.release(resources[i], exit),
|
|
265
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, ),
|
|
266
|
-
() => _chunkBKBFSOGTcjs.unit.call(void 0, )
|
|
267
|
-
);
|
|
268
|
-
runtime.fork(releaseEff).join(() => resolve());
|
|
269
|
-
});
|
|
270
|
-
} catch (e5) {
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
131
|
|
|
275
|
-
// src/core/runtime/linkedQueue.ts
|
|
276
|
-
var LinkedQueue = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }
|
|
277
|
-
__init() {this.head = null}
|
|
278
|
-
__init2() {this.tail = null}
|
|
279
|
-
__init3() {this.len = 0}
|
|
280
|
-
get length() {
|
|
281
|
-
return this.len;
|
|
282
|
-
}
|
|
283
|
-
isEmpty() {
|
|
284
|
-
return this.len === 0;
|
|
285
|
-
}
|
|
286
|
-
push(value) {
|
|
287
|
-
const node = { value, next: null, prev: this.tail, removed: false };
|
|
288
|
-
if (this.tail) this.tail.next = node;
|
|
289
|
-
else this.head = node;
|
|
290
|
-
this.tail = node;
|
|
291
|
-
this.len++;
|
|
292
|
-
return node;
|
|
293
|
-
}
|
|
294
|
-
shift() {
|
|
295
|
-
const h = this.head;
|
|
296
|
-
if (!h) return void 0;
|
|
297
|
-
this.unlink(h);
|
|
298
|
-
return h.value;
|
|
299
|
-
}
|
|
300
|
-
remove(node) {
|
|
301
|
-
if (node.removed) return;
|
|
302
|
-
this.unlink(node);
|
|
303
|
-
}
|
|
304
|
-
unlink(node) {
|
|
305
|
-
node.removed = true;
|
|
306
|
-
const { prev, next } = node;
|
|
307
|
-
if (prev) prev.next = next;
|
|
308
|
-
else this.head = next;
|
|
309
|
-
if (next) next.prev = prev;
|
|
310
|
-
else this.tail = prev;
|
|
311
|
-
node.next = null;
|
|
312
|
-
node.prev = null;
|
|
313
|
-
this.len--;
|
|
314
|
-
}
|
|
315
|
-
}, _class);
|
|
316
132
|
|
|
317
|
-
// src/core/runtime/semaphore.ts
|
|
318
|
-
function makeSemaphore(n) {
|
|
319
|
-
const capacity = Math.max(1, Math.floor(n));
|
|
320
|
-
let available = capacity;
|
|
321
|
-
let totalAcquired = 0;
|
|
322
|
-
let totalReleased = 0;
|
|
323
|
-
const waiters = new LinkedQueue();
|
|
324
|
-
const acquire = () => {
|
|
325
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
326
|
-
if (available > 0) {
|
|
327
|
-
available--;
|
|
328
|
-
totalAcquired++;
|
|
329
|
-
cb({ _tag: "Success", value: void 0 });
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
const node = waiters.push(cb);
|
|
333
|
-
return () => {
|
|
334
|
-
waiters.remove(node);
|
|
335
|
-
};
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
const release = () => {
|
|
339
|
-
totalReleased++;
|
|
340
|
-
if (waiters.length > 0) {
|
|
341
|
-
const waiter = waiters.shift();
|
|
342
|
-
totalAcquired++;
|
|
343
|
-
waiter({ _tag: "Success", value: void 0 });
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
available++;
|
|
347
|
-
};
|
|
348
|
-
const withPermit = (effect) => {
|
|
349
|
-
return _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
350
|
-
acquire(),
|
|
351
|
-
() => _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
352
|
-
const runtime = _chunkBKBFSOGTcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
353
|
-
const fiber = runtime.fork(effect);
|
|
354
|
-
fiber.join((exit) => {
|
|
355
|
-
release();
|
|
356
|
-
cb(exit);
|
|
357
|
-
});
|
|
358
|
-
return () => {
|
|
359
|
-
fiber.interrupt();
|
|
360
|
-
release();
|
|
361
|
-
};
|
|
362
|
-
})
|
|
363
|
-
);
|
|
364
|
-
};
|
|
365
|
-
return {
|
|
366
|
-
capacity,
|
|
367
|
-
available: () => available,
|
|
368
|
-
waiting: () => waiters.length,
|
|
369
|
-
withPermit,
|
|
370
|
-
acquire,
|
|
371
|
-
release
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
133
|
|
|
375
|
-
// src/core/runtime/ref.ts
|
|
376
|
-
function makeRef(initial) {
|
|
377
|
-
let value = initial;
|
|
378
|
-
return {
|
|
379
|
-
get: () => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => value),
|
|
380
|
-
set: (v) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
381
|
-
value = v;
|
|
382
|
-
}),
|
|
383
|
-
update: (f) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
384
|
-
value = f(value);
|
|
385
|
-
return value;
|
|
386
|
-
}),
|
|
387
|
-
modify: (f) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
388
|
-
const [result, next] = f(value);
|
|
389
|
-
value = next;
|
|
390
|
-
return result;
|
|
391
|
-
}),
|
|
392
|
-
unsafeGet: () => value
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
function derivedRef(parent, get, set) {
|
|
396
|
-
return {
|
|
397
|
-
get: () => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => get(parent.unsafeGet())),
|
|
398
|
-
set: (b) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
399
|
-
const current = parent.unsafeGet();
|
|
400
|
-
parent.set(set(current, b));
|
|
401
|
-
}),
|
|
402
|
-
update: (f) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
403
|
-
const parentVal = parent.unsafeGet();
|
|
404
|
-
const currentB = get(parentVal);
|
|
405
|
-
const newB = f(currentB);
|
|
406
|
-
const newParent = set(parentVal, newB);
|
|
407
|
-
parent.unsafeGet = () => newParent;
|
|
408
|
-
return newB;
|
|
409
|
-
}),
|
|
410
|
-
modify: (f) => _chunkBKBFSOGTcjs.asyncSync.call(void 0, () => {
|
|
411
|
-
const parentVal = parent.unsafeGet();
|
|
412
|
-
const currentB = get(parentVal);
|
|
413
|
-
const [result, newB] = f(currentB);
|
|
414
|
-
const newParent = set(parentVal, newB);
|
|
415
|
-
parent.unsafeGet = () => newParent;
|
|
416
|
-
return result;
|
|
417
|
-
}),
|
|
418
|
-
unsafeGet: () => get(parent.unsafeGet())
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
134
|
|
|
422
|
-
// src/core/runtime/schedule.ts
|
|
423
|
-
function recurs(n) {
|
|
424
|
-
return {
|
|
425
|
-
_tag: "Schedule",
|
|
426
|
-
initial: () => 0,
|
|
427
|
-
step: (count, _input) => {
|
|
428
|
-
const next = count + 1;
|
|
429
|
-
return [{ continue: next < n, delayMs: 0 }, next, next];
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
function fixed(delayMs) {
|
|
434
|
-
return {
|
|
435
|
-
_tag: "Schedule",
|
|
436
|
-
initial: () => 0,
|
|
437
|
-
step: (count, _input) => {
|
|
438
|
-
return [{ continue: true, delayMs }, count + 1, count + 1];
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
function exponential(baseMs, maxMs = Infinity) {
|
|
443
|
-
return {
|
|
444
|
-
_tag: "Schedule",
|
|
445
|
-
initial: () => 0,
|
|
446
|
-
step: (count, _input) => {
|
|
447
|
-
const delay = Math.min(baseMs * Math.pow(2, count), maxMs);
|
|
448
|
-
return [{ continue: true, delayMs: delay }, count + 1, count + 1];
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
function jittered(baseMs, maxMs = Infinity) {
|
|
453
|
-
return {
|
|
454
|
-
_tag: "Schedule",
|
|
455
|
-
initial: () => 0,
|
|
456
|
-
step: (count, _input) => {
|
|
457
|
-
const cap = Math.min(baseMs * Math.pow(2, count), maxMs);
|
|
458
|
-
const delay = Math.floor(Math.random() * cap);
|
|
459
|
-
return [{ continue: true, delayMs: delay }, count + 1, count + 1];
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function elapsed(maxMs) {
|
|
464
|
-
return {
|
|
465
|
-
_tag: "Schedule",
|
|
466
|
-
initial: () => performance.now(),
|
|
467
|
-
step: (startedAt, _input) => {
|
|
468
|
-
const el = performance.now() - startedAt;
|
|
469
|
-
return [{ continue: el < maxMs, delayMs: 0 }, startedAt, el];
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
function whileInput(pred) {
|
|
474
|
-
return {
|
|
475
|
-
_tag: "Schedule",
|
|
476
|
-
initial: () => void 0,
|
|
477
|
-
step: (_state, input) => {
|
|
478
|
-
return [{ continue: pred(input), delayMs: 0 }, void 0, input];
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
function take(schedule, n) {
|
|
483
|
-
return {
|
|
484
|
-
_tag: "Schedule",
|
|
485
|
-
initial: () => ({ inner: schedule.initial(), count: 0 }),
|
|
486
|
-
step: (state, input) => {
|
|
487
|
-
if (state.count >= n) return [{ continue: false, delayMs: 0 }, state, void 0];
|
|
488
|
-
const [decision, nextInner, output] = schedule.step(state.inner, input);
|
|
489
|
-
const nextState = { inner: nextInner, count: state.count + 1 };
|
|
490
|
-
return [{ continue: decision.continue && state.count + 1 < n, delayMs: decision.delayMs }, nextState, output];
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
function andThen(first, second) {
|
|
495
|
-
return {
|
|
496
|
-
_tag: "Schedule",
|
|
497
|
-
initial: () => ({ phase: "first", inner: first.initial() }),
|
|
498
|
-
step: (state, input) => {
|
|
499
|
-
if (state.phase === "first") {
|
|
500
|
-
const [decision2, nextInner2, output2] = first.step(state.inner, input);
|
|
501
|
-
if (decision2.continue) {
|
|
502
|
-
return [decision2, { phase: "first", inner: nextInner2 }, output2];
|
|
503
|
-
}
|
|
504
|
-
return [{ continue: true, delayMs: decision2.delayMs }, { phase: "second", inner: second.initial() }, output2];
|
|
505
|
-
}
|
|
506
|
-
const [decision, nextInner, output] = second.step(state.inner, input);
|
|
507
|
-
return [decision, { phase: "second", inner: nextInner }, output];
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
function intersect(left, right) {
|
|
512
|
-
return {
|
|
513
|
-
_tag: "Schedule",
|
|
514
|
-
initial: () => ({ left: left.initial(), right: right.initial() }),
|
|
515
|
-
step: (state, input) => {
|
|
516
|
-
const [ld, ls, lo] = left.step(state.left, input);
|
|
517
|
-
const [rd, rs, ro] = right.step(state.right, input);
|
|
518
|
-
const cont = ld.continue && rd.continue;
|
|
519
|
-
const delay = Math.max(ld.delayMs, rd.delayMs);
|
|
520
|
-
return [{ continue: cont, delayMs: delay }, { left: ls, right: rs }, [lo, ro]];
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
function union(left, right) {
|
|
525
|
-
return {
|
|
526
|
-
_tag: "Schedule",
|
|
527
|
-
initial: () => ({ left: left.initial(), right: right.initial() }),
|
|
528
|
-
step: (state, input) => {
|
|
529
|
-
const [ld, ls, lo] = left.step(state.left, input);
|
|
530
|
-
const [rd, rs, ro] = right.step(state.right, input);
|
|
531
|
-
const cont = ld.continue || rd.continue;
|
|
532
|
-
const delay = Math.min(ld.delayMs, rd.delayMs);
|
|
533
|
-
return [{ continue: cont, delayMs: delay }, { left: ls, right: rs }, [lo, ro]];
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
function retryWithSchedule(effect, schedule) {
|
|
538
|
-
const loop = (state) => _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
539
|
-
effect,
|
|
540
|
-
(error) => {
|
|
541
|
-
const [decision, nextState, _output] = schedule.step(state, error);
|
|
542
|
-
if (!decision.continue) return _chunkBKBFSOGTcjs.asyncFail.call(void 0, error);
|
|
543
|
-
if (decision.delayMs <= 0) return loop(nextState);
|
|
544
|
-
return _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, _chunkSKVY72E5cjs.sleep.call(void 0, decision.delayMs), () => loop(nextState));
|
|
545
|
-
},
|
|
546
|
-
(value) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, value)
|
|
547
|
-
);
|
|
548
|
-
return loop(schedule.initial());
|
|
549
|
-
}
|
|
550
|
-
function repeatWithSchedule(effect, schedule) {
|
|
551
|
-
const loop = (state, lastValue) => {
|
|
552
|
-
const [decision, nextState, _output] = schedule.step(state, lastValue);
|
|
553
|
-
if (!decision.continue) return _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, lastValue);
|
|
554
|
-
if (decision.delayMs <= 0) {
|
|
555
|
-
return _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
556
|
-
effect,
|
|
557
|
-
(error) => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error),
|
|
558
|
-
(value) => loop(nextState, value)
|
|
559
|
-
);
|
|
560
|
-
}
|
|
561
|
-
return _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
562
|
-
_chunkSKVY72E5cjs.sleep.call(void 0, decision.delayMs),
|
|
563
|
-
() => _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
564
|
-
effect,
|
|
565
|
-
(error) => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error),
|
|
566
|
-
(value) => loop(nextState, value)
|
|
567
|
-
)
|
|
568
|
-
);
|
|
569
|
-
};
|
|
570
|
-
return _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
571
|
-
effect,
|
|
572
|
-
(error) => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error),
|
|
573
|
-
(value) => loop(schedule.initial(), value)
|
|
574
|
-
);
|
|
575
|
-
}
|
|
576
135
|
|
|
577
|
-
// src/core/runtime/shutdown.ts
|
|
578
|
-
async function gracefulShutdown(runtime, config = {}) {
|
|
579
|
-
const timeoutMs = _nullishCoalesce(config.timeoutMs, () => ( 3e4));
|
|
580
|
-
const startedAt = Date.now();
|
|
581
|
-
_optionalChain([config, 'access', _2 => _2.onStart, 'optionalCall', _3 => _3()]);
|
|
582
|
-
let timedOut = false;
|
|
583
|
-
const shutdownPromise = (_chunkBKBFSOGTcjs.async.call(void 0, ) => {
|
|
584
|
-
try {
|
|
585
|
-
await runtime.shutdown();
|
|
586
|
-
} catch (e6) {
|
|
587
|
-
}
|
|
588
|
-
})();
|
|
589
|
-
const timeoutPromise = new Promise((resolve) => {
|
|
590
|
-
setTimeout(() => {
|
|
591
|
-
timedOut = true;
|
|
592
|
-
resolve();
|
|
593
|
-
}, timeoutMs);
|
|
594
|
-
});
|
|
595
|
-
await Promise.race([shutdownPromise, timeoutPromise]);
|
|
596
|
-
const completedAt = Date.now();
|
|
597
|
-
const stats = {
|
|
598
|
-
startedAt,
|
|
599
|
-
completedAt,
|
|
600
|
-
elapsedMs: completedAt - startedAt,
|
|
601
|
-
timedOut
|
|
602
|
-
};
|
|
603
|
-
if (timedOut) {
|
|
604
|
-
_optionalChain([config, 'access', _4 => _4.onTimeout, 'optionalCall', _5 => _5(stats)]);
|
|
605
|
-
} else {
|
|
606
|
-
_optionalChain([config, 'access', _6 => _6.onComplete, 'optionalCall', _7 => _7(stats)]);
|
|
607
|
-
}
|
|
608
|
-
return stats;
|
|
609
|
-
}
|
|
610
|
-
function registerShutdownHooks(runtime, config = {}) {
|
|
611
|
-
let shuttingDown = false;
|
|
612
|
-
const handler = (signal) => {
|
|
613
|
-
if (shuttingDown) {
|
|
614
|
-
process.exit(1);
|
|
615
|
-
}
|
|
616
|
-
shuttingDown = true;
|
|
617
|
-
console.log(`
|
|
618
|
-
[brass-runtime] Received ${signal}, shutting down gracefully...`);
|
|
619
|
-
gracefulShutdown(runtime, {
|
|
620
|
-
...config,
|
|
621
|
-
onComplete: (stats) => {
|
|
622
|
-
_optionalChain([config, 'access', _8 => _8.onComplete, 'optionalCall', _9 => _9(stats)]);
|
|
623
|
-
if (!config.onComplete) {
|
|
624
|
-
console.log(`[brass-runtime] Shutdown complete (${stats.elapsedMs}ms)`);
|
|
625
|
-
process.exit(0);
|
|
626
|
-
}
|
|
627
|
-
},
|
|
628
|
-
onTimeout: (stats) => {
|
|
629
|
-
_optionalChain([config, 'access', _10 => _10.onTimeout, 'optionalCall', _11 => _11(stats)]);
|
|
630
|
-
if (!config.onTimeout) {
|
|
631
|
-
console.log(`[brass-runtime] Shutdown timed out after ${stats.elapsedMs}ms, forcing exit`);
|
|
632
|
-
process.exit(1);
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
};
|
|
637
|
-
process.on("SIGTERM", () => handler("SIGTERM"));
|
|
638
|
-
process.on("SIGINT", () => handler("SIGINT"));
|
|
639
|
-
return () => {
|
|
640
|
-
process.removeAllListeners("SIGTERM");
|
|
641
|
-
process.removeAllListeners("SIGINT");
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
136
|
|
|
645
|
-
// src/core/runtime/testing.ts
|
|
646
|
-
function makeTestRuntime(env, options) {
|
|
647
|
-
const runtime = _chunkBKBFSOGTcjs.Runtime.make(_nullishCoalesce(env, () => ( {})));
|
|
648
|
-
const run = (effect) => runtime.toPromise(effect);
|
|
649
|
-
const runExit = (effect) => new Promise((resolve) => {
|
|
650
|
-
runtime.unsafeRunAsync(effect, resolve);
|
|
651
|
-
});
|
|
652
|
-
return { runtime, run, runExit };
|
|
653
|
-
}
|
|
654
|
-
async function assertSucceeds(effect, expected, runtime) {
|
|
655
|
-
const rt = _nullishCoalesce(runtime, () => ( _chunkBKBFSOGTcjs.Runtime.make({})));
|
|
656
|
-
const exit = await new Promise((resolve) => {
|
|
657
|
-
rt.unsafeRunAsync(effect, resolve);
|
|
658
|
-
});
|
|
659
|
-
if (exit._tag !== "Success") {
|
|
660
|
-
throw new Error(`Expected success with ${JSON.stringify(expected)}, got failure: ${JSON.stringify(exit.cause)}`);
|
|
661
|
-
}
|
|
662
|
-
if (JSON.stringify(exit.value) !== JSON.stringify(expected)) {
|
|
663
|
-
throw new Error(`Expected ${JSON.stringify(expected)}, got ${JSON.stringify(exit.value)}`);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
async function assertFails(effect, expectedError, runtime) {
|
|
667
|
-
const rt = _nullishCoalesce(runtime, () => ( _chunkBKBFSOGTcjs.Runtime.make({})));
|
|
668
|
-
const exit = await new Promise((resolve) => {
|
|
669
|
-
rt.unsafeRunAsync(effect, resolve);
|
|
670
|
-
});
|
|
671
|
-
if (exit._tag !== "Failure") {
|
|
672
|
-
throw new Error(`Expected failure with ${JSON.stringify(expectedError)}, got success: ${JSON.stringify(exit.value)}`);
|
|
673
|
-
}
|
|
674
|
-
const error = exit.cause.error;
|
|
675
|
-
if (JSON.stringify(error) !== JSON.stringify(expectedError)) {
|
|
676
|
-
throw new Error(`Expected error ${JSON.stringify(expectedError)}, got ${JSON.stringify(error)}`);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
async function assertFailsWith(effect, predicate, runtime) {
|
|
680
|
-
const rt = _nullishCoalesce(runtime, () => ( _chunkBKBFSOGTcjs.Runtime.make({})));
|
|
681
|
-
const exit = await new Promise((resolve) => {
|
|
682
|
-
rt.unsafeRunAsync(effect, resolve);
|
|
683
|
-
});
|
|
684
|
-
if (exit._tag !== "Failure") {
|
|
685
|
-
throw new Error(`Expected failure, got success: ${JSON.stringify(exit.value)}`);
|
|
686
|
-
}
|
|
687
|
-
const error = exit.cause.error;
|
|
688
|
-
if (!predicate(error)) {
|
|
689
|
-
throw new Error(`Error did not match predicate: ${JSON.stringify(error)}`);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
async function assertCompletesWithin(effect, maxMs, runtime) {
|
|
693
|
-
const rt = _nullishCoalesce(runtime, () => ( _chunkBKBFSOGTcjs.Runtime.make({})));
|
|
694
|
-
const start = performance.now();
|
|
695
|
-
const result = await rt.toPromise(effect);
|
|
696
|
-
const elapsed2 = performance.now() - start;
|
|
697
|
-
if (elapsed2 > maxMs) {
|
|
698
|
-
throw new Error(`Effect took ${elapsed2.toFixed(1)}ms, expected < ${maxMs}ms`);
|
|
699
|
-
}
|
|
700
|
-
return result;
|
|
701
|
-
}
|
|
702
|
-
function flakyEffect(failCount, successValue, errorValue) {
|
|
703
|
-
let calls = 0;
|
|
704
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
705
|
-
calls++;
|
|
706
|
-
if (calls <= failCount) {
|
|
707
|
-
cb({ _tag: "Failure", cause: { _tag: "Fail", error: errorValue } });
|
|
708
|
-
} else {
|
|
709
|
-
cb({ _tag: "Success", value: successValue });
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
function delayedEffect(ms, value) {
|
|
714
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
715
|
-
const id = setTimeout(() => cb({ _tag: "Success", value }), ms);
|
|
716
|
-
return () => clearTimeout(id);
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
function neverEffect() {
|
|
720
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, () => {
|
|
721
|
-
return () => {
|
|
722
|
-
};
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
137
|
|
|
726
|
-
// src/core/runtime/layer.ts
|
|
727
|
-
function layer(acquire, release) {
|
|
728
|
-
return {
|
|
729
|
-
_tag: "Layer",
|
|
730
|
-
build: (_deps) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, acquire(), (service) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, {
|
|
731
|
-
service,
|
|
732
|
-
release: release ? () => release(service) : () => _chunkBKBFSOGTcjs.unit.call(void 0, )
|
|
733
|
-
}))
|
|
734
|
-
};
|
|
735
|
-
}
|
|
736
|
-
function layerFrom() {
|
|
737
|
-
return (acquire, release) => ({
|
|
738
|
-
_tag: "Layer",
|
|
739
|
-
build: (deps) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, acquire(deps), (service) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, {
|
|
740
|
-
service,
|
|
741
|
-
release: release ? () => release(service) : () => _chunkBKBFSOGTcjs.unit.call(void 0, )
|
|
742
|
-
}))
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
function layerSucceed(value) {
|
|
746
|
-
return {
|
|
747
|
-
_tag: "Layer",
|
|
748
|
-
build: () => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, { service: value, release: () => _chunkBKBFSOGTcjs.unit.call(void 0, ) })
|
|
749
|
-
};
|
|
750
|
-
}
|
|
751
|
-
function layerFail(error) {
|
|
752
|
-
return {
|
|
753
|
-
_tag: "Layer",
|
|
754
|
-
build: () => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error)
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
function compose(from, to) {
|
|
758
|
-
return {
|
|
759
|
-
_tag: "Layer",
|
|
760
|
-
build: (deps) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
761
|
-
from.build(deps),
|
|
762
|
-
({ service: mid, release: releaseMid }) => _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
763
|
-
to.build(mid),
|
|
764
|
-
(error) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, releaseMid(), () => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error)),
|
|
765
|
-
({ service: out, release: releaseOut }) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, {
|
|
766
|
-
service: out,
|
|
767
|
-
release: () => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, releaseOut(), () => releaseMid())
|
|
768
|
-
})
|
|
769
|
-
)
|
|
770
|
-
)
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
function merge2(left, right) {
|
|
774
|
-
return {
|
|
775
|
-
_tag: "Layer",
|
|
776
|
-
build: (deps) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
777
|
-
left.build(deps),
|
|
778
|
-
({ service: a, release: releaseA }) => _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
779
|
-
right.build(deps),
|
|
780
|
-
(error) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, releaseA(), () => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error)),
|
|
781
|
-
({ service: b, release: releaseB }) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, {
|
|
782
|
-
service: { ...a, ...b },
|
|
783
|
-
release: () => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, releaseB(), () => releaseA())
|
|
784
|
-
})
|
|
785
|
-
)
|
|
786
|
-
)
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
function mapLayer(l, f) {
|
|
790
|
-
return {
|
|
791
|
-
_tag: "Layer",
|
|
792
|
-
build: (deps) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
793
|
-
l.build(deps),
|
|
794
|
-
({ service, release }) => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, { service: f(service), release })
|
|
795
|
-
)
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function provideLayer(l, use, deps) {
|
|
799
|
-
return _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0,
|
|
800
|
-
l.build(_nullishCoalesce(deps, () => ( {}))),
|
|
801
|
-
({ service, release }) => _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
802
|
-
use(service),
|
|
803
|
-
(error) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, release(), () => _chunkBKBFSOGTcjs.asyncFail.call(void 0, error)),
|
|
804
|
-
(value) => _chunkBKBFSOGTcjs.asyncFlatMap.call(void 0, release(), () => _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, value))
|
|
805
|
-
)
|
|
806
|
-
);
|
|
807
|
-
}
|
|
808
138
|
|
|
809
|
-
// src/core/runtime/workerPool.ts
|
|
810
|
-
function makeWorkerPool(config = {}) {
|
|
811
|
-
const size = _nullishCoalesce(config.size, () => ( 4));
|
|
812
|
-
const maxQueue = _nullishCoalesce(config.maxQueue, () => ( 1e3));
|
|
813
|
-
const taskTimeoutMs = _nullishCoalesce(config.taskTimeoutMs, () => ( 3e4));
|
|
814
|
-
let closed = false;
|
|
815
|
-
let busy = 0;
|
|
816
|
-
let completed = 0;
|
|
817
|
-
let failed = 0;
|
|
818
|
-
let timedOut = 0;
|
|
819
|
-
const queue = [];
|
|
820
|
-
const processNext = () => {
|
|
821
|
-
if (queue.length === 0 || busy >= size) return;
|
|
822
|
-
const task = queue.shift();
|
|
823
|
-
busy++;
|
|
824
|
-
setImmediate(() => {
|
|
825
|
-
if (task.timeoutId) clearTimeout(task.timeoutId);
|
|
826
|
-
try {
|
|
827
|
-
const result = task.fn();
|
|
828
|
-
busy--;
|
|
829
|
-
completed++;
|
|
830
|
-
task.resolve(result);
|
|
831
|
-
processNext();
|
|
832
|
-
} catch (e) {
|
|
833
|
-
busy--;
|
|
834
|
-
failed++;
|
|
835
|
-
task.reject({ _tag: "WorkerTaskError", message: String(e) });
|
|
836
|
-
processNext();
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
};
|
|
840
|
-
const execute = (fn) => {
|
|
841
|
-
if (closed) return _chunkBKBFSOGTcjs.asyncFail.call(void 0, { _tag: "WorkerPoolClosed" });
|
|
842
|
-
if (queue.length >= maxQueue) {
|
|
843
|
-
return _chunkBKBFSOGTcjs.asyncFail.call(void 0, { _tag: "WorkerPoolFull", queued: queue.length });
|
|
844
|
-
}
|
|
845
|
-
return _chunkBKBFSOGTcjs.async.call(void 0, (_env, cb) => {
|
|
846
|
-
const task = {
|
|
847
|
-
fn,
|
|
848
|
-
resolve: (value) => cb({ _tag: "Success", value }),
|
|
849
|
-
reject: (error) => cb({ _tag: "Failure", cause: { _tag: "Fail", error } })
|
|
850
|
-
};
|
|
851
|
-
task.timeoutId = setTimeout(() => {
|
|
852
|
-
const idx = queue.indexOf(task);
|
|
853
|
-
if (idx >= 0) {
|
|
854
|
-
queue.splice(idx, 1);
|
|
855
|
-
timedOut++;
|
|
856
|
-
task.reject({ _tag: "WorkerTaskTimeout", ms: taskTimeoutMs });
|
|
857
|
-
}
|
|
858
|
-
}, taskTimeoutMs);
|
|
859
|
-
queue.push(task);
|
|
860
|
-
processNext();
|
|
861
|
-
return () => {
|
|
862
|
-
const idx = queue.indexOf(task);
|
|
863
|
-
if (idx >= 0) {
|
|
864
|
-
queue.splice(idx, 1);
|
|
865
|
-
if (task.timeoutId) clearTimeout(task.timeoutId);
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
});
|
|
869
|
-
};
|
|
870
|
-
const run = (taskSource, args = []) => {
|
|
871
|
-
return execute(() => {
|
|
872
|
-
const fn = new Function(...args.map((_, i) => `arg${i}`), taskSource);
|
|
873
|
-
return fn(...args);
|
|
874
|
-
});
|
|
875
|
-
};
|
|
876
|
-
return {
|
|
877
|
-
execute,
|
|
878
|
-
run,
|
|
879
|
-
stats: () => ({
|
|
880
|
-
size,
|
|
881
|
-
busy,
|
|
882
|
-
idle: size - busy,
|
|
883
|
-
queued: queue.length,
|
|
884
|
-
completed,
|
|
885
|
-
failed,
|
|
886
|
-
timedOut
|
|
887
|
-
}),
|
|
888
|
-
shutdown: _chunkBKBFSOGTcjs.async.call(void 0, ) => {
|
|
889
|
-
closed = true;
|
|
890
|
-
while (queue.length > 0) {
|
|
891
|
-
const task = queue.shift();
|
|
892
|
-
if (task.timeoutId) clearTimeout(task.timeoutId);
|
|
893
|
-
task.reject({ _tag: "WorkerPoolClosed" });
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
139
|
|
|
899
|
-
// src/core/runtime/tracing.ts
|
|
900
|
-
var idCounter = 0;
|
|
901
|
-
function generateId() {
|
|
902
|
-
return (++idCounter).toString(16).padStart(16, "0");
|
|
903
|
-
}
|
|
904
|
-
function makeTracer(config) {
|
|
905
|
-
const completedSpans = [];
|
|
906
|
-
const sampleRate = _nullishCoalesce(config.sampleRate, () => ( 1));
|
|
907
|
-
const shouldSample = () => {
|
|
908
|
-
if (sampleRate >= 1) return true;
|
|
909
|
-
if (sampleRate <= 0) return false;
|
|
910
|
-
return Math.random() < sampleRate;
|
|
911
|
-
};
|
|
912
|
-
const span = (name, effect, attributes) => {
|
|
913
|
-
if (!shouldSample()) return effect;
|
|
914
|
-
const spanObj = {
|
|
915
|
-
name,
|
|
916
|
-
context: {
|
|
917
|
-
traceId: generateId(),
|
|
918
|
-
spanId: generateId()
|
|
919
|
-
},
|
|
920
|
-
startTime: performance.now(),
|
|
921
|
-
status: "unset",
|
|
922
|
-
attributes: { "service.name": config.serviceName, ...attributes },
|
|
923
|
-
events: []
|
|
924
|
-
};
|
|
925
|
-
return _chunkBKBFSOGTcjs.asyncFold.call(void 0,
|
|
926
|
-
effect,
|
|
927
|
-
(error) => {
|
|
928
|
-
spanObj.endTime = performance.now();
|
|
929
|
-
spanObj.status = "error";
|
|
930
|
-
spanObj.events.push({
|
|
931
|
-
name: "error",
|
|
932
|
-
time: performance.now(),
|
|
933
|
-
attributes: { "error.message": String(error) }
|
|
934
|
-
});
|
|
935
|
-
completedSpans.push(spanObj);
|
|
936
|
-
_optionalChain([config, 'access', _12 => _12.onSpanEnd, 'optionalCall', _13 => _13(spanObj)]);
|
|
937
|
-
return _chunkBKBFSOGTcjs.asyncFail.call(void 0, error);
|
|
938
|
-
},
|
|
939
|
-
(value) => {
|
|
940
|
-
spanObj.endTime = performance.now();
|
|
941
|
-
spanObj.status = "ok";
|
|
942
|
-
completedSpans.push(spanObj);
|
|
943
|
-
_optionalChain([config, 'access', _14 => _14.onSpanEnd, 'optionalCall', _15 => _15(spanObj)]);
|
|
944
|
-
return _chunkBKBFSOGTcjs.asyncSucceed.call(void 0, value);
|
|
945
|
-
}
|
|
946
|
-
);
|
|
947
|
-
};
|
|
948
|
-
return {
|
|
949
|
-
span,
|
|
950
|
-
spans: () => completedSpans,
|
|
951
|
-
clear: () => {
|
|
952
|
-
completedSpans.length = 0;
|
|
953
|
-
}
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
140
|
|
|
957
|
-
// src/core/runtime/metrics.ts
|
|
958
|
-
var DEFAULT_BOUNDARIES = [1, 5, 10, 25, 50, 100, 250, 500, 1e3, 5e3, 1e4];
|
|
959
|
-
function makeMetrics() {
|
|
960
|
-
const counters = /* @__PURE__ */ new Map();
|
|
961
|
-
const gauges = /* @__PURE__ */ new Map();
|
|
962
|
-
const histograms = /* @__PURE__ */ new Map();
|
|
963
|
-
const key = (name, labels) => labels ? `${name}|${Object.entries(labels).sort().map(([k, v]) => `${k}=${v}`).join(",")}` : name;
|
|
964
|
-
const counter = (name, labels = {}) => {
|
|
965
|
-
const k = key(name, labels);
|
|
966
|
-
if (!counters.has(k)) counters.set(k, { labels, value: 0 });
|
|
967
|
-
const entry = counters.get(k);
|
|
968
|
-
return {
|
|
969
|
-
increment: (n = 1) => {
|
|
970
|
-
entry.value += Math.max(0, n);
|
|
971
|
-
},
|
|
972
|
-
value: () => entry.value
|
|
973
|
-
};
|
|
974
|
-
};
|
|
975
|
-
const gauge = (name, labels = {}) => {
|
|
976
|
-
const k = key(name, labels);
|
|
977
|
-
if (!gauges.has(k)) gauges.set(k, { labels, value: 0 });
|
|
978
|
-
const entry = gauges.get(k);
|
|
979
|
-
return {
|
|
980
|
-
set: (v) => {
|
|
981
|
-
entry.value = v;
|
|
982
|
-
},
|
|
983
|
-
increment: (n = 1) => {
|
|
984
|
-
entry.value += n;
|
|
985
|
-
},
|
|
986
|
-
decrement: (n = 1) => {
|
|
987
|
-
entry.value -= n;
|
|
988
|
-
},
|
|
989
|
-
value: () => entry.value
|
|
990
|
-
};
|
|
991
|
-
};
|
|
992
|
-
const histogram = (name, boundaries = DEFAULT_BOUNDARIES, labels = {}) => {
|
|
993
|
-
const k = key(name, labels);
|
|
994
|
-
if (!histograms.has(k)) {
|
|
995
|
-
const sorted = [...boundaries].sort((a, b) => a - b);
|
|
996
|
-
histograms.set(k, {
|
|
997
|
-
labels,
|
|
998
|
-
boundaries: sorted,
|
|
999
|
-
data: { boundaries: sorted, counts: new Array(sorted.length + 1).fill(0), sum: 0, count: 0, min: Infinity, max: -Infinity }
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
const entry = histograms.get(k);
|
|
1003
|
-
return {
|
|
1004
|
-
observe: (value) => {
|
|
1005
|
-
entry.data.sum += value;
|
|
1006
|
-
entry.data.count++;
|
|
1007
|
-
entry.data.min = Math.min(entry.data.min, value);
|
|
1008
|
-
entry.data.max = Math.max(entry.data.max, value);
|
|
1009
|
-
let placed = false;
|
|
1010
|
-
for (let i = 0; i < entry.boundaries.length; i++) {
|
|
1011
|
-
if (value <= entry.boundaries[i]) {
|
|
1012
|
-
entry.data.counts[i]++;
|
|
1013
|
-
placed = true;
|
|
1014
|
-
break;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
if (!placed) entry.data.counts[entry.boundaries.length]++;
|
|
1018
|
-
},
|
|
1019
|
-
buckets: () => ({ ...entry.data }),
|
|
1020
|
-
percentile: (p) => {
|
|
1021
|
-
const target = Math.ceil(entry.data.count * (p / 100));
|
|
1022
|
-
let cumulative = 0;
|
|
1023
|
-
for (let i = 0; i < entry.boundaries.length; i++) {
|
|
1024
|
-
cumulative += entry.data.counts[i];
|
|
1025
|
-
if (cumulative >= target) return entry.boundaries[i];
|
|
1026
|
-
}
|
|
1027
|
-
return entry.data.max;
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
};
|
|
1031
|
-
return {
|
|
1032
|
-
counter,
|
|
1033
|
-
gauge,
|
|
1034
|
-
histogram,
|
|
1035
|
-
snapshot: () => ({
|
|
1036
|
-
counters: Array.from(counters.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, value: v.value })),
|
|
1037
|
-
gauges: Array.from(gauges.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, value: v.value })),
|
|
1038
|
-
histograms: Array.from(histograms.entries()).map(([k, v]) => ({ name: k.split("|")[0], labels: v.labels, buckets: v.data }))
|
|
1039
|
-
}),
|
|
1040
|
-
reset: () => {
|
|
1041
|
-
counters.clear();
|
|
1042
|
-
gauges.clear();
|
|
1043
|
-
histograms.clear();
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
141
|
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
var _chunkWQ5QNU5Rcjs = require('./chunk-WQ5QNU5R.cjs');
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
var _chunkDJQ7OMMBcjs = require('./chunk-DJQ7OMMB.cjs');
|
|
204
|
+
require('./chunk-SPUEME2B.cjs');
|
|
205
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
1098
206
|
|
|
1099
207
|
// src/core/stream/queue.ts
|
|
1100
208
|
function bounded(capacity, strategy = "backpressure", options = {}) {
|
|
1101
|
-
return
|
|
209
|
+
return _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => makeQueue(capacity, strategy, options));
|
|
1102
210
|
}
|
|
1103
211
|
function makeQueue(capacity, strategy, options) {
|
|
1104
|
-
const items =
|
|
212
|
+
const items = _chunkWQ5QNU5Rcjs.makeBoundedRingBuffer.call(void 0, capacity, capacity, options);
|
|
1105
213
|
let closed = false;
|
|
1106
214
|
const QueueClosedErr = { _tag: "QueueClosed" };
|
|
1107
|
-
const offerWaiters = new LinkedQueue();
|
|
1108
|
-
const takers = new LinkedQueue();
|
|
215
|
+
const offerWaiters = new (0, _chunkMWXMNYJScjs.LinkedQueue)();
|
|
216
|
+
const takers = new (0, _chunkMWXMNYJScjs.LinkedQueue)();
|
|
1109
217
|
const shutdown = () => {
|
|
1110
218
|
if (closed) return;
|
|
1111
219
|
closed = true;
|
|
@@ -1122,7 +230,7 @@ function makeQueue(capacity, strategy, options) {
|
|
|
1122
230
|
return {
|
|
1123
231
|
size: () => items.length,
|
|
1124
232
|
shutdown,
|
|
1125
|
-
offer: (a) =>
|
|
233
|
+
offer: (a) => _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
1126
234
|
if (closed) {
|
|
1127
235
|
cb({ _tag: "Success", value: false });
|
|
1128
236
|
return;
|
|
@@ -1157,7 +265,7 @@ function makeQueue(capacity, strategy, options) {
|
|
|
1157
265
|
};
|
|
1158
266
|
return canceler;
|
|
1159
267
|
}),
|
|
1160
|
-
take: () =>
|
|
268
|
+
take: () => _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
1161
269
|
if (items.length > 0) {
|
|
1162
270
|
const a = items.shift();
|
|
1163
271
|
cb({ _tag: "Success", value: a });
|
|
@@ -1184,7 +292,7 @@ function makeQueue(capacity, strategy, options) {
|
|
|
1184
292
|
};
|
|
1185
293
|
return canceler;
|
|
1186
294
|
}),
|
|
1187
|
-
offerBatch: (values) =>
|
|
295
|
+
offerBatch: (values) => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
1188
296
|
const results = [];
|
|
1189
297
|
for (let i = 0; i < values.length; i++) {
|
|
1190
298
|
if (closed) {
|
|
@@ -1215,7 +323,7 @@ function makeQueue(capacity, strategy, options) {
|
|
|
1215
323
|
}
|
|
1216
324
|
return results;
|
|
1217
325
|
}),
|
|
1218
|
-
takeBatch: (n) =>
|
|
326
|
+
takeBatch: (n) => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
1219
327
|
const results = [];
|
|
1220
328
|
const count = Math.min(n, items.length + offerWaiters.length);
|
|
1221
329
|
for (let i = 0; i < count; i++) {
|
|
@@ -1249,34 +357,34 @@ function buffer(stream, capacity, strategy = "backpressure") {
|
|
|
1249
357
|
let q = null;
|
|
1250
358
|
let producer = null;
|
|
1251
359
|
let upstream = stream;
|
|
1252
|
-
const onUpstreamFailure = (opt) =>
|
|
360
|
+
const onUpstreamFailure = (opt) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0,
|
|
1253
361
|
opt._tag === "None" ? SIGNAL_END : { _tag: "Fail", error: opt.value }
|
|
1254
362
|
);
|
|
1255
|
-
const onUpstreamSuccess = ([a, tail]) =>
|
|
363
|
+
const onUpstreamSuccess = ([a, tail]) => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
1256
364
|
upstream = tail;
|
|
1257
365
|
return { _tag: "Elem", value: a };
|
|
1258
366
|
});
|
|
1259
|
-
const nextSignal = () =>
|
|
1260
|
-
|
|
367
|
+
const nextSignal = () => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
368
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, upstream),
|
|
1261
369
|
onUpstreamFailure,
|
|
1262
370
|
onUpstreamSuccess
|
|
1263
371
|
);
|
|
1264
|
-
const start = (env) =>
|
|
372
|
+
const start = (env) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, bounded(capacity, strategy), (_q) => {
|
|
1265
373
|
q = _q;
|
|
1266
374
|
let lastSig;
|
|
1267
375
|
const afterOffer = () => {
|
|
1268
376
|
if (lastSig._tag !== "Elem") {
|
|
1269
|
-
return
|
|
377
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
1270
378
|
}
|
|
1271
379
|
return loop();
|
|
1272
380
|
};
|
|
1273
381
|
const onSignal = (sig) => {
|
|
1274
382
|
lastSig = sig;
|
|
1275
|
-
return
|
|
383
|
+
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, q.offer(sig), afterOffer);
|
|
1276
384
|
};
|
|
1277
|
-
const loop = () =>
|
|
1278
|
-
producer =
|
|
1279
|
-
return
|
|
385
|
+
const loop = () => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, nextSignal(), onSignal);
|
|
386
|
+
producer = _chunkWQ5QNU5Rcjs.fork.call(void 0, loop(), env);
|
|
387
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0);
|
|
1280
388
|
});
|
|
1281
389
|
const pullDown = {
|
|
1282
390
|
_tag: "Async",
|
|
@@ -1284,7 +392,7 @@ function buffer(stream, capacity, strategy = "backpressure") {
|
|
|
1284
392
|
const go = () => {
|
|
1285
393
|
if (!started) {
|
|
1286
394
|
started = true;
|
|
1287
|
-
|
|
395
|
+
_chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(start(env)).join(() => {
|
|
1288
396
|
pullFromQueue(env, cb);
|
|
1289
397
|
});
|
|
1290
398
|
return;
|
|
@@ -1296,25 +404,25 @@ function buffer(stream, capacity, strategy = "backpressure") {
|
|
|
1296
404
|
};
|
|
1297
405
|
function pullFromQueue(env, cb) {
|
|
1298
406
|
const takeEff = q.take();
|
|
1299
|
-
|
|
407
|
+
_chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, ).fork(takeEff).join((ex) => {
|
|
1300
408
|
if (ex._tag !== "Success") return;
|
|
1301
409
|
const sig = ex.value;
|
|
1302
410
|
switch (sig._tag) {
|
|
1303
411
|
case "Elem":
|
|
1304
|
-
cb({ _tag: "Success", value: [sig.value,
|
|
412
|
+
cb({ _tag: "Success", value: [sig.value, _chunk7HUOJA4Wcjs.fromPull.call(void 0, pullDown)] });
|
|
1305
413
|
return;
|
|
1306
414
|
case "End":
|
|
1307
|
-
_optionalChain([producer, 'optionalAccess',
|
|
1308
|
-
cb({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
415
|
+
_optionalChain([producer, 'optionalAccess', _ => _.interrupt, 'optionalCall', _2 => _2()]);
|
|
416
|
+
cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.none } });
|
|
1309
417
|
return;
|
|
1310
418
|
case "Fail":
|
|
1311
|
-
_optionalChain([producer, 'optionalAccess',
|
|
1312
|
-
cb({ _tag: "Failure", cause: { _tag: "Fail", error:
|
|
419
|
+
_optionalChain([producer, 'optionalAccess', _3 => _3.interrupt, 'optionalCall', _4 => _4()]);
|
|
420
|
+
cb({ _tag: "Failure", cause: { _tag: "Fail", error: _chunkDJQ7OMMBcjs.some.call(void 0, sig.error) } });
|
|
1313
421
|
return;
|
|
1314
422
|
}
|
|
1315
423
|
});
|
|
1316
424
|
}
|
|
1317
|
-
return
|
|
425
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0, pullDown);
|
|
1318
426
|
}
|
|
1319
427
|
|
|
1320
428
|
// src/core/stream/hub.ts
|
|
@@ -1323,45 +431,45 @@ function makeHub(capacity, strategy = "BackPressure") {
|
|
|
1323
431
|
const queues = /* @__PURE__ */ new Set();
|
|
1324
432
|
let closed = false;
|
|
1325
433
|
const publish = (a) => {
|
|
1326
|
-
if (closed) return
|
|
434
|
+
if (closed) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, false);
|
|
1327
435
|
const size = queues.size;
|
|
1328
|
-
if (size === 0) return
|
|
436
|
+
if (size === 0) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, true);
|
|
1329
437
|
if (size === 1) {
|
|
1330
438
|
const q = queues.values().next().value;
|
|
1331
439
|
return q.offer(a);
|
|
1332
440
|
}
|
|
1333
|
-
let eff =
|
|
441
|
+
let eff = _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, true);
|
|
1334
442
|
for (const q of queues) {
|
|
1335
|
-
eff =
|
|
443
|
+
eff = _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
1336
444
|
eff,
|
|
1337
|
-
(okSoFar) =>
|
|
445
|
+
(okSoFar) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, q.offer(a), (ok) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, okSoFar && ok))
|
|
1338
446
|
);
|
|
1339
447
|
}
|
|
1340
448
|
return eff;
|
|
1341
449
|
};
|
|
1342
450
|
const publishAll = (as) => {
|
|
1343
|
-
let eff =
|
|
451
|
+
let eff = _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, true);
|
|
1344
452
|
const it = as[Symbol.iterator]();
|
|
1345
453
|
while (true) {
|
|
1346
454
|
const n = it.next();
|
|
1347
455
|
if (n.done) break;
|
|
1348
456
|
const a = n.value;
|
|
1349
|
-
eff =
|
|
457
|
+
eff = _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
1350
458
|
eff,
|
|
1351
|
-
(okSoFar) =>
|
|
459
|
+
(okSoFar) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, publish(a), (ok) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, okSoFar && ok))
|
|
1352
460
|
);
|
|
1353
461
|
}
|
|
1354
462
|
return eff;
|
|
1355
463
|
};
|
|
1356
464
|
const subscribe = () => {
|
|
1357
465
|
if (closed) {
|
|
1358
|
-
return
|
|
466
|
+
return _chunkDJQ7OMMBcjs.asyncTotal.call(void 0, () => {
|
|
1359
467
|
throw { _tag: "HubClosed" };
|
|
1360
468
|
});
|
|
1361
469
|
}
|
|
1362
|
-
return
|
|
470
|
+
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
1363
471
|
bounded(capacity, toQueueStrategy(strategy)),
|
|
1364
|
-
(q) =>
|
|
472
|
+
(q) => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
1365
473
|
queues.add(q);
|
|
1366
474
|
return {
|
|
1367
475
|
...q,
|
|
@@ -1374,7 +482,7 @@ function makeHub(capacity, strategy = "BackPressure") {
|
|
|
1374
482
|
})
|
|
1375
483
|
);
|
|
1376
484
|
};
|
|
1377
|
-
const shutdown = () =>
|
|
485
|
+
const shutdown = () => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => {
|
|
1378
486
|
if (closed) return;
|
|
1379
487
|
closed = true;
|
|
1380
488
|
for (const q of queues) q.shutdown();
|
|
@@ -1389,23 +497,23 @@ function makeHub(capacity, strategy = "BackPressure") {
|
|
|
1389
497
|
}
|
|
1390
498
|
var broadcast = makeHub;
|
|
1391
499
|
function broadcastToHub(stream, hub) {
|
|
1392
|
-
return
|
|
500
|
+
return _chunk7HUOJA4Wcjs.foreachStream.call(void 0,
|
|
1393
501
|
stream,
|
|
1394
|
-
(a) =>
|
|
502
|
+
(a) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, hub.publish(a), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, void 0))
|
|
1395
503
|
);
|
|
1396
504
|
}
|
|
1397
505
|
function fromHub(hub) {
|
|
1398
|
-
return
|
|
1399
|
-
|
|
1400
|
-
const loop =
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
(a) =>
|
|
506
|
+
return _chunk7HUOJA4Wcjs.managedStream.call(void 0,
|
|
507
|
+
_chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, hub.subscribe(), (sub) => {
|
|
508
|
+
const loop = _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
509
|
+
_chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
510
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, sub.take(), (_queueClosed) => _chunkDJQ7OMMBcjs.none),
|
|
511
|
+
(a) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop])
|
|
1404
512
|
)
|
|
1405
513
|
);
|
|
1406
|
-
return
|
|
514
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, {
|
|
1407
515
|
stream: loop,
|
|
1408
|
-
release: (_exit) =>
|
|
516
|
+
release: (_exit) => _chunkDJQ7OMMBcjs.asyncSync.call(void 0, () => sub.unsubscribe())
|
|
1409
517
|
});
|
|
1410
518
|
})
|
|
1411
519
|
);
|
|
@@ -1415,20 +523,20 @@ function fromHub(hub) {
|
|
|
1415
523
|
var cachedWasmChunkCtor;
|
|
1416
524
|
function resolveWasmChunkBuffer() {
|
|
1417
525
|
if (cachedWasmChunkCtor !== void 0) return cachedWasmChunkCtor;
|
|
1418
|
-
const mod =
|
|
1419
|
-
cachedWasmChunkCtor = _nullishCoalesce(_optionalChain([mod, 'optionalAccess',
|
|
526
|
+
const mod = _chunkWQ5QNU5Rcjs.resolveWasmModule.call(void 0, );
|
|
527
|
+
cachedWasmChunkCtor = _nullishCoalesce(_optionalChain([mod, 'optionalAccess', _5 => _5.BrassWasmChunkBuffer]), () => ( null));
|
|
1420
528
|
return cachedWasmChunkCtor;
|
|
1421
529
|
}
|
|
1422
|
-
var TsChunker = (
|
|
1423
|
-
constructor(maxChunkSize) {;
|
|
530
|
+
var TsChunker = (_class = class {
|
|
531
|
+
constructor(maxChunkSize) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
|
|
1424
532
|
this.maxChunkSize = maxChunkSize;
|
|
1425
533
|
}
|
|
1426
534
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
535
|
+
__init() {this.engine = "ts"}
|
|
536
|
+
__init2() {this.values = []}
|
|
537
|
+
__init3() {this.emittedChunks = 0}
|
|
538
|
+
__init4() {this.emittedItems = 0}
|
|
539
|
+
__init5() {this.flushes = 0}
|
|
1432
540
|
get length() {
|
|
1433
541
|
return this.values.length;
|
|
1434
542
|
}
|
|
@@ -1469,12 +577,12 @@ var TsChunker = (_class2 = class {
|
|
|
1469
577
|
}
|
|
1470
578
|
};
|
|
1471
579
|
}
|
|
1472
|
-
},
|
|
1473
|
-
var WasmChunker = (
|
|
1474
|
-
|
|
1475
|
-
|
|
580
|
+
}, _class);
|
|
581
|
+
var WasmChunker = (_class2 = class {
|
|
582
|
+
__init6() {this.engine = "wasm"}
|
|
583
|
+
__init7() {this.fallbackUsed = false}
|
|
1476
584
|
|
|
1477
|
-
constructor(maxChunkSize) {;
|
|
585
|
+
constructor(maxChunkSize) {;_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);
|
|
1478
586
|
const Ctor = resolveWasmChunkBuffer();
|
|
1479
587
|
if (!Ctor) {
|
|
1480
588
|
throw new Error("brass-runtime wasm chunk buffer is not available. Run npm run build:wasm first.");
|
|
@@ -1505,7 +613,7 @@ var WasmChunker = (_class3 = class {
|
|
|
1505
613
|
stats() {
|
|
1506
614
|
return { engine: "wasm", fallbackUsed: false, data: JSON.parse(this.inner.stats_json()) };
|
|
1507
615
|
}
|
|
1508
|
-
},
|
|
616
|
+
}, _class2);
|
|
1509
617
|
function makeStreamChunker(chunkSize, options = {}) {
|
|
1510
618
|
const size = Math.max(1, chunkSize | 0);
|
|
1511
619
|
const engine = _nullishCoalesce(options.engine, () => ( "ts"));
|
|
@@ -1515,19 +623,19 @@ function makeStreamChunker(chunkSize, options = {}) {
|
|
|
1515
623
|
}
|
|
1516
624
|
function chunks(input, chunkSize, options = {}) {
|
|
1517
625
|
const size = Math.max(1, chunkSize | 0);
|
|
1518
|
-
const loop = (cur) =>
|
|
1519
|
-
const fillChunk = (cur, chunker) =>
|
|
1520
|
-
|
|
626
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0, fillChunk(cur, makeStreamChunker(size, options)));
|
|
627
|
+
const fillChunk = (cur, chunker) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
628
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1521
629
|
(opt) => {
|
|
1522
630
|
if (opt._tag === "None" && !chunker.isEmpty()) {
|
|
1523
|
-
return
|
|
631
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [chunker.takeChunk(), _chunk7HUOJA4Wcjs.fromPull.call(void 0, _chunkDJQ7OMMBcjs.asyncFail.call(void 0, _chunkDJQ7OMMBcjs.none))]);
|
|
1524
632
|
}
|
|
1525
|
-
return
|
|
633
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
1526
634
|
},
|
|
1527
635
|
([a, tail]) => {
|
|
1528
636
|
chunker.push(a);
|
|
1529
637
|
if (chunker.isFull()) {
|
|
1530
|
-
return
|
|
638
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [chunker.takeChunk(), loop(tail)]);
|
|
1531
639
|
}
|
|
1532
640
|
return fillChunk(tail, chunker);
|
|
1533
641
|
}
|
|
@@ -1538,15 +646,15 @@ function mapChunks(input, chunkSize, f, options = {}) {
|
|
|
1538
646
|
const pullOne = (pending, rest) => {
|
|
1539
647
|
if (pending.length > 0) {
|
|
1540
648
|
const [head, ...tail] = pending;
|
|
1541
|
-
return
|
|
649
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0, _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [head, pullOne(tail, rest)]));
|
|
1542
650
|
}
|
|
1543
|
-
return
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
(opt) =>
|
|
651
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
652
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
653
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, rest),
|
|
654
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1547
655
|
([chunk, tail]) => {
|
|
1548
656
|
const mapped = f(chunk);
|
|
1549
|
-
return
|
|
657
|
+
return _chunk7HUOJA4Wcjs.uncons.call(void 0, pullOne(mapped, tail));
|
|
1550
658
|
}
|
|
1551
659
|
)
|
|
1552
660
|
);
|
|
@@ -1559,16 +667,16 @@ function mapChunksEffect(chunkSize, f, options = {}) {
|
|
|
1559
667
|
const pullOne = (pending, rest) => {
|
|
1560
668
|
if (pending.length > 0) {
|
|
1561
669
|
const [head, ...tail] = pending;
|
|
1562
|
-
return
|
|
670
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0, _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [head, pullOne(tail, rest)]));
|
|
1563
671
|
}
|
|
1564
|
-
return
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
(opt) =>
|
|
1568
|
-
([chunk, tail]) =>
|
|
1569
|
-
|
|
1570
|
-
(opt) =>
|
|
1571
|
-
(mapped) =>
|
|
672
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
673
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
674
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, _chunk7HUOJA4Wcjs.uncons.call(void 0, rest), (opt) => _chunk7HUOJA4Wcjs.widenOpt.call(void 0, opt)),
|
|
675
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
676
|
+
([chunk, tail]) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
677
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0, f(chunk), (e) => ({ _tag: "Some", value: e })),
|
|
678
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
679
|
+
(mapped) => _chunk7HUOJA4Wcjs.uncons.call(void 0, pullOne(mapped, tail))
|
|
1572
680
|
)
|
|
1573
681
|
)
|
|
1574
682
|
);
|
|
@@ -1693,8 +801,8 @@ function countCounters(metas) {
|
|
|
1693
801
|
return count;
|
|
1694
802
|
}
|
|
1695
803
|
function fuse(pipeline, options) {
|
|
1696
|
-
const verbose = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1697
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
804
|
+
const verbose = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _6 => _6.verbose]), () => ( _fusionVerbose));
|
|
805
|
+
if (_optionalChain([options, 'optionalAccess', _7 => _7.enabled]) === false || !_fusionEnabled && _optionalChain([options, 'optionalAccess', _8 => _8.enabled]) !== true) {
|
|
1698
806
|
if (verbose) {
|
|
1699
807
|
console.log("[FusionEngine] Fusion disabled by options");
|
|
1700
808
|
}
|
|
@@ -1802,20 +910,20 @@ function applyFused(stream, fused) {
|
|
|
1802
910
|
return arrayToStream(outputArray);
|
|
1803
911
|
}
|
|
1804
912
|
const state = fused.initState();
|
|
1805
|
-
const loop = (cur) =>
|
|
1806
|
-
|
|
1807
|
-
|
|
913
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
914
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
915
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1808
916
|
// End-of-stream or error: propagate
|
|
1809
|
-
(opt) =>
|
|
917
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1810
918
|
([a, tail]) => {
|
|
1811
919
|
const result = fused.step(a, state);
|
|
1812
920
|
switch (result.tag) {
|
|
1813
921
|
case "emit":
|
|
1814
|
-
return
|
|
922
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [result.value, loop(tail)]);
|
|
1815
923
|
case "skip":
|
|
1816
|
-
return
|
|
924
|
+
return _chunk7HUOJA4Wcjs.uncons.call(void 0, loop(tail));
|
|
1817
925
|
case "halt":
|
|
1818
|
-
return
|
|
926
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, _chunkDJQ7OMMBcjs.none);
|
|
1819
927
|
}
|
|
1820
928
|
}
|
|
1821
929
|
)
|
|
@@ -1890,7 +998,7 @@ function deserializeFusedPipeline(serialized) {
|
|
|
1890
998
|
}
|
|
1891
999
|
const carrier = createDeserializedCarrier(metas);
|
|
1892
1000
|
return carrier;
|
|
1893
|
-
} catch (
|
|
1001
|
+
} catch (e2) {
|
|
1894
1002
|
return null;
|
|
1895
1003
|
}
|
|
1896
1004
|
}
|
|
@@ -2001,10 +1109,10 @@ function identity() {
|
|
|
2001
1109
|
}
|
|
2002
1110
|
function mapP(f) {
|
|
2003
1111
|
const pipeline = ((input) => {
|
|
2004
|
-
const onError = (opt) =>
|
|
2005
|
-
const onSuccess = ([a, tail]) =>
|
|
2006
|
-
const loop = (cur) =>
|
|
2007
|
-
|
|
1112
|
+
const onError = (opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
1113
|
+
const onSuccess = ([a, tail]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [f(a), loop(tail)]);
|
|
1114
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1115
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0, _chunk7HUOJA4Wcjs.uncons.call(void 0, cur), onError, onSuccess)
|
|
2008
1116
|
);
|
|
2009
1117
|
return loop(input);
|
|
2010
1118
|
});
|
|
@@ -2013,10 +1121,10 @@ function mapP(f) {
|
|
|
2013
1121
|
}
|
|
2014
1122
|
function filterP(pred) {
|
|
2015
1123
|
const pipeline = ((input) => {
|
|
2016
|
-
const onError = (opt) =>
|
|
2017
|
-
const onSuccess = ([a, tail]) => pred(a) ?
|
|
2018
|
-
const next = (cur) =>
|
|
2019
|
-
const loop = (cur) =>
|
|
1124
|
+
const onError = (opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
1125
|
+
const onSuccess = ([a, tail]) => pred(a) ? _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop(tail)]) : next(tail);
|
|
1126
|
+
const next = (cur) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0, _chunk7HUOJA4Wcjs.uncons.call(void 0, cur), onError, onSuccess);
|
|
1127
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0, next(cur));
|
|
2020
1128
|
return loop(input);
|
|
2021
1129
|
});
|
|
2022
1130
|
pipeline[PURE_PIPELINE_TAG] = { kind: "filter", pred };
|
|
@@ -2024,16 +1132,16 @@ function filterP(pred) {
|
|
|
2024
1132
|
}
|
|
2025
1133
|
function filterMapP(f) {
|
|
2026
1134
|
return ((input) => {
|
|
2027
|
-
const onError = (opt) =>
|
|
2028
|
-
const next = (cur) =>
|
|
2029
|
-
|
|
1135
|
+
const onError = (opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
1136
|
+
const next = (cur) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1137
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
2030
1138
|
onError,
|
|
2031
1139
|
([a, tail]) => {
|
|
2032
1140
|
const ob = f(a);
|
|
2033
|
-
return ob._tag === "Some" ?
|
|
1141
|
+
return ob._tag === "Some" ? _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [ob.value, loop(tail)]) : next(tail);
|
|
2034
1142
|
}
|
|
2035
1143
|
);
|
|
2036
|
-
const loop = (cur) =>
|
|
1144
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0, next(cur));
|
|
2037
1145
|
return loop(input);
|
|
2038
1146
|
});
|
|
2039
1147
|
}
|
|
@@ -2041,12 +1149,12 @@ function takeP(n) {
|
|
|
2041
1149
|
const m = Math.max(0, n | 0);
|
|
2042
1150
|
const pipeline = ((input) => {
|
|
2043
1151
|
const loop = (cur, remaining) => {
|
|
2044
|
-
if (remaining <= 0) return
|
|
2045
|
-
return
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
(opt) =>
|
|
2049
|
-
([a, tail]) =>
|
|
1152
|
+
if (remaining <= 0) return _chunk7HUOJA4Wcjs.emptyStream.call(void 0, );
|
|
1153
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1154
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1155
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1156
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1157
|
+
([a, tail]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop(tail, remaining - 1)])
|
|
2050
1158
|
)
|
|
2051
1159
|
);
|
|
2052
1160
|
};
|
|
@@ -2060,11 +1168,11 @@ function dropP(n) {
|
|
|
2060
1168
|
const pipeline = ((input) => {
|
|
2061
1169
|
const skip = (cur, remaining) => {
|
|
2062
1170
|
if (remaining <= 0) return cur;
|
|
2063
|
-
return
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
(opt) =>
|
|
2067
|
-
([_a, tail]) =>
|
|
1171
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1172
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1173
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1174
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1175
|
+
([_a, tail]) => _chunk7HUOJA4Wcjs.uncons.call(void 0, skip(tail, remaining - 1))
|
|
2068
1176
|
)
|
|
2069
1177
|
);
|
|
2070
1178
|
};
|
|
@@ -2075,19 +1183,19 @@ function dropP(n) {
|
|
|
2075
1183
|
}
|
|
2076
1184
|
function mapEffectP(f) {
|
|
2077
1185
|
return ((input) => {
|
|
2078
|
-
const raiseToOpt = (fa) =>
|
|
2079
|
-
const loop = (cur) =>
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
(opt) =>
|
|
1186
|
+
const raiseToOpt = (fa) => _chunkDJQ7OMMBcjs.asyncMapError.call(void 0, fa, (e) => _chunkDJQ7OMMBcjs.some.call(void 0, e));
|
|
1187
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1188
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1189
|
+
_chunkDJQ7OMMBcjs.asyncMapError.call(void 0,
|
|
1190
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1191
|
+
(opt) => _chunk7HUOJA4Wcjs.widenOpt.call(void 0, opt)
|
|
2084
1192
|
),
|
|
2085
|
-
(opt) =>
|
|
2086
|
-
([a, tail]) =>
|
|
1193
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1194
|
+
([a, tail]) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
2087
1195
|
raiseToOpt(f(a)),
|
|
2088
1196
|
// Async<Rp, ...>
|
|
2089
|
-
(opt2) =>
|
|
2090
|
-
(b) =>
|
|
1197
|
+
(opt2) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt2),
|
|
1198
|
+
(b) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [b, loop(tail)])
|
|
2091
1199
|
)
|
|
2092
1200
|
)
|
|
2093
1201
|
);
|
|
@@ -2095,7 +1203,7 @@ function mapEffectP(f) {
|
|
|
2095
1203
|
});
|
|
2096
1204
|
}
|
|
2097
1205
|
function tapEffectP(f) {
|
|
2098
|
-
return mapEffectP((a) =>
|
|
1206
|
+
return mapEffectP((a) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, f(a), () => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, a)));
|
|
2099
1207
|
}
|
|
2100
1208
|
function chunksP(chunkSize, options = {}) {
|
|
2101
1209
|
return ((input) => chunks(input, chunkSize, options));
|
|
@@ -2110,23 +1218,23 @@ function groupedP(n) {
|
|
|
2110
1218
|
const size = Math.max(1, n | 0);
|
|
2111
1219
|
return ((input) => {
|
|
2112
1220
|
const gather = (cur, remaining, acc) => {
|
|
2113
|
-
if (remaining <= 0) return
|
|
2114
|
-
return
|
|
2115
|
-
|
|
1221
|
+
if (remaining <= 0) return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, { chunk: acc, rest: cur });
|
|
1222
|
+
return _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1223
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
2116
1224
|
(opt) => {
|
|
2117
|
-
if (opt._tag === "None") return
|
|
2118
|
-
return
|
|
1225
|
+
if (opt._tag === "None") return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, { chunk: acc, rest: _chunk7HUOJA4Wcjs.emptyStream.call(void 0, ) });
|
|
1226
|
+
return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt);
|
|
2119
1227
|
},
|
|
2120
1228
|
([a, tail]) => gather(tail, remaining - 1, [...acc, a])
|
|
2121
1229
|
);
|
|
2122
1230
|
};
|
|
2123
|
-
const loop = (cur) =>
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
(opt) =>
|
|
2127
|
-
([a, tail]) =>
|
|
1231
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1232
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1233
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1234
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1235
|
+
([a, tail]) => _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
2128
1236
|
gather(tail, size - 1, [a]),
|
|
2129
|
-
({ chunk, rest }) =>
|
|
1237
|
+
({ chunk, rest }) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [chunk, loop(rest)])
|
|
2130
1238
|
)
|
|
2131
1239
|
)
|
|
2132
1240
|
);
|
|
@@ -2137,25 +1245,25 @@ function groupedP(n) {
|
|
|
2137
1245
|
// src/core/stream/operators.ts
|
|
2138
1246
|
function throttle(stream, intervalMs) {
|
|
2139
1247
|
let lastEmitTime = 0;
|
|
2140
|
-
const loop = (cur) =>
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
(opt) =>
|
|
1248
|
+
const loop = (cur) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1249
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1250
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1251
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
2144
1252
|
([a, tail]) => {
|
|
2145
1253
|
const now = Date.now();
|
|
2146
1254
|
if (now - lastEmitTime >= intervalMs) {
|
|
2147
1255
|
lastEmitTime = now;
|
|
2148
|
-
return
|
|
1256
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop(tail)]);
|
|
2149
1257
|
}
|
|
2150
|
-
return
|
|
1258
|
+
return _chunk7HUOJA4Wcjs.uncons.call(void 0, loop(tail));
|
|
2151
1259
|
}
|
|
2152
1260
|
)
|
|
2153
1261
|
);
|
|
2154
1262
|
return loop(stream);
|
|
2155
1263
|
}
|
|
2156
1264
|
function debounce(stream, delayMs) {
|
|
2157
|
-
return
|
|
2158
|
-
|
|
1265
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1266
|
+
_chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
2159
1267
|
let lastValue;
|
|
2160
1268
|
let hasValue = false;
|
|
2161
1269
|
let timerId;
|
|
@@ -2163,15 +1271,15 @@ function debounce(stream, delayMs) {
|
|
|
2163
1271
|
let tail = stream;
|
|
2164
1272
|
const pullNext = () => {
|
|
2165
1273
|
if (done) return;
|
|
2166
|
-
const pull =
|
|
2167
|
-
pull
|
|
1274
|
+
const pull = _chunk7HUOJA4Wcjs.uncons.call(void 0, tail);
|
|
1275
|
+
_chunkWQ5QNU5Rcjs.unsafeRunAsync.call(void 0, pull, _env, (exit) => {
|
|
2168
1276
|
if (done) return;
|
|
2169
1277
|
if (exit._tag === "Failure") {
|
|
2170
1278
|
if (hasValue) {
|
|
2171
1279
|
const value = lastValue;
|
|
2172
1280
|
hasValue = false;
|
|
2173
1281
|
clearTimeout(timerId);
|
|
2174
|
-
cb({ _tag: "Success", value: [value,
|
|
1282
|
+
cb({ _tag: "Success", value: [value, _chunk7HUOJA4Wcjs.emptyStream.call(void 0, )] });
|
|
2175
1283
|
} else {
|
|
2176
1284
|
cb(exit);
|
|
2177
1285
|
}
|
|
@@ -2201,73 +1309,73 @@ function debounce(stream, delayMs) {
|
|
|
2201
1309
|
);
|
|
2202
1310
|
}
|
|
2203
1311
|
function zip2(left, right) {
|
|
2204
|
-
const loop = (l, r) =>
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
(opt) =>
|
|
2208
|
-
([a, lTail]) =>
|
|
2209
|
-
|
|
2210
|
-
(opt) =>
|
|
2211
|
-
([b, rTail]) =>
|
|
1312
|
+
const loop = (l, r) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1313
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1314
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, l),
|
|
1315
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1316
|
+
([a, lTail]) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1317
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, r),
|
|
1318
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1319
|
+
([b, rTail]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [[a, b], loop(lTail, rTail)])
|
|
2212
1320
|
)
|
|
2213
1321
|
)
|
|
2214
1322
|
);
|
|
2215
1323
|
return loop(left, right);
|
|
2216
1324
|
}
|
|
2217
1325
|
function zipWith(left, right, f) {
|
|
2218
|
-
const loop = (l, r) =>
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
(opt) =>
|
|
2222
|
-
([a, lTail]) =>
|
|
2223
|
-
|
|
2224
|
-
(opt) =>
|
|
2225
|
-
([b, rTail]) =>
|
|
1326
|
+
const loop = (l, r) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1327
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1328
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, l),
|
|
1329
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1330
|
+
([a, lTail]) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1331
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, r),
|
|
1332
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1333
|
+
([b, rTail]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [f(a, b), loop(lTail, rTail)])
|
|
2226
1334
|
)
|
|
2227
1335
|
)
|
|
2228
1336
|
);
|
|
2229
1337
|
return loop(left, right);
|
|
2230
1338
|
}
|
|
2231
1339
|
function scan(stream, initial, f) {
|
|
2232
|
-
const loop = (cur, acc) =>
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
(opt) =>
|
|
1340
|
+
const loop = (cur, acc) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1341
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1342
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1343
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
2236
1344
|
([a, tail]) => {
|
|
2237
1345
|
const next = f(acc, a);
|
|
2238
|
-
return
|
|
1346
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [next, loop(tail, next)]);
|
|
2239
1347
|
}
|
|
2240
1348
|
)
|
|
2241
1349
|
);
|
|
2242
|
-
return
|
|
2243
|
-
|
|
1350
|
+
return _chunk7HUOJA4Wcjs.concatStream.call(void 0,
|
|
1351
|
+
_chunk7HUOJA4Wcjs.emitStream.call(void 0, _chunkDJQ7OMMBcjs.succeed.call(void 0, initial)),
|
|
2244
1352
|
loop(stream, initial)
|
|
2245
1353
|
);
|
|
2246
1354
|
}
|
|
2247
1355
|
function interleave(left, right) {
|
|
2248
|
-
const loop = (l, r, pickLeft) =>
|
|
2249
|
-
|
|
2250
|
-
|
|
1356
|
+
const loop = (l, r, pickLeft) => _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1357
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1358
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, pickLeft ? l : r),
|
|
2251
1359
|
// Current stream ended — drain the other
|
|
2252
|
-
(_opt) =>
|
|
1360
|
+
(_opt) => _chunk7HUOJA4Wcjs.uncons.call(void 0, pickLeft ? r : l),
|
|
2253
1361
|
([a, tail]) => {
|
|
2254
1362
|
const nextL = pickLeft ? tail : l;
|
|
2255
1363
|
const nextR = pickLeft ? r : tail;
|
|
2256
|
-
return
|
|
1364
|
+
return _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop(nextL, nextR, !pickLeft)]);
|
|
2257
1365
|
}
|
|
2258
1366
|
)
|
|
2259
1367
|
);
|
|
2260
1368
|
return loop(left, right, true);
|
|
2261
1369
|
}
|
|
2262
1370
|
function take2(stream, n) {
|
|
2263
|
-
if (n <= 0) return
|
|
1371
|
+
if (n <= 0) return _chunk7HUOJA4Wcjs.emptyStream.call(void 0, );
|
|
2264
1372
|
const loop = (cur, remaining) => {
|
|
2265
|
-
if (remaining <= 0) return
|
|
2266
|
-
return
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
(opt) =>
|
|
2270
|
-
([a, tail]) =>
|
|
1373
|
+
if (remaining <= 0) return _chunk7HUOJA4Wcjs.emptyStream.call(void 0, );
|
|
1374
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1375
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1376
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1377
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1378
|
+
([a, tail]) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, [a, loop(tail, remaining - 1)])
|
|
2271
1379
|
)
|
|
2272
1380
|
);
|
|
2273
1381
|
};
|
|
@@ -2277,11 +1385,11 @@ function drop(stream, n) {
|
|
|
2277
1385
|
if (n <= 0) return stream;
|
|
2278
1386
|
const skip = (cur, remaining) => {
|
|
2279
1387
|
if (remaining <= 0) return cur;
|
|
2280
|
-
return
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
(opt) =>
|
|
2284
|
-
([_a, tail]) =>
|
|
1388
|
+
return _chunk7HUOJA4Wcjs.fromPull.call(void 0,
|
|
1389
|
+
_chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
1390
|
+
_chunk7HUOJA4Wcjs.uncons.call(void 0, cur),
|
|
1391
|
+
(opt) => _chunkDJQ7OMMBcjs.asyncFail.call(void 0, opt),
|
|
1392
|
+
([_a, tail]) => _chunk7HUOJA4Wcjs.uncons.call(void 0, skip(tail, remaining - 1))
|
|
2285
1393
|
)
|
|
2286
1394
|
);
|
|
2287
1395
|
};
|
|
@@ -2500,4 +1608,33 @@ function selectedEngineStats(requested, engine, data) {
|
|
|
2500
1608
|
|
|
2501
1609
|
|
|
2502
1610
|
|
|
2503
|
-
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
exports.ABI_VERSION = _chunkWQ5QNU5Rcjs.ABI_VERSION; exports.Async = _chunkDJQ7OMMBcjs.Async; exports.Cause = _chunkDJQ7OMMBcjs.Cause; exports.DefaultHostExecutor = _chunkWQ5QNU5Rcjs.DefaultHostExecutor; exports.EVENT_WORDS = _chunkWQ5QNU5Rcjs.EVENT_WORDS; exports.EngineFiberHandle = _chunkWQ5QNU5Rcjs.EngineFiberHandle; exports.EventBus = _chunkJX3LZQJHcjs.EventBus; exports.EventKindCode = _chunkWQ5QNU5Rcjs.EventKindCode; exports.Exit = _chunkDJQ7OMMBcjs.Exit; exports.HostRegistry = _chunkWQ5QNU5Rcjs.HostRegistry; exports.InMemoryTracer = _chunkJX3LZQJHcjs.InMemoryTracer; exports.JsFiberEngine = _chunkWQ5QNU5Rcjs.JsFiberEngine; exports.NONE_U32 = _chunkWQ5QNU5Rcjs.NONE_U32; exports.NoopHooks = _chunkWQ5QNU5Rcjs.NoopHooks; exports.OpcodeTagCode = _chunkWQ5QNU5Rcjs.OpcodeTagCode; exports.PURE_PIPELINE_TAG = PURE_PIPELINE_TAG; exports.ProgramBuilder = _chunkWQ5QNU5Rcjs.ProgramBuilder; exports.PushStatus = _chunkWQ5QNU5Rcjs.PushStatus; exports.Resource = _chunkJF4XXPZ5cjs.Resource; exports.RingBuffer = _chunkWQ5QNU5Rcjs.RingBuffer; exports.Runtime = _chunkWQ5QNU5Rcjs.Runtime; exports.RuntimeFiber = _chunkWQ5QNU5Rcjs.RuntimeFiber; exports.RuntimeRegistry = _chunkMWXMNYJScjs.RuntimeRegistry; exports.Scheduler = _chunkWQ5QNU5Rcjs.Scheduler; exports.Scope = _chunkTVN5I4U6cjs.Scope; exports.Supervisor = _chunkMWXMNYJScjs.Supervisor; exports.WasmFiberEngine = _chunkWQ5QNU5Rcjs.WasmFiberEngine; exports.WasmFiberRegistryBridge = _chunkWQ5QNU5Rcjs.WasmFiberRegistryBridge; exports.WasmPackFiberBridge = _chunkWQ5QNU5Rcjs.WasmPackFiberBridge; exports.abortablePromiseStats = _chunkWQ5QNU5Rcjs.abortablePromiseStats; exports.acquireRelease = _chunkDJQ7OMMBcjs.acquireRelease; exports.andThen = andThen2; exports.andThenSchedule = _chunkJF4XXPZ5cjs.andThen; exports.applyFused = applyFused; exports.assertCompletesWithin = _chunkMWXMNYJScjs.assertCompletesWithin; exports.assertFails = _chunkMWXMNYJScjs.assertFails; exports.assertFailsWith = _chunkMWXMNYJScjs.assertFailsWith; exports.assertNever = _chunk7HUOJA4Wcjs.assertNever; exports.assertSucceeds = _chunkMWXMNYJScjs.assertSucceeds; exports.async = _chunkDJQ7OMMBcjs.asyncEffect; exports.asyncCatchAll = _chunkDJQ7OMMBcjs.asyncCatchAll; exports.asyncFail = _chunkDJQ7OMMBcjs.asyncFail; exports.asyncFlatMap = _chunkDJQ7OMMBcjs.asyncFlatMap; exports.asyncFold = _chunkDJQ7OMMBcjs.asyncFold; exports.asyncInterruptible = _chunkDJQ7OMMBcjs.asyncInterruptible; exports.asyncMap = _chunkDJQ7OMMBcjs.asyncMap; exports.asyncMapError = _chunkDJQ7OMMBcjs.asyncMapError; exports.asyncSucceed = _chunkDJQ7OMMBcjs.asyncSucceed; exports.asyncSync = _chunkDJQ7OMMBcjs.asyncSync; exports.asyncTotal = _chunkDJQ7OMMBcjs.asyncTotal; exports.bounded = bounded; exports.bracket = _chunkJF4XXPZ5cjs.bracket; exports.broadcast = broadcast; exports.broadcastToHub = broadcastToHub; exports.buffer = buffer; exports.bufferP = bufferP; exports.catchAll = _chunkDJQ7OMMBcjs.catchAll; exports.catchTag = _chunkMWXMNYJScjs.catchTag; exports.catchTags = _chunkMWXMNYJScjs.catchTags; exports.chunks = chunks; exports.chunksP = chunksP; exports.collectAllPar = _chunkNYL4D7SKcjs.collectAllPar; exports.collectStream = _chunk7HUOJA4Wcjs.collectStream; exports.compose = compose2; exports.composeLayer = _chunkMWXMNYJScjs.compose; exports.concatStream = _chunk7HUOJA4Wcjs.concatStream; exports.consoleJsonLogger = _chunkMWXMNYJScjs.consoleJsonLogger; exports.contramapSchedule = _chunkJF4XXPZ5cjs.contramap; exports.ctxExtend = _chunkWQ5QNU5Rcjs.ctxExtend; exports.ctxToObject = _chunkWQ5QNU5Rcjs.ctxToObject; exports.debounce = debounce; exports.decodeEvent = _chunkWQ5QNU5Rcjs.decodeEvent; exports.decodeEventBatch = _chunkWQ5QNU5Rcjs.decodeEventBatch; exports.defaultTracer = _chunkMWXMNYJScjs.defaultTracer; exports.delayedEffect = _chunkMWXMNYJScjs.delayedEffect; exports.derivedRef = _chunkMWXMNYJScjs.derivedRef; exports.deserializeFusedPipeline = deserializeFusedPipeline; exports.dropP = dropP; exports.dropStream = drop; exports.dumpAllFibers = _chunkMWXMNYJScjs.dumpAllFibers; exports.elapsed = _chunkJF4XXPZ5cjs.elapsed; exports.emitStream = _chunk7HUOJA4Wcjs.emitStream; exports.emptyContext = _chunkWQ5QNU5Rcjs.emptyContext; exports.emptyStream = _chunk7HUOJA4Wcjs.emptyStream; exports.encodeOpcodeNodes = _chunkWQ5QNU5Rcjs.encodeOpcodeNodes; exports.encodeOpcodeProgram = _chunkWQ5QNU5Rcjs.encodeOpcodeProgram; exports.end = _chunkDJQ7OMMBcjs.end; exports.engineStats = engineStats; exports.ensuring = _chunkJF4XXPZ5cjs.ensuring; exports.exponential = _chunkJF4XXPZ5cjs.exponential; exports.fail = _chunkDJQ7OMMBcjs.fail; exports.fibonacci = _chunkJF4XXPZ5cjs.fibonacci; exports.filterMapP = filterMapP; exports.filterP = filterP; exports.fixed = _chunkJF4XXPZ5cjs.fixed; exports.flakyEffect = _chunkMWXMNYJScjs.flakyEffect; exports.flatMap = _chunkDJQ7OMMBcjs.flatMap; exports.flattenStream = _chunk7HUOJA4Wcjs.flattenStream; exports.foreachStream = _chunk7HUOJA4Wcjs.foreachStream; exports.fork = _chunkWQ5QNU5Rcjs.fork; exports.fromArray = _chunk7HUOJA4Wcjs.fromArray; exports.fromHub = fromHub; exports.fromPromiseAbortable = _chunkWQ5QNU5Rcjs.fromPromiseAbortable; exports.fromPull = _chunk7HUOJA4Wcjs.fromPull; exports.fuse = fuse; exports.getBenchmarkBudget = _chunkWQ5QNU5Rcjs.getBenchmarkBudget; exports.getCurrentFiber = _chunkWQ5QNU5Rcjs.getCurrentFiber; exports.getStats = getStats; exports.globalScheduler = _chunkWQ5QNU5Rcjs.globalScheduler; exports.gracefulShutdown = _chunkMWXMNYJScjs.gracefulShutdown; exports.groupedP = groupedP; exports.identity = identity; exports.inferCallerLaneFromStack = _chunkWQ5QNU5Rcjs.inferCallerLaneFromStack; exports.initState = initState; exports.interleave = interleave; exports.intersect = _chunkJF4XXPZ5cjs.intersect; exports.isFusionEnabled = isFusionEnabled; exports.isFusionVerbose = isFusionVerbose; exports.jitter = _chunkJF4XXPZ5cjs.jitter; exports.jittered = _chunkJF4XXPZ5cjs.jittered; exports.jitteredSchedule = _chunkJF4XXPZ5cjs.jitteredSchedule; exports.joinSupervised = _chunkMWXMNYJScjs.joinSupervised; exports.laneTag = _chunkWQ5QNU5Rcjs.laneTag; exports.layer = _chunkMWXMNYJScjs.layer; exports.layerFail = _chunkMWXMNYJScjs.layerFail; exports.layerFrom = _chunkMWXMNYJScjs.layerFrom; exports.layerSucceed = _chunkMWXMNYJScjs.layerSucceed; exports.linkAbortController = _chunkMWXMNYJScjs.linkAbortController; exports.makeBoundedRingBuffer = _chunkWQ5QNU5Rcjs.makeBoundedRingBuffer; exports.makeCancelToken = _chunkMWXMNYJScjs.makeCancelToken; exports.makeCircuitBreaker = _chunkJF4XXPZ5cjs.makeCircuitBreaker; exports.makeFiberReadyQueue = _chunkWQ5QNU5Rcjs.makeFiberReadyQueue; exports.makeHub = makeHub; exports.makeMetrics = _chunkJX3LZQJHcjs.makeMetrics; exports.makeRef = _chunkMWXMNYJScjs.makeRef; exports.makeResource = _chunkJF4XXPZ5cjs.makeResource; exports.makeRuntimeEventRecord = _chunkJX3LZQJHcjs.makeRuntimeEventRecord; exports.makeSemaphore = _chunkMWXMNYJScjs.makeSemaphore; exports.makeStreamChunker = makeStreamChunker; exports.makeSupervisor = _chunkMWXMNYJScjs.makeSupervisor; exports.makeTestRuntime = _chunkMWXMNYJScjs.makeTestRuntime; exports.makeTracer = _chunkMWXMNYJScjs.makeTracer; exports.makeWorkerPool = _chunkMWXMNYJScjs.makeWorkerPool; exports.managed = _chunkJF4XXPZ5cjs.managed; exports.managedAll = _chunkJF4XXPZ5cjs.managedAll; exports.managedStream = _chunk7HUOJA4Wcjs.managedStream; exports.map = _chunkDJQ7OMMBcjs.map; exports.mapAsync = _chunkDJQ7OMMBcjs.mapAsync; exports.mapChunks = mapChunks; exports.mapChunksEffect = mapChunksEffect; exports.mapChunksEffectP = mapChunksEffectP; exports.mapEffectP = mapEffectP; exports.mapError = _chunkDJQ7OMMBcjs.mapError; exports.mapErrorTyped = _chunkMWXMNYJScjs.mapError; exports.mapLayer = _chunkMWXMNYJScjs.mapLayer; exports.mapP = mapP; exports.mapSchedule = _chunkJF4XXPZ5cjs.map; exports.mapStream = _chunk7HUOJA4Wcjs.mapStream; exports.mapTryAsync = _chunkDJQ7OMMBcjs.mapTryAsync; exports.merge = _chunk7HUOJA4Wcjs.merge; exports.mergeLayer = _chunkMWXMNYJScjs.merge; exports.mergeStream = _chunk7HUOJA4Wcjs.mergeStream; exports.neverEffect = _chunkMWXMNYJScjs.neverEffect; exports.none = _chunkDJQ7OMMBcjs.none; exports.orElse = _chunkMWXMNYJScjs.orElse; exports.orElseOptional = _chunkDJQ7OMMBcjs.orElseOptional; exports.provideLayer = _chunkMWXMNYJScjs.provideLayer; exports.race = _chunkNYL4D7SKcjs.race; exports.raceWith = _chunkNYL4D7SKcjs.raceWith; exports.rangeStream = _chunk7HUOJA4Wcjs.rangeStream; exports.recurs = _chunkJF4XXPZ5cjs.recurs; exports.registerShutdownHooks = _chunkMWXMNYJScjs.registerShutdownHooks; exports.repeatWithSchedule = _chunkJF4XXPZ5cjs.repeatWithSchedule; exports.resetAbortablePromiseStats = _chunkWQ5QNU5Rcjs.resetAbortablePromiseStats; exports.resource = _chunkJF4XXPZ5cjs.resource; exports.resourceAll = _chunkJF4XXPZ5cjs.resourceAll; exports.resourceFromManaged = _chunkJF4XXPZ5cjs.resourceFromManaged; exports.resourceSucceed = _chunkJF4XXPZ5cjs.resourceSucceed; exports.retry = _chunk45F7OKGTcjs.retry; exports.retryN = _chunk45F7OKGTcjs.retryN; exports.retryWithBackoff = _chunk45F7OKGTcjs.retryWithBackoff; exports.retryWithSchedule = _chunkJF4XXPZ5cjs.retryWithSchedule; exports.runFusedArray = runFusedArray; exports.runtimeCapabilities = _chunkWQ5QNU5Rcjs.runtimeCapabilities; exports.runtimeEventRecordContext = _chunkJX3LZQJHcjs.runtimeEventRecordContext; exports.runtimeForCaller = _chunkWQ5QNU5Rcjs.runtimeForCaller; exports.runtimeHooksToEventHandler = _chunkJX3LZQJHcjs.runtimeHooksToEventHandler; exports.sanitizeLaneKey = _chunkWQ5QNU5Rcjs.sanitizeLaneKey; exports.scan = scan; exports.selectedEngineStats = selectedEngineStats; exports.serializeFusedPipeline = serializeFusedPipeline; exports.setBenchmarkBudget = _chunkWQ5QNU5Rcjs.setBenchmarkBudget; exports.setFusionEnabled = setFusionEnabled; exports.setFusionVerbose = setFusionVerbose; exports.sleep = _chunk45F7OKGTcjs.sleep; exports.some = _chunkDJQ7OMMBcjs.some; exports.streamFromReadableStream = _chunk7HUOJA4Wcjs.streamFromReadableStream; exports.succeed = _chunkDJQ7OMMBcjs.succeed; exports.supervise = _chunkMWXMNYJScjs.supervise; exports.sync = _chunkDJQ7OMMBcjs.sync; exports.tagError = _chunkMWXMNYJScjs.tagError; exports.takeP = takeP; exports.takeSchedule = _chunkJF4XXPZ5cjs.take; exports.takeStream = take2; exports.tapEffectP = tapEffectP; exports.throttle = throttle; exports.timeout = _chunk45F7OKGTcjs.timeout; exports.toPromise = _chunkWQ5QNU5Rcjs.toPromise; exports.toPromiseByCaller = _chunkWQ5QNU5Rcjs.toPromiseByCaller; exports.uncons = _chunk7HUOJA4Wcjs.uncons; exports.union = _chunkJF4XXPZ5cjs.union; exports.unit = _chunkDJQ7OMMBcjs.unit; exports.unsafeGetCurrentRuntime = _chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime; exports.unsafeRunAsync = _chunkWQ5QNU5Rcjs.unsafeRunAsync; exports.unsafeRunFoldWithEnv = _chunkWQ5QNU5Rcjs.unsafeRunFoldWithEnv; exports.unwrapScoped = _chunk7HUOJA4Wcjs.unwrapScoped; exports.useManaged = _chunkJF4XXPZ5cjs.useManaged; exports.useResource = _chunkJF4XXPZ5cjs.useResource; exports.via = via; exports.whileInput = _chunkJF4XXPZ5cjs.whileInput; exports.widenOpt = _chunk7HUOJA4Wcjs.widenOpt; exports.windowed = _chunkJF4XXPZ5cjs.windowed; exports.withAsyncPromise = _chunkDJQ7OMMBcjs.withAsyncPromise; exports.withCurrentFiber = _chunkWQ5QNU5Rcjs.withCurrentFiber; exports.withScope = _chunkTVN5I4U6cjs.withScope; exports.withScopeAsync = _chunkTVN5I4U6cjs.withScopeAsync; exports.zip = _chunk7HUOJA4Wcjs.zip; exports.zipPar = _chunkNYL4D7SKcjs.zipPar; exports.zipStream = zip2; exports.zipWith = zipWith;
|