pi-proactive 0.2.0-beta.2 → 0.2.0-beta.3

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 (243) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +32 -28
  3. package/build/cli.mjs +121 -0
  4. package/build/extensions/proactive.js +47 -6
  5. package/build/src/commands.js +78 -2
  6. package/build/src/config.js +511 -4
  7. package/build/src/daemon-config.js +221 -0
  8. package/build/src/daemon-contact.js +103 -0
  9. package/build/src/daemon-host.js +84 -0
  10. package/build/src/daemon.js +193 -3
  11. package/build/src/health.js +84 -0
  12. package/build/src/lineage.js +41 -2
  13. package/build/src/notify.js +183 -0
  14. package/build/src/progress-eta.js +134 -0
  15. package/build/src/trigger.js +43 -0
  16. package/build/src/trust-loop.js +321 -0
  17. package/build/src/trust-metrics.js +236 -0
  18. package/build/src/trust-notify.js +73 -0
  19. package/build/src/trust-policy.js +58 -0
  20. package/build/src/trust-registry.js +323 -0
  21. package/daemon/launchd.plist +48 -0
  22. package/daemon/pi-proactive-daemon.service +29 -0
  23. package/daemon/run-daemon.sh +84 -0
  24. package/node_modules/typebox/build/compile/code.mjs +2 -1
  25. package/node_modules/typebox/build/compile/validator.mjs +1 -5
  26. package/node_modules/typebox/build/format/date_time.d.mts +1 -2
  27. package/node_modules/typebox/build/format/date_time.mjs +3 -12
  28. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  29. package/node_modules/typebox/build/format/duration.mjs +2 -2
  30. package/node_modules/typebox/build/format/idn_email.d.mts +0 -1
  31. package/node_modules/typebox/build/format/idn_email.mjs +0 -1
  32. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  33. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  34. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  35. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  36. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  37. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  38. package/node_modules/typebox/build/format/iri.mjs +9 -16
  39. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  40. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  41. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  42. package/node_modules/typebox/build/guard/guard.d.mts +5 -7
  43. package/node_modules/typebox/build/guard/guard.mjs +9 -14
  44. package/node_modules/typebox/build/guard/index.mjs +0 -6
  45. package/node_modules/typebox/build/guard/{unicode/unicode_segment.mjs → string.mjs} +19 -16
  46. package/node_modules/typebox/build/schema/build.mjs +5 -5
  47. package/node_modules/typebox/build/schema/check.mjs +1 -1
  48. package/node_modules/typebox/build/schema/engine/_context.d.mts +1 -5
  49. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -16
  50. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  51. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  52. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  53. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  54. package/node_modules/typebox/build/schema/engine/_refine.mjs +9 -14
  55. package/node_modules/typebox/build/schema/engine/_stack.d.mts +20 -34
  56. package/node_modules/typebox/build/schema/engine/_stack.mjs +202 -143
  57. package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -4
  58. package/node_modules/typebox/build/schema/engine/_unique.mjs +3 -7
  59. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  60. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  61. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -5
  62. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +32 -27
  63. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  64. package/node_modules/typebox/build/schema/engine/allOf.mjs +1 -1
  65. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  66. package/node_modules/typebox/build/schema/engine/anyOf.mjs +9 -4
  67. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  68. package/node_modules/typebox/build/schema/engine/boolean.mjs +6 -2
  69. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  70. package/node_modules/typebox/build/schema/engine/const.mjs +6 -2
  71. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  72. package/node_modules/typebox/build/schema/engine/contains.mjs +9 -5
  73. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  74. package/node_modules/typebox/build/schema/engine/dependencies.mjs +7 -5
  75. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  76. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +6 -2
  77. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  78. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +1 -2
  79. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  80. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +8 -12
  81. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  82. package/node_modules/typebox/build/schema/engine/enum.mjs +6 -2
  83. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  84. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +6 -2
  85. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  86. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +6 -2
  87. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  88. package/node_modules/typebox/build/schema/engine/format.mjs +8 -11
  89. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  90. package/node_modules/typebox/build/schema/engine/if.mjs +13 -5
  91. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  92. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  93. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  94. package/node_modules/typebox/build/schema/engine/items.mjs +5 -8
  95. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  96. package/node_modules/typebox/build/schema/engine/maxContains.mjs +8 -4
  97. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  98. package/node_modules/typebox/build/schema/engine/maxItems.mjs +6 -2
  99. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  100. package/node_modules/typebox/build/schema/engine/maxLength.mjs +6 -2
  101. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  102. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +6 -2
  103. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  104. package/node_modules/typebox/build/schema/engine/maximum.mjs +6 -2
  105. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  106. package/node_modules/typebox/build/schema/engine/minContains.mjs +9 -5
  107. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  108. package/node_modules/typebox/build/schema/engine/minItems.mjs +6 -2
  109. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  110. package/node_modules/typebox/build/schema/engine/minLength.mjs +6 -2
  111. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  112. package/node_modules/typebox/build/schema/engine/minProperties.mjs +6 -2
  113. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  114. package/node_modules/typebox/build/schema/engine/minimum.mjs +6 -2
  115. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  116. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +6 -2
  117. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  118. package/node_modules/typebox/build/schema/engine/not.mjs +8 -4
  119. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  120. package/node_modules/typebox/build/schema/engine/oneOf.mjs +11 -6
  121. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  122. package/node_modules/typebox/build/schema/engine/pattern.mjs +7 -3
  123. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  124. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +5 -6
  125. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  126. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  127. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  128. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -4
  129. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  130. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +10 -7
  131. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  132. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +8 -12
  133. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  134. package/node_modules/typebox/build/schema/engine/ref.mjs +14 -18
  135. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  136. package/node_modules/typebox/build/schema/engine/required.mjs +6 -2
  137. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  138. package/node_modules/typebox/build/schema/engine/schema.mjs +138 -136
  139. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  140. package/node_modules/typebox/build/schema/engine/type.mjs +6 -2
  141. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  142. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +9 -5
  143. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  144. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +9 -5
  145. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  146. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +6 -2
  147. package/node_modules/typebox/build/schema/errors.mjs +1 -1
  148. package/node_modules/typebox/build/schema/intern/intern.d.mts +9 -6
  149. package/node_modules/typebox/build/schema/intern/intern.mjs +56 -90
  150. package/node_modules/typebox/build/schema/parse.mjs +0 -3
  151. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +6 -1
  152. package/node_modules/typebox/build/schema/pointer/pointer.mjs +64 -47
  153. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +32 -6
  154. package/node_modules/typebox/build/schema/resolve/resolve.mjs +227 -231
  155. package/node_modules/typebox/build/schema/schema.d.mts +0 -1
  156. package/node_modules/typebox/build/schema/schema.mjs +0 -1
  157. package/node_modules/typebox/build/system/hashing/hash.mjs +34 -63
  158. package/node_modules/typebox/build/system/locale/en_US.mjs +1 -2
  159. package/node_modules/typebox/build/system/memory/assign.d.mts +8 -2
  160. package/node_modules/typebox/build/system/memory/assign.mjs +6 -13
  161. package/node_modules/typebox/build/system/memory/clone.d.mts +5 -4
  162. package/node_modules/typebox/build/system/memory/clone.mjs +96 -8
  163. package/node_modules/typebox/build/system/memory/create.d.mts +5 -1
  164. package/node_modules/typebox/build/system/memory/create.mjs +13 -18
  165. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  166. package/node_modules/typebox/build/system/memory/discard.mjs +8 -9
  167. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  168. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  169. package/node_modules/typebox/build/system/memory/update.d.mts +4 -1
  170. package/node_modules/typebox/build/system/memory/update.mjs +16 -43
  171. package/node_modules/typebox/build/system/settings/settings.d.mts +0 -11
  172. package/node_modules/typebox/build/system/settings/settings.mjs +0 -14
  173. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +24 -2
  174. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +29 -2
  175. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +0 -1
  176. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +0 -1
  177. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +1 -5
  178. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +1 -6
  179. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +3 -1
  180. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +4 -1
  181. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  182. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  183. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  184. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  185. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +3 -1
  186. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +4 -1
  187. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +3 -1
  188. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +4 -1
  189. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  190. package/node_modules/typebox/build/type/extends/inference.mjs +2 -15
  191. package/node_modules/typebox/build/type/extends/tuple.d.mts +1 -2
  192. package/node_modules/typebox/build/type/extends/tuple.mjs +1 -21
  193. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  194. package/node_modules/typebox/build/value/clone/clone.d.mts +3 -4
  195. package/node_modules/typebox/build/value/clone/clone.mjs +7 -5
  196. package/node_modules/typebox/build/value/parse/parse.mjs +4 -10
  197. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +14 -25
  198. package/node_modules/typebox/package.json +1 -1
  199. package/node_modules/typebox/readme.md +84 -52
  200. package/package.json +11 -3
  201. package/skills/pi-proactive/SKILL.md +27 -24
  202. package/tools/cli.mjs +121 -0
  203. package/tools/daemon-install.sh +397 -0
  204. package/tools/daemon-uninstall.sh +226 -0
  205. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +0 -6
  206. package/node_modules/typebox/build/guard/unicode/unicode.mjs +0 -35
  207. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +0 -1
  208. package/node_modules/typebox/build/schema/engine/_pathing.mjs +0 -11
  209. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +0 -2
  210. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +0 -288
  211. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +0 -2
  212. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +0 -300
  213. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +0 -2
  214. package/node_modules/typebox/build/schema/meta/draft_3.mjs +0 -143
  215. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +0 -2
  216. package/node_modules/typebox/build/schema/meta/draft_4.mjs +0 -149
  217. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +0 -2
  218. package/node_modules/typebox/build/schema/meta/draft_6.mjs +0 -155
  219. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +0 -2
  220. package/node_modules/typebox/build/schema/meta/draft_7.mjs +0 -172
  221. package/node_modules/typebox/build/schema/meta/index.d.mts +0 -2
  222. package/node_modules/typebox/build/schema/meta/index.mjs +0 -2
  223. package/node_modules/typebox/build/schema/meta/meta.d.mts +0 -9
  224. package/node_modules/typebox/build/schema/meta/meta.mjs +0 -15
  225. package/node_modules/typebox/build/schema/meta/schema.d.mts +0 -6
  226. package/node_modules/typebox/build/schema/meta/schema.mjs +0 -1
  227. package/node_modules/typebox/build/system/memory/deep.d.mts +0 -2
  228. package/node_modules/typebox/build/system/memory/deep.mjs +0 -108
  229. package/node_modules/typebox/build/system/memory/finalize.d.mts +0 -4
  230. package/node_modules/typebox/build/system/memory/finalize.mjs +0 -30
  231. package/node_modules/typebox/build/system/memory/keys.d.mts +0 -2
  232. package/node_modules/typebox/build/system/memory/keys.mjs +0 -8
  233. package/node_modules/typebox/build/system/settings/internal.d.mts +0 -2
  234. package/node_modules/typebox/build/system/settings/internal.mjs +0 -20
  235. package/node_modules/typebox/build/type/engine/call/index.d.mts +0 -1
  236. package/node_modules/typebox/build/type/engine/call/index.mjs +0 -1
  237. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +0 -30
  238. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +0 -29
  239. package/node_modules/typebox/build/type/engine/this/index.d.mts +0 -1
  240. package/node_modules/typebox/build/type/engine/this/index.mjs +0 -1
  241. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +0 -2
  242. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +0 -6
  243. /package/node_modules/typebox/build/guard/{unicode/unicode_segment.d.mts → string.d.mts} +0 -0
