@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.
- package/LICENSE.md +11 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/match-lock-file/config-types.js +3 -0
- package/dist/match-lock-file/config-types.js.map +1 -0
- package/dist/match-lock-file/index.js +19 -0
- package/dist/match-lock-file/index.js.map +1 -0
- package/dist/match-lock-file/match-config/index.js +18 -0
- package/dist/match-lock-file/match-config/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/draft/index.js +44 -0
- package/dist/match-lock-file/match-config/version-1/draft/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/draft/roster-piece-info.js +32 -0
- package/dist/match-lock-file/match-config/version-1/draft/roster-piece-info.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/draft/selection-script-info.js +13 -0
- package/dist/match-lock-file/match-config/version-1/draft/selection-script-info.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/index.js +22 -0
- package/dist/match-lock-file/match-config/version-1/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.js +37 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.js +43 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.js +7 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.js +41 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.js +20 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.js +31 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.js +40 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.js +17 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.js +16 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/index.js +19 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/error.js +25 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/error.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/index.js +33 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.js +31 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.js +37 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.js +22 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.js +24 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.js +39 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.js +46 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.js +23 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.js +99 -0
- package/dist/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/index.js +56 -0
- package/dist/match-lock-file/match-config/version-1/lock/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.js +87 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/index.js +19 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.js +94 -0
- package/dist/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.js +18 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.js +28 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.js +31 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.js +68 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.js +49 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.js +62 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.js +21 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/index.js +19 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.js +10 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/human.js +27 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/human.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/id.js +27 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/id.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/index.js +74 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.js +31 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.js +25 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/utils.js +23 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/utils.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/version.js +19 -0
- package/dist/match-lock-file/match-config/version-1/lock/rosters/validate/version.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.js +42 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.js +46 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.js +12 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.js +49 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.js +32 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.js +12 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/index.js +19 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/index.js +33 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/script.js +23 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/script.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.js +49 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.js +14 -0
- package/dist/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/file-paths.js +5 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/file-paths.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/index.js +23 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/keywords.js +29 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/keywords.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/schema.js +19 -0
- package/dist/match-lock-file/match-config/version-1/piece-info/schema.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/shared/Identity.js +15 -0
- package/dist/match-lock-file/match-config/version-1/shared/Identity.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/shared/SelectedPiece.js +38 -0
- package/dist/match-lock-file/match-config/version-1/shared/SelectedPiece.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/shared/count.js +48 -0
- package/dist/match-lock-file/match-config/version-1/shared/count.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/shared/index.js +25 -0
- package/dist/match-lock-file/match-config/version-1/shared/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/calculatePieceVersion.js +70 -0
- package/dist/match-lock-file/match-config/version-1/usage/calculatePieceVersion.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/empty-configs.js +49 -0
- package/dist/match-lock-file/match-config/version-1/usage/empty-configs.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/constants.js +8 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/constants.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.js +75 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.js +28 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/index.js +20 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/types.js +3 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/types.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.js +33 -0
- package/dist/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/index.js +22 -0
- package/dist/match-lock-file/match-config/version-1/usage/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/SemVer.js +63 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/SemVer.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/diffLocks.js +51 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/diffLocks.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/index.js +19 -0
- package/dist/match-lock-file/match-config/version-1/usage/publish/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/constants.js +14 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/constants.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.js +53 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js +49 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/index.js +68 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.js +38 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.js +40 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.js +78 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.js +43 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.js.map +1 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.js +26 -0
- package/dist/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.js.map +1 -0
- package/dist/match-lock-file/util-types/json-schema/JSONSchemaCaster.js +45 -0
- package/dist/match-lock-file/util-types/json-schema/JSONSchemaCaster.js.map +1 -0
- package/dist/match-lock-file/util-types/json-schema/defineKeyword.js +30 -0
- package/dist/match-lock-file/util-types/json-schema/defineKeyword.js.map +1 -0
- package/dist/match-lock-file/util-types/json-schema/index.js +21 -0
- package/dist/match-lock-file/util-types/json-schema/index.js.map +1 -0
- package/dist/match-lock-file/util-types/json-schema/safe-keyword.js +3 -0
- package/dist/match-lock-file/util-types/json-schema/safe-keyword.js.map +1 -0
- package/dist/match-lock-file/util-types/json-schema/schema-types.js +3 -0
- package/dist/match-lock-file/util-types/json-schema/schema-types.js.map +1 -0
- package/package.json +49 -0
- package/src/index.ts +3 -0
- package/src/match-lock-file/config-types.ts +10 -0
- package/src/match-lock-file/index.ts +4 -0
- package/src/match-lock-file/match-config/index.ts +2 -0
- package/src/match-lock-file/match-config/version-0/pieces/caster-runtypes/index.ts +99 -0
- package/src/match-lock-file/match-config/version-0/pieces/caster-runtypes/util-casters.ts +155 -0
- package/src/match-lock-file/match-config/version-0/pieces/index.ts +3 -0
- package/src/match-lock-file/match-config/version-0/pieces/types.ts +49 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/definition/assetCount.ts +33 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/definition/assetType.ts +22 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/definition/index.ts +30 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/definition/pathVariables.ts +39 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/index.ts +4 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/sha.ts +23 -0
- package/src/match-lock-file/match-config/version-0/pieces/validate/version.ts +66 -0
- package/src/match-lock-file/match-config/version-0/restriction/casters.ts +52 -0
- package/src/match-lock-file/match-config/version-0/restriction/index.ts +4 -0
- package/src/match-lock-file/match-config/version-0/restriction/types.ts +42 -0
- package/src/match-lock-file/match-config/version-0/restriction/validate/index.ts +15 -0
- package/src/match-lock-file/match-config/version-0/restriction/validate/piece/index.ts +46 -0
- package/src/match-lock-file/match-config/version-0/restriction/validate/sha.ts +19 -0
- package/src/match-lock-file/match-config/version-0/selection/casters.ts +105 -0
- package/src/match-lock-file/match-config/version-0/selection/validate/count.ts +16 -0
- package/src/match-lock-file/match-config/version-0/selection/validate/index.ts +40 -0
- package/src/match-lock-file/match-config/version-0/selection/validate/scriptMeta.ts +26 -0
- package/src/match-lock-file/match-config/version-1/draft/index.ts +52 -0
- package/src/match-lock-file/match-config/version-1/draft/roster-piece-info.ts +33 -0
- package/src/match-lock-file/match-config/version-1/draft/selection-script-info.ts +16 -0
- package/src/match-lock-file/match-config/version-1/index.ts +7 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.ts +46 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.ts +48 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/index.ts +6 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/officialSelections.ts +42 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/index.ts +26 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/requirements/keywords.ts +34 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/schema.ts +47 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/index.ts +22 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/variables/keywords.ts +14 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/index.ts +3 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/constants.ts +7 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/error.ts +21 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/index.ts +18 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath-component.ts +41 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/filepath.ts +55 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/index.ts +21 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/glob/pathvariables.ts +28 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/assets/index.ts +46 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/index.ts +37 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/path-variables.ts +21 -0
- package/src/match-lock-file/match-config/version-1/lock/engine/validate/piece/requirements.ts +117 -0
- package/src/match-lock-file/match-config/version-1/lock/index.ts +51 -0
- package/src/match-lock-file/match-config/version-1/lock/piece-meta/caster-json-schema/index.ts +97 -0
- package/src/match-lock-file/match-config/version-1/lock/piece-meta/index.ts +3 -0
- package/src/match-lock-file/match-config/version-1/lock/piece-meta/validate/index.ts +114 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/downloadableSources.ts +25 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/human.ts +33 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/id.ts +33 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/index.ts +103 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/pathVariables.ts +59 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/requiresPieces.ts +71 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/caster-json-schema/version.ts +22 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/index.ts +3 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/downloadable-source.ts +9 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/human.ts +22 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/id.ts +20 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/index.ts +83 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/path-variables.ts +40 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/required-pieces.ts +30 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/utils.ts +17 -0
- package/src/match-lock-file/match-config/version-1/lock/rosters/validate/version.ts +22 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/index.ts +53 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/script.ts +54 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/game-controlled.ts +11 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/normal.ts +58 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/preselected.ts +37 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/caster-json-schema/selection-types/unselectable.ts +11 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/index.ts +3 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/validate/index.ts +37 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/validate/script.ts +28 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/validate/selections/normal.ts +69 -0
- package/src/match-lock-file/match-config/version-1/lock/selection/validate/selections/preselected.ts +18 -0
- package/src/match-lock-file/match-config/version-1/piece-info/file-paths.ts +2 -0
- package/src/match-lock-file/match-config/version-1/piece-info/index.ts +14 -0
- package/src/match-lock-file/match-config/version-1/piece-info/keywords.ts +39 -0
- package/src/match-lock-file/match-config/version-1/piece-info/schema.ts +29 -0
- package/src/match-lock-file/match-config/version-1/shared/Identity.ts +14 -0
- package/src/match-lock-file/match-config/version-1/shared/SelectedPiece.ts +49 -0
- package/src/match-lock-file/match-config/version-1/shared/count.ts +47 -0
- package/src/match-lock-file/match-config/version-1/shared/index.ts +9 -0
- package/src/match-lock-file/match-config/version-1/usage/calculatePieceVersion.ts +85 -0
- package/src/match-lock-file/match-config/version-1/usage/empty-configs.ts +61 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/constants.ts +6 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/getAssetsOfFiles.ts +88 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/getMatchingAsset.ts +42 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/index.ts +4 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/types.ts +5 -0
- package/src/match-lock-file/match-config/version-1/usage/files-and-assets/validateAssetFileCount.ts +34 -0
- package/src/match-lock-file/match-config/version-1/usage/index.ts +6 -0
- package/src/match-lock-file/match-config/version-1/usage/publish/SemVer.ts +67 -0
- package/src/match-lock-file/match-config/version-1/usage/publish/diffLocks.ts +66 -0
- package/src/match-lock-file/match-config/version-1/usage/publish/index.ts +2 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/constants.ts +9 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.ts +61 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.ts +54 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/index.ts +98 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.ts +49 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.ts +39 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/include-mandatory-require.ts +44 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.ts +101 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.ts +51 -0
- package/src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.ts +36 -0
- package/src/match-lock-file/util-types/json-schema/JSONSchemaCaster.ts +52 -0
- package/src/match-lock-file/util-types/json-schema/checkVersion.ts +9 -0
- package/src/match-lock-file/util-types/json-schema/defineKeyword.ts +50 -0
- package/src/match-lock-file/util-types/json-schema/index.ts +4 -0
- package/src/match-lock-file/util-types/json-schema/safe-keyword.ts +27 -0
- package/src/match-lock-file/util-types/json-schema/schema-types.ts +5 -0
- package/tests/engine/assets.spec.ts +147 -0
- package/tests/engine/official-selections.spec.ts +67 -0
- package/tests/engine/requirements.spec.ts +43 -0
- package/tests/piece-info/cast.spec.ts +20 -0
- package/tests/piece-info/rosterlock.piece-info.json +15 -0
- package/tests/piece-meta/cast.spec.ts +60 -0
- package/tests/rosters/path-variables.spec.ts +52 -0
- package/tests/selection/cast-result.spec.ts +72 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
CollectionId,
|
|
4
|
+
PieceType, PieceId,
|
|
5
|
+
} from "../../../config-types";
|
|
6
|
+
import {
|
|
7
|
+
DateTime,
|
|
8
|
+
Sha256,
|
|
9
|
+
URLType,
|
|
10
|
+
SemVer,
|
|
11
|
+
SignedContent,
|
|
12
|
+
} from "../pieces/caster-runtypes/util-casters";
|
|
13
|
+
|
|
14
|
+
import { MatchLockEngineConfig } from "../../engine";
|
|
15
|
+
import { MatchLockSelectionConfig } from "../../selection";
|
|
16
|
+
import { MatchLockPublishPiece } from "../../piece";
|
|
17
|
+
|
|
18
|
+
export type MatchLockRestrictionPiece = (
|
|
19
|
+
MatchLockPublishPiece & {
|
|
20
|
+
id: PieceId,
|
|
21
|
+
requiredPieces?: Record<CollectionId, Array<PieceId>>
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type MatchLockRestrictionConfig = {
|
|
26
|
+
name: string,
|
|
27
|
+
version: SemVer,
|
|
28
|
+
published: DateTime,
|
|
29
|
+
|
|
30
|
+
sha256: Sha256,
|
|
31
|
+
signature: SignedContent,
|
|
32
|
+
signatureVerificationUrl: URLType,
|
|
33
|
+
|
|
34
|
+
engine: MatchLockEngineConfig,
|
|
35
|
+
|
|
36
|
+
pieces: Record<CollectionId, {
|
|
37
|
+
selectionConfig: MatchLockSelectionConfig,
|
|
38
|
+
pieceDefinition: PieceType,
|
|
39
|
+
pieces: Array<MatchLockRestrictionPiece>
|
|
40
|
+
}>
|
|
41
|
+
}
|
|
42
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { MatchLockRestrictionConfig } from "../types";
|
|
3
|
+
import { validateRestrictionSha } from "./sha";
|
|
4
|
+
import { validateEngineConfig } from "../../engine";
|
|
5
|
+
import { validatePieces } from "./piece";
|
|
6
|
+
|
|
7
|
+
export function validateMatchLockRestriction(restriction: MatchLockRestrictionConfig) {
|
|
8
|
+
validateRestrictionSha(restriction);
|
|
9
|
+
validateEngineConfig(restriction.engine);
|
|
10
|
+
validatePieces(restriction);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { parseFilePath } from "../../../piece/version-0/caster-runtypes/util-casters";
|
|
2
|
+
import { MatchLockRestrictionConfig, MatchLockRestrictionPiece } from "../../types";
|
|
3
|
+
import {
|
|
4
|
+
validatePieceMatchesEngineDefinition,
|
|
5
|
+
validatePieceVersion,
|
|
6
|
+
validatePublishPieceSha,
|
|
7
|
+
} from "../../../piece";
|
|
8
|
+
|
|
9
|
+
export function validatePieces(restriction: MatchLockRestrictionConfig){
|
|
10
|
+
for(const [collectionId, collection] of Object.entries(restriction.pieces)){
|
|
11
|
+
if(!(collection.pieceDefinition in restriction.engine.pieceDefinitions)){
|
|
12
|
+
throw new Error(`Collection ${collectionId} is of non existant type ${collection.pieceDefinition}`);
|
|
13
|
+
}
|
|
14
|
+
const ids = new Set<string>()
|
|
15
|
+
for(const piece of collection.pieces){
|
|
16
|
+
if(ids.has(piece.id)){
|
|
17
|
+
throw new Error(`Duplicate piece id ${piece.id} in collection ${collectionId}`);
|
|
18
|
+
}
|
|
19
|
+
ids.add(piece.id);
|
|
20
|
+
|
|
21
|
+
validatePiecesRequired(restriction, piece);
|
|
22
|
+
validatePieceMatchesEngineDefinition(restriction.engine, piece);
|
|
23
|
+
validatePieceVersion(restriction.engine, piece);
|
|
24
|
+
validatePublishPieceSha(piece);
|
|
25
|
+
}
|
|
26
|
+
validateMatchLockSelection(collection.selectionConfig, ids);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function validatePiecesRequired(
|
|
31
|
+
restriction: MatchLockRestrictionConfig, piece: MatchLockRestrictionPiece
|
|
32
|
+
){
|
|
33
|
+
if(!piece.requiredPieces) return;
|
|
34
|
+
for(const [requiredCollectionId, requiredPieceIds] of Object.entries(piece.requiredPieces)){
|
|
35
|
+
if(!(requiredCollectionId in restriction.pieces)){
|
|
36
|
+
throw new Error(`Piece ${piece.id} requires piece from non existant collection ${requiredCollectionId}`);
|
|
37
|
+
}
|
|
38
|
+
for(const requiredPieceId of requiredPieceIds){
|
|
39
|
+
if(!restriction.pieces[requiredCollectionId].pieces.find(p=>p.id === requiredPieceId)){
|
|
40
|
+
throw new Error(`Piece ${piece.id} requires piece ${requiredPieceId} from collection ${requiredCollectionId} which does not exist`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
import { validateMatchLockSelection } from "../../../selection";
|
|
46
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { MatchLockRestrictionConfig } from "../types";
|
|
3
|
+
import { canonicalJSONStringify } from "../../../../utils/JSON";
|
|
4
|
+
import { createSHA256Hash } from "../../piece/version-0/caster-runtypes/util-casters";
|
|
5
|
+
|
|
6
|
+
export async function validateRestrictionSha(restriction: MatchLockRestrictionConfig){
|
|
7
|
+
const predictableString = canonicalJSONStringify({
|
|
8
|
+
name: restriction.name,
|
|
9
|
+
version: restriction.version,
|
|
10
|
+
published: restriction.published,
|
|
11
|
+
|
|
12
|
+
engine: restriction.engine,
|
|
13
|
+
pieces: restriction.pieces,
|
|
14
|
+
});
|
|
15
|
+
const sha = await createSHA256Hash(predictableString);
|
|
16
|
+
if(sha !== restriction.sha256){
|
|
17
|
+
throw new Error("Restriction's sha isn't equal to the expected")
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Record as CastRecord,
|
|
5
|
+
Object as CastObject,
|
|
6
|
+
Array as CastArray,
|
|
7
|
+
String as CastString,
|
|
8
|
+
Literal,
|
|
9
|
+
Union as CastUnion,
|
|
10
|
+
Tuple as CastTuple,
|
|
11
|
+
Boolean as CastBoolean,
|
|
12
|
+
Undefined as CastUndefined,
|
|
13
|
+
} from "runtypes"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
GasLimittedScript,
|
|
18
|
+
UserSelectionValidation,
|
|
19
|
+
ScriptWithPieceMeta,
|
|
20
|
+
MatchLockSelectionConfig
|
|
21
|
+
} from "../../version-1/selection/types";
|
|
22
|
+
import {
|
|
23
|
+
CountCaster,
|
|
24
|
+
JSONPrimitiveCaster,
|
|
25
|
+
} from "../pieces/caster-runtypes/util-casters";
|
|
26
|
+
import { JSON_Primitive } from "../../../../utils/JSON";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const ScriptCaster = CastObject({
|
|
30
|
+
type: CastUnion(
|
|
31
|
+
Literal("text/typescript"),
|
|
32
|
+
Literal("text/javascript"),
|
|
33
|
+
Literal("text/lua"),
|
|
34
|
+
),
|
|
35
|
+
content: CastString,
|
|
36
|
+
}).conform<GasLimittedScript>();
|
|
37
|
+
|
|
38
|
+
const SelectionCountCaster = CastUnion(
|
|
39
|
+
CountCaster,
|
|
40
|
+
CastTuple(CountCaster, CountCaster),
|
|
41
|
+
).withConstraint((value) => {
|
|
42
|
+
if(!Array.isArray(value)){
|
|
43
|
+
if(value < 0) return "Count is negative";
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if(value[0] < 0) return "Count range min is negative";
|
|
47
|
+
const [min, max] = value;
|
|
48
|
+
if(min > max) return "Count range min is greater than max";
|
|
49
|
+
return true;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const ScriptWithPieceMetaCaster = CastObject({
|
|
53
|
+
name: CastString,
|
|
54
|
+
scriptMeta: CastObject({
|
|
55
|
+
defaultValue: CastRecord(CastString, JSONPrimitiveCaster),
|
|
56
|
+
pieceValues: CastRecord(CastString, CastRecord(CastString, CastUnion(JSONPrimitiveCaster, CastUndefined))),
|
|
57
|
+
}).optional(),
|
|
58
|
+
script: ScriptCaster,
|
|
59
|
+
}).conform<ScriptWithPieceMeta<any>>();
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const UserSelectionValidationCaster = CastObject({
|
|
63
|
+
count: SelectionCountCaster,
|
|
64
|
+
unique: CastBoolean,
|
|
65
|
+
customValidation: CastArray(ScriptWithPieceMetaCaster),
|
|
66
|
+
}).conform<UserSelectionValidation>();
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export const MatchLockSelectionConfigCaster = CastUnion(
|
|
70
|
+
CastObject({
|
|
71
|
+
type: Literal("mandatory"),
|
|
72
|
+
}),
|
|
73
|
+
CastObject({
|
|
74
|
+
type: Literal("on-demand"),
|
|
75
|
+
}),
|
|
76
|
+
CastObject({
|
|
77
|
+
type: Literal("agreed"),
|
|
78
|
+
}),
|
|
79
|
+
CastObject({
|
|
80
|
+
type: Literal("player-choices"),
|
|
81
|
+
validation: CastObject({
|
|
82
|
+
count: SelectionCountCaster,
|
|
83
|
+
unique: CastBoolean,
|
|
84
|
+
customValidation: CastArray(ScriptWithPieceMetaCaster),
|
|
85
|
+
}),
|
|
86
|
+
algorithm: ScriptWithPieceMetaCaster.optional(),
|
|
87
|
+
}),
|
|
88
|
+
CastObject({
|
|
89
|
+
type: Literal("global-choices"),
|
|
90
|
+
validation: CastObject({
|
|
91
|
+
count: SelectionCountCaster,
|
|
92
|
+
unique: CastBoolean,
|
|
93
|
+
customValidation: CastArray(ScriptWithPieceMetaCaster),
|
|
94
|
+
}).optional(),
|
|
95
|
+
algorithm: ScriptWithPieceMetaCaster,
|
|
96
|
+
}),
|
|
97
|
+
CastObject({
|
|
98
|
+
type: Literal("democracy-random"),
|
|
99
|
+
validation: CastObject({
|
|
100
|
+
count: SelectionCountCaster,
|
|
101
|
+
unique: CastBoolean,
|
|
102
|
+
customValidation: CastArray(ScriptWithPieceMetaCaster),
|
|
103
|
+
}).optional(),
|
|
104
|
+
}),
|
|
105
|
+
).conform<MatchLockSelectionConfig>();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
export function validateCount(count: number | [number, number]){
|
|
3
|
+
if(!Array.isArray(count)){
|
|
4
|
+
if(count < 0){
|
|
5
|
+
throw new Error(`Count ${count} is negative`);
|
|
6
|
+
}
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const [min, max] = count;
|
|
10
|
+
if(min < 0){
|
|
11
|
+
throw new Error(`Count ${min} is negative`);
|
|
12
|
+
}
|
|
13
|
+
if(max < min){
|
|
14
|
+
throw new Error(`Count ${max} is less than ${min}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MatchLockSelectionConfig } from "../../types";
|
|
2
|
+
import { validateCount } from "./count";
|
|
3
|
+
import { validateScriptMeta } from "./scriptMeta";
|
|
4
|
+
|
|
5
|
+
export function validateMatchLockSelection(
|
|
6
|
+
selection: MatchLockSelectionConfig, pieceIds: Set<string>
|
|
7
|
+
) {
|
|
8
|
+
switch(selection.type){
|
|
9
|
+
case "mandatory":
|
|
10
|
+
return;
|
|
11
|
+
case "on-demand":
|
|
12
|
+
return;
|
|
13
|
+
case "agreed":
|
|
14
|
+
return;
|
|
15
|
+
case "player-choices":
|
|
16
|
+
validateCount(selection.validation.count);
|
|
17
|
+
for(const script of selection.validation.customValidation){
|
|
18
|
+
validateScriptMeta(script, pieceIds);
|
|
19
|
+
}
|
|
20
|
+
if(!selection.algorithm) return;
|
|
21
|
+
validateScriptMeta(selection.algorithm, pieceIds);
|
|
22
|
+
return;
|
|
23
|
+
case "global-choices":
|
|
24
|
+
if(selection.validation){
|
|
25
|
+
validateCount(selection.validation.count);
|
|
26
|
+
for(const script of selection.validation.customValidation){
|
|
27
|
+
validateScriptMeta(script, pieceIds);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
validateScriptMeta(selection.algorithm, pieceIds);
|
|
31
|
+
return;
|
|
32
|
+
case "democracy-random":
|
|
33
|
+
if(!selection.validation) return;
|
|
34
|
+
validateCount(selection.validation.count);
|
|
35
|
+
if(!selection.validation.customValidation) return;
|
|
36
|
+
for(const script of selection.validation.customValidation){
|
|
37
|
+
validateScriptMeta(script, pieceIds);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { ScriptWithPieceMeta } from "../../types";
|
|
3
|
+
|
|
4
|
+
export function validateScriptMeta(
|
|
5
|
+
script: ScriptWithPieceMeta<any>, pieceIds: Set<string>
|
|
6
|
+
){
|
|
7
|
+
if(!script.scriptMeta) return;
|
|
8
|
+
const defaultType = script.scriptMeta.defaultValue;
|
|
9
|
+
const types: Record<string, string> = {};
|
|
10
|
+
for(const key in defaultType){
|
|
11
|
+
types[key] = typeof defaultType[key];
|
|
12
|
+
}
|
|
13
|
+
for(const [pieceId, pieceMeta] of Object.entries(script.scriptMeta.pieceValues)){
|
|
14
|
+
if(!pieceIds.has(pieceId)){
|
|
15
|
+
throw new Error(`Script ${script.name} references piece ${pieceId} which is not in the piece ids`);
|
|
16
|
+
}
|
|
17
|
+
for(const key in pieceMeta){
|
|
18
|
+
if(!(key in types)){
|
|
19
|
+
throw new Error(`Script ${script.name} references piece ${pieceId} with meta key ${key} which is not in the default meta`);
|
|
20
|
+
}
|
|
21
|
+
if(typeof pieceMeta[key] !== types[key]){
|
|
22
|
+
throw new Error(`Script ${script.name} references piece ${pieceId} with meta key ${key} which is not the same type as the default meta`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import { JSONSchemaType } from "ajv";
|
|
3
|
+
import { RosterLockV1Draft } from "@roster-lock/types";
|
|
4
|
+
import { JSONSchemaCaster, defineKeyword } from "../../../util-types/json-schema";
|
|
5
|
+
|
|
6
|
+
import { RosterLockV1Schema, RosterLockV1SchemaKeywords } from "../lock";
|
|
7
|
+
|
|
8
|
+
import { buildIdentity } from "../shared";
|
|
9
|
+
|
|
10
|
+
import { rosterPieceInfoSchema } from "./roster-piece-info";
|
|
11
|
+
import { selectionScriptInfoSchema } from "./selection-script-info";
|
|
12
|
+
|
|
13
|
+
export const RosterLockV1DraftSchema: JSONSchemaType<RosterLockV1Draft> = {
|
|
14
|
+
type: "object",
|
|
15
|
+
required: ["configIdentity", "previousLock", "stagedLock", "draft"],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
$defs: {
|
|
18
|
+
RosterLockV1Config: RosterLockV1Schema,
|
|
19
|
+
},
|
|
20
|
+
properties: {
|
|
21
|
+
configIdentity: buildIdentity("draft", 1),
|
|
22
|
+
previousLock: { $ref: "#/$defs/RosterLockV1Config" },
|
|
23
|
+
stagedLock: { $ref: "#/$defs/RosterLockV1Config" },
|
|
24
|
+
draft: {
|
|
25
|
+
type: "object", required: ["rosterPieceInfo", "selectionScriptInfo"],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
properties: {
|
|
28
|
+
rosterPieceInfo: {
|
|
29
|
+
type: "object", required: [],
|
|
30
|
+
additionalProperties: {
|
|
31
|
+
type: "object", required: [],
|
|
32
|
+
additionalProperties: rosterPieceInfoSchema
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
selectionScriptInfo: {
|
|
36
|
+
type: "object", required: [],
|
|
37
|
+
additionalProperties: selectionScriptInfoSchema
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
} as JSONSchemaType<RosterLockV1Draft>;
|
|
43
|
+
|
|
44
|
+
function ignore(){ return true; }
|
|
45
|
+
export const RosterLockV1DraftSchemaKeywords = RosterLockV1SchemaKeywords.map((keywordDef)=>{
|
|
46
|
+
return defineKeyword({ keyword: keywordDef.keyword, type: keywordDef.type, validate: ignore });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const ROSTERLOCK_V1_DRAFT_CASTER_JSONSCHEMA = new JSONSchemaCaster<RosterLockV1Draft>(
|
|
50
|
+
RosterLockV1DraftSchema,
|
|
51
|
+
RosterLockV1DraftSchemaKeywords,
|
|
52
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { JSONSchemaType } from "ajv";
|
|
3
|
+
import { RosterLockV1Draft } from "@roster-lock/types";
|
|
4
|
+
|
|
5
|
+
type RosterLockDraftPieceInfo = RosterLockV1Draft["draft"]["rosterPieceInfo"]["string"]["string"];
|
|
6
|
+
export const rosterPieceInfoSchema: JSONSchemaType<RosterLockDraftPieceInfo> = {
|
|
7
|
+
type: "object", additionalProperties: false,
|
|
8
|
+
required: ["testedDownloadSources"],
|
|
9
|
+
properties: {
|
|
10
|
+
referenceFolder: { type: "string", nullable: true },
|
|
11
|
+
testedDownloadSources: {
|
|
12
|
+
type: "array",
|
|
13
|
+
items: {
|
|
14
|
+
type: "object",
|
|
15
|
+
required: ["source", "testedAt", "version"],
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
properties: {
|
|
18
|
+
source: { type: "string" },
|
|
19
|
+
testedAt: { type: "number" },
|
|
20
|
+
version: {
|
|
21
|
+
type: "object", additionalProperties: false,
|
|
22
|
+
required: ["logic", "media", "docs"],
|
|
23
|
+
properties: {
|
|
24
|
+
logic: { type: "string" },
|
|
25
|
+
media: { type: "string" },
|
|
26
|
+
docs: { type: "string" },
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { JSONSchemaType } from "ajv";
|
|
3
|
+
import { RosterLockV1Draft } from "@roster-lock/types";
|
|
4
|
+
|
|
5
|
+
type RosterLockDraftScriptInfo = RosterLockV1Draft["draft"]["selectionScriptInfo"][string];
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const selectionScriptInfoSchema: JSONSchemaType<RosterLockDraftScriptInfo> = {
|
|
9
|
+
type: "object", required: ["lastLoad", "sha", "referencePath"],
|
|
10
|
+
additionalProperties: false,
|
|
11
|
+
properties: {
|
|
12
|
+
lastLoad: { type: "number" },
|
|
13
|
+
sha: { type: "string" },
|
|
14
|
+
referencePath: { type: "string" },
|
|
15
|
+
}
|
|
16
|
+
};
|
package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/index.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { JSONSchemaType } from "ajv";
|
|
2
|
+
import { RosterLockV1Config } from "@roster-lock/types";
|
|
3
|
+
import { countSchema } from "../../../../shared/count";
|
|
4
|
+
type RosterLockEngineConfig = RosterLockV1Config["engine"];
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
assetNameSchemaValidator,
|
|
9
|
+
assetGlobListSchemaValidator,
|
|
10
|
+
assetGlobPathVariablesSchemaValidator,
|
|
11
|
+
assetGlobItemSchemaValidator,
|
|
12
|
+
} from "./keywords";
|
|
13
|
+
export const assetsSchema: JSONSchemaType<
|
|
14
|
+
RosterLockEngineConfig["pieceDefinitions"][string]["assets"]
|
|
15
|
+
> = {
|
|
16
|
+
type: "array",
|
|
17
|
+
items: {
|
|
18
|
+
type: "object",
|
|
19
|
+
additionalProperties: false,
|
|
20
|
+
required: ["name", "classification", "count", "glob"],
|
|
21
|
+
properties: {
|
|
22
|
+
name: {
|
|
23
|
+
[assetNameSchemaValidator.keyword]: true,
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
classification: { type: "string", enum: ["logic", "media", "doc"] },
|
|
27
|
+
count: countSchema,
|
|
28
|
+
glob: {
|
|
29
|
+
[assetGlobListSchemaValidator.keyword]: true,
|
|
30
|
+
type: "array",
|
|
31
|
+
items: {
|
|
32
|
+
[assetGlobPathVariablesSchemaValidator.keyword]: true,
|
|
33
|
+
[assetGlobItemSchemaValidator.keyword]: true,
|
|
34
|
+
type: "string",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const assetKeywords = [
|
|
42
|
+
assetNameSchemaValidator,
|
|
43
|
+
assetGlobListSchemaValidator,
|
|
44
|
+
assetGlobPathVariablesSchemaValidator,
|
|
45
|
+
assetGlobItemSchemaValidator,
|
|
46
|
+
];
|
package/src/match-lock-file/match-config/version-1/lock/engine/caster-json-schema/asset/keywords.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineKeyword } from "../../../../../../util-types/json-schema";
|
|
2
|
+
import { RosterLockV1Config } from "@roster-lock/types";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { validateAssetName } from "../../validate/piece/assets";
|
|
6
|
+
export const assetNameSchemaValidator = defineKeyword({
|
|
7
|
+
keyword: "assetName",
|
|
8
|
+
type: "string",
|
|
9
|
+
validate: function(name: string, { engine }: RosterLockV1Config, path){
|
|
10
|
+
// /engine/pieceDefinitions/pieceType/assets/index/name
|
|
11
|
+
const pathParts = path.split("/").slice(0, -3);
|
|
12
|
+
const pieceType = pathParts.at(-1);
|
|
13
|
+
if(!pieceType) throw new Error("Invalid path");
|
|
14
|
+
const assets = engine.pieceDefinitions[pieceType].assets;
|
|
15
|
+
validateAssetName(name, assets);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
import { validateGlobList } from "../../validate/piece/assets";
|
|
20
|
+
export const assetGlobListSchemaValidator = defineKeyword({
|
|
21
|
+
keyword: "assetGlobList",
|
|
22
|
+
type: "array",
|
|
23
|
+
validate: validateGlobList
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
import { validatePathVariablesInGlob } from "../../validate/piece/assets/glob/pathvariables";
|
|
27
|
+
export const assetGlobPathVariablesSchemaValidator = defineKeyword({
|
|
28
|
+
keyword: "assetGlobPathVariables",
|
|
29
|
+
type: "string",
|
|
30
|
+
validate: function(globItem: string, { engine }: RosterLockV1Config, path){
|
|
31
|
+
// /engine/pieceDefinitions/pieceType/assets/index/glob/index
|
|
32
|
+
const pathParts = path.split("/").slice(0, -4);
|
|
33
|
+
const pieceType = pathParts.at(-1);
|
|
34
|
+
if(!pieceType) throw new Error("Invalid path");
|
|
35
|
+
const variables = engine.pieceDefinitions[pieceType].pathVariables;
|
|
36
|
+
validatePathVariablesInGlob(globItem, variables);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
import { validateGlobItem } from "../../validate/piece/assets/glob";
|
|
41
|
+
export const assetGlobItemSchemaValidator = defineKeyword({
|
|
42
|
+
keyword: "assetGlobItem",
|
|
43
|
+
type: "string",
|
|
44
|
+
validate: validateGlobItem
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { JSONSchemaType } from "ajv";
|
|
2
|
+
import { defineKeyword } from "../../../../../util-types/json-schema";
|
|
3
|
+
import { RosterLockV1Config } from "@roster-lock/types";
|
|
4
|
+
import { sha256SchemaValidator } from "../../rosters/caster-json-schema/version";
|
|
5
|
+
|
|
6
|
+
export const officialSelectionHashUniquenessSchemaValidator = defineKeyword({
|
|
7
|
+
keyword: "officialSelectionHashUniqueness",
|
|
8
|
+
type: "string",
|
|
9
|
+
validate: function (hash: string, { engine }: RosterLockV1Config, path){
|
|
10
|
+
// /engine/officialSelections/index/hash
|
|
11
|
+
const index = Number(path.split("/").at(-2));
|
|
12
|
+
if(Number.isNaN(index)) throw new Error("Invalid path: index is not a number");
|
|
13
|
+
const list = engine.officialSelections ?? [];
|
|
14
|
+
for(let i = 0; i < list.length; i++){
|
|
15
|
+
if(i === index) continue;
|
|
16
|
+
if(list[i].hash === hash) throw new Error(`Duplicate official selection hash ${hash}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const officialSelectionsSchema: JSONSchemaType<
|
|
22
|
+
NonNullable<RosterLockV1Config["engine"]["officialSelections"]>
|
|
23
|
+
> = {
|
|
24
|
+
type: "array",
|
|
25
|
+
items: {
|
|
26
|
+
type: "object",
|
|
27
|
+
required: ["tag", "hash"],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
properties: {
|
|
30
|
+
tag: { type: "string" },
|
|
31
|
+
hash: {
|
|
32
|
+
type: "string",
|
|
33
|
+
[sha256SchemaValidator.keyword]: true,
|
|
34
|
+
[officialSelectionHashUniquenessSchemaValidator.keyword]: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const officialSelectionsKeywords = [
|
|
41
|
+
officialSelectionHashUniquenessSchemaValidator,
|
|
42
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { JSONSchemaType } from "ajv";
|
|
3
|
+
import { requirementListSchemaValidator, requirementItemSchemaValidator, requirementCycleSchemaValidator } from "./keywords";
|
|
4
|
+
import { RosterLockV1Config } from "@roster-lock/types";
|
|
5
|
+
type RosterLockEngineConfig = RosterLockV1Config["engine"];
|
|
6
|
+
|
|
7
|
+
export { requirementCycleSchemaValidator };
|
|
8
|
+
|
|
9
|
+
export const requirementKeywords = [
|
|
10
|
+
requirementListSchemaValidator,
|
|
11
|
+
requirementItemSchemaValidator,
|
|
12
|
+
requirementCycleSchemaValidator,
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const requirementsSchema: JSONSchemaType<
|
|
17
|
+
RosterLockEngineConfig["pieceDefinitions"][string]["requires"]
|
|
18
|
+
> = {
|
|
19
|
+
[requirementListSchemaValidator.keyword]: true,
|
|
20
|
+
[requirementCycleSchemaValidator.keyword]: true,
|
|
21
|
+
type: "array",
|
|
22
|
+
items: {
|
|
23
|
+
[requirementItemSchemaValidator.keyword]: true,
|
|
24
|
+
type: "string",
|
|
25
|
+
},
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineKeyword } from "../../../../../../util-types/json-schema";
|
|
2
|
+
import { RosterLockV1Config } from "@roster-lock/types";
|
|
3
|
+
|
|
4
|
+
import { validatePieceRequirementList } from "../../validate/piece/requirements";
|
|
5
|
+
export const requirementListSchemaValidator = defineKeyword({
|
|
6
|
+
keyword: "requirementList",
|
|
7
|
+
type: "array",
|
|
8
|
+
validate: validatePieceRequirementList
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
import { validatePieceInCycles } from "../../validate/piece/requirements";
|
|
12
|
+
export const requirementCycleSchemaValidator = defineKeyword({
|
|
13
|
+
keyword: "requirementCycle",
|
|
14
|
+
type: "array",
|
|
15
|
+
validate: function(item: string, { engine }: RosterLockV1Config, path){
|
|
16
|
+
// /engine/pieceDefinitions/pieceType/requires
|
|
17
|
+
const parts = path.split("/").slice(0, -1);
|
|
18
|
+
const pieceType = parts.at(-1);
|
|
19
|
+
if(!pieceType) throw new Error("Invalid path");
|
|
20
|
+
|
|
21
|
+
validatePieceInCycles(pieceType, engine);
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
import { validatePieceRequirementIsResolved } from "../../validate/piece/requirements";
|
|
26
|
+
export const requirementItemSchemaValidator = defineKeyword({
|
|
27
|
+
keyword: "requirementResolved",
|
|
28
|
+
type: "string",
|
|
29
|
+
validate: function(item: string, { engine }: RosterLockV1Config, path){
|
|
30
|
+
// /engine/pieceDefinitions/pieceType/requires/index
|
|
31
|
+
validatePieceRequirementIsResolved(item, engine);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|