@roster-lock/shared 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/LICENSE.md +11 -0
  2. package/dist/index.js +19 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/match-lock-file/config-types.js +3 -0
  5. package/dist/match-lock-file/config-types.js.map +1 -0
  6. package/dist/match-lock-file/index.js +19 -0
  7. package/dist/match-lock-file/index.js.map +1 -0
  8. package/dist/match-lock-file/match-config/index.js +18 -0
  9. package/dist/match-lock-file/match-config/index.js.map +1 -0
  10. package/dist/match-lock-file/match-config/version-1/draft/index.js +44 -0
  11. package/dist/match-lock-file/match-config/version-1/draft/index.js.map +1 -0
  12. package/dist/match-lock-file/match-config/version-1/draft/roster-piece-info.js +32 -0
  13. package/dist/match-lock-file/match-config/version-1/draft/roster-piece-info.js.map +1 -0
  14. package/dist/match-lock-file/match-config/version-1/draft/selection-script-info.js +13 -0
  15. package/dist/match-lock-file/match-config/version-1/draft/selection-script-info.js.map +1 -0
  16. package/dist/match-lock-file/match-config/version-1/index.js +22 -0
  17. package/dist/match-lock-file/match-config/version-1/index.js.map +1 -0
  18. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.js +37 -0
  19. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.js.map +1 -0
  20. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.js +43 -0
  21. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.js.map +1 -0
  22. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.js +7 -0
  23. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.js.map +1 -0
  24. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.js +41 -0
  25. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.js.map +1 -0
  26. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.js +20 -0
  27. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.js.map +1 -0
  28. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.js +31 -0
  29. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.js.map +1 -0
  30. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.js +40 -0
  31. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.js.map +1 -0
  32. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.js +17 -0
  33. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.js.map +1 -0
  34. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.js +16 -0
  35. package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.js.map +1 -0
  36. package/dist/match-lock-file/match-config/version-1/lock/engine/index.js +19 -0
  37. package/dist/match-lock-file/match-config/version-1/lock/engine/index.js.map +1 -0
  38. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/error.js +25 -0
  39. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/error.js.map +1 -0
  40. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/index.js +33 -0
  41. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/index.js.map +1 -0
  42. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.js +31 -0
  43. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.js.map +1 -0
  44. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.js +37 -0
  45. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.js.map +1 -0
  46. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.js +22 -0
  47. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.js.map +1 -0
  48. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.js +24 -0
  49. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.js.map +1 -0
  50. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.js +39 -0
  51. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.js.map +1 -0
  52. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.js +46 -0
  53. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.js.map +1 -0
  54. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.js +23 -0
  55. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.js.map +1 -0
  56. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.js +99 -0
  57. package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.js.map +1 -0
  58. package/dist/match-lock-file/match-config/version-1/lock/index.js +56 -0
  59. package/dist/match-lock-file/match-config/version-1/lock/index.js.map +1 -0
  60. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.js +87 -0
  61. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.js.map +1 -0
  62. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/index.js +19 -0
  63. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/index.js.map +1 -0
  64. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.js +94 -0
  65. package/dist/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.js.map +1 -0
  66. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.js +18 -0
  67. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.js.map +1 -0
  68. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.js +28 -0
  69. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.js.map +1 -0
  70. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.js +31 -0
  71. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.js.map +1 -0
  72. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.js +68 -0
  73. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.js.map +1 -0
  74. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.js +49 -0
  75. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.js.map +1 -0
  76. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.js +62 -0
  77. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.js.map +1 -0
  78. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.js +21 -0
  79. package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.js.map +1 -0
  80. package/dist/match-lock-file/match-config/version-1/lock/rosters/index.js +19 -0
  81. package/dist/match-lock-file/match-config/version-1/lock/rosters/index.js.map +1 -0
  82. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.js +10 -0
  83. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.js.map +1 -0
  84. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/human.js +27 -0
  85. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/human.js.map +1 -0
  86. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/id.js +27 -0
  87. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/id.js.map +1 -0
  88. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/index.js +74 -0
  89. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/index.js.map +1 -0
  90. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.js +31 -0
  91. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.js.map +1 -0
  92. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.js +25 -0
  93. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.js.map +1 -0
  94. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/utils.js +23 -0
  95. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/utils.js.map +1 -0
  96. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/version.js +19 -0
  97. package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/version.js.map +1 -0
  98. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.js +42 -0
  99. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.js.map +1 -0
  100. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.js +46 -0
  101. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.js.map +1 -0
  102. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.js +12 -0
  103. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.js.map +1 -0
  104. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.js +49 -0
  105. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.js.map +1 -0
  106. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.js +32 -0
  107. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.js.map +1 -0
  108. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.js +12 -0
  109. package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.js.map +1 -0
  110. package/dist/match-lock-file/match-config/version-1/lock/selection/index.js +19 -0
  111. package/dist/match-lock-file/match-config/version-1/lock/selection/index.js.map +1 -0
  112. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/index.js +33 -0
  113. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/index.js.map +1 -0
  114. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/script.js +23 -0
  115. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/script.js.map +1 -0
  116. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.js +49 -0
  117. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.js.map +1 -0
  118. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.js +14 -0
  119. package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.js.map +1 -0
  120. package/dist/match-lock-file/match-config/version-1/piece-info/file-paths.js +5 -0
  121. package/dist/match-lock-file/match-config/version-1/piece-info/file-paths.js.map +1 -0
  122. package/dist/match-lock-file/match-config/version-1/piece-info/index.js +23 -0
  123. package/dist/match-lock-file/match-config/version-1/piece-info/index.js.map +1 -0
  124. package/dist/match-lock-file/match-config/version-1/piece-info/keywords.js +29 -0
  125. package/dist/match-lock-file/match-config/version-1/piece-info/keywords.js.map +1 -0
  126. package/dist/match-lock-file/match-config/version-1/piece-info/schema.js +19 -0
  127. package/dist/match-lock-file/match-config/version-1/piece-info/schema.js.map +1 -0
  128. package/dist/match-lock-file/match-config/version-1/shared/Identity.js +15 -0
  129. package/dist/match-lock-file/match-config/version-1/shared/Identity.js.map +1 -0
  130. package/dist/match-lock-file/match-config/version-1/shared/SelectedPiece.js +38 -0
  131. package/dist/match-lock-file/match-config/version-1/shared/SelectedPiece.js.map +1 -0
  132. package/dist/match-lock-file/match-config/version-1/shared/count.js +48 -0
  133. package/dist/match-lock-file/match-config/version-1/shared/count.js.map +1 -0
  134. package/dist/match-lock-file/match-config/version-1/shared/index.js +25 -0
  135. package/dist/match-lock-file/match-config/version-1/shared/index.js.map +1 -0
  136. package/dist/match-lock-file/match-config/version-1/usage/calculatePieceVersion.js +70 -0
  137. package/dist/match-lock-file/match-config/version-1/usage/calculatePieceVersion.js.map +1 -0
  138. package/dist/match-lock-file/match-config/version-1/usage/empty-configs.js +49 -0
  139. package/dist/match-lock-file/match-config/version-1/usage/empty-configs.js.map +1 -0
  140. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/constants.js +8 -0
  141. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/constants.js.map +1 -0
  142. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.js +75 -0
  143. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.js.map +1 -0
  144. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.js +28 -0
  145. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.js.map +1 -0
  146. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/index.js +20 -0
  147. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/index.js.map +1 -0
  148. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/types.js +3 -0
  149. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/types.js.map +1 -0
  150. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.js +33 -0
  151. package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.js.map +1 -0
  152. package/dist/match-lock-file/match-config/version-1/usage/index.js +22 -0
  153. package/dist/match-lock-file/match-config/version-1/usage/index.js.map +1 -0
  154. package/dist/match-lock-file/match-config/version-1/usage/publish/SemVer.js +63 -0
  155. package/dist/match-lock-file/match-config/version-1/usage/publish/SemVer.js.map +1 -0
  156. package/dist/match-lock-file/match-config/version-1/usage/publish/diffLocks.js +51 -0
  157. package/dist/match-lock-file/match-config/version-1/usage/publish/diffLocks.js.map +1 -0
  158. package/dist/match-lock-file/match-config/version-1/usage/publish/index.js +19 -0
  159. package/dist/match-lock-file/match-config/version-1/usage/publish/index.js.map +1 -0
  160. package/dist/match-lock-file/match-config/version-1/usage/validate-select/constants.js +14 -0
  161. package/dist/match-lock-file/match-config/version-1/usage/validate-select/constants.js.map +1 -0
  162. package/dist/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.js +53 -0
  163. package/dist/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.js.map +1 -0
  164. package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js +49 -0
  165. package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js.map +1 -0
  166. package/dist/match-lock-file/match-config/version-1/usage/validate-select/index.js +68 -0
  167. package/dist/match-lock-file/match-config/version-1/usage/validate-select/index.js.map +1 -0
  168. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.js +38 -0
  169. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.js.map +1 -0
  170. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.js +40 -0
  171. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.js.map +1 -0
  172. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.js +78 -0
  173. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.js.map +1 -0
  174. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.js +43 -0
  175. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.js.map +1 -0
  176. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.js +26 -0
  177. package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.js.map +1 -0
  178. package/dist/match-lock-file/util-types/json-schema/JSONSchemaCaster.js +45 -0
  179. package/dist/match-lock-file/util-types/json-schema/JSONSchemaCaster.js.map +1 -0
  180. package/dist/match-lock-file/util-types/json-schema/defineKeyword.js +30 -0
  181. package/dist/match-lock-file/util-types/json-schema/defineKeyword.js.map +1 -0
  182. package/dist/match-lock-file/util-types/json-schema/index.js +21 -0
  183. package/dist/match-lock-file/util-types/json-schema/index.js.map +1 -0
  184. package/dist/match-lock-file/util-types/json-schema/safe-keyword.js +3 -0
  185. package/dist/match-lock-file/util-types/json-schema/safe-keyword.js.map +1 -0
  186. package/dist/match-lock-file/util-types/json-schema/schema-types.js +3 -0
  187. package/dist/match-lock-file/util-types/json-schema/schema-types.js.map +1 -0
  188. package/package.json +49 -0
  189. package/src/index.ts +3 -0
  190. package/src/match-lock-file/config-types.ts +10 -0
  191. package/src/match-lock-file/index.ts +4 -0
  192. package/src/match-lock-file/match-config/index.ts +2 -0
  193. package/src/match-lock-file/match-config/version-0/pieces/caster-runtypes/index.ts +99 -0
  194. package/src/match-lock-file/match-config/version-0/pieces/caster-runtypes/util-casters.ts +155 -0
  195. package/src/match-lock-file/match-config/version-0/pieces/index.ts +3 -0
  196. package/src/match-lock-file/match-config/version-0/pieces/types.ts +49 -0
  197. package/src/match-lock-file/match-config/version-0/pieces/validate/definition/assetCount.ts +33 -0
  198. package/src/match-lock-file/match-config/version-0/pieces/validate/definition/assetType.ts +22 -0
  199. package/src/match-lock-file/match-config/version-0/pieces/validate/definition/index.ts +30 -0
  200. package/src/match-lock-file/match-config/version-0/pieces/validate/definition/pathVariables.ts +39 -0
  201. package/src/match-lock-file/match-config/version-0/pieces/validate/index.ts +4 -0
  202. package/src/match-lock-file/match-config/version-0/pieces/validate/sha.ts +23 -0
  203. package/src/match-lock-file/match-config/version-0/pieces/validate/version.ts +66 -0
  204. package/src/match-lock-file/match-config/version-0/restriction/casters.ts +52 -0
  205. package/src/match-lock-file/match-config/version-0/restriction/index.ts +4 -0
  206. package/src/match-lock-file/match-config/version-0/restriction/types.ts +42 -0
  207. package/src/match-lock-file/match-config/version-0/restriction/validate/index.ts +15 -0
  208. package/src/match-lock-file/match-config/version-0/restriction/validate/piece/index.ts +46 -0
  209. package/src/match-lock-file/match-config/version-0/restriction/validate/sha.ts +19 -0
  210. package/src/match-lock-file/match-config/version-0/selection/casters.ts +105 -0
  211. package/src/match-lock-file/match-config/version-0/selection/validate/count.ts +16 -0
  212. package/src/match-lock-file/match-config/version-0/selection/validate/index.ts +40 -0
  213. package/src/match-lock-file/match-config/version-0/selection/validate/scriptMeta.ts +26 -0
  214. package/src/match-lock-file/match-config/version-1/draft/index.ts +52 -0
  215. package/src/match-lock-file/match-config/version-1/draft/roster-piece-info.ts +33 -0
  216. package/src/match-lock-file/match-config/version-1/draft/selection-script-info.ts +16 -0
  217. package/src/match-lock-file/match-config/version-1/index.ts +7 -0
  218. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.ts +46 -0
  219. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.ts +48 -0
  220. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.ts +6 -0
  221. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.ts +42 -0
  222. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.ts +26 -0
  223. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.ts +34 -0
  224. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.ts +47 -0
  225. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.ts +22 -0
  226. package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.ts +14 -0
  227. package/src/match-lock-file/match-config/version-1/lock/engine/index.ts +3 -0
  228. package/src/match-lock-file/match-config/version-1/lock/engine/validate/constants.ts +7 -0
  229. package/src/match-lock-file/match-config/version-1/lock/engine/validate/error.ts +21 -0
  230. package/src/match-lock-file/match-config/version-1/lock/engine/validate/index.ts +18 -0
  231. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.ts +41 -0
  232. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.ts +55 -0
  233. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.ts +21 -0
  234. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.ts +28 -0
  235. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.ts +46 -0
  236. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.ts +37 -0
  237. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.ts +21 -0
  238. package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.ts +117 -0
  239. package/src/match-lock-file/match-config/version-1/lock/index.ts +51 -0
  240. package/src/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.ts +97 -0
  241. package/src/match-lock-file/match-config/version-1/lock/piece-meta/index.ts +3 -0
  242. package/src/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.ts +114 -0
  243. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.ts +25 -0
  244. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.ts +33 -0
  245. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.ts +33 -0
  246. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.ts +103 -0
  247. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.ts +59 -0
  248. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.ts +71 -0
  249. package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.ts +22 -0
  250. package/src/match-lock-file/match-config/version-1/lock/rosters/index.ts +3 -0
  251. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.ts +9 -0
  252. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/human.ts +22 -0
  253. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/id.ts +20 -0
  254. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/index.ts +83 -0
  255. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.ts +40 -0
  256. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.ts +30 -0
  257. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/utils.ts +17 -0
  258. package/src/match-lock-file/match-config/version-1/lock/rosters/validate/version.ts +22 -0
  259. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.ts +53 -0
  260. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.ts +54 -0
  261. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.ts +11 -0
  262. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.ts +58 -0
  263. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.ts +37 -0
  264. package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.ts +11 -0
  265. package/src/match-lock-file/match-config/version-1/lock/selection/index.ts +3 -0
  266. package/src/match-lock-file/match-config/version-1/lock/selection/validate/index.ts +37 -0
  267. package/src/match-lock-file/match-config/version-1/lock/selection/validate/script.ts +28 -0
  268. package/src/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.ts +69 -0
  269. package/src/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.ts +18 -0
  270. package/src/match-lock-file/match-config/version-1/piece-info/file-paths.ts +2 -0
  271. package/src/match-lock-file/match-config/version-1/piece-info/index.ts +14 -0
  272. package/src/match-lock-file/match-config/version-1/piece-info/keywords.ts +39 -0
  273. package/src/match-lock-file/match-config/version-1/piece-info/schema.ts +29 -0
  274. package/src/match-lock-file/match-config/version-1/shared/Identity.ts +14 -0
  275. package/src/match-lock-file/match-config/version-1/shared/SelectedPiece.ts +49 -0
  276. package/src/match-lock-file/match-config/version-1/shared/count.ts +47 -0
  277. package/src/match-lock-file/match-config/version-1/shared/index.ts +9 -0
  278. package/src/match-lock-file/match-config/version-1/usage/calculatePieceVersion.ts +85 -0
  279. package/src/match-lock-file/match-config/version-1/usage/empty-configs.ts +61 -0
  280. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/constants.ts +6 -0
  281. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.ts +88 -0
  282. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.ts +42 -0
  283. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/index.ts +4 -0
  284. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/types.ts +5 -0
  285. package/src/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.ts +34 -0
  286. package/src/match-lock-file/match-config/version-1/usage/index.ts +6 -0
  287. package/src/match-lock-file/match-config/version-1/usage/publish/SemVer.ts +67 -0
  288. package/src/match-lock-file/match-config/version-1/usage/publish/diffLocks.ts +66 -0
  289. package/src/match-lock-file/match-config/version-1/usage/publish/index.ts +2 -0
  290. package/src/match-lock-file/match-config/version-1/usage/validate-select/constants.ts +9 -0
  291. package/src/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.ts +61 -0
  292. package/src/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.ts +54 -0
  293. package/src/match-lock-file/match-config/version-1/usage/validate-select/index.ts +98 -0
  294. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.ts +49 -0
  295. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.ts +39 -0
  296. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/include-mandatory-require.ts +44 -0
  297. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.ts +101 -0
  298. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.ts +51 -0
  299. package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.ts +36 -0
  300. package/src/match-lock-file/util-types/json-schema/JSONSchemaCaster.ts +52 -0
  301. package/src/match-lock-file/util-types/json-schema/checkVersion.ts +9 -0
  302. package/src/match-lock-file/util-types/json-schema/defineKeyword.ts +50 -0
  303. package/src/match-lock-file/util-types/json-schema/index.ts +4 -0
  304. package/src/match-lock-file/util-types/json-schema/safe-keyword.ts +27 -0
  305. package/src/match-lock-file/util-types/json-schema/schema-types.ts +5 -0
  306. package/tests/engine/assets.spec.ts +147 -0
  307. package/tests/engine/official-selections.spec.ts +67 -0
  308. package/tests/engine/requirements.spec.ts +43 -0
  309. package/tests/piece-info/cast.spec.ts +20 -0
  310. package/tests/piece-info/rosterlock.piece-info.json +15 -0
  311. package/tests/piece-meta/cast.spec.ts +60 -0
  312. package/tests/rosters/path-variables.spec.ts +52 -0
  313. package/tests/selection/cast-result.spec.ts +72 -0
  314. package/tsconfig.json +20 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,mCAAkD;AAGlD,0CAAwB;AACxB,mCAA8C;AAE9C,8BAAqC,MAAoC;IACvE,KAAI,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAC,CAAC;QAC5E,IAAI,CAAC;YACH,IAAA,+BAAuB,EAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,MAAM,MAAM,GAAG,2BAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,aAAa,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC;YACtD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidPathComponent = isValidPathComponent;
