@emulsify/cli 1.5.0 → 1.7.1

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 (344) hide show
  1. package/README.md +89 -1
  2. package/dist/handlers/componentInstall.js +9 -5
  3. package/dist/handlers/componentList.js +1 -1
  4. package/dist/handlers/init.js +1 -1
  5. package/dist/handlers/systemInstall.js +27 -11
  6. package/dist/index.js +13 -21
  7. package/dist/node_modules/.package-lock.json +34 -43
  8. package/dist/node_modules/@types/node/LICENSE +0 -0
  9. package/dist/node_modules/@types/node/README.md +3 -3
  10. package/dist/node_modules/@types/node/assert.d.ts +33 -31
  11. package/dist/node_modules/@types/node/async_hooks.d.ts +29 -21
  12. package/dist/node_modules/@types/node/buffer.d.ts +67 -3
  13. package/dist/node_modules/@types/node/child_process.d.ts +230 -62
  14. package/dist/node_modules/@types/node/cluster.d.ts +62 -27
  15. package/dist/node_modules/@types/node/console.d.ts +6 -6
  16. package/dist/node_modules/@types/node/constants.d.ts +12 -11
  17. package/dist/node_modules/@types/node/crypto.d.ts +338 -240
  18. package/dist/node_modules/@types/node/dgram.d.ts +50 -14
  19. package/dist/node_modules/@types/node/dns.d.ts +183 -54
  20. package/dist/node_modules/@types/node/domain.d.ts +4 -4
  21. package/dist/node_modules/@types/node/events.d.ts +4 -4
  22. package/dist/node_modules/@types/node/fs/promises.d.ts +105 -39
  23. package/dist/node_modules/@types/node/fs.d.ts +440 -126
  24. package/dist/node_modules/@types/node/globals.d.ts +176 -24
  25. package/dist/node_modules/@types/node/globals.global.d.ts +0 -0
  26. package/dist/node_modules/@types/node/http.d.ts +309 -218
  27. package/dist/node_modules/@types/node/http2.d.ts +345 -98
  28. package/dist/node_modules/@types/node/https.d.ts +250 -118
  29. package/dist/node_modules/@types/node/index.d.ts +1 -2
  30. package/dist/node_modules/@types/node/inspector.d.ts +2 -3
  31. package/dist/node_modules/@types/node/module.d.ts +4 -4
  32. package/dist/node_modules/@types/node/net.d.ts +42 -14
  33. package/dist/node_modules/@types/node/os.d.ts +5 -4
  34. package/dist/node_modules/@types/node/package.json +10 -8
  35. package/dist/node_modules/@types/node/path.d.ts +35 -24
  36. package/dist/node_modules/@types/node/perf_hooks.d.ts +5 -5
  37. package/dist/node_modules/@types/node/process.d.ts +62 -23
  38. package/dist/node_modules/@types/node/punycode.d.ts +3 -3
  39. package/dist/node_modules/@types/node/querystring.d.ts +15 -5
  40. package/dist/node_modules/@types/node/readline.d.ts +16 -6
  41. package/dist/node_modules/@types/node/repl.d.ts +13 -7
  42. package/dist/node_modules/@types/node/stream.d.ts +190 -31
  43. package/dist/node_modules/@types/node/string_decoder.d.ts +3 -3
  44. package/dist/node_modules/@types/node/timers.d.ts +6 -6
  45. package/dist/node_modules/@types/node/tls.d.ts +113 -30
  46. package/dist/node_modules/@types/node/trace_events.d.ts +3 -3
  47. package/dist/node_modules/@types/node/ts4.8/assert.d.ts +130 -0
  48. package/dist/node_modules/@types/node/ts4.8/async_hooks.d.ts +237 -0
  49. package/dist/node_modules/@types/node/ts4.8/buffer.d.ts +89 -0
  50. package/dist/node_modules/@types/node/ts4.8/child_process.d.ts +682 -0
  51. package/dist/node_modules/@types/node/ts4.8/cluster.d.ts +300 -0
  52. package/dist/node_modules/@types/node/ts4.8/console.d.ts +142 -0
  53. package/dist/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
  54. package/dist/node_modules/@types/node/ts4.8/crypto.d.ts +1287 -0
  55. package/dist/node_modules/@types/node/ts4.8/dgram.d.ts +180 -0
  56. package/dist/node_modules/@types/node/ts4.8/dns.d.ts +516 -0
  57. package/dist/node_modules/@types/node/ts4.8/domain.d.ts +27 -0
  58. package/dist/node_modules/@types/node/ts4.8/events.d.ts +82 -0
  59. package/dist/node_modules/@types/node/ts4.8/fs/promises.d.ts +634 -0
  60. package/dist/node_modules/@types/node/ts4.8/fs.d.ts +2587 -0
  61. package/dist/node_modules/@types/node/ts4.8/globals.d.ts +763 -0
  62. package/dist/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  63. package/dist/node_modules/@types/node/ts4.8/http.d.ts +580 -0
  64. package/dist/node_modules/@types/node/ts4.8/http2.d.ts +1208 -0
  65. package/dist/node_modules/@types/node/ts4.8/https.d.ts +274 -0
  66. package/dist/node_modules/@types/node/ts4.8/index.d.ts +53 -0
  67. package/dist/node_modules/@types/node/ts4.8/inspector.d.ts +3050 -0
  68. package/dist/node_modules/@types/node/ts4.8/module.d.ts +56 -0
  69. package/dist/node_modules/@types/node/ts4.8/net.d.ts +324 -0
  70. package/dist/node_modules/@types/node/ts4.8/os.d.ts +243 -0
  71. package/dist/node_modules/@types/node/ts4.8/path.d.ts +168 -0
  72. package/dist/node_modules/@types/node/ts4.8/perf_hooks.d.ts +274 -0
  73. package/dist/node_modules/@types/node/ts4.8/process.d.ts +452 -0
  74. package/dist/node_modules/@types/node/ts4.8/punycode.d.ts +78 -0
  75. package/dist/node_modules/@types/node/ts4.8/querystring.d.ts +41 -0
  76. package/dist/node_modules/@types/node/ts4.8/readline.d.ts +184 -0
  77. package/dist/node_modules/@types/node/ts4.8/repl.d.ts +404 -0
  78. package/dist/node_modules/@types/node/ts4.8/stream.d.ts +518 -0
  79. package/dist/node_modules/@types/node/ts4.8/string_decoder.d.ts +10 -0
  80. package/dist/node_modules/@types/node/ts4.8/timers.d.ts +19 -0
  81. package/dist/node_modules/@types/node/ts4.8/tls.d.ts +866 -0
  82. package/dist/node_modules/@types/node/ts4.8/trace_events.d.ts +64 -0
  83. package/dist/node_modules/@types/node/ts4.8/tty.d.ts +69 -0
  84. package/dist/node_modules/@types/node/ts4.8/url.d.ts +187 -0
  85. package/dist/node_modules/@types/node/ts4.8/util.d.ts +278 -0
  86. package/dist/node_modules/@types/node/ts4.8/v8.d.ts +189 -0
  87. package/dist/node_modules/@types/node/ts4.8/vm.d.ts +155 -0
  88. package/dist/node_modules/@types/node/ts4.8/wasi.d.ts +88 -0
  89. package/dist/node_modules/@types/node/ts4.8/worker_threads.d.ts +241 -0
  90. package/dist/node_modules/@types/node/ts4.8/zlib.d.ts +364 -0
  91. package/dist/node_modules/@types/node/tty.d.ts +4 -4
  92. package/dist/node_modules/@types/node/url.d.ts +75 -7
  93. package/dist/node_modules/@types/node/util.d.ts +103 -41
  94. package/dist/node_modules/@types/node/v8.d.ts +4 -5
  95. package/dist/node_modules/@types/node/vm.d.ts +7 -7
  96. package/dist/node_modules/@types/node/wasi.d.ts +3 -4
  97. package/dist/node_modules/@types/node/worker_threads.d.ts +8 -8
  98. package/dist/node_modules/@types/node/zlib.d.ts +13 -13
  99. package/dist/node_modules/@types/progress/LICENSE +0 -0
  100. package/dist/node_modules/@types/progress/README.md +2 -3
  101. package/dist/node_modules/@types/progress/index.d.ts +0 -5
  102. package/dist/node_modules/@types/progress/package.json +6 -6
  103. package/dist/node_modules/ajv-formats/node_modules/ajv/README.md +20 -5
  104. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2019.d.ts +3 -1
  105. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2019.js +7 -1
  106. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2019.js.map +1 -1
  107. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2020.d.ts +3 -1
  108. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2020.js +7 -1
  109. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/2020.js.map +1 -1
  110. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/ajv.d.ts +3 -1
  111. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js +7 -1
  112. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js.map +1 -1
  113. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts +6 -5
  114. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js +9 -1
  115. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
  116. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.d.ts +2 -2
  117. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map +1 -1
  118. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.d.ts +5 -5
  119. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js +1 -1
  120. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -1
  121. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js +1 -1
  122. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js.map +1 -1
  123. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.d.ts +1 -1
  124. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js +9 -10
  125. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map +1 -1
  126. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
  127. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
  128. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js +19 -8
  129. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
  130. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.d.ts +2 -2
  131. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js +6 -6
  132. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js.map +1 -1
  133. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.d.ts +2 -1
  134. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js +3 -3
  135. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map +1 -1
  136. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts +6 -6
  137. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js +16 -14
  138. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map +1 -1
  139. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.d.ts +2 -2
  140. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.d.ts +2 -2
  141. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js +1 -1
  142. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js.map +1 -1
  143. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -1
  144. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.d.ts +1 -1
  145. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js +2 -1
  146. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -1
  147. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -1
  148. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js +12 -2
  149. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
  150. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -1
  151. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.d.ts +1 -1
  152. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -1
  153. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.d.ts +7 -5
  154. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js +22 -18
  155. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map +1 -1
  156. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/jtd.d.ts +4 -2
  157. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js +7 -1
  158. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js.map +1 -1
  159. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.d.ts +1 -1
  160. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js +2 -1
  161. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js.map +1 -1
  162. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.d.ts +1 -1
  163. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -1
  164. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
  165. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js +6 -0
  166. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  167. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js +8 -1
  168. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js.map +1 -1
  169. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts +25 -19
  170. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts +15 -14
  171. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.d.ts +31 -25
  172. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +1 -1
  173. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -1
  174. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +1 -1
  175. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
  176. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +1 -1
  177. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +1 -1
  178. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -1
  179. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +2 -2
  180. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -1
  181. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +1 -1
  182. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -1
  183. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +1 -1
  184. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -1
  185. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +1 -1
  186. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +1 -1
  187. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -1
  188. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +1 -1
  189. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -1
  190. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -1
  191. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
  192. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +1 -1
  193. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
  194. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js +1 -1
  195. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
  196. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +1 -1
  197. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js +10 -3
  198. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
  199. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +1 -1
  200. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js +1 -1
  201. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -1
  202. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -1
  203. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.d.ts +1 -1
  204. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.d.ts +1 -1
  205. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -1
  206. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +1 -1
  207. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -1
  208. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +1 -1
  209. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +1 -1
  210. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -1
  211. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +1 -1
  212. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +1 -1
  213. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -1
  214. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -1
  215. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +3 -3
  216. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js +8 -5
  217. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -1
  218. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js +3 -2
  219. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -1
  220. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +3 -3
  221. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -1
  222. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +1 -1
  223. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js +10 -7
  224. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -1
  225. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +1 -1
  226. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -1
  227. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +1 -1
  228. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
  229. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.d.ts +1 -1
  230. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -1
  231. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +1 -1
  232. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +1 -1
  233. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js +4 -3
  234. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -1
  235. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.d.ts +2 -2
  236. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -1
  237. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +3 -3
  238. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -1
  239. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -1
  240. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +1 -1
  241. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +1 -1
  242. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.d.ts +1 -1
  243. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
  244. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +1 -1
  245. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/2019.ts +4 -1
  246. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/2020.ts +4 -1
  247. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/ajv.ts +4 -1
  248. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts +8 -0
  249. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/index.ts +25 -5
  250. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts +8 -8
  251. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/parse.ts +1 -1
  252. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/serialize.ts +21 -15
  253. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/types.ts +1 -1
  254. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/ref_error.ts +4 -3
  255. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts +18 -15
  256. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/rules.ts +1 -1
  257. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/dataType.ts +1 -0
  258. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/index.ts +11 -2
  259. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/core.ts +13 -2
  260. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/jtd.ts +4 -1
  261. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/runtime/parseJson.ts +2 -1
  262. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts +6 -0
  263. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/standalone/index.ts +9 -2
  264. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts +14 -3
  265. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts +2 -4
  266. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/jtd-schema.ts +25 -16
  267. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/ref.ts +1 -1
  268. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts +11 -3
  269. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/properties.ts +13 -6
  270. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/ref.ts +3 -1
  271. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/values.ts +10 -7
  272. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/enum.ts +5 -3
  273. package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +1 -1
  274. package/dist/node_modules/ajv-formats/node_modules/ajv/package.json +40 -38
  275. package/dist/node_modules/commander/Readme.md +407 -169
  276. package/dist/node_modules/commander/esm.mjs +13 -1
  277. package/dist/node_modules/commander/index.js +13 -2206
  278. package/dist/node_modules/commander/lib/argument.js +145 -0
  279. package/dist/node_modules/commander/lib/command.js +2299 -0
  280. package/dist/node_modules/commander/lib/error.js +43 -0
  281. package/dist/node_modules/commander/lib/help.js +457 -0
  282. package/dist/node_modules/commander/lib/option.js +327 -0
  283. package/dist/node_modules/commander/lib/suggestSimilar.js +100 -0
  284. package/dist/node_modules/commander/package.json +46 -34
  285. package/dist/node_modules/commander/typings/esm.d.mts +3 -0
  286. package/dist/node_modules/commander/typings/index.d.ts +889 -617
  287. package/dist/node_modules/debug/README.md +3 -0
  288. package/dist/node_modules/debug/package.json +1 -1
  289. package/dist/node_modules/debug/src/common.js +1 -1
  290. package/dist/node_modules/fs-extra/README.md +3 -5
  291. package/dist/node_modules/fs-extra/lib/{copy-sync → copy}/copy-sync.js +11 -8
  292. package/dist/node_modules/fs-extra/lib/copy/copy.js +12 -9
  293. package/dist/node_modules/fs-extra/lib/copy/index.js +2 -1
  294. package/dist/node_modules/fs-extra/lib/empty/index.js +10 -19
  295. package/dist/node_modules/fs-extra/lib/ensure/index.js +15 -15
  296. package/dist/node_modules/fs-extra/lib/ensure/link.js +10 -7
  297. package/dist/node_modules/fs-extra/lib/ensure/symlink.js +34 -15
  298. package/dist/node_modules/fs-extra/lib/fs/index.js +8 -10
  299. package/dist/node_modules/fs-extra/lib/index.js +1 -12
  300. package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +1 -1
  301. package/dist/node_modules/fs-extra/lib/json/output-json.js +1 -1
  302. package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +16 -130
  303. package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  304. package/dist/node_modules/fs-extra/lib/move/index.js +2 -1
  305. package/dist/node_modules/fs-extra/lib/{move-sync → move}/move-sync.js +12 -5
  306. package/dist/node_modules/fs-extra/lib/move/move.js +14 -4
  307. package/dist/node_modules/fs-extra/lib/remove/index.js +15 -2
  308. package/dist/node_modules/fs-extra/lib/util/stat.js +60 -45
  309. package/dist/node_modules/fs-extra/package.json +7 -10
  310. package/dist/node_modules/graceful-fs/LICENSE +1 -1
  311. package/dist/node_modules/graceful-fs/graceful-fs.js +23 -4
  312. package/dist/node_modules/graceful-fs/package.json +6 -3
  313. package/dist/node_modules/graceful-fs/polyfills.js +39 -30
  314. package/dist/node_modules/punycode/README.md +29 -3
  315. package/dist/node_modules/punycode/package.json +7 -7
  316. package/dist/node_modules/punycode/punycode.es6.js +25 -22
  317. package/dist/node_modules/punycode/punycode.js +25 -22
  318. package/dist/node_modules/ramda/dist/ramda.js +4 -4
  319. package/dist/node_modules/ramda/dist/ramda.min.js +1 -1
  320. package/dist/node_modules/ramda/es/trim.js +1 -1
  321. package/dist/node_modules/ramda/package.json +1 -1
  322. package/dist/node_modules/ramda/src/trim.js +1 -1
  323. package/dist/node_modules/universalify/README.md +1 -1
  324. package/dist/node_modules/universalify/index.js +6 -6
  325. package/dist/node_modules/universalify/package.json +2 -2
  326. package/dist/package.json +5 -6
  327. package/dist/schemas/variant.json +28 -5
  328. package/dist/util/cache/cloneIntoCache.js +1 -1
  329. package/dist/util/cache/getCachedItemPath.js +4 -2
  330. package/dist/util/cache/getJsonFromCachedFile.js +2 -2
  331. package/dist/util/getGitRepoNameFromUrl.js +1 -1
  332. package/dist/util/getRepositoryLatestTag.js +16 -0
  333. package/dist/util/platform/getInitSuccessMessageForPlatform.js +4 -3
  334. package/dist/util/project/buildComponentDependencyList.js +20 -0
  335. package/package.json +6 -7
  336. package/dist/node_modules/at-least-node/LICENSE +0 -6
  337. package/dist/node_modules/at-least-node/README.md +0 -25
  338. package/dist/node_modules/at-least-node/index.js +0 -5
  339. package/dist/node_modules/at-least-node/package.json +0 -32
  340. package/dist/node_modules/commander/CHANGELOG.md +0 -440
  341. package/dist/node_modules/fs-extra/CHANGELOG.md +0 -902
  342. package/dist/node_modules/fs-extra/lib/copy-sync/index.js +0 -5
  343. package/dist/node_modules/fs-extra/lib/move-sync/index.js +0 -5
  344. /package/dist/node_modules/fs-extra/lib/{output → output-file}/index.js +0 -0