@@ -1,8 +1,7 @@
1
1
  // deno-fmt-ignore-file
2
- import * as Schema from '../types/index.mjs';
3
- import * as Unique from './_unique.mjs';
4
- import * as Externals from './_externals.mjs';
5
- import * as Pathing from './_pathing.mjs';
2
+ import * as S from '../types/index.mjs';
3
+ import * as V from './_externals.mjs';
4
+ import { Unique } from './_unique.mjs';
6
5
  import { UnicodeRegExp } from './_regexp.mjs';
7
6
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
8
7
  import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
@@ -35,41 +34,43 @@ function GetPropertyKeyAsPattern(key) {
35
34
  }
36
35
  function GetPropertiesPattern(schema) {
37
36
  const patterns = [];
38
- if (Schema.IsPatternProperties(schema))
37
+ if (S.IsPatternProperties(schema))
39
38
  patterns.push(...G.Keys(schema.patternProperties));
40
- if (Schema.IsProperties(schema))
39
+ if (S.IsProperties(schema))
41
40
  patterns.push(...G.Keys(schema.properties).map(GetPropertyKeyAsPattern));
42
41
  return G.IsEqual(patterns.length, 0) ? '(?!)' : `(${patterns.join('|')})`;
43
42
  }
44
43
  // ------------------------------------------------------------------
