@maroonedog/luq 2.1.0 → 2.3.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 (161) hide show
  1. package/README.md +92 -430
  2. package/dist/builder/builder-surface.types.d.ts +1 -0
  3. package/dist/builder/compile-declarations.d.ts +7 -1
  4. package/dist/builder/compile-declarations.js +18 -8
  5. package/dist/builder/compile-declarations.mjs +18 -8
  6. package/dist/builder/create-builder.js +8 -0
  7. package/dist/builder/create-builder.mjs +8 -0
  8. package/dist/builder/create-field-builder.js +13 -1
  9. package/dist/builder/create-field-builder.mjs +13 -1
  10. package/dist/builder/declared-calls-store.d.ts +9 -0
  11. package/dist/builder/declared-calls-store.js +19 -0
  12. package/dist/builder/declared-calls-store.mjs +15 -0
  13. package/dist/builder/field-builder.types.d.ts +13 -0
  14. package/dist/builder/field-declared-calls.types.d.ts +6 -0
  15. package/dist/builder/field-declared-calls.types.js +2 -0
  16. package/dist/builder/field-declared-calls.types.mjs +1 -0
  17. package/dist/builder/field-entry.types.d.ts +9 -3
  18. package/dist/builder/field-options.types.d.ts +26 -0
  19. package/dist/chain/bundle-paths.types.d.ts +23 -0
  20. package/dist/chain/bundle-paths.types.js +2 -0
  21. package/dist/chain/bundle-paths.types.mjs +1 -0
  22. package/dist/chain/chain-method.types.d.ts +8 -3
  23. package/dist/chain/chain-node-store.d.ts +5 -0
  24. package/dist/chain/chain-node-store.js +15 -0
  25. package/dist/chain/chain-node-store.mjs +11 -0
  26. package/dist/chain/collect-field-rules.d.ts +13 -2
  27. package/dist/chain/collect-field-rules.js +10 -3
  28. package/dist/chain/collect-field-rules.mjs +10 -3
  29. package/dist/chain/create-chain-node.js +19 -9
  30. package/dist/chain/create-chain-node.mjs +19 -9
  31. package/dist/chain/declaration-recorder.port.d.ts +31 -0
  32. package/dist/chain/declaration-recorder.port.js +17 -0
  33. package/dist/chain/declaration-recorder.port.mjs +13 -0
  34. package/dist/chain/declared-call.types.d.ts +15 -0
  35. package/dist/chain/declared-call.types.js +2 -0
  36. package/dist/chain/declared-call.types.mjs +1 -0
  37. package/dist/chain/index.d.ts +3 -1
  38. package/dist/chain/resolve-args.types.d.ts +4 -2
  39. package/dist/compile/compile-array-node.d.ts +0 -7
  40. package/dist/compile/compile-array-node.js +5 -0
  41. package/dist/compile/compile-array-node.mjs +5 -0
  42. package/dist/compile/compile-field.d.ts +1 -0
  43. package/dist/compile/compile-field.js +13 -2
  44. package/dist/compile/compile-field.mjs +13 -2
  45. package/dist/compile/compile-schema.js +4 -0
  46. package/dist/compile/compile-schema.mjs +4 -0
  47. package/dist/compile/group-array-fields.d.ts +1 -0
  48. package/dist/compile/split-rules-by-kind.js +27 -7
  49. package/dist/compile/split-rules-by-kind.mjs +27 -7
  50. package/dist/compile/validation-plan.types.d.ts +36 -0
  51. package/dist/core/type-erasure.d.ts +36 -30
  52. package/dist/core/type-erasure.js +36 -30
  53. package/dist/core/type-erasure.mjs +36 -30
  54. package/dist/json-schema/build-from-schema.js +8 -1
  55. package/dist/json-schema/build-from-schema.mjs +8 -1
  56. package/dist/json-schema/declare-additional-properties.d.ts +7 -7
  57. package/dist/json-schema/declare-additional-properties.js +7 -7
  58. package/dist/json-schema/declare-additional-properties.mjs +7 -7
  59. package/dist/json-schema/declare-object-keywords.js +4 -4
  60. package/dist/json-schema/declare-object-keywords.mjs +4 -4
  61. package/dist/json-schema/flatten-schema.js +1 -1
  62. package/dist/json-schema/flatten-schema.mjs +1 -1
  63. package/dist/json-schema/follow-json-pointer.d.ts +7 -6
  64. package/dist/json-schema/follow-json-pointer.js +24 -24
  65. package/dist/json-schema/follow-json-pointer.mjs +24 -24
  66. package/dist/json-schema/ref-resolution-error.js +3 -3
  67. package/dist/json-schema/ref-resolution-error.mjs +3 -3
  68. package/dist/json-schema/schema-registry.js +12 -11
  69. package/dist/json-schema/schema-registry.mjs +12 -11
  70. package/dist/json-schema/uri-reference.js +12 -12
  71. package/dist/json-schema/uri-reference.mjs +12 -12
  72. package/dist/path/create-value-writer.js +12 -12
  73. package/dist/path/create-value-writer.mjs +12 -12
  74. package/dist/path/reserved-segment.d.ts +16 -16
  75. package/dist/path/reserved-segment.js +17 -21
  76. package/dist/path/reserved-segment.mjs +17 -21
  77. package/dist/plugin-kit/marker.types.d.ts +18 -0
  78. package/dist/plugins/index.generated.d.ts +1 -0
  79. package/dist/plugins/index.generated.js +6 -4
  80. package/dist/plugins/index.generated.mjs +3 -2
  81. package/dist/plugins/manifest.generated.js +3 -2
  82. package/dist/plugins/manifest.generated.mjs +3 -2
  83. package/dist/plugins/object-additional-properties/select-additional-keys.d.ts +8 -8
  84. package/dist/plugins/object-additional-properties/select-additional-keys.js +16 -16
  85. package/dist/plugins/object-additional-properties/select-additional-keys.mjs +16 -16
  86. package/dist/plugins/stitch/stitch.d.ts +24 -8
  87. package/dist/plugins/stitch-with/index.d.ts +2 -0
  88. package/dist/plugins/stitch-with/index.js +5 -0
  89. package/dist/plugins/stitch-with/index.mjs +1 -0
  90. package/dist/plugins/stitch-with/stitch-with.d.ts +12 -0
  91. package/dist/plugins/stitch-with/stitch-with.js +92 -0
  92. package/dist/plugins/stitch-with/stitch-with.mjs +89 -0
  93. package/dist/plugins/stitchWith.d.ts +1 -0
  94. package/dist/plugins/stitchWith.js +2 -0
  95. package/dist/plugins/stitchWith.mjs +1 -0
  96. package/dist/plugins/string-min/string-min.js +19 -3
  97. package/dist/plugins/string-min/string-min.mjs +20 -4
  98. package/dist/presets/index.d.ts +1 -0
  99. package/dist/presets/index.js +9 -0
  100. package/dist/presets/index.mjs +1 -0
  101. package/dist/presets/presets.d.ts +164 -0
  102. package/dist/presets/presets.js +79 -0
  103. package/dist/presets/presets.mjs +76 -0
  104. package/dist/runtime/create-field-validator.js +22 -8
  105. package/dist/runtime/create-field-validator.mjs +22 -8
  106. package/dist/runtime/create-validator.js +38 -8
  107. package/dist/runtime/create-validator.mjs +38 -8
  108. package/dist/runtime/field-rule-context.d.ts +32 -0
  109. package/dist/runtime/field-rule-context.js +48 -0
  110. package/dist/runtime/field-rule-context.mjs +44 -0
  111. package/dist/runtime/index-stack.d.ts +29 -4
  112. package/dist/runtime/index-stack.js +76 -15
  113. package/dist/runtime/index-stack.mjs +76 -15
  114. package/dist/runtime/output-writer.js +5 -1
  115. package/dist/runtime/output-writer.mjs +5 -1
  116. package/dist/runtime/run-array-node.js +22 -10
  117. package/dist/runtime/run-array-node.mjs +22 -10
  118. package/dist/runtime/run-field.js +47 -18
  119. package/dist/runtime/run-field.mjs +47 -18
  120. package/dist/runtime/run-plan.js +5 -1
  121. package/dist/runtime/run-plan.mjs +5 -1
  122. package/dist/standard-schema/assemble-json-schema.d.ts +4 -0
  123. package/dist/standard-schema/assemble-json-schema.js +95 -0
  124. package/dist/standard-schema/assemble-json-schema.mjs +92 -0
  125. package/dist/standard-schema/declaration-recorder.d.ts +6 -0
  126. package/dist/standard-schema/declaration-recorder.js +30 -0
  127. package/dist/standard-schema/declaration-recorder.mjs +27 -0
  128. package/dist/standard-schema/declarations-unavailable-error.d.ts +4 -0
  129. package/dist/standard-schema/declarations-unavailable-error.js +32 -0
  130. package/dist/standard-schema/declarations-unavailable-error.mjs +28 -0
  131. package/dist/standard-schema/emit-field-schema.d.ts +9 -0
  132. package/dist/standard-schema/emit-field-schema.js +68 -0
  133. package/dist/standard-schema/emit-field-schema.mjs +65 -0
  134. package/dist/standard-schema/index.d.ts +5 -0
  135. package/dist/standard-schema/index.js +9 -1
  136. package/dist/standard-schema/index.mjs +4 -0
  137. package/dist/standard-schema/json-schema-target.d.ts +6 -0
  138. package/dist/standard-schema/json-schema-target.js +44 -0
  139. package/dist/standard-schema/json-schema-target.mjs +39 -0
  140. package/dist/standard-schema/plugin-keyword-map.d.ts +3 -0
  141. package/dist/standard-schema/plugin-keyword-map.js +93 -0
  142. package/dist/standard-schema/plugin-keyword-map.mjs +90 -0
  143. package/dist/standard-schema/split-issue-path.d.ts +6 -4
  144. package/dist/standard-schema/split-issue-path.js +15 -13
  145. package/dist/standard-schema/split-issue-path.mjs +15 -13
  146. package/dist/standard-schema/standard-schema.types.d.ts +8 -7
  147. package/dist/standard-schema/standard-schema.types.js +6 -6
  148. package/dist/standard-schema/standard-schema.types.mjs +6 -6
  149. package/dist/standard-schema/to-standard-json-schema.d.ts +19 -0
  150. package/dist/standard-schema/to-standard-json-schema.js +36 -0
  151. package/dist/standard-schema/to-standard-json-schema.mjs +33 -0
  152. package/dist/standard-schema/to-standard-schema.d.ts +16 -15
  153. package/dist/standard-schema/to-standard-schema.js +15 -22
  154. package/dist/standard-schema/to-standard-schema.mjs +15 -22
  155. package/dist/standard-schema/unrepresentable-rule-error.d.ts +15 -0
  156. package/dist/standard-schema/unrepresentable-rule-error.js +43 -0
  157. package/dist/standard-schema/unrepresentable-rule-error.mjs +38 -0
  158. package/dist/types/index.d.ts +19 -7
  159. package/dist/types/index.js +7 -7
  160. package/dist/types/index.mjs +7 -7
  161. package/package.json +35 -19