@@ -7,7 +7,7 @@ import addMetaSchema2020 from "./refs/json-schema-2020-12"
7
7
 
8
8
  const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"
9
9
 
10
- class Ajv2020 extends AjvCore {
10
+ export class Ajv2020 extends AjvCore {
11
11
  constructor(opts: Options = {}) {
12
12
  super({
13
13
  ...opts,
@@ -38,6 +38,7 @@ class Ajv2020 extends AjvCore {
38
38
  }
39
39
 
40
40
  module.exports = exports = Ajv2020
41
+ module.exports.Ajv2020 = Ajv2020
41
42
  Object.defineProperty(exports, "__esModule", {value: true})
42
43
 
43
44
  export default Ajv2020
@@ -70,3 +71,5 @@ export {DefinedError} from "./vocabularies/errors"
70
71
  export {JSONType} from "./compile/rules"
71
72
  export {JSONSchemaType} from "./types/json-schema"
72
73
  export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen"
74
+ export {default as ValidationError} from "./runtime/validation_error"
75
+ export {default as MissingRefError} from "./compile/ref_error"
@@ -8,7 +8,7 @@ const META_SUPPORT_DATA = ["/properties"]
8
8
 
9
9
  const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"
10
10
 
11
- class Ajv extends AjvCore {
11
+ export class Ajv extends AjvCore {
12
12
  _addVocabularies(): void {
13
13
  super._addVocabularies()
14
14
  draft7Vocabularies.forEach((v) => this.addVocabulary(v))
@@ -32,6 +32,7 @@ class Ajv extends AjvCore {
32
32
  }
33
33
 
34
34
  module.exports = exports = Ajv
35
+ module.exports.Ajv = Ajv
35
36
  Object.defineProperty(exports, "__esModule", {value: true})
36
37
 
37
38
  export default Ajv
@@ -65,3 +66,5 @@ export {DefinedError} from "./vocabularies/errors"
65
66
  export {JSONType} from "./compile/rules"
66
67
  export {JSONSchemaType} from "./types/json-schema"
67
68
  export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen"
69
+ export {default as ValidationError} from "./runtime/validation_error"
70
+ export {default as MissingRefError} from "./compile/ref_error"
@@ -155,6 +155,14 @@ export function getProperty(key: Code | string | number): Code {
155
155
  return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`
156
156
  }
157
157
 
158
+ //Does best effort to format the name properly
159
+ export function getEsmExportName(key: Code | string | number): Code {
160
+ if (typeof key == "string" && IDENTIFIER.test(key)) {
161
+ return new _Code(`${key}`)
162
+ }
163
+ throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`)
164
+ }
165
+
158
166
  export function regexpCode(rx: RegExp): Code {
159
167
  return new _Code(rx.toString())
160
168
  }
@@ -41,7 +41,11 @@ abstract class Node {
41
41
  }
42
42
 
43
43
  class Def extends Node {
44
- constructor(private readonly varKind: Name, private readonly name: Name, private rhs?: SafeExpr) {
44
+ constructor(
45
+ private readonly varKind: Name,
46
+ private readonly name: Name,
47
+ private rhs?: SafeExpr
48
+ ) {
45
49
  super()
46
50
  }
47
51
 
@@ -63,7 +67,11 @@ class Def extends Node {
63
67
  }
64
68
 
65
69
  class Assign extends Node {
66
- constructor(readonly lhs: Code, public rhs: SafeExpr, private readonly sideEffects?: boolean) {
70
+ constructor(
71
+ readonly lhs: Code,
72
+ public rhs: SafeExpr,
73
+ private readonly sideEffects?: boolean
74
+ ) {
67
75
  super()
68
76
  }
69
77
 
@@ -84,7 +92,12 @@ class Assign extends Node {
84
92
  }
85
93
 
86
94
  class AssignOp extends Assign {
87
- constructor(lhs: Code, private readonly op: Code, rhs: SafeExpr, sideEffects?: boolean) {
95
+ constructor(
96
+ lhs: Code,
97
+ private readonly op: Code,
98
+ rhs: SafeExpr,
99
+ sideEffects?: boolean
100
+ ) {
88
101
  super(lhs, rhs, sideEffects)
89
102
  }
90
103
 
@@ -211,7 +224,10 @@ class Else extends BlockNode {
211
224
  class If extends BlockNode {
212
225
  static readonly kind = "if"
213
226
  else?: If | Else
214
- constructor(private condition: Code | boolean, nodes?: ChildNode[]) {
227
+ constructor(
228
+ private condition: Code | boolean,
229
+ nodes?: ChildNode[]
230
+ ) {
215
231
  super(nodes)
216
232
  }
217
233
 
@@ -331,7 +347,11 @@ class ForIter extends For {
331
347
 
332
348
  class Func extends BlockNode {
333
349
  static readonly kind = "func"
334
- constructor(public name: Name, public args: Code, public async?: boolean) {
350
+ constructor(
351
+ public name: Name,
352
+ public args: Code,
353
+ public async?: boolean
354
+ ) {
335
355
  super()
336
356
  }
337
357
 
@@ -112,7 +112,7 @@ export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv {
112
112
  // TODO refactor - remove compilations
113
113
  const _sch = getCompilingSchema.call(this, sch)
114
114
  if (_sch) return _sch
115
- const rootId = getFullPath(sch.root.baseId) // TODO if getFullPath removed 1 tests fails
115
+ const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails
116
116
  const {es5, lines} = this.opts.code
117
117
  const {ownProperties} = this.opts
118
118
  const gen = new CodeGen(this.scope, {es5, lines, ownProperties})
@@ -208,7 +208,7 @@ export function resolveRef(
208
208
  baseId: string,
209
209
  ref: string
210
210
  ): AnySchema | SchemaEnv | undefined {
211
- ref = resolveUrl(baseId, ref)
211
+ ref = resolveUrl(this.opts.uriResolver, baseId, ref)
212
212
  const schOrFunc = root.refs[ref]
213
213
  if (schOrFunc) return schOrFunc
214
214
 
@@ -257,9 +257,9 @@ export function resolveSchema(
257
257
  root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
258
258
  ref: string // reference to resolve
259
259
  ): SchemaEnv | undefined {
260
- const p = URI.parse(ref)
261
- const refPath = _getFullPath(p)
262
- let baseId = getFullPath(root.baseId)
260
+ const p = this.opts.uriResolver.parse(ref)
261
+ const refPath = _getFullPath(this.opts.uriResolver, p)
262
+ let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined)
263
263
  // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
264
264
  if (Object.keys(root.schema).length > 0 && refPath === baseId) {
265
265
  return getJsonPointer.call(this, p, root)
@@ -279,7 +279,7 @@ export function resolveSchema(
279
279
  const {schema} = schOrRef
280
280
  const {schemaId} = this.opts
281
281
  const schId = schema[schemaId]
282
- if (schId) baseId = resolveUrl(baseId, schId)
282
+ if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId)
283
283
  return new SchemaEnv({schema, schemaId, root, baseId})
284
284
  }
285
285
  return getJsonPointer.call(this, p, schOrRef)
@@ -307,12 +307,12 @@ function getJsonPointer(
307
307
  // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
308
308
  const schId = typeof schema === "object" && schema[this.opts.schemaId]
309
309
  if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
310
- baseId = resolveUrl(baseId, schId)
310
+ baseId = resolveUrl(this.opts.uriResolver, baseId, schId)
311
311
  }
312
312
  }
313
313
  let env: SchemaEnv | undefined
314
314
  if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) {
315
- const $ref = resolveUrl(baseId, schema.$ref)
315
+ const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref)
316
316
  env = resolveSchema.call(this, root, $ref)
317
317
  }
318
318
  // even though resolution failed we need to return SchemaEnv to throw exception
@@ -342,7 +342,7 @@ function parseRef(cxt: ParseCxt): void {
342
342
  const {gen, self, definitions, schema, schemaEnv} = cxt
343
343
  const {ref} = schema
344
344
  const refSchema = definitions[ref]
345
- if (!refSchema) throw new MissingRefError("", ref, `No definition ${ref}`)
345
+ if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`)
346
346
  if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema})
347
347
  const {root} = schemaEnv
348
348
  const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions)
@@ -117,7 +117,7 @@ function serializeValues(cxt: SerializeCxt): void {
117
117
  gen.add(N.json, str`}`)
118
118
  }
119
119
 
120
- function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first: Name): void {
120
+ function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first?: Name): void {
121
121
  const {gen, data} = cxt
122
122
  addComma(cxt, first)
123
123
  serializeString({...cxt, data: key})
@@ -156,20 +156,24 @@ function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): v
156
156
  const optProps = keys(optionalProperties)
157
157
  const allProps = allProperties(props.concat(optProps))
158
158
  let first = !discriminator
159
+ let firstProp: Name | undefined
160
+
159
161
  for (const key of props) {
162
+ if (first) first = false
163
+ else gen.add(N.json, str`,`)
160
164
  serializeProperty(key, properties[key], keyValue(key))
161
165
  }
166
+ if (first) firstProp = gen.let("first", true)
162
167
  for (const key of optProps) {
163
168
  const value = keyValue(key)
164
- gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () =>
169
+ gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => {
170
+ addComma(cxt, firstProp)
165
171
  serializeProperty(key, optionalProperties[key], value)
166
- )
172
+ })
167
173
  }
168
174
  if (schema.additionalProperties) {
169
175
  gen.forIn("key", data, (key) =>
170
- gen.if(isAdditional(key, allProps), () =>
171
- serializeKeyValue(cxt, key, {}, gen.let("first", first))
172
- )
176
+ gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp))
173
177
  )
174
178
  }
175
179
 
@@ -190,8 +194,6 @@ function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): v
190
194
  }
191
195
 
192
196
  function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void {
193
- if (first) first = false
194
- else gen.add(N.json, str`,`)
195
197
  gen.add(N.json, str`${JSON.stringify(key)}:`)
196
198
  serializeCode({...cxt, schema: propSchema, data: value})
197
199
  }
@@ -234,7 +236,7 @@ function serializeRef(cxt: SerializeCxt): void {
234
236
  const {gen, self, data, definitions, schema, schemaEnv} = cxt
235
237
  const {ref} = schema
236
238
  const refSchema = definitions[ref]
237
- if (!refSchema) throw new MissingRefError("", ref, `No definition ${ref}`)
239
+ if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`)
238
240
  if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema})
239
241
  const {root} = schemaEnv
240
242
  const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions)
@@ -251,10 +253,14 @@ function serializeEmpty({gen, data}: SerializeCxt): void {
251
253
  gen.add(N.json, _`JSON.stringify(${data})`)
252
254
  }
253
255
 
254
- function addComma({gen}: SerializeCxt, first: Name): void {
255
- gen.if(
256
- first,
257
- () => gen.assign(first, false),
258
- () => gen.add(N.json, str`,`)
259
- )
256
+ function addComma({gen}: SerializeCxt, first?: Name): void {
257
+ if (first) {
258
+ gen.if(
259
+ first,
260
+ () => gen.assign(first, false),
261
+ () => gen.add(N.json, str`,`)
262
+ )
263
+ } else {
264
+ gen.add(N.json, str`,`)
265
+ }
260
266
  }
@@ -13,4 +13,4 @@ export const jtdForms = [
13
13
  "ref",
14
14
  ] as const
15
15
 
16
- export type JTDForm = typeof jtdForms[number]
16
+ export type JTDForm = (typeof jtdForms)[number]
@@ -1,12 +1,13 @@
1
1
  import {resolveUrl, normalizeId, getFullPath} from "./resolve"
2
+ import type {UriResolver} from "../types"
2
3
 
3
4
  export default class MissingRefError extends Error {
4
5
  readonly missingRef: string
5
6
  readonly missingSchema: string
6
7
 
7
- constructor(baseId: string, ref: string, msg?: string) {
8
+ constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) {
8
9
  super(msg || `can't resolve reference ${ref} from id ${baseId}`)
9
- this.missingRef = resolveUrl(baseId, ref)
10
- this.missingSchema = normalizeId(getFullPath(this.missingRef))
10
+ this.missingRef = resolveUrl(resolver, baseId, ref)
11
+ this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef))
11
12
  }
12
13
  }
@@ -1,9 +1,9 @@
1
- import type {AnySchema, AnySchemaObject} from "../types"
1
+ import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
2
2
  import type Ajv from "../ajv"
3
+ import type {URIComponents} from "uri-js"
3
4
  import {eachItem} from "./util"
4
5
  import * as equal from "fast-deep-equal"
5
6
  import * as traverse from "json-schema-traverse"
6
- import * as URI from "uri-js"
7
7
 
8
8
  // the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution
9
9
  export type LocalRefs = {[Ref in string]?: AnySchemaObject}
@@ -67,14 +67,15 @@ function countKeys(schema: AnySchemaObject): number {
67
67
  return count
68
68
  }
69
69
 
70
- export function getFullPath(id = "", normalize?: boolean): string {
70
+ export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string {
71
71
  if (normalize !== false) id = normalizeId(id)
72
- const p = URI.parse(id)
73
- return _getFullPath(p)
72
+ const p = resolver.parse(id)
73
+ return _getFullPath(resolver, p)
74
74
  }
75
75
 
76
- export function _getFullPath(p: URI.URIComponents): string {
77
- return URI.serialize(p).split("#")[0] + "#"
76
+ export function _getFullPath(resolver: UriResolver, p: URIComponents): string {
77
+ const serialized = resolver.serialize(p)
78
+ return serialized.split("#")[0] + "#"
78
79
  }
79
80
 
80
81
  const TRAILING_SLASH_HASH = /#\/?$/
@@ -82,33 +83,35 @@ export function normalizeId(id: string | undefined): string {
82
83
  return id ? id.replace(TRAILING_SLASH_HASH, "") : ""
83
84
  }
84
85
 
85
- export function resolveUrl(baseId: string, id: string): string {
86
+ export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string {
86
87
  id = normalizeId(id)
87
- return URI.resolve(baseId, id)
88
+ return resolver.resolve(baseId, id)
88
89
  }
89
90
 
90
91
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i
91
92
 
92
93
  export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs {
93
94
  if (typeof schema == "boolean") return {}
94
- const {schemaId} = this.opts
95
+ const {schemaId, uriResolver} = this.opts
95
96
  const schId = normalizeId(schema[schemaId] || baseId)
96
97
  const baseIds: {[JsonPtr in string]?: string} = {"": schId}
97
- const pathPrefix = getFullPath(schId, false)
98
+ const pathPrefix = getFullPath(uriResolver, schId, false)
98
99
  const localRefs: LocalRefs = {}
99
100
  const schemaRefs: Set<string> = new Set()
100
101
 
101
102
  traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => {
102
103
  if (parentJsonPtr === undefined) return
103
104
  const fullPath = pathPrefix + jsonPtr
104
- let baseId = baseIds[parentJsonPtr]
105
- if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId])
105
+ let innerBaseId = baseIds[parentJsonPtr]
106
+ if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId])
106
107
  addAnchor.call(this, sch.$anchor)
107
108
  addAnchor.call(this, sch.$dynamicAnchor)
108
- baseIds[jsonPtr] = baseId
109
+ baseIds[jsonPtr] = innerBaseId
109
110
 
110
111
  function addRef(this: Ajv, ref: string): string {
111
- ref = normalizeId(baseId ? URI.resolve(baseId, ref) : ref)
112
+ // eslint-disable-next-line @typescript-eslint/unbound-method
113
+ const _resolve = this.opts.uriResolver.resolve
114
+ ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref)
112
115
  if (schemaRefs.has(ref)) throw ambiguos(ref)
113
116
  schemaRefs.add(ref)
114
117
  let schOrRef = this.refs[ref]
@@ -2,7 +2,7 @@ import type {AddedKeywordDefinition} from "../types"
2
2
 
3
3
  const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"] as const
4
4
 
5
- export type JSONType = typeof _jsonTypes[number]
5
+ export type JSONType = (typeof _jsonTypes)[number]
6
6
 
7
7
  const jsonTypes: Set<string> = new Set(_jsonTypes)
8
8
 
@@ -30,6 +30,7 @@ export function getSchemaTypes(schema: AnySchemaObject): JSONType[] {
30
30
  return types
31
31
  }
32
32
 
33
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
33
34
  export function getJSONTypes(ts: unknown | unknown[]): JSONType[] {
34
35
  const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : []
35
36
  if (types.every(isJSONType)) return types
@@ -177,7 +177,7 @@ function checkNoDefault(it: SchemaObjCxt): void {
177
177
 
178
178
  function updateContext(it: SchemaObjCxt): void {
179
179
  const schId = it.schema[it.opts.schemaId]
180
- if (schId) it.baseId = resolveUrl(it.baseId, schId)
180
+ if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId)
181
181
  }
182
182
 
183
183
  function checkAsyncSchema(it: SchemaObjCxt): void {
@@ -286,7 +286,7 @@ function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void {
286
286
  strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`)
287
287
  }
288
288
  })
289
- it.dataTypes = it.dataTypes.filter((t) => includesType(types, t))
289
+ narrowSchemaTypes(it, types)
290
290
  }
291
291
 
292
292
  function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void {
@@ -316,6 +316,15 @@ function includesType(ts: JSONType[], t: JSONType): boolean {
316
316
  return ts.includes(t) || (t === "integer" && ts.includes("number"))
317
317
  }
318
318
 
319
+ function narrowSchemaTypes(it: SchemaObjCxt, withTypes: JSONType[]): void {
320
+ const ts: JSONType[] = []
321
+ for (const t of it.dataTypes) {
322
+ if (includesType(withTypes, t)) ts.push(t)
323
+ else if (withTypes.includes("integer") && t === "number") ts.push("integer")
324
+ }
325
+ it.dataTypes = ts
326
+ }
327
+
319
328
  function strictTypesError(it: SchemaObjCxt, msg: string): void {
320
329
  const schemaPath = it.schemaEnv.baseId + it.errSchemaPath
321
330
  msg += ` at "${schemaPath}" (strictTypes)`
@@ -49,6 +49,7 @@ import type {
49
49
  Format,
50
50
  AddedFormat,
51
51
  RegExpEngine,
52
+ UriResolver,
52
53
  } from "./types"
53
54
  import type {JSONSchemaType} from "./types/json-schema"
54
55
  import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema"
@@ -60,9 +61,10 @@ import {Code, ValueScope} from "./compile/codegen"
60
61
  import {normalizeId, getSchemaRefs} from "./compile/resolve"
61
62
  import {getJSONTypes} from "./compile/validate/dataType"
62
63
  import {eachItem} from "./compile/util"
63
-
64
64
  import * as $dataRefSchema from "./refs/data.json"
65
65
 
66
+ import DefaultUriResolver from "./runtime/uri"
67
+
66
68
  const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags)
67
69
  defaultRegExp.code = "new RegExp"
68
70
 
@@ -136,10 +138,12 @@ export interface CurrentOptions {
136
138
  int32range?: boolean // JTD only
137
139
  messages?: boolean
138
140
  code?: CodeOptions // NEW
141
+ uriResolver?: UriResolver
139
142
  }
140
143
 
141
144
  export interface CodeOptions {
142
145
  es5?: boolean
146
+ esm?: boolean
143
147
  lines?: boolean
144
148
  optimize?: boolean | number
145
149
  formats?: Code // code to require (or construct) map of available formats - for standalone code
@@ -225,7 +229,8 @@ type RequiredInstanceOptions = {
225
229
  | "validateSchema"
226
230
  | "validateFormats"
227
231
  | "int32range"
228
- | "unicodeRegExp"]: NonNullable<Options[K]>
232
+ | "unicodeRegExp"
233
+ | "uriResolver"]: NonNullable<Options[K]>
229
234
  } & {code: InstanceCodeOptions}
230
235
 
231
236
  export type InstanceOptions = Options & RequiredInstanceOptions
@@ -238,6 +243,7 @@ function requiredOptions(o: Options): RequiredInstanceOptions {
238
243
  const _optz = o.code?.optimize
239
244
  const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0
240
245
  const regExp = o.code?.regExp ?? defaultRegExp
246
+ const uriResolver = o.uriResolver ?? DefaultUriResolver
241
247
  return {
242
248
  strictSchema: o.strictSchema ?? s ?? true,
243
249
  strictNumbers: o.strictNumbers ?? s ?? true,
@@ -256,6 +262,7 @@ function requiredOptions(o: Options): RequiredInstanceOptions {
256
262
  validateFormats: o.validateFormats ?? true,
257
263
  unicodeRegExp: o.unicodeRegExp ?? true,
258
264
  int32range: o.int32range ?? true,
265
+ uriResolver: uriResolver,
259
266
  }
260
267
  }
261
268
 
@@ -336,14 +343,17 @@ export default class Ajv {
336
343
  validate<T>(schema: JTDSchemaType<T>, data: unknown): data is T
337
344
  // This overload is only intended for typescript inference, the first
338
345
  // argument prevents manual type annotation from matching this overload
346
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
339
347
  validate<N extends never, T extends SomeJTDSchemaType>(
340
348
  schema: T,
341
349
  data: unknown
342
350
  ): data is JTDDataType<T>
351
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
343
352
  validate<T>(schema: AsyncSchema, data: unknown | T): Promise<T>
344
353
  validate<T>(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise<T>
345
354
  validate<T>(
346
355
  schemaKeyRef: AnySchema | string, // key, ref or schema object
356
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
347
357
  data: unknown | T // to be validated
348
358
  ): boolean | Promise<T> {
349
359
  let v: AnyValidateFunction | undefined
@@ -367,6 +377,7 @@ export default class Ajv {
367
377
  compile<T = unknown>(schema: JTDSchemaType<T>, _meta?: boolean): ValidateFunction<T>
368
378
  // This overload is only intended for typescript inference, the first
369
379
  // argument prevents manual type annotation from matching this overload
380
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
370
381
  compile<N extends never, T extends SomeJTDSchemaType>(
371
382
  schema: T,
372
383
  _meta?: boolean
@@ -35,7 +35,7 @@ type JTDOptions = CurrentOptions & {
35
35
  multipleOfPrecision?: never
36
36
  }
37
37
 
38
- class Ajv extends AjvCore {
38
+ export class Ajv extends AjvCore {
39
39
  constructor(opts: JTDOptions = {}) {
40
40
  super({
41
41
  ...opts,
@@ -93,6 +93,7 @@ class Ajv extends AjvCore {
93
93
  }
94
94
 
95
95
  module.exports = exports = Ajv
96
+ module.exports.Ajv = Ajv
96
97
  Object.defineProperty(exports, "__esModule", {value: true})
97
98
 
98
99
  export default Ajv
@@ -127,3 +128,5 @@ export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./com
127
128
 
128
129
  export {JTDSchemaType, SomeJTDSchemaType, JTDDataType}
129
130
  export {JTDOptions}
131
+ export {default as ValidationError} from "./runtime/validation_error"
132
+ export {default as MissingRefError} from "./compile/ref_error"
@@ -1,4 +1,4 @@
1
- const rxParseJson = /position\s(\d+)$/
1
+ const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/
2
2
 
3
3
  export function parseJson(s: string, pos: number): unknown {
4
4
  let endPos: number | undefined
@@ -129,6 +129,7 @@ export function parseJsonString(s: string, pos: number): string | undefined {
129
129
  while (count--) {
130
130
  code <<= 4
131
131
  c = s[pos]
132
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
132
133
  if (c === undefined) {
133
134
  errorMessage("unexpected end")
134
135
  return undefined
@@ -0,0 +1,6 @@
1
+ import * as uri from "uri-js"
2
+
3
+ type URI = typeof uri & {code: string}
4
+ ;(uri as URI).code = 'require("ajv/dist/runtime/uri").default'
5
+
6
+ export default uri as URI
@@ -2,7 +2,7 @@ import type AjvCore from "../core"
2
2
  import type {AnyValidateFunction, SourceCode} from "../types"
3
3
  import type {SchemaEnv} from "../compile"
4
4
  import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope"
5
- import {_, nil, _Code, Code, getProperty} from "../compile/codegen/code"
5
+ import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code"
6
6
 
7
7
  function standaloneCode(
8
8
  ajv: AjvCore,
@@ -30,6 +30,10 @@ function standaloneCode(
30
30
  const usedValues: UsedScopeValues = {}
31
31
  const n = source?.validateName
32
32
  const vCode = validateCode(usedValues, source)
33
+ if (ajv.opts.code.esm) {
34
+ // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value
35
+ return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`
36
+ }
33
37
  return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`
34
38
  }
35
39
 
@@ -43,7 +47,10 @@ function standaloneCode(
43
47
  const v = getValidateFunc(schemas[name] as T)
44
48
  if (v) {
45
49
  const vCode = validateCode(usedValues, v.source)
46
- code = _`${code}${_n}exports${getProperty(name)} = ${v.source?.validateName};${_n}${vCode}`
50
+ const exportSyntax = ajv.opts.code.esm
51
+ ? _`export const ${getEsmExportName(name)}`
52
+ : _`exports${getProperty(name)}`
53
+ code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}`
47
54
  }
48
55
  }
49
56
  return `${code}`
@@ -1,3 +1,4 @@
1
+ import * as URI from "uri-js"
1
2
  import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen"
2
3
  import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile"
3
4
  import type {JSONType} from "../compile/rules"
@@ -47,6 +48,7 @@ export interface DataValidationCxt<T extends string | number = string | number>
47
48
  }
48
49
 
49
50
  export interface ValidateFunction<T = unknown> {
51
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
50
52
  (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T
51
53
  errors?: null | ErrorObject[]
52
54
  evaluated?: Evaluated
@@ -137,9 +139,12 @@ export interface DataValidateFunction {
137
139
  }
138
140
 
139
141
  export interface SchemaValidateFunction {
140
- (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt):
141
- | boolean
142
- | Promise<any>
142
+ (
143
+ schema: any,
144
+ data: any,
145
+ parentSchema?: AnySchemaObject,
146
+ dataCxt?: DataValidationCxt
147
+ ): boolean | Promise<any>
143
148
  errors?: Partial<ErrorObject>[]
144
149
  }
145
150
 
@@ -231,3 +236,9 @@ export interface RegExpEngine {
231
236
  export interface RegExpLike {
232
237
  test: (s: string) => boolean
233
238
  }
239
+
240
+ export interface UriResolver {
241
+ parse(uri: string): URI.URIComponents
242
+ resolve(base: string, path: string): string
243
+ serialize(component: URI.URIComponents): string
244
+ }
@@ -113,10 +113,7 @@ type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (
113
113
  dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema<T>}
114
114
  minProperties?: number
115
115
  maxProperties?: number
116
- } & (// "required" type does not guarantee that all required properties
117
- // are listed it only asserts that optional cannot be listed.
118
- // "required" is not necessary if it's a non-partial type with no required keys
119
- IsPartial extends true
116
+ } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties
120
117
  ? {required: Readonly<(keyof T)[]>}
121
118
  : [UncheckedRequiredMembers<T>] extends [never]
122
119
  ? {required?: Readonly<UncheckedRequiredMembers<T>[]>}
@@ -183,6 +180,7 @@ type Nullable<T> = undefined extends T
183
180
  default?: T | null
184
181
  }
185
182
  : {
183
+ nullable?: false
186
184
  const?: T
187
185
  enum?: Readonly<T[]>
188
186
  default?: T