@dxos/effect 0.8.4-main.bc674ce → 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/index.mjs +79 -31
- 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 +79 -31
- 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/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 +1 -0
- 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 +8 -6
- package/src/errors.ts +59 -13
- package/src/index.ts +1 -0
- package/src/testing.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/ast.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/ast.ts":{"bytes":46860,"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/platform-browser/BrowserKeyValueStore","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","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":62831},"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/platform-browser/BrowserKeyValueStore","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","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":9860},"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":25454},"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 * Exmaple:\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 * Exmaple:\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 /**\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 (!
|
|
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 * Exmaple:\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 * Exmaple:\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 * Exmaple:\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, [
|
|
@@ -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,10 +162,10 @@ var findProperty = (schema, path) => {
|
|
|
163
162
|
return getProp(schema.ast, path.split("."));
|
|
164
163
|
};
|
|
165
164
|
var defaultAnnotations = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
ObjectKeyword: SchemaAST.objectKeyword,
|
|
166
|
+
StringKeyword: SchemaAST.stringKeyword,
|
|
167
|
+
NumberKeyword: SchemaAST.numberKeyword,
|
|
168
|
+
BooleanKeyword: SchemaAST.booleanKeyword
|
|
170
169
|
};
|
|
171
170
|
var getAnnotation2 = (annotationId, noDefault = true) => (node) => {
|
|
172
171
|
const id = Function.pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
|
|
@@ -212,7 +211,7 @@ var isDiscriminatedUnion = (node) => {
|
|
|
212
211
|
var getDiscriminatingProps = (node) => {
|
|
213
212
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
214
213
|
F: __dxlog_file,
|
|
215
|
-
L:
|
|
214
|
+
L: 355,
|
|
216
215
|
S: void 0,
|
|
217
216
|
A: [
|
|
218
217
|
"SchemaAST.isUnion(node)",
|
|
@@ -230,7 +229,7 @@ var getDiscriminatingProps = (node) => {
|
|
|
230
229
|
var getDiscriminatedType = (node, value = {}) => {
|
|
231
230
|
invariant(SchemaAST.isUnion(node), void 0, {
|
|
232
231
|
F: __dxlog_file,
|
|
233
|
-
L:
|
|
232
|
+
L: 379,
|
|
234
233
|
S: void 0,
|
|
235
234
|
A: [
|
|
236
235
|
"SchemaAST.isUnion(node)",
|
|
@@ -239,7 +238,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
239
238
|
});
|
|
240
239
|
invariant(value, void 0, {
|
|
241
240
|
F: __dxlog_file,
|
|
242
|
-
L:
|
|
241
|
+
L: 380,
|
|
243
242
|
S: void 0,
|
|
244
243
|
A: [
|
|
245
244
|
"value",
|
|
@@ -254,7 +253,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
254
253
|
const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
|
|
255
254
|
invariant(SchemaAST.isLiteral(prop.type), void 0, {
|
|
256
255
|
F: __dxlog_file,
|
|
257
|
-
L:
|
|
256
|
+
L: 391,
|
|
258
257
|
S: void 0,
|
|
259
258
|
A: [
|
|
260
259
|
"SchemaAST.isLiteral(prop.type)",
|
|
@@ -272,7 +271,7 @@ var getDiscriminatedType = (node, value = {}) => {
|
|
|
272
271
|
const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
|
|
273
272
|
invariant(SchemaAST.isLiteral(literal.type), void 0, {
|
|
274
273
|
F: __dxlog_file,
|
|
275
|
-
L:
|
|
274
|
+
L: 409,
|
|
276
275
|
S: void 0,
|
|
277
276
|
A: [
|
|
278
277
|
"SchemaAST.isLiteral(literal.type)",
|
|
@@ -375,8 +374,7 @@ import * as Exit from "effect/Exit";
|
|
|
375
374
|
import * as GlobalValue from "effect/GlobalValue";
|
|
376
375
|
import * as Option2 from "effect/Option";
|
|
377
376
|
import * as Runtime from "effect/Runtime";
|
|
378
|
-
var spanSymbol = Symbol.for("effect/SpanAnnotation");
|
|
379
|
-
var originalSymbol = Symbol.for("effect/OriginalAnnotation");
|
|
377
|
+
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
380
378
|
var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
381
379
|
var locationRegex = /\((.*)\)/g;
|
|
382
380
|
var prettyErrorStack = (error, appendStacks = []) => {
|
|
@@ -386,7 +384,7 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
386
384
|
const span = error[spanSymbol];
|
|
387
385
|
const lines = typeof error.stack === "string" ? error.stack.split("\n") : [];
|
|
388
386
|
const out = [];
|
|
389
|
-
let atStack = false;
|
|
387
|
+
let atStack = false, inCore = false, passedScheduler = false;
|
|
390
388
|
for (let i = 0; i < lines.length; i++) {
|
|
391
389
|
if (!atStack && !lines[i].startsWith(" at ")) {
|
|
392
390
|
out.push(lines[i]);
|
|
@@ -403,6 +401,26 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
403
401
|
if (lines[i].includes("effect_internal_function")) {
|
|
404
402
|
break;
|
|
405
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
|
+
}
|
|
406
424
|
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>").replace(/at Arguments\./, "at "));
|
|
407
425
|
}
|
|
408
426
|
if (span) {
|
|
@@ -433,9 +451,7 @@ var prettyErrorStack = (error, appendStacks = []) => {
|
|
|
433
451
|
}
|
|
434
452
|
}
|
|
435
453
|
out.push(...appendStacks);
|
|
436
|
-
|
|
437
|
-
error = error[originalSymbol];
|
|
438
|
-
}
|
|
454
|
+
error = Cause.originalError(error);
|
|
439
455
|
if (error.cause) {
|
|
440
456
|
error.cause = prettyErrorStack(error.cause);
|
|
441
457
|
}
|
|
@@ -459,7 +475,7 @@ var causeToError = (cause) => {
|
|
|
459
475
|
];
|
|
460
476
|
const getStackFrames = () => {
|
|
461
477
|
const o = new Error();
|
|
462
|
-
Error.captureStackTrace(o,
|
|
478
|
+
Error.captureStackTrace(o, causeToError);
|
|
463
479
|
return o.stack.split("\n").slice(1);
|
|
464
480
|
};
|
|
465
481
|
const stackFrames = getStackFrames();
|
|
@@ -474,19 +490,30 @@ var causeToError = (cause) => {
|
|
|
474
490
|
var throwCause = (cause) => {
|
|
475
491
|
throw causeToError(cause);
|
|
476
492
|
};
|
|
477
|
-
var unwrapExit = (
|
|
478
|
-
if (Exit.isSuccess(
|
|
479
|
-
return
|
|
493
|
+
var unwrapExit = (exit2) => {
|
|
494
|
+
if (Exit.isSuccess(exit2)) {
|
|
495
|
+
return exit2.value;
|
|
480
496
|
}
|
|
481
|
-
return throwCause(
|
|
497
|
+
return throwCause(exit2.cause);
|
|
482
498
|
};
|
|
483
499
|
var runAndForwardErrors = async (effect, options) => {
|
|
484
|
-
const
|
|
485
|
-
return unwrapExit(
|
|
486
|
-
};
|
|
487
|
-
var runInRuntime =
|
|
488
|
-
|
|
489
|
-
|
|
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
|
+
}
|
|
490
517
|
};
|
|
491
518
|
var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
|
|
492
519
|
try {
|
|
@@ -677,7 +704,7 @@ import * as Function2 from "effect/Function";
|
|
|
677
704
|
import * as Option5 from "effect/Option";
|
|
678
705
|
import * as SchemaAST2 from "effect/SchemaAST";
|
|
679
706
|
import { decamelize } from "@dxos/util";
|
|
680
|
-
var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
707
|
+
var ParamKeyAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/ParamKey");
|
|
681
708
|
var getParamKeyAnnotation = SchemaAST2.getAnnotation(ParamKeyAnnotationId);
|
|
682
709
|
var ParamKeyAnnotation = (value) => (self) => self.annotations({
|
|
683
710
|
[ParamKeyAnnotationId]: value
|
|
@@ -744,11 +771,32 @@ var runPromise2 = (provider) => async (effect) => {
|
|
|
744
771
|
return unwrapExit(await effect.pipe(Runtime3.runPromiseExit(runtime2)));
|
|
745
772
|
};
|
|
746
773
|
var provide2 = (runtimeProvider) => (effect) => Effect5.flatMap(runtimeProvider, (runtime2) => Effect5.provide(effect, runtime2));
|
|
774
|
+
|
|
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
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
return yield* exit2;
|
|
793
|
+
});
|
|
747
794
|
export {
|
|
748
795
|
dynamic_runtime_exports as DynamicRuntime,
|
|
749
796
|
JsonPath,
|
|
750
797
|
JsonProp,
|
|
751
798
|
ParamKeyAnnotation,
|
|
799
|
+
Performance_exports as Performance,
|
|
752
800
|
RuntimeProvider_exports as RuntimeProvider,
|
|
753
801
|
UrlParser,
|
|
754
802
|
VisitResult,
|