45
- // BuildAdditionalPropertiesFast (AdditionalProperties False)
44
+ // BuildAdditionalPropertiesFast
46
45
  //
47
- // - AdditionalProperties is explicitly set to false,
48
- // - The schema uses only Properties (no PatternProperties),
49
- // - Required contains exactly the keys in Properties.
46
+ // Optimized logic for schemas with `additionalProperties: false`.
47
+ //
48
+ // This fast-path applies only when:
49
+ // - `additionalProperties` is explicitly set to false,
50
+ // - the schema uses only `properties` (no `patternProperties`),
51
+ // - and all defined properties are required (i.e., no optional keys).
52
+ //
53
+ // This constraint is common when enforcing strict object shapes
54
+ // with only known, fixed keys. When all these conditions are met,
55
+ // we can generate a simplified and efficient runtime check.
50
56
  //
51
57
  // ------------------------------------------------------------------
52
- function HasExactRequiredProperties(schema) {
53
- const keys = G.Keys(schema.properties);
54
- return G.IsEqual(keys.length, schema.required.length)
55
- && G.Every(keys, 0, (key) => schema.required.includes(key));
56
- }
57
- function CanAdditionalPropertiesFast(_context, schema, _value) {
58
- return Schema.IsRequired(schema)
59
- && Schema.IsProperties(schema)
60
- && !Schema.IsPatternProperties(schema)
58
+ export function CanAdditionalPropertiesFast(_context, schema, _value) {
59
+ return S.IsRequired(schema)
60
+ && S.IsProperties(schema)
61
+ && !S.IsPatternProperties(schema)
61
62
  && G.IsEqual(schema.additionalProperties, false)
62
- && HasExactRequiredProperties(schema);
63
+ && G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
63
64
  }
64
- function BuildAdditionalPropertiesFast(_context, schema, value) {
65
+ export function BuildAdditionalPropertiesFast(_context, schema, value) {
65
66
  return E.IsEqual(E.Member(E.Call(E.Member('Object', 'getOwnPropertyNames'), [value]), 'length'), E.Constant(schema.required.length));
66
67
  }
67
68
  // ------------------------------------------------------------------
68
69
  // BuildAdditionalPropertiesStandard
69
70
  // ------------------------------------------------------------------
70
- function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
71
- const [key, _index] = [Unique.CreateUnique(), Unique.CreateUnique()];
72
- const regexp = Externals.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
71
+ export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
72
+ const [key, _index] = [Unique(), Unique()];
73
+ const regexp = V.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
73
74
  const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
74
75
  const isKey = E.Call(E.Member(regexp, 'test'), [key]);
75
76
  const addKey = context.AddKey(key);
@@ -106,13 +107,17 @@ export function ErrorAdditionalProperties(stack, context, schemaPath, instancePa
106
107
  const additionalProperties = [];
107
108
  const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
108
109
  const nextSchemaPath = `${schemaPath}/additionalProperties`;
109
- const nextInstancePath = `${instancePath}/${Pathing.EncodeFragment(key)}`;
110
+ const nextInstancePath = `${instancePath}/${key}`;
110
111
  const isAdditionalProperty = regexp.test(key) ||
111
112
  (ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
112
113
  if (!isAdditionalProperty)
113
114
  additionalProperties.push(key);
114
115
  return isAdditionalProperty;
115
116
  });
116
- return isAdditionalProperties ||
117
- context.AddError('additionalProperties', schemaPath, instancePath, { additionalProperties });
117
+ return isAdditionalProperties || context.AddError({
118
+ keyword: 'additionalProperties',
119
+ schemaPath,
120
+ instancePath,
121
+ params: { additionalProperties },
122
+ });
118
123
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildAllOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
5
- export declare function CheckAllOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
6
- export declare function ErrorAllOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
4
+ export declare function BuildAllOf(stack: Stack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
5
+ export declare function CheckAllOf(stack: Stack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
6
+ export declare function ErrorAllOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
@@ -42,6 +42,6 @@ export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, val
42
42
  }, []);
43
43
  const isAllOf = G.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
44
44
  if (!isAllOf)
45
- failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
45
+ failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
46
46
  return isAllOf;
47
47
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildAnyOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
5
- export declare function CheckAnyOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
6
- export declare function ErrorAnyOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
4
+ export declare function BuildAnyOf(stack: Stack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
5
+ export declare function CheckAnyOf(stack: Stack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
6
+ export declare function ErrorAnyOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
@@ -1,8 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
- import { Reducer } from './_reducer.mjs';
3
2
  import { CheckContext, ErrorContext } from './_context.mjs';
4
- import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
3
+ import { Reducer } from './_reducer.mjs';
5
4
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
5
+ import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // Build
8
8
  // ------------------------------------------------------------------
@@ -42,6 +42,11 @@ export function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, val
42
42
  }, []);
43
43
  const isAnyOf = G.IsGreaterThan(results.length, 0) && context.Merge(results);
44
44
  if (!isAnyOf)
45
- failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
46
- return isAnyOf || context.AddError('anyOf', schemaPath, instancePath, {});
45
+ failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
46
+ return isAnyOf || context.AddError({
47
+ keyword: 'anyOf',
48
+ schemaPath,
49
+ instancePath,
50
+ params: {}
51
+ });
47
52
  }
@@ -1,5 +1,5 @@
1
- import * as Stack from './_stack.mjs';
1
+ import { Stack } from './_stack.mjs';
2
2
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
3
- export declare function BuildSchemaBoolean(_stack: Stack.XStack, _context: BuildContext, schema: boolean, _value: string): string;
4
- export declare function CheckSchemaBoolean(_stack: Stack.XStack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
- export declare function ErrorSchemaBoolean(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
3
+ export declare function BuildSchemaBoolean(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
4
+ export declare function CheckSchemaBoolean(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
5
+ export declare function ErrorSchemaBoolean(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
@@ -16,6 +16,10 @@ export function CheckSchemaBoolean(_stack, _context, schema, _value) {
16
16
  // Error
17
17
  // ------------------------------------------------------------------
18
18
  export function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
19
- return CheckSchemaBoolean(stack, context, schema, value) ||
20
- context.AddError('boolean', schemaPath, instancePath, {});
19
+ return CheckSchemaBoolean(stack, context, schema, value) || context.AddError({
20
+ keyword: 'boolean',
21
+ schemaPath,
22
+ instancePath,
23
+ params: {}
24
+ });
21
25
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildConst(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XConst, value: string): string;
5
- export declare function CheckConst(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
6
- export declare function ErrorConst(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
4
+ export declare function BuildConst(_stack: Stack, _context: BuildContext, schema: Schema.XConst, value: string): string;
5
+ export declare function CheckConst(_stack: Stack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
6
+ export declare function ErrorConst(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
@@ -21,6 +21,10 @@ export function CheckConst(_stack, _context, schema, value) {
21
21
  // Check
22
22
  // ------------------------------------------------------------------
23
23
  export function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
24
- return CheckConst(stack, context, schema, value) ||
25
- context.AddError('const', schemaPath, instancePath, { allowedValue: schema.const });
24
+ return CheckConst(stack, context, schema, value) || context.AddError({
25
+ keyword: 'const',
26
+ schemaPath,
27
+ instancePath,
28
+ params: { allowedValue: schema.const },
29
+ });
26
30
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildContains(stack: Stack.XStack, context: BuildContext, schema: Schema.XContains, value: string): string;
5
- export declare function CheckContains(stack: Stack.XStack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
6
- export declare function ErrorContains(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
4
+ export declare function BuildContains(stack: Stack, context: BuildContext, schema: Schema.XContains, value: string): string;
5
+ export declare function CheckContains(stack: Stack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
6
+ export declare function ErrorContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
@@ -1,6 +1,6 @@
1
1
  // deno-fmt-ignore-file
2
2
  import * as Schema from '../types/index.mjs';
3
- import * as Unique from './_unique.mjs';
3
+ import { Unique } from './_unique.mjs';
4
4
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
5
5
  import { BuildSchema, CheckSchema } from './schema.mjs';
6
6
  // ------------------------------------------------------------------
@@ -13,13 +13,13 @@ function IsValid(schema) {
13
13
  // Build
14
14
  // ------------------------------------------------------------------
15
15
  function BuildContainsStandard(stack, context, schema, value) {
16
- const [item, index] = [Unique.CreateUnique(), Unique.CreateUnique()];
16
+ const [item, index] = [Unique(), Unique()];
17
17
  const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
18
18
  const isSome = E.SomeAll(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
19
19
  return E.And(isLength, isSome);
20
20
  }
21
21
  function BuildContainsFast(stack, context, schema, value) {
22
- const [item] = [Unique.CreateUnique()];
22
+ const [item] = [Unique()];
23
23
  const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
24
24
  const isSome = E.Some(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
25
25
  return E.And(isLength, isSome);
@@ -45,6 +45,10 @@ export function CheckContains(stack, context, schema, value) {
45
45
  // Error
46
46
  // ------------------------------------------------------------------
47
47
  export function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
48
- return CheckContains(stack, context, schema, value) ||
49
- context.AddError('contains', schemaPath, instancePath, { minContains: 1 });
48
+ return CheckContains(stack, context, schema, value) || context.AddError({
49
+ keyword: 'contains',
50
+ schemaPath,
51
+ instancePath,
52
+ params: { minContains: 1 },
53
+ });
50
54
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildDependencies(stack: Stack.XStack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
5
- export declare function CheckDependencies(stack: Stack.XStack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
6
- export declare function ErrorDependencies(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
4
+ export declare function BuildDependencies(stack: Stack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
5
+ export declare function CheckDependencies(stack: Stack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
6
+ export declare function ErrorDependencies(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
@@ -1,5 +1,4 @@
1
1
  // deno-fmt-ignore-file
2
- import * as Pathing from './_pathing.mjs';
3
2
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
4
3
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
4
  // ------------------------------------------------------------------
@@ -33,11 +32,14 @@ export function CheckDependencies(stack, context, schema, value) {
33
32
  export function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
34
33
  const isLength = G.IsEqual(G.Keys(value).length, 0);
35
34
  const isEvery = G.EveryAll(G.Entries(schema.dependencies), 0, ([key, schema]) => {
36
- const nextSchemaPath = `${schemaPath}/dependencies/${Pathing.EncodeFragment(key)}`;
35
+ const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
37
36
  return !G.HasPropertyKey(value, key) || (G.IsArray(schema)
38
- ? schema.every((dependency) => G.HasPropertyKey(value, dependency) ||
39
- context.AddError('dependencies', schemaPath, instancePath, { property: key, dependencies: schema }))
40
- : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
37
+ ? schema.every((dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
38
+ keyword: 'dependencies',
39
+ schemaPath,
40
+ instancePath,
41
+ params: { property: key, dependencies: schema },
42
+ })) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
41
43
  });
42
44
  return isLength || isEvery;
43
45
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildDependentRequired(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XDependentRequired, value: string): string;
5
- export declare function CheckDependentRequired(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
6
- export declare function ErrorDependentRequired(_stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
4
+ export declare function BuildDependentRequired(_stack: Stack, _context: BuildContext, schema: Schema.XDependentRequired, value: string): string;
5
+ export declare function CheckDependentRequired(_stack: Stack, _context: CheckContext, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
6
+ export declare function ErrorDependentRequired(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
@@ -29,8 +29,12 @@ export function CheckDependentRequired(_stack, _context, schema, value) {
29
29
  export function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
30
30
  const isLength = G.IsEqual(G.Keys(value).length, 0);
31
31
  const isEveryEntry = G.EveryAll(G.Entries(schema.dependentRequired), 0, ([key, keys]) => {
32
- return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) ||
33
- context.AddError('dependentRequired', schemaPath, instancePath, { property: key, dependencies: keys }));
32
+ return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
33
+ keyword: 'dependentRequired',
34
+ schemaPath,
35
+ instancePath,
36
+ params: { property: key, dependencies: keys },
37
+ }));
34
38
  });
35
39
  return isLength || isEveryEntry;
36
40
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildDependentSchemas(stack: Stack.XStack, context: BuildContext, schema: Schema.XDependentSchemas, value: string): string;
5
- export declare function CheckDependentSchemas(stack: Stack.XStack, context: CheckContext, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
6
- export declare function ErrorDependentSchemas(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
4
+ export declare function BuildDependentSchemas(stack: Stack, context: BuildContext, schema: Schema.XDependentSchemas, value: string): string;
5
+ export declare function CheckDependentSchemas(stack: Stack, context: CheckContext, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
6
+ export declare function ErrorDependentSchemas(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
@@ -1,5 +1,4 @@
1
1
  // deno-fmt-ignore-file
2
- import * as Pathing from './_pathing.mjs';
3
2
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
4
3
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
4
  // ------------------------------------------------------------------
@@ -31,7 +30,7 @@ export function CheckDependentSchemas(stack, context, schema, value) {
31
30
  export function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
32
31
  const isLength = G.IsEqual(G.Keys(value).length, 0);
33
32
  const isEvery = G.EveryAll(G.Entries(schema.dependentSchemas), 0, ([key, schema]) => {
34
- const nextSchemaPath = `${schemaPath}/dependentSchemas/${Pathing.EncodeFragment(key)}`;
33
+ const nextSchemaPath = `${schemaPath}/dependentSchemas/${key}`;
35
34
  return !G.HasPropertyKey(value, key) ||
36
35
  ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value);
37
36
  });
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildDynamicRef(stack: Stack.XStack, context: BuildContext, schema: Schema.XDynamicRef, value: string): string;
5
- export declare function CheckDynamicRef(stack: Stack.XStack, context: CheckContext, schema: Schema.XDynamicRef, value: unknown): boolean;
6
- export declare function ErrorDynamicRef(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDynamicRef, value: unknown): boolean;
4
+ export declare function BuildDynamicRef(stack: Stack, context: BuildContext, schema: Schema.XDynamicRef, value: string): string;
5
+ export declare function CheckDynamicRef(stack: Stack, context: CheckContext, schema: Schema.XDynamicRef, value: unknown): boolean;
6
+ export declare function ErrorDynamicRef(stack: Stack, context: ErrorContext, _schemaPath: string, instancePath: string, schema: Schema.XDynamicRef, value: unknown): boolean;
@@ -1,29 +1,25 @@
1
1
  // deno-fmt-ignore-file
2
- import * as Schema from '../types/index.mjs';
3
2
  import * as Functions from './_functions.mjs';
4
- import { Resolve } from '../resolve/index.mjs';
3
+ import * as Schema from '../types/index.mjs';
5
4
  import { CheckSchema, ErrorSchema } from './schema.mjs';
6
5
  // ------------------------------------------------------------------
7
6
  // Build
8
7
  // ------------------------------------------------------------------
9
8
  export function BuildDynamicRef(stack, context, schema, value) {
10
- const target = Resolve.DynamicRef(stack, schema) ?? false;
11
- const nextStack = target ? { ...stack, pendingResource: true } : stack;
12
- return Functions.CreateFunction(nextStack, context, target, value);
9
+ const target = stack.DynamicRef(schema) ?? false;
10
+ return Functions.CreateFunction(stack, context, target, value);
13
11
  }
14
12
  // ------------------------------------------------------------------
15
13
  // Check
16
14
  // ------------------------------------------------------------------
17
15
  export function CheckDynamicRef(stack, context, schema, value) {
18
- const target = Resolve.DynamicRef(stack, schema) ?? false;
19
- const nextStack = target ? { ...stack, pendingResource: true } : stack;
20
- return (Schema.IsSchema(target) && CheckSchema(nextStack, context, target, value));
16
+ const target = stack.DynamicRef(schema) ?? false;
17
+ return (Schema.IsSchema(target) && CheckSchema(stack, context, target, value));
21
18
  }
22
19
  // ------------------------------------------------------------------
23
20
  // Error
24
21
  // ------------------------------------------------------------------
25
- export function ErrorDynamicRef(stack, context, schemaPath, instancePath, schema, value) {
26
- const target = Resolve.DynamicRef(stack, schema) ?? false;
27
- const nextStack = target ? { ...stack, pendingResource: true } : stack;
28
- return (Schema.IsSchema(target) && ErrorSchema(nextStack, context, schemaPath, instancePath, target, value));
22
+ export function ErrorDynamicRef(stack, context, _schemaPath, instancePath, schema, value) {
23
+ const target = stack.DynamicRef(schema) ?? false;
24
+ return (Schema.IsSchema(target) && ErrorSchema(stack, context, '#', instancePath, target, value));
29
25
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildEnum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XEnum, value: string): string;
5
- export declare function CheckEnum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XEnum, value: unknown): boolean;
6
- export declare function ErrorEnum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
4
+ export declare function BuildEnum(_stack: Stack, _context: BuildContext, schema: Schema.XEnum, value: string): string;
5
+ export declare function CheckEnum(_stack: Stack, _context: CheckContext, schema: Schema.XEnum, value: unknown): boolean;
6
+ export declare function ErrorEnum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
@@ -24,6 +24,10 @@ export function CheckEnum(_stack, _context, schema, value) {
24
24
  // Error
25
25
  // ------------------------------------------------------------------
26
26
  export function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
27
- return CheckEnum(stack, context, schema, value) ||
28
- context.AddError('enum', schemaPath, instancePath, { allowedValues: schema.enum });
27
+ return CheckEnum(stack, context, schema, value) || context.AddError({
28
+ keyword: 'enum',
29
+ schemaPath,
30
+ instancePath,
31
+ params: { allowedValues: schema.enum }
32
+ });
29
33
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildExclusiveMaximum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XExclusiveMaximum, value: string): string;
5
- export declare function CheckExclusiveMaximum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
6
- export declare function ErrorExclusiveMaximum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
4
+ export declare function BuildExclusiveMaximum(_stack: Stack, _context: BuildContext, schema: Schema.XExclusiveMaximum, value: string): string;
5
+ export declare function CheckExclusiveMaximum(_stack: Stack, _context: CheckContext, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
6
+ export declare function ErrorExclusiveMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
@@ -16,6 +16,10 @@ export function CheckExclusiveMaximum(_stack, _context, schema, value) {
16
16
  // Error
17
17
  // ------------------------------------------------------------------
18
18
  export function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
19
- return CheckExclusiveMaximum(stack, context, schema, value) ||
20
- context.AddError('exclusiveMaximum', schemaPath, instancePath, { comparison: '<', limit: schema.exclusiveMaximum });
19
+ return CheckExclusiveMaximum(stack, context, schema, value) || context.AddError({
20
+ keyword: 'exclusiveMaximum',
21
+ schemaPath,
22
+ instancePath,
23
+ params: { comparison: '<', limit: schema.exclusiveMaximum }
24
+ });
21
25
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildExclusiveMinimum(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XExclusiveMinimum, value: string): string;
5
- export declare function CheckExclusiveMinimum(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
6
- export declare function ErrorExclusiveMinimum(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
4
+ export declare function BuildExclusiveMinimum(_stack: Stack, _context: BuildContext, schema: Schema.XExclusiveMinimum, value: string): string;
5
+ export declare function CheckExclusiveMinimum(_stack: Stack, _context: CheckContext, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
6
+ export declare function ErrorExclusiveMinimum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
@@ -16,6 +16,10 @@ export function CheckExclusiveMinimum(_stack, _context, schema, value) {
16
16
  // Error
17
17
  // ------------------------------------------------------------------
18
18
  export function ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value) {
19
- return CheckExclusiveMinimum(stack, context, schema, value) ||
20
- context.AddError('exclusiveMinimum', schemaPath, instancePath, { comparison: '>', limit: schema.exclusiveMinimum });
19
+ return CheckExclusiveMinimum(stack, context, schema, value) || context.AddError({
20
+ keyword: 'exclusiveMinimum',
21
+ schemaPath,
22
+ instancePath,
23
+ params: { comparison: '>', limit: schema.exclusiveMinimum }
24
+ });
21
25
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildFormat(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XFormat, value: string): string;
5
- export declare function CheckFormat(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XFormat, value: string): boolean;
6
- export declare function ErrorFormat(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
4
+ export declare function BuildFormat(_stack: Stack, _context: BuildContext, schema: Schema.XFormat, value: string): string;
5
+ export declare function CheckFormat(_stack: Stack, _context: CheckContext, schema: Schema.XFormat, value: string): boolean;
6
+ export declare function ErrorFormat(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
@@ -1,18 +1,11 @@
1
1
  // deno-fmt-ignore-file
2
- import * as Externals from './_externals.mjs';
3
2
  import { Format } from '../../format/index.mjs';
4
3
  import { EmitGuard as E } from '../../guard/index.mjs';
5
4
  // ------------------------------------------------------------------
6
- // Build (Remote)
7
- // ------------------------------------------------------------------
8
- // export function BuildFormat(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XFormat, value: string): string {
9
- // return E.Call(E.Member('Format', 'Test'), [E.Constant(schema.format), value])
10
- // }
11
- // ------------------------------------------------------------------
12
- // Build (Inline)
5
+ // Build
13
6
  // ------------------------------------------------------------------
14
7
  export function BuildFormat(_stack, _context, schema, value) {
15
- return Format.Has(schema.format) ? E.Call(Externals.CreateVariable(Format.Get(schema.format)), [value]) : E.Constant(true);
8
+ return E.Call(E.Member('Format', 'Test'), [E.Constant(schema.format), value]);
16
9
  }
17
10
  // ------------------------------------------------------------------
18
11
  // Check
@@ -24,6 +17,10 @@ export function CheckFormat(_stack, _context, schema, value) {
24
17
  // Error
25
18
  // ------------------------------------------------------------------
26
19
  export function ErrorFormat(stack, context, schemaPath, instancePath, schema, value) {
27
- return CheckFormat(stack, context, schema, value) ||
28
- context.AddError('format', schemaPath, instancePath, { format: schema.format });
20
+ return CheckFormat(stack, context, schema, value) || context.AddError({
21
+ keyword: 'format',
22
+ schemaPath,
23
+ instancePath,
24
+ params: { format: schema.format },
25
+ });
29
26
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import * as Stack from './_stack.mjs';
2
+ import { Stack } from './_stack.mjs';
3
3
  import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
4
- export declare function BuildIf(stack: Stack.XStack, context: BuildContext, schema: Schema.XIf, value: string): string;
5
- export declare function CheckIf(stack: Stack.XStack, context: CheckContext, schema: Schema.XIf, value: unknown): boolean;
6
- export declare function ErrorIf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XIf, value: unknown): boolean;
4
+ export declare function BuildIf(stack: Stack, context: BuildContext, schema: Schema.XIf, value: string): string;
5
+ export declare function CheckIf(stack: Stack, context: CheckContext, schema: Schema.XIf, value: unknown): boolean;
6
+ export declare function ErrorIf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XIf, value: unknown): boolean;
@@ -1,8 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
2
  import * as Schema from '../types/index.mjs';
3
3
  import { ErrorContext } from './_context.mjs';
4
- import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
4
  import { EmitGuard as E } from '../../guard/index.mjs';
5
+ import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // Build
8
8
  // ------------------------------------------------------------------
@@ -29,10 +29,18 @@ export function ErrorIf(stack, context, schemaPath, instancePath, schema, value)
29
29
  const elseSchema = Schema.IsElse(schema) ? schema.else : true;
30
30
  const trueContext = new ErrorContext();
31
31
  const isIf = ErrorSchema(stack, trueContext, `${schemaPath}/if`, instancePath, schema.if, value)
32
- ? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) ||
33
- context.AddError('if', schemaPath, instancePath, { failingKeyword: 'then' })
34
- : ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) ||
35
- context.AddError('if', schemaPath, instancePath, { failingKeyword: 'else' });
32
+ ? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) || context.AddError({
33
+ keyword: 'if',
34
+ schemaPath,
35
+ instancePath,
36
+ params: { failingKeyword: 'then' },
37
+ })
38
+ : ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) || context.AddError({
39
+ keyword: 'if',
40
+ schemaPath,
41
+ instancePath,
42
+ params: { failingKeyword: 'else' },
43
+ });
36
44
  if (isIf)
37
45
  context.Merge([trueContext]);
38
46
  return isIf;
@@ -4,7 +4,6 @@ export * from './_functions.mjs';
4
4
  export * from './_reducer.mjs';
5
5
  export * from './_refine.mjs';
6
6
  export * from './_stack.mjs';
7
- export * from './_unique.mjs';
8
7
  export * from './additionalItems.mjs';
9
8
  export * from './additionalProperties.mjs';
10
9
  export * from './allOf.mjs';
@@ -7,7 +7,6 @@ export * from './_functions.mjs';
7
7
  export * from './_reducer.mjs';
8
8
  export * from './_refine.mjs';
9
9
  export * from './_stack.mjs';
10
- export * from './_unique.mjs';
11
10
  // ------------------------------------------------------------------
12
11
  // Schematics
13
12
  // ------------------------------------------------------------------