4
+ const WINDOWS_RESERVED_NAMES = [
5
+ 'CON', 'PRN', 'AUX', 'NUL',
6
+ 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7', 'COM8', 'COM9',
7
+ 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5', 'LPT6', 'LPT7', 'LPT8', 'LPT9'
8
+ ];
9
+ function isValidPathComponent(component) {
10
+ if (component.length === 0) {
11
+ throw new Error("Filepath component is empty");
12
+ }
13
+ if (component.length > 255) {
14
+ throw new Error("Filepath component is too long");
15
+ }
16
+ const upperComponent = component.toUpperCase();
17
+ const baseName = upperComponent.split('.')[0];
18
+ if (WINDOWS_RESERVED_NAMES.includes(baseName)) {
19
+ throw new Error("Filepath component is a reserved name");
20
+ }
21
+ if (component.startsWith(' ') || component.endsWith(' ')) {
22
+ throw new Error("Filepath component has leading/trailing spaces");
23
+ }
24
+ if (component.endsWith('.')) {
25
+ throw new Error("Filepath component ends with a dot");
26
+ }
27
+ if (/^\.+$/.test(component)) {
28
+ throw new Error("Filepath component is just dots");
29
+ }
30
+ }
31
+ //# sourceMappingURL=filepath-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath-component.js","sourceRoot":"","sources":["../../../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.ts"],"names":[],"mappings":";;;AACA,MAAM,sBAAsB,GAAG;IAC7B,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IAC1B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CACvE,CAAC;AAEF,8BAAqC,SAAiB;IAEpD,IAAG,SAAS,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAGD,IAAG,SAAS,CAAC,MAAM,GAAG,GAAG,EAAC,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAGD,MAAM,cAAc,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,IAAG,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAID,IAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAGD,IAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAGD,IAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidFilePath = isValidFilePath;
4
+ const filepath_component_1 = require("./filepath-component");
5
+ function isValidFilePath(path) {
6
+ if (path.length === 0) {
7
+ throw new Error("Filepath is empty");
8
+ }
9
+ if (path.length > 4096) {
10
+ throw new Error("Filepath is too long");
11
+ }
12
+ if (path.includes('\\')) {
13
+ throw new Error("Filepath contains backslash - use forward slashes only");
14
+ }
15
+ const invalidChars = /[<>:"|?*\x00-\x1f\x7f]/;
16
+ if (invalidChars.test(path)) {
17
+ throw new Error("Filepath contains invalid characters");
18
+ }
19
+ if (path.includes('../') ||
20
+ path.includes('/..') ||
21
+ path === '..' ||
22
+ path.startsWith('../') ||
23
+ path.endsWith('/..')) {
24
+ throw new Error("Filepath contains invalid traversal");
25
+ }
26
+ if (path.endsWith('/')) {
27
+ throw new Error("Filepath ends with a slash");
28
+ }
29
+ const components = path.split('/');
30
+ for (const component of components) {
31
+ (0, filepath_component_1.isValidPathComponent)(component);
32
+ }
33
+ if (components.length === 0) {
34
+ throw new Error("Filepath has no components");
35
+ }
36
+ }
37
+ //# sourceMappingURL=filepath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filepath.js","sourceRoot":"","sources":["../../../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.ts"],"names":[],"mappings":";;;AACA,6DAA4D;AAC5D,yBAAgC,IAAY;IAE1C,IAAG,IAAI,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAGD,IAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAGD,IAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAC,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAMD,MAAM,YAAY,GAAG,wBAAwB,CAAC;IAC9C,IAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;IAGD,IACE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QACpB,IAAI,KAAK,IAAI;QACb,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrB,CAAC;QACA,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAGD,IAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAGD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,KAAI,MAAM,SAAS,IAAI,UAAU,EAAC,CAAC;QACjC,IAAA,yCAAoB,EAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAGD,IAAG,UAAU,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validatePathVariablesInGlob = void 0;
7
+ exports.validateGlobItem = validateGlobItem;
8
+ const is_glob_1 = __importDefault(require("is-glob"));
9
+ var pathvariables_1 = require("./pathvariables");
10
+ Object.defineProperty(exports, "validatePathVariablesInGlob", { enumerable: true, get: function () { return pathvariables_1.validatePathVariablesInGlob; } });
11
+ const pathvariables_2 = require("./pathvariables");
12
+ const filepath_1 = require("./filepath");
13
+ function validateGlobItem(pattern) {
14
+ pattern = (0, pathvariables_2.replacePathVariablesWithGlob)(pattern);
15
+ if (pattern.startsWith('/') || /^[a-zA-Z]:/.test(pattern)) {
16
+ throw new Error("File pattern is absolute");
17
+ }
18
+ if ((0, is_glob_1.default)(pattern))
19
+ return;
20
+ (0, filepath_1.isValidFilePath)(pattern);
21
+ }
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.ts"],"names":[],"mappings":";;;;;;;AAAA,sDAA6B;AAE7B,iDAA8D;AAArD,4HAAA,2BAA2B,OAAA;AACpC,mDAA+D;AAC/D,yCAA6C;AAC7C,0BAAiC,OAAe;IAE9C,OAAO,GAAG,IAAA,4CAA4B,EAAC,OAAO,CAAC,CAAC;IAGhD,IAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAC,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAGD,IAAG,IAAA,iBAAM,EAAC,OAAO,CAAC;QAAE,OAAO;IAG3B,IAAA,0BAAe,EAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PATH_VARIABLE_VALUE_VALIDATION = void 0;
4
+ exports.validatePathVariablesInGlob = validatePathVariablesInGlob;
5
+ exports.replacePathVariablesWithGlob = replacePathVariablesWithGlob;
6
+ exports.PATH_VARIABLE_VALUE_VALIDATION = {
7
+ minLength: 1,
8
+ maxLength: 64,
9
+ charset: 'a-zA-Z0-9_\\- ',
10
+ };
11
+ function validatePathVariablesInGlob(glob, pathVariables) {
12
+ const pathVariableRegex = /<([a-zA-Z0-9_\\-]+)>/g;
13
+ let match;
14
+ while ((match = pathVariableRegex.exec(glob)) !== null) {
15
+ const variable = match[1];
16
+ if (!pathVariables.includes(variable)) {
17
+ throw new Error(`Glob ${glob} uses undefined path variable ${variable}`);
18
+ }
19
+ }
20
+ }
21
+ function replacePathVariablesWithGlob(glob) {
22
+ return glob.replaceAll(/<([a-zA-Z0-9_\\-]+)>/g, `[[${exports.PATH_VARIABLE_VALUE_VALIDATION.charset}]+]{${exports.PATH_VARIABLE_VALUE_VALIDATION.minLength},${exports.PATH_VARIABLE_VALUE_VALIDATION.maxLength}}`);
23
+ }
24
+ //# sourceMappingURL=pathvariables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathvariables.js","sourceRoot":"","sources":["../../../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.ts"],"names":[],"mappings":";;;;;AACa,QAAA,8BAA8B,GAAG;IAC5C,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,gBAAgB;CAC1B,CAAC;AAEF,qCACE,IAAY,EAAE,aAA4B;IAE1C,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;IAClD,IAAI,KAA6B,CAAC;IAClC,OAAM,CAAC,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAC,CAAC;QACrD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,iCAAiC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;AACH,CAAC;AAED,sCACE,IAAY;IAEZ,OAAO,IAAI,CAAC,UAAU,CACpB,uBAAuB,EACvB,KAAK,QAAA,8BAA8B,CAAC,OAAO,OAAO,QAAA,8BAA8B,CAAC,SAAS,IAAI,QAAA,8BAA8B,CAAC,SAAS,GAAG,CAC1I,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateGlobItem = exports.validatePathVariablesInGlob = void 0;
4
+ exports.validateAsset = validateAsset;
5
+ exports.validateAssetName = validateAssetName;
6
+ exports.validateGlobList = validateGlobList;
7
+ const count_1 = require("../../../../../shared/count");
8
+ function validateAsset(pieceAssetDefinition, definition) {
9
+ validateAssetName(pieceAssetDefinition.name, definition.assets);
10
+ (0, count_1.validateCount)(pieceAssetDefinition.count);
11
+ validateGlobList(pieceAssetDefinition.glob);
12
+ for (const g of pieceAssetDefinition.glob) {
13
+ (0, glob_1.validatePathVariablesInGlob)(g, definition.pathVariables);
14
+ (0, glob_1.validateGlobItem)(g);
15
+ }
16
+ }
17
+ function validateAssetName(name, assets) {
18
+ if (name === "") {
19
+ throw new Error("Name is empty");
20
+ }
21
+ if (name !== name.trim()) {
22
+ throw new Error("Name contains a trailing or leading space");
23
+ }
24
+ if (assets.filter((a) => a.name === name).length > 1) {
25
+ throw new Error("Duplicate name");
26
+ }
27
+ }
28
+ const glob_1 = require("./glob");
29
+ Object.defineProperty(exports, "validatePathVariablesInGlob", { enumerable: true, get: function () { return glob_1.validatePathVariablesInGlob; } });
30
+ Object.defineProperty(exports, "validateGlobItem", { enumerable: true, get: function () { return glob_1.validateGlobItem; } });
31
+ function validateGlobList(glob) {
32
+ if (glob.length === 0) {
33
+ throw new Error("Expecting at least 1 glob");
34
+ }
35
+ if (new Set(glob).size !== glob.length) {
36
+ throw new Error("Has duplicate globs");
37
+ }
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.ts"],"names":[],"mappings":";;;;;;AAIA,uDAA4D;AAE5D,uBACE,oBAAqF,EACrF,UAA8D;IAE9D,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAChE,IAAA,qBAAa,EAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC1C,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,KAAI,MAAM,CAAC,IAAI,oBAAoB,CAAC,IAAI,EAAC,CAAC;QACxC,IAAA,kCAA2B,EAAC,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;QACzD,IAAA,uBAAgB,EAAC,CAAC,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,2BACE,IAAmC,EAAE,MAAoE;IAEzG,IAAG,IAAI,KAAK,EAAE,EAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IACD,IAAG,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,EAAC,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IACD,IAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,iCAAuE;4GAA9D,kCAA2B;iGAAE,uBAAgB;AACtD,0BACE,IAAmC;IAEnC,IAAG,IAAI,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,IAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,EAAC,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.validatePieceDefinition = validatePieceDefinition;
18
+ __exportStar(require("./requirements"), exports);
19
+ __exportStar(require("./path-variables"), exports);
20
+ __exportStar(require("./assets"), exports);
21
+ const path_variables_1 = require("./path-variables");
22
+ const assets_1 = require("./assets");
23
+ const requirements_1 = require("./requirements");
24
+ const error_1 = require("../error");
25
+ function validatePieceDefinition(pieceType, definition, engine) {
26
+ (0, requirements_1.validatePieceRequirementList)(definition.requires);
27
+ for (const requiredPieceType of definition.requires) {
28
+ (0, requirements_1.validatePieceRequirementIsResolved)(requiredPieceType, engine);
29
+ }
30
+ (0, path_variables_1.validatePathVariables)(definition.pathVariables);
31
+ for (const variable of definition.pathVariables) {
32
+ (0, path_variables_1.validatePathVariableName)(variable);
33
+ }
34
+ for (const asset of definition.assets) {
35
+ try {
36
+ (0, assets_1.validateAsset)(asset, definition);
37
+ }
38
+ catch (e) {
39
+ const eTyped = error_1.ValidationErrorPath.convertError(e);
40
+ eTyped.addPathPrefix(`assets/${asset.name}`);
41
+ throw e;
42
+ }
43
+ }
44
+ (0, requirements_1.validatePieceInCycles)(pieceType, engine);
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,iDAA+B;AAC/B,mDAAiC;AACjC,2CAAyB;AACzB,qDAAmF;AACnF,qCAAyC;AACzC,iDAEwB;AACxB,oCAA+C;AAE/C,iCACE,SAAiB,EAAE,UAA8D,EAAE,MAA8B;IAEjH,IAAA,2CAA4B,EAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClD,KAAI,MAAM,iBAAiB,IAAI,UAAU,CAAC,QAAQ,EAAC,CAAC;QAClD,IAAA,iDAAkC,EAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IACD,IAAA,sCAAqB,EAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAChD,KAAI,MAAM,QAAQ,IAAI,UAAU,CAAC,aAAa,EAAC,CAAC;QAC9C,IAAA,yCAAwB,EAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IACD,KAAI,MAAM,KAAK,IAAI,UAAU,CAAC,MAAM,EAAC,CAAC;QACpC,IAAI,CAAC;YACH,IAAA,sBAAa,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACnC,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,MAAM,MAAM,GAAG,2BAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,aAAa,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7C,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,IAAA,oCAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatePathVariables = validatePathVariables;
4
+ exports.validatePathVariableName = validatePathVariableName;
5
+ function validatePathVariables(variables) {
6
+ if (new Set(variables).size !== variables.length) {
7
+ throw new Error(`Duplicate path variables`);
8
+ }
9
+ }
10
+ const INVALID_PATH_VARIABLE_CHARS = /[^a-zA-Z0-9_]/;
11
+ function validatePathVariableName(variable) {
12
+ if (variable.length === 0) {
13
+ throw new Error(`Path variable is empty`);
14
+ }
15
+ if (variable.length > 64) {
16
+ throw new Error(`Path variable ${variable} is too long`);
17
+ }
18
+ const match = variable.match(INVALID_PATH_VARIABLE_CHARS);
19
+ if (match) {
20
+ throw new Error(`Path variable ${variable} contains invalid character: "${match[0]}"`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=path-variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-variables.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.ts"],"names":[],"mappings":";;;;AACA,+BAAsC,SAAwB;IAC5D,IAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,MAAM,EAAC,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAGD,MAAM,2BAA2B,GAAG,eAAe,CAAC;AACpD,kCAAyC,QAAgB;IACvD,IAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IACD,IAAG,QAAQ,CAAC,MAAM,GAAG,EAAE,EAAC,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,cAAc,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;IACzD,IAAG,KAAK,EAAC,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,iCAAiC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CycleError = void 0;
4
+ exports.validatePieceRequirementCycles = validatePieceRequirementCycles;
5
+ exports.validatePieceInCycles = validatePieceInCycles;
6
+ exports.validatePieceRequirementList = validatePieceRequirementList;
7
+ exports.validatePieceRequirementIsResolved = validatePieceRequirementIsResolved;
8
+ exports.eachPieceRequirementIsResolved_COMPLEX = eachPieceRequirementIsResolved_COMPLEX;
9
+ const utils_1 = require("@roster-lock/utils");
10
+ class CycleError extends Error {
11
+ cycles;
12
+ constructor(cycles) {
13
+ super(`Piece requirements form a cycle`);
14
+ this.cycles = cycles;
15
+ }
16
+ getCyclesOfPiece(pieceType) {
17
+ return (0, utils_1.getCyclesUsingKey)(pieceType, this.cycles);
18
+ }
19
+ }
20
+ exports.CycleError = CycleError;
21
+ function validatePieceRequirementCycles(engine) {
22
+ const pieceTypes = Object.keys(engine.pieceDefinitions);
23
+ const cycles = (0, utils_1.findAllCycles)(pieceTypes, (pieceType) => engine.pieceDefinitions[pieceType].requires);
24
+ if (cycles.length > 0)
25
+ throw new CycleError(cycles);
26
+ }
27
+ function validatePieceInCycles(pieceType, engine) {
28
+ const pieceTypes = Object.keys(engine.pieceDefinitions);
29
+ const cycles = (0, utils_1.findAllCycles)(pieceTypes, (pieceType) => engine.pieceDefinitions[pieceType].requires);
30
+ if (cycles.length === 0)
31
+ return;
32
+ const pieceCycles = (0, utils_1.getCyclesUsingKey)(pieceType, cycles);
33
+ if (pieceCycles.length === 0)
34
+ return;
35
+ throw new CycleError(pieceCycles);
36
+ }
37
+ function validatePieceRequirementList(requires) {
38
+ if (requires.length === 0)
39
+ return;
40
+ if (new Set(requires).size !== requires.length)
41
+ throw new Error(`Duplicate requires`);
42
+ }
43
+ function validatePieceRequirementIsResolved(requiredPieceType, engine) {
44
+ const requiredDefinition = engine.pieceDefinitions[requiredPieceType];
45
+ if (!requiredDefinition) {
46
+ throw new Error(`Non-existant piece ${requiredPieceType} required`);
47
+ }
48
+ if (requiredDefinition.selectionStrategy !== "on demand") {
49
+ throw new Error(`Non on-demand piece ${requiredPieceType} required`);
50
+ }
51
+ }
52
+ function eachPieceRequirementIsResolved_COMPLEX(engine) {
53
+ const notOnDemandPieceTypes = new Set();
54
+ const unusedOnDemandPieceTypes = new Set();
55
+ const usedOnDemandPieceTypes = new Set();
56
+ const expectedRequires = new Set();
57
+ for (const [pieceType, definition] of Object.entries(engine.pieceDefinitions)) {
58
+ if (definition.selectionStrategy === "on demand") {
59
+ if (usedOnDemandPieceTypes.has(pieceType))
60
+ continue;
61
+ expectedRequires.delete(pieceType);
62
+ unusedOnDemandPieceTypes.add(pieceType);
63
+ if (definition.requires.length === 0)
64
+ continue;
65
+ if (new Set(definition.requires).size !== definition.requires.length)
66
+ throw new Error(`Piece ${pieceType} has duplicate requires`);
67
+ continue;
68
+ }
69
+ if (expectedRequires.has(pieceType)) {
70
+ throw new Error(`Piece ${pieceType} is required by another piece but is not an on demand piece`);
71
+ }
72
+ notOnDemandPieceTypes.add(pieceType);
73
+ if (definition.requires.length === 0)
74
+ continue;
75
+ if (new Set(definition.requires).size !== definition.requires.length)
76
+ throw new Error(`Piece ${pieceType} has duplicate requires`);
77
+ checkRequires(pieceType, definition);
78
+ }
79
+ if (expectedRequires.size > 0) {
80
+ throw new Error(`The following pieces are required but not resolved: ${Array.from(expectedRequires).join(", ")}`);
81
+ }
82
+ function checkRequires(pieceType, definition) {
83
+ for (const requiredPieceType of definition.requires) {
84
+ if (notOnDemandPieceTypes.has(requiredPieceType)) {
85
+ throw new Error(`Piece ${requiredPieceType} is required by another piece but is not an on demand piece`);
86
+ }
87
+ if (usedOnDemandPieceTypes.has(requiredPieceType))
88
+ continue;
89
+ if (unusedOnDemandPieceTypes.has(requiredPieceType)) {
90
+ unusedOnDemandPieceTypes.delete(requiredPieceType);
91
+ usedOnDemandPieceTypes.add(requiredPieceType);
92
+ checkRequires(requiredPieceType, engine.pieceDefinitions[requiredPieceType]);
93
+ continue;
94
+ }
95
+ expectedRequires.add(requiredPieceType);
96
+ }
97
+ }
98
+ }
99
+ //# sourceMappingURL=requirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirements.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.ts"],"names":[],"mappings":";;;;;;;;AAAA,8CAAsE;AAKtE,gBAAwB,SAAQ,KAAK;IAChB,MAAM;IAAzB,YAAmB,MAA4B;QAC7C,KAAK,CAAC,iCAAiC,CAAC,CAAC;sBADxB,MAAM;IAEzB,CAAC;IACD,gBAAgB,CAAC,SAA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AiB,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ROSTERLOCK_V1_CASTER_JSONSCHEMA = exports.RosterLockV1SchemaKeywords = exports.RosterLockV1Schema = void 0;
18
+ const json_schema_1 = require("../../../util-types/json-schema");
19
+ const engine_1 = require("./engine");
20
+ __exportStar(require("./engine"), exports);
21
+ const rosters_1 = require("./rosters");
22
+ __exportStar(require("./rosters"), exports);
23
+ const selection_1 = require("./selection");
24
+ __exportStar(require("./selection"), exports);
25
+ const piece_meta_1 = require("./piece-meta");
26
+ __exportStar(require("./piece-meta"), exports);
27
+ const shared_1 = require("../shared");
28
+ const shared_2 = require("../shared");
29
+ exports.RosterLockV1Schema = {
30
+ type: "object",
31
+ required: [
32
+ "configIdentity",
33
+ "author", "title", "version",
34
+ "engine", "rosters", "selection", "pieceMeta"
35
+ ],
36
+ additionalProperties: false,
37
+ properties: {
38
+ configIdentity: (0, shared_2.buildIdentity)("lock", 1),
39
+ author: { type: "string" },
40
+ title: { type: "string" },
41
+ version: { type: "string" },
42
+ engine: engine_1.engineSchema,
43
+ rosters: rosters_1.rostersSchema,
44
+ selection: selection_1.selectionConfigSchema,
45
+ pieceMeta: piece_meta_1.pieceMetaSchema,
46
+ },
47
+ };
48
+ exports.RosterLockV1SchemaKeywords = [
49
+ ...shared_1.sharedKeywords,
50
+ ...engine_1.engineKeywords,
51
+ ...rosters_1.rosterKeywords,
52
+ ...selection_1.selectionKeywords,
53
+ ...piece_meta_1.pieceMetaKeywords,
54
+ ];
55
+ exports.ROSTERLOCK_V1_CASTER_JSONSCHEMA = new json_schema_1.JSONSchemaCaster(exports.RosterLockV1Schema, exports.RosterLockV1SchemaKeywords);
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/lock/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,iEAAmE;AACnE,qCAAwD;AACxD,2CAAyB;AACzB,uCAA0D;AAC1D,4CAA0B;AAC1B,2CAAwE;AACxE,8CAA4B;AAC5B,6CAAkE;AAClE,+CAA6B;AAC7B,sCAA2C;AAI3C,sCAA0C;AAE7B,QAAA,kBAAkB,GAAyC;IACtE,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR,gBAAgB;QAChB,QAAQ,EAAE,OAAO,EAAE,SAAS;QAC5B,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW;KAC9C;IACD,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,cAAc,EAAE,IAAA,sBAAa,EAAC,MAAM,EAAE,CAAC,CAAC;QAExC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAE3B,MAAM,EAAE,qBAAY;QACpB,OAAO,EAAE,uBAAa;QACtB,SAAS,EAAE,iCAAqB;QAChC,SAAS,EAAE,4BAAe;KAC3B;CACF,CAAC;AAEW,QAAA,0BAA0B,GAAG;IACxC,GAAG,uBAAc;IACjB,GAAG,uBAAc;IACjB,GAAG,wBAAc;IACjB,GAAG,6BAAiB;IACpB,GAAG,8BAAiB;CACrB,CAAC;AAGW,QAAA,+BAA+B,GAAG,IAAI,8BAAgB,CAEjE,QAAA,kBAAkB,EAAC,QAAA,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pieceMetaKeywords = exports.pieceMetaSchema = exports.selectionPieceMetaSchema = exports.metaPieceValueSchemaValidator = exports.metaDefaultValueSchemaValidator = void 0;
4
+ const json_schema_1 = require("../../../../../util-types/json-schema");
5
+ const validate_1 = require("../validate");
6
+ exports.metaDefaultValueSchemaValidator = (0, json_schema_1.defineKeyword)({
7
+ keyword: "metaDefaultValue",
8
+ type: "object",
9
+ validate: (defaultMeta, { pieceMeta }, path) => {
10
+ const pathParts = path.split("/");
11
+ const pieceType = pathParts[2];
12
+ const sharedPieceMeta = pieceMeta[pieceType];
13
+ if (!sharedPieceMeta) {
14
+ throw new Error(`Piece type ${pieceType} does not have shared piece meta`);
15
+ }
16
+ (0, validate_1.validateMetaDefaultValue)(sharedPieceMeta.schema, defaultMeta);
17
+ },
18
+ });
19
+ exports.metaPieceValueSchemaValidator = (0, json_schema_1.defineKeyword)({
20
+ keyword: "metaPieceValue",
21
+ type: "object",
22
+ validate: (pieceValue, { pieceMeta, rosters }, path) => {
23
+ const pathParts = path.split("/");
24
+ const pieceType = pathParts[2];
25
+ const pieceId = pathParts[4]?.replace(/~1/g, "/").replace(/~0/g, "~");
26
+ const sharedPieceMeta = pieceMeta[pieceType];
27
+ if (!sharedPieceMeta) {
28
+ throw new Error(`Piece type ${pieceType} does not have shared piece meta`);
29
+ }
30
+ const roster = rosters[pieceType];
31
+ if (!roster) {
32
+ throw new Error(`Piece type ${pieceType} does not have a roster`);
33
+ }
34
+ (0, validate_1.validateMetaForPiece)(sharedPieceMeta.schema, pieceId, pieceValue, roster);
35
+ },
36
+ });
37
+ const shallowObjectSchema = {
38
+ type: "object",
39
+ required: [],
40
+ additionalProperties: {
41
+ anyOf: [
42
+ { type: "string" },
43
+ { type: "number" },
44
+ { type: "boolean" },
45
+ { type: "array", items: { type: "string" } },
46
+ { type: "array", items: { type: "number" } },
47
+ { type: "array", items: { type: "boolean" } },
48
+ ],
49
+ },
50
+ };
51
+ exports.selectionPieceMetaSchema = {
52
+ type: "object",
53
+ required: ["schema", "defaultMeta", "values"],
54
+ additionalProperties: false,
55
+ properties: {
56
+ schema: {
57
+ type: "object",
58
+ required: [],
59
+ additionalProperties: {
60
+ type: "string",
61
+ enum: ["boolean", "number", "string", "boolean[]", "number[]", "string[]"],
62
+ },
63
+ },
64
+ defaultMeta: {
65
+ ...shallowObjectSchema,
66
+ [exports.metaDefaultValueSchemaValidator.keyword]: true,
67
+ },
68
+ values: {
69
+ type: "object",
70
+ required: [],
71
+ additionalProperties: {
72
+ ...shallowObjectSchema,
73
+ [exports.metaPieceValueSchemaValidator.keyword]: true,
74
+ }
75
+ },
76
+ },
77
+ };
78
+ exports.pieceMetaSchema = {
79
+ type: "object",
80
+ required: [],
81
+ additionalProperties: exports.selectionPieceMetaSchema,
82
+ };
83
+ exports.pieceMetaKeywords = [
84
+ exports.metaDefaultValueSchemaValidator,
85
+ exports.metaPieceValueSchemaValidator,
86
+ ];
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.ts"],"names":[],"mappings":";;;AAEA,uEAAsE;AAGtE,0CAA6E;AAEhE,QAAA,+BAA+B,GAAG,IAAA,2BAAa,EAAC;IAC3D,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,WAA8B,EAAE,EAAE,SAAS,EAAsB,EAAE,IAAI,EAAC,EAAE;QACnF,MAAM,SAAS,GAAG,IAAI,CAAC,KAA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AAI,EAAE,QAAQ;IACd,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE,QAAA,wBAAwB;CAC/C,CAAC;AAEW,QAAA,iBAAiB,GAAG;IAC/B,QAAA,+BAA+B;IAC/B,QAAA,6BAA6B;CAC9B,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./validate"), exports);
18
+ __exportStar(require("./caster-json-schema"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/lock/piece-meta/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6CAA2B;AAC3B,uDAAqC"}