@dxos/effect 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
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/index.mjs +97 -38
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing.mjs +2 -1
- package/dist/lib/browser/testing.mjs.map +3 -3
- package/dist/lib/node-esm/index.mjs +97 -38
- 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 +2 -1
- package/dist/lib/node-esm/testing.mjs.map +3 -3
- package/dist/types/src/Performance.d.ts +25 -0
- package/dist/types/src/Performance.d.ts.map +1 -0
- package/dist/types/src/ast.d.ts.map +1 -1
- package/dist/types/src/atom-kvs.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +11 -3
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +4 -3
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
- package/src/Performance.ts +45 -0
- package/src/ast.test.ts +25 -0
- package/src/ast.ts +24 -12
- package/src/atom-kvs.ts +1 -1
- package/src/errors.ts +59 -13
- package/src/index.ts +1 -0
- package/src/testing.ts +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/ast.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/ast.ts":{"bytes":48426,"imports":[{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/atom-kvs.ts":{"bytes":3891,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@effect/platform-browser/BrowserKeyValueStore","kind":"import-statement","external":true}],"format":"esm"},"src/context.ts":{"bytes":1719,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":24218,"imports":[{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Chunk","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"effect/GlobalValue","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true}],"format":"esm"},"src/dynamic-runtime.ts":{"bytes":17249,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/json-path.ts":{"bytes":11858,"imports":[{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/resource.ts":{"bytes":2400,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/url.ts":{"bytes":7881,"imports":[{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/RuntimeProvider.ts":{"bytes":3526,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"}],"format":"esm"},"src/Performance.ts":{"bytes":3291,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1510,"imports":[{"path":"src/ast.ts","kind":"import-statement","original":"./ast"},{"path":"src/atom-kvs.ts","kind":"import-statement","original":"./atom-kvs"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/dynamic-runtime.ts","kind":"import-statement","original":"./dynamic-runtime"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/json-path.ts","kind":"import-statement","original":"./json-path"},{"path":"src/resource.ts","kind":"import-statement","original":"./resource"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/RuntimeProvider.ts","kind":"import-statement","original":"./RuntimeProvider"},{"path":"src/Performance.ts","kind":"import-statement","original":"./Performance"}],"format":"esm"},"src/testing.ts":{"bytes":6719,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":63569},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-CGS2ULMK.mjs","kind":"import-statement"},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"@effect/platform-browser/BrowserKeyValueStore","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true},{"path":"effect/Cause","kind":"import-statement","external":true},{"path":"effect/Chunk","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Exit","kind":"import-statement","external":true},{"path":"effect/GlobalValue","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"effect/SchemaAST","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Runtime","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"exports":["DynamicRuntime","JsonPath","JsonProp","ParamKeyAnnotation","Performance","RuntimeProvider","UrlParser","VisitResult","acquireReleaseResource","causeToError","contextFromScope","createJsonPath","createKvsStore","findAnnotation","findNode","findProperty","fromEffectValidationPath","getAnnotation","getArrayElementType","getBaseType","getDiscriminatedType","getDiscriminatingProps","getField","getParamKeyAnnotation","getProperties","getValue","isArrayType","isDiscriminatedUnion","isJsonPath","isLiteralUnion","isNestedType","isOption","isTupleType","mapAst","promiseWithCauseCapture","runAndForwardErrors","runInRuntime","setValue","splitJsonPath","throwCause","unwrapExit","visit"],"entryPoint":"src/index.ts","inputs":{"src/ast.ts":{"bytesInOutput":10161},"src/index.ts":{"bytesInOutput":0},"src/atom-kvs.ts":{"bytesInOutput":462},"src/context.ts":{"bytesInOutput":378},"src/dynamic-runtime.ts":{"bytesInOutput":3194},"src/errors.ts":{"bytesInOutput":4860},"src/json-path.ts":{"bytesInOutput":2189},"src/resource.ts":{"bytesInOutput":382},"src/url.ts":{"bytesInOutput":1709},"src/RuntimeProvider.ts":{"bytesInOutput":657},"src/Performance.ts":{"bytesInOutput":565}},"bytes":25755},"dist/lib/browser/testing.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3975},"dist/lib/browser/testing.mjs":{"imports":[{"path":"dist/lib/browser/chunk-CGS2ULMK.mjs","kind":"import-statement"},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"exports":["TestContextService","TestHelpers"],"entryPoint":"src/testing.ts","inputs":{"src/testing.ts":{"bytesInOutput":986}},"bytes":1154},"dist/lib/browser/chunk-CGS2ULMK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/chunk-CGS2ULMK.mjs":{"imports":[],"exports":["__export"],"inputs":{},"bytes":268}}}
|
|
@@ -19,8 +19,9 @@ import * as Effect from "effect/Effect";
|
|
|
19
19
|
return yield* effect;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
TestHelpers2.tagEnabled = (tag) => process.env.DX_TEST_TAGS?.includes(tag);
|
|
22
23
|
TestHelpers2.taggedTest = (tag) => (effect, ctx) => Effect.gen(function* () {
|
|
23
|
-
if (!
|
|
24
|
+
if (!TestHelpers2.tagEnabled(tag)) {
|
|
24
25
|
ctx.skip();
|
|
25
26
|
} else {
|
|
26
27
|
return yield* effect;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/testing.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport type { TestContext } from 'vitest';\n\n// TODO(dmaretskyi): Add all different test tags here.\nexport type TestTag =\n | 'flaky' // Flaky tests.\n | 'llm' // Tests with AI.\n | 'sync'; // Sync with external services.\n\nexport namespace TestHelpers {\n /**\n * Skip the test if the condition is false.\n *\n *
|
|
5
|
-
"mappings": ";;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;UASPC,cAAAA;eAeFC,QACX,CAACC,cACD,CAAUC,QAAgCC,QACjCC,WAAI,aAAA;AACT,QAAI,CAACH,WAAW;AACdE,UAAIE,KAAI;IACV,OAAO;AACL,aAAO,OAAOH;IAChB;EACF,CAAA;eAgBSI,SACX,CAACL,cACD,CAAUC,QAAgCC,QACjCC,WAAI,aAAA;AACT,QAAIH,WAAW;AACbE,UAAIE,KAAI;IACV,OAAO;AACL,aAAO,OAAOH;IAChB;EACF,CAAA;
|
|
6
|
-
"names": ["Context", "Effect", "TestHelpers", "runIf", "condition", "effect", "ctx", "gen", "skip", "skipIf", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport type { TestContext } from 'vitest';\n\n// TODO(dmaretskyi): Add all different test tags here.\nexport type TestTag =\n | 'flaky' // Flaky tests.\n | 'llm' // Tests with AI.\n | 'sync'; // Sync with external services.\n\nexport namespace TestHelpers {\n /**\n * Skip the test if the condition is false.\n *\n * Example:\n * ```ts\n * it.effect(\n * 'should process an agentic loop using Claude',\n * Effect.fn(function* ({ expect }) {\n * // ...\n * }),\n * TestHelpers.runIf(process.env.ANTHROPIC_API_KEY),\n * );\n * ```\n */\n export const runIf =\n (condition: unknown) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>, ctx: TestContext): Effect.Effect<A, E, R> =>\n Effect.gen(function* () {\n if (!condition) {\n ctx.skip();\n } else {\n return yield* effect;\n }\n });\n\n /**\n * Skip the test if the condition is true.\n *\n * Example:\n * ```ts\n * it.effect(\n * 'should process an agentic loop using Claude',\n * Effect.fn(function* ({ expect }) {\n * // ...\n * }),\n * TestHelpers.skipIf(!process.env.ANTHROPIC_API_KEY),\n * );\n * ```\n */\n export const skipIf =\n (condition: unknown) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>, ctx: TestContext): Effect.Effect<A, E, R> =>\n Effect.gen(function* () {\n if (condition) {\n ctx.skip();\n } else {\n return yield* effect;\n }\n });\n\n export const tagEnabled = (tag: TestTag) => process.env.DX_TEST_TAGS?.includes(tag);\n\n /**\n * Skips this test if the tag is not in the list of tags to run.\n * Tags are specified in the `DX_TEST_TAGS` environment variable.\n *\n * @param tag\n * @returns\n */\n export const taggedTest =\n (tag: TestTag) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>, ctx: TestContext): Effect.Effect<A, E, R> =>\n Effect.gen(function* () {\n if (!tagEnabled(tag)) {\n ctx.skip();\n } else {\n return yield* effect;\n }\n });\n\n /**\n * Provide TestContext from test parameters.\n *\n * Example:\n * ```ts\n * it.effect(\n * 'with context',\n * Effect.fn(function* ({ expect }) {\n * const ctx = yield* TestContextService;\n * }),\n * TestHelpers.provideTestContext,\n * );\n * ```\n */\n export const provideTestContext = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n ctx: TestContext,\n ): Effect.Effect<A, E, Exclude<R, TestContextService>> => Effect.provideService(effect, TestContextService, ctx);\n}\n\n/**\n * Exposes vitest test context as an effect service.\n */\nexport class TestContextService extends Context.Tag('@dxos/effect/TestContextService')<\n TestContextService,\n TestContext\n>() {}\n"],
|
|
5
|
+
"mappings": ";;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;UASPC,cAAAA;eAeFC,QACX,CAACC,cACD,CAAUC,QAAgCC,QACjCC,WAAI,aAAA;AACT,QAAI,CAACH,WAAW;AACdE,UAAIE,KAAI;IACV,OAAO;AACL,aAAO,OAAOH;IAChB;EACF,CAAA;eAgBSI,SACX,CAACL,cACD,CAAUC,QAAgCC,QACjCC,WAAI,aAAA;AACT,QAAIH,WAAW;AACbE,UAAIE,KAAI;IACV,OAAO;AACL,aAAO,OAAOH;IAChB;EACF,CAAA;eAESK,aAAa,CAACC,QAAiBC,QAAQC,IAAIC,cAAcC,SAASJ,GAAAA;eASlEK,aACX,CAACL,QACD,CAAUN,QAAgCC,QACjCC,WAAI,aAAA;AACT,QAAI,CAACG,aAAAA,WAAWC,GAAAA,GAAM;AACpBL,UAAIE,KAAI;IACV,OAAO;AACL,aAAO,OAAOH;IAChB;EACF,CAAA;eAgBSY,qBAAqB,CAChCZ,QACAC,QAC+DY,sBAAeb,QAAQc,oBAAoBb,GAAAA;AAC9G,GAzFiBJ,gBAAAA,cAAAA,CAAAA,EAAAA;AA8FV,IAAMiB,qBAAN,cAAyCC,YAAI,iCAAA,EAAA,EAAA;AAG/C;;",
|
|
6
|
+
"names": ["Context", "Effect", "TestHelpers", "runIf", "condition", "effect", "ctx", "gen", "skip", "skipIf", "tagEnabled", "tag", "process", "env", "DX_TEST_TAGS", "includes", "taggedTest", "provideTestContext", "provideService", "TestContextService", "Tag"]
|
|
7
7
|
}
|
|
@@ -13,13 +13,12 @@ import { isNonNullable } from "@dxos/util";
|
|
|
13
13
|
var __dxlog_file = "/__w/dxos/dxos/packages/common/effect/src/ast.ts";
|
|
14
14
|
var reduceRefinements = (type, refinements = []) => {
|
|
15
15
|
if (SchemaAST.isRefinement(type)) {
|
|
16
|
-
const annotations = type.annotations;
|
|
17
16
|
const filter = type.filter;
|
|
18
17
|
const nextType = {
|
|
19
18
|
...type.from,
|
|
20
19
|
annotations: {
|
|
21
|
-
...type.annotations,
|
|
22
|
-
...annotations
|
|
20
|
+
...type.from.annotations,
|
|
21
|
+
...type.annotations
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
24
|
return reduceRefinements(nextType, [
|
|
@@ -39,12 +38,23 @@ var getBaseType = (prop) => {
|
|
|
39
38
|
};
|
|
40
39
|
var getProperties = (ast) => {
|
|
41
40
|
const properties = SchemaAST.getPropertySignatures(ast);
|
|
42
|
-
return properties.map((prop) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
48
|
+
}
|
|
49
|
+
} : type;
|
|
50
|
+
return {
|
|
51
|
+
type: mergedType,
|
|
52
|
+
refinements,
|
|
53
|
+
name: prop.name,
|
|
54
|
+
isOptional: prop.isOptional,
|
|
55
|
+
isReadonly: prop.isReadonly
|
|
56
|
+
};
|
|
57
|
+
});
|
|
48
58
|
};
|
|
49
59
|
var VisitResult = /* @__PURE__ */ (function(VisitResult2) {
|
|
50
60
|
VisitResult2[VisitResult2["CONTINUE"] = 0] = "CONTINUE";
|
|
@@ -143,7 +153,7 @@ var findProperty = (schema, path) => {
|
|
|
143
153
|
const typeNode = findNode(node, SchemaAST.isTypeLiteral);
|
|
144
154
|
invariant(typeNode, void 0, {
|
|
145
155
|
F: __dxlog_file,
|
|
146
|
-
L:
|
|
156
|
+
L: 247,
|
|
147
157
|
S: void 0,
|
|
148
158
|
A: [
|
|
149
159
|
"typeNode",
|
|
@@ -163,10 +173,10 @@ var findProperty = (schema, path) => {
|
|
|
163
173
|
return getProp(schema.ast, path.split("."));
|
|
164
174
|
};
|
|
165
175
|
var defaultAnnotations = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
176
|
+
ObjectKeyword: SchemaAST.objectKeyword,
|
|
177
|
+
StringKeyword: SchemaAST.stringKeyword,
|
|
178
|
+
NumberKeyword: SchemaAST.numberKeyword,
|
|
179
|
+
BooleanKeyword: SchemaAST.booleanKeyword
|
|
170
180
|
};
|
|
171
181
|
var getAnnotation2 = (annotationId, noDefault = true) => (node) => {
|
|
172
182
|
const id = Function.pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
|
|
@@ -212,7 +222,7 @@ var isDiscriminatedUnion = (node) => {
|
|
|
212
222
|
var getDiscriminatingProps = (node) => {
|
|
213
223
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
214
224
|
F: __dxlog_file,
|
|
215
|
-
L:
|
|
225
|
+
L: 365,
|
|
216
226
|
S: void 0,
|
|
217
227
|
A: [
|
|
218
228
|
"SchemaAST.isUnion(node)",
|
|
@@ -230,7 +240,7 @@ var getDiscriminatingProps = (node) => {
|
|
|
230
240
|
var getDiscriminatedType = (node, value = {}) => {
|
|
231
241
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
232
242
|
F: __dxlog_file,
|
|
233
|
-
L:
|
|
243
|
+
L: 389,
|
|
234
244
|
S: void 0,
|
|
235
245
|
A: [
|
|
236
246
|
"SchemaAST.isUnion(node)",
|
|
@@ -239,7 +249,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
239
249
|
});
|
|
240
250
|
invariant(value, void 0, {
|
|
241
251
|
F: __dxlog_file,
|
|
242
|
-
L:
|
|
252
|
+
L: 390,
|
|
243
253
|
S: void 0,
|
|
244
254
|
A: [
|
|
245
255
|
"value",
|
|
@@ -254,7 +264,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
254
264
|
const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
|
|
255
265
|
invariant(SchemaAST.isLiteral(prop.type), void 0, {
|
|
256
266
|
F: __dxlog_file,
|
|
257
|
-
L:
|
|
267
|
+
L: 401,
|
|
258
268
|
S: void 0,
|
|
259
269
|
A: [
|
|
260
270
|
"SchemaAST.isLiteral(prop.type)",
|
|
@@ -272,7 +282,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
272
282
|
const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
|
|
273
283
|
invariant(SchemaAST.isLiteral(literal.type), void 0, {
|
|
274
284
|
F: __dxlog_file,
|
|
275
|
-
L:
|
|
285
|
+
L: 419,
|
|
276
286
|
S: void 0,
|
|
277
287
|
A: [
|
|
278
288
|
"SchemaAST.isLiteral(literal.type)",
|
|
@@ -330,8 +340,8 @@ var getIndexSignatures = (ast) => {
|
|
|
330
340
|
};
|
|
331
341
|
|
|
332
342
|
// src/atom-kvs.ts
|
|
333
|
-
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
334
343
|
import { Atom } from "@effect-atom/atom-react";
|
|
344
|
+
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
335
345
|
var defaultRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
336
346
|
var createKvsStore = (options) => {
|
|
337
347
|
const runtime2 = options.runtime ?? defaultRuntime;
|
|
@@ -375,8 +385,7 @@ import * as Exit from "effect/Exit";
|
|
|
375
385
|
import * as GlobalValue from "effect/GlobalValue";
|
|
376
386
|
import * as Option2 from "effect/Option";
|
|
377
387
|
import * as Runtime from "effect/Runtime";
|
|
378
|
-
var spanSymbol = Symbol.for("effect/SpanAnnotation");
|
|
379
|
-
var originalSymbol = Symbol.for("effect/OriginalAnnotation");
|
|
388
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
380
389
|
var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
381
390
|
var locationRegex = /\((.*)\)/g;
|
|
382
391
|
var prettyErrorStack = (error, appendStacks = []) => {
|
|
@@ -386,7 +395,7 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
386
395
|
const span = error[spanSymbol];
|
|
387
396
|
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
388
397
|
const out = [];
|
|
389
|
-
let atStack = false;
|
|
398
|
+
let atStack = false, inCore = false, passedScheduler = false;
|
|
390
399
|
for (let i = 0; i < lines.length; i++) {
|
|
391
400
|
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
392
401
|
out.push(lines[i]);
|
|
@@ -403,6 +412,26 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
403
412
|
if (lines[i].includes("effect_internal_function")) {
|
|
404
413
|
break;
|
|
405
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
|
+
}
|
|
406
435
|
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
407
436
|
}
|
|
408
437
|
if (span) {
|
|
@@ -433,9 +462,7 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
433
462
|
}
|
|
434
463
|
}
|
|
435
464
|
out.push(...appendStacks);
|
|
436
|
-
|
|
437
|
-
error = error[originalSymbol];
|
|
438
|
-
}
|
|
465
|
+
error = Cause.originalError(error);
|
|
439
466
|
if (error.cause) {
|
|
440
467
|
error.cause = prettyErrorStack(error.cause);
|
|
441
468
|
}
|
|
@@ -459,7 +486,7 @@ var causeToError = (cause) => {
|
|
|
459
486
|
];
|
|
460
487
|
const getStackFrames = () => {
|
|
461
488
|
const o = new Error();
|
|
462
|
-
Error.captureStackTrace(o,
|
|
489
|
+
Error.captureStackTrace(o, causeToError);
|
|
463
490
|
return o.stack.split("\n").slice(1);
|
|
464
491
|
};
|
|
465
492
|
const stackFrames = getStackFrames();
|
|
@@ -474,19 +501,30 @@ var causeToError = (cause) => {
|
|
|
474
501
|
var throwCause = (cause) => {
|
|
475
502
|
throw causeToError(cause);
|
|
476
503
|
};
|
|
477
|
-
var unwrapExit = (
|
|
478
|
-
if (Exit.isSuccess(
|
|
479
|
-
return
|
|
504
|
+
var unwrapExit = (exit2) => {
|
|
505
|
+
if (Exit.isSuccess(exit2)) {
|
|
506
|
+
return exit2.value;
|
|
480
507
|
}
|
|
481
|
-
return throwCause(
|
|
508
|
+
return throwCause(exit2.cause);
|
|
482
509
|
};
|
|
483
510
|
var runAndForwardErrors = async (effect, options) => {
|
|
484
|
-
const
|
|
485
|
-
return unwrapExit(
|
|
486
|
-
};
|
|
487
|
-
var runInRuntime =
|
|
488
|
-
|
|
489
|
-
|
|
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
|
+
}
|
|
490
528
|
};
|
|
491
529
|
var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
492
530
|
try {
|
|
@@ -677,7 +715,7 @@ import * as Function2 from "effect/Function";
|
|
|
677
715
|
import * as Option5 from "effect/Option";
|
|
678
716
|
import * as SchemaAST2 from "effect/SchemaAST";
|
|
679
717
|
import { decamelize } from "@dxos/util";
|
|
680
|
-
var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
718
|
+
var ParamKeyAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
681
719
|
var getParamKeyAnnotation = SchemaAST2.getAnnotation(ParamKeyAnnotationId);
|
|
682
720
|
var ParamKeyAnnotation = (value) => (self) => self.annotations({
|
|
683
721
|
[ParamKeyAnnotationId]: value
|
|
@@ -744,11 +782,32 @@ var runPromise2 = (provider) => async (effect) => {
|
|
|
744
782
|
return unwrapExit(await effect.pipe(Runtime3.runPromiseExit(runtime2)));
|
|
745
783
|
};
|
|
746
784
|
var provide2 = (runtimeProvider) => (effect) => Effect5.flatMap(runtimeProvider, (runtime2) => Effect5.provide(effect, runtime2));
|
|
785
|
+
|
|
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
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
return yield* exit2;
|
|
804
|
+
});
|
|
747
805
|
export {
|
|
748
806
|
dynamic_runtime_exports as DynamicRuntime,
|
|
749
807
|
JsonPath,
|
|
750
808
|
JsonProp,
|
|
751
809
|
ParamKeyAnnotation,
|
|
810
|
+
Performance_exports as Performance,
|
|
752
811
|
RuntimeProvider_exports as RuntimeProvider,
|
|
753
812
|
UrlParser,
|
|
754
813
|
VisitResult,
|