@dxos/effect 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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 +516 -189
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing.mjs +39 -0
- package/dist/lib/browser/testing.mjs.map +7 -0
- 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 +516 -189
- 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 +39 -0
- package/dist/lib/node-esm/testing.mjs.map +7 -0
- package/dist/types/src/Performance.d.ts +25 -0
- package/dist/types/src/Performance.d.ts.map +1 -0
- 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 +36 -22
- package/dist/types/src/ast.d.ts.map +1 -1
- package/dist/types/src/async-task-tagging.d.ts +6 -0
- package/dist/types/src/async-task-tagging.d.ts.map +1 -0
- 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/context.d.ts +2 -1
- package/dist/types/src/context.d.ts.map +1 -1
- 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 +43 -1
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +8 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interrupt.test.d.ts +2 -0
- package/dist/types/src/interrupt.test.d.ts.map +1 -0
- package/dist/types/src/{jsonPath.d.ts → json-path.d.ts} +12 -4
- package/dist/types/src/json-path.d.ts.map +1 -0
- package/dist/types/src/json-path.test.d.ts +2 -0
- package/dist/types/src/json-path.test.d.ts.map +1 -0
- package/dist/types/src/layers.test.d.ts +2 -0
- package/dist/types/src/layers.test.d.ts.map +1 -0
- package/dist/types/src/otel.d.ts +17 -0
- package/dist/types/src/otel.d.ts.map +1 -0
- package/dist/types/src/otel.test.d.ts +2 -0
- package/dist/types/src/otel.test.d.ts.map +1 -0
- package/dist/types/src/resource.d.ts +8 -0
- package/dist/types/src/resource.d.ts.map +1 -0
- package/dist/types/src/resource.test.d.ts +2 -0
- package/dist/types/src/resource.test.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +68 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/url.d.ts +3 -1
- package/dist/types/src/url.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -10
- package/src/Performance.ts +45 -0
- package/src/RuntimeProvider.ts +35 -0
- package/src/ast.test.ts +39 -11
- package/src/ast.ts +135 -96
- package/src/async-task-tagging.ts +47 -0
- package/src/atom-kvs.ts +35 -0
- package/src/context.ts +2 -1
- package/src/dynamic-runtime.test.ts +465 -0
- package/src/dynamic-runtime.ts +195 -0
- package/src/errors.test.ts +1 -1
- package/src/errors.ts +152 -29
- package/src/index.ts +8 -2
- package/src/interrupt.test.ts +35 -0
- package/src/{jsonPath.test.ts → json-path.test.ts} +47 -8
- package/src/{jsonPath.ts → json-path.ts} +29 -4
- package/src/layers.test.ts +112 -0
- package/src/otel.test.ts +126 -0
- package/src/otel.ts +45 -0
- package/src/resource.test.ts +32 -0
- package/src/resource.ts +30 -0
- package/src/sanity.test.ts +30 -15
- package/src/testing.ts +112 -0
- package/src/url.test.ts +1 -1
- package/src/url.ts +5 -2
- package/dist/types/src/jsonPath.d.ts.map +0 -1
- package/dist/types/src/jsonPath.test.d.ts +0 -2
- package/dist/types/src/jsonPath.test.d.ts.map +0 -1
|
@@ -1,70 +1,73 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
|
+
import {
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-CGS2ULMK.mjs";
|
|
2
5
|
|
|
3
6
|
// src/ast.ts
|
|
4
|
-
import
|
|
5
|
-
import
|
|
7
|
+
import * as Function from "effect/Function";
|
|
8
|
+
import * as Option from "effect/Option";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
6
11
|
import { invariant } from "@dxos/invariant";
|
|
7
12
|
import { isNonNullable } from "@dxos/util";
|
|
8
13
|
var __dxlog_file = "/__w/dxos/dxos/packages/common/effect/src/ast.ts";
|
|
9
|
-
var
|
|
10
|
-
if (SchemaAST.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return "enum";
|
|
24
|
-
}
|
|
25
|
-
if (SchemaAST.isLiteral(node)) {
|
|
26
|
-
return "literal";
|
|
14
|
+
var reduceRefinements = (type, refinements = []) => {
|
|
15
|
+
if (SchemaAST.isRefinement(type)) {
|
|
16
|
+
const filter = type.filter;
|
|
17
|
+
const nextType = {
|
|
18
|
+
...type.from,
|
|
19
|
+
annotations: {
|
|
20
|
+
...type.from.annotations,
|
|
21
|
+
...type.annotations
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return reduceRefinements(nextType, [
|
|
25
|
+
...refinements,
|
|
26
|
+
filter
|
|
27
|
+
]);
|
|
27
28
|
}
|
|
29
|
+
return {
|
|
30
|
+
type,
|
|
31
|
+
refinements
|
|
32
|
+
};
|
|
28
33
|
};
|
|
29
|
-
var
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
45
|
-
default: {
|
|
46
|
-
throw new Error(`Unsupported type for default value: ${type}`);
|
|
34
|
+
var getBaseType = (prop) => {
|
|
35
|
+
const encoded = SchemaAST.encodedBoundAST(prop.type);
|
|
36
|
+
const unwrapped = prop.isOptional && encoded._tag === "Union" ? encoded.types[0] : encoded;
|
|
37
|
+
return reduceRefinements(unwrapped);
|
|
38
|
+
};
|
|
39
|
+
var getProperties = (ast) => {
|
|
40
|
+
const properties = SchemaAST.getPropertySignatures(ast);
|
|
41
|
+
return properties.map((prop) => {
|
|
42
|
+
const { type, refinements } = getBaseType(prop);
|
|
43
|
+
const mergedType = prop.annotations && Reflect.ownKeys(prop.annotations).length > 0 ? {
|
|
44
|
+
...type,
|
|
45
|
+
annotations: {
|
|
46
|
+
...type.annotations,
|
|
47
|
+
...prop.annotations
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
} : type;
|
|
50
|
+
return {
|
|
51
|
+
type: mergedType,
|
|
52
|
+
refinements,
|
|
53
|
+
name: prop.name,
|
|
54
|
+
isOptional: prop.isOptional,
|
|
55
|
+
isReadonly: prop.isReadonly
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var VisitResult = /* @__PURE__ */ (function(VisitResult2) {
|
|
52
60
|
VisitResult2[VisitResult2["CONTINUE"] = 0] = "CONTINUE";
|
|
53
61
|
VisitResult2[VisitResult2["SKIP"] = 1] = "SKIP";
|
|
54
62
|
VisitResult2[VisitResult2["EXIT"] = 2] = "EXIT";
|
|
55
63
|
return VisitResult2;
|
|
56
|
-
}({});
|
|
57
|
-
var defaultTest = isSimpleType;
|
|
64
|
+
})({});
|
|
58
65
|
var visit = (node, testOrVisitor, visitor) => {
|
|
59
|
-
|
|
60
|
-
visitNode(node, defaultTest, testOrVisitor);
|
|
61
|
-
} else {
|
|
62
|
-
visitNode(node, testOrVisitor, visitor);
|
|
63
|
-
}
|
|
66
|
+
visitNode(node, testOrVisitor, visitor);
|
|
64
67
|
};
|
|
65
68
|
var visitNode = (node, test, visitor, path = [], depth = 0) => {
|
|
66
|
-
const
|
|
67
|
-
const result =
|
|
69
|
+
const $result = test?.(node, path, depth);
|
|
70
|
+
const result = $result === void 0 ? 0 : typeof $result === "boolean" ? $result ? 0 : 1 : $result;
|
|
68
71
|
if (result === 2) {
|
|
69
72
|
return result;
|
|
70
73
|
}
|
|
@@ -117,6 +120,12 @@ var findNode = (node, test) => {
|
|
|
117
120
|
return child;
|
|
118
121
|
}
|
|
119
122
|
}
|
|
123
|
+
for (const prop of getIndexSignatures(node)) {
|
|
124
|
+
const child = findNode(prop.type, test);
|
|
125
|
+
if (child) {
|
|
126
|
+
return child;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
120
129
|
} else if (SchemaAST.isTupleType(node)) {
|
|
121
130
|
for (const [_, element] of node.elements.entries()) {
|
|
122
131
|
const child = findNode(element.type, test);
|
|
@@ -125,12 +134,13 @@ var findNode = (node, test) => {
|
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
} else if (SchemaAST.isUnion(node)) {
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
if (isLiteralUnion(node)) {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
for (const type of node.types) {
|
|
141
|
+
const child = findNode(type, test);
|
|
142
|
+
if (child) {
|
|
143
|
+
return child;
|
|
134
144
|
}
|
|
135
145
|
}
|
|
136
146
|
} else if (SchemaAST.isRefinement(node)) {
|
|
@@ -163,21 +173,21 @@ var findProperty = (schema, path) => {
|
|
|
163
173
|
return getProp(schema.ast, path.split("."));
|
|
164
174
|
};
|
|
165
175
|
var defaultAnnotations = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
};
|
|
171
|
-
var
|
|
172
|
-
const id = pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
|
|
173
|
-
const value = pipe(SchemaAST.getAnnotation(annotationId)(node), Option.getOrUndefined);
|
|
176
|
+
ObjectKeyword: SchemaAST.objectKeyword,
|
|
177
|
+
StringKeyword: SchemaAST.stringKeyword,
|
|
178
|
+
NumberKeyword: SchemaAST.numberKeyword,
|
|
179
|
+
BooleanKeyword: SchemaAST.booleanKeyword
|
|
180
|
+
};
|
|
181
|
+
var getAnnotation2 = (annotationId, noDefault = true) => (node) => {
|
|
182
|
+
const id = Function.pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
|
|
183
|
+
const value = Function.pipe(SchemaAST.getAnnotation(annotationId)(node), Option.getOrUndefined);
|
|
174
184
|
if (noDefault && (value === defaultAnnotations[node._tag]?.annotations[annotationId] || value === id)) {
|
|
175
185
|
return void 0;
|
|
176
186
|
}
|
|
177
187
|
return value;
|
|
178
188
|
};
|
|
179
189
|
var findAnnotation = (node, annotationId, noDefault = true) => {
|
|
180
|
-
const getAnnotationById =
|
|
190
|
+
const getAnnotationById = getAnnotation2(annotationId, noDefault);
|
|
181
191
|
const getBaseAnnotation = (node2) => {
|
|
182
192
|
const value = getAnnotationById(node2);
|
|
183
193
|
if (value !== void 0) {
|
|
@@ -197,13 +207,22 @@ var isOption = (node) => {
|
|
|
197
207
|
var isLiteralUnion = (node) => {
|
|
198
208
|
return SchemaAST.isUnion(node) && node.types.every(SchemaAST.isLiteral);
|
|
199
209
|
};
|
|
210
|
+
var isArrayType = (node) => {
|
|
211
|
+
return SchemaAST.isTupleType(node) && node.elements.length === 0 && node.rest.length === 1;
|
|
212
|
+
};
|
|
213
|
+
var getArrayElementType = (node) => {
|
|
214
|
+
return isArrayType(node) ? node.rest.at(0)?.type : void 0;
|
|
215
|
+
};
|
|
216
|
+
var isTupleType2 = (node) => {
|
|
217
|
+
return SchemaAST.isTupleType(node) && node.elements.length > 0;
|
|
218
|
+
};
|
|
200
219
|
var isDiscriminatedUnion = (node) => {
|
|
201
220
|
return SchemaAST.isUnion(node) && !!getDiscriminatingProps(node)?.length;
|
|
202
221
|
};
|
|
203
222
|
var getDiscriminatingProps = (node) => {
|
|
204
223
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
205
224
|
F: __dxlog_file,
|
|
206
|
-
L:
|
|
225
|
+
L: 365,
|
|
207
226
|
S: void 0,
|
|
208
227
|
A: [
|
|
209
228
|
"SchemaAST.isUnion(node)",
|
|
@@ -221,7 +240,7 @@ var getDiscriminatingProps = (node) => {
|
|
|
221
240
|
var getDiscriminatedType = (node, value = {}) => {
|
|
222
241
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
223
242
|
F: __dxlog_file,
|
|
224
|
-
L:
|
|
243
|
+
L: 389,
|
|
225
244
|
S: void 0,
|
|
226
245
|
A: [
|
|
227
246
|
"SchemaAST.isUnion(node)",
|
|
@@ -230,7 +249,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
230
249
|
});
|
|
231
250
|
invariant(value, void 0, {
|
|
232
251
|
F: __dxlog_file,
|
|
233
|
-
L:
|
|
252
|
+
L: 390,
|
|
234
253
|
S: void 0,
|
|
235
254
|
A: [
|
|
236
255
|
"value",
|
|
@@ -245,7 +264,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
245
264
|
const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
|
|
246
265
|
invariant(SchemaAST.isLiteral(prop.type), void 0, {
|
|
247
266
|
F: __dxlog_file,
|
|
248
|
-
L:
|
|
267
|
+
L: 401,
|
|
249
268
|
S: void 0,
|
|
250
269
|
A: [
|
|
251
270
|
"SchemaAST.isLiteral(prop.type)",
|
|
@@ -263,7 +282,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
263
282
|
const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
|
|
264
283
|
invariant(SchemaAST.isLiteral(literal.type), void 0, {
|
|
265
284
|
F: __dxlog_file,
|
|
266
|
-
L:
|
|
285
|
+
L: 419,
|
|
267
286
|
S: void 0,
|
|
268
287
|
A: [
|
|
269
288
|
"SchemaAST.isLiteral(literal.type)",
|
|
@@ -280,10 +299,14 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
280
299
|
const schema = Schema.Struct(fields);
|
|
281
300
|
return schema.ast;
|
|
282
301
|
};
|
|
302
|
+
var isNestedType = (node) => {
|
|
303
|
+
return SchemaAST.isDeclaration(node) || SchemaAST.isObjectKeyword(node) || SchemaAST.isTypeLiteral(node) || // TODO(wittjosiah): Tuples are actually arrays.
|
|
304
|
+
isTupleType2(node) || isDiscriminatedUnion(node);
|
|
305
|
+
};
|
|
283
306
|
var mapAst = (ast, f) => {
|
|
284
307
|
switch (ast._tag) {
|
|
285
308
|
case "TypeLiteral": {
|
|
286
|
-
return new SchemaAST.TypeLiteral(ast.propertySignatures.map((prop) => new SchemaAST.PropertySignature(prop.name, f(prop.type, prop.name), prop.isOptional, prop.isReadonly, prop.annotations)), ast.indexSignatures);
|
|
309
|
+
return new SchemaAST.TypeLiteral(ast.propertySignatures.map((prop) => new SchemaAST.PropertySignature(prop.name, f(prop.type, prop.name), prop.isOptional, prop.isReadonly, prop.annotations)), ast.indexSignatures, ast.annotations);
|
|
287
310
|
}
|
|
288
311
|
case "Union": {
|
|
289
312
|
return SchemaAST.Union.make(ast.types.map(f), ast.annotations);
|
|
@@ -300,16 +323,313 @@ var mapAst = (ast, f) => {
|
|
|
300
323
|
}
|
|
301
324
|
}
|
|
302
325
|
};
|
|
303
|
-
var
|
|
304
|
-
|
|
326
|
+
var getIndexSignatures = (ast) => {
|
|
327
|
+
const annotation = SchemaAST.getSurrogateAnnotation(ast);
|
|
328
|
+
if (Option.isSome(annotation)) {
|
|
329
|
+
return getIndexSignatures(annotation.value);
|
|
330
|
+
}
|
|
331
|
+
switch (ast._tag) {
|
|
332
|
+
case "TypeLiteral":
|
|
333
|
+
return ast.indexSignatures.slice();
|
|
334
|
+
case "Suspend":
|
|
335
|
+
return getIndexSignatures(ast.f());
|
|
336
|
+
case "Refinement":
|
|
337
|
+
return getIndexSignatures(ast.from);
|
|
338
|
+
}
|
|
339
|
+
return [];
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// src/atom-kvs.ts
|
|
343
|
+
import { Atom } from "@effect-atom/atom-react";
|
|
344
|
+
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
345
|
+
var defaultRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
346
|
+
var createKvsStore = (options) => {
|
|
347
|
+
const runtime2 = options.runtime ?? defaultRuntime;
|
|
348
|
+
return Atom.kvs({
|
|
349
|
+
runtime: runtime2,
|
|
350
|
+
key: options.key,
|
|
351
|
+
schema: options.schema,
|
|
352
|
+
defaultValue: options.defaultValue
|
|
353
|
+
}).pipe(Atom.keepAlive);
|
|
305
354
|
};
|
|
306
|
-
var SimpleType;
|
|
307
355
|
|
|
308
|
-
// src/
|
|
309
|
-
import
|
|
356
|
+
// src/context.ts
|
|
357
|
+
import * as Effect from "effect/Effect";
|
|
358
|
+
import { Context } from "@dxos/context";
|
|
359
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/effect/src/context.ts";
|
|
360
|
+
var contextFromScope = () => Effect.gen(function* () {
|
|
361
|
+
const ctx = new Context(void 0, {
|
|
362
|
+
F: __dxlog_file2,
|
|
363
|
+
L: 13
|
|
364
|
+
});
|
|
365
|
+
yield* Effect.addFinalizer(() => Effect.promise(() => ctx.dispose()));
|
|
366
|
+
return ctx;
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// src/dynamic-runtime.ts
|
|
370
|
+
var dynamic_runtime_exports = {};
|
|
371
|
+
__export(dynamic_runtime_exports, {
|
|
372
|
+
make: () => make
|
|
373
|
+
});
|
|
374
|
+
import * as Context2 from "effect/Context";
|
|
375
|
+
import * as Effect3 from "effect/Effect";
|
|
376
|
+
import * as Exit2 from "effect/Exit";
|
|
377
|
+
import * as Option3 from "effect/Option";
|
|
378
|
+
import * as Runtime2 from "effect/Runtime";
|
|
379
|
+
|
|
380
|
+
// src/errors.ts
|
|
381
|
+
import * as Cause from "effect/Cause";
|
|
382
|
+
import * as Chunk from "effect/Chunk";
|
|
383
|
+
import * as Effect2 from "effect/Effect";
|
|
384
|
+
import * as Exit from "effect/Exit";
|
|
385
|
+
import * as GlobalValue from "effect/GlobalValue";
|
|
386
|
+
import * as Option2 from "effect/Option";
|
|
387
|
+
import * as Runtime from "effect/Runtime";
|
|
388
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
389
|
+
var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
390
|
+
var locationRegex = /\((.*)\)/g;
|
|
391
|
+
var prettyErrorStack = (error, appendStacks = []) => {
|
|
392
|
+
if (typeof error !== "object" || error === null) {
|
|
393
|
+
return error;
|
|
394
|
+
}
|
|
395
|
+
const span = error[spanSymbol];
|
|
396
|
+
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
397
|
+
const out = [];
|
|
398
|
+
let atStack = false, inCore = false, passedScheduler = false;
|
|
399
|
+
for (let i = 0; i < lines.length; i++) {
|
|
400
|
+
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
401
|
+
out.push(lines[i]);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
atStack = true;
|
|
405
|
+
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
406
|
+
i++;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (lines[i].includes("Generator.next")) {
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
if (lines[i].includes("effect_internal_function")) {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
const filename = lines[i].match(/\/([a-zA-Z0-9_\-.]+):\d+:\d+\)$/)?.[1];
|
|
416
|
+
if (!inCore && [
|
|
417
|
+
"core-effect.ts"
|
|
418
|
+
].includes(filename)) {
|
|
419
|
+
inCore = true;
|
|
420
|
+
}
|
|
421
|
+
if (inCore && !passedScheduler && [
|
|
422
|
+
"Scheduler.ts"
|
|
423
|
+
].includes(filename)) {
|
|
424
|
+
passedScheduler = true;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (passedScheduler && ![
|
|
428
|
+
"Scheduler.ts"
|
|
429
|
+
].includes(filename)) {
|
|
430
|
+
inCore = false;
|
|
431
|
+
}
|
|
432
|
+
if (inCore) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
436
|
+
}
|
|
437
|
+
if (span) {
|
|
438
|
+
let current = span;
|
|
439
|
+
let i = 0;
|
|
440
|
+
while (current && current._tag === "Span" && i < 10) {
|
|
441
|
+
const stackFn = spanToTrace.get(current);
|
|
442
|
+
if (typeof stackFn === "function") {
|
|
443
|
+
const stack = stackFn();
|
|
444
|
+
if (typeof stack === "string") {
|
|
445
|
+
const locationMatchAll = stack.matchAll(locationRegex);
|
|
446
|
+
let match = false;
|
|
447
|
+
for (const [, location] of locationMatchAll) {
|
|
448
|
+
match = true;
|
|
449
|
+
out.push(` at ${current.name} (${location})`);
|
|
450
|
+
}
|
|
451
|
+
if (!match) {
|
|
452
|
+
out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
|
|
453
|
+
}
|
|
454
|
+
} else {
|
|
455
|
+
out.push(` at ${current.name}`);
|
|
456
|
+
}
|
|
457
|
+
} else {
|
|
458
|
+
out.push(` at ${current.name}`);
|
|
459
|
+
}
|
|
460
|
+
current = Option2.getOrUndefined(current.parent);
|
|
461
|
+
i++;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
out.push(...appendStacks);
|
|
465
|
+
error = Cause.originalError(error);
|
|
466
|
+
if (error.cause) {
|
|
467
|
+
error.cause = prettyErrorStack(error.cause);
|
|
468
|
+
}
|
|
469
|
+
Object.defineProperty(error, "stack", {
|
|
470
|
+
value: out.join("\n"),
|
|
471
|
+
writable: true,
|
|
472
|
+
enumerable: false,
|
|
473
|
+
configurable: true
|
|
474
|
+
});
|
|
475
|
+
return error;
|
|
476
|
+
};
|
|
477
|
+
var causeToError = (cause) => {
|
|
478
|
+
if (Cause.isEmpty(cause)) {
|
|
479
|
+
return new Error("Fiber failed without a cause");
|
|
480
|
+
} else if (Cause.isInterruptedOnly(cause)) {
|
|
481
|
+
return new Error("Fiber was interrupted");
|
|
482
|
+
} else {
|
|
483
|
+
const errors = [
|
|
484
|
+
...Chunk.toArray(Cause.failures(cause)),
|
|
485
|
+
...Chunk.toArray(Cause.defects(cause))
|
|
486
|
+
];
|
|
487
|
+
const getStackFrames = () => {
|
|
488
|
+
const o = new Error();
|
|
489
|
+
Error.captureStackTrace(o, causeToError);
|
|
490
|
+
return o.stack.split("\n").slice(1);
|
|
491
|
+
};
|
|
492
|
+
const stackFrames = getStackFrames();
|
|
493
|
+
const newErrors = errors.map((error) => prettyErrorStack(error, stackFrames));
|
|
494
|
+
if (newErrors.length === 1) {
|
|
495
|
+
return newErrors[0];
|
|
496
|
+
} else {
|
|
497
|
+
return new AggregateError(newErrors);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
var throwCause = (cause) => {
|
|
502
|
+
throw causeToError(cause);
|
|
503
|
+
};
|
|
504
|
+
var unwrapExit = (exit2) => {
|
|
505
|
+
if (Exit.isSuccess(exit2)) {
|
|
506
|
+
return exit2.value;
|
|
507
|
+
}
|
|
508
|
+
return throwCause(exit2.cause);
|
|
509
|
+
};
|
|
510
|
+
var runAndForwardErrors = async (effect, options) => {
|
|
511
|
+
const exit2 = await Effect2.runPromiseExit(effect, options);
|
|
512
|
+
return unwrapExit(exit2);
|
|
513
|
+
};
|
|
514
|
+
var runInRuntime = (...args) => {
|
|
515
|
+
if (args.length === 1) {
|
|
516
|
+
const [runtime2] = args;
|
|
517
|
+
return async (effect, options) => {
|
|
518
|
+
const exit2 = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
519
|
+
return unwrapExit(exit2);
|
|
520
|
+
};
|
|
521
|
+
} else {
|
|
522
|
+
const [runtime2, effect, options] = args;
|
|
523
|
+
return (async () => {
|
|
524
|
+
const exit2 = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
525
|
+
return unwrapExit(exit2);
|
|
526
|
+
})();
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
530
|
+
try {
|
|
531
|
+
const result = await evaluate(signal);
|
|
532
|
+
return Effect2.succeed(result);
|
|
533
|
+
} catch (err) {
|
|
534
|
+
return Effect2.die(err);
|
|
535
|
+
}
|
|
536
|
+
}).pipe(Effect2.flatten);
|
|
537
|
+
|
|
538
|
+
// src/dynamic-runtime.ts
|
|
539
|
+
var validateTags = (context, tags) => Effect3.gen(function* () {
|
|
540
|
+
const missingTags = [];
|
|
541
|
+
for (const tag of tags) {
|
|
542
|
+
const option = Context2.getOption(context, tag);
|
|
543
|
+
if (Option3.isNone(option)) {
|
|
544
|
+
missingTags.push(tag.key);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (missingTags.length > 0) {
|
|
548
|
+
return yield* Effect3.die(new Error(`Missing required tags in runtime: ${missingTags.join(", ")}`));
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
function make(managedRuntime, tags) {
|
|
552
|
+
const managedRuntimeAny = managedRuntime;
|
|
553
|
+
let cachedRuntime;
|
|
554
|
+
let validatedRuntimePromise;
|
|
555
|
+
const getValidatedRuntimeAsync = async () => {
|
|
556
|
+
if (!validatedRuntimePromise) {
|
|
557
|
+
validatedRuntimePromise = managedRuntimeAny.runPromise(Effect3.gen(function* () {
|
|
558
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
559
|
+
yield* validateTags(rt.context, tags);
|
|
560
|
+
return rt;
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
return validatedRuntimePromise;
|
|
564
|
+
};
|
|
565
|
+
const getValidatedRuntime = () => {
|
|
566
|
+
const validationExit = managedRuntimeAny.runSyncExit(Effect3.gen(function* () {
|
|
567
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
568
|
+
yield* validateTags(rt.context, tags);
|
|
569
|
+
return rt;
|
|
570
|
+
}));
|
|
571
|
+
return unwrapExit(validationExit);
|
|
572
|
+
};
|
|
573
|
+
return {
|
|
574
|
+
managedRuntime: managedRuntimeAny,
|
|
575
|
+
runPromise: async (effect) => {
|
|
576
|
+
const runtime2 = await getValidatedRuntimeAsync();
|
|
577
|
+
return Runtime2.runPromise(runtime2)(effect);
|
|
578
|
+
},
|
|
579
|
+
runSync: (effect) => {
|
|
580
|
+
const runtime2 = getValidatedRuntime();
|
|
581
|
+
return Runtime2.runSync(runtime2)(effect);
|
|
582
|
+
},
|
|
583
|
+
runSyncExit: (effect) => {
|
|
584
|
+
const validationExit = managedRuntimeAny.runSyncExit(Effect3.gen(function* () {
|
|
585
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
586
|
+
yield* validateTags(rt.context, tags);
|
|
587
|
+
return rt;
|
|
588
|
+
}));
|
|
589
|
+
if (Exit2.isSuccess(validationExit)) {
|
|
590
|
+
const runtime2 = validationExit.value;
|
|
591
|
+
return Runtime2.runSyncExit(runtime2)(effect);
|
|
592
|
+
}
|
|
593
|
+
return validationExit;
|
|
594
|
+
},
|
|
595
|
+
runPromiseExit: async (effect) => {
|
|
596
|
+
try {
|
|
597
|
+
const runtime2 = await getValidatedRuntimeAsync();
|
|
598
|
+
return Runtime2.runPromiseExit(runtime2)(effect);
|
|
599
|
+
} catch (error) {
|
|
600
|
+
return Exit2.die(error);
|
|
601
|
+
}
|
|
602
|
+
},
|
|
603
|
+
runFork: (effect) => {
|
|
604
|
+
const runtime2 = getValidatedRuntime();
|
|
605
|
+
return Runtime2.runFork(runtime2)(effect);
|
|
606
|
+
},
|
|
607
|
+
runtimeEffect: Effect3.gen(function* () {
|
|
608
|
+
if (cachedRuntime) {
|
|
609
|
+
return cachedRuntime;
|
|
610
|
+
}
|
|
611
|
+
const rt = yield* managedRuntimeAny.runtimeEffect;
|
|
612
|
+
yield* validateTags(rt.context, tags);
|
|
613
|
+
const runtime2 = rt;
|
|
614
|
+
cachedRuntime = runtime2;
|
|
615
|
+
return runtime2;
|
|
616
|
+
}).pipe(Effect3.catchAll(() => (
|
|
617
|
+
// This should never happen since validateTags uses Effect.die
|
|
618
|
+
Effect3.die(new Error("Unexpected error in runtimeEffect validation"))
|
|
619
|
+
))),
|
|
620
|
+
dispose: async () => {
|
|
621
|
+
await managedRuntimeAny.dispose();
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// src/json-path.ts
|
|
627
|
+
import * as Option4 from "effect/Option";
|
|
628
|
+
import * as Schema2 from "effect/Schema";
|
|
310
629
|
import { JSONPath } from "jsonpath-plus";
|
|
311
630
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
312
|
-
|
|
631
|
+
import { getDeep, setDeep } from "@dxos/util";
|
|
632
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/effect/src/json-path.ts";
|
|
313
633
|
var PATH_REGEX = /^($|[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*|\[\d+\](?:\.)?)*$)/;
|
|
314
634
|
var PROP_REGEX = /^\w+$/;
|
|
315
635
|
var JsonPath = Schema2.String.pipe(Schema2.pattern(PATH_REGEX)).annotations({
|
|
@@ -320,7 +640,7 @@ var JsonProp = Schema2.NonEmptyString.pipe(Schema2.pattern(PROP_REGEX, {
|
|
|
320
640
|
message: () => "Property name must contain only letters, numbers, and underscores"
|
|
321
641
|
}));
|
|
322
642
|
var isJsonPath = (value) => {
|
|
323
|
-
return
|
|
643
|
+
return Option4.isSome(Schema2.validateOption(JsonPath)(value));
|
|
324
644
|
};
|
|
325
645
|
var createJsonPath = (path) => {
|
|
326
646
|
const candidatePath = path.map((p, i) => {
|
|
@@ -331,8 +651,8 @@ var createJsonPath = (path) => {
|
|
|
331
651
|
}
|
|
332
652
|
}).join("");
|
|
333
653
|
invariant2(isJsonPath(candidatePath), `Invalid JsonPath: ${candidatePath}`, {
|
|
334
|
-
F:
|
|
335
|
-
L:
|
|
654
|
+
F: __dxlog_file3,
|
|
655
|
+
L: 69,
|
|
336
656
|
S: void 0,
|
|
337
657
|
A: [
|
|
338
658
|
"isJsonPath(candidatePath)",
|
|
@@ -344,8 +664,8 @@ var createJsonPath = (path) => {
|
|
|
344
664
|
var fromEffectValidationPath = (effectPath) => {
|
|
345
665
|
const jsonPath = effectPath.replace(/\.\[(\d+)\]/g, "[$1]");
|
|
346
666
|
invariant2(isJsonPath(jsonPath), `Invalid JsonPath: ${jsonPath}`, {
|
|
347
|
-
F:
|
|
348
|
-
L:
|
|
667
|
+
F: __dxlog_file3,
|
|
668
|
+
L: 80,
|
|
349
669
|
S: void 0,
|
|
350
670
|
A: [
|
|
351
671
|
"isJsonPath(jsonPath)",
|
|
@@ -358,7 +678,10 @@ var splitJsonPath = (path) => {
|
|
|
358
678
|
if (!isJsonPath(path)) {
|
|
359
679
|
return [];
|
|
360
680
|
}
|
|
361
|
-
return path.match(/[a-zA-Z_$][\w$]*|\[\d+\]/g)?.map((part) => part.
|
|
681
|
+
return path.match(/[a-zA-Z_$][\w$]*|\[\d+\]/g)?.map((part) => part.replace(/[[\]]/g, "")).map((part) => {
|
|
682
|
+
const parsed = Number.parseInt(part, 10);
|
|
683
|
+
return Number.isNaN(parsed) ? part : parsed;
|
|
684
|
+
}) ?? [];
|
|
362
685
|
};
|
|
363
686
|
var getField = (object, path) => {
|
|
364
687
|
return JSONPath({
|
|
@@ -366,16 +689,39 @@ var getField = (object, path) => {
|
|
|
366
689
|
json: object
|
|
367
690
|
})[0];
|
|
368
691
|
};
|
|
692
|
+
var getValue = (obj, path) => {
|
|
693
|
+
return getDeep(obj, splitJsonPath(path));
|
|
694
|
+
};
|
|
695
|
+
var setValue = (obj, path, value) => {
|
|
696
|
+
return setDeep(obj, splitJsonPath(path), value);
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// src/resource.ts
|
|
700
|
+
import * as Effect4 from "effect/Effect";
|
|
701
|
+
var acquireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
|
|
702
|
+
const resource = getResource();
|
|
703
|
+
yield* Effect4.promise(async () => {
|
|
704
|
+
await resource.open?.();
|
|
705
|
+
return void 0;
|
|
706
|
+
});
|
|
707
|
+
return resource;
|
|
708
|
+
}), (resource) => Effect4.promise(async () => {
|
|
709
|
+
await resource.close?.();
|
|
710
|
+
return void 0;
|
|
711
|
+
}));
|
|
369
712
|
|
|
370
713
|
// src/url.ts
|
|
371
|
-
import
|
|
714
|
+
import * as Function2 from "effect/Function";
|
|
715
|
+
import * as Option5 from "effect/Option";
|
|
716
|
+
import * as SchemaAST2 from "effect/SchemaAST";
|
|
372
717
|
import { decamelize } from "@dxos/util";
|
|
373
|
-
var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
718
|
+
var ParamKeyAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
374
719
|
var getParamKeyAnnotation = SchemaAST2.getAnnotation(ParamKeyAnnotationId);
|
|
375
720
|
var ParamKeyAnnotation = (value) => (self) => self.annotations({
|
|
376
721
|
[ParamKeyAnnotationId]: value
|
|
377
722
|
});
|
|
378
723
|
var UrlParser = class {
|
|
724
|
+
_schema;
|
|
379
725
|
constructor(_schema) {
|
|
380
726
|
this._schema = _schema;
|
|
381
727
|
}
|
|
@@ -410,7 +756,7 @@ var UrlParser = class {
|
|
|
410
756
|
if (value !== void 0) {
|
|
411
757
|
const field = this._schema.fields[key];
|
|
412
758
|
if (field) {
|
|
413
|
-
const { key: serializedKey } =
|
|
759
|
+
const { key: serializedKey } = Function2.pipe(getParamKeyAnnotation(field.ast), Option5.getOrElse(() => ({
|
|
414
760
|
key: decamelize(key)
|
|
415
761
|
})));
|
|
416
762
|
url.searchParams.set(serializedKey, String(value));
|
|
@@ -421,140 +767,121 @@ var UrlParser = class {
|
|
|
421
767
|
}
|
|
422
768
|
};
|
|
423
769
|
|
|
424
|
-
// src/
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
F: __dxlog_file3,
|
|
431
|
-
L: 12
|
|
432
|
-
});
|
|
433
|
-
yield* Effect.addFinalizer(() => Effect.promise(() => ctx.dispose()));
|
|
434
|
-
return ctx;
|
|
770
|
+
// src/RuntimeProvider.ts
|
|
771
|
+
var RuntimeProvider_exports = {};
|
|
772
|
+
__export(RuntimeProvider_exports, {
|
|
773
|
+
currentRuntime: () => currentRuntime,
|
|
774
|
+
provide: () => provide2,
|
|
775
|
+
runPromise: () => runPromise2
|
|
435
776
|
});
|
|
777
|
+
import * as Effect5 from "effect/Effect";
|
|
778
|
+
import * as Runtime3 from "effect/Runtime";
|
|
779
|
+
var currentRuntime = () => Effect5.runtime().pipe(Effect5.map(Effect5.succeed));
|
|
780
|
+
var runPromise2 = (provider) => async (effect) => {
|
|
781
|
+
const runtime2 = await runAndForwardErrors(provider);
|
|
782
|
+
return unwrapExit(await effect.pipe(Runtime3.runPromiseExit(runtime2)));
|
|
783
|
+
};
|
|
784
|
+
var provide2 = (runtimeProvider) => (effect) => Effect5.flatMap(runtimeProvider, (runtime2) => Effect5.provide(effect, runtime2));
|
|
436
785
|
|
|
437
|
-
// src/
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
atStack = true;
|
|
453
|
-
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
454
|
-
i++;
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
if (lines[i].includes("Generator.next")) {
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
if (lines[i].includes("effect_internal_function")) {
|
|
461
|
-
break;
|
|
786
|
+
// src/Performance.ts
|
|
787
|
+
var Performance_exports = {};
|
|
788
|
+
__export(Performance_exports, {
|
|
789
|
+
addTrackEntry: () => addTrackEntry
|
|
790
|
+
});
|
|
791
|
+
import * as Effect6 from "effect/Effect";
|
|
792
|
+
var addTrackEntry = (options) => (effect) => Effect6.gen(function* () {
|
|
793
|
+
const start = performance.now();
|
|
794
|
+
const exit2 = yield* Effect6.exit(effect);
|
|
795
|
+
const resolvedOptions = typeof options === "function" ? options(exit2) : options;
|
|
796
|
+
performance.measure(resolvedOptions.name, {
|
|
797
|
+
start,
|
|
798
|
+
detail: {
|
|
799
|
+
...resolvedOptions.detail,
|
|
800
|
+
devtools: resolvedOptions.devtools
|
|
462
801
|
}
|
|
463
|
-
|
|
802
|
+
});
|
|
803
|
+
return yield* exit2;
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
// src/async-task-tagging.ts
|
|
807
|
+
import * as Context3 from "effect/Context";
|
|
808
|
+
import * as Effect7 from "effect/Effect";
|
|
809
|
+
import { pipe as pipe3 } from "effect/Function";
|
|
810
|
+
import * as Layer from "effect/Layer";
|
|
811
|
+
import * as Predicate from "effect/Predicate";
|
|
812
|
+
import * as Tracer from "effect/Tracer";
|
|
813
|
+
var runInTask = /* @__PURE__ */ Symbol("runInTask");
|
|
814
|
+
var asyncTaskTaggingLayer = () => {
|
|
815
|
+
if (Predicate.hasProperty(console, "createTask") === false) {
|
|
816
|
+
return Layer.empty;
|
|
464
817
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
} else {
|
|
483
|
-
out.push(` at ${current.name}`);
|
|
818
|
+
const makeTracer = Effect7.gen(function* () {
|
|
819
|
+
const oldTracer = yield* Effect7.tracer;
|
|
820
|
+
return Tracer.make({
|
|
821
|
+
span: (name, ...args) => {
|
|
822
|
+
const span = oldTracer.span(name, ...args);
|
|
823
|
+
const trace = console.createTask(name);
|
|
824
|
+
span[runInTask] = (f) => trace.run(f);
|
|
825
|
+
return span;
|
|
826
|
+
},
|
|
827
|
+
context: (f, fiber) => {
|
|
828
|
+
const maybeParentSpan = Context3.getOption(Tracer.ParentSpan)(fiber.currentContext);
|
|
829
|
+
if (maybeParentSpan._tag === "None") return oldTracer.context(f, fiber);
|
|
830
|
+
const parentSpan = maybeParentSpan.value;
|
|
831
|
+
if (parentSpan._tag === "ExternalSpan") return oldTracer.context(f, fiber);
|
|
832
|
+
const span = parentSpan;
|
|
833
|
+
if (runInTask in span && typeof span[runInTask] === "function") {
|
|
834
|
+
return span[runInTask](() => oldTracer.context(f, fiber));
|
|
484
835
|
}
|
|
485
|
-
|
|
486
|
-
out.push(` at ${current.name}`);
|
|
836
|
+
return oldTracer.context(f, fiber);
|
|
487
837
|
}
|
|
488
|
-
|
|
489
|
-
i++;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
out.push(...appendStacks);
|
|
493
|
-
Object.defineProperty(error, "stack", {
|
|
494
|
-
value: out.join("\n"),
|
|
495
|
-
writable: true,
|
|
496
|
-
enumerable: false,
|
|
497
|
-
configurable: true
|
|
838
|
+
});
|
|
498
839
|
});
|
|
499
|
-
|
|
500
|
-
var runAndForwardErrors = async (effect, options) => {
|
|
501
|
-
const exit = await Effect2.runPromiseExit(effect, options);
|
|
502
|
-
if (Exit.isSuccess(exit)) {
|
|
503
|
-
return exit.value;
|
|
504
|
-
}
|
|
505
|
-
if (Cause.isEmpty(exit.cause)) {
|
|
506
|
-
throw new Error("Fiber failed without a cause");
|
|
507
|
-
} else if (Cause.isInterrupted(exit.cause)) {
|
|
508
|
-
throw new Error("Fiber was interrupted");
|
|
509
|
-
} else {
|
|
510
|
-
const errors = [
|
|
511
|
-
...Chunk.toArray(Cause.failures(exit.cause)),
|
|
512
|
-
...Chunk.toArray(Cause.defects(exit.cause))
|
|
513
|
-
];
|
|
514
|
-
const getStackFrames = () => {
|
|
515
|
-
const o = {};
|
|
516
|
-
Error.captureStackTrace(o, getStackFrames);
|
|
517
|
-
return o.stack.split("\n").slice(1);
|
|
518
|
-
};
|
|
519
|
-
const stackFrames = getStackFrames();
|
|
520
|
-
for (const error of errors) {
|
|
521
|
-
prettyErrorStack(error, stackFrames);
|
|
522
|
-
}
|
|
523
|
-
if (errors.length === 1) {
|
|
524
|
-
throw errors[0];
|
|
525
|
-
} else {
|
|
526
|
-
throw new AggregateError(errors);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
840
|
+
return pipe3(makeTracer, Effect7.map(Layer.setTracer), Layer.unwrapEffect);
|
|
529
841
|
};
|
|
530
842
|
export {
|
|
843
|
+
dynamic_runtime_exports as DynamicRuntime,
|
|
531
844
|
JsonPath,
|
|
532
845
|
JsonProp,
|
|
533
846
|
ParamKeyAnnotation,
|
|
534
|
-
|
|
847
|
+
Performance_exports as Performance,
|
|
848
|
+
RuntimeProvider_exports as RuntimeProvider,
|
|
535
849
|
UrlParser,
|
|
536
850
|
VisitResult,
|
|
851
|
+
acquireReleaseResource,
|
|
852
|
+
asyncTaskTaggingLayer,
|
|
853
|
+
causeToError,
|
|
537
854
|
contextFromScope,
|
|
538
855
|
createJsonPath,
|
|
856
|
+
createKvsStore,
|
|
539
857
|
findAnnotation,
|
|
540
858
|
findNode,
|
|
541
859
|
findProperty,
|
|
542
860
|
fromEffectValidationPath,
|
|
543
|
-
getAnnotation,
|
|
861
|
+
getAnnotation2 as getAnnotation,
|
|
862
|
+
getArrayElementType,
|
|
863
|
+
getBaseType,
|
|
544
864
|
getDiscriminatedType,
|
|
545
865
|
getDiscriminatingProps,
|
|
546
866
|
getField,
|
|
547
867
|
getParamKeyAnnotation,
|
|
548
|
-
|
|
868
|
+
getProperties,
|
|
869
|
+
getValue,
|
|
549
870
|
isArrayType,
|
|
550
871
|
isDiscriminatedUnion,
|
|
551
872
|
isJsonPath,
|
|
552
873
|
isLiteralUnion,
|
|
874
|
+
isNestedType,
|
|
553
875
|
isOption,
|
|
554
|
-
|
|
876
|
+
isTupleType2 as isTupleType,
|
|
555
877
|
mapAst,
|
|
878
|
+
promiseWithCauseCapture,
|
|
556
879
|
runAndForwardErrors,
|
|
880
|
+
runInRuntime,
|
|
881
|
+
setValue,
|
|
557
882
|
splitJsonPath,
|
|
883
|
+
throwCause,
|
|
884
|
+
unwrapExit,
|
|
558
885
|
visit
|
|
559
886
|
};
|
|
560
887
|
//# sourceMappingURL=index.mjs.map
|