@dxos/effect 0.8.4-main.406dc2a → 0.8.4-main.548089c

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/effect",
3
- "version": "0.8.4-main.406dc2a",
3
+ "version": "0.8.4-main.548089c",
4
4
  "description": "Effect utils.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -27,10 +27,10 @@
27
27
  "@effect/opentelemetry": "^0.58.0",
28
28
  "@opentelemetry/api": "^1.9.0",
29
29
  "jsonpath-plus": "10.2.0",
30
- "@dxos/context": "0.8.4-main.406dc2a",
31
- "@dxos/util": "0.8.4-main.406dc2a",
32
- "@dxos/invariant": "0.8.4-main.406dc2a",
33
- "@dxos/node-std": "0.8.4-main.406dc2a"
30
+ "@dxos/invariant": "0.8.4-main.548089c",
31
+ "@dxos/context": "0.8.4-main.548089c",
32
+ "@dxos/util": "0.8.4-main.548089c",
33
+ "@dxos/node-std": "0.8.4-main.548089c"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@opentelemetry/api-logs": "^0.203.0",
@@ -40,7 +40,7 @@
40
40
  "@opentelemetry/sdk-trace-node": "^2.1.0",
41
41
  "@opentelemetry/semantic-conventions": "^1.37.0",
42
42
  "effect": "3.18.3",
43
- "@dxos/log": "0.8.4-main.406dc2a"
43
+ "@dxos/log": "0.8.4-main.548089c"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "effect": "^3.13.3"
package/src/ast.ts CHANGED
@@ -214,6 +214,12 @@ export const findNode = (node: SchemaAST.AST, test: (node: SchemaAST.AST) => boo
214
214
  return child;
215
215
  }
216
216
  }
217
+ for (const prop of getIndexSignatures(node)) {
218
+ const child = findNode(prop.type, test);
219
+ if (child) {
220
+ return child;
221
+ }
222
+ }
217
223
  }
218
224
 
219
225
  // Tuple.
@@ -481,3 +487,19 @@ export const isArrayType = (node: SchemaAST.AST): boolean => {
481
487
  node.types.length === 2)
482
488
  );
483
489
  };
490
+
491
+ const getIndexSignatures = (ast: SchemaAST.AST): Array<SchemaAST.IndexSignature> => {
492
+ const annotation = SchemaAST.getSurrogateAnnotation(ast);
493
+ if (Option.isSome(annotation)) {
494
+ return getIndexSignatures(annotation.value);
495
+ }
496
+ switch (ast._tag) {
497
+ case 'TypeLiteral':
498
+ return ast.indexSignatures.slice();
499
+ case 'Suspend':
500
+ return getIndexSignatures(ast.f());
501
+ case 'Refinement':
502
+ return getIndexSignatures(ast.from);
503
+ }
504
+ return [];
505
+ };