@spotlightjs/spotlight 4.11.3 → 4.11.5

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 (191) hide show
  1. package/dist/_virtual/ajv.js +6 -3
  2. package/dist/_virtual/ajv2.js +13 -0
  3. package/dist/_virtual/index.js +6 -3
  4. package/dist/_virtual/index10.js +3 -3
  5. package/dist/_virtual/index11.js +3 -3
  6. package/dist/_virtual/index12.js +13 -0
  7. package/dist/_virtual/index2.js +3 -3
  8. package/dist/_virtual/index4.js +3 -3
  9. package/dist/_virtual/index5.js +3 -3
  10. package/dist/_virtual/index6.js +3 -3
  11. package/dist/_virtual/index7.js +3 -3
  12. package/dist/_virtual/index8.js +3 -3
  13. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +1 -1
  14. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -1
  15. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +3 -3
  16. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js +203 -194
  17. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js.map +1 -1
  18. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js +47 -47
  19. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js.map +1 -1
  20. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js +77 -69
  21. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js.map +1 -1
  22. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js +80 -85
  23. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js.map +1 -1
  24. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js +145 -136
  25. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
  26. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js +692 -685
  27. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js.map +1 -1
  28. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js +143 -135
  29. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -1
  30. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js +122 -116
  31. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js.map +1 -1
  32. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js +218 -218
  33. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js.map +1 -1
  34. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js +43 -35
  35. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js.map +1 -1
  36. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js +19 -11
  37. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js.map +1 -1
  38. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js +149 -144
  39. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js.map +1 -1
  40. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js +31 -25
  41. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js.map +1 -1
  42. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js +164 -160
  43. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js.map +1 -1
  44. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -17
  45. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -1
  46. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js +52 -49
  47. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -1
  48. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js +174 -173
  49. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -1
  50. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js +36 -32
  51. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -1
  52. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js +473 -478
  53. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
  54. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -111
  55. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -1
  56. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js +81 -77
  57. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -1
  58. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js +573 -574
  59. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js.map +1 -1
  60. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json.js +3 -17
  61. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.json.js.map +1 -1
  62. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +4 -236
  63. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -1
  64. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js +16 -7
  65. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js.map +1 -1
  66. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js +27 -18
  67. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -1
  68. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js +16 -7
  69. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js.map +1 -1
  70. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js +17 -8
  71. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js.map +1 -1
  72. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +55 -48
  73. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -1
  74. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +104 -99
  75. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
  76. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +30 -22
  77. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
  78. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +20 -12
  79. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -1
  80. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -88
  81. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -1
  82. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +94 -88
  83. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -1
  84. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js +71 -64
  85. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -1
  86. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js +66 -73
  87. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -1
  88. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js +60 -54
  89. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -1
  90. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +41 -36
  91. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -1
  92. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js +34 -26
  93. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -1
  94. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -53
  95. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -1
  96. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +73 -67
  97. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -1
  98. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +20 -12
  99. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -1
  100. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +62 -57
  101. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
  102. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +46 -39
  103. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -1
  104. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +21 -13
  105. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -1
  106. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js +132 -129
  107. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
  108. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js +17 -8
  109. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -1
  110. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js +27 -20
  111. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -1
  112. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js +121 -118
  113. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
  114. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +103 -99
  115. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
  116. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +15 -9
  117. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -1
  118. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js +30 -26
  119. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -1
  120. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js +84 -76
  121. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -1
  122. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js +16 -8
  123. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -1
  124. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js +24 -18
  125. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
  126. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js +33 -27
  127. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -1
  128. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js +53 -47
  129. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -1
  130. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js +52 -53
  131. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
  132. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +32 -24
  133. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -1
  134. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +37 -31
  135. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -1
  136. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +35 -27
  137. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -1
  138. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +32 -24
  139. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -1
  140. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +31 -23
  141. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -1
  142. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +41 -35
  143. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -1
  144. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js +80 -74
  145. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
  146. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +71 -66
  147. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -1
  148. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +34 -27
  149. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -1
  150. package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js +300 -0
  151. package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/index.js.map +1 -0
  152. package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/schemes.js +223 -0
  153. package/dist/node_modules/.pnpm/{fast-uri@3.1.0 → fast-uri@3.1.2}/node_modules/fast-uri/lib/schemes.js.map +1 -1
  154. package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js +325 -0
  155. package/dist/node_modules/.pnpm/fast-uri@3.1.2/node_modules/fast-uri/lib/utils.js.map +1 -0
  156. package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/helper/streaming/sse.js.map +1 -0
  157. package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/middleware/cors/index.js +8 -8
  158. package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/middleware/cors/index.js.map +1 -0
  159. package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/utils/html.js.map +1 -0
  160. package/dist/node_modules/.pnpm/hono@4.12.18/node_modules/hono/dist/utils/stream.js.map +1 -0
  161. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +83 -78
  162. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js.map +1 -1
  163. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.1.13/node_modules/zod-to-json-schema/dist/esm/Options.js +1 -1
  164. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.1.13/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -1
  165. package/dist/node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js +1 -1
  166. package/dist/node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/core/util.js.map +1 -1
  167. package/dist/sentry-config.js +2 -2
  168. package/dist/server/cli/run.js +2 -2
  169. package/dist/server/cli.js +2 -2
  170. package/dist/server/main.js +2 -2
  171. package/dist/server/mcp/mcp.js +2 -2
  172. package/dist/server/routes/stream/streaming.js +2 -2
  173. package/dist/ui/assets/index.js +61 -70
  174. package/dist/ui/assets/index2.js +1 -1
  175. package/dist/ui/assets/instrumentation.js +18 -18
  176. package/dist/ui/assets/main.css +1 -1
  177. package/dist/ui/assets/main.js +1 -1
  178. package/dist/ui/assets/serverTimingMeta.js +23 -30
  179. package/package.json +9 -9
  180. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +0 -264
  181. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js.map +0 -1
  182. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +0 -197
  183. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +0 -261
  184. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js.map +0 -1
  185. package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/helper/streaming/sse.js.map +0 -1
  186. package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/middleware/cors/index.js.map +0 -1
  187. package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/utils/html.js.map +0 -1
  188. package/dist/node_modules/.pnpm/hono@4.12.8/node_modules/hono/dist/utils/stream.js.map +0 -1
  189. /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/helper/streaming/sse.js +0 -0
  190. /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/utils/html.js +0 -0
  191. /package/dist/node_modules/.pnpm/{hono@4.12.8 → hono@4.12.18}/node_modules/hono/dist/utils/stream.js +0 -0
