@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,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildIdentity = buildIdentity;
4
+ function buildIdentity(purpose, version) {
5
+ return {
6
+ type: "object", required: ["namespace", "purpose", "version"],
7
+ additionalProperties: false,
8
+ properties: {
9
+ namespace: { type: "string", const: "roster-lock" },
10
+ purpose: { type: "string", const: purpose },
11
+ version: { type: "number", const: version },
12
+ }
13
+ };
14
+ }
15
+ //# sourceMappingURL=Identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Identity.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/shared/Identity.ts"],"names":[],"mappings":";;;AACA,uBACE,OAAU,EAAE,OAAU;IAEtB,OAAO;QACL,IAAI,EAAE,QAAiB,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAU;QAC/E,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,KAAK,EAAE,aAAsB,EAAE;YACrE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,KAAK,EAAE,OAAO,EAAE;YACpD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,KAAK,EAAE,OAAO,EAAE;SACrD;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SelectedPieceSchema = exports.SelectedPieceSchemaDef = void 0;
4
+ exports.SelectedPieceSchemaDef = {
5
+ $defs: {
6
+ SelectedPiece: {
7
+ type: "object",
8
+ required: ["id", "required"],
9
+ additionalProperties: false,
10
+ properties: {
11
+ id: { type: "string" },
12
+ required: {
13
+ type: "object",
14
+ required: [],
15
+ additionalProperties: {
16
+ type: "object",
17
+ required: ["mandatory", "selectable"],
18
+ additionalProperties: false,
19
+ properties: {
20
+ mandatory: {
21
+ type: "array",
22
+ items: { $ref: "#/$defs/SelectedPiece" },
23
+ },
24
+ selectable: {
25
+ type: "array",
26
+ items: { $ref: "#/$defs/SelectedPiece" },
27
+ }
28
+ }
29
+ },
30
+ },
31
+ },
32
+ },
33
+ },
34
+ };
35
+ exports.SelectedPieceSchema = {
36
+ $ref: "#/$defs/SelectedPiece"
37
+ };
38
+ //# sourceMappingURL=SelectedPiece.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectedPiece.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/shared/SelectedPiece.ts"],"names":[],"mappings":";;;AAaa,QAAA,sBAAsB,GAAG;IACpC,KAAK,EAAE;QACL,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC;YAC5B,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACtB,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,QAAQ,EAAE,EAAE;oBACZ,oBAAoB,EAAE;wBACpB,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;wBACrC,oBAAoB,EAAE,KAAK;wBAC3B,UAAU,EAAE;4BACV,SAAS,EAAE;gCACT,IAAI,EAAE,OAAO;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;6BACzC;4BACD,UAAU,EAAE;gCACV,IAAI,EAAE,OAAO;gCACb,KAAK,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;6BACzC;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC;AAGW,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,uBAAuB;CACc,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countSchema = exports.countSchemaValidator = void 0;
4
+ exports.validateCount = validateCount;
5
+ const json_schema_1 = require("../../../util-types/json-schema");
6
+ exports.countSchemaValidator = (0, json_schema_1.defineKeyword)({
7
+ keyword: "Count",
8
+ type: ["number", "string", "array"],
9
+ validate: validateCount
10
+ });
11
+ exports.countSchema = {
12
+ [exports.countSchemaValidator.keyword]: true,
13
+ type: ["number", "string", "array"],
14
+ anyOf: [
15
+ { type: "number", minimum: 1 },
16
+ { type: "string", const: "*" },
17
+ {
18
+ type: "array",
19
+ items: [
20
+ { type: "number", minimum: 0 },
21
+ { anyOf: [{ type: "number", minimum: 1 }, { type: "string", const: "*" }] },
22
+ ],
23
+ minItems: 2,
24
+ maxItems: 2,
25
+ },
26
+ ],
27
+ };
28
+ function validateCount(count) {
29
+ if (!Array.isArray(count)) {
30
+ if (count === "*")
31
+ return;
32
+ if (count <= 0)
33
+ throw new Error("count should be greater than 0");
34
+ return;
35
+ }
36
+ if (count.length !== 2) {
37
+ throw new Error("range should be a single value or a range of two values");
38
+ }
39
+ if (count[0] < 0) {
40
+ throw new Error("range should not have a negative minimum");
41
+ }
42
+ if (count[1] === "*")
43
+ return;
44
+ if (count[0] >= count[1]) {
45
+ throw new Error("maximum should be greater than the minimum");
46
+ }
47
+ }
48
+ //# sourceMappingURL=count.js.map
@@ -0,0 +1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C,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,IAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAC,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,OAAO;IAC5B,IAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAC,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
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.sharedKeywords = void 0;
18
+ __exportStar(require("./count"), exports);
19
+ __exportStar(require("./Identity"), exports);
20
+ __exportStar(require("./SelectedPiece"), exports);
21
+ const count_1 = require("./count");
22
+ exports.sharedKeywords = [
23
+ count_1.countSchemaValidator,
24
+ ];
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,0CAAwB;AACxB,6CAA2B;AAC3B,kDAAgC;AAEhC,mCAA+C;AAClC,QAAA,cAAc,GAAG;IAC5B,4BAAoB;CACrB,CAAC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculatePieceVersion = calculatePieceVersion;
4
+ async function calculatePieceVersion(files, getFile, onProgress) {
5
+ const logicFiles = [];
6
+ const mediaFiles = [];
7
+ const docFiles = [];
8
+ await Promise.all(Array.from(files.entries()).map(async ([relativePath, { assets }]) => {
9
+ const sha = await getHashFromFile(relativePath, getFile, onProgress);
10
+ const asset = assets[0];
11
+ if (!asset)
12
+ throw new Error(`No asset found for ${relativePath}`);
13
+ switch (asset.classification) {
14
+ case "logic":
15
+ logicFiles.push({ path: relativePath, asset, sha });
16
+ break;
17
+ case "media":
18
+ mediaFiles.push({ path: relativePath, asset, sha });
19
+ break;
20
+ case "doc":
21
+ docFiles.push({ path: relativePath, asset, sha });
22
+ break;
23
+ default: throw new Error(`Unknown asset type ${asset.classification}`);
24
+ }
25
+ }));
26
+ return {
27
+ logic: await calculateComnbinedHash(logicFiles.sort(shaSort)),
28
+ media: await calculateComnbinedHash(mediaFiles.sort(shaSort)),
29
+ docs: await calculateComnbinedHash(docFiles.sort(shaSort)),
30
+ };
31
+ }
32
+ function shaSort(a, b) {
33
+ return a.sha.localeCompare(b.sha);
34
+ }
35
+ async function getHashFromFile(file, getFile, onProgress) {
36
+ try {
37
+ const { stream, byteSize } = await getFile(file);
38
+ const buffer = new Uint8Array(byteSize);
39
+ let consumed = 0;
40
+ for await (const chunk of stream) {
41
+ buffer.set(chunk, consumed);
42
+ consumed += chunk.byteLength;
43
+ onProgress && onProgress({ file, current: consumed, total: byteSize });
44
+ }
45
+ return toHex(await crypto.subtle.digest("SHA-256", buffer));
46
+ }
47
+ catch (e) {
48
+ throw new Error("Failed to calculate Hash from file");
49
+ }
50
+ }
51
+ async function calculateComnbinedHash(files) {
52
+ if (files.length === 0) {
53
+ return toHex(await crypto.subtle.digest("SHA-256", new Uint8Array(0)));
54
+ }
55
+ const buffer = new Uint8Array(files.length * 32);
56
+ let offset = 0;
57
+ for (const { sha } of files) {
58
+ for (let i = 0; i < sha.length; i += 2) {
59
+ const byte = Number.parseInt(sha.substring(i, i + 2), 16);
60
+ if (Number.isNaN(byte))
61
+ throw new Error(`Invalid SHA: ${sha}`);
62
+ buffer[offset++] = byte;
63
+ }
64
+ }
65
+ return toHex(await crypto.subtle.digest("SHA-256", buffer));
66
+ }
67
+ function toHex(buffer) {
68
+ return Array.from(new Uint8Array(buffer)).map(b => b.toString(16).padStart(2, "0")).join("");
69
+ }
70
+ //# sourceMappingURL=calculatePieceVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculatePieceVersion.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/usage/calculatePieceVersion.ts"],"names":[],"mappings":";;;AAQO,KAAK,gCACV,KAA4D,EAC5D,OAAmB,EACnB,UAA6B;IAE7B,MAAM,UAAU,GAAuB,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAuB,EAAE,CAAC;IAC1C,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;QACrF,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAG,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,YAAY,EAAE,CAAC,CAAC;QACjE,QAAO,KAAK,CAAC,cAAc,EAAC,CAAC;YAC3B,KAAK,OAAO;gBAAE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,KAA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,OAAO,KAAK,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,KAAK,CAAC,MAAmB;IAChC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMPTY_PIECE_META = exports.EMPTY_ROSTER_UNSELECTABLE_SELECTION = exports.EMPTY_ROSTER_PRESELECTED_SELECTION = exports.EMPTY_ROSTER_NORMAL_SELECTION = exports.EMPTY_ROSTER_GAME_SELECTION = exports.EMPTY_ROSTER_DRAFT = exports.EMPTY_ROSTER_LOCK = void 0;
4
+ const utils_1 = require("@roster-lock/utils");
5
+ exports.EMPTY_ROSTER_LOCK = {
6
+ configIdentity: { namespace: "roster-lock", purpose: "lock", version: 1 },
7
+ author: "",
8
+ title: "",
9
+ version: "0.0.0",
10
+ engine: { name: "", version: "", pieceDefinitions: {} },
11
+ rosters: {},
12
+ selection: { piece: {}, globalValidation: [], scriptDictionary: {}, },
13
+ pieceMeta: {},
14
+ };
15
+ exports.EMPTY_ROSTER_DRAFT = {
16
+ configIdentity: { namespace: "roster-lock", purpose: "draft", version: 1 },
17
+ previousLock: (0, utils_1.cloneJSON)(exports.EMPTY_ROSTER_LOCK),
18
+ stagedLock: (0, utils_1.cloneJSON)(exports.EMPTY_ROSTER_LOCK),
19
+ draft: {
20
+ rosterPieceInfo: {},
21
+ selectionScriptInfo: {},
22
+ }
23
+ };
24
+ exports.EMPTY_ROSTER_GAME_SELECTION = {
25
+ type: "game-controlled",
26
+ };
27
+ exports.EMPTY_ROSTER_NORMAL_SELECTION = {
28
+ type: "normal",
29
+ validation: {
30
+ count: "*",
31
+ unique: false,
32
+ banList: [],
33
+ customValidation: []
34
+ },
35
+ mergeAlgorithm: void 0
36
+ };
37
+ exports.EMPTY_ROSTER_PRESELECTED_SELECTION = {
38
+ type: "preselected",
39
+ pieces: []
40
+ };
41
+ exports.EMPTY_ROSTER_UNSELECTABLE_SELECTION = {
42
+ type: "unselectable",
43
+ };
44
+ exports.EMPTY_PIECE_META = {
45
+ schema: {},
46
+ defaultMeta: {},
47
+ values: {},
48
+ };
49
+ //# sourceMappingURL=empty-configs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-configs.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/usage/empty-configs.ts"],"names":[],"mappings":";;;AACA,8CAA+C;AAElC,QAAA,iBAAiB,GAAuB;IACnD,cAAc,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE;IACzE,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE;IACvD,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,GAAG;IACrE,SAAS,EAAE,EAAE;CACd,CAAA;AAEY,QAAA,kBAAkB,GAAsB;IACnD,cAAc,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;IAC1E,YAAY,EAAE,IAAA,iBAAS,EAAC,QAAA,iBAAiB,CAAC;IAC1C,UAAU,EAAE,IAAA,iBAAS,EAAC,QAAA,iBAAiB,CAAC;IACxC,KAAK,EAAE;QACL,eAAe,EAAE,EAAE;QACnB,mBAAmB,EAAE,EAAE;KACxB;CACF,CAAC;AAUW,QAAA,2BAA2B,GAAkC;IACxE,IAAI,EAAE,iBAAiB;CACxB,CAAA;AAEY,QAAA,6BAA6B,GAA0B;IAClE,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE;QACX,gBAAgB,EAAE,EAAE;KACrB;IACD,cAAc,EAAE,KAAK,CAAC;CACvB,CAAA;AAEY,QAAA,kCAAkC,GAA+B;IAC5E,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,EAAE;CACX,CAAA;AAEY,QAAA,mCAAmC,GAAgC;IAC9E,IAAI,EAAE,cAAc;CACrB,CAAA;AAEY,QAAA,gBAAgB,GAA0C;IACrE,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,EAAE;CACX,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILES_TO_IGNORE = void 0;
4
+ const piece_info_1 = require("../../piece-info");
5
+ exports.FILES_TO_IGNORE = [
6
+ piece_info_1.PATH_ROSTERLOCK_PIECE_INFO
7
+ ];
8
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/constants.ts"],"names":[],"mappings":";;;AACA,iDAA6D;AAEhD,QAAA,eAAe,GAAG;IAC7B,uCAA0B;CAC3B,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMatchingAssetsForFile = void 0;
4
+ exports.getAssetsOfFiles = getAssetsOfFiles;
5
+ exports.collectAssetFileErrors = collectAssetFileErrors;
6
+ const constants_1 = require("./constants");
7
+ const getMatchingAsset_1 = require("./getMatchingAsset");
8
+ Object.defineProperty(exports, "getMatchingAssetsForFile", { enumerable: true, get: function () { return getMatchingAsset_1.getMatchingAssetsForFile; } });
9
+ async function getAssetsOfFiles(files, pathVariables, pieceDefinition) {
10
+ const assetCounts = new Map();
11
+ const fileCounts = new Map();
12
+ for await (const filePath of files) {
13
+ if (constants_1.FILES_TO_IGNORE.includes(filePath))
14
+ continue;
15
+ const assetMatching = (0, getMatchingAsset_1.getMatchingAssetsForFile)(pieceDefinition, pathVariables, filePath);
16
+ const asset = assetMatching[0];
17
+ if (!asset) {
18
+ fileCounts.set(filePath, { assets: [] });
19
+ continue;
20
+ }
21
+ if (assetMatching.length > 1) {
22
+ }
23
+ const currentCount = (() => {
24
+ const currentCount = assetCounts.get(asset.name);
25
+ if (currentCount)
26
+ return currentCount;
27
+ const newCount = { files: [], asset: asset };
28
+ assetCounts.set(asset.name, newCount);
29
+ return newCount;
30
+ })();
31
+ currentCount.files.push(filePath);
32
+ fileCounts.set(filePath, { assets: assetMatching });
33
+ }
34
+ for (const asset of pieceDefinition.assets) {
35
+ const currentCountInfo = assetCounts.get(asset.name);
36
+ if (!currentCountInfo) {
37
+ assetCounts.set(asset.name, { files: [], asset });
38
+ }
39
+ }
40
+ return { filesWithAssets: fileCounts, assetsWithFiles: assetCounts };
41
+ }
42
+ const validateAssetFileCount_1 = require("./validateAssetFileCount");
43
+ function collectAssetFileErrors({ assetsWithFiles, filesWithAssets }) {
44
+ const errors = [];
45
+ for (const [assetName, { asset, files }] of assetsWithFiles) {
46
+ try {
47
+ if (files.length === 0 && !(0, validateAssetFileCount_1.isValidAssetFileCount)(asset.count, 0)) {
48
+ errors.push({
49
+ type: "asset",
50
+ id: assetName,
51
+ message: `Asset is expected to have files`,
52
+ });
53
+ continue;
54
+ }
55
+ (0, validateAssetFileCount_1.validateAssetFileCount)(asset.count, files.length);
56
+ }
57
+ catch (e) {
58
+ errors.push({
59
+ type: "asset",
60
+ id: assetName,
61
+ message: e.message,
62
+ });
63
+ }
64
+ }
65
+ for (const [filePath, { assets }] of filesWithAssets) {
66
+ if (assets.length === 0)
67
+ errors.push({
68
+ type: "file",
69
+ id: filePath,
70
+ message: "File has no matching assets",
71
+ });
72
+ }
73
+ return errors;
74
+ }
75
+ //# sourceMappingURL=getAssetsOfFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAssetsOfFiles.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.ts"],"names":[],"mappings":";;;;;AAAA,2CAA8C;AAE9C,yDAA8D;yGAArD,2CAAwB;AAM1B,KAAK,2BACV,KAA+C,EAC/C,aAAqC,EACrC,eAAgC;IAKhC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkE,CAAC;IAC9F,MAAM,UAAU,GAAG,IAAI,GAAG,EAAoD,CAAC;IAC/E,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,KAAK,EAAC,CAAC;QAClC,IAAG,2BAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,SAAS;QAEhD,MAAM,aAAa,GAAG,IAAA,2CAAwB,EAAC,eAAe,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;QACzF,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAG,CAAC,KAAK,EAAC,CAAC;YAET,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;YACzC,SAAS;QACX,CAAC;QACD,IAAG,aAAa,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC;QAE7B,CAAC;QACD,MAAM,YAAY,GAAG,CAAC,GAA2D,EAAE;YACjF,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjD,IAAG,YAAY;gBAAE,OAAO,YAAY,CAAC;YACrC,MAAM,QAAQ,GAAG,EAAE,KAAK,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AAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,OAAO;gBACb,EAAE,EAAE,SAAS;gBACb,OAAO,EAAG,CAAW,CAAC,OAAO;aAC9B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,KAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,IAAI,eAAe,EAAC,CAAC;QACnD,IAAG,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC;gBAClC,IAAI,EAAE,MAAM;gBACZ,EAAE,EAAE,QAAQ;gBACZ,OAAO,EAAE,6BAA6B;aACvC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,28 @@
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.getMatchingAssetsForFile = getMatchingAssetsForFile;
7
+ const micromatch_1 = __importDefault(require("micromatch"));
8
+ const validate_1 = require("../../lock/rosters/validate");
9
+ function getMatchingAssetsForFile(pieceDefinition, pathVariables, relativePath) {
10
+ for (const variableValue of Object.values(pathVariables)) {
11
+ (0, validate_1.validatePathVariableValue)(variableValue);
12
+ }
13
+ return pieceDefinition.assets.filter((asset) => (asset.glob.some((glob) => {
14
+ glob = replacePathVariables(glob, pathVariables);
15
+ if (relativePath === glob)
16
+ return true;
17
+ if (micromatch_1.default.isMatch(relativePath, glob))
18
+ return true;
19
+ return false;
20
+ })));
21
+ }
22
+ function replacePathVariables(glob, pathVariables) {
23
+ for (const [variableName, value] of Object.entries(pathVariables)) {
24
+ glob = glob.replaceAll(`<${variableName}>`, value);
25
+ }
26
+ return glob;
27
+ }
28
+ //# sourceMappingURL=getMatchingAsset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMatchingAsset.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AAIpC,0DAAwE;AAIxE,kCACE,eAAmE,EACnE,aAAqC,EACrC,YAAoB;IAGpB,KAAI,MAAM,aAAa,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAC,CAAC;QACvD,IAAA,oCAAyB,EAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAA,CAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAC,EAAE;QAEtB,IAAI,GAAG,oBAAoB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAKjD,IAAG,YAAY,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAEtC,IAAG,oBAAU,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACH,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAC3B,IAAY,EAAE,aAAqC;IAEnD,KAAI,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAC,CAAC;QAChE,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,YAAY,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
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("./getAssetsOfFiles"), exports);
18
+ __exportStar(require("./getMatchingAsset"), exports);
19
+ __exportStar(require("./validateAssetFileCount"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,qDAAmC;AACnC,qDAAmC;AACnC,2DAAyC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateAssetFileCount = validateAssetFileCount;
4
+ exports.isValidAssetFileCount = isValidAssetFileCount;
5
+ function validateAssetFileCount(validator, actualCount) {
6
+ if (!Array.isArray(validator)) {
7
+ if (validator === "*")
8
+ return;
9
+ if (actualCount !== validator) {
10
+ throw new Error(`Expected ${validator} files, got ${actualCount}`);
11
+ }
12
+ return;
13
+ }
14
+ const [min, max] = validator;
15
+ if (actualCount < min) {
16
+ throw new Error(`Expected at least ${min} files, got ${actualCount}`);
17
+ }
18
+ if (max === "*")
19
+ return;
20
+ if (actualCount > max) {
21
+ throw new Error(`Expected at most ${max} files, got ${actualCount}`);
22
+ }
23
+ }
24
+ function isValidAssetFileCount(validator, actualCount) {
25
+ try {
26
+ validateAssetFileCount(validator, actualCount);
27
+ return true;
28
+ }
29
+ catch (e) {
30
+ return false;
31
+ }
32
+ }
33
+ //# sourceMappingURL=validateAssetFileCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateAssetFileCount.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.ts"],"names":[],"mappings":";;;;AAEA,gCACE,SAAyC,EACzC,WAAmB;IAEnB,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAC,CAAC;QAC5B,IAAG,SAAS,KAAK,GAAG;YAAE,OAAO;QAC7B,IAAG,WAAW,KAAK,SAAS,EAAC,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,SAAS,eAAe,WAAW,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IAC7B,IAAG,WAAW,GAAG,GAAG,EAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,eAAe,WAAW,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,IAAG,GAAG,KAAK,GAAG;QAAE,OAAO;IACvB,IAAG,WAAW,GAAG,GAAG,EAAC,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,eAAe,WAAW,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,+BACE,SAAyC,EACzC,WAAmB;IAEnB,IAAI,CAAC;QACH,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAAA,OAAM,CAAC,EAAC,CAAC;QACR,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
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("./files-and-assets"), exports);
18
+ __exportStar(require("./validate-select"), exports);
19
+ __exportStar(require("./calculatePieceVersion"), exports);
20
+ __exportStar(require("./empty-configs"), exports);
21
+ __exportStar(require("./publish"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/match-lock-file/match-config/version-1/usage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,qDAAmC;AACnC,oDAAkC;AAClC,0DAAwC;AACxC,kDAAgC;AAChC,4CAA0B"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SemVer = void 0;
4
+ class SemVer {
5
+ updateStatus = "none";
6
+ v;
7
+ reasons = {
8
+ major: [],
9
+ minor: [],
10
+ patch: [],
11
+ };
12
+ constructor(value) {
13
+ const parts = value.split(".");
14
+ if (parts.length !== 3)
15
+ throw new Error("Invalid Semver string");
16
+ this.v = {
17
+ major: SemVer.validateVersion(parts[0], "major"),
18
+ minor: SemVer.validateVersion(parts[1], "minor"),
19
+ patch: SemVer.validateVersion(parts[2], "patch"),
20
+ };
21
+ if (value !== this.toString()) {
22
+ throw new Error("Invalid Semver string");
23
+ }
24
+ }
25
+ addMajor(reason, info = {}) {
26
+ this.reasons.major.push({ reason, info });
27
+ if (this.updateStatus === "major")
28
+ return;
29
+ this.updateStatus = "major";
30
+ this.v.major += 1;
31
+ this.v.minor = 0;
32
+ this.v.patch = 0;
33
+ }
34
+ addMinor(reason, info = {}) {
35
+ this.reasons.minor.push({ reason, info });
36
+ if (this.updateStatus === "minor")
37
+ return;
38
+ this.updateStatus = "minor";
39
+ this.v.minor += 1;
40
+ this.v.patch = 0;
41
+ }
42
+ addPatch(reason, info = {}) {
43
+ this.reasons.patch.push({ reason, info });
44
+ if (this.updateStatus === "patch")
45
+ return;
46
+ this.updateStatus = "patch";
47
+ this.v.patch += 1;
48
+ }
49
+ toString() {
50
+ return [this.v.major, this.v.minor, this.v.patch].join(".");
51
+ }
52
+ getReasons() {
53
+ return this.reasons;
54
+ }
55
+ static validateVersion(value, partName) {
56
+ const v = Number.parseInt(value);
57
+ if (Number.isNaN(v))
58
+ throw new Error(`Invalid Semver string: ${partName} version not an integer`);
59
+ return v;
60
+ }
61
+ }
62
+ exports.SemVer = SemVer;
63
+ //# sourceMappingURL=SemVer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SemVer.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/publish/SemVer.ts"],"names":[],"mappings":";;;AAEA;IACU,YAAY,GAAyC,MAAM,CAAC;IACpE,CAAC,CAIA;IACD,OAAO,GAIH;QACF,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;KACV,CAAA;IACD,YAAY,KAAa;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAG,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAA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AC,MAAc,EAAE,IAAI,GAAiB,EAAE;QAC9C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,IAAG,IAAI,CAAC,YAAY,KAAK,OAAO;YAAE,OAAO;QACzC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;IACnB,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC7D,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,KAAa,EAAE,QAAgB;QACpD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAChC,IAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,QAAQ,yBAAyB,CAAC,CAAA;QAChG,OAAO,CAAC,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diffLocks = diffLocks;
4
+ const json_diff_ts_1 = require("json-diff-ts");
5
+ const SemVer_1 = require("./SemVer");
6
+ function diffLocks(oldLock, newLock) {
7
+ const versionTracker = new SemVer_1.SemVer(oldLock.version);
8
+ diffRosters(versionTracker, oldLock, newLock);
9
+ return versionTracker;
10
+ }
11
+ function diffRosters(versionTracker, oldLock, newLock) {
12
+ const oldPieceCollections = Object.entries(oldLock.rosters);
13
+ const newPieceCollectionKeys = Object.keys(newLock.rosters);
14
+ const missingCollections = [];
15
+ const addedCollections = new Set(newPieceCollectionKeys);
16
+ for (const [key, oldPieces] of oldPieceCollections) {
17
+ const newPieces = newLock.rosters[key];
18
+ if (!newPieces) {
19
+ versionTracker.addMajor("Missing Piece Collection", { collectionName: key });
20
+ missingCollections.push(key);
21
+ continue;
22
+ }
23
+ addedCollections.delete(key);
24
+ diffPieces(versionTracker, key, oldPieces, newPieces);
25
+ }
26
+ for (const key of addedCollections) {
27
+ versionTracker.addMajor("New Piece Collection", { collectionName: key });
28
+ }
29
+ return versionTracker;
30
+ }
31
+ function diffPieces(versionTracker, collection, oldLock, newLock) {
32
+ const newPieces = new Map();
33
+ for (const newPiece of newLock) {
34
+ newPieces.set(newPiece.version.logic, newPiece);
35
+ }
36
+ for (const oldPiece of oldLock) {
37
+ const newPiece = newPieces.get(oldPiece.version.logic);
38
+ if (!newPiece) {
39
+ versionTracker.addMajor("Removed a Piece", { collection, id: oldPiece.id, logic: oldPiece.version.logic });
40
+ continue;
41
+ }
42
+ newPieces.delete(oldPiece.version.logic);
43
+ if ((0, json_diff_ts_1.diff)(oldPiece, newPiece)) {
44
+ versionTracker.addPatch("Updated non gameplay piece info", { collection, id: oldPiece.id, old: oldPiece.downloadSources, new: newPiece.downloadSources });
45
+ }
46
+ }
47
+ for (const [logic, newPiece] of newPieces) {
48
+ versionTracker.addMinor("Added a Piece", { collection, id: newPiece.id, logic });
49
+ }
50
+ }
51
+ //# sourceMappingURL=diffLocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffLocks.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/publish/diffLocks.ts"],"names":[],"mappings":";;;AACA,+CAAoC;AACpC,qCAAkC;AAGlC,mBAA0B,OAA2B,EAAE,OAA2B;IAChF,MAAM,cAAc,GAAG,IAAI,eAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnD,WAAW,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,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