@@ -1,19 +1,19 @@
1
1
  // ===========================================================================
2
- // L8 src/json-schema/uri-reference.ts — `$id` `$ref` の URI 演算。
2
+ // L8 src/json-schema/uri-reference.ts — the URI arithmetic of `$id`/`$ref`.
3
3
  //
4
- // Draft-07 §8.2 `$id` はベース URI を立て、`$ref` はその上で解決される。
5
- // つまり `$ref` は「文書内のポインタ」ではなく **URI 参照** であり、
6
- // 同じ文字列でも、どの `$id` の下に書かれたかで別の場所を指す。
4
+ // Draft-07 §8.2 makes `$id` establish a base URI that `$ref` resolves
5
+ // against. A `$ref` is therefore a **URI reference** and not a pointer within
6
+ // a document: the same string points somewhere else depending on which `$id`
7
+ // it was written under.
7
8
  //
8
- // 解決は WHATWG URL に任せる。RFC 3986 §5.3 を手で書き直しても、
9
- // パーセント符号化・ドットセグメント・スキーム相対 (`//host/x`) の三つで
10
- // 必ずずれるそして URL はブラウザにも Node にもある標準グローバルで、
11
- // eval new Function も使わない (check:no-dynamic-code が見ている)。
9
+ // Resolution is delegated to the WHATWG URL. Rewriting RFC 3986 §5.3 by hand
10
+ // goes wrong on percent-encoding, dot segments and scheme-relative
11
+ // (`//host/x`) every time and URL is a standard global in both browsers and
12
+ // Node, needing neither eval nor new Function.
12
13
  //
13
- // ネットワークには**触れない**。ここにあるのは文字列演算だけで、
14
- // 解決した URI をどう手に入れるかは呼び出し側の責任である
15
- // (schema-registry.ts externalDocuments)。スキーマが書いた URI
16
- // このプロセスがソケットを開くことは無い。
14
+ // **Nothing here touches the network.** This is string arithmetic; how a
15
+ // resolved URI is actually obtained is the caller's responsibility. A URI
16
+ // written in a schema never causes this process to open a socket.
17
17
  // ===========================================================================
18
18
  export function splitUri(uri) {
19
19
  const hash = uri.indexOf("#");
@@ -36,19 +36,19 @@ function writeInto(container, keys, depth, value) {
36
36
  * numeric key here is a Record key.
37
37
  */
38
38
  /**
39
- * キーを own プロパティとして置く。**代入演算子を使わない。**
39
+ * Places a key as an own property. **Never with the assignment operator.**
40
40
  *
41
- * `copy[key] = value` key が "__proto__" のとき Object.prototype
42
- * アクセサ (setter) を呼び、own プロパティを作る代わりにプロトタイプを
43
- * 差し替えてしまう。defineProperty はアクセサを見ずに own プロパティを
44
- * 定義するので、"__proto__" という名前のプロパティを安全に持てる。
41
+ * `copy[key] = value` on "__proto__" invokes the accessor on
42
+ * Object.prototype: instead of creating an own property it swaps the
43
+ * prototype. defineProperty ignores accessors and defines the own property, so
44
+ * a property actually named "__proto__" can be held safely.
45
45
  *
46
- * "constructor" "prototype" Object.prototype 上でデータプロパティ
47
- * なので代入でも own プロパティになるが、キーごとに分岐すると分岐のほうを
48
- * 間違えるので一律にこちらを通す。
46
+ * "constructor" and "prototype" are data properties, so assignment would only
47
+ * make own properties of them — but branching per key is how the branch gets
48
+ * written wrong, so everything goes through this one path.
49
49
  *
50
- * これが「宣言パスに __proto__ を書けるようにする」の前提。書き込みが安全に
51
- * なったので、パス文法の側で拒否する必要が無くなった (reserved-segment.ts)。
50
+ * This is what makes writing safe, and therefore what makes refusing these
51
+ * names in the path grammar unnecessary. See reserved-segment.ts.
52
52
  */
53
53
  function putOwnProperty(target, key, value) {
54
54
  Object.defineProperty(target, key, {
@@ -72,8 +72,8 @@ function copyWith(container, key, value) {
72
72
  copy[index] = value;
73
73
  return copy;
74
74
  }
75
- // スプレッドは own の列挙可能プロパティを CreateDataProperty で写すので、
76
- // ここでは setter は動かない。危ないのは下の代入だけ。
75
+ // Spread copies own enumerable properties with CreateDataProperty, so no
76
+ // setter runs here. Only assignment is dangerous.
77
77
  const copy = { ...container };
78
78
  putOwnProperty(copy, key, value);
79
79
  return copy;
@@ -33,19 +33,19 @@ function writeInto(container, keys, depth, value) {
33
33
  * numeric key here is a Record key.
34
34
  */
35
35
  /**
36
- * キーを own プロパティとして置く。**代入演算子を使わない。**
36
+ * Places a key as an own property. **Never with the assignment operator.**
37
37
  *
38
- * `copy[key] = value` key が "__proto__" のとき Object.prototype
39
- * アクセサ (setter) を呼び、own プロパティを作る代わりにプロトタイプを
40
- * 差し替えてしまう。defineProperty はアクセサを見ずに own プロパティを
41
- * 定義するので、"__proto__" という名前のプロパティを安全に持てる。
38
+ * `copy[key] = value` on "__proto__" invokes the accessor on
39
+ * Object.prototype: instead of creating an own property it swaps the
40
+ * prototype. defineProperty ignores accessors and defines the own property, so
41
+ * a property actually named "__proto__" can be held safely.
42
42
  *
43
- * "constructor" "prototype" Object.prototype 上でデータプロパティ
44
- * なので代入でも own プロパティになるが、キーごとに分岐すると分岐のほうを
45
- * 間違えるので一律にこちらを通す。
43
+ * "constructor" and "prototype" are data properties, so assignment would only
44
+ * make own properties of them — but branching per key is how the branch gets
45
+ * written wrong, so everything goes through this one path.
46
46
  *
47
- * これが「宣言パスに __proto__ を書けるようにする」の前提。書き込みが安全に
48
- * なったので、パス文法の側で拒否する必要が無くなった (reserved-segment.ts)。
47
+ * This is what makes writing safe, and therefore what makes refusing these
48
+ * names in the path grammar unnecessary. See reserved-segment.ts.
49
49
  */
50
50
  function putOwnProperty(target, key, value) {
51
51
  Object.defineProperty(target, key, {
@@ -69,8 +69,8 @@ function copyWith(container, key, value) {
69
69
  copy[index] = value;
70
70
  return copy;
71
71
  }
72
- // スプレッドは own の列挙可能プロパティを CreateDataProperty で写すので、
73
- // ここでは setter は動かない。危ないのは下の代入だけ。
72
+ // Spread copies own enumerable properties with CreateDataProperty, so no
73
+ // setter runs here. Only assignment is dangerous.
74
74
  const copy = { ...container };
75
75
  putOwnProperty(copy, key, value);
76
76
  return copy;
@@ -1,24 +1,24 @@
1
1
  /**
2
- * `Object.prototype` 上に同名のものがあるキー。
2
+ * Keys that share a name with something on `Object.prototype`.
3
3
  *
4
- * **これはもう拒否リストではない。** 以前はこの3つを宣言パスに書けなくして
5
- * いたが、その拒否は過剰だった。危険なのは書き込みだけで、しかも本当に危ない
6
- * のは "__proto__" ひとつである:
4
+ * **This is no longer a deny list.** Refusing these in a declared path was
5
+ * over-broad: only writing is dangerous, and of the three only "__proto__"
6
+ * really is.
7
7
  *
8
- * 読み取り create-value-reader.ts hasOwnProperty.call own プロパティ
9
- * しか読まないので、プロトタイプは最初から辿らない
10
- * 書き込み `target[key] = value` "__proto__" のとき Object.prototype
11
- * **アクセサ** を呼び、own プロパティを作らずプロトタイプを差し替える。
12
- * "constructor" "prototype" はデータプロパティなので代入でも
13
- * own プロパティになるだけで、汚染にはならない
8
+ * reading own properties only, checked with hasOwnProperty.call, so the
9
+ * prototype chain is never walked to begin with
10
+ * writing `target[key] = value` on "__proto__" invokes the ACCESSOR on
11
+ * Object.prototype: it creates no own property and swaps the
12
+ * prototype instead. "constructor" and "prototype" are data
13
+ * properties, so assigning them only makes an own property and
14
+ * pollutes nothing
14
15
  *
15
- * create-value-writer.ts が代入をやめて defineProperty に移したことで、
16
- * この経路が閉じた。したがって名前で拒否する必要が無くなり、
17
- * `{ "properties": { "__proto__": ... } }` のようなスキーマを検証できる
18
- * ようになった (JSON-Schema-Test-Suite の properties.json が要求している)。
16
+ * Writing through defineProperty instead of assignment closes that route.
17
+ * Refusing by name became unnecessary, which is what allows a schema like
18
+ * `{ "properties": { "__proto__": ... } }` to be validated at all.
19
19
  *
20
- * リスト自体は残す。テストが「この3つを書いても Object.prototype が汚れない」
21
- * ことを名指しで確認するのに使う (test/unit/path/create-value-writer.test.ts)。
20
+ * The list stays. Tests use it to name the keys they check Object.prototype
21
+ * against.
22
22
  */
23
23
  export declare const RESERVED_SEGMENTS: readonly string[];
24
24
  /** Thrown at BUILD time for every malformed or unsafe path. A declared rule
@@ -14,26 +14,26 @@ exports.PathSyntaxError = exports.RESERVED_SEGMENTS = void 0;
14
14
  exports.isReservedSegment = isReservedSegment;
15
15
  exports.assertDeclarableKey = assertDeclarableKey;
16
16
  /**
17
- * `Object.prototype` 上に同名のものがあるキー。
17
+ * Keys that share a name with something on `Object.prototype`.
18
18
  *
19
- * **これはもう拒否リストではない。** 以前はこの3つを宣言パスに書けなくして
20
- * いたが、その拒否は過剰だった。危険なのは書き込みだけで、しかも本当に危ない
21
- * のは "__proto__" ひとつである:
19
+ * **This is no longer a deny list.** Refusing these in a declared path was
20
+ * over-broad: only writing is dangerous, and of the three only "__proto__"
21
+ * really is.
22
22
  *
23
- * 読み取り create-value-reader.ts hasOwnProperty.call own プロパティ
24
- * しか読まないので、プロトタイプは最初から辿らない
25
- * 書き込み `target[key] = value` "__proto__" のとき Object.prototype
26
- * **アクセサ** を呼び、own プロパティを作らずプロトタイプを差し替える。
27
- * "constructor" "prototype" はデータプロパティなので代入でも
28
- * own プロパティになるだけで、汚染にはならない
23
+ * reading own properties only, checked with hasOwnProperty.call, so the
24
+ * prototype chain is never walked to begin with
25
+ * writing `target[key] = value` on "__proto__" invokes the ACCESSOR on
26
+ * Object.prototype: it creates no own property and swaps the
27
+ * prototype instead. "constructor" and "prototype" are data
28
+ * properties, so assigning them only makes an own property and
29
+ * pollutes nothing
29
30
  *
30
- * create-value-writer.ts が代入をやめて defineProperty に移したことで、
31
- * この経路が閉じた。したがって名前で拒否する必要が無くなり、
32
- * `{ "properties": { "__proto__": ... } }` のようなスキーマを検証できる
33
- * ようになった (JSON-Schema-Test-Suite の properties.json が要求している)。
31
+ * Writing through defineProperty instead of assignment closes that route.
32
+ * Refusing by name became unnecessary, which is what allows a schema like
33
+ * `{ "properties": { "__proto__": ... } }` to be validated at all.
34
34
  *
35
- * リスト自体は残す。テストが「この3つを書いても Object.prototype が汚れない」
36
- * ことを名指しで確認するのに使う (test/unit/path/create-value-writer.test.ts)。
35
+ * The list stays. Tests use it to name the keys they check Object.prototype
36
+ * against.
37
37
  */
38
38
  exports.RESERVED_SEGMENTS = Object.freeze([
39
39
  "__proto__",
@@ -80,9 +80,5 @@ function assertDeclarableKey(key, source) {
80
80
  throw new PathSyntaxError(source, `the key ${JSON.stringify(key)} contains a bracket; "[*]" is the only ` +
81
81
  "bracket form and it must trail a key");
82
82
  }
83
- // 予約セグメントの拒否はここから外した。理由は RESERVED_SEGMENTS
84
- // コメントに書いてある。要約すると、危険なのは書き込みだけで、その書き込みは
85
- // create-value-writer.ts が defineProperty に移したので安全になった。
86
- // 名前で拒否する必要が無くなり、JSON Schema が "__proto__" というキーを
87
- // 持つオブジェクトを検証できるようになった。
83
+ // Reserved segments are deliberately NOT refused here. See RESERVED_SEGMENTS.
88
84
  }
@@ -9,26 +9,26 @@
9
9
  // dependent for no gain.
10
10
  // ===========================================================================
11
11
  /**
12
- * `Object.prototype` 上に同名のものがあるキー。
12
+ * Keys that share a name with something on `Object.prototype`.
13
13
  *
14
- * **これはもう拒否リストではない。** 以前はこの3つを宣言パスに書けなくして
15
- * いたが、その拒否は過剰だった。危険なのは書き込みだけで、しかも本当に危ない
16
- * のは "__proto__" ひとつである:
14
+ * **This is no longer a deny list.** Refusing these in a declared path was
15
+ * over-broad: only writing is dangerous, and of the three only "__proto__"
16
+ * really is.
17
17
  *
18
- * 読み取り create-value-reader.ts hasOwnProperty.call own プロパティ
19
- * しか読まないので、プロトタイプは最初から辿らない
20
- * 書き込み `target[key] = value` "__proto__" のとき Object.prototype
21
- * **アクセサ** を呼び、own プロパティを作らずプロトタイプを差し替える。
22
- * "constructor" "prototype" はデータプロパティなので代入でも
23
- * own プロパティになるだけで、汚染にはならない
18
+ * reading own properties only, checked with hasOwnProperty.call, so the
19
+ * prototype chain is never walked to begin with
20
+ * writing `target[key] = value` on "__proto__" invokes the ACCESSOR on
21
+ * Object.prototype: it creates no own property and swaps the
22
+ * prototype instead. "constructor" and "prototype" are data
23
+ * properties, so assigning them only makes an own property and
24
+ * pollutes nothing
24
25
  *
25
- * create-value-writer.ts が代入をやめて defineProperty に移したことで、
26
- * この経路が閉じた。したがって名前で拒否する必要が無くなり、
27
- * `{ "properties": { "__proto__": ... } }` のようなスキーマを検証できる
28
- * ようになった (JSON-Schema-Test-Suite の properties.json が要求している)。
26
+ * Writing through defineProperty instead of assignment closes that route.
27
+ * Refusing by name became unnecessary, which is what allows a schema like
28
+ * `{ "properties": { "__proto__": ... } }` to be validated at all.
29
29
  *
30
- * リスト自体は残す。テストが「この3つを書いても Object.prototype が汚れない」
31
- * ことを名指しで確認するのに使う (test/unit/path/create-value-writer.test.ts)。
30
+ * The list stays. Tests use it to name the keys they check Object.prototype
31
+ * against.
32
32
  */
33
33
  export const RESERVED_SEGMENTS = Object.freeze([
34
34
  "__proto__",
@@ -74,9 +74,5 @@ export function assertDeclarableKey(key, source) {
74
74
  throw new PathSyntaxError(source, `the key ${JSON.stringify(key)} contains a bracket; "[*]" is the only ` +
75
75
  "bracket form and it must trail a key");
76
76
  }
77
- // 予約セグメントの拒否はここから外した。理由は RESERVED_SEGMENTS
78
- // コメントに書いてある。要約すると、危険なのは書き込みだけで、その書き込みは
79
- // create-value-writer.ts が defineProperty に移したので安全になった。
80
- // 名前で拒否する必要が無くなり、JSON Schema が "__proto__" というキーを
81
- // 持つオブジェクトを検証できるようになった。
77
+ // Reserved segments are deliberately NOT refused here. See RESERVED_SEGMENTS.
82
78
  }
@@ -45,6 +45,22 @@ export interface TransformOut {
45
45
  export interface GuardOut {
46
46
  readonly [MARKER]: "guardOut";
47
47
  }
48
+ /**
49
+ * Like GuardOut, these exist so ChainMethod can give the method a call-site
50
+ * type parameter. ResolveArgs resolves each argument against a FIXED
51
+ * TRoot/TValue and cannot make argument 2 depend on argument 1, so a plugin
52
+ * whose second argument is typed by its first has to come through this door.
53
+ *
54
+ * `StitchOut` types the FIELD VALUES a cross-field predicate receives, from
55
+ * the paths named in argument 1. `BundleOut` types the SUBJECT of a sub-chain,
56
+ * from the alias-to-path map in argument 1.
57
+ */
58
+ export interface StitchOut {
59
+ readonly [MARKER]: "stitchOut";
60
+ }
61
+ export interface BundleOut {
62
+ readonly [MARKER]: "bundleOut";
63
+ }
48
64
  export type PresenceShiftKind = "excludeMissing" | "excludeUndefined" | "excludeNull" | "allowNull";
49
65
  export interface PresenceShift<K extends PresenceShiftKind> {
50
66
  readonly [MARKER]: "presence";
@@ -75,6 +91,8 @@ export interface OutputMarkerRegistry {
75
91
  readonly unchanged: Unchanged;
76
92
  readonly transformOut: TransformOut;
77
93
  readonly guardOut: GuardOut;
94
+ readonly stitchOut: StitchOut;
95
+ readonly bundleOut: BundleOut;
78
96
  readonly excludeMissing: PresenceShift<"excludeMissing">;
79
97
  readonly excludeUndefined: PresenceShift<"excludeUndefined">;
80
98
  readonly excludeNull: PresenceShift<"excludeNull">;
@@ -41,6 +41,7 @@ export { requiredPlugin } from "./required";
41
41
  export { requiredIfPlugin } from "./required-if";
42
42
  export { skipPlugin } from "./skip";
43
43
  export { stitchPlugin } from "./stitch";
44
+ export { stitchWithPlugin } from "./stitch-with";
44
45
  export { stringAlphanumericPlugin } from "./string-alphanumeric";
45
46
  export { stringBase64Plugin } from "./string-base64";
46
47
  export { stringContentEncodingPlugin } from "./string-content-encoding";
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- // GENERATED FILE - 手で編集しないでください。
3
- // 生成元: プラグインディレクトリ構造 (scripts/catalog/build-plugin-catalog.ts)。
2
+ // GENERATED FILE - do not edit by hand.
3
+ // Generated by scripts/catalog/build-plugin-catalog.ts out of the plugin directory structure.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.stringDurationPlugin = exports.stringDatetimePlugin = exports.stringDatePlugin = exports.stringContentMediaTypePlugin = exports.stringContentEncodingPlugin = exports.stringBase64Plugin = exports.stringAlphanumericPlugin = exports.stitchPlugin = exports.skipPlugin = exports.requiredIfPlugin = exports.requiredPlugin = exports.readOnlyPlugin = exports.orFailPlugin = exports.optionalIfPlugin = exports.optionalPlugin = exports.oneOfPlugin = exports.objectRecursivelyPlugin = exports.objectPropertyNamesPlugin = exports.objectPatternPropertiesPlugin = exports.objectMinPropertiesPlugin = exports.objectMaxPropertiesPlugin = exports.objectDependentSchemasPlugin = exports.objectDependentRequiredPlugin = exports.objectAdditionalPropertiesSchemaPlugin = exports.objectAdditionalPropertiesPlugin = exports.objectPlugin = exports.numberRangePlugin = exports.numberPositivePlugin = exports.numberNegativePlugin = exports.numberMultipleOfPlugin = exports.numberMinPlugin = exports.numberMaxPlugin = exports.numberIntegerPlugin = exports.numberFinitePlugin = exports.nullablePlugin = exports.literalPlugin = exports.jsonSchemaFullFeaturePlugin = exports.jsonSchemaPlugin = exports.fromContextPlugin = exports.customPlugin = exports.conditionalSchemaPlugin = exports.compareFieldPlugin = exports.booleanTruthyPlugin = exports.booleanFalsyPlugin = exports.arrayUniquePlugin = exports.arrayMinLengthPlugin = exports.arrayMaxLengthPlugin = exports.arrayIncludesPlugin = exports.arrayEachPlugin = exports.arrayContainsPlugin = void 0;
6
- exports.writeOnlyPlugin = exports.validateIfPlugin = exports.uuidPlugin = exports.unionGuardPlugin = exports.tupleBuilderPlugin = exports.transformPlugin = exports.stringUrlPlugin = exports.stringUriTemplatePlugin = exports.stringUriReferencePlugin = exports.stringTimePlugin = exports.stringStartsWithPlugin = exports.stringRelativeJsonPointerPlugin = exports.stringRegexPlugin = exports.stringPatternPlugin = exports.stringMinPlugin = exports.stringMaxPlugin = exports.stringJsonPointerPlugin = exports.stringIriReferencePlugin = exports.stringIriPlugin = exports.stringIpv6Plugin = exports.stringIpv4Plugin = exports.stringIdnHostnamePlugin = exports.stringIdnEmailPlugin = exports.stringHostnamePlugin = exports.stringExactLengthPlugin = exports.stringEndsWithPlugin = exports.stringEmailPlugin = void 0;
5
+ exports.stringDatetimePlugin = exports.stringDatePlugin = exports.stringContentMediaTypePlugin = exports.stringContentEncodingPlugin = exports.stringBase64Plugin = exports.stringAlphanumericPlugin = exports.stitchWithPlugin = exports.stitchPlugin = exports.skipPlugin = exports.requiredIfPlugin = exports.requiredPlugin = exports.readOnlyPlugin = exports.orFailPlugin = exports.optionalIfPlugin = exports.optionalPlugin = exports.oneOfPlugin = exports.objectRecursivelyPlugin = exports.objectPropertyNamesPlugin = exports.objectPatternPropertiesPlugin = exports.objectMinPropertiesPlugin = exports.objectMaxPropertiesPlugin = exports.objectDependentSchemasPlugin = exports.objectDependentRequiredPlugin = exports.objectAdditionalPropertiesSchemaPlugin = exports.objectAdditionalPropertiesPlugin = exports.objectPlugin = exports.numberRangePlugin = exports.numberPositivePlugin = exports.numberNegativePlugin = exports.numberMultipleOfPlugin = exports.numberMinPlugin = exports.numberMaxPlugin = exports.numberIntegerPlugin = exports.numberFinitePlugin = exports.nullablePlugin = exports.literalPlugin = exports.jsonSchemaFullFeaturePlugin = exports.jsonSchemaPlugin = exports.fromContextPlugin = exports.customPlugin = exports.conditionalSchemaPlugin = exports.compareFieldPlugin = exports.booleanTruthyPlugin = exports.booleanFalsyPlugin = exports.arrayUniquePlugin = exports.arrayMinLengthPlugin = exports.arrayMaxLengthPlugin = exports.arrayIncludesPlugin = exports.arrayEachPlugin = exports.arrayContainsPlugin = void 0;
6
+ exports.writeOnlyPlugin = exports.validateIfPlugin = exports.uuidPlugin = exports.unionGuardPlugin = exports.tupleBuilderPlugin = exports.transformPlugin = exports.stringUrlPlugin = exports.stringUriTemplatePlugin = exports.stringUriReferencePlugin = exports.stringTimePlugin = exports.stringStartsWithPlugin = exports.stringRelativeJsonPointerPlugin = exports.stringRegexPlugin = exports.stringPatternPlugin = exports.stringMinPlugin = exports.stringMaxPlugin = exports.stringJsonPointerPlugin = exports.stringIriReferencePlugin = exports.stringIriPlugin = exports.stringIpv6Plugin = exports.stringIpv4Plugin = exports.stringIdnHostnamePlugin = exports.stringIdnEmailPlugin = exports.stringHostnamePlugin = exports.stringExactLengthPlugin = exports.stringEndsWithPlugin = exports.stringEmailPlugin = exports.stringDurationPlugin = void 0;
7
7
  var array_contains_1 = require("./array-contains");
8
8
  Object.defineProperty(exports, "arrayContainsPlugin", { enumerable: true, get: function () { return array_contains_1.arrayContainsPlugin; } });
9
9
  var array_each_1 = require("./array-each");
@@ -90,6 +90,8 @@ var skip_1 = require("./skip");
90
90
  Object.defineProperty(exports, "skipPlugin", { enumerable: true, get: function () { return skip_1.skipPlugin; } });
91
91
  var stitch_1 = require("./stitch");
92
92
  Object.defineProperty(exports, "stitchPlugin", { enumerable: true, get: function () { return stitch_1.stitchPlugin; } });
93
+ var stitch_with_1 = require("./stitch-with");
94
+ Object.defineProperty(exports, "stitchWithPlugin", { enumerable: true, get: function () { return stitch_with_1.stitchWithPlugin; } });
93
95
  var string_alphanumeric_1 = require("./string-alphanumeric");
94
96
  Object.defineProperty(exports, "stringAlphanumericPlugin", { enumerable: true, get: function () { return string_alphanumeric_1.stringAlphanumericPlugin; } });
95
97
  var string_base64_1 = require("./string-base64");
@@ -1,5 +1,5 @@
1
- // GENERATED FILE - 手で編集しないでください。
2
- // 生成元: プラグインディレクトリ構造 (scripts/catalog/build-plugin-catalog.ts)。
1
+ // GENERATED FILE - do not edit by hand.
2
+ // Generated by scripts/catalog/build-plugin-catalog.ts out of the plugin directory structure.
3
3
  export { arrayContainsPlugin } from "./array-contains/index.mjs";
4
4
  export { arrayEachPlugin } from "./array-each/index.mjs";
5
5
  export { arrayIncludesPlugin } from "./array-includes/index.mjs";
@@ -43,6 +43,7 @@ export { requiredPlugin } from "./required/index.mjs";
43
43
  export { requiredIfPlugin } from "./required-if/index.mjs";
44
44
  export { skipPlugin } from "./skip/index.mjs";
45
45
  export { stitchPlugin } from "./stitch/index.mjs";
46
+ export { stitchWithPlugin } from "./stitch-with/index.mjs";
46
47
  export { stringAlphanumericPlugin } from "./string-alphanumeric/index.mjs";
47
48
  export { stringBase64Plugin } from "./string-base64/index.mjs";
48
49
  export { stringContentEncodingPlugin } from "./string-content-encoding/index.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- // GENERATED FILE - 手で編集しないでください。
3
- // 生成元: プラグインディレクトリ構造 (scripts/catalog/build-plugin-catalog.ts)。
2
+ // GENERATED FILE - do not edit by hand.
3
+ // Generated by scripts/catalog/build-plugin-catalog.ts out of the plugin directory structure.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.PLUGIN_MANIFEST = void 0;
6
6
  exports.PLUGIN_MANIFEST = [
@@ -46,6 +46,7 @@ exports.PLUGIN_MANIFEST = [
46
46
  { directoryName: "required-if", subpathName: "requiredIf", tier: "isolated", entryFile: "src/plugins/required-if/index.ts", exportedSymbols: ["requiredIfPlugin"] },
47
47
  { directoryName: "skip", subpathName: "skip", tier: "isolated", entryFile: "src/plugins/skip/index.ts", exportedSymbols: ["skipPlugin"] },
48
48
  { directoryName: "stitch", subpathName: "stitch", tier: "isolated", entryFile: "src/plugins/stitch/index.ts", exportedSymbols: ["stitchPlugin"] },
49
+ { directoryName: "stitch-with", subpathName: "stitchWith", tier: "isolated", entryFile: "src/plugins/stitch-with/index.ts", exportedSymbols: ["stitchWithPlugin"] },
49
50
  { directoryName: "string-alphanumeric", subpathName: "stringAlphanumeric", tier: "isolated", entryFile: "src/plugins/string-alphanumeric/index.ts", exportedSymbols: ["stringAlphanumericPlugin"] },
50
51
  { directoryName: "string-base64", subpathName: "stringBase64", tier: "isolated", entryFile: "src/plugins/string-base64/index.ts", exportedSymbols: ["stringBase64Plugin"] },
51
52
  { directoryName: "string-content-encoding", subpathName: "stringContentEncoding", tier: "isolated", entryFile: "src/plugins/string-content-encoding/index.ts", exportedSymbols: ["stringContentEncodingPlugin"] },
@@ -1,5 +1,5 @@
1
- // GENERATED FILE - 手で編集しないでください。
2
- // 生成元: プラグインディレクトリ構造 (scripts/catalog/build-plugin-catalog.ts)。
1
+ // GENERATED FILE - do not edit by hand.
2
+ // Generated by scripts/catalog/build-plugin-catalog.ts out of the plugin directory structure.
3
3
  export const PLUGIN_MANIFEST = [
4
4
  { directoryName: "array-contains", subpathName: "arrayContains", tier: "isolated", entryFile: "src/plugins/array-contains/index.ts", exportedSymbols: ["arrayContainsPlugin"] },
5
5
  { directoryName: "array-each", subpathName: "arrayEach", tier: "isolated", entryFile: "src/plugins/array-each/index.ts", exportedSymbols: ["arrayEachPlugin"] },
@@ -43,6 +43,7 @@ export const PLUGIN_MANIFEST = [
43
43
  { directoryName: "required-if", subpathName: "requiredIf", tier: "isolated", entryFile: "src/plugins/required-if/index.ts", exportedSymbols: ["requiredIfPlugin"] },
44
44
  { directoryName: "skip", subpathName: "skip", tier: "isolated", entryFile: "src/plugins/skip/index.ts", exportedSymbols: ["skipPlugin"] },
45
45
  { directoryName: "stitch", subpathName: "stitch", tier: "isolated", entryFile: "src/plugins/stitch/index.ts", exportedSymbols: ["stitchPlugin"] },
46
+ { directoryName: "stitch-with", subpathName: "stitchWith", tier: "isolated", entryFile: "src/plugins/stitch-with/index.ts", exportedSymbols: ["stitchWithPlugin"] },
46
47
  { directoryName: "string-alphanumeric", subpathName: "stringAlphanumeric", tier: "isolated", entryFile: "src/plugins/string-alphanumeric/index.ts", exportedSymbols: ["stringAlphanumericPlugin"] },
47
48
  { directoryName: "string-base64", subpathName: "stringBase64", tier: "isolated", entryFile: "src/plugins/string-base64/index.ts", exportedSymbols: ["stringBase64Plugin"] },
48
49
  { directoryName: "string-content-encoding", subpathName: "stringContentEncoding", tier: "isolated", entryFile: "src/plugins/string-content-encoding/index.ts", exportedSymbols: ["stringContentEncodingPlugin"] },
@@ -1,15 +1,15 @@
1
1
  /**
2
- * パターンは build 時に一度だけコンパイルする。実行時は回すだけ、という
3
- * 設計に合わせるためで、キーごとに new RegExp すると O(キー数 x パターン数)
4
- * のコンパイルが毎回走る。
2
+ * Patterns are compiled once, at build time, matching the design where
3
+ * validation only runs what was already assembled. Compiling per key would
4
+ * cost O(keys × patterns) compilations on every call.
5
5
  *
6
- * 壊れた正規表現は無視する。スキーマ側の誤りでビルド全体を落とすより、
7
- * そのパターンが誰にも一致しないほうがまし (Draft-07 ECMA-262
8
- * 正規表現を求めるが、方言差で通らないものが現実には来る)。
6
+ * A broken pattern is ignored rather than fatal. Draft-07 asks for ECMA-262
7
+ * regular expressions and real documents arrive with dialect differences;
8
+ * having that one pattern match nothing beats refusing the whole build.
9
9
  */
10
10
  export declare function compilePatterns(patterns: readonly string[] | undefined): readonly RegExp[];
11
11
  /**
12
- * 宣言済みのキー名にも、どのパターンにも該当しないキーを返す。
13
- * 返る配列は入力の列挙順を保つ (issue のメッセージが安定する)。
12
+ * Returns the keys matched by neither a declared name nor any pattern,
13
+ * preserving the input's enumeration order so issue output stays stable.
14
14
  */
15
15
  export declare function selectAdditionalKeys(value: Readonly<Record<string, unknown>>, known: ReadonlySet<string>, patterns: readonly RegExp[]): readonly string[];
@@ -2,25 +2,25 @@
2
2
  // ===========================================================================
3
3
  // L7 src/plugins/object-additional-properties/select-additional-keys.ts
4
4
  //
5
- // additional なキー」を選ぶ規則。boolean 形とスキーマ形の両方が使う。
5
+ // Which keys count as "additional". Used by both the boolean form and the
6
+ // schema form.
6
7
  //
7
- // Draft-07 §6.5.4 additionalProperties の対象を「properties にも
8
- // patternProperties にも該当しないキー」と定めている。パターンを見落とすと
9
- // `{"patternProperties":{"^v":{}},"additionalProperties":false}`
10
- // {"vroom":2} を誤って拒否する (スイートの
11
- // "patternProperties are not additional properties" がそれを突く)。
8
+ // Draft-07 §6.5.4 defines them as the keys matched by neither `properties`
9
+ // nor `patternProperties`. Miss the patterns and
10
+ // `{"patternProperties":{"^v":{}},"additionalProperties":false}` wrongly
11
+ // rejects {"vroom":2}.
12
12
  // ===========================================================================
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.compilePatterns = compilePatterns;
15
15
  exports.selectAdditionalKeys = selectAdditionalKeys;
16
16
  /**
17
- * パターンは build 時に一度だけコンパイルする。実行時は回すだけ、という
18
- * 設計に合わせるためで、キーごとに new RegExp すると O(キー数 x パターン数)
19
- * のコンパイルが毎回走る。
17
+ * Patterns are compiled once, at build time, matching the design where
18
+ * validation only runs what was already assembled. Compiling per key would
19
+ * cost O(keys × patterns) compilations on every call.
20
20
  *
21
- * 壊れた正規表現は無視する。スキーマ側の誤りでビルド全体を落とすより、
22
- * そのパターンが誰にも一致しないほうがまし (Draft-07 ECMA-262
23
- * 正規表現を求めるが、方言差で通らないものが現実には来る)。
21
+ * A broken pattern is ignored rather than fatal. Draft-07 asks for ECMA-262
22
+ * regular expressions and real documents arrive with dialect differences;
23
+ * having that one pattern match nothing beats refusing the whole build.
24
24
  */
25
25
  function compilePatterns(patterns) {
26
26
  if (patterns === undefined || patterns.length === 0)
@@ -32,19 +32,19 @@ function compilePatterns(patterns) {
32
32
  }
33
33
  catch {
34
34
  try {
35
- // "u" が付くと通らない書き方が現実にはある。付けずにもう一度試す。
35
+ // Some real patterns fail only under "u". Try again without it.
36
36
  compiled.push(new RegExp(pattern));
37
37
  }
38
38
  catch {
39
- // どちらでも駄目なら、このパターンは一致しないものとして扱う。
39
+ // Failing both ways, treat this pattern as matching nothing.
40
40
  }
41
41
  }
42
42
  }
43
43
  return Object.freeze(compiled);
44
44
  }
45
45
  /**
46
- * 宣言済みのキー名にも、どのパターンにも該当しないキーを返す。
47
- * 返る配列は入力の列挙順を保つ (issue のメッセージが安定する)。
46
+ * Returns the keys matched by neither a declared name nor any pattern,
47
+ * preserving the input's enumeration order so issue output stays stable.
48
48
  */
49
49
  function selectAdditionalKeys(value, known, patterns) {
50
50
  return Object.keys(value).filter((key) => !known.has(key) && !patterns.some((pattern) => pattern.test(key)));
@@ -1,22 +1,22 @@
1
1
  // ===========================================================================
2
2
  // L7 src/plugins/object-additional-properties/select-additional-keys.ts
3
3
  //
4
- // additional なキー」を選ぶ規則。boolean 形とスキーマ形の両方が使う。
4
+ // Which keys count as "additional". Used by both the boolean form and the
5
+ // schema form.
5
6
  //
6
- // Draft-07 §6.5.4 additionalProperties の対象を「properties にも
7
- // patternProperties にも該当しないキー」と定めている。パターンを見落とすと
8
- // `{"patternProperties":{"^v":{}},"additionalProperties":false}`
9
- // {"vroom":2} を誤って拒否する (スイートの
10
- // "patternProperties are not additional properties" がそれを突く)。
7
+ // Draft-07 §6.5.4 defines them as the keys matched by neither `properties`
8
+ // nor `patternProperties`. Miss the patterns and
9
+ // `{"patternProperties":{"^v":{}},"additionalProperties":false}` wrongly
10
+ // rejects {"vroom":2}.
11
11
  // ===========================================================================
12
12
  /**
13
- * パターンは build 時に一度だけコンパイルする。実行時は回すだけ、という
14
- * 設計に合わせるためで、キーごとに new RegExp すると O(キー数 x パターン数)
15
- * のコンパイルが毎回走る。
13
+ * Patterns are compiled once, at build time, matching the design where
14
+ * validation only runs what was already assembled. Compiling per key would
15
+ * cost O(keys × patterns) compilations on every call.
16
16
  *
17
- * 壊れた正規表現は無視する。スキーマ側の誤りでビルド全体を落とすより、
18
- * そのパターンが誰にも一致しないほうがまし (Draft-07 ECMA-262
19
- * 正規表現を求めるが、方言差で通らないものが現実には来る)。
17
+ * A broken pattern is ignored rather than fatal. Draft-07 asks for ECMA-262
18
+ * regular expressions and real documents arrive with dialect differences;
19
+ * having that one pattern match nothing beats refusing the whole build.
20
20
  */
21
21
  export function compilePatterns(patterns) {
22
22
  if (patterns === undefined || patterns.length === 0)
@@ -28,19 +28,19 @@ export function compilePatterns(patterns) {
28
28
  }
29
29
  catch {
30
30
  try {
31
- // "u" が付くと通らない書き方が現実にはある。付けずにもう一度試す。
31
+ // Some real patterns fail only under "u". Try again without it.
32
32
  compiled.push(new RegExp(pattern));
33
33
  }
34
34
  catch {
35
- // どちらでも駄目なら、このパターンは一致しないものとして扱う。
35
+ // Failing both ways, treat this pattern as matching nothing.
36
36
  }
37
37
  }
38
38
  }
39
39
  return Object.freeze(compiled);
40
40
  }
41
41
  /**
42
- * 宣言済みのキー名にも、どのパターンにも該当しないキーを返す。
43
- * 返る配列は入力の列挙順を保つ (issue のメッセージが安定する)。
42
+ * Returns the keys matched by neither a declared name nor any pattern,
43
+ * preserving the input's enumeration order so issue output stays stable.
44
44
  */
45
45
  export function selectAdditionalKeys(value, known, patterns) {
46
46
  return Object.keys(value).filter((key) => !known.has(key) && !patterns.some((pattern) => pattern.test(key)));
@@ -1,6 +1,15 @@
1
+ import type { CrossFieldOutcome } from "../../types";
1
2
  import type { PickPaths } from "../../path/index";
2
- import type { FieldRefs, Unchanged } from "../../plugin-kit/marker.types";
3
- /** The bundle handed to the check, keyed by the path exactly as declared. */
3
+ import type { FieldRefs, StitchOut } from "../../plugin-kit/marker.types";
4
+ /**
5
+ * The bundle handed to the check at RUN TIME, keyed by the path exactly as
6
+ * declared.
7
+ *
8
+ * Callers no longer see this type. Writing `.stitch(["price"], ...)` already
9
+ * fixes the set of paths, so the bundle the predicate receives is typed per
10
+ * key from those paths. What survives here is the run-time side's record of
11
+ * one fact: the keys are the path strings.
12
+ */
4
13
  export type StitchFieldValues = Readonly<Record<string, unknown>>;
5
14
  /**
6
15
  * PickPaths applied to a declared tuple: `StitchFieldsOf<Order, ["price",
@@ -11,11 +20,18 @@ export type StitchFieldValues = Readonly<Record<string, unknown>>;
11
20
  * the same alternative-2 move readExternalContext makes for async context.
12
21
  */
13
22
  export type StitchFieldsOf<TRoot, TFields extends readonly string[]> = PickPaths<TRoot, TFields>;
14
- /** 1.x's `{ valid, message? }`, unchanged. */
15
- export interface StitchOutcome {
16
- readonly valid: boolean;
17
- readonly message?: string;
18
- }
23
+ /**
24
+ * The legacy `{ valid, message? }`, name and shape unchanged. It is declared
25
+ * where the chain layer can reach it, so that layer never has to import a
26
+ * plugin to build a caller-facing type.
27
+ */
28
+ export type StitchOutcome = CrossFieldOutcome;
29
+ /**
30
+ * The shape build() receives at run time. **Not the type a caller sees.**
31
+ *
32
+ * Writing `.stitch(["price", "quantity"], ...)` already fixes the set of
33
+ * paths, so the bundle the predicate receives is typed per key.
34
+ */
19
35
  export type StitchCheck = (fieldValues: StitchFieldValues, value: unknown, root: unknown) => StitchOutcome;
20
36
  /** 1.x's messageFactory context for this plugin, minus the re-run. */
21
37
  export interface StitchExtra {
@@ -25,6 +41,6 @@ export interface StitchExtra {
25
41
  }
26
42
  export declare const stitchPlugin: import("../../plugin-kit/plugin-definition").PluginDefinition<"stitch", "stitch", readonly ["string", "number", "boolean", "date", "object", "array", "tuple", "union"], {
27
43
  args: readonly [fields: FieldRefs, check: StitchCheck];
28
- out: Unchanged;
44
+ out: StitchOut;
29
45
  context: StitchExtra;
30
46
  }>;
@@ -0,0 +1,2 @@
1
+ export { stitchWithPlugin } from "./stitch-with";
2
+ export type { BundleAliasMap, StitchWithExtra } from "./stitch-with";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stitchWithPlugin = void 0;
4
+ var stitch_with_1 = require("./stitch-with");
5
+ Object.defineProperty(exports, "stitchWithPlugin", { enumerable: true, get: function () { return stitch_with_1.stitchWithPlugin; } });