@@ -2,636 +2,635 @@
2
2
  !(function() {
3
3
  try {
4
4
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
5
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "fa6432fa-9b52-414d-bdee-0e4f5c16ebc9", e._sentryDebugIdIdentifier = "sentry-dbid-fa6432fa-9b52-414d-bdee-0e4f5c16ebc9");
5
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c8f163c9-517a-47f2-904c-28e555b29a77", e._sentryDebugIdIdentifier = "sentry-dbid-c8f163c9-517a-47f2-904c-28e555b29a77");
6
6
  } catch (e2) {
7
7
  }
8
8
  })();
9
9
  import { __exports as core } from "../../../../../../_virtual/core.js";
10
- import "./compile/validate/index.js";
11
- import "./compile/codegen/index.js";
12
- import "./runtime/validation_error.js";
13
- import "./compile/ref_error.js";
14
- import "./compile/rules.js";
15
- import "./compile/index.js";
16
- import "./compile/resolve.js";
17
- import "./compile/validate/dataType.js";
18
- import "./compile/util.js";
10
+ import { __require as requireValidate } from "./compile/validate/index.js";
11
+ import { __require as requireCodegen } from "./compile/codegen/index.js";
12
+ import { __require as requireValidation_error } from "./runtime/validation_error.js";
13
+ import { __require as requireRef_error } from "./compile/ref_error.js";
14
+ import { __require as requireRules } from "./compile/rules.js";
15
+ import { __require as requireCompile } from "./compile/index.js";
16
+ import { __require as requireResolve } from "./compile/resolve.js";
17
+ import { __require as requireDataType } from "./compile/validate/dataType.js";
18
+ import { __require as requireUtil } from "./compile/util.js";
19
19
  import require$$9 from "./refs/data.json.js";
20
- import "./runtime/uri.js";
21
- import { __exports as validate } from "../../../../../../_virtual/index.js";
22
- import { __exports as codegen } from "../../../../../../_virtual/index2.js";
23
- import { __exports as validation_error } from "../../../../../../_virtual/validation_error.js";
24
- import { __exports as ref_error } from "../../../../../../_virtual/ref_error.js";
25
- import { __exports as rules } from "../../../../../../_virtual/rules.js";
26
- import { __exports as resolve } from "../../../../../../_virtual/resolve.js";
27
- import { __exports as compile } from "../../../../../../_virtual/index5.js";
28
- import { __exports as util } from "../../../../../../_virtual/util.js";
29
- import { __exports as dataType } from "../../../../../../_virtual/dataType.js";
30
- import { __exports as uri } from "../../../../../../_virtual/uri.js";
31
- (function(exports$1) {
32
- Object.defineProperty(exports$1, "__esModule", { value: true });
33
- exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
34
- var validate_1 = validate;
35
- Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
36
- return validate_1.KeywordCxt;
37
- } });
38
- var codegen_1 = codegen;
39
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
40
- return codegen_1._;
41
- } });
42
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
43
- return codegen_1.str;
44
- } });
45
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
46
- return codegen_1.stringify;
47
- } });
48
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
49
- return codegen_1.nil;
50
- } });
51
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
52
- return codegen_1.Name;
53
- } });
54
- Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
55
- return codegen_1.CodeGen;
56
- } });
57
- const validation_error_1 = validation_error;
58
- const ref_error_1 = ref_error;
59
- const rules_1 = rules;
60
- const compile_1 = compile;
61
- const codegen_2 = codegen;
62
- const resolve_1 = resolve;
63
- const dataType_1 = dataType;
64
- const util_1 = util;
65
- const $dataRefSchema = require$$9;
66
- const uri_1 = uri;
67
- const defaultRegExp = (str, flags) => new RegExp(str, flags);
68
- defaultRegExp.code = "new RegExp";
69
- const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
70
- const EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
71
- "validate",
72
- "serialize",
73
- "parse",
74
- "wrapper",
75
- "root",
76
- "schema",
77
- "keyword",
78
- "pattern",
79
- "formats",
80
- "validate$data",
81
- "func",
82
- "obj",
83
- "Error"
84
- ]);
85
- const removedOptions = {
86
- errorDataPath: "",
87
- format: "`validateFormats: false` can be used instead.",
88
- nullable: '"nullable" keyword is supported by default.',
89
- jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
90
- extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
91
- missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
92
- processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
93
- sourceCode: "Use option `code: {source: true}`",
94
- strictDefaults: "It is default now, see option `strict`.",
95
- strictKeywords: "It is default now, see option `strict`.",
96
- uniqueItems: '"uniqueItems" keyword is always validated.',
97
- unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
98
- cache: "Map is used as cache, schema object as key.",
99
- serialize: "Map is used as cache, schema object as key.",
100
- ajvErrors: "It is default now."
101
- };
102
- const deprecatedOptions = {
103
- ignoreKeywordsWithRef: "",
104
- jsPropertySyntax: "",
105
- unicode: '"minLength"/"maxLength" account for unicode characters by default.'
106
- };
107
- const MAX_EXPRESSION = 200;
108
- function requiredOptions(o) {
109
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
110
- const s = o.strict;
111
- const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
112
- const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
113
- const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
114
- const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
115
- return {
116
- strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
117
- strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
118
- strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
119
- strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
120
- strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
121
- code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
122
- loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
123
- loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
124
- meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
125
- messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
126
- inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
127
- schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
128
- addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
129
- validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
130
- validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
131
- unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
132
- int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
133
- uriResolver
20
+ import { __require as requireUri } from "./runtime/uri.js";
21
+ var hasRequiredCore;
22
+ function requireCore() {
23
+ if (hasRequiredCore) return core;
24
+ hasRequiredCore = 1;
25
+ (function(exports$1) {
26
+ Object.defineProperty(exports$1, "__esModule", { value: true });
27
+ exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
28
+ var validate_1 = /* @__PURE__ */ requireValidate();
29
+ Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
30
+ return validate_1.KeywordCxt;
31
+ } });
32
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
33
+ Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
34
+ return codegen_1._;
35
+ } });
36
+ Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
37
+ return codegen_1.str;
38
+ } });
39
+ Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
40
+ return codegen_1.stringify;
41
+ } });
42
+ Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
43
+ return codegen_1.nil;
44
+ } });
45
+ Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
46
+ return codegen_1.Name;
47
+ } });
48
+ Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
49
+ return codegen_1.CodeGen;
50
+ } });
51
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
52
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
53
+ const rules_1 = /* @__PURE__ */ requireRules();
54
+ const compile_1 = /* @__PURE__ */ requireCompile();
55
+ const codegen_2 = /* @__PURE__ */ requireCodegen();
56
+ const resolve_1 = /* @__PURE__ */ requireResolve();
57
+ const dataType_1 = /* @__PURE__ */ requireDataType();
58
+ const util_1 = /* @__PURE__ */ requireUtil();
59
+ const $dataRefSchema = require$$9;
60
+ const uri_1 = /* @__PURE__ */ requireUri();
61
+ const defaultRegExp = (str, flags) => new RegExp(str, flags);
62
+ defaultRegExp.code = "new RegExp";
63
+ const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
64
+ const EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
65
+ "validate",
66
+ "serialize",
67
+ "parse",
68
+ "wrapper",
69
+ "root",
70
+ "schema",
71
+ "keyword",
72
+ "pattern",
73
+ "formats",
74
+ "validate$data",
75
+ "func",
76
+ "obj",
77
+ "Error"
78
+ ]);
79
+ const removedOptions = {
80
+ errorDataPath: "",
81
+ format: "`validateFormats: false` can be used instead.",
82
+ nullable: '"nullable" keyword is supported by default.',
83
+ jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
84
+ extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
85
+ missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
86
+ processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
87
+ sourceCode: "Use option `code: {source: true}`",
88
+ strictDefaults: "It is default now, see option `strict`.",
89
+ strictKeywords: "It is default now, see option `strict`.",
90
+ uniqueItems: '"uniqueItems" keyword is always validated.',
91
+ unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
92
+ cache: "Map is used as cache, schema object as key.",
93
+ serialize: "Map is used as cache, schema object as key.",
94
+ ajvErrors: "It is default now."
134
95
  };
135
- }
136
- class Ajv {
137
- constructor(opts = {}) {
138
- this.schemas = {};
139
- this.refs = {};
140
- this.formats = {};
141
- this._compilations = /* @__PURE__ */ new Set();
142
- this._loading = {};
143
- this._cache = /* @__PURE__ */ new Map();
144
- opts = this.opts = { ...opts, ...requiredOptions(opts) };
145
- const { es5, lines } = this.opts.code;
146
- this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
147
- this.logger = getLogger(opts.logger);
148
- const formatOpt = opts.validateFormats;
149
- opts.validateFormats = false;
150
- this.RULES = (0, rules_1.getRules)();
151
- checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
152
- checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
153
- this._metaOpts = getMetaSchemaOptions.call(this);
154
- if (opts.formats)
155
- addInitialFormats.call(this);
156
- this._addVocabularies();
157
- this._addDefaultMetaSchema();
158
- if (opts.keywords)
159
- addInitialKeywords.call(this, opts.keywords);
160
- if (typeof opts.meta == "object")
161
- this.addMetaSchema(opts.meta);
162
- addInitialSchemas.call(this);
163
- opts.validateFormats = formatOpt;
164
- }
165
- _addVocabularies() {
166
- this.addKeyword("$async");
96
+ const deprecatedOptions = {
97
+ ignoreKeywordsWithRef: "",
98
+ jsPropertySyntax: "",
99
+ unicode: '"minLength"/"maxLength" account for unicode characters by default.'
100
+ };
101
+ const MAX_EXPRESSION = 200;
102
+ function requiredOptions(o) {
103
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
104
+ const s = o.strict;
105
+ const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
106
+ const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
107
+ const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
108
+ const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
109
+ return {
110
+ strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
111
+ strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
112
+ strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
113
+ strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
114
+ strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
115
+ code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
116
+ loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
117
+ loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
118
+ meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
119
+ messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
120
+ inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
121
+ schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
122
+ addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
123
+ validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
124
+ validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
125
+ unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
126
+ int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
127
+ uriResolver
128
+ };
167
129
  }
168
- _addDefaultMetaSchema() {
169
- const { $data, meta, schemaId } = this.opts;
170
- let _dataRefSchema = $dataRefSchema;
171
- if (schemaId === "id") {
172
- _dataRefSchema = { ...$dataRefSchema };
173
- _dataRefSchema.id = _dataRefSchema.$id;
174
- delete _dataRefSchema.$id;
130
+ class Ajv {
131
+ constructor(opts = {}) {
132
+ this.schemas = {};
133
+ this.refs = {};
134
+ this.formats = {};
135
+ this._compilations = /* @__PURE__ */ new Set();
136
+ this._loading = {};
137
+ this._cache = /* @__PURE__ */ new Map();
138
+ opts = this.opts = { ...opts, ...requiredOptions(opts) };
139
+ const { es5, lines } = this.opts.code;
140
+ this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
141
+ this.logger = getLogger(opts.logger);
142
+ const formatOpt = opts.validateFormats;
143
+ opts.validateFormats = false;
144
+ this.RULES = (0, rules_1.getRules)();
145
+ checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
146
+ checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
147
+ this._metaOpts = getMetaSchemaOptions.call(this);
148
+ if (opts.formats)
149
+ addInitialFormats.call(this);
150
+ this._addVocabularies();
151
+ this._addDefaultMetaSchema();
152
+ if (opts.keywords)
153
+ addInitialKeywords.call(this, opts.keywords);
154
+ if (typeof opts.meta == "object")
155
+ this.addMetaSchema(opts.meta);
156
+ addInitialSchemas.call(this);
157
+ opts.validateFormats = formatOpt;
175
158
  }
176
- if (meta && $data)
177
- this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
178
- }
179
- defaultMeta() {
180
- const { meta, schemaId } = this.opts;
181
- return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
182
- }
183
- validate(schemaKeyRef, data) {
184
- let v;
185
- if (typeof schemaKeyRef == "string") {
186
- v = this.getSchema(schemaKeyRef);
187
- if (!v)
188
- throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
189
- } else {
190
- v = this.compile(schemaKeyRef);
159
+ _addVocabularies() {
160
+ this.addKeyword("$async");
191
161
  }
192
- const valid = v(data);
193
- if (!("$async" in v))
194
- this.errors = v.errors;
195
- return valid;
196
- }
197
- compile(schema, _meta) {
198
- const sch = this._addSchema(schema, _meta);
199
- return sch.validate || this._compileSchemaEnv(sch);
200
- }
201
- compileAsync(schema, meta) {
202
- if (typeof this.opts.loadSchema != "function") {
203
- throw new Error("options.loadSchema should be a function");
162
+ _addDefaultMetaSchema() {
163
+ const { $data, meta, schemaId } = this.opts;
164
+ let _dataRefSchema = $dataRefSchema;
165
+ if (schemaId === "id") {
166
+ _dataRefSchema = { ...$dataRefSchema };
167
+ _dataRefSchema.id = _dataRefSchema.$id;
168
+ delete _dataRefSchema.$id;
169
+ }
170
+ if (meta && $data)
171
+ this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
204
172
  }
205
- const { loadSchema } = this.opts;
206
- return runCompileAsync.call(this, schema, meta);
207
- async function runCompileAsync(_schema, _meta) {
208
- await loadMetaSchema.call(this, _schema.$schema);
209
- const sch = this._addSchema(_schema, _meta);
210
- return sch.validate || _compileAsync.call(this, sch);
173
+ defaultMeta() {
174
+ const { meta, schemaId } = this.opts;
175
+ return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
211
176
  }
212
- async function loadMetaSchema($ref) {
213
- if ($ref && !this.getSchema($ref)) {
214
- await runCompileAsync.call(this, { $ref }, true);
177
+ validate(schemaKeyRef, data) {
178
+ let v;
179
+ if (typeof schemaKeyRef == "string") {
180
+ v = this.getSchema(schemaKeyRef);
181
+ if (!v)
182
+ throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
183
+ } else {
184
+ v = this.compile(schemaKeyRef);
215
185
  }
186
+ const valid = v(data);
187
+ if (!("$async" in v))
188
+ this.errors = v.errors;
189
+ return valid;
216
190
  }
217
- async function _compileAsync(sch) {
218
- try {
219
- return this._compileSchemaEnv(sch);
220
- } catch (e) {
221
- if (!(e instanceof ref_error_1.default))
222
- throw e;
223
- checkLoaded.call(this, e);
224
- await loadMissingSchema.call(this, e.missingSchema);
225
- return _compileAsync.call(this, sch);
226
- }
191
+ compile(schema, _meta) {
192
+ const sch = this._addSchema(schema, _meta);
193
+ return sch.validate || this._compileSchemaEnv(sch);
227
194
  }
228
- function checkLoaded({ missingSchema: ref, missingRef }) {
229
- if (this.refs[ref]) {
230
- throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
195
+ compileAsync(schema, meta) {
196
+ if (typeof this.opts.loadSchema != "function") {
197
+ throw new Error("options.loadSchema should be a function");
231
198
  }
232
- }
233
- async function loadMissingSchema(ref) {
234
- const _schema = await _loadSchema.call(this, ref);
235
- if (!this.refs[ref])
199
+ const { loadSchema } = this.opts;
200
+ return runCompileAsync.call(this, schema, meta);
201
+ async function runCompileAsync(_schema, _meta) {
236
202
  await loadMetaSchema.call(this, _schema.$schema);
237
- if (!this.refs[ref])
238
- this.addSchema(_schema, ref, meta);
203
+ const sch = this._addSchema(_schema, _meta);
204
+ return sch.validate || _compileAsync.call(this, sch);
205
+ }
206
+ async function loadMetaSchema($ref) {
207
+ if ($ref && !this.getSchema($ref)) {
208
+ await runCompileAsync.call(this, { $ref }, true);
209
+ }
210
+ }
211
+ async function _compileAsync(sch) {
212
+ try {
213
+ return this._compileSchemaEnv(sch);
214
+ } catch (e) {
215
+ if (!(e instanceof ref_error_1.default))
216
+ throw e;
217
+ checkLoaded.call(this, e);
218
+ await loadMissingSchema.call(this, e.missingSchema);
219
+ return _compileAsync.call(this, sch);
220
+ }
221
+ }
222
+ function checkLoaded({ missingSchema: ref, missingRef }) {
223
+ if (this.refs[ref]) {
224
+ throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
225
+ }
226
+ }
227
+ async function loadMissingSchema(ref) {
228
+ const _schema = await _loadSchema.call(this, ref);
229
+ if (!this.refs[ref])
230
+ await loadMetaSchema.call(this, _schema.$schema);
231
+ if (!this.refs[ref])
232
+ this.addSchema(_schema, ref, meta);
233
+ }
234
+ async function _loadSchema(ref) {
235
+ const p = this._loading[ref];
236
+ if (p)
237
+ return p;
238
+ try {
239
+ return await (this._loading[ref] = loadSchema(ref));
240
+ } finally {
241
+ delete this._loading[ref];
242
+ }
243
+ }
239
244
  }
240
- async function _loadSchema(ref) {
241
- const p = this._loading[ref];
242
- if (p)
243
- return p;
244
- try {
245
- return await (this._loading[ref] = loadSchema(ref));
246
- } finally {
247
- delete this._loading[ref];
245
+ // Adds schema to the instance
246
+ addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
247
+ if (Array.isArray(schema)) {
248
+ for (const sch of schema)
249
+ this.addSchema(sch, void 0, _meta, _validateSchema);
250
+ return this;
248
251
  }
252
+ let id;
253
+ if (typeof schema === "object") {
254
+ const { schemaId } = this.opts;
255
+ id = schema[schemaId];
256
+ if (id !== void 0 && typeof id != "string") {
257
+ throw new Error(`schema ${schemaId} must be string`);
258
+ }
259
+ }
260
+ key = (0, resolve_1.normalizeId)(key || id);
261
+ this._checkUnique(key);
262
+ this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
263
+ return this;
249
264
  }
250
- }
251
- // Adds schema to the instance
252
- addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
253
- if (Array.isArray(schema)) {
254
- for (const sch of schema)
255
- this.addSchema(sch, void 0, _meta, _validateSchema);
265
+ // Add schema that will be used to validate other schemas
266
+ // options in META_IGNORE_OPTIONS are alway set to false
267
+ addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
268
+ this.addSchema(schema, key, true, _validateSchema);
256
269
  return this;
257
270
  }
258
- let id;
259
- if (typeof schema === "object") {
260
- const { schemaId } = this.opts;
261
- id = schema[schemaId];
262
- if (id !== void 0 && typeof id != "string") {
263
- throw new Error(`schema ${schemaId} must be string`);
271
+ // Validate schema against its meta-schema
272
+ validateSchema(schema, throwOrLogError) {
273
+ if (typeof schema == "boolean")
274
+ return true;
275
+ let $schema;
276
+ $schema = schema.$schema;
277
+ if ($schema !== void 0 && typeof $schema != "string") {
278
+ throw new Error("$schema must be a string");
264
279
  }
280
+ $schema = $schema || this.opts.defaultMeta || this.defaultMeta();
281
+ if (!$schema) {
282
+ this.logger.warn("meta-schema not available");
283
+ this.errors = null;
284
+ return true;
285
+ }
286
+ const valid = this.validate($schema, schema);
287
+ if (!valid && throwOrLogError) {
288
+ const message = "schema is invalid: " + this.errorsText();
289
+ if (this.opts.validateSchema === "log")
290
+ this.logger.error(message);
291
+ else
292
+ throw new Error(message);
293
+ }
294
+ return valid;
265
295
  }
266
- key = (0, resolve_1.normalizeId)(key || id);
267
- this._checkUnique(key);
268
- this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
269
- return this;
270
- }
271
- // Add schema that will be used to validate other schemas
272
- // options in META_IGNORE_OPTIONS are alway set to false
273
- addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
274
- this.addSchema(schema, key, true, _validateSchema);
275
- return this;
276
- }
277
- // Validate schema against its meta-schema
278
- validateSchema(schema, throwOrLogError) {
279
- if (typeof schema == "boolean")
280
- return true;
281
- let $schema;
282
- $schema = schema.$schema;
283
- if ($schema !== void 0 && typeof $schema != "string") {
284
- throw new Error("$schema must be a string");
285
- }
286
- $schema = $schema || this.opts.defaultMeta || this.defaultMeta();
287
- if (!$schema) {
288
- this.logger.warn("meta-schema not available");
289
- this.errors = null;
290
- return true;
291
- }
292
- const valid = this.validate($schema, schema);
293
- if (!valid && throwOrLogError) {
294
- const message = "schema is invalid: " + this.errorsText();
295
- if (this.opts.validateSchema === "log")
296
- this.logger.error(message);
297
- else
298
- throw new Error(message);
296
+ // Get compiled schema by `key` or `ref`.
297
+ // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
298
+ getSchema(keyRef) {
299
+ let sch;
300
+ while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
301
+ keyRef = sch;
302
+ if (sch === void 0) {
303
+ const { schemaId } = this.opts;
304
+ const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
305
+ sch = compile_1.resolveSchema.call(this, root, keyRef);
306
+ if (!sch)
307
+ return;
308
+ this.refs[keyRef] = sch;
309
+ }
310
+ return sch.validate || this._compileSchemaEnv(sch);
299
311
  }
300
- return valid;
301
- }
302
- // Get compiled schema by `key` or `ref`.
303
- // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
304
- getSchema(keyRef) {
305
- let sch;
306
- while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
307
- keyRef = sch;
308
- if (sch === void 0) {
309
- const { schemaId } = this.opts;
310
- const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
311
- sch = compile_1.resolveSchema.call(this, root, keyRef);
312
- if (!sch)
313
- return;
314
- this.refs[keyRef] = sch;
312
+ // Remove cached schema(s).
313
+ // If no parameter is passed all schemas but meta-schemas are removed.
314
+ // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
315
+ // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
316
+ removeSchema(schemaKeyRef) {
317
+ if (schemaKeyRef instanceof RegExp) {
318
+ this._removeAllSchemas(this.schemas, schemaKeyRef);
319
+ this._removeAllSchemas(this.refs, schemaKeyRef);
320
+ return this;
321
+ }
322
+ switch (typeof schemaKeyRef) {
323
+ case "undefined":
324
+ this._removeAllSchemas(this.schemas);
325
+ this._removeAllSchemas(this.refs);
326
+ this._cache.clear();
327
+ return this;
328
+ case "string": {
329
+ const sch = getSchEnv.call(this, schemaKeyRef);
330
+ if (typeof sch == "object")
331
+ this._cache.delete(sch.schema);
332
+ delete this.schemas[schemaKeyRef];
333
+ delete this.refs[schemaKeyRef];
334
+ return this;
335
+ }
336
+ case "object": {
337
+ const cacheKey = schemaKeyRef;
338
+ this._cache.delete(cacheKey);
339
+ let id = schemaKeyRef[this.opts.schemaId];
340
+ if (id) {
341
+ id = (0, resolve_1.normalizeId)(id);
342
+ delete this.schemas[id];
343
+ delete this.refs[id];
344
+ }
345
+ return this;
346
+ }
347
+ default:
348
+ throw new Error("ajv.removeSchema: invalid parameter");
349
+ }
315
350
  }
316
- return sch.validate || this._compileSchemaEnv(sch);
317
- }
318
- // Remove cached schema(s).
319
- // If no parameter is passed all schemas but meta-schemas are removed.
320
- // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
321
- // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
322
- removeSchema(schemaKeyRef) {
323
- if (schemaKeyRef instanceof RegExp) {
324
- this._removeAllSchemas(this.schemas, schemaKeyRef);
325
- this._removeAllSchemas(this.refs, schemaKeyRef);
351
+ // add "vocabulary" - a collection of keywords
352
+ addVocabulary(definitions) {
353
+ for (const def of definitions)
354
+ this.addKeyword(def);
326
355
  return this;
327
356
  }
328
- switch (typeof schemaKeyRef) {
329
- case "undefined":
330
- this._removeAllSchemas(this.schemas);
331
- this._removeAllSchemas(this.refs);
332
- this._cache.clear();
333
- return this;
334
- case "string": {
335
- const sch = getSchEnv.call(this, schemaKeyRef);
336
- if (typeof sch == "object")
337
- this._cache.delete(sch.schema);
338
- delete this.schemas[schemaKeyRef];
339
- delete this.refs[schemaKeyRef];
340
- return this;
341
- }
342
- case "object": {
343
- const cacheKey = schemaKeyRef;
344
- this._cache.delete(cacheKey);
345
- let id = schemaKeyRef[this.opts.schemaId];
346
- if (id) {
347
- id = (0, resolve_1.normalizeId)(id);
348
- delete this.schemas[id];
349
- delete this.refs[id];
357
+ addKeyword(kwdOrDef, def) {
358
+ let keyword;
359
+ if (typeof kwdOrDef == "string") {
360
+ keyword = kwdOrDef;
361
+ if (typeof def == "object") {
362
+ this.logger.warn("these parameters are deprecated, see docs for addKeyword");
363
+ def.keyword = keyword;
350
364
  }
365
+ } else if (typeof kwdOrDef == "object" && def === void 0) {
366
+ def = kwdOrDef;
367
+ keyword = def.keyword;
368
+ if (Array.isArray(keyword) && !keyword.length) {
369
+ throw new Error("addKeywords: keyword must be string or non-empty array");
370
+ }
371
+ } else {
372
+ throw new Error("invalid addKeywords parameters");
373
+ }
374
+ checkKeyword.call(this, keyword, def);
375
+ if (!def) {
376
+ (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
351
377
  return this;
352
378
  }
353
- default:
354
- throw new Error("ajv.removeSchema: invalid parameter");
379
+ keywordMetaschema.call(this, def);
380
+ const definition = {
381
+ ...def,
382
+ type: (0, dataType_1.getJSONTypes)(def.type),
383
+ schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
384
+ };
385
+ (0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
386
+ return this;
355
387
  }
356
- }
357
- // add "vocabulary" - a collection of keywords
358
- addVocabulary(definitions) {
359
- for (const def of definitions)
360
- this.addKeyword(def);
361
- return this;
362
- }
363
- addKeyword(kwdOrDef, def) {
364
- let keyword;
365
- if (typeof kwdOrDef == "string") {
366
- keyword = kwdOrDef;
367
- if (typeof def == "object") {
368
- this.logger.warn("these parameters are deprecated, see docs for addKeyword");
369
- def.keyword = keyword;
370
- }
371
- } else if (typeof kwdOrDef == "object" && def === void 0) {
372
- def = kwdOrDef;
373
- keyword = def.keyword;
374
- if (Array.isArray(keyword) && !keyword.length) {
375
- throw new Error("addKeywords: keyword must be string or non-empty array");
388
+ getKeyword(keyword) {
389
+ const rule = this.RULES.all[keyword];
390
+ return typeof rule == "object" ? rule.definition : !!rule;
391
+ }
392
+ // Remove keyword
393
+ removeKeyword(keyword) {
394
+ const { RULES } = this;
395
+ delete RULES.keywords[keyword];
396
+ delete RULES.all[keyword];
397
+ for (const group of RULES.rules) {
398
+ const i = group.rules.findIndex((rule) => rule.keyword === keyword);
399
+ if (i >= 0)
400
+ group.rules.splice(i, 1);
376
401
  }
377
- } else {
378
- throw new Error("invalid addKeywords parameters");
402
+ return this;
379
403
  }
380
- checkKeyword.call(this, keyword, def);
381
- if (!def) {
382
- (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
404
+ // Add format
405
+ addFormat(name, format) {
406
+ if (typeof format == "string")
407
+ format = new RegExp(format);
408
+ this.formats[name] = format;
383
409
  return this;
384
410
  }
385
- keywordMetaschema.call(this, def);
386
- const definition = {
387
- ...def,
388
- type: (0, dataType_1.getJSONTypes)(def.type),
389
- schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
390
- };
391
- (0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
392
- return this;
393
- }
394
- getKeyword(keyword) {
395
- const rule = this.RULES.all[keyword];
396
- return typeof rule == "object" ? rule.definition : !!rule;
397
- }
398
- // Remove keyword
399
- removeKeyword(keyword) {
400
- const { RULES } = this;
401
- delete RULES.keywords[keyword];
402
- delete RULES.all[keyword];
403
- for (const group of RULES.rules) {
404
- const i = group.rules.findIndex((rule) => rule.keyword === keyword);
405
- if (i >= 0)
406
- group.rules.splice(i, 1);
411
+ errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
412
+ if (!errors || errors.length === 0)
413
+ return "No errors";
414
+ return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
407
415
  }
408
- return this;
409
- }
410
- // Add format
411
- addFormat(name, format) {
412
- if (typeof format == "string")
413
- format = new RegExp(format);
414
- this.formats[name] = format;
415
- return this;
416
- }
417
- errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
418
- if (!errors || errors.length === 0)
419
- return "No errors";
420
- return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
421
- }
422
- $dataMetaSchema(metaSchema, keywordsJsonPointers) {
423
- const rules2 = this.RULES.all;
424
- metaSchema = JSON.parse(JSON.stringify(metaSchema));
425
- for (const jsonPointer of keywordsJsonPointers) {
426
- const segments = jsonPointer.split("/").slice(1);
427
- let keywords = metaSchema;
428
- for (const seg of segments)
429
- keywords = keywords[seg];
430
- for (const key in rules2) {
431
- const rule = rules2[key];
432
- if (typeof rule != "object")
433
- continue;
434
- const { $data } = rule.definition;
435
- const schema = keywords[key];
436
- if ($data && schema)
437
- keywords[key] = schemaOrData(schema);
416
+ $dataMetaSchema(metaSchema, keywordsJsonPointers) {
417
+ const rules = this.RULES.all;
418
+ metaSchema = JSON.parse(JSON.stringify(metaSchema));
419
+ for (const jsonPointer of keywordsJsonPointers) {
420
+ const segments = jsonPointer.split("/").slice(1);
421
+ let keywords = metaSchema;
422
+ for (const seg of segments)
423
+ keywords = keywords[seg];
424
+ for (const key in rules) {
425
+ const rule = rules[key];
426
+ if (typeof rule != "object")
427
+ continue;
428
+ const { $data } = rule.definition;
429
+ const schema = keywords[key];
430
+ if ($data && schema)
431
+ keywords[key] = schemaOrData(schema);
432
+ }
438
433
  }
434
+ return metaSchema;
439
435
  }
440
- return metaSchema;
441
- }
442
- _removeAllSchemas(schemas, regex) {
443
- for (const keyRef in schemas) {
444
- const sch = schemas[keyRef];
445
- if (!regex || regex.test(keyRef)) {
446
- if (typeof sch == "string") {
447
- delete schemas[keyRef];
448
- } else if (sch && !sch.meta) {
449
- this._cache.delete(sch.schema);
450
- delete schemas[keyRef];
436
+ _removeAllSchemas(schemas, regex) {
437
+ for (const keyRef in schemas) {
438
+ const sch = schemas[keyRef];
439
+ if (!regex || regex.test(keyRef)) {
440
+ if (typeof sch == "string") {
441
+ delete schemas[keyRef];
442
+ } else if (sch && !sch.meta) {
443
+ this._cache.delete(sch.schema);
444
+ delete schemas[keyRef];
445
+ }
451
446
  }
452
447
  }
453
448
  }
454
- }
455
- _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
456
- let id;
457
- const { schemaId } = this.opts;
458
- if (typeof schema == "object") {
459
- id = schema[schemaId];
460
- } else {
461
- if (this.opts.jtd)
462
- throw new Error("schema must be object");
463
- else if (typeof schema != "boolean")
464
- throw new Error("schema must be object or boolean");
465
- }
466
- let sch = this._cache.get(schema);
467
- if (sch !== void 0)
449
+ _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
450
+ let id;
451
+ const { schemaId } = this.opts;
452
+ if (typeof schema == "object") {
453
+ id = schema[schemaId];
454
+ } else {
455
+ if (this.opts.jtd)
456
+ throw new Error("schema must be object");
457
+ else if (typeof schema != "boolean")
458
+ throw new Error("schema must be object or boolean");
459
+ }
460
+ let sch = this._cache.get(schema);
461
+ if (sch !== void 0)
462
+ return sch;
463
+ baseId = (0, resolve_1.normalizeId)(id || baseId);
464
+ const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
465
+ sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
466
+ this._cache.set(sch.schema, sch);
467
+ if (addSchema && !baseId.startsWith("#")) {
468
+ if (baseId)
469
+ this._checkUnique(baseId);
470
+ this.refs[baseId] = sch;
471
+ }
472
+ if (validateSchema)
473
+ this.validateSchema(schema, true);
468
474
  return sch;
469
- baseId = (0, resolve_1.normalizeId)(id || baseId);
470
- const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
471
- sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
472
- this._cache.set(sch.schema, sch);
473
- if (addSchema && !baseId.startsWith("#")) {
474
- if (baseId)
475
- this._checkUnique(baseId);
476
- this.refs[baseId] = sch;
477
475
  }
478
- if (validateSchema)
479
- this.validateSchema(schema, true);
480
- return sch;
476
+ _checkUnique(id) {
477
+ if (this.schemas[id] || this.refs[id]) {
478
+ throw new Error(`schema with key or id "${id}" already exists`);
479
+ }
480
+ }
481
+ _compileSchemaEnv(sch) {
482
+ if (sch.meta)
483
+ this._compileMetaSchema(sch);
484
+ else
485
+ compile_1.compileSchema.call(this, sch);
486
+ if (!sch.validate)
487
+ throw new Error("ajv implementation error");
488
+ return sch.validate;
489
+ }
490
+ _compileMetaSchema(sch) {
491
+ const currentOpts = this.opts;
492
+ this.opts = this._metaOpts;
493
+ try {
494
+ compile_1.compileSchema.call(this, sch);
495
+ } finally {
496
+ this.opts = currentOpts;
497
+ }
498
+ }
481
499
  }
482
- _checkUnique(id) {
483
- if (this.schemas[id] || this.refs[id]) {
484
- throw new Error(`schema with key or id "${id}" already exists`);
500
+ Ajv.ValidationError = validation_error_1.default;
501
+ Ajv.MissingRefError = ref_error_1.default;
502
+ exports$1.default = Ajv;
503
+ function checkOptions(checkOpts, options, msg, log = "error") {
504
+ for (const key in checkOpts) {
505
+ const opt = key;
506
+ if (opt in options)
507
+ this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
485
508
  }
486
509
  }
487
- _compileSchemaEnv(sch) {
488
- if (sch.meta)
489
- this._compileMetaSchema(sch);
510
+ function getSchEnv(keyRef) {
511
+ keyRef = (0, resolve_1.normalizeId)(keyRef);
512
+ return this.schemas[keyRef] || this.refs[keyRef];
513
+ }
514
+ function addInitialSchemas() {
515
+ const optsSchemas = this.opts.schemas;
516
+ if (!optsSchemas)
517
+ return;
518
+ if (Array.isArray(optsSchemas))
519
+ this.addSchema(optsSchemas);
490
520
  else
491
- compile_1.compileSchema.call(this, sch);
492
- if (!sch.validate)
493
- throw new Error("ajv implementation error");
494
- return sch.validate;
521
+ for (const key in optsSchemas)
522
+ this.addSchema(optsSchemas[key], key);
495
523
  }
496
- _compileMetaSchema(sch) {
497
- const currentOpts = this.opts;
498
- this.opts = this._metaOpts;
499
- try {
500
- compile_1.compileSchema.call(this, sch);
501
- } finally {
502
- this.opts = currentOpts;
524
+ function addInitialFormats() {
525
+ for (const name in this.opts.formats) {
526
+ const format = this.opts.formats[name];
527
+ if (format)
528
+ this.addFormat(name, format);
503
529
  }
504
530
  }
505
- }
506
- Ajv.ValidationError = validation_error_1.default;
507
- Ajv.MissingRefError = ref_error_1.default;
508
- exports$1.default = Ajv;
509
- function checkOptions(checkOpts, options, msg, log = "error") {
510
- for (const key in checkOpts) {
511
- const opt = key;
512
- if (opt in options)
513
- this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
514
- }
515
- }
516
- function getSchEnv(keyRef) {
517
- keyRef = (0, resolve_1.normalizeId)(keyRef);
518
- return this.schemas[keyRef] || this.refs[keyRef];
519
- }
520
- function addInitialSchemas() {
521
- const optsSchemas = this.opts.schemas;
522
- if (!optsSchemas)
523
- return;
524
- if (Array.isArray(optsSchemas))
525
- this.addSchema(optsSchemas);
526
- else
527
- for (const key in optsSchemas)
528
- this.addSchema(optsSchemas[key], key);
529
- }
530
- function addInitialFormats() {
531
- for (const name in this.opts.formats) {
532
- const format = this.opts.formats[name];
533
- if (format)
534
- this.addFormat(name, format);
531
+ function addInitialKeywords(defs) {
532
+ if (Array.isArray(defs)) {
533
+ this.addVocabulary(defs);
534
+ return;
535
+ }
536
+ this.logger.warn("keywords option as map is deprecated, pass array");
537
+ for (const keyword in defs) {
538
+ const def = defs[keyword];
539
+ if (!def.keyword)
540
+ def.keyword = keyword;
541
+ this.addKeyword(def);
542
+ }
535
543
  }
536
- }
537
- function addInitialKeywords(defs) {
538
- if (Array.isArray(defs)) {
539
- this.addVocabulary(defs);
540
- return;
544
+ function getMetaSchemaOptions() {
545
+ const metaOpts = { ...this.opts };
546
+ for (const opt of META_IGNORE_OPTIONS)
547
+ delete metaOpts[opt];
548
+ return metaOpts;
541
549
  }
542
- this.logger.warn("keywords option as map is deprecated, pass array");
543
- for (const keyword in defs) {
544
- const def = defs[keyword];
545
- if (!def.keyword)
546
- def.keyword = keyword;
547
- this.addKeyword(def);
550
+ const noLogs = { log() {
551
+ }, warn() {
552
+ }, error() {
553
+ } };
554
+ function getLogger(logger) {
555
+ if (logger === false)
556
+ return noLogs;
557
+ if (logger === void 0)
558
+ return console;
559
+ if (logger.log && logger.warn && logger.error)
560
+ return logger;
561
+ throw new Error("logger must implement log, warn and error methods");
548
562
  }
549
- }
550
- function getMetaSchemaOptions() {
551
- const metaOpts = { ...this.opts };
552
- for (const opt of META_IGNORE_OPTIONS)
553
- delete metaOpts[opt];
554
- return metaOpts;
555
- }
556
- const noLogs = { log() {
557
- }, warn() {
558
- }, error() {
559
- } };
560
- function getLogger(logger) {
561
- if (logger === false)
562
- return noLogs;
563
- if (logger === void 0)
564
- return console;
565
- if (logger.log && logger.warn && logger.error)
566
- return logger;
567
- throw new Error("logger must implement log, warn and error methods");
568
- }
569
- const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
570
- function checkKeyword(keyword, def) {
571
- const { RULES } = this;
572
- (0, util_1.eachItem)(keyword, (kwd) => {
573
- if (RULES.keywords[kwd])
574
- throw new Error(`Keyword ${kwd} is already defined`);
575
- if (!KEYWORD_NAME.test(kwd))
576
- throw new Error(`Keyword ${kwd} has invalid name`);
577
- });
578
- if (!def)
579
- return;
580
- if (def.$data && !("code" in def || "validate" in def)) {
581
- throw new Error('$data keyword must have "code" or "validate" function');
563
+ const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
564
+ function checkKeyword(keyword, def) {
565
+ const { RULES } = this;
566
+ (0, util_1.eachItem)(keyword, (kwd) => {
567
+ if (RULES.keywords[kwd])
568
+ throw new Error(`Keyword ${kwd} is already defined`);
569
+ if (!KEYWORD_NAME.test(kwd))
570
+ throw new Error(`Keyword ${kwd} has invalid name`);
571
+ });
572
+ if (!def)
573
+ return;
574
+ if (def.$data && !("code" in def || "validate" in def)) {
575
+ throw new Error('$data keyword must have "code" or "validate" function');
576
+ }
582
577
  }
583
- }
584
- function addRule(keyword, definition, dataType2) {
585
- var _a;
586
- const post = definition === null || definition === void 0 ? void 0 : definition.post;
587
- if (dataType2 && post)
588
- throw new Error('keyword with "post" flag cannot have "type"');
589
- const { RULES } = this;
590
- let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType2);
591
- if (!ruleGroup) {
592
- ruleGroup = { type: dataType2, rules: [] };
593
- RULES.rules.push(ruleGroup);
578
+ function addRule(keyword, definition, dataType) {
579
+ var _a;
580
+ const post = definition === null || definition === void 0 ? void 0 : definition.post;
581
+ if (dataType && post)
582
+ throw new Error('keyword with "post" flag cannot have "type"');
583
+ const { RULES } = this;
584
+ let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
585
+ if (!ruleGroup) {
586
+ ruleGroup = { type: dataType, rules: [] };
587
+ RULES.rules.push(ruleGroup);
588
+ }
589
+ RULES.keywords[keyword] = true;
590
+ if (!definition)
591
+ return;
592
+ const rule = {
593
+ keyword,
594
+ definition: {
595
+ ...definition,
596
+ type: (0, dataType_1.getJSONTypes)(definition.type),
597
+ schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
598
+ }
599
+ };
600
+ if (definition.before)
601
+ addBeforeRule.call(this, ruleGroup, rule, definition.before);
602
+ else
603
+ ruleGroup.rules.push(rule);
604
+ RULES.all[keyword] = rule;
605
+ (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
594
606
  }
595
- RULES.keywords[keyword] = true;
596
- if (!definition)
597
- return;
598
- const rule = {
599
- keyword,
600
- definition: {
601
- ...definition,
602
- type: (0, dataType_1.getJSONTypes)(definition.type),
603
- schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
607
+ function addBeforeRule(ruleGroup, rule, before) {
608
+ const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
609
+ if (i >= 0) {
610
+ ruleGroup.rules.splice(i, 0, rule);
611
+ } else {
612
+ ruleGroup.rules.push(rule);
613
+ this.logger.warn(`rule ${before} is not defined`);
604
614
  }
615
+ }
616
+ function keywordMetaschema(def) {
617
+ let { metaSchema } = def;
618
+ if (metaSchema === void 0)
619
+ return;
620
+ if (def.$data && this.opts.$data)
621
+ metaSchema = schemaOrData(metaSchema);
622
+ def.validateSchema = this.compile(metaSchema, true);
623
+ }
624
+ const $dataRef = {
625
+ $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
605
626
  };
606
- if (definition.before)
607
- addBeforeRule.call(this, ruleGroup, rule, definition.before);
608
- else
609
- ruleGroup.rules.push(rule);
610
- RULES.all[keyword] = rule;
611
- (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
612
- }
613
- function addBeforeRule(ruleGroup, rule, before) {
614
- const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
615
- if (i >= 0) {
616
- ruleGroup.rules.splice(i, 0, rule);
617
- } else {
618
- ruleGroup.rules.push(rule);
619
- this.logger.warn(`rule ${before} is not defined`);
627
+ function schemaOrData(schema) {
628
+ return { anyOf: [schema, $dataRef] };
620
629
  }
621
- }
622
- function keywordMetaschema(def) {
623
- let { metaSchema } = def;
624
- if (metaSchema === void 0)
625
- return;
626
- if (def.$data && this.opts.$data)
627
- metaSchema = schemaOrData(metaSchema);
628
- def.validateSchema = this.compile(metaSchema, true);
629
- }
630
- const $dataRef = {
631
- $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
632
- };
633
- function schemaOrData(schema) {
634
- return { anyOf: [schema, $dataRef] };
635
- }
636
- })(core);
630
+ })(core);
631
+ return core;
632
+ }
633
+ export {
634
+ requireCore as __require
635
+ };
637
636
  //# sourceMappingURL=core.js.map