@dxos/effect 0.8.4-main.5ea62a8 → 0.8.4-main.66e292d

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.
Files changed (51) hide show
  1. package/dist/lib/browser/index.mjs +93 -60
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +93 -60
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/ast.d.ts +3 -2
  8. package/dist/types/src/ast.d.ts.map +1 -1
  9. package/dist/types/src/context.d.ts +2 -1
  10. package/dist/types/src/context.d.ts.map +1 -1
  11. package/dist/types/src/errors.d.ts +3 -1
  12. package/dist/types/src/errors.d.ts.map +1 -1
  13. package/dist/types/src/index.d.ts +1 -1
  14. package/dist/types/src/index.d.ts.map +1 -1
  15. package/dist/types/src/{jsonPath.d.ts → json-path.d.ts} +10 -2
  16. package/dist/types/src/json-path.d.ts.map +1 -0
  17. package/dist/types/src/json-path.test.d.ts +2 -0
  18. package/dist/types/src/json-path.test.d.ts.map +1 -0
  19. package/dist/types/src/otel.d.ts +17 -0
  20. package/dist/types/src/otel.d.ts.map +1 -0
  21. package/dist/types/src/otel.test.d.ts +2 -0
  22. package/dist/types/src/otel.test.d.ts.map +1 -0
  23. package/dist/types/src/resource.d.ts +6 -2
  24. package/dist/types/src/resource.d.ts.map +1 -1
  25. package/dist/types/src/testing.d.ts +24 -1
  26. package/dist/types/src/testing.d.ts.map +1 -1
  27. package/dist/types/src/url.d.ts +3 -1
  28. package/dist/types/src/url.d.ts.map +1 -1
  29. package/dist/types/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +15 -7
  31. package/src/ast.test.ts +3 -2
  32. package/src/ast.ts +39 -12
  33. package/src/context.ts +2 -1
  34. package/src/errors.test.ts +1 -1
  35. package/src/errors.ts +12 -7
  36. package/src/index.ts +1 -1
  37. package/src/interrupt.test.ts +4 -5
  38. package/src/{jsonPath.test.ts → json-path.test.ts} +40 -1
  39. package/src/{jsonPath.ts → json-path.ts} +29 -1
  40. package/src/layers.test.ts +6 -2
  41. package/src/otel.test.ts +126 -0
  42. package/src/otel.ts +45 -0
  43. package/src/resource.test.ts +3 -3
  44. package/src/resource.ts +8 -3
  45. package/src/sanity.test.ts +24 -11
  46. package/src/testing.ts +29 -1
  47. package/src/url.test.ts +1 -1
  48. package/src/url.ts +5 -2
  49. package/dist/types/src/jsonPath.d.ts.map +0 -1
  50. package/dist/types/src/jsonPath.test.d.ts +0 -2
  51. package/dist/types/src/jsonPath.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"inputs":{"src/ast.ts":{"bytes":43345,"imports":[{"path":"effect","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/jsonPath.ts":{"bytes":9719,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"src/url.ts":{"bytes":7910,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/context.ts":{"bytes":1663,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true}],"format":"esm"},"src/errors.ts":{"bytes":18775,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/testing.ts":{"bytes":4845,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/resource.ts":{"bytes":2161,"imports":[{"path":"effect","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":947,"imports":[{"path":"src/ast.ts","kind":"import-statement","original":"./ast"},{"path":"src/jsonPath.ts","kind":"import-statement","original":"./jsonPath"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/testing.ts","kind":"import-statement","original":"./testing"},{"path":"src/resource.ts","kind":"import-statement","original":"./resource"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":45355},"dist/lib/browser/index.mjs":{"imports":[{"path":"effect","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","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true},{"path":"effect","kind":"import-statement","external":true}],"exports":["JsonPath","JsonProp","ParamKeyAnnotation","SimpleType","TestHelpers","UrlParser","VisitResult","accuireReleaseResource","causeToError","contextFromScope","createJsonPath","findAnnotation","findNode","findProperty","fromEffectValidationPath","getAnnotation","getDiscriminatedType","getDiscriminatingProps","getField","getParamKeyAnnotation","getSimpleType","isArrayType","isDiscriminatedUnion","isJsonPath","isLiteralUnion","isOption","isSimpleType","mapAst","promiseWithCauseCapture","runAndForwardErrors","splitJsonPath","throwCause","unwrapExit","visit"],"entryPoint":"src/index.ts","inputs":{"src/ast.ts":{"bytesInOutput":9247},"src/index.ts":{"bytesInOutput":0},"src/jsonPath.ts":{"bytesInOutput":1862},"src/url.ts":{"bytesInOutput":1916},"src/context.ts":{"bytesInOutput":370},"src/errors.ts":{"bytesInOutput":3689},"src/testing.ts":{"bytesInOutput":680},"src/resource.ts":{"bytesInOutput":372}},"bytes":18932}}}
1
+ {"inputs":{"src/ast.ts":{"bytes":45965,"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/json-path.ts":{"bytes":11804,"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/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/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":19285,"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}],"format":"esm"},"src/testing.ts":{"bytes":6498,"imports":[{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/resource.ts":{"bytes":2356,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":948,"imports":[{"path":"src/ast.ts","kind":"import-statement","original":"./ast"},{"path":"src/json-path.ts","kind":"import-statement","original":"./json-path"},{"path":"src/url.ts","kind":"import-statement","original":"./url"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/errors.ts","kind":"import-statement","original":"./errors"},{"path":"src/testing.ts","kind":"import-statement","original":"./testing"},{"path":"src/resource.ts","kind":"import-statement","original":"./resource"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":48681},"dist/lib/browser/index.mjs":{"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},{"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/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":"@dxos/context","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/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true}],"exports":["JsonPath","JsonProp","ParamKeyAnnotation","SimpleType","TestContextService","TestHelpers","UrlParser","VisitResult","acquireReleaseResource","causeToError","contextFromScope","createJsonPath","findAnnotation","findNode","findProperty","fromEffectValidationPath","getAnnotation","getDiscriminatedType","getDiscriminatingProps","getField","getParamKeyAnnotation","getSimpleType","getValue","isArrayType","isDiscriminatedUnion","isJsonPath","isLiteralUnion","isOption","isSimpleType","mapAst","promiseWithCauseCapture","runAndForwardErrors","setValue","splitJsonPath","throwCause","unwrapExit","visit"],"entryPoint":"src/index.ts","inputs":{"src/ast.ts":{"bytesInOutput":9947},"src/index.ts":{"bytesInOutput":0},"src/json-path.ts":{"bytesInOutput":2175},"src/url.ts":{"bytesInOutput":1693},"src/context.ts":{"bytesInOutput":378},"src/errors.ts":{"bytesInOutput":3847},"src/testing.ts":{"bytesInOutput":926},"src/resource.ts":{"bytesInOutput":370}},"bytes":20197}}}
@@ -1,17 +1,19 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
3
  // src/ast.ts
4
- import { Option, Schema, SchemaAST, pipe } from "effect";
5
- import { isUndefinedKeyword } from "effect/SchemaAST";
4
+ import * as Function from "effect/Function";
5
+ import * as Option from "effect/Option";
6
+ import * as Schema from "effect/Schema";
7
+ import * as SchemaAST from "effect/SchemaAST";
6
8
  import { invariant } from "@dxos/invariant";
7
9
  import { isNonNullable } from "@dxos/util";
8
10
  var __dxlog_file = "/__w/dxos/dxos/packages/common/effect/src/ast.ts";
9
- var isTupleType = (node) => {
11
+ var isTupleType2 = (node) => {
10
12
  return SchemaAST.isTupleType(node) && node.elements.length > 0;
11
13
  };
12
14
  var getSimpleType = (node) => {
13
15
  if (SchemaAST.isDeclaration(node) || SchemaAST.isObjectKeyword(node) || SchemaAST.isTypeLiteral(node) || // TODO(wittjosiah): Tuples are actually arrays.
14
- isTupleType(node) || isDiscriminatedUnion(node)) {
16
+ isTupleType2(node) || isDiscriminatedUnion(node)) {
15
17
  return "object";
16
18
  }
17
19
  if (SchemaAST.isStringKeyword(node)) {
@@ -52,12 +54,12 @@ var isSimpleType = (node) => !!getSimpleType(node);
52
54
  }
53
55
  };
54
56
  })(SimpleType || (SimpleType = {}));
55
- var VisitResult = /* @__PURE__ */ function(VisitResult2) {
57
+ var VisitResult = /* @__PURE__ */ (function(VisitResult2) {
56
58
  VisitResult2[VisitResult2["CONTINUE"] = 0] = "CONTINUE";
57
59
  VisitResult2[VisitResult2["SKIP"] = 1] = "SKIP";
58
60
  VisitResult2[VisitResult2["EXIT"] = 2] = "EXIT";
59
61
  return VisitResult2;
60
- }({});
62
+ })({});
61
63
  var defaultTest = isSimpleType;
62
64
  var visit = (node, testOrVisitor, visitor) => {
63
65
  if (!visitor) {
@@ -121,6 +123,12 @@ var findNode = (node, test) => {
121
123
  return child;
122
124
  }
123
125
  }
126
+ for (const prop of getIndexSignatures(node)) {
127
+ const child = findNode(prop.type, test);
128
+ if (child) {
129
+ return child;
130
+ }
131
+ }
124
132
  } else if (SchemaAST.isTupleType(node)) {
125
133
  for (const [_, element] of node.elements.entries()) {
126
134
  const child = findNode(element.type, test);
@@ -129,12 +137,13 @@ var findNode = (node, test) => {
129
137
  }
130
138
  }
131
139
  } else if (SchemaAST.isUnion(node)) {
132
- if (isOption(node)) {
133
- for (const type of node.types) {
134
- const child = findNode(type, test);
135
- if (child) {
136
- return child;
137
- }
140
+ if (isLiteralUnion(node)) {
141
+ return void 0;
142
+ }
143
+ for (const type of node.types) {
144
+ const child = findNode(type, test);
145
+ if (child) {
146
+ return child;
138
147
  }
139
148
  }
140
149
  } else if (SchemaAST.isRefinement(node)) {
@@ -147,7 +156,7 @@ var findProperty = (schema, path) => {
147
156
  const typeNode = findNode(node, SchemaAST.isTypeLiteral);
148
157
  invariant(typeNode, void 0, {
149
158
  F: __dxlog_file,
150
- L: 255,
159
+ L: 265,
151
160
  S: void 0,
152
161
  A: [
153
162
  "typeNode",
@@ -172,16 +181,16 @@ var defaultAnnotations = {
172
181
  ["NumberKeyword"]: SchemaAST.numberKeyword,
173
182
  ["BooleanKeyword"]: SchemaAST.booleanKeyword
174
183
  };
175
- var getAnnotation = (annotationId, noDefault = true) => (node) => {
176
- const id = pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
177
- const value = pipe(SchemaAST.getAnnotation(annotationId)(node), Option.getOrUndefined);
184
+ var getAnnotation2 = (annotationId, noDefault = true) => (node) => {
185
+ const id = Function.pipe(SchemaAST.getIdentifierAnnotation(node), Option.getOrUndefined);
186
+ const value = Function.pipe(SchemaAST.getAnnotation(annotationId)(node), Option.getOrUndefined);
178
187
  if (noDefault && (value === defaultAnnotations[node._tag]?.annotations[annotationId] || value === id)) {
179
188
  return void 0;
180
189
  }
181
190
  return value;
182
191
  };
183
192
  var findAnnotation = (node, annotationId, noDefault = true) => {
184
- const getAnnotationById = getAnnotation(annotationId, noDefault);
193
+ const getAnnotationById = getAnnotation2(annotationId, noDefault);
185
194
  const getBaseAnnotation = (node2) => {
186
195
  const value = getAnnotationById(node2);
187
196
  if (value !== void 0) {
@@ -207,7 +216,7 @@ var isDiscriminatedUnion = (node) => {
207
216
  var getDiscriminatingProps = (node) => {
208
217
  invariant(SchemaAST.isUnion(node), void 0, {
209
218
  F: __dxlog_file,
210
- L: 352,
219
+ L: 362,
211
220
  S: void 0,
212
221
  A: [
213
222
  "SchemaAST.isUnion(node)",
@@ -225,7 +234,7 @@ var getDiscriminatingProps = (node) => {
225
234
  var getDiscriminatedType = (node, value = {}) => {
226
235
  invariant(SchemaAST.isUnion(node), void 0, {
227
236
  F: __dxlog_file,
228
- L: 376,
237
+ L: 386,
229
238
  S: void 0,
230
239
  A: [
231
240
  "SchemaAST.isUnion(node)",
@@ -234,7 +243,7 @@ var getDiscriminatedType = (node, value = {}) => {
234
243
  });
235
244
  invariant(value, void 0, {
236
245
  F: __dxlog_file,
237
- L: 377,
246
+ L: 387,
238
247
  S: void 0,
239
248
  A: [
240
249
  "value",
@@ -249,7 +258,7 @@ var getDiscriminatedType = (node, value = {}) => {
249
258
  const match = SchemaAST.getPropertySignatures(type).filter((prop) => props?.includes(prop.name.toString())).every((prop) => {
250
259
  invariant(SchemaAST.isLiteral(prop.type), void 0, {
251
260
  F: __dxlog_file,
252
- L: 388,
261
+ L: 398,
253
262
  S: void 0,
254
263
  A: [
255
264
  "SchemaAST.isLiteral(prop.type)",
@@ -267,7 +276,7 @@ var getDiscriminatedType = (node, value = {}) => {
267
276
  const literal = SchemaAST.getPropertySignatures(type).find((p) => p.name.toString() === prop);
268
277
  invariant(SchemaAST.isLiteral(literal.type), void 0, {
269
278
  F: __dxlog_file,
270
- L: 406,
279
+ L: 416,
271
280
  S: void 0,
272
281
  A: [
273
282
  "SchemaAST.isLiteral(literal.type)",
@@ -287,7 +296,7 @@ var getDiscriminatedType = (node, value = {}) => {
287
296
  var mapAst = (ast, f) => {
288
297
  switch (ast._tag) {
289
298
  case "TypeLiteral": {
290
- 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);
299
+ 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);
291
300
  }
292
301
  case "Union": {
293
302
  return SchemaAST.Union.make(ast.types.map(f), ast.annotations);
@@ -305,15 +314,32 @@ var mapAst = (ast, f) => {
305
314
  }
306
315
  };
307
316
  var isArrayType = (node) => {
308
- return SchemaAST.isTupleType(node) || SchemaAST.isUnion(node) && node.types.some(isArrayType) && node.types.some(isUndefinedKeyword) && node.types.length === 2;
317
+ return SchemaAST.isTupleType(node) || SchemaAST.isUnion(node) && node.types.some(isArrayType) && node.types.some(SchemaAST.isUndefinedKeyword) && node.types.length === 2;
318
+ };
319
+ var getIndexSignatures = (ast) => {
320
+ const annotation = SchemaAST.getSurrogateAnnotation(ast);
321
+ if (Option.isSome(annotation)) {
322
+ return getIndexSignatures(annotation.value);
323
+ }
324
+ switch (ast._tag) {
325
+ case "TypeLiteral":
326
+ return ast.indexSignatures.slice();
327
+ case "Suspend":
328
+ return getIndexSignatures(ast.f());
329
+ case "Refinement":
330
+ return getIndexSignatures(ast.from);
331
+ }
332
+ return [];
309
333
  };
310
334
  var SimpleType;
311
335
 
312
- // src/jsonPath.ts
313
- import { Option as Option2, Schema as Schema2 } from "effect";
336
+ // src/json-path.ts
337
+ import * as Option2 from "effect/Option";
338
+ import * as Schema2 from "effect/Schema";
314
339
  import { JSONPath } from "jsonpath-plus";
315
340
  import { invariant as invariant2 } from "@dxos/invariant";
316
- var __dxlog_file2 = "/__w/dxos/dxos/packages/common/effect/src/jsonPath.ts";
341
+ import { getDeep, setDeep } from "@dxos/util";
342
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/common/effect/src/json-path.ts";
317
343
  var PATH_REGEX = /^($|[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*|\[\d+\](?:\.)?)*$)/;
318
344
  var PROP_REGEX = /^\w+$/;
319
345
  var JsonPath = Schema2.String.pipe(Schema2.pattern(PATH_REGEX)).annotations({
@@ -336,7 +362,7 @@ var createJsonPath = (path) => {
336
362
  }).join("");
337
363
  invariant2(isJsonPath(candidatePath), `Invalid JsonPath: ${candidatePath}`, {
338
364
  F: __dxlog_file2,
339
- L: 63,
365
+ L: 69,
340
366
  S: void 0,
341
367
  A: [
342
368
  "isJsonPath(candidatePath)",
@@ -349,7 +375,7 @@ var fromEffectValidationPath = (effectPath) => {
349
375
  const jsonPath = effectPath.replace(/\.\[(\d+)\]/g, "[$1]");
350
376
  invariant2(isJsonPath(jsonPath), `Invalid JsonPath: ${jsonPath}`, {
351
377
  F: __dxlog_file2,
352
- L: 74,
378
+ L: 80,
353
379
  S: void 0,
354
380
  A: [
355
381
  "isJsonPath(jsonPath)",
@@ -370,29 +396,28 @@ var getField = (object, path) => {
370
396
  json: object
371
397
  })[0];
372
398
  };
399
+ var getValue = (obj, path) => {
400
+ return getDeep(obj, splitJsonPath(path).map((p) => p.replace(/[[\]]/g, "")));
401
+ };
402
+ var setValue = (obj, path, value) => {
403
+ return setDeep(obj, splitJsonPath(path).map((p) => p.replace(/[[\]]/g, "")), value);
404
+ };
373
405
 
374
406
  // src/url.ts
375
- import { Option as Option3, SchemaAST as SchemaAST2, pipe as pipe2 } from "effect";
407
+ import * as Function2 from "effect/Function";
408
+ import * as Option3 from "effect/Option";
409
+ import * as SchemaAST2 from "effect/SchemaAST";
376
410
  import { decamelize } from "@dxos/util";
377
- function _define_property(obj, key, value) {
378
- if (key in obj) {
379
- Object.defineProperty(obj, key, {
380
- value,
381
- enumerable: true,
382
- configurable: true,
383
- writable: true
384
- });
385
- } else {
386
- obj[key] = value;
387
- }
388
- return obj;
389
- }
390
411
  var ParamKeyAnnotationId = Symbol.for("@dxos/schema/annotation/ParamKey");
391
412
  var getParamKeyAnnotation = SchemaAST2.getAnnotation(ParamKeyAnnotationId);
392
413
  var ParamKeyAnnotation = (value) => (self) => self.annotations({
393
414
  [ParamKeyAnnotationId]: value
394
415
  });
395
416
  var UrlParser = class {
417
+ _schema;
418
+ constructor(_schema) {
419
+ this._schema = _schema;
420
+ }
396
421
  /**
397
422
  * Parse URL params.
398
423
  */
@@ -424,7 +449,7 @@ var UrlParser = class {
424
449
  if (value !== void 0) {
425
450
  const field = this._schema.fields[key];
426
451
  if (field) {
427
- const { key: serializedKey } = pipe2(getParamKeyAnnotation(field.ast), Option3.getOrElse(() => ({
452
+ const { key: serializedKey } = Function2.pipe(getParamKeyAnnotation(field.ast), Option3.getOrElse(() => ({
428
453
  key: decamelize(key)
429
454
  })));
430
455
  url.searchParams.set(serializedKey, String(value));
@@ -433,27 +458,28 @@ var UrlParser = class {
433
458
  });
434
459
  return url;
435
460
  }
436
- constructor(_schema) {
437
- _define_property(this, "_schema", void 0);
438
- this._schema = _schema;
439
- }
440
461
  };
441
462
 
442
463
  // src/context.ts
443
- import { Effect } from "effect";
464
+ import * as Effect from "effect/Effect";
444
465
  import { Context } from "@dxos/context";
445
466
  var __dxlog_file3 = "/__w/dxos/dxos/packages/common/effect/src/context.ts";
446
467
  var contextFromScope = () => Effect.gen(function* () {
447
468
  const ctx = new Context(void 0, {
448
469
  F: __dxlog_file3,
449
- L: 12
470
+ L: 13
450
471
  });
451
472
  yield* Effect.addFinalizer(() => Effect.promise(() => ctx.dispose()));
452
473
  return ctx;
453
474
  });
454
475
 
455
476
  // src/errors.ts
456
- import { Cause, Chunk, Effect as Effect2, Exit, GlobalValue, Option as Option4 } from "effect";
477
+ import * as Cause from "effect/Cause";
478
+ import * as Chunk from "effect/Chunk";
479
+ import * as Effect2 from "effect/Effect";
480
+ import * as Exit from "effect/Exit";
481
+ import * as GlobalValue from "effect/GlobalValue";
482
+ import * as Option4 from "effect/Option";
457
483
  var spanSymbol = Symbol.for("effect/SpanAnnotation");
458
484
  var originalSymbol = Symbol.for("effect/OriginalAnnotation");
459
485
  var spanToTrace = GlobalValue.globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
@@ -525,9 +551,9 @@ var prettyErrorStack = (error, appendStacks = []) => {
525
551
  };
526
552
  var causeToError = (cause) => {
527
553
  if (Cause.isEmpty(cause)) {
528
- throw new Error("Fiber failed without a cause");
554
+ return new Error("Fiber failed without a cause");
529
555
  } else if (Cause.isInterruptedOnly(cause)) {
530
- throw new Error("Fiber was interrupted");
556
+ return new Error("Fiber was interrupted");
531
557
  } else {
532
558
  const errors = [
533
559
  ...Chunk.toArray(Cause.failures(cause)),
@@ -541,9 +567,9 @@ var causeToError = (cause) => {
541
567
  const stackFrames = getStackFrames();
542
568
  const newErrors = errors.map((error) => prettyErrorStack(error, stackFrames));
543
569
  if (newErrors.length === 1) {
544
- throw newErrors[0];
570
+ return newErrors[0];
545
571
  } else {
546
- throw new AggregateError(newErrors);
572
+ return new AggregateError(newErrors);
547
573
  }
548
574
  }
549
575
  };
@@ -570,7 +596,8 @@ var promiseWithCauseCapture = (evaluate) => Effect2.promise(async (signal) => {
570
596
  }).pipe(Effect2.flatten);
571
597
 
572
598
  // src/testing.ts
573
- import { Effect as Effect3 } from "effect";
599
+ import * as Context2 from "effect/Context";
600
+ import * as Effect3 from "effect/Effect";
574
601
  (function(TestHelpers2) {
575
602
  TestHelpers2.runIf = (condition) => (effect, ctx) => Effect3.gen(function* () {
576
603
  if (!condition) {
@@ -593,12 +620,15 @@ import { Effect as Effect3 } from "effect";
593
620
  return yield* effect;
594
621
  }
595
622
  });
623
+ TestHelpers2.provideTestContext = (effect, ctx) => Effect3.provideService(effect, TestContextService, ctx);
596
624
  })(TestHelpers || (TestHelpers = {}));
625
+ var TestContextService = class extends Context2.Tag("@dxos/effect/TestContextService")() {
626
+ };
597
627
  var TestHelpers;
598
628
 
599
629
  // src/resource.ts
600
- import { Effect as Effect4 } from "effect";
601
- var accuireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
630
+ import * as Effect4 from "effect/Effect";
631
+ var acquireReleaseResource = (getResource) => Effect4.acquireRelease(Effect4.gen(function* () {
602
632
  const resource = getResource();
603
633
  yield* Effect4.promise(async () => {
604
634
  resource.open?.();
@@ -614,10 +644,11 @@ export {
614
644
  JsonProp,
615
645
  ParamKeyAnnotation,
616
646
  SimpleType,
647
+ TestContextService,
617
648
  TestHelpers,
618
649
  UrlParser,
619
650
  VisitResult,
620
- accuireReleaseResource,
651
+ acquireReleaseResource,
621
652
  causeToError,
622
653
  contextFromScope,
623
654
  createJsonPath,
@@ -625,12 +656,13 @@ export {
625
656
  findNode,
626
657
  findProperty,
627
658
  fromEffectValidationPath,
628
- getAnnotation,
659
+ getAnnotation2 as getAnnotation,
629
660
  getDiscriminatedType,
630
661
  getDiscriminatingProps,
631
662
  getField,
632
663
  getParamKeyAnnotation,
633
664
  getSimpleType,
665
+ getValue,
634
666
  isArrayType,
635
667
  isDiscriminatedUnion,
636
668
  isJsonPath,
@@ -640,6 +672,7 @@ export {
640
672
  mapAst,
641
673
  promiseWithCauseCapture,
642
674
  runAndForwardErrors,
675
+ setValue,
643
676
  splitJsonPath,
644
677
  throwCause,
645
678
  unwrapExit,