@atscript/core 0.2.3 → 0.2.4

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/index.mjs CHANGED
@@ -633,6 +633,17 @@ const text$1 = (val) => new Token({
633
633
  return specifier[0] !== "." && specifier[0] !== "/";
634
634
  }
635
635
  /**
636
+ * The import path of an `.as` import as atscript resolves it: without a trailing `.as` extension.
637
+ * `.as` imports may name a file with or without its extension (`'./user'`, `'./user.as'`,
638
+ * `'my-lib/models.as'`); both spellings resolve to the same module. A bare package name
639
+ * (`'my-lib'`, no subpath) is kept as written.
640
+ */ function withoutAsExtension(specifier) {
641
+ if (!specifier.endsWith(".as")) return specifier;
642
+ const slash = specifier.lastIndexOf("/");
643
+ if (specifier.slice(slash + 1) === ".as" || isBareSpecifier(specifier) && parseBareSpecifier(specifier).subpath === ".") return specifier;
644
+ return specifier.slice(0, -3);
645
+ }
646
+ /**
636
647
  * Returns true if the document ID is a bare specifier placeholder.
637
648
  */ function isBareId(id) {
638
649
  return id.startsWith("bare:");
@@ -739,6 +750,7 @@ const resolveCache = /* @__PURE__ */ new Map();
739
750
  * @param fromDir Absolute directory of the importing file
740
751
  * @returns Resolved absolute file path, or undefined if not found
741
752
  */ async function resolveBareSpecifier(specifier, fromDir) {
753
+ specifier = withoutAsExtension(specifier);
742
754
  const cacheKey = `${fromDir}\0${specifier}`;
743
755
  if (resolveCache.has(cacheKey)) return resolveCache.get(cacheKey);
744
756
  const result = await _resolveBareSpecifier(specifier, fromDir);
@@ -784,16 +796,17 @@ async function _resolveBareSpecifier(specifier, fromDir) {
784
796
  //#endregion
785
797
  //#region packages/core/src/parser/utils.ts
786
798
  /** {@link resolveAtscriptFromPath} by document id and import path (a pure function of both). */ const resolvedFromPaths = /* @__PURE__ */ new Map();
787
- function resolveAtscriptFromPath(from, id) {
799
+ function resolveAtscriptFromPath(written, id) {
788
800
  let byFrom = resolvedFromPaths.get(id);
789
801
  if (!byFrom) {
790
802
  byFrom = /* @__PURE__ */ new Map();
791
803
  resolvedFromPaths.set(id, byFrom);
792
804
  }
793
- let resolved = byFrom.get(from);
805
+ let resolved = byFrom.get(written);
794
806
  if (resolved === void 0) {
807
+ const from = withoutAsExtension(written);
795
808
  resolved = isBareSpecifier(from) ? `bare:${from}.as` : `file://${path.join(fileUriToPath(id).split("/").slice(0, -1).join("/"), from)}.as`;
796
- byFrom.set(from, resolved);
809
+ byFrom.set(written, resolved);
797
810
  }
798
811
  return resolved;
799
812
  }
@@ -1262,6 +1275,10 @@ function _define_property$9(obj, key, value) {
1262
1275
  else obj[key] = value;
1263
1276
  return obj;
1264
1277
  }
1278
+ /**
1279
+ * The built-in annotation of `annotate` blocks that removes another annotation from the node
1280
+ * (`@annotate.reset 'expect.pattern'`): a directive, never written as metadata.
1281
+ */ const ANNOTATE_RESET = "annotate.reset";
1265
1282
  /** Whether an annotation argument type is written in backticks (`query`, `expr`, `order`). */ function isBacktickArgType(type) {
1266
1283
  return type === "query" || type === "expr" || type === "order";
1267
1284
  }
@@ -1280,7 +1297,7 @@ var AnnotationSpec = class {
1280
1297
  return this.arguments.map((arg, index) => {
1281
1298
  const placeholderIndex = index + 1;
1282
1299
  const defaultValue = this.getDefaultValueForType(arg.name, arg.type);
1283
- const quote = arg.type === "string" ? `'` : isBacktickArgType(arg.type) ? "`" : "";
1300
+ const quote = arg.type === "string" || arg.type === "value" ? `'` : isBacktickArgType(arg.type) ? "`" : "";
1284
1301
  return `${quote}\${${placeholderIndex}:${defaultValue}}${quote}`;
1285
1302
  }).join(", ");
1286
1303
  }
@@ -1290,6 +1307,7 @@ var AnnotationSpec = class {
1290
1307
  case "number": return tokenType === "number" ? void 0 : "number expected.";
1291
1308
  case "boolean": return tokenType === "identifier" ? void 0 : "boolean expected.";
1292
1309
  case "ref": return tokenType === "identifier" ? void 0 : "type reference expected.";
1310
+ case "value": return tokenType === "text" || tokenType === "number" || tokenType === "identifier" ? void 0 : "string, number or boolean expected.";
1293
1311
  case "query":
1294
1312
  case "expr":
1295
1313
  case "order": return tokenType === "query" ? void 0 : BACKTICK_TYPE_MESSAGES[type];
@@ -1346,7 +1364,7 @@ var AnnotationSpec = class {
1346
1364
  });
1347
1365
  continue;
1348
1366
  }
1349
- const values = argSpec.type === "boolean" ? ["true", "false"] : argSpec.values;
1367
+ const values = argSpec.type === "boolean" || argSpec.type === "value" && tokenType === "identifier" ? ["true", "false"] : argSpec.values;
1350
1368
  if (values && !values.includes(valueText)) messages.push({
1351
1369
  severity: 1,
1352
1370
  message: `${mainToken.text} at argument #${i + 1} ("${argSpec.name}") must be one of [${values.join(", ")}]`,
@@ -1395,10 +1413,33 @@ var AnnotationSpec = class {
1395
1413
  messages.push(...this.validateTargetType(def, mainToken.range, defDoc) || []);
1396
1414
  }
1397
1415
  }
1416
+ messages.push(...this.validateValueArgs(mainToken, args, doc));
1398
1417
  if (this.config.validate) messages.push(...this.config.validate(mainToken, args, doc) || []);
1399
1418
  return messages.length > 0 ? messages : void 0;
1400
1419
  }
1401
1420
  /**
1421
+ * `value` arguments written as a number or a boolean must fit the annotated field's type: a
1422
+ * number literal a field that holds numbers, a boolean literal one that holds booleans (a
1423
+ * union: one of its members; `unknown`: any). A string is accepted for any field.
1424
+ */ validateValueArgs(mainToken, args, doc) {
1425
+ const messages = [];
1426
+ const specArgs = this.arguments;
1427
+ let kinds = null;
1428
+ for (let i = 0; i < args.length && i < specArgs.length; i++) {
1429
+ const token = args[i];
1430
+ const kind = token.type === "number" ? "number" : token.type === "identifier" ? "boolean" : void 0;
1431
+ if (specArgs[i].type !== "value" || !kind) continue;
1432
+ if (kinds === null) kinds = annotatedValueKinds(mainToken, doc);
1433
+ if (!kinds) return messages;
1434
+ if (!literalFits(kind, kinds)) messages.push({
1435
+ severity: 1,
1436
+ message: `${mainToken.text} at argument #${i + 1} ("${specArgs[i].name}"): a ${kind} does not fit the field's type (${[...kinds].join(" | ") || "unknown"}).`,
1437
+ range: token.range
1438
+ });
1439
+ }
1440
+ return messages;
1441
+ }
1442
+ /**
1402
1443
  * Checks an already-resolved target node against this annotation's `defType`
1403
1444
  * guard (e.g. `@expect.minLength` requires `string | array`). Returns a
1404
1445
  * diagnostic when the type doesn't match, or `undefined` when it matches or no
@@ -1431,9 +1472,9 @@ var AnnotationSpec = class {
1431
1472
  const a = this.arguments[index];
1432
1473
  if (a) {
1433
1474
  const values = a.values ? `\n\nValues:\n${a.values.join(", ")}` : "";
1434
- return `### \`${a.name}${a.optional ? "?" : ""}: ${a.type}\`\n\n${a.description}${values}`;
1475
+ return `### \`${a.name}${a.optional ? "?" : ""}: ${argTypeLabel(a)}\`\n\n${a.description}${values}`;
1435
1476
  }
1436
- } else return `### ${index} ${this.arguments.map((a) => `\`${a.name}${a.optional ? "?" : ""}: ${a.type}\``).join(", ")}\n\n${this.config.description}`;
1477
+ } else return `### ${index} ${this.arguments.map((a) => `\`${a.name}${a.optional ? "?" : ""}: ${argTypeLabel(a)}\``).join(", ")}\n\n${this.config.description}`;
1437
1478
  }
1438
1479
  getDefaultValueForType(name, type) {
1439
1480
  switch (type) {
@@ -1444,6 +1485,7 @@ var AnnotationSpec = class {
1444
1485
  case "query": return "field = value";
1445
1486
  case "expr": return "field + 1";
1446
1487
  case "order": return "field asc";
1488
+ case "value": return name;
1447
1489
  default: return "";
1448
1490
  }
1449
1491
  }
@@ -1454,6 +1496,9 @@ var AnnotationSpec = class {
1454
1496
  this.__is_annotation_spec = true;
1455
1497
  }
1456
1498
  };
1499
+ /** An argument's type as the docs show it (`value`: the literals it takes). */ function argTypeLabel(a) {
1500
+ return a.type === "value" ? "string | number | boolean" : a.type;
1501
+ }
1457
1502
  function isAnnotationSpec(a) {
1458
1503
  return Boolean(a) && a.__is_annotation_spec;
1459
1504
  }
@@ -1477,6 +1522,29 @@ function isAnnotationSpec(a) {
1477
1522
  };
1478
1523
  walk(tree);
1479
1524
  }
1525
+ /**
1526
+ * Where annotation `spec` holds user-facing text (arguments flagged `userText`): `true` — its
1527
+ * value itself (a spec with one argument, not a list: the value is the string; for a `multiple`
1528
+ * annotation, each value); a list — those fields of its value object (a spec with an argument
1529
+ * list). `undefined`: no user-facing text.
1530
+ */ function userTextFields(spec) {
1531
+ const arg = spec.config.argument;
1532
+ if (!arg) return;
1533
+ if (!Array.isArray(arg)) return arg.userText ? true : void 0;
1534
+ const fields = arg.filter((a) => a.userText).map((a) => a.name);
1535
+ return fields.length > 0 ? fields : void 0;
1536
+ }
1537
+ /**
1538
+ * Every annotation of `tree` (core and plugins) holding user-facing text, by full name (see
1539
+ * {@link userTextFields}): what i18n tooling extracts and a translator translates.
1540
+ */ function userTextAnnotations(tree) {
1541
+ const out = /* @__PURE__ */ new Map();
1542
+ forEachAnnotationSpec(tree, (name, spec) => {
1543
+ const fields = userTextFields(spec);
1544
+ if (fields) out.set(name, fields);
1545
+ });
1546
+ return out;
1547
+ }
1480
1548
  function resolveAnnotation(name, annotationsTree) {
1481
1549
  const parts = name.split(".");
1482
1550
  let current = annotationsTree;
@@ -1495,11 +1563,14 @@ function resolveAnnotation(name, annotationsTree) {
1495
1563
  return defType.includes(describeNode(def));
1496
1564
  }
1497
1565
  /** The `defType` vocabulary name of a resolved node (`string`, `object`, `union`, `array`, …). */ function describeNode(def) {
1498
- if (isPrimitive(def)) return def.type || "unknown";
1566
+ if (isPrimitive(def)) return def.type === "any" ? "unknown" : def.type || "unknown";
1499
1567
  if (isInterface(def) || isStructure(def)) return "object";
1500
1568
  if (isGroup(def) && def.entity !== "tuple") return def.op === "&" ? "intersection" : "union";
1501
1569
  return def?.entity || "unknown";
1502
1570
  }
1571
+ /** A `|` group (not a tuple, an inline object `{ … }` or a `&` group). */ function isUnionGroup(node) {
1572
+ return node?.entity === "group" && node.op !== "&";
1573
+ }
1503
1574
  /** Walks a `|` union (flattening nested unions and union aliases), resolving member refs. */ function walkUnionMembers(def, doc, cb, seen = /* @__PURE__ */ new Set()) {
1504
1575
  if (seen.has(def)) return;
1505
1576
  seen.add(def);
@@ -1511,7 +1582,7 @@ function resolveAnnotation(name, annotationsTree) {
1511
1582
  member = unwound?.def;
1512
1583
  memberDoc = unwound?.doc || doc;
1513
1584
  }
1514
- if (isGroup(member) && member.entity !== "tuple" && member.op !== "&") walkUnionMembers(member, memberDoc, cb, seen);
1585
+ if (isUnionGroup(member)) walkUnionMembers(member, memberDoc, cb, seen);
1515
1586
  else cb(member);
1516
1587
  }
1517
1588
  }
@@ -1538,7 +1609,7 @@ function describeUnionMembers(def, doc) {
1538
1609
  * const ok = members ? members.length > 0 && members.every(isWanted) : isWanted(def)
1539
1610
  * ```
1540
1611
  */ function nonNullishMembers(def, doc) {
1541
- if (!isGroup(def) || def.entity === "tuple" || def.op === "&") return;
1612
+ if (!isUnionGroup(def)) return;
1542
1613
  const members = [];
1543
1614
  walkUnionMembers(def, doc, (m) => {
1544
1615
  if (m && !isNullishPrimitive(m)) members.push(m);
@@ -1546,6 +1617,73 @@ function describeUnionMembers(def, doc) {
1546
1617
  return members;
1547
1618
  }
1548
1619
  /**
1620
+ * The resolved type of the field (or type) an annotation is written on: an inline prop's, the
1621
+ * prop an `annotate` block entry names, an `annotate` block's target. `undefined` when it does
1622
+ * not resolve (reported elsewhere).
1623
+ */ function annotatedFieldType(mainToken, doc) {
1624
+ const parent = mainToken.parentNode;
1625
+ if (!parent) return;
1626
+ const at = parent.entity === "annotate" ? doc.unwindType(parent.targetName) : doc.annotatedDefinition(parent);
1627
+ if (!at?.def) return;
1628
+ if (isRef(at.def)) {
1629
+ const unwound = at.doc.unwindRef(at.def);
1630
+ return unwound?.def ? {
1631
+ def: unwound.def,
1632
+ doc: unwound.doc
1633
+ } : void 0;
1634
+ }
1635
+ return {
1636
+ def: at.def,
1637
+ doc: at.doc
1638
+ };
1639
+ }
1640
+ /**
1641
+ * The scalar kinds a resolved type holds (`string`, `number`, `boolean`, `decimal`; `unknown`:
1642
+ * any value), through references and aliases: a union's members' (not `null` / `undefined`), a
1643
+ * scalar merge's kinds every member has (`unknown` takes no part: `unknown & number` is a
1644
+ * number), a literal's.
1645
+ */ function valueKinds(def, doc, seen = /* @__PURE__ */ new Set()) {
1646
+ let node = def;
1647
+ let at = doc;
1648
+ while (node && isGroup(node) && !node.op && node.unwrap().length === 1) node = node.unwrap()[0];
1649
+ if (isRef(node)) {
1650
+ const unwound = at.unwindRef(node);
1651
+ node = unwound?.def;
1652
+ at = unwound?.doc ?? at;
1653
+ }
1654
+ if (!node || seen.has(node)) return /* @__PURE__ */ new Set();
1655
+ seen.add(node);
1656
+ if (node.entity === "const") return new Set([node.token("identifier")?.type === "number" ? "number" : "string"]);
1657
+ if (isGroup(node) && node.entity !== "tuple" && node.op === "&") {
1658
+ let out;
1659
+ for (const m of node.unwrap()) {
1660
+ const ks = valueKinds(m, at, seen);
1661
+ if (ks.size === 1 && ks.has("unknown")) continue;
1662
+ out = out ? new Set([...out].filter((k) => ks.has(k))) : ks;
1663
+ }
1664
+ return out ?? new Set(["unknown"]);
1665
+ }
1666
+ const members = nonNullishMembers(node, at);
1667
+ if (members) {
1668
+ const out = /* @__PURE__ */ new Set();
1669
+ for (const m of members) for (const k of valueKinds(m, at, seen)) out.add(k);
1670
+ return out;
1671
+ }
1672
+ return new Set([describeNode(node)]);
1673
+ }
1674
+ /**
1675
+ * The scalar kinds the field (or type) annotation `mainToken` is written on holds (see
1676
+ * `valueKinds`): `string`, `number`, `boolean`, `decimal`, `unknown` (any value), or another
1677
+ * kind name (`object`, `array`, …). `undefined` when the field does not resolve. Code generators
1678
+ * use it for `value` arguments: a number literal on a `decimal` field is written as its string.
1679
+ */ function annotatedValueKinds(mainToken, doc) {
1680
+ const target = annotatedFieldType(mainToken, doc);
1681
+ return target ? valueKinds(target.def, target.doc) : void 0;
1682
+ }
1683
+ /** Whether a literal of `kind` (`number`, `boolean`) fits a field of `kinds` (see `valueKinds`). */ function literalFits(kind, kinds) {
1684
+ return kinds.has("unknown") || kinds.has(kind) || kind === "number" && kinds.has("decimal");
1685
+ }
1686
+ /**
1549
1687
  * The node type an `annotate` block's top-level annotations apply to: its target's (`interface`
1550
1688
  * or `type`; through an `annotate … as` alias, the alias's target's). `undefined` while the
1551
1689
  * target does not resolve (reported elsewhere).
@@ -4169,6 +4307,11 @@ var TSeverity = /* @__PURE__ */ function(TSeverity) {
4169
4307
  const UNION_IN_RECURSIVE_MERGE = "union members are not supported in recursive merges; split with named types";
4170
4308
  const MERGE_TOO_COMPLEX = "merge too complex: split it with named types";
4171
4309
  /** Why scalars (or an object and a scalar) merge to `never`. */ const NOTHING_IN_COMMON = "values with nothing in common";
4310
+ /**
4311
+ * Why a merge of `unknown` (any value) with an object, an array or `null` is refused: TypeScript
4312
+ * reads `unknown & X` as `X`, a merge of values would be `never` (a compile error, not a
4313
+ * validator rejecting what the `.d.ts` accepts).
4314
+ */ const OPAQUE_MERGE = "\"unknown\" cannot be merged with an object, an array or null";
4172
4315
  /** A type written as an operand of its own merge (`type X = A & X`). */ const SELF_OPERAND = "a type cannot be an operand of its own merge; recurse through a field instead";
4173
4316
  /** A db entity whose flattening reaches a web of mutually recursive merges. */ const FLATTEN_WEB = "flattening this type reaches mutually recursive merges; split it with named types";
4174
4317
  /**
@@ -4176,6 +4319,8 @@ const MERGE_TOO_COMPLEX = "merge too complex: split it with named types";
4176
4319
  * itself splits (MODEL §15 SELF-SPLIT): where it lands depends on the positions it decides.
4177
4320
  */ const SELF_SPLIT = "A block's path can't cross the type path it splits.";
4178
4321
  const isBranch = (s) => s.startsWith("|");
4322
+ /** A shape of the `unknown` primitive (any value). */ const isAnyShape = (s) => s.k === "scalar" && s.any === true;
4323
+ /** Merge refusals reported as errors, never dropped as a `never` branch. */ const refused = (reason) => reason === MERGE_TOO_COMPLEX || reason === OPAQUE_MERGE;
4179
4324
  /** A step that is a prop's name (not a union branch, an in-place merge operand or an element). */ const isNameStep = (s) => !s.startsWith("|") && !s.startsWith("&") && s !== "[]";
4180
4325
  /** A written `null`. */ const isNull = (x) => x.k === "scalar" && isPrimitive(x.node) && x.node.key === "null";
4181
4326
  /** A shape that is, or has a branch that is, an array. */ const holdsArray = (s) => s?.k === "arr" || s?.k === "uni" && s.items.some(holdsArray);
@@ -6380,7 +6525,12 @@ function fieldLoc(s) {
6380
6525
  }
6381
6526
  shape0(t) {
6382
6527
  switch (t.k) {
6383
- case "scalar": return isPrimitive(t.node) && t.node.key === "null" ? { k: "mixed" } : { k: "scalar" };
6528
+ case "scalar":
6529
+ if (!isPrimitive(t.node)) return { k: "scalar" };
6530
+ return t.node.key === "null" ? { k: "mixed" } : t.node.type === "any" ? {
6531
+ k: "scalar",
6532
+ any: true
6533
+ } : { k: "scalar" };
6384
6534
  case "tup": {
6385
6535
  const items = t.items.map((i) => this.shape(i));
6386
6536
  if (!items.every((s) => s.k === "scalar" || s.k === "never")) return { k: "mixed" };
@@ -6392,6 +6542,10 @@ function fieldLoc(s) {
6392
6542
  case "uni": {
6393
6543
  if (t.struct) return this.shape(structExpr(t));
6394
6544
  const ss = t.items.map((i) => this.shape(i));
6545
+ if (ss.some(isAnyShape)) return {
6546
+ k: "scalar",
6547
+ any: true
6548
+ };
6395
6549
  if (ss.every((s) => s.k === "scalar" || s.k === "never")) return ss.every((s) => s.k === "never") ? {
6396
6550
  k: "never",
6397
6551
  reason: "union"
@@ -6459,13 +6613,17 @@ function fieldLoc(s) {
6459
6613
  * algebra: disjoint scalars are `never`), a single union operand of objects distributes.
6460
6614
  */ combine(ss, ends) {
6461
6615
  if (ss.length === 1) return ss[0];
6616
+ if (ss.some(isAnyShape) && !ss.every((s) => s.k === "scalar" || s.k === "never")) return {
6617
+ k: "never",
6618
+ reason: OPAQUE_MERGE
6619
+ };
6462
6620
  const tuple = ends.length === ss.length ? this.tupleShape(ends) : void 0;
6463
6621
  if (tuple) return tuple;
6464
6622
  if (ss.some((s) => s.k === "mixed")) {
6465
6623
  if (ends.length === ss.length && ends.some(isNull) && ends.every((e) => isNull(e) || this.nullable(e))) return { k: "scalar" };
6466
6624
  const leaves = ends.length === ss.length ? this.mixedLeaves(ss, ends) : void 0;
6467
6625
  const product = leaves && this.productShape(leaves.ss, leaves.ends);
6468
- if (product?.k === "never" && product.reason === MERGE_TOO_COMPLEX) return product;
6626
+ if (product?.k === "never" && refused(product.reason)) return product;
6469
6627
  return product?.k === "never" ? {
6470
6628
  k: "never",
6471
6629
  reason: NOTHING_IN_COMMON
@@ -6536,6 +6694,7 @@ function fieldLoc(s) {
6536
6694
  }
6537
6695
  const es = pick.map((p) => p.e);
6538
6696
  const c = this.combine(pick.map((p) => p.s), es.every(Boolean) ? es : []);
6697
+ if (c.k === "never" && c.reason === OPAQUE_MERGE) return c;
6539
6698
  if (c.k !== "never" && c.k !== "mixed") out.push(c);
6540
6699
  }
6541
6700
  if (out.length === 0) return {
@@ -8255,12 +8414,12 @@ var AtscriptDoc = class AtscriptDoc {
8255
8414
  * them to its target's metadata: an `append` annotation adds its values after the existing
8256
8415
  * ones, any other replaces them.
8257
8416
  */ overlayAnnotations(base, overlay) {
8258
- const replaced = /* @__PURE__ */ new Set();
8417
+ const replaced = resetNames(overlay) ?? /* @__PURE__ */ new Set();
8259
8418
  for (const a of overlay) {
8260
8419
  const spec = this.resolveAnnotation(a.name);
8261
8420
  if (!(spec?.config.multiple && spec.config.mergeStrategy === "append")) replaced.add(a.name);
8262
8421
  }
8263
- return [...(base ?? []).filter((a) => !replaced.has(a.name)), ...overlay];
8422
+ return [...(base ?? []).filter((a) => a.name === ANNOTATE_RESET || !replaced.has(a.name)), ...overlay];
8264
8423
  }
8265
8424
  /**
8266
8425
  * What declaration `decl` (of this document) is defined as — an alias's, its target's (an
@@ -8629,7 +8788,7 @@ var AtscriptDoc = class AtscriptDoc {
8629
8788
  */ evalAnnotationsForNode(givenNode, own = givenNode.annotations, blocks = false) {
8630
8789
  if (isAnnotate(givenNode) && !givenNode.isMutating) {
8631
8790
  const target = this.getDeclarationOwnerNode(givenNode.targetName);
8632
- return this.mergeNodesAnnotations(target?.node && target.node !== givenNode ? target.doc.evalAnnotationsForNode(target.node, annotationsOf(target.node, blocks), blocks) : void 0, own);
8791
+ return stripResets(this.mergeNodesAnnotations(target?.node && target.node !== givenNode ? target.doc.evalAnnotationsForNode(target.node, annotationsOf(target.node, blocks), blocks) : void 0, own, true));
8633
8792
  }
8634
8793
  return this.evalAnnotationsForDefinition(givenNode.getDefinition(), own, givenNode, blocks);
8635
8794
  }
@@ -8658,24 +8817,24 @@ var AtscriptDoc = class AtscriptDoc {
8658
8817
  for (const chainNode of chainNodes) {
8659
8818
  if (chainNode === unwound?.def) continue;
8660
8819
  const anns = chainNode === unwound?.node && fieldAnns ? fieldAnns : annotationsOf(chainNode, blocks);
8661
- right = this.mergeNodesAnnotations(this.filterPassedWhenReferred(anns, viaProp), right);
8820
+ right = this.mergeNodesAnnotations(this.filterPassedWhenReferred(anns, viaProp), right, true);
8662
8821
  }
8663
8822
  def = unwound?.def || def;
8664
8823
  }
8665
8824
  if (def) {
8666
8825
  const merged = this.mergeIntersection(def);
8667
8826
  if (merged !== def && isRef(merged)) {
8668
- right = this.mergeNodesAnnotations(merged.annotations, right);
8827
+ right = this.mergeNodesAnnotations(merged.annotations, right, true);
8669
8828
  def = merged;
8670
8829
  continue;
8671
8830
  }
8672
8831
  const written = unparenthesized(def);
8673
8832
  const own = isIntersection(written) ? this.intersectionAnnotations(written, blocks).map((p) => p.an) : refDef ? annotationsOf(merged, blocks) : merged.annotations;
8674
- right = this.mergeNodesAnnotations(refDef ? this.filterPassedWhenReferred(own, viaProp) : own, right);
8833
+ right = this.mergeNodesAnnotations(refDef ? this.filterPassedWhenReferred(own, viaProp) : own, right, true);
8675
8834
  }
8676
8835
  break;
8677
8836
  }
8678
- return right;
8837
+ return stripResets(right);
8679
8838
  }
8680
8839
  /**
8681
8840
  * The annotations of the field chain reference `ref` names (its node `node`), with the blocks:
@@ -8885,7 +9044,7 @@ var AtscriptDoc = class AtscriptDoc {
8885
9044
  const idToken = prop.token("identifier");
8886
9045
  if (idToken) cloned.saveToken(idToken, "identifier");
8887
9046
  if (newDef) cloned.define(newDef);
8888
- cloned.annotations = group.own.length === 0 ? prop.annotations : this.mergeNodesAnnotations(prop.annotations, group.own);
9047
+ cloned.annotations = group.own.length === 0 ? prop.annotations : this.mergeNodesAnnotations(prop.annotations, group.own, true);
8889
9048
  const optionalToken = prop.token("optional");
8890
9049
  if (optionalToken) cloned.saveToken(optionalToken, "optional");
8891
9050
  newProps.push(cloned);
@@ -9508,6 +9667,11 @@ var AtscriptDoc = class AtscriptDoc {
9508
9667
  message: MERGE_TOO_COMPLEX,
9509
9668
  range: token.range
9510
9669
  });
9670
+ else if (token && reason === OPAQUE_MERGE) messages.push({
9671
+ severity: TSeverity.Error,
9672
+ message: `${OPAQUE_MERGE}${path.length > 0 ? ` at "${decl.name}.${path.join(".")}"` : ` in "${decl.name}"`}: write the other type alone`,
9673
+ range: token.range
9674
+ });
9511
9675
  else if (token) messages.push({
9512
9676
  severity: TSeverity.Warning,
9513
9677
  message: `Intersection of ${reason} cannot be merged${path.length > 0 ? ` at "${decl.name}.${path.join(".")}"` : ` in "${decl.name}"`}; the type resolves to never`,
@@ -10083,14 +10247,29 @@ var AtscriptDoc = class AtscriptDoc {
10083
10247
  add(group);
10084
10248
  return out;
10085
10249
  }
10086
- mergeNodesAnnotations(left, right) {
10250
+ /**
10251
+ * Annotations `right` over `left`: right's win, `append` ones of both kept (left's after).
10252
+ *
10253
+ * `layered`: `right` is a node's and `left` what the node is layered over (the type it
10254
+ * references, an `as` copy's target) — right's `@annotate.reset 'x'` drop left's x, and the
10255
+ * resets of both stay, for the layers further below (see {@link stripResets}). Else they are
10256
+ * siblings (the members of a merge): a reset applies within its member's own layers only, and
10257
+ * is left out.
10258
+ */ mergeNodesAnnotations(left, right, layered = false) {
10087
10259
  const annotations = [];
10088
10260
  const savedAnnotations = /* @__PURE__ */ new Set();
10261
+ const hidden = layered ? resetNames(right) : void 0;
10089
10262
  for (const a of right || []) {
10263
+ if (a.name === ANNOTATE_RESET && !layered) continue;
10090
10264
  annotations.push(a);
10091
10265
  savedAnnotations.add(a.name);
10092
10266
  }
10093
10267
  for (const a of left || []) {
10268
+ if (a.name === ANNOTATE_RESET) {
10269
+ if (layered) annotations.push(a);
10270
+ continue;
10271
+ }
10272
+ if (hidden?.has(a.name)) continue;
10094
10273
  const spec = this.resolveAnnotation(a.name);
10095
10274
  if (spec && spec.config.multiple && spec.config.mergeStrategy === "append" || !savedAnnotations.has(a.name)) annotations.push(a);
10096
10275
  }
@@ -10299,6 +10478,72 @@ const zeroRange = {
10299
10478
  for (const t of decl.referredIdentifiers) out.add(t);
10300
10479
  return out;
10301
10480
  }
10481
+ /** The annotation names `@annotate.reset` entries of `anns` reset; `undefined`: none. */ function resetNames(anns) {
10482
+ let out;
10483
+ for (const a of anns ?? []) if (a.name === ANNOTATE_RESET && a.args[0]?.type === "text") (out ?? (out = /* @__PURE__ */ new Set())).add(a.args[0].text);
10484
+ return out;
10485
+ }
10486
+ /**
10487
+ * `anns` without their `@annotate.reset` entries: a node's annotations once the resets applied to
10488
+ * the layers below it (see `AtscriptDoc.mergeNodesAnnotations`).
10489
+ */ function stripResets(anns) {
10490
+ return anns?.some((a) => a.name === ANNOTATE_RESET) ? anns.filter((a) => a.name !== ANNOTATE_RESET) : anns;
10491
+ }
10492
+
10493
+ //#endregion
10494
+ //#region packages/core/src/defaults/annotate-annotations.ts
10495
+ /** Whether `name` is in the `annotate` namespace: a directive of `annotate` blocks, never metadata. */ function isAnnotateDirective(name) {
10496
+ return name.startsWith("annotate.");
10497
+ }
10498
+ /** The annotations of the `annotate` namespace: directives of `annotate` blocks, not metadata. */ const annotateAnnotations = { reset: new AnnotationSpec({
10499
+ description: annotationExample("Removes an annotation the annotated field or type would otherwise carry — declared on it, inherited from the type it references (`email: Email`, a primitive like `string.email`), from the target of an `annotate … as` copy, or written by a lower-ranked `annotate` block. Allowed only in `annotate` blocks (mutating and `annotate … as`), on an entry or at the top of the block (the type itself). The block's own value of that annotation applies over the reset; any other value does not. Repeat it to reset several annotations.", "annotate User as PublicUser {", " @annotate.reset 'expect.pattern'", " @expect.pattern '^[a-z]+$'", " login", "", " @annotate.reset 'meta.sensitive'", " token", "}"),
10500
+ multiple: true,
10501
+ argument: {
10502
+ name: "annotation",
10503
+ type: "string",
10504
+ description: "The full name of the annotation to remove, without `@` (`expect.pattern`, `meta.label`).",
10505
+ valueScope: (_token, doc) => annotationNames(doc.config.annotations)
10506
+ },
10507
+ validate(token, args, doc) {
10508
+ const messages = [];
10509
+ const parent = token.parentNode;
10510
+ const id = parent && isRef(parent) ? parent.token("identifier") : void 0;
10511
+ if (!(!!parent && isAnnotate(parent) || !!id && !!doc.annotateBlockAt(id.range.start.line, id.range.start.character))) messages.push({
10512
+ severity: TSeverity.Error,
10513
+ message: "@annotate.reset is allowed only in annotate blocks",
10514
+ range: token.range
10515
+ });
10516
+ const name = args[0]?.type === "text" ? args[0].text : void 0;
10517
+ if (name === void 0) return messages;
10518
+ if (isAnnotateDirective(name) || name === "annotate") messages.push({
10519
+ severity: TSeverity.Error,
10520
+ message: `"${name}" is not metadata: it cannot be reset`,
10521
+ range: args[0].range
10522
+ });
10523
+ else if (!doc.resolveAnnotation(name)) {
10524
+ const unknown = doc.config.unknownAnnotation;
10525
+ if (unknown !== "allow") messages.push({
10526
+ severity: unknown === "warn" ? TSeverity.Warning : TSeverity.Error,
10527
+ message: `Unknown annotation "@${name}"`,
10528
+ range: args[0].range
10529
+ });
10530
+ }
10531
+ return messages;
10532
+ }
10533
+ }) };
10534
+ /** The full names of the metadata annotations of `tree` (completion of `@annotate.reset`). */ function annotationNames(tree) {
10535
+ const out = [];
10536
+ forEachAnnotationSpec(tree ?? {}, (name, spec) => {
10537
+ if (!isAnnotateDirective(name)) {
10538
+ const doc = spec.config.description;
10539
+ out.push({
10540
+ value: name,
10541
+ documentation: doc
10542
+ });
10543
+ }
10544
+ });
10545
+ return out;
10546
+ }
10302
10547
 
10303
10548
  //#endregion
10304
10549
  //#region packages/core/src/defaults/emit-annotations.ts
@@ -10336,6 +10581,13 @@ const emitAnnotations = {
10336
10581
  //#endregion
10337
10582
  //#region packages/core/src/defaults/expect-annotations.ts
10338
10583
  const NULLABLE_NOTE = "Also allowed on a nullable field (`T | null`, `T | undefined`): `null` passes, any other value must satisfy the constraint.";
10584
+ /** The optional message argument of a constraint annotation. */ const MESSAGE_ARG = {
10585
+ name: "message",
10586
+ optional: true,
10587
+ type: "string",
10588
+ description: "Optional error message to display if the validation fails.",
10589
+ userText: true
10590
+ };
10339
10591
  /** Whether `flags` are flags of a JS regular expression. */ function validFlags(flags) {
10340
10592
  try {
10341
10593
  new RegExp("", flags);
@@ -10364,12 +10616,40 @@ const NULLABLE_NOTE = "Also allowed on a nullable field (`T | null`, `T | undefi
10364
10616
  name: argName,
10365
10617
  type: "number",
10366
10618
  description: argDescription
10367
- }, {
10368
- name: "message",
10369
- optional: true,
10370
- type: "string",
10371
- description: "Optional error message to display if the validation fails."
10372
- }]
10619
+ }, MESSAGE_ARG]
10620
+ });
10621
+ }
10622
+ /** Whether `text` (a number argument) is a non-negative integer. */ function isCount(text) {
10623
+ return /^\d+$/.test(text);
10624
+ }
10625
+ /**
10626
+ * `@expect.minKeys` / `maxKeys`: a key count (a non-negative integer) plus an optional message.
10627
+ * `@expect.maxKeys` also checks it is not below the node's `@expect.minKeys`.
10628
+ */ function keyCountSpec(bound, example, argDescription, min) {
10629
+ return new AnnotationSpec({
10630
+ description: annotationExample(`${`Validates that an object has ${bound} this many keys: the keys it keeps (with unknown properties ignored, every own key; else the declared and pattern-matched ones).`} ${NULLABLE_NOTE}`, ...example),
10631
+ defType: ["object"],
10632
+ argument: [{
10633
+ name: "count",
10634
+ type: "number",
10635
+ description: argDescription
10636
+ }, MESSAGE_ARG],
10637
+ validate(mainToken, args) {
10638
+ const count = args[0];
10639
+ if (!count || count.type !== "number") return [];
10640
+ if (!isCount(count.text)) return [{
10641
+ message: `${mainToken.text} expects a non-negative integer`,
10642
+ range: count.range,
10643
+ severity: 1
10644
+ }];
10645
+ const lower = min ? mainToken.parentNode?.annotations?.find((a) => a.name === min)?.args[0] : void 0;
10646
+ if (lower && isCount(lower.text) && Number(lower.text) > Number(count.text)) return [{
10647
+ message: `${mainToken.text} is below @${min} (${lower.text})`,
10648
+ range: count.range,
10649
+ severity: 1
10650
+ }];
10651
+ return [];
10652
+ }
10373
10653
  });
10374
10654
  }
10375
10655
  const expectAnnotations = {
@@ -10380,12 +10660,7 @@ const expectAnnotations = {
10380
10660
  name: "length",
10381
10661
  type: "number",
10382
10662
  description: "The minimum length of the string or array."
10383
- }, {
10384
- name: "message",
10385
- optional: true,
10386
- type: "string",
10387
- description: "Optional error message to display if the validation fails."
10388
- }]
10663
+ }, MESSAGE_ARG]
10389
10664
  }),
10390
10665
  maxLength: new AnnotationSpec({
10391
10666
  description: annotationExample(`Validates that a string or array has a maximum length. ${NULLABLE_NOTE}`, "@expect.maxLength 5", "name: string"),
@@ -10394,12 +10669,7 @@ const expectAnnotations = {
10394
10669
  name: "length",
10395
10670
  type: "number",
10396
10671
  description: "The maximum length of the string or array."
10397
- }, {
10398
- name: "message",
10399
- optional: true,
10400
- type: "string",
10401
- description: "Optional error message to display if the validation fails."
10402
- }]
10672
+ }, MESSAGE_ARG]
10403
10673
  }),
10404
10674
  min: numberBoundSpec("Validates that a number is greater than or equal to a minimum value.", ["@expect.min 18", "age: number"], "minValue", "The minimum value."),
10405
10675
  max: numberBoundSpec("Validates that a number is less than or equal to a maximum value.", ["@expect.max 10", "count: number"], "maxValue", "The maximum value."),
@@ -10407,7 +10677,20 @@ const expectAnnotations = {
10407
10677
  exclusiveMax: numberBoundSpec("Validates that a number is strictly less than a value (the value itself is rejected).", ["@expect.exclusiveMax 1", "ratio: number"], "exclusiveMaxValue", "The exclusive upper bound (the value must be less than this)."),
10408
10678
  int: new AnnotationSpec({
10409
10679
  description: annotationExample(`Validates that a number is an integer (no decimal places). ${NULLABLE_NOTE}`, "@expect.int", "age: number"),
10410
- defType: ["number"]
10680
+ defType: ["number"],
10681
+ argument: [MESSAGE_ARG]
10682
+ }),
10683
+ minKeys: keyCountSpec("at least", ["@expect.minKeys 1", "labels: { [*]: string }"], "The minimum number of keys."),
10684
+ maxKeys: keyCountSpec("at most", ["@expect.maxKeys 20", "labels: { [*]: string }"], "The maximum number of keys.", "expect.minKeys"),
10685
+ message: new AnnotationSpec({
10686
+ description: annotationExample("Custom error message for a type mismatch: wrong type (a non-finite number, a malformed decimal), not the literal (or not one of a literal union's values), no union branch, unknown discriminator, wrong tuple length. Constraint failures keep their own messages (`@expect.minLength` …, `@meta.required`).", "@expect.message 'Choose a valid status'", "status: 'active' | 'blocked'"),
10687
+ nodeType: ["prop", "type"],
10688
+ argument: {
10689
+ name: "message",
10690
+ type: "string",
10691
+ description: "The error message.",
10692
+ userText: true
10693
+ }
10411
10694
  }),
10412
10695
  pattern: new AnnotationSpec({
10413
10696
  description: annotationExample(`Validates that a string matches a specific pattern. ${NULLABLE_NOTE}`, "@expect.pattern \"[a-z]+\", \"u\"", "name: string"),
@@ -10492,12 +10775,7 @@ const expectAnnotations = {
10492
10775
  ],
10493
10776
  description: "Optional flags for the regular expression."
10494
10777
  },
10495
- {
10496
- name: "message",
10497
- optional: true,
10498
- type: "string",
10499
- description: "Optional error message to display if the validation fails."
10500
- }
10778
+ MESSAGE_ARG
10501
10779
  ],
10502
10780
  validate(mainToken, args) {
10503
10781
  if (args[0]) {
@@ -10526,7 +10804,8 @@ const expectAnnotations = {
10526
10804
  name: "message",
10527
10805
  optional: true,
10528
10806
  type: "string",
10529
- description: "Optional custom error message when duplicate items are found."
10807
+ description: "Optional custom error message when duplicate items are found.",
10808
+ userText: true
10530
10809
  }],
10531
10810
  validate(token, args, doc) {
10532
10811
  const field = token.parentNode;
@@ -10557,7 +10836,8 @@ const expectAnnotations = {
10557
10836
  name: "message",
10558
10837
  optional: true,
10559
10838
  type: "string",
10560
- description: "Optional custom error message (used by @expect.array.uniqueItems when checking key-based uniqueness)."
10839
+ description: "Optional custom error message (used by @expect.array.uniqueItems when checking key-based uniqueness).",
10840
+ userText: true
10561
10841
  }],
10562
10842
  validate(token, args, doc) {
10563
10843
  const field = token.parentNode;
@@ -10593,7 +10873,8 @@ const metaAnnotations = {
10593
10873
  argument: {
10594
10874
  name: "text",
10595
10875
  type: "string",
10596
- description: "The label to be used for this field or entity."
10876
+ description: "The label to be used for this field or entity.",
10877
+ userText: true
10597
10878
  }
10598
10879
  }),
10599
10880
  id: new AnnotationSpec({
@@ -10606,7 +10887,8 @@ const metaAnnotations = {
10606
10887
  argument: {
10607
10888
  name: "text",
10608
10889
  type: "string",
10609
- description: "Detailed description for this field or entity."
10890
+ description: "Detailed description for this field or entity.",
10891
+ userText: true
10610
10892
  }
10611
10893
  }),
10612
10894
  documentation: new AnnotationSpec({
@@ -10636,7 +10918,8 @@ const metaAnnotations = {
10636
10918
  name: "message",
10637
10919
  optional: true,
10638
10920
  type: "string",
10639
- description: "Optional error message to display if the validation fails."
10921
+ description: "Optional error message to display if the validation fails.",
10922
+ userText: true
10640
10923
  }],
10641
10924
  passedWhenReferred: false
10642
10925
  }),
@@ -10901,6 +11184,10 @@ const primitives = {
10901
11184
  type: "void",
10902
11185
  documentation: "Represents no value."
10903
11186
  },
11187
+ unknown: {
11188
+ type: "any",
11189
+ documentation: "Any value (an opaque value: JSON data of any shape). Not checked by the validator; JSON Schema `{}`; TypeScript `unknown`."
11190
+ },
10904
11191
  phantom: {
10905
11192
  type: "phantom",
10906
11193
  documentation: "Phantom type. Does not affect the data type, validation, or schema. Discoverable via runtime type traversal."
@@ -10915,7 +11202,8 @@ function getDefaultAtscriptConfig() {
10915
11202
  annotations: {
10916
11203
  meta: { ...metaAnnotations },
10917
11204
  expect: { ...expectAnnotations },
10918
- emit: { ...emitAnnotations }
11205
+ emit: { ...emitAnnotations },
11206
+ annotate: { ...annotateAnnotations }
10919
11207
  }
10920
11208
  };
10921
11209
  }
@@ -11077,12 +11365,14 @@ var AtscriptRepo = class {
11077
11365
  ref: "import(\"@atscript/typescript/utils\").AtscriptRef",
11078
11366
  query: "import(\"@atscript/typescript/utils\").AtscriptQueryNode",
11079
11367
  expr: "import(\"@atscript/typescript/utils\").AtscriptExprNode",
11080
- order: "import(\"@atscript/typescript/utils\").AtscriptOrderItem[]"
11368
+ order: "import(\"@atscript/typescript/utils\").AtscriptOrderItem[]",
11369
+ value: "string | number | boolean"
11081
11370
  };
11082
11371
  const mapArgType = (t) => ANNOTATION_TYPE_MAP[t] || t;
11083
11372
  const manager = await this.getSharedPluginManager();
11084
11373
  const annotations = {};
11085
11374
  if (manager) await manager.loopInAnnotationsSpec((name, spec) => {
11375
+ if (isAnnotateDirective(name)) return;
11086
11376
  const types = [];
11087
11377
  const multiple = !!spec.config.multiple;
11088
11378
  if (Array.isArray(spec.config.argument)) {
@@ -11110,7 +11400,7 @@ var AtscriptRepo = class {
11110
11400
  for (const doc of Array.from(this.atscripts.values())) {
11111
11401
  const awaited = await doc;
11112
11402
  for (const { name, token, args } of awaited.annotations) {
11113
- if (annotations[name]?.fromSpec) continue;
11403
+ if (annotations[name]?.fromSpec || isAnnotateDirective(name)) continue;
11114
11404
  if (!annotations[name]) annotations[name] = {
11115
11405
  multiple: false,
11116
11406
  fromSpec: false,
@@ -11459,4 +11749,4 @@ let tmpSeq = 0;
11459
11749
  }
11460
11750
 
11461
11751
  //#endregion
11462
- export { $n, AnnotationSpec, AtscriptDoc, AtscriptRepo, BACKTICK_ARG_VOCABULARY, BuildRepo, DB_ENTITY_ANNOTATIONS, DEFAULT_FORMAT, FLATTEN_WEB, MERGE_CAP, MERGE_TOO_COMPLEX, NAV_PROP_ANNOTATIONS, NOTHING_IN_COMMON, PRODUCT_CAP, PluginManager, SELF_OPERAND, SELF_SPLIT, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticExprBinaryNode, SemanticExprCallNode, SemanticExprNode, SemanticExprNumberNode, SemanticExprUnaryNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticOrderNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, StructureModel, Token, UNION_IN_RECURSIVE_MERGE, analyzeQueryCursorContext, andExprs, annotationExample, baseSlot, blockDependencies, blockTargetDocuments, build, clearResolveBareCache, componentOf, components, createAtscriptPlugin, defPosition, defineConfig, distinctFields, documentsEpoch, entryParts, fieldRefTokens, fileUriToPath, flatDefinitions, forEachAnnotationSpec, getDeclaredValue, getFieldPathCompletionScope, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, getSiblingAnnotation, getValueCandidates, hasMutatingAnnotates, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isAsView, isBacktickArgType, isBareId, isBareSpecifier, isConst, isDbEntityNode, isGroup, isImport, isInterface, isNull, isPhantomNode, isPhantomPath, isPhantomPrimitive, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, moduleId, nonNullishMembers, parseBareSpecifier, pastViews, recordDocumentReads, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveFieldRefAt, resolveFieldRefsAt, resolveQueryFieldRef, unshell, unwoundFields };
11752
+ export { $n, ANNOTATE_RESET, AnnotationSpec, AtscriptDoc, AtscriptRepo, BACKTICK_ARG_VOCABULARY, BuildRepo, DB_ENTITY_ANNOTATIONS, DEFAULT_FORMAT, FLATTEN_WEB, MERGE_CAP, MERGE_TOO_COMPLEX, NAV_PROP_ANNOTATIONS, NOTHING_IN_COMMON, OPAQUE_MERGE, PRODUCT_CAP, PluginManager, SELF_OPERAND, SELF_SPLIT, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticExprBinaryNode, SemanticExprCallNode, SemanticExprNode, SemanticExprNumberNode, SemanticExprUnaryNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticOrderNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, StructureModel, Token, UNION_IN_RECURSIVE_MERGE, analyzeQueryCursorContext, andExprs, annotatedValueKinds, annotationExample, baseSlot, blockDependencies, blockTargetDocuments, build, clearResolveBareCache, componentOf, components, createAtscriptPlugin, defPosition, defineConfig, distinctFields, documentsEpoch, entryParts, fieldRefTokens, fileUriToPath, flatDefinitions, forEachAnnotationSpec, getDeclaredValue, getFieldPathCompletionScope, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, getSiblingAnnotation, getValueCandidates, hasMutatingAnnotates, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isAsView, isBacktickArgType, isBareId, isBareSpecifier, isConst, isDbEntityNode, isGroup, isImport, isInterface, isNull, isPhantomNode, isPhantomPath, isPhantomPrimitive, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, moduleId, nonNullishMembers, parseBareSpecifier, pastViews, recordDocumentReads, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveFieldRefAt, resolveFieldRefsAt, resolveQueryFieldRef, unshell, unwoundFields, userTextAnnotations, userTextFields, withoutAsExtension };