@bjornpagen/bumbledb 0.1.0 → 0.2.0

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 (103) hide show
  1. package/COOKBOOK.md +1394 -0
  2. package/README.md +4 -0
  3. package/dist/closed.d.ts +60 -37
  4. package/dist/closed.d.ts.map +1 -1
  5. package/dist/closed.js +159 -40
  6. package/dist/closed.js.map +1 -1
  7. package/dist/count.d.ts +64 -17
  8. package/dist/count.d.ts.map +1 -1
  9. package/dist/count.js +37 -14
  10. package/dist/count.js.map +1 -1
  11. package/dist/db.d.ts +15 -7
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +13 -5
  14. package/dist/db.js.map +1 -1
  15. package/dist/exhume.d.ts +12 -11
  16. package/dist/exhume.d.ts.map +1 -1
  17. package/dist/exhume.js +7 -6
  18. package/dist/exhume.js.map +1 -1
  19. package/dist/face.d.ts +79 -19
  20. package/dist/face.d.ts.map +1 -1
  21. package/dist/face.js +14 -15
  22. package/dist/face.js.map +1 -1
  23. package/dist/fields.d.ts +158 -129
  24. package/dist/fields.d.ts.map +1 -1
  25. package/dist/fields.js +80 -81
  26. package/dist/fields.js.map +1 -1
  27. package/dist/index.d.ts +21 -21
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +13 -12
  30. package/dist/index.js.map +1 -1
  31. package/dist/lower.d.ts +6 -3
  32. package/dist/lower.d.ts.map +1 -1
  33. package/dist/lower.js +48 -17
  34. package/dist/lower.js.map +1 -1
  35. package/dist/marshal.d.ts +36 -21
  36. package/dist/marshal.d.ts.map +1 -1
  37. package/dist/marshal.js +41 -25
  38. package/dist/marshal.js.map +1 -1
  39. package/dist/native.js +2 -2
  40. package/dist/query/atom.d.ts +332 -174
  41. package/dist/query/atom.d.ts.map +1 -1
  42. package/dist/query/atom.js +72 -172
  43. package/dist/query/atom.js.map +1 -1
  44. package/dist/query/lower.d.ts +295 -107
  45. package/dist/query/lower.d.ts.map +1 -1
  46. package/dist/query/lower.js +860 -388
  47. package/dist/query/lower.js.map +1 -1
  48. package/dist/query/predicate.d.ts +69 -88
  49. package/dist/query/predicate.d.ts.map +1 -1
  50. package/dist/query/predicate.js +118 -72
  51. package/dist/query/predicate.js.map +1 -1
  52. package/dist/query/run.d.ts +19 -16
  53. package/dist/query/run.d.ts.map +1 -1
  54. package/dist/query/run.js +31 -24
  55. package/dist/query/run.js.map +1 -1
  56. package/dist/query/scope.d.ts +139 -123
  57. package/dist/query/scope.d.ts.map +1 -1
  58. package/dist/query/scope.js +71 -115
  59. package/dist/query/scope.js.map +1 -1
  60. package/dist/query/select.d.ts +102 -80
  61. package/dist/query/select.d.ts.map +1 -1
  62. package/dist/query/select.js +39 -34
  63. package/dist/query/select.js.map +1 -1
  64. package/dist/relation.d.ts +33 -36
  65. package/dist/relation.d.ts.map +1 -1
  66. package/dist/relation.js +15 -16
  67. package/dist/relation.js.map +1 -1
  68. package/dist/schema.d.ts.map +1 -1
  69. package/dist/schema.js +19 -8
  70. package/dist/schema.js.map +1 -1
  71. package/dist/spec.d.ts +6 -5
  72. package/dist/spec.d.ts.map +1 -1
  73. package/dist/spec.js.map +1 -1
  74. package/dist/statements.d.ts +56 -31
  75. package/dist/statements.d.ts.map +1 -1
  76. package/dist/statements.js +38 -13
  77. package/dist/statements.js.map +1 -1
  78. package/package.json +4 -3
  79. package/src/closed.ts +271 -93
  80. package/src/count.ts +112 -18
  81. package/src/db.ts +22 -12
  82. package/src/exhume.ts +12 -11
  83. package/src/face.ts +114 -22
  84. package/src/fields.ts +261 -217
  85. package/src/index.ts +50 -59
  86. package/src/lower.ts +62 -20
  87. package/src/marshal.ts +48 -30
  88. package/src/native.ts +2 -2
  89. package/src/query/atom.ts +480 -376
  90. package/src/query/lower.ts +1341 -542
  91. package/src/query/predicate.ts +198 -161
  92. package/src/query/run.ts +35 -25
  93. package/src/query/scope.ts +188 -218
  94. package/src/query/select.ts +168 -93
  95. package/src/relation.ts +38 -44
  96. package/src/schema.ts +22 -12
  97. package/src/spec.ts +6 -5
  98. package/src/statements.ts +69 -26
  99. package/dist/brand.d.ts +0 -59
  100. package/dist/brand.d.ts.map +0 -1
  101. package/dist/brand.js +0 -47
  102. package/dist/brand.js.map +0 -1
  103. package/src/brand.ts +0 -82
package/dist/marshal.d.ts CHANGED
@@ -1,21 +1,33 @@
1
1
  /**
2
- * The marshal layer (PRD-07): fact object ⇄ positional `FactValue[]` by
3
- * field ordinal, schema-directed, in ONE place only. The write side lowers
4
- * named host objects to rows in the relation's field-declaration order
2
+ * The marshal layer: fact object ⇄ positional `FactValue[]` by field
3
+ * ordinal, schema-directed, in ONE place only. The write side lowers named
4
+ * host objects to rows in the relation's field-declaration order
5
5
  * (declaration order = ordinal ids, the macro's law); the read side decodes
6
- * rows back to named objects with brands applied by assertion — the store
7
- * is the proof carrier: a row the engine admitted IS a legal fact of its
8
- * relation, so readback asserts the brand instead of re-judging the value
9
- * (the same trust direction as Rust's typed readback). Shape mismatches
10
- * here are genuine failures and THROW typed; they are never domain data.
6
+ * rows back to named objects of BARE structural values — the marshal
7
+ * boundary is pure both ways. CAST-FREE, LITERALLY: with structural values
8
+ * there is no brand to assert on the way out (the historical "one
9
+ * sanctioned marshal cast" died with the brand era), so product code
10
+ * carries zero casts the only trusted seams are the completeness
11
+ * PREDICATES below, which verify the checkable half (every declared field
12
+ * present) and rely on the store as the proof carrier for the rest: a row
13
+ * the engine admitted IS a legal fact of its relation (the same trust
14
+ * direction as Rust's typed readback). Shape mismatches here are genuine
15
+ * failures and THROW typed; they are never domain data.
11
16
  */
12
- import type { FieldData } from "#fields.ts";
17
+ import type { AnyField } from "#fields.ts";
13
18
  import type { FactValue } from "#native.ts";
14
19
  import type { AnyRelation, Fact, FreshKeys, RelationData } from "#relation.ts";
20
+ /**
21
+ * The fresh-mark probe: `true` exactly for a `.fresh`-marked u64 descriptor
22
+ * (the S1 kernel's one structural mark — an unmarked u64's `fresh` property
23
+ * holds the MARKED descriptor, so the probe compares against the literal
24
+ * `true`, never truthiness).
25
+ */
26
+ declare function isFreshField(field: AnyField): boolean;
15
27
  /**
16
28
  * The inferred object type `tx.insert` returns: one property per
17
- * fresh-marked field of `R`, carrying the minted (or resupplied) branded
18
- * id. A relation with no fresh field returns the empty object.
29
+ * fresh-marked field of `R`, carrying the minted (or resupplied) id as a
30
+ * bare `bigint`. A relation with no fresh field returns the empty object.
19
31
  */
20
32
  type Minted<R extends AnyRelation> = {
21
33
  [K in FreshKeys<R>]: Fact<R>[K];
@@ -28,7 +40,8 @@ type Minted<R extends AnyRelation> = {
28
40
  * relation's primary key is always its fresh field. When `R` carries a
29
41
  * fresh field the type demands exactly that field; otherwise the primary
30
42
  * key lives in the schema's statement list, which the type system cannot
31
- * see (statements are untyped values), so the type admits any partial fact
43
+ * see (the schema's statement list is not carried in the schema's type,
44
+ * only in the KeyStatement values themselves), so the type admits any partial fact
32
45
  * and the projection is verified at runtime — a missing key field throws
33
46
  * naming the projection.
34
47
  */
@@ -43,11 +56,12 @@ type KeyFact<R extends AnyRelation> = [FreshKeys<R>] extends [never] ? Partial<F
43
56
  declare function recordOf(fact: object): Record<string, unknown>;
44
57
  /**
45
58
  * Marshals one host cell at its field position to the natural wire value,
46
- * schema-directed by the field's structural type (never guessed). Brands
47
- * are phantoms, so the runtime values are exactly the wire's natural JS
48
- * values; only widths and domains are left to the engine's own judge.
59
+ * schema-directed by the field descriptor's structural kind (never
60
+ * guessed). Values are bare, so the runtime values ARE the wire's natural
61
+ * JS values; widths and domain labels are the engine's own judgment at the
62
+ * write boundary.
49
63
  */
50
- declare function cellOf(context: string, field: FieldData, value: unknown): FactValue;
64
+ declare function cellOf(context: string, field: AnyField, value: unknown): FactValue;
51
65
  /**
52
66
  * Marshals one complete fact object to its positional row, in field
53
67
  * declaration order (= ordinal ids). Every declared field must be present;
@@ -65,15 +79,16 @@ declare function keyRowOf(relation: RelationData, projection: readonly string[],
65
79
  /**
66
80
  * The insert-return trusted seam: the collected fresh cells of one insert
67
81
  * (minted by the engine or resupplied by the caller) are the relation's
68
- * branded fresh ids — same assertion direction as {@link isBrandedFact}.
82
+ * fresh ids as bare bigints — same presence-only direction as
83
+ * {@link isCompleteFact}.
69
84
  */
70
85
  declare function isMintedFresh<R extends AnyRelation>(relation: R, minted: Readonly<Record<string, FactValue>>): minted is Readonly<Record<string, FactValue>> & Minted<R>;
71
86
  /**
72
- * Unmarshals one positional row to the relation's named, branded, frozen
73
- * fact object — the inverse of {@link rowOf}, ordinal-directed by the same
74
- * declaration order.
87
+ * Unmarshals one positional row to the relation's named, frozen fact object
88
+ * of bare structural values — the inverse of {@link rowOf},
89
+ * ordinal-directed by the same declaration order.
75
90
  */
76
91
  declare function factOf<R extends AnyRelation>(relation: R, row: readonly FactValue[]): Fact<R>;
77
92
  export type { KeyFact, Minted };
78
- export { cellOf, factOf, isMintedFresh, keyRowOf, recordOf, rowOf };
93
+ export { cellOf, factOf, isFreshField, isMintedFresh, keyRowOf, recordOf, rowOf };
79
94
  //# sourceMappingURL=marshal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["../src/marshal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE9E;;;;GAIG;AACH,KAAK,MAAM,CAAC,CAAC,SAAS,WAAW,IAAI;KAAG,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAExE;;;;;;;;;;;GAWG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CA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YAAY,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EAAE,CAQ3F;AAED;;;;;GAKG;AACH,iBAAS,QAAQ,CAChB,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACpC,SAAS,EAAE,CAgBb;AAiBD;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,CAAC,SAAS,WAAW,EAC3C,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GACzC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAI3D;AAED;;;;GAIG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAoBtF;AAED,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
package/dist/marshal.js CHANGED
@@ -1,15 +1,29 @@
1
1
  /**
2
- * The marshal layer (PRD-07): fact object ⇄ positional `FactValue[]` by
3
- * field ordinal, schema-directed, in ONE place only. The write side lowers
4
- * named host objects to rows in the relation's field-declaration order
2
+ * The marshal layer: fact object ⇄ positional `FactValue[]` by field
3
+ * ordinal, schema-directed, in ONE place only. The write side lowers named
4
+ * host objects to rows in the relation's field-declaration order
5
5
  * (declaration order = ordinal ids, the macro's law); the read side decodes
6
- * rows back to named objects with brands applied by assertion — the store
7
- * is the proof carrier: a row the engine admitted IS a legal fact of its
8
- * relation, so readback asserts the brand instead of re-judging the value
9
- * (the same trust direction as Rust's typed readback). Shape mismatches
10
- * here are genuine failures and THROW typed; they are never domain data.
6
+ * rows back to named objects of BARE structural values — the marshal
7
+ * boundary is pure both ways. CAST-FREE, LITERALLY: with structural values
8
+ * there is no brand to assert on the way out (the historical "one
9
+ * sanctioned marshal cast" died with the brand era), so product code
10
+ * carries zero casts the only trusted seams are the completeness
11
+ * PREDICATES below, which verify the checkable half (every declared field
12
+ * present) and rely on the store as the proof carrier for the rest: a row
13
+ * the engine admitted IS a legal fact of its relation (the same trust
14
+ * direction as Rust's typed readback). Shape mismatches here are genuine
15
+ * failures and THROW typed; they are never domain data.
11
16
  */
12
17
  import * as errors from "@superbuilders/errors";
18
+ /**
19
+ * The fresh-mark probe: `true` exactly for a `.fresh`-marked u64 descriptor
20
+ * (the S1 kernel's one structural mark — an unmarked u64's `fresh` property
21
+ * holds the MARKED descriptor, so the probe compares against the literal
22
+ * `true`, never truthiness).
23
+ */
24
+ function isFreshField(field) {
25
+ return "fresh" in field && field.fresh === true;
26
+ }
13
27
  /** The typed shape refusal of the row marshaler — a genuine failure, never data. */
14
28
  function cellShapeError(context, expected, value) {
15
29
  return errors.new(`${context}: expected ${expected}, got ${typeof value}`);
@@ -33,12 +47,13 @@ function recordOf(fact) {
33
47
  }
34
48
  /**
35
49
  * Marshals one host cell at its field position to the natural wire value,
36
- * schema-directed by the field's structural type (never guessed). Brands
37
- * are phantoms, so the runtime values are exactly the wire's natural JS
38
- * values; only widths and domains are left to the engine's own judge.
50
+ * schema-directed by the field descriptor's structural kind (never
51
+ * guessed). Values are bare, so the runtime values ARE the wire's natural
52
+ * JS values; widths and domain labels are the engine's own judgment at the
53
+ * write boundary.
39
54
  */
40
55
  function cellOf(context, field, value) {
41
- switch (field.type.kind) {
56
+ switch (field.kind) {
42
57
  case "bool": {
43
58
  if (typeof value !== "boolean") {
44
59
  throw cellShapeError(context, "boolean", value);
@@ -52,7 +67,7 @@ function cellOf(context, field, value) {
52
67
  }
53
68
  return value;
54
69
  }
55
- case "string": {
70
+ case "str": {
56
71
  if (typeof value !== "string") {
57
72
  throw cellShapeError(context, "string", value);
58
73
  }
@@ -68,7 +83,7 @@ function cellOf(context, field, value) {
68
83
  }
69
84
  return value;
70
85
  }
71
- case "fixedBytes": {
86
+ case "bytes": {
72
87
  if (!(value instanceof Uint8Array)) {
73
88
  throw cellShapeError(context, "Uint8Array", value);
74
89
  }
@@ -120,11 +135,11 @@ function keyRowOf(relation, projection, key) {
120
135
  }
121
136
  /**
122
137
  * The read-side trusted seam: a decoded row carrying every declared field
123
- * IS a fact of its relation — the engine admitted it, so the brand is
124
- * asserted, not re-derived. The checkable half (completeness) is verified;
125
- * the phantom half (brands) is carried by the store's own judgment.
138
+ * IS a fact of its relation — the engine admitted the row, and the values
139
+ * are BARE structural values, so nothing is asserted beyond presence (no
140
+ * brand exists to re-derive; the store is the proof carrier).
126
141
  */
127
- function isBrandedFact(relation, decoded) {
142
+ function isCompleteFact(relation, decoded) {
128
143
  return relation.data.fields.every(function present(declared) {
129
144
  return decoded[declared.name] !== undefined;
130
145
  });
@@ -132,17 +147,18 @@ function isBrandedFact(relation, decoded) {
132
147
  /**
133
148
  * The insert-return trusted seam: the collected fresh cells of one insert
134
149
  * (minted by the engine or resupplied by the caller) are the relation's
135
- * branded fresh ids — same assertion direction as {@link isBrandedFact}.
150
+ * fresh ids as bare bigints — same presence-only direction as
151
+ * {@link isCompleteFact}.
136
152
  */
137
153
  function isMintedFresh(relation, minted) {
138
154
  return relation.data.fields.every(function presentWhenFresh(declared) {
139
- return !declared.field.minted || minted[declared.name] !== undefined;
155
+ return !isFreshField(declared.field) || minted[declared.name] !== undefined;
140
156
  });
141
157
  }
142
158
  /**
143
- * Unmarshals one positional row to the relation's named, branded, frozen
144
- * fact object — the inverse of {@link rowOf}, ordinal-directed by the same
145
- * declaration order.
159
+ * Unmarshals one positional row to the relation's named, frozen fact object
160
+ * of bare structural values — the inverse of {@link rowOf},
161
+ * ordinal-directed by the same declaration order.
146
162
  */
147
163
  function factOf(relation, row) {
148
164
  const data = relation.data;
@@ -158,10 +174,10 @@ function factOf(relation, row) {
158
174
  decoded[declared.name] = cell;
159
175
  });
160
176
  Object.freeze(decoded);
161
- if (!isBrandedFact(relation, decoded)) {
177
+ if (!isCompleteFact(relation, decoded)) {
162
178
  throw errors.new(`relation ${data.name}: decoded row is not a complete fact`);
163
179
  }
164
180
  return decoded;
165
181
  }
166
- export { cellOf, factOf, isMintedFresh, keyRowOf, recordOf, rowOf };
182
+ export { cellOf, factOf, isFreshField, isMintedFresh, keyRowOf, recordOf, rowOf };
167
183
  //# sourceMappingURL=marshal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"marshal.js","sourceRoot":"","sources":["../src/marshal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AA4B/C,oFAAoF;AACpF,SAAS,cAAc,CAAC,OAAe,EAAE,QAAgB,EAAE,KAAc;IACxE,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,cAAc,QAAQ,SAAS,OAAO,KAAK,EAAE,CAAC,CAAA;AAC3E,CAAC;AAED,sEAAsE;AACtE,SAAS,cAAc,CAAC,KAAc;IACrC,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;QAChB,KAAK,IAAI,KAAK;QACd,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAC7B,CAAA;AACF,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,IAAY;IAC7B,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,SAAS,MAAM,CAAC,OAAe,E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,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,MAAM,CAAC,GAAG,CACf,YAAY,IAAI,CAAC,IAAI,eAAe,GAAG,CAAC,MAAM,uBAAuB,IAAI,CAAC,MAAM,CAAC,MAAM,kBAAkB,CACzG,CAAA;IACF,CAAC;IACD,MAAM,OAAO,GAA8B,EAAE,CAAA;IAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,UAAU,CAAC,QAAQ,EAAE,OAAO;QACxD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,CAAA;QACzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,cAAc,OAAO,KAAK,QAAQ,CAAC,IAAI,aAAa,CAAC,CAAA;QAC5F,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC9B,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACtB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,IAAI,sCAAsC,CAAC,CAAA;IAC9E,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC;AAGD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA"}
package/dist/native.js CHANGED
@@ -15,8 +15,8 @@ const SHIPPED_PLATFORMS = "darwin-arm64";
15
15
  * It resolves the per-platform binary package by name (see
16
16
  * {@link loadNativeBinding}); the addon never crosses as a relative path.
17
17
  * createRequire is the only unflagged Node-API addon loader in ESM, and this
18
- * file is the package's single sanctioned FFI boundary
19
- * (docs/road-to-1.0.0/prd-03-arch-split-packaging.md).
18
+ * file is the package's single sanctioned FFI boundary (the arch-split
19
+ * packaging ruling).
20
20
  */
21
21
  const requireNative = createRequire(import.meta.url);
22
22
  /**