@dxos/effect 0.8.4-main.3c1ae3b → 0.8.4-main.3eb6e50203
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/dist/lib/browser/chunk-CGS2ULMK.mjs +11 -0
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +203 -29
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing.mjs +3 -1
- package/dist/lib/browser/testing.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +203 -29
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing.mjs +3 -1
- package/dist/lib/node-esm/testing.mjs.map +3 -3
- package/dist/types/src/RuntimeProvider.d.ts +21 -0
- package/dist/types/src/RuntimeProvider.d.ts.map +1 -0
- package/dist/types/src/ast.d.ts +2 -1
- package/dist/types/src/ast.d.ts.map +1 -1
- package/dist/types/src/atom-kvs.d.ts +19 -0
- package/dist/types/src/atom-kvs.d.ts.map +1 -0
- package/dist/types/src/dynamic-runtime.d.ts +56 -0
- package/dist/types/src/dynamic-runtime.d.ts.map +1 -0
- package/dist/types/src/dynamic-runtime.test.d.ts +2 -0
- package/dist/types/src/dynamic-runtime.test.d.ts.map +1 -0
- package/dist/types/src/errors.d.ts +12 -0
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/json-path.d.ts +2 -2
- package/dist/types/src/json-path.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +1 -0
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -9
- package/src/RuntimeProvider.ts +35 -0
- package/src/ast.test.ts +25 -0
- package/src/ast.ts +6 -3
- package/src/atom-kvs.ts +35 -0
- package/src/dynamic-runtime.test.ts +465 -0
- package/src/dynamic-runtime.ts +195 -0
- package/src/errors.ts +69 -8
- package/src/index.ts +3 -0
- package/src/interrupt.test.ts +3 -1
- package/src/json-path.test.ts +7 -7
- package/src/json-path.ts +9 -12
- package/src/layers.test.ts +4 -2
- package/src/resource.ts +2 -2
- package/src/sanity.test.ts +6 -4
- package/src/testing.ts +3 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "@dxos/node-std/globals";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__export
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-CGS2ULMK.mjs.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
|
+
import {
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-CGS2ULMK.mjs";
|
|
2
5
|
|
|
3
6
|
// src/ast.ts
|
|
4
7
|
import * as Function from "effect/Function";
|
|
@@ -10,13 +13,12 @@ import { isNonNullable } from "@dxos/util";
|
|
|
10
13
|
var __dxlog_file = "/__w/dxos/dxos/packages/common/effect/src/ast.ts";
|
|
11
14
|
var reduceRefinements = (type, refinements = []) => {
|
|
12
15
|
if (SchemaAST.isRefinement(type)) {
|
|
13
|
-
const annotations = type.annotations;
|
|
14
16
|
const filter = type.filter;
|
|
15
17
|
const nextType = {
|
|
16
18
|
...type.from,
|
|
17
19
|
annotations: {
|
|
18
|
-
...type.annotations,
|
|
19
|
-
...annotations
|
|
20
|
+
...type.from.annotations,
|
|
21
|
+
...type.annotations
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
return reduceRefinements(nextType, [
|
|
@@ -140,7 +142,7 @@ var findProperty = (schema, path) => {
|
|
|
140
142
|
const typeNode = findNode(node, SchemaAST.isTypeLiteral);
|
|
141
143
|
invariant(typeNode, void 0, {
|
|
142
144
|
F: __dxlog_file,
|
|
143
|
-
L:
|
|
145
|
+
L: 237,
|
|
144
146
|
S: void 0,
|
|
145
147
|
A: [
|
|
146
148
|
"typeNode",
|
|
@@ -209,7 +211,7 @@ var isDiscriminatedUnion = (node) => {
|
|
|
209
211
|
var getDiscriminatingProps = (node) => {
|
|
210
212
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
211
213
|
F: __dxlog_file,
|
|
212
|
-
L:
|
|
214
|
+
L: 355,
|
|
213
215
|
S: void 0,
|
|
214
216
|
A: [
|
|
215
217
|
"SchemaAST.isUnion(node)",
|
|
@@ -227,7 +229,7 @@ var getDiscriminatingProps = (node) => {
|
|
|
227
229
|
var getDiscriminatedType = (node, value = {}) => {
|
|
228
230
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
229
231
|
F: __dxlog_file,
|
|
230
|
-
L:
|
|
232
|
+
L: 379,
|
|
231
233
|
S: void 0,
|
|
232
234
|
A: [
|
|
233
235
|
"SchemaAST.isUnion(node)",
|
|
@@ -236,7 +238,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
236
238
|
});
|
|
237
239
|
invariant(value, void 0, {
|
|
238
240
|
F: __dxlog_file,
|
|
239
|
-
L:
|
|
241
|
+
L: 380,
|
|
240
242
|
S: void 0,
|
|
241
243
|
A: [
|
|
242
244
|
"value",
|
|
@@ -251,7 +253,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
251
253
|
const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
|
|
252
254
|
invariant(SchemaAST.isLiteral(prop.type), void 0, {
|
|
253
255
|
F: __dxlog_file,
|
|
254
|
-
L:
|
|
256
|
+
L: 391,
|
|
255
257
|
S: void 0,
|
|
256
258
|
A: [
|
|
257
259
|
"SchemaAST.isLiteral(prop.type)",
|
|
@@ -269,7 +271,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
269
271
|
const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
|
|
270
272
|
invariant(SchemaAST.isLiteral(literal.type), void 0, {
|
|
271
273
|
F: __dxlog_file,
|
|
272
|
-
L:
|
|
274
|
+
L: 409,
|
|
273
275
|
S: void 0,
|
|
274
276
|
A: [
|
|
275
277
|
"SchemaAST.isLiteral(literal.type)",
|
|
@@ -326,6 +328,20 @@ var getIndexSignatures = (ast) => {
|
|
|
326
328
|
return [];
|
|
327
329
|
};
|
|
328
330
|
|
|
331
|
+
// src/atom-kvs.ts
|
|
332
|
+
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
333
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
334
|
+
var defaultRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
335
|
+
var createKvsStore = (options) => {
|
|
336
|
+
const runtime2 = options.runtime ?? defaultRuntime;
|
|
337
|
+
return Atom.kvs({
|
|
338
|
+
runtime: runtime2,
|
|
339
|
+
key: options.key,
|
|
340
|
+
schema: options.schema,
|
|
341
|
+
defaultValue: options.defaultValue
|
|
342
|
+
}).pipe(Atom.keepAlive);
|
|
343
|
+
};
|
|
344
|
+
|
|
329
345
|
// src/context.ts
|
|
330
346
|
import * as Effect from "effect/Effect";
|
|
331
347
|
import { Context } from "@dxos/context";
|
|
@@ -339,6 +355,17 @@ var contextFromScope = () => Effect.gen(function* () {
|
|
|
339
355
|
return ctx;
|
|
340
356
|
});
|
|
341
357
|
|
|
358
|
+
// src/dynamic-runtime.ts
|
|
359
|
+
var dynamic_runtime_exports = {};
|
|
360
|
+
__export(dynamic_runtime_exports, {
|
|
361
|
+
make: () => make
|
|
362
|
+
});
|
|
363
|
+
import * as Context2 from "effect/Context";
|
|
364
|
+
import * as Effect3 from "effect/Effect";
|
|
365
|
+
import * as Exit2 from "effect/Exit";
|
|
366
|
+
import * as Option3 from "effect/Option";
|
|
367
|
+
import * as Runtime2 from "effect/Runtime";
|
|
368
|
+
|
|
342
369
|
// src/errors.ts
|
|
343
370
|
import * as Cause from "effect/Cause";
|
|
344
371
|
import * as Chunk from "effect/Chunk";
|
|
@@ -346,15 +373,18 @@ import * as Effect2 from "effect/Effect";
|
|
|
346
373
|
import * as Exit from "effect/Exit";
|
|
347
374
|
import * as GlobalValue from "effect/GlobalValue";
|
|
348
375
|
import * as Option2 from "effect/Option";
|
|
376
|
+
import * as Runtime from "effect/Runtime";
|
|
349
377
|
var spanSymbol = Symbol.for("effect/SpanAnnotation");
|
|
350
|
-
var originalSymbol = Symbol.for("effect/OriginalAnnotation");
|
|
351
378
|
var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
352
379
|
var locationRegex = /\((.*)\)/g;
|
|
353
380
|
var prettyErrorStack = (error, appendStacks = []) => {
|
|
381
|
+
if (typeof error !== "object" || error === null) {
|
|
382
|
+
return error;
|
|
383
|
+
}
|
|
354
384
|
const span = error[spanSymbol];
|
|
355
385
|
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
356
386
|
const out = [];
|
|
357
|
-
let atStack = false;
|
|
387
|
+
let atStack = false, inCore = false, passedScheduler = false;
|
|
358
388
|
for (let i = 0; i < lines.length; i++) {
|
|
359
389
|
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
360
390
|
out.push(lines[i]);
|
|
@@ -371,6 +401,26 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
371
401
|
if (lines[i].includes("effect_internal_function")) {
|
|
372
402
|
break;
|
|
373
403
|
}
|
|
404
|
+
const filename = lines[i].match(/\/([a-zA-Z0-9_\-.]+):\d+:\d+\)$/)?.[1];
|
|
405
|
+
if (!inCore && [
|
|
406
|
+
"core-effect.ts"
|
|
407
|
+
].includes(filename)) {
|
|
408
|
+
inCore = true;
|
|
409
|
+
}
|
|
410
|
+
if (inCore && !passedScheduler && [
|
|
411
|
+
"Scheduler.ts"
|
|
412
|
+
].includes(filename)) {
|
|
413
|
+
passedScheduler = true;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (passedScheduler && ![
|
|
417
|
+
"Scheduler.ts"
|
|
418
|
+
].includes(filename)) {
|
|
419
|
+
inCore = false;
|
|
420
|
+
}
|
|
421
|
+
if (inCore) {
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
374
424
|
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
375
425
|
}
|
|
376
426
|
if (span) {
|
|
@@ -401,9 +451,7 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
401
451
|
}
|
|
402
452
|
}
|
|
403
453
|
out.push(...appendStacks);
|
|
404
|
-
|
|
405
|
-
error = error[originalSymbol];
|
|
406
|
-
}
|
|
454
|
+
error = Cause.originalError(error);
|
|
407
455
|
if (error.cause) {
|
|
408
456
|
error.cause = prettyErrorStack(error.cause);
|
|
409
457
|
}
|
|
@@ -426,8 +474,8 @@ var causeToError = (cause) => {
|
|
|
426
474
|
...Chunk.toArray(Cause.defects(cause))
|
|
427
475
|
];
|
|
428
476
|
const getStackFrames = () => {
|
|
429
|
-
const o =
|
|
430
|
-
Error.captureStackTrace(o,
|
|
477
|
+
const o = new Error();
|
|
478
|
+
Error.captureStackTrace(o, causeToError);
|
|
431
479
|
return o.stack.split("\n").slice(1);
|
|
432
480
|
};
|
|
433
481
|
const stackFrames = getStackFrames();
|
|
@@ -452,6 +500,21 @@ var runAndForwardErrors = async (effect, options) => {
|
|
|
452
500
|
const exit = await Effect2.runPromiseExit(effect, options);
|
|
453
501
|
return unwrapExit(exit);
|
|
454
502
|
};
|
|
503
|
+
var runInRuntime = (...args) => {
|
|
504
|
+
if (args.length === 1) {
|
|
505
|
+
const [runtime2] = args;
|
|
506
|
+
return async (effect, options) => {
|
|
507
|
+
const exit = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
508
|
+
return unwrapExit(exit);
|
|
509
|
+
};
|
|
510
|
+
} else {
|
|
511
|
+
const [runtime2, effect, options] = args;
|
|
512
|
+
return (async () => {
|
|
513
|
+
const exit = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
514
|
+
return unwrapExit(exit);
|
|
515
|
+
})();
|
|
516
|
+
}
|
|
517
|
+
};
|
|
455
518
|
var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
456
519
|
try {
|
|
457
520
|
const result = await evaluate(signal);
|
|
@@ -461,8 +524,96 @@ var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
|
461
524
|
}
|
|
462
525
|
}).pipe(Effect2.flatten);
|
|
463
526
|
|
|
527
|
+
// src/dynamic-runtime.ts
|
|
528
|
+
var validateTags = (context, tags) => Effect3.gen(function* () {
|
|
529
|
+
const missingTags = [];
|
|
530
|
+
for (const tag of tags) {
|
|
531
|
+
const option = Context2.getOption(context, tag);
|
|
532
|
+
if (Option3.isNone(option)) {
|
|
533
|
+
missingTags.push(tag.key);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (missingTags.length > 0) {
|
|
537
|
+
return yield* Effect3.die(new Error(`Missing required tags in runtime: ${missingTags.join(", ")}`));
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
function make(managedRuntime, tags) {
|
|
541
|
+
const managedRuntimeAny = managedRuntime;
|
|
542
|
+
let cachedRuntime;
|
|
543
|
+
let validatedRuntimePromise;
|
|
544
|
+
const getValidatedRuntimeAsync = async () => {
|
|
545
|
+
if (!validatedRuntimePromise) {
|
|
546
|
+
validatedRuntimePromise = managedRuntimeAny.runPromise(Effect3.gen(function* () {
|
|
547
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
548
|
+
yield* validateTags(rt.context, tags);
|
|
549
|
+
return rt;
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
return validatedRuntimePromise;
|
|
553
|
+
};
|
|
554
|
+
const getValidatedRuntime = () => {
|
|
555
|
+
const validationExit = managedRuntimeAny.runSyncExit(Effect3.gen(function* () {
|
|
556
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
557
|
+
yield* validateTags(rt.context, tags);
|
|
558
|
+
return rt;
|
|
559
|
+
}));
|
|
560
|
+
return unwrapExit(validationExit);
|
|
561
|
+
};
|
|
562
|
+
return {
|
|
563
|
+
managedRuntime: managedRuntimeAny,
|
|
564
|
+
runPromise: async (effect) => {
|
|
565
|
+
const runtime2 = await getValidatedRuntimeAsync();
|
|
566
|
+
return Runtime2.runPromise(runtime2)(effect);
|
|
567
|
+
},
|
|
568
|
+
runSync: (effect) => {
|
|
569
|
+
const runtime2 = getValidatedRuntime();
|
|
570
|
+
return Runtime2.runSync(runtime2)(effect);
|
|
571
|
+
},
|
|
572
|
+
runSyncExit: (effect) => {
|
|
573
|
+
const validationExit = managedRuntimeAny.runSyncExit(Effect3.gen(function* () {
|
|
574
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
575
|
+
yield* validateTags(rt.context, tags);
|
|
576
|
+
return rt;
|
|
577
|
+
}));
|
|
578
|
+
if (Exit2.isSuccess(validationExit)) {
|
|
579
|
+
const runtime2 = validationExit.value;
|
|
580
|
+
return Runtime2.runSyncExit(runtime2)(effect);
|
|
581
|
+
}
|
|
582
|
+
return validationExit;
|
|
583
|
+
},
|
|
584
|
+
runPromiseExit: async (effect) => {
|
|
585
|
+
try {
|
|
586
|
+
const runtime2 = await getValidatedRuntimeAsync();
|
|
587
|
+
return Runtime2.runPromiseExit(runtime2)(effect);
|
|
588
|
+
} catch (error) {
|
|
589
|
+
return Exit2.die(error);
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
runFork: (effect) => {
|
|
593
|
+
const runtime2 = getValidatedRuntime();
|
|
594
|
+
return Runtime2.runFork(runtime2)(effect);
|
|
595
|
+
},
|
|
596
|
+
runtimeEffect: Effect3.gen(function* () {
|
|
597
|
+
if (cachedRuntime) {
|
|
598
|
+
return cachedRuntime;
|
|
599
|
+
}
|
|
600
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
601
|
+
yield* validateTags(rt.context, tags);
|
|
602
|
+
const runtime2 = rt;
|
|
603
|
+
cachedRuntime = runtime2;
|
|
604
|
+
return runtime2;
|
|
605
|
+
}).pipe(Effect3.catchAll(() => (
|
|
606
|
+
// This should never happen since validateTags uses Effect.die
|
|
607
|
+
Effect3.die(new Error("Unexpected error in runtimeEffect validation"))
|
|
608
|
+
))),
|
|
609
|
+
dispose: async () => {
|
|
610
|
+
await managedRuntimeAny.dispose();
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
464
615
|
// src/json-path.ts
|
|
465
|
-
import * as
|
|
616
|
+
import * as Option4 from "effect/Option";
|
|
466
617
|
import * as Schema2 from "effect/Schema";
|
|
467
618
|
import { JSONPath } from "jsonpath-plus";
|
|
468
619
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
@@ -478,7 +629,7 @@ var JsonProp = Schema2.NonEmptyString.pipe(Schema2.pattern(PROP_REGEX, {
|
|
|
478
629
|
message: () => "Property name must contain only letters, numbers, and underscores"
|
|
479
630
|
}));
|
|
480
631
|
var isJsonPath = (value) => {
|
|
481
|
-
return
|
|
632
|
+
return Option4.isSome(Schema2.validateOption(JsonPath)(value));
|
|
482
633
|
};
|
|
483
634
|
var createJsonPath = (path) => {
|
|
484
635
|
const candidatePath = path.map((p, i) => {
|
|
@@ -516,7 +667,10 @@ var splitJsonPath = (path) => {
|
|
|
516
667
|
if (!isJsonPath(path)) {
|
|
517
668
|
return [];
|
|
518
669
|
}
|
|
519
|
-
return path.match(/[a-zA-Z_$][\w$]*|\[\d+\]/g)?.map((part) => part.
|
|
670
|
+
return path.match(/[a-zA-Z_$][\w$]*|\[\d+\]/g)?.map((part) => part.replace(/[[\]]/g, "")).map((part) => {
|
|
671
|
+
const parsed = Number.parseInt(part, 10);
|
|
672
|
+
return Number.isNaN(parsed) ? part : parsed;
|
|
673
|
+
}) ?? [];
|
|
520
674
|
};
|
|
521
675
|
var getField = (object, path) => {
|
|
522
676
|
return JSONPath({
|
|
@@ -525,29 +679,29 @@ var getField = (object, path) => {
|
|
|
525
679
|
})[0];
|
|
526
680
|
};
|
|
527
681
|
var getValue = (obj, path) => {
|
|
528
|
-
return getDeep(obj, splitJsonPath(path)
|
|
682
|
+
return getDeep(obj, splitJsonPath(path));
|
|
529
683
|
};
|
|
530
684
|
var setValue = (obj, path, value) => {
|
|
531
|
-
return setDeep(obj, splitJsonPath(path)
|
|
685
|
+
return setDeep(obj, splitJsonPath(path), value);
|
|
532
686
|
};
|
|
533
687
|
|
|
534
688
|
// src/resource.ts
|
|
535
|
-
import * as
|
|
536
|
-
var acquireReleaseResource = (getResource) =>
|
|
689
|
+
import * as Effect4 from "effect/Effect";
|
|
690
|
+
var acquireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
|
|
537
691
|
const resource = getResource();
|
|
538
|
-
yield*
|
|
539
|
-
resource.open?.();
|
|
692
|
+
yield* Effect4.promise(async () => {
|
|
693
|
+
await resource.open?.();
|
|
540
694
|
return void 0;
|
|
541
695
|
});
|
|
542
696
|
return resource;
|
|
543
|
-
}), (resource) =>
|
|
544
|
-
resource.close?.();
|
|
697
|
+
}), (resource) => Effect4.promise(async () => {
|
|
698
|
+
await resource.close?.();
|
|
545
699
|
return void 0;
|
|
546
700
|
}));
|
|
547
701
|
|
|
548
702
|
// src/url.ts
|
|
549
703
|
import * as Function2 from "effect/Function";
|
|
550
|
-
import * as
|
|
704
|
+
import * as Option5 from "effect/Option";
|
|
551
705
|
import * as SchemaAST2 from "effect/SchemaAST";
|
|
552
706
|
import { decamelize } from "@dxos/util";
|
|
553
707
|
var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
@@ -591,7 +745,7 @@ var UrlParser = class {
|
|
|
591
745
|
if (value !== void 0) {
|
|
592
746
|
const field = this._schema.fields[key];
|
|
593
747
|
if (field) {
|
|
594
|
-
const { key: serializedKey } = Function2.pipe(getParamKeyAnnotation(field.ast),
|
|
748
|
+
const { key: serializedKey } = Function2.pipe(getParamKeyAnnotation(field.ast), Option5.getOrElse(() => ({
|
|
595
749
|
key: decamelize(key)
|
|
596
750
|
})));
|
|
597
751
|
url.searchParams.set(serializedKey, String(value));
|
|
@@ -601,16 +755,35 @@ var UrlParser = class {
|
|
|
601
755
|
return url;
|
|
602
756
|
}
|
|
603
757
|
};
|
|
758
|
+
|
|
759
|
+
// src/RuntimeProvider.ts
|
|
760
|
+
var RuntimeProvider_exports = {};
|
|
761
|
+
__export(RuntimeProvider_exports, {
|
|
762
|
+
currentRuntime: () => currentRuntime,
|
|
763
|
+
provide: () => provide2,
|
|
764
|
+
runPromise: () => runPromise2
|
|
765
|
+
});
|
|
766
|
+
import * as Effect5 from "effect/Effect";
|
|
767
|
+
import * as Runtime3 from "effect/Runtime";
|
|
768
|
+
var currentRuntime = () => Effect5.runtime().pipe(Effect5.map(Effect5.succeed));
|
|
769
|
+
var runPromise2 = (provider) => async (effect) => {
|
|
770
|
+
const runtime2 = await runAndForwardErrors(provider);
|
|
771
|
+
return unwrapExit(await effect.pipe(Runtime3.runPromiseExit(runtime2)));
|
|
772
|
+
};
|
|
773
|
+
var provide2 = (runtimeProvider) => (effect) => Effect5.flatMap(runtimeProvider, (runtime2) => Effect5.provide(effect, runtime2));
|
|
604
774
|
export {
|
|
775
|
+
dynamic_runtime_exports as DynamicRuntime,
|
|
605
776
|
JsonPath,
|
|
606
777
|
JsonProp,
|
|
607
778
|
ParamKeyAnnotation,
|
|
779
|
+
RuntimeProvider_exports as RuntimeProvider,
|
|
608
780
|
UrlParser,
|
|
609
781
|
VisitResult,
|
|
610
782
|
acquireReleaseResource,
|
|
611
783
|
causeToError,
|
|
612
784
|
contextFromScope,
|
|
613
785
|
createJsonPath,
|
|
786
|
+
createKvsStore,
|
|
614
787
|
findAnnotation,
|
|
615
788
|
findNode,
|
|
616
789
|
findProperty,
|
|
@@ -634,6 +807,7 @@ export {
|
|
|
634
807
|
mapAst,
|
|
635
808
|
promiseWithCauseCapture,
|
|
636
809
|
runAndForwardErrors,
|
|
810
|
+
runInRuntime,
|
|
637
811
|
setValue,
|
|
638
812
|
splitJsonPath,
|
|
639
813
|
throwCause,
|