@dxos/effect 0.8.4-main.b97322e → 0.8.4-main.bcb3aa67d6
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 +472 -236
- 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 +472 -236
- 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/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 +6 -3
- 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 +6 -2
- package/dist/types/src/resource.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +34 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- 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 +125 -96
- 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 +142 -28
- package/src/index.ts +6 -3
- 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 +5 -4
- package/src/resource.ts +10 -5
- package/src/sanity.test.ts +30 -15
- package/src/testing.ts +55 -1
- 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,62 @@
|
|
|
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
|
-
return "number";
|
|
18
|
-
}
|
|
19
|
-
if (SchemaAST.isBooleanKeyword(node)) {
|
|
20
|
-
return "boolean";
|
|
21
|
-
}
|
|
22
|
-
if (SchemaAST.isEnums(node)) {
|
|
23
|
-
return "enum";
|
|
24
|
-
}
|
|
25
|
-
if (SchemaAST.isLiteral(node)) {
|
|
26
|
-
return "literal";
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var isSimpleType = (node) => !!getSimpleType(node);
|
|
30
|
-
(function(SimpleType2) {
|
|
31
|
-
SimpleType2.getDefaultValue = (type) => {
|
|
32
|
-
switch (type) {
|
|
33
|
-
case "string": {
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
case "number": {
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
|
-
case "boolean": {
|
|
40
|
-
return false;
|
|
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
|
|
41
22
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
23
|
+
};
|
|
24
|
+
return reduceRefinements(nextType, [
|
|
25
|
+
...refinements,
|
|
26
|
+
filter
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
type,
|
|
31
|
+
refinements
|
|
49
32
|
};
|
|
50
|
-
}
|
|
51
|
-
var
|
|
33
|
+
};
|
|
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
|
+
...getBaseType(prop),
|
|
43
|
+
name: prop.name,
|
|
44
|
+
isOptional: prop.isOptional,
|
|
45
|
+
isReadonly: prop.isReadonly
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
var VisitResult = /* @__PURE__ */ (function(VisitResult2) {
|
|
52
49
|
VisitResult2[VisitResult2["CONTINUE"] = 0] = "CONTINUE";
|
|
53
50
|
VisitResult2[VisitResult2["SKIP"] = 1] = "SKIP";
|
|
54
51
|
VisitResult2[VisitResult2["EXIT"] = 2] = "EXIT";
|
|
55
52
|
return VisitResult2;
|
|
56
|
-
}({});
|
|
57
|
-
var defaultTest = isSimpleType;
|
|
53
|
+
})({});
|
|
58
54
|
var visit = (node, testOrVisitor, visitor) => {
|
|
59
|
-
|
|
60
|
-
visitNode(node, defaultTest, testOrVisitor);
|
|
61
|
-
} else {
|
|
62
|
-
visitNode(node, testOrVisitor, visitor);
|
|
63
|
-
}
|
|
55
|
+
visitNode(node, testOrVisitor, visitor);
|
|
64
56
|
};
|
|
65
57
|
var visitNode = (node, test, visitor, path = [], depth = 0) => {
|
|
66
|
-
const
|
|
67
|
-
const result =
|
|
58
|
+
const $result = test?.(node, path, depth);
|
|
59
|
+
const result = $result === void 0 ? 0 : typeof $result === "boolean" ? $result ? 0 : 1 : $result;
|
|
68
60
|
if (result === 2) {
|
|
69
61
|
return result;
|
|
70
62
|
}
|
|
@@ -117,6 +109,12 @@ var findNode = (node, test) => {
|
|
|
117
109
|
return child;
|
|
118
110
|
}
|
|
119
111
|
}
|
|
112
|
+
for (const prop of getIndexSignatures(node)) {
|
|
113
|
+
const child = findNode(prop.type, test);
|
|
114
|
+
if (child) {
|
|
115
|
+
return child;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
120
118
|
} else if (SchemaAST.isTupleType(node)) {
|
|
121
119
|
for (const [_, element] of node.elements.entries()) {
|
|
122
120
|
const child = findNode(element.type, test);
|
|
@@ -125,12 +123,13 @@ var findNode = (node, test) => {
|
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
} else if (SchemaAST.isUnion(node)) {
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
if (isLiteralUnion(node)) {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
for (const type of node.types) {
|
|
130
|
+
const child = findNode(type, test);
|
|
131
|
+
if (child) {
|
|
132
|
+
return child;
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
} else if (SchemaAST.isRefinement(node)) {
|
|
@@ -143,7 +142,7 @@ var findProperty = (schema, path) => {
|
|
|
143
142
|
const typeNode = findNode(node, SchemaAST.isTypeLiteral);
|
|
144
143
|
invariant(typeNode, void 0, {
|
|
145
144
|
F: __dxlog_file,
|
|
146
|
-
L:
|
|
145
|
+
L: 237,
|
|
147
146
|
S: void 0,
|
|
148
147
|
A: [
|
|
149
148
|
"typeNode",
|
|
@@ -163,21 +162,21 @@ var findProperty = (schema, path) => {
|
|
|
163
162
|
return getProp(schema.ast, path.split("."));
|
|
164
163
|
};
|
|
165
164
|
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);
|
|
165
|
+
ObjectKeyword: SchemaAST.objectKeyword,
|
|
166
|
+
StringKeyword: SchemaAST.stringKeyword,
|
|
167
|
+
NumberKeyword: SchemaAST.numberKeyword,
|
|
168
|
+
BooleanKeyword: SchemaAST.booleanKeyword
|
|
169
|
+
};
|
|
170
|
+
var getAnnotation2 = (annotationId, noDefault = true) => (node) => {
|
|
171
|
+
const id = Function.pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
|
|
172
|
+
const value = Function.pipe(SchemaAST.getAnnotation(annotationId)(node), Option.getOrUndefined);
|
|
174
173
|
if (noDefault && (value === defaultAnnotations[node._tag]?.annotations[annotationId] || value === id)) {
|
|
175
174
|
return void 0;
|
|
176
175
|
}
|
|
177
176
|
return value;
|
|
178
177
|
};
|
|
179
178
|
var findAnnotation = (node, annotationId, noDefault = true) => {
|
|
180
|
-
const getAnnotationById =
|
|
179
|
+
const getAnnotationById = getAnnotation2(annotationId, noDefault);
|
|
181
180
|
const getBaseAnnotation = (node2) => {
|
|
182
181
|
const value = getAnnotationById(node2);
|
|
183
182
|
if (value !== void 0) {
|
|
@@ -197,13 +196,22 @@ var isOption = (node) => {
|
|
|
197
196
|
var isLiteralUnion = (node) => {
|
|
198
197
|
return SchemaAST.isUnion(node) && node.types.every(SchemaAST.isLiteral);
|
|
199
198
|
};
|
|
199
|
+
var isArrayType = (node) => {
|
|
200
|
+
return SchemaAST.isTupleType(node) && node.elements.length === 0 && node.rest.length === 1;
|
|
201
|
+
};
|
|
202
|
+
var getArrayElementType = (node) => {
|
|
203
|
+
return isArrayType(node) ? node.rest.at(0)?.type : void 0;
|
|
204
|
+
};
|
|
205
|
+
var isTupleType2 = (node) => {
|
|
206
|
+
return SchemaAST.isTupleType(node) && node.elements.length > 0;
|
|
207
|
+
};
|
|
200
208
|
var isDiscriminatedUnion = (node) => {
|
|
201
209
|
return SchemaAST.isUnion(node) && !!getDiscriminatingProps(node)?.length;
|
|
202
210
|
};
|
|
203
211
|
var getDiscriminatingProps = (node) => {
|
|
204
212
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
205
213
|
F: __dxlog_file,
|
|
206
|
-
L:
|
|
214
|
+
L: 355,
|
|
207
215
|
S: void 0,
|
|
208
216
|
A: [
|
|
209
217
|
"SchemaAST.isUnion(node)",
|
|
@@ -221,7 +229,7 @@ var getDiscriminatingProps = (node) => {
|
|
|
221
229
|
var getDiscriminatedType = (node, value = {}) => {
|
|
222
230
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
223
231
|
F: __dxlog_file,
|
|
224
|
-
L:
|
|
232
|
+
L: 379,
|
|
225
233
|
S: void 0,
|
|
226
234
|
A: [
|
|
227
235
|
"SchemaAST.isUnion(node)",
|
|
@@ -230,7 +238,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
230
238
|
});
|
|
231
239
|
invariant(value, void 0, {
|
|
232
240
|
F: __dxlog_file,
|
|
233
|
-
L:
|
|
241
|
+
L: 380,
|
|
234
242
|
S: void 0,
|
|
235
243
|
A: [
|
|
236
244
|
"value",
|
|
@@ -245,7 +253,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
245
253
|
const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
|
|
246
254
|
invariant(SchemaAST.isLiteral(prop.type), void 0, {
|
|
247
255
|
F: __dxlog_file,
|
|
248
|
-
L:
|
|
256
|
+
L: 391,
|
|
249
257
|
S: void 0,
|
|
250
258
|
A: [
|
|
251
259
|
"SchemaAST.isLiteral(prop.type)",
|
|
@@ -263,7 +271,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
263
271
|
const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
|
|
264
272
|
invariant(SchemaAST.isLiteral(literal.type), void 0, {
|
|
265
273
|
F: __dxlog_file,
|
|
266
|
-
L:
|
|
274
|
+
L: 409,
|
|
267
275
|
S: void 0,
|
|
268
276
|
A: [
|
|
269
277
|
"SchemaAST.isLiteral(literal.type)",
|
|
@@ -280,10 +288,14 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
280
288
|
const schema = Schema.Struct(fields);
|
|
281
289
|
return schema.ast;
|
|
282
290
|
};
|
|
291
|
+
var isNestedType = (node) => {
|
|
292
|
+
return SchemaAST.isDeclaration(node) || SchemaAST.isObjectKeyword(node) || SchemaAST.isTypeLiteral(node) || // TODO(wittjosiah): Tuples are actually arrays.
|
|
293
|
+
isTupleType2(node) || isDiscriminatedUnion(node);
|
|
294
|
+
};
|
|
283
295
|
var mapAst = (ast, f) => {
|
|
284
296
|
switch (ast._tag) {
|
|
285
297
|
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);
|
|
298
|
+
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
299
|
}
|
|
288
300
|
case "Union": {
|
|
289
301
|
return SchemaAST.Union.make(ast.types.map(f), ast.annotations);
|
|
@@ -300,16 +312,313 @@ var mapAst = (ast, f) => {
|
|
|
300
312
|
}
|
|
301
313
|
}
|
|
302
314
|
};
|
|
303
|
-
var
|
|
304
|
-
|
|
315
|
+
var getIndexSignatures = (ast) => {
|
|
316
|
+
const annotation = SchemaAST.getSurrogateAnnotation(ast);
|
|
317
|
+
if (Option.isSome(annotation)) {
|
|
318
|
+
return getIndexSignatures(annotation.value);
|
|
319
|
+
}
|
|
320
|
+
switch (ast._tag) {
|
|
321
|
+
case "TypeLiteral":
|
|
322
|
+
return ast.indexSignatures.slice();
|
|
323
|
+
case "Suspend":
|
|
324
|
+
return getIndexSignatures(ast.f());
|
|
325
|
+
case "Refinement":
|
|
326
|
+
return getIndexSignatures(ast.from);
|
|
327
|
+
}
|
|
328
|
+
return [];
|
|
305
329
|
};
|
|
306
|
-
var SimpleType;
|
|
307
330
|
|
|
308
|
-
// src/
|
|
309
|
-
import
|
|
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
|
+
|
|
345
|
+
// src/context.ts
|
|
346
|
+
import * as Effect from "effect/Effect";
|
|
347
|
+
import { Context } from "@dxos/context";
|
|
348
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/effect/src/context.ts";
|
|
349
|
+
var contextFromScope = () => Effect.gen(function* () {
|
|
350
|
+
const ctx = new Context(void 0, {
|
|
351
|
+
F: __dxlog_file2,
|
|
352
|
+
L: 13
|
|
353
|
+
});
|
|
354
|
+
yield* Effect.addFinalizer(() => Effect.promise(() => ctx.dispose()));
|
|
355
|
+
return ctx;
|
|
356
|
+
});
|
|
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
|
+
|
|
369
|
+
// src/errors.ts
|
|
370
|
+
import * as Cause from "effect/Cause";
|
|
371
|
+
import * as Chunk from "effect/Chunk";
|
|
372
|
+
import * as Effect2 from "effect/Effect";
|
|
373
|
+
import * as Exit from "effect/Exit";
|
|
374
|
+
import * as GlobalValue from "effect/GlobalValue";
|
|
375
|
+
import * as Option2 from "effect/Option";
|
|
376
|
+
import * as Runtime from "effect/Runtime";
|
|
377
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
378
|
+
var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
379
|
+
var locationRegex = /\((.*)\)/g;
|
|
380
|
+
var prettyErrorStack = (error, appendStacks = []) => {
|
|
381
|
+
if (typeof error !== "object" || error === null) {
|
|
382
|
+
return error;
|
|
383
|
+
}
|
|
384
|
+
const span = error[spanSymbol];
|
|
385
|
+
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
386
|
+
const out = [];
|
|
387
|
+
let atStack = false, inCore = false, passedScheduler = false;
|
|
388
|
+
for (let i = 0; i < lines.length; i++) {
|
|
389
|
+
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
390
|
+
out.push(lines[i]);
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
atStack = true;
|
|
394
|
+
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
395
|
+
i++;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (lines[i].includes("Generator.next")) {
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
if (lines[i].includes("effect_internal_function")) {
|
|
402
|
+
break;
|
|
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
|
+
}
|
|
424
|
+
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
425
|
+
}
|
|
426
|
+
if (span) {
|
|
427
|
+
let current = span;
|
|
428
|
+
let i = 0;
|
|
429
|
+
while (current && current._tag === "Span" && i < 10) {
|
|
430
|
+
const stackFn = spanToTrace.get(current);
|
|
431
|
+
if (typeof stackFn === "function") {
|
|
432
|
+
const stack = stackFn();
|
|
433
|
+
if (typeof stack === "string") {
|
|
434
|
+
const locationMatchAll = stack.matchAll(locationRegex);
|
|
435
|
+
let match = false;
|
|
436
|
+
for (const [, location] of locationMatchAll) {
|
|
437
|
+
match = true;
|
|
438
|
+
out.push(` at ${current.name} (${location})`);
|
|
439
|
+
}
|
|
440
|
+
if (!match) {
|
|
441
|
+
out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
out.push(` at ${current.name}`);
|
|
445
|
+
}
|
|
446
|
+
} else {
|
|
447
|
+
out.push(` at ${current.name}`);
|
|
448
|
+
}
|
|
449
|
+
current = Option2.getOrUndefined(current.parent);
|
|
450
|
+
i++;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
out.push(...appendStacks);
|
|
454
|
+
error = Cause.originalError(error);
|
|
455
|
+
if (error.cause) {
|
|
456
|
+
error.cause = prettyErrorStack(error.cause);
|
|
457
|
+
}
|
|
458
|
+
Object.defineProperty(error, "stack", {
|
|
459
|
+
value: out.join("\n"),
|
|
460
|
+
writable: true,
|
|
461
|
+
enumerable: false,
|
|
462
|
+
configurable: true
|
|
463
|
+
});
|
|
464
|
+
return error;
|
|
465
|
+
};
|
|
466
|
+
var causeToError = (cause) => {
|
|
467
|
+
if (Cause.isEmpty(cause)) {
|
|
468
|
+
return new Error("Fiber failed without a cause");
|
|
469
|
+
} else if (Cause.isInterruptedOnly(cause)) {
|
|
470
|
+
return new Error("Fiber was interrupted");
|
|
471
|
+
} else {
|
|
472
|
+
const errors = [
|
|
473
|
+
...Chunk.toArray(Cause.failures(cause)),
|
|
474
|
+
...Chunk.toArray(Cause.defects(cause))
|
|
475
|
+
];
|
|
476
|
+
const getStackFrames = () => {
|
|
477
|
+
const o = new Error();
|
|
478
|
+
Error.captureStackTrace(o, causeToError);
|
|
479
|
+
return o.stack.split("\n").slice(1);
|
|
480
|
+
};
|
|
481
|
+
const stackFrames = getStackFrames();
|
|
482
|
+
const newErrors = errors.map((error) => prettyErrorStack(error, stackFrames));
|
|
483
|
+
if (newErrors.length === 1) {
|
|
484
|
+
return newErrors[0];
|
|
485
|
+
} else {
|
|
486
|
+
return new AggregateError(newErrors);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
var throwCause = (cause) => {
|
|
491
|
+
throw causeToError(cause);
|
|
492
|
+
};
|
|
493
|
+
var unwrapExit = (exit2) => {
|
|
494
|
+
if (Exit.isSuccess(exit2)) {
|
|
495
|
+
return exit2.value;
|
|
496
|
+
}
|
|
497
|
+
return throwCause(exit2.cause);
|
|
498
|
+
};
|
|
499
|
+
var runAndForwardErrors = async (effect, options) => {
|
|
500
|
+
const exit2 = await Effect2.runPromiseExit(effect, options);
|
|
501
|
+
return unwrapExit(exit2);
|
|
502
|
+
};
|
|
503
|
+
var runInRuntime = (...args) => {
|
|
504
|
+
if (args.length === 1) {
|
|
505
|
+
const [runtime2] = args;
|
|
506
|
+
return async (effect, options) => {
|
|
507
|
+
const exit2 = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
508
|
+
return unwrapExit(exit2);
|
|
509
|
+
};
|
|
510
|
+
} else {
|
|
511
|
+
const [runtime2, effect, options] = args;
|
|
512
|
+
return (async () => {
|
|
513
|
+
const exit2 = await Runtime.runPromiseExit(runtime2, effect, options);
|
|
514
|
+
return unwrapExit(exit2);
|
|
515
|
+
})();
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
519
|
+
try {
|
|
520
|
+
const result = await evaluate(signal);
|
|
521
|
+
return Effect2.succeed(result);
|
|
522
|
+
} catch (err) {
|
|
523
|
+
return Effect2.die(err);
|
|
524
|
+
}
|
|
525
|
+
}).pipe(Effect2.flatten);
|
|
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
|
+
|
|
615
|
+
// src/json-path.ts
|
|
616
|
+
import * as Option4 from "effect/Option";
|
|
617
|
+
import * as Schema2 from "effect/Schema";
|
|
310
618
|
import { JSONPath } from "jsonpath-plus";
|
|
311
619
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
312
|
-
|
|
620
|
+
import { getDeep, setDeep } from "@dxos/util";
|
|
621
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/effect/src/json-path.ts";
|
|
313
622
|
var PATH_REGEX = /^($|[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*|\[\d+\](?:\.)?)*$)/;
|
|
314
623
|
var PROP_REGEX = /^\w+$/;
|
|
315
624
|
var JsonPath = Schema2.String.pipe(Schema2.pattern(PATH_REGEX)).annotations({
|
|
@@ -320,7 +629,7 @@ var JsonProp = Schema2.NonEmptyString.pipe(Schema2.pattern(PROP_REGEX, {
|
|
|
320
629
|
message: () => "Property name must contain only letters, numbers, and underscores"
|
|
321
630
|
}));
|
|
322
631
|
var isJsonPath = (value) => {
|
|
323
|
-
return
|
|
632
|
+
return Option4.isSome(Schema2.validateOption(JsonPath)(value));
|
|
324
633
|
};
|
|
325
634
|
var createJsonPath = (path) => {
|
|
326
635
|
const candidatePath = path.map((p, i) => {
|
|
@@ -331,8 +640,8 @@ var createJsonPath = (path) => {
|
|
|
331
640
|
}
|
|
332
641
|
}).join("");
|
|
333
642
|
invariant2(isJsonPath(candidatePath), `Invalid JsonPath: ${candidatePath}`, {
|
|
334
|
-
F:
|
|
335
|
-
L:
|
|
643
|
+
F: __dxlog_file3,
|
|
644
|
+
L: 69,
|
|
336
645
|
S: void 0,
|
|
337
646
|
A: [
|
|
338
647
|
"isJsonPath(candidatePath)",
|
|
@@ -344,8 +653,8 @@ var createJsonPath = (path) => {
|
|
|
344
653
|
var fromEffectValidationPath = (effectPath) => {
|
|
345
654
|
const jsonPath = effectPath.replace(/\.\[(\d+)\]/g, "[$1]");
|
|
346
655
|
invariant2(isJsonPath(jsonPath), `Invalid JsonPath: ${jsonPath}`, {
|
|
347
|
-
F:
|
|
348
|
-
L:
|
|
656
|
+
F: __dxlog_file3,
|
|
657
|
+
L: 80,
|
|
349
658
|
S: void 0,
|
|
350
659
|
A: [
|
|
351
660
|
"isJsonPath(jsonPath)",
|
|
@@ -358,7 +667,10 @@ var splitJsonPath = (path) => {
|
|
|
358
667
|
if (!isJsonPath(path)) {
|
|
359
668
|
return [];
|
|
360
669
|
}
|
|
361
|
-
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
|
+
}) ?? [];
|
|
362
674
|
};
|
|
363
675
|
var getField = (object, path) => {
|
|
364
676
|
return JSONPath({
|
|
@@ -366,16 +678,39 @@ var getField = (object, path) => {
|
|
|
366
678
|
json: object
|
|
367
679
|
})[0];
|
|
368
680
|
};
|
|
681
|
+
var getValue = (obj, path) => {
|
|
682
|
+
return getDeep(obj, splitJsonPath(path));
|
|
683
|
+
};
|
|
684
|
+
var setValue = (obj, path, value) => {
|
|
685
|
+
return setDeep(obj, splitJsonPath(path), value);
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
// src/resource.ts
|
|
689
|
+
import * as Effect4 from "effect/Effect";
|
|
690
|
+
var acquireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
|
|
691
|
+
const resource = getResource();
|
|
692
|
+
yield* Effect4.promise(async () => {
|
|
693
|
+
await resource.open?.();
|
|
694
|
+
return void 0;
|
|
695
|
+
});
|
|
696
|
+
return resource;
|
|
697
|
+
}), (resource) => Effect4.promise(async () => {
|
|
698
|
+
await resource.close?.();
|
|
699
|
+
return void 0;
|
|
700
|
+
}));
|
|
369
701
|
|
|
370
702
|
// src/url.ts
|
|
371
|
-
import
|
|
703
|
+
import * as Function2 from "effect/Function";
|
|
704
|
+
import * as Option5 from "effect/Option";
|
|
705
|
+
import * as SchemaAST2 from "effect/SchemaAST";
|
|
372
706
|
import { decamelize } from "@dxos/util";
|
|
373
|
-
var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
707
|
+
var ParamKeyAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
374
708
|
var getParamKeyAnnotation = SchemaAST2.getAnnotation(ParamKeyAnnotationId);
|
|
375
709
|
var ParamKeyAnnotation = (value) => (self) => self.annotations({
|
|
376
710
|
[ParamKeyAnnotationId]: value
|
|
377
711
|
});
|
|
378
712
|
var UrlParser = class {
|
|
713
|
+
_schema;
|
|
379
714
|
constructor(_schema) {
|
|
380
715
|
this._schema = _schema;
|
|
381
716
|
}
|
|
@@ -410,7 +745,7 @@ var UrlParser = class {
|
|
|
410
745
|
if (value !== void 0) {
|
|
411
746
|
const field = this._schema.fields[key];
|
|
412
747
|
if (field) {
|
|
413
|
-
const { key: serializedKey } =
|
|
748
|
+
const { key: serializedKey } = Function2.pipe(getParamKeyAnnotation(field.ast), Option5.getOrElse(() => ({
|
|
414
749
|
key: decamelize(key)
|
|
415
750
|
})));
|
|
416
751
|
url.searchParams.set(serializedKey, String(value));
|
|
@@ -421,182 +756,83 @@ var UrlParser = class {
|
|
|
421
756
|
}
|
|
422
757
|
};
|
|
423
758
|
|
|
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;
|
|
759
|
+
// src/RuntimeProvider.ts
|
|
760
|
+
var RuntimeProvider_exports = {};
|
|
761
|
+
__export(RuntimeProvider_exports, {
|
|
762
|
+
currentRuntime: () => currentRuntime,
|
|
763
|
+
provide: () => provide2,
|
|
764
|
+
runPromise: () => runPromise2
|
|
435
765
|
});
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
var locationRegex = /\((.*)\)/g;
|
|
443
|
-
var prettyErrorStack = (error, appendStacks = []) => {
|
|
444
|
-
const span = error[spanSymbol];
|
|
445
|
-
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
446
|
-
const out = [];
|
|
447
|
-
let atStack = false;
|
|
448
|
-
for (let i = 0; i < lines.length; i++) {
|
|
449
|
-
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
450
|
-
out.push(lines[i]);
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
atStack = true;
|
|
454
|
-
if (lines[i].includes(" at new BaseEffectError") || lines[i].includes(" at new YieldableError")) {
|
|
455
|
-
i++;
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
if (lines[i].includes("Generator.next")) {
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
if (lines[i].includes("effect_internal_function")) {
|
|
462
|
-
break;
|
|
463
|
-
}
|
|
464
|
-
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
465
|
-
}
|
|
466
|
-
if (span) {
|
|
467
|
-
let current = span;
|
|
468
|
-
let i = 0;
|
|
469
|
-
while (current && current._tag === "Span" && i < 10) {
|
|
470
|
-
const stackFn = spanToTrace.get(current);
|
|
471
|
-
if (typeof stackFn === "function") {
|
|
472
|
-
const stack = stackFn();
|
|
473
|
-
if (typeof stack === "string") {
|
|
474
|
-
const locationMatchAll = stack.matchAll(locationRegex);
|
|
475
|
-
let match = false;
|
|
476
|
-
for (const [, location] of locationMatchAll) {
|
|
477
|
-
match = true;
|
|
478
|
-
out.push(` at ${current.name} (${location})`);
|
|
479
|
-
}
|
|
480
|
-
if (!match) {
|
|
481
|
-
out.push(` at ${current.name} (${stack.replace(/^at /, "")})`);
|
|
482
|
-
}
|
|
483
|
-
} else {
|
|
484
|
-
out.push(` at ${current.name}`);
|
|
485
|
-
}
|
|
486
|
-
} else {
|
|
487
|
-
out.push(` at ${current.name}`);
|
|
488
|
-
}
|
|
489
|
-
current = Option4.getOrUndefined(current.parent);
|
|
490
|
-
i++;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
out.push(...appendStacks);
|
|
494
|
-
if (error[originalSymbol]) {
|
|
495
|
-
error = error[originalSymbol];
|
|
496
|
-
}
|
|
497
|
-
if (error.cause) {
|
|
498
|
-
error.cause = prettyErrorStack(error.cause);
|
|
499
|
-
}
|
|
500
|
-
Object.defineProperty(error, "stack", {
|
|
501
|
-
value: out.join("\n"),
|
|
502
|
-
writable: true,
|
|
503
|
-
enumerable: false,
|
|
504
|
-
configurable: true
|
|
505
|
-
});
|
|
506
|
-
return error;
|
|
507
|
-
};
|
|
508
|
-
var runAndForwardErrors = async (effect, options) => {
|
|
509
|
-
const exit = await Effect2.runPromiseExit(effect, options);
|
|
510
|
-
if (Exit.isSuccess(exit)) {
|
|
511
|
-
return exit.value;
|
|
512
|
-
}
|
|
513
|
-
if (Cause.isEmpty(exit.cause)) {
|
|
514
|
-
throw new Error("Fiber failed without a cause");
|
|
515
|
-
} else if (Cause.isInterrupted(exit.cause)) {
|
|
516
|
-
throw new Error("Fiber was interrupted");
|
|
517
|
-
} else {
|
|
518
|
-
const errors = [
|
|
519
|
-
...Chunk.toArray(Cause.failures(exit.cause)),
|
|
520
|
-
...Chunk.toArray(Cause.defects(exit.cause))
|
|
521
|
-
];
|
|
522
|
-
const getStackFrames = () => {
|
|
523
|
-
const o = {};
|
|
524
|
-
Error.captureStackTrace(o, getStackFrames);
|
|
525
|
-
return o.stack.split("\n").slice(1);
|
|
526
|
-
};
|
|
527
|
-
const stackFrames = getStackFrames();
|
|
528
|
-
const newErrors = errors.map((error) => prettyErrorStack(error, stackFrames));
|
|
529
|
-
if (newErrors.length === 1) {
|
|
530
|
-
throw newErrors[0];
|
|
531
|
-
} else {
|
|
532
|
-
throw new AggregateError(newErrors);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
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)));
|
|
535
772
|
};
|
|
773
|
+
var provide2 = (runtimeProvider) => (effect) => Effect5.flatMap(runtimeProvider, (runtime2) => Effect5.provide(effect, runtime2));
|
|
536
774
|
|
|
537
|
-
// src/
|
|
538
|
-
|
|
539
|
-
(
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
775
|
+
// src/Performance.ts
|
|
776
|
+
var Performance_exports = {};
|
|
777
|
+
__export(Performance_exports, {
|
|
778
|
+
addTrackEntry: () => addTrackEntry
|
|
779
|
+
});
|
|
780
|
+
import * as Effect6 from "effect/Effect";
|
|
781
|
+
var addTrackEntry = (options) => (effect) => Effect6.gen(function* () {
|
|
782
|
+
const start = performance.now();
|
|
783
|
+
const exit2 = yield* Effect6.exit(effect);
|
|
784
|
+
const resolvedOptions = typeof options === "function" ? options(exit2) : options;
|
|
785
|
+
performance.measure(resolvedOptions.name, {
|
|
786
|
+
start,
|
|
787
|
+
detail: {
|
|
788
|
+
...resolvedOptions.detail,
|
|
789
|
+
devtools: resolvedOptions.devtools
|
|
552
790
|
}
|
|
553
791
|
});
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// src/resource.ts
|
|
558
|
-
import { Effect as Effect4 } from "effect";
|
|
559
|
-
var accuireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
|
|
560
|
-
const resource = getResource();
|
|
561
|
-
yield* Effect4.promise(async () => {
|
|
562
|
-
resource.open?.();
|
|
563
|
-
return void 0;
|
|
564
|
-
});
|
|
565
|
-
return resource;
|
|
566
|
-
}), (resource) => Effect4.promise(async () => {
|
|
567
|
-
resource.close?.();
|
|
568
|
-
return void 0;
|
|
569
|
-
}));
|
|
792
|
+
return yield* exit2;
|
|
793
|
+
});
|
|
570
794
|
export {
|
|
795
|
+
dynamic_runtime_exports as DynamicRuntime,
|
|
571
796
|
JsonPath,
|
|
572
797
|
JsonProp,
|
|
573
798
|
ParamKeyAnnotation,
|
|
574
|
-
|
|
575
|
-
|
|
799
|
+
Performance_exports as Performance,
|
|
800
|
+
RuntimeProvider_exports as RuntimeProvider,
|
|
576
801
|
UrlParser,
|
|
577
802
|
VisitResult,
|
|
578
|
-
|
|
803
|
+
acquireReleaseResource,
|
|
804
|
+
causeToError,
|
|
579
805
|
contextFromScope,
|
|
580
806
|
createJsonPath,
|
|
807
|
+
createKvsStore,
|
|
581
808
|
findAnnotation,
|
|
582
809
|
findNode,
|
|
583
810
|
findProperty,
|
|
584
811
|
fromEffectValidationPath,
|
|
585
|
-
getAnnotation,
|
|
812
|
+
getAnnotation2 as getAnnotation,
|
|
813
|
+
getArrayElementType,
|
|
814
|
+
getBaseType,
|
|
586
815
|
getDiscriminatedType,
|
|
587
816
|
getDiscriminatingProps,
|
|
588
817
|
getField,
|
|
589
818
|
getParamKeyAnnotation,
|
|
590
|
-
|
|
819
|
+
getProperties,
|
|
820
|
+
getValue,
|
|
591
821
|
isArrayType,
|
|
592
822
|
isDiscriminatedUnion,
|
|
593
823
|
isJsonPath,
|
|
594
824
|
isLiteralUnion,
|
|
825
|
+
isNestedType,
|
|
595
826
|
isOption,
|
|
596
|
-
|
|
827
|
+
isTupleType2 as isTupleType,
|
|
597
828
|
mapAst,
|
|
829
|
+
promiseWithCauseCapture,
|
|
598
830
|
runAndForwardErrors,
|
|
831
|
+
runInRuntime,
|
|
832
|
+
setValue,
|
|
599
833
|
splitJsonPath,
|
|
834
|
+
throwCause,
|
|
835
|
+
unwrapExit,
|
|
600
836
|
visit
|
|
601
837
|
};
|
|
602
838
|
//# sourceMappingURL=index.mjs.map
|