@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SemVer"), exports);
|
|
18
|
+
__exportStar(require("./diffLocks"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/publish/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunUntrustedError = void 0;
|
|
4
|
+
class RunUntrustedError extends Error {
|
|
5
|
+
scriptSrc;
|
|
6
|
+
error;
|
|
7
|
+
constructor(scriptSrc, message, error) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.scriptSrc = scriptSrc;
|
|
10
|
+
this.error = error;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RunUntrustedError = RunUntrustedError;
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/constants.ts"],"names":[],"mappings":";;;AAEA,uBAA+B,SAAQ,KAAK;IAEjC,SAAS;IAAkC,KAAK;IADzD,YACS,SAAiB,EAAE,OAAe,EAAS,KAAU;QAE5D,KAAK,CAAC,OAAO,CAAC,CAAA;yBAFP,SAAS;qBAAkC,KAAK;IAGzD,CAAC;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensurePiecesAreInRoster = ensurePiecesAreInRoster;
|
|
4
|
+
function ensurePiecesAreInRoster(config, pieceType, selections) {
|
|
5
|
+
const requireConfig = new Set(config.engine.pieceDefinitions[pieceType].requires);
|
|
6
|
+
if (requireConfig.size !== config.engine.pieceDefinitions[pieceType].requires.length) {
|
|
7
|
+
throw new Error(`${pieceType} requires has duplicate items`);
|
|
8
|
+
}
|
|
9
|
+
const roster = config.rosters[pieceType];
|
|
10
|
+
for (const piece of selections) {
|
|
11
|
+
const rosterPiece = roster.find(p => p.id === piece.id);
|
|
12
|
+
if (!rosterPiece) {
|
|
13
|
+
throw new Error(`Piece ${piece.id} is not in the roster`);
|
|
14
|
+
}
|
|
15
|
+
const pieceRequiredKeys = Object.keys(piece.required);
|
|
16
|
+
if (pieceRequiredKeys.length !== requireConfig.size) {
|
|
17
|
+
throw new Error(`Piece ${piece.id} has incorrect number of required keys`);
|
|
18
|
+
}
|
|
19
|
+
for (const requirePieceType of pieceRequiredKeys) {
|
|
20
|
+
if (!requireConfig.has(requirePieceType)) {
|
|
21
|
+
throw new Error(`Piece ${piece.id} is missing required piece type ${requirePieceType}`);
|
|
22
|
+
}
|
|
23
|
+
ensureCorrectMandatory(rosterPiece, requirePieceType, piece.required[requirePieceType].mandatory);
|
|
24
|
+
ensurePiecesAreInRoster(config, requirePieceType, piece.required[requirePieceType].mandatory);
|
|
25
|
+
ensureSelectionIsAllowed(rosterPiece, requirePieceType, piece.required[requirePieceType].selectable);
|
|
26
|
+
ensurePiecesAreInRoster(config, requirePieceType, piece.required[requirePieceType].selectable);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function ensureCorrectMandatory(rosterPiece, requiredPieceType, mandatoryPieces) {
|
|
31
|
+
const rosterMandatory = rosterPiece.requiredPieces[requiredPieceType];
|
|
32
|
+
if (!rosterMandatory)
|
|
33
|
+
throw new Error(`Roster Piece ${rosterPiece.id} missing required ${requiredPieceType}`);
|
|
34
|
+
if (rosterMandatory.expected.length !== mandatoryPieces.length) {
|
|
35
|
+
throw new Error(`Piece ${rosterPiece.id} has incorrect number of required pieces for ${requiredPieceType}`);
|
|
36
|
+
}
|
|
37
|
+
for (let i = 0; i < rosterMandatory.expected.length; i++) {
|
|
38
|
+
const mandatoryId = rosterMandatory.expected[i];
|
|
39
|
+
const mandatoryPiece = mandatoryPieces[i];
|
|
40
|
+
if (mandatoryId !== mandatoryPiece.id) {
|
|
41
|
+
throw new Error(`Piece ${rosterPiece.id} has incorrect required piece of ${requiredPieceType} at ${i}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function ensureSelectionIsAllowed(rosterPiece, requiredPieceType, selectedPieces) {
|
|
46
|
+
const rosterMandatory = rosterPiece.requiredPieces[requiredPieceType];
|
|
47
|
+
if (!rosterMandatory)
|
|
48
|
+
throw new Error(`Roster Piece ${rosterPiece.id} missing required ${requiredPieceType}`);
|
|
49
|
+
if (!rosterMandatory.selectable && selectedPieces.length > 0) {
|
|
50
|
+
throw new Error(`Piece ${rosterPiece.id} does not allow custom selection for ${requiredPieceType}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=ensure-pieces-are-in-roster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-pieces-are-in-roster.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/ensure-pieces-are-in-roster.ts"],"names":[],"mappings":";;;AAGA,iCACE,MAA0B,EAC1B,SAAoB,EACpB,UAAgC;IAEhC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;I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CAAC,iBAAiB,CAAC,CAAC;IACtE,IAAG,CAAC,eAAe;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,WAAW,CAAC,EAAE,qBAAqB,iBAAiB,EAAE,CAAC,CAAC;IAC7G,IAAG,CAAC,eAAe,CAAC,UAAU,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,SAAS,WAAW,CAAC,EAAE,wCAAwC,iBAAiB,EAAE,CAAC,CAAC;IACtG,CAAC;AACH,CAAC"}
|
package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleValidationResult = handleValidationResult;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
async function handleValidationResult(script, result) {
|
|
6
|
+
const isValid = await (async () => {
|
|
7
|
+
try {
|
|
8
|
+
return await result;
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
throw new constants_1.RunUntrustedError(script.src, e instanceof Error ? e.message : String(e), e);
|
|
12
|
+
}
|
|
13
|
+
})();
|
|
14
|
+
const errorStatus = normalizeError(isValid);
|
|
15
|
+
if (!errorStatus.passed) {
|
|
16
|
+
throw new constants_1.RunUntrustedError(script.src, errorStatus.message, isValid);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const INVALID_VALUE = "Invalid return type for validation";
|
|
20
|
+
const FAILED_WITHOUT_MESSAGE = "Validation Failed";
|
|
21
|
+
function normalizeError(validResult) {
|
|
22
|
+
if (typeof validResult === "boolean") {
|
|
23
|
+
if (validResult)
|
|
24
|
+
return { passed: true };
|
|
25
|
+
return { passed: false, message: FAILED_WITHOUT_MESSAGE };
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(validResult)) {
|
|
28
|
+
const [passed, reason] = validResult;
|
|
29
|
+
if (typeof passed !== "boolean") {
|
|
30
|
+
return { passed: false, message: INVALID_VALUE };
|
|
31
|
+
}
|
|
32
|
+
if (passed)
|
|
33
|
+
return { passed: true };
|
|
34
|
+
return {
|
|
35
|
+
passed: false,
|
|
36
|
+
message: typeof reason === "string" ? reason : FAILED_WITHOUT_MESSAGE,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (typeof validResult === "string") {
|
|
40
|
+
return {
|
|
41
|
+
passed: false,
|
|
42
|
+
message: validResult
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (validResult === null || validResult === void 0)
|
|
46
|
+
return { passed: true };
|
|
47
|
+
return { passed: false, message: INVALID_VALUE };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=handle-validation.js.map
|
package/dist/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-validation.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/handle-validation.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAEzC,KAAK,iCACV,MAAuB,EAAE,MAAwB;IAEjD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,IAAG,EAAE;QAC/B,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC;QACtB,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,MAAM,IAAI,6BAAiB,CACzB,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IACL,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAG,CAAC,WAAW,CAAC,MAAM,EAAC,CAAC;QACtB,MAAM,IAAI,6BAAiB,CACzB,MAAM,CAAC,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|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runSelection = runSelection;
|
|
4
|
+
const game_controlled_1 = require("./selection-types/game-controlled");
|
|
5
|
+
const preselected_1 = require("./selection-types/preselected");
|
|
6
|
+
const normal_1 = require("./selection-types/normal");
|
|
7
|
+
const handle_validation_1 = require("./handle-validation");
|
|
8
|
+
async function runSelection(config, gameControlledSelections, userInputs, runScript) {
|
|
9
|
+
const users = [];
|
|
10
|
+
const seeds = [];
|
|
11
|
+
const allSelections = {};
|
|
12
|
+
const sortedPlayerIds = Object.keys(userInputs).sort();
|
|
13
|
+
for (const playerId of sortedPlayerIds) {
|
|
14
|
+
const { randomSeed, userSelection } = userInputs[playerId];
|
|
15
|
+
users.push(playerId);
|
|
16
|
+
seeds.push(randomSeed);
|
|
17
|
+
allSelections[playerId] = userSelection;
|
|
18
|
+
}
|
|
19
|
+
const finalSelection = {};
|
|
20
|
+
await Promise.all(Object.entries(config.engine.pieceDefinitions).map(async ([pieceType, pieceConfig]) => {
|
|
21
|
+
if (pieceConfig.selectionStrategy === "on demand")
|
|
22
|
+
return;
|
|
23
|
+
if (pieceConfig.selectionStrategy === "mandatory") {
|
|
24
|
+
if (!config.rosters[pieceType]) {
|
|
25
|
+
throw new Error(`Missing roster for mandatory piece ${pieceType}`);
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const selectionConfig = config.selection.piece[pieceType];
|
|
30
|
+
if (!selectionConfig) {
|
|
31
|
+
throw new Error(`Missing selection config for ${pieceType}`);
|
|
32
|
+
}
|
|
33
|
+
if (selectionConfig.type === "game-controlled") {
|
|
34
|
+
finalSelection[pieceType] = await (0, game_controlled_1.handleGameControlledSelection)(config, users, pieceType, gameControlledSelections);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (selectionConfig.type === "preselected") {
|
|
38
|
+
finalSelection[pieceType] = await (0, preselected_1.handlePreselectedSelection)(config, users, pieceType, selectionConfig);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (selectionConfig.type === "normal") {
|
|
42
|
+
finalSelection[pieceType] = await (0, normal_1.handleNormalSelection)(config, seeds, users, pieceType, selectionConfig, allSelections, runScript);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
throw new Error(`Unknown Selection Type ${selectionConfig.type}`);
|
|
46
|
+
}));
|
|
47
|
+
if (!config.selection.globalValidation)
|
|
48
|
+
return finalSelection;
|
|
49
|
+
const strippedSelection = {};
|
|
50
|
+
for (const [k, v] of Object.entries(finalSelection)) {
|
|
51
|
+
strippedSelection[k] = v.value;
|
|
52
|
+
}
|
|
53
|
+
await Promise.all(config.selection.globalValidation.map(async (script) => {
|
|
54
|
+
return (0, handle_validation_1.handleValidationResult)(script, runScript({
|
|
55
|
+
config,
|
|
56
|
+
randomSeeds: seeds,
|
|
57
|
+
purpose: {
|
|
58
|
+
type: "global-validation",
|
|
59
|
+
users,
|
|
60
|
+
pieceTypes: Object.keys(config.engine.pieceDefinitions),
|
|
61
|
+
input: strippedSelection,
|
|
62
|
+
},
|
|
63
|
+
entryScript: script,
|
|
64
|
+
}));
|
|
65
|
+
}));
|
|
66
|
+
return finalSelection;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/index.ts"],"names":[],"mappings":";;;AAKA,uEAAkF;AAClF,+DAA2E;AAC3E,qDAAiE;AAIjE,2DAA6D;AAEtD,KAAK,uBACV,MAA0B,EAC1B,wBAA0G,EAC1G,UAAuC,EACvC,SAA+C;IAE/C,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,MAAM,aAAa,GAA8D,EAAE,CAAC;IAOpF,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAA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C,CAAC;IAEJ,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleGameControlledSelection = handleGameControlledSelection;
|
|
4
|
+
const ensure_pieces_are_in_roster_1 = require("../ensure-pieces-are-in-roster");
|
|
5
|
+
async function handleGameControlledSelection(config, users, pieceType, gameControlledSelections) {
|
|
6
|
+
const pieceDefinition = config.engine.pieceDefinitions[pieceType];
|
|
7
|
+
if (!pieceDefinition) {
|
|
8
|
+
throw new Error(`Missing piece config for ${pieceType}`);
|
|
9
|
+
}
|
|
10
|
+
if (pieceDefinition.selectionStrategy === "mandatory") {
|
|
11
|
+
throw new Error(`Mandatory piece ${pieceType} cannot be game controlled`);
|
|
12
|
+
}
|
|
13
|
+
if (pieceDefinition.selectionStrategy === "on demand") {
|
|
14
|
+
throw new Error(`On demand piece ${pieceType} cannot be game controlled`);
|
|
15
|
+
}
|
|
16
|
+
const pieceSelections = gameControlledSelections[pieceType];
|
|
17
|
+
if (!pieceSelections) {
|
|
18
|
+
throw new Error(`Missing selections for ${pieceType}`);
|
|
19
|
+
}
|
|
20
|
+
if (pieceDefinition.selectionStrategy === "shared") {
|
|
21
|
+
if (!Array.isArray(pieceSelections)) {
|
|
22
|
+
throw new Error(`Expected Array for Shared Selection`);
|
|
23
|
+
}
|
|
24
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, pieceSelections);
|
|
25
|
+
return { type: "shared", value: pieceSelections };
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(pieceSelections) || pieceSelections === null) {
|
|
28
|
+
throw new Error(`Expected Record for Personal Selection`);
|
|
29
|
+
}
|
|
30
|
+
for (const userId of users) {
|
|
31
|
+
if (!pieceSelections[userId]) {
|
|
32
|
+
throw new Error(`Missing selection for ${userId}`);
|
|
33
|
+
}
|
|
34
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, pieceSelections[userId]);
|
|
35
|
+
}
|
|
36
|
+
return { type: "personal", value: pieceSelections };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=game-controlled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-controlled.js","sourceRoot":"","sources":["../../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/game-controlled.ts"],"names":[],"mappings":";;;AAGA,gFAAyE;AAGlE,KAAK,wCACV,MAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACpB,wBAA0G;IAE1G,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClE,IAAG,CAAC,eAAe,EAAC,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAG,eAAe,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IACD,IAAG,eAAe,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,eAAe,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC5D,IAAG,CAAC,eAAe,EAAC,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,0BAA0B,SAAS,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,IAAG,eAAe,CAAC,iBAAiB,KAAK,QAAQ,EAAC,CAAC;QACjD,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAC,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IACpD,CAAC;IAGD,IAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,eAAe,KAAK,IAAI,EAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAI,MAAM,MAAM,IAAI,KAAK,EAAC,CAAC;QACzB,IAAG,CAAC,eAAe,CAAC,MAAM,CAAC,EAAC,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.castSharedResult = castSharedResult;
|
|
7
|
+
exports.castPersonalResult = castPersonalResult;
|
|
8
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
9
|
+
const SelectedPiece_1 = require("../../../../shared/SelectedPiece");
|
|
10
|
+
const ajv = new ajv_1.default({ allErrors: true, strict: true, allowUnionTypes: true });
|
|
11
|
+
ajv.addSchema({
|
|
12
|
+
$id: "SelectedPiece",
|
|
13
|
+
...SelectedPiece_1.SelectedPieceSchemaDef,
|
|
14
|
+
...SelectedPiece_1.SelectedPieceSchema,
|
|
15
|
+
});
|
|
16
|
+
const validateShared = ajv.compile({
|
|
17
|
+
type: "array",
|
|
18
|
+
items: { $ref: "SelectedPiece" },
|
|
19
|
+
});
|
|
20
|
+
const validatePersonal = ajv.compile({
|
|
21
|
+
type: "object",
|
|
22
|
+
required: [],
|
|
23
|
+
additionalProperties: {
|
|
24
|
+
type: "array",
|
|
25
|
+
items: { $ref: "SelectedPiece" },
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
function castSharedResult(value) {
|
|
29
|
+
if (!validateShared(value)) {
|
|
30
|
+
throw validateShared.errors;
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
function castPersonalResult(value) {
|
|
35
|
+
if (!validatePersonal(value)) {
|
|
36
|
+
throw validatePersonal.errors;
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=cast-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cast-result.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/cast-result.ts"],"names":[],"mappings":";;;;;;;AACA,8CAAsB;AACtB,oEAA+F;AAE/F,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AAE9E,GAAG,CAAC,SAAS,CAAC;IACZ,GAAG,EAAE,eAAe;IACpB,GAAG,sCAAsB;IACzB,GAAG,mCAAmB;CACvB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAuB;IACvD,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;CACjC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAAyC;IAC3E,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,EAAE;IACZ,oBAAoB,EAAE;QACpB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;KACjC;CACF,CAAC,CAAC;AAEH,0BAAiC,KAAc;IAC7C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,cAAc,CAAC,MAAM,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4BAAmC,KAAc;IAC/C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,gBAAgB,CAAC,MAAM,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleNormalSelection = handleNormalSelection;
|
|
4
|
+
const ensure_pieces_are_in_roster_1 = require("../../ensure-pieces-are-in-roster");
|
|
5
|
+
const validate_user_selection_1 = require("./validate-user-selection");
|
|
6
|
+
const handle_validation_1 = require("../../handle-validation");
|
|
7
|
+
const cast_result_1 = require("./cast-result");
|
|
8
|
+
async function handleNormalSelection(config, randomSeeds, users, pieceType, selectionConfig, allSelections, runScript) {
|
|
9
|
+
const pieceConfig = config.engine.pieceDefinitions[pieceType];
|
|
10
|
+
if (!pieceConfig) {
|
|
11
|
+
throw new Error(`Missing piece config for ${pieceType}`);
|
|
12
|
+
}
|
|
13
|
+
if (pieceConfig.selectionStrategy === "mandatory") {
|
|
14
|
+
throw new Error(`Mandatory piece ${pieceType} cannot be normal`);
|
|
15
|
+
}
|
|
16
|
+
if (pieceConfig.selectionStrategy === "on demand") {
|
|
17
|
+
throw new Error(`On demand piece ${pieceType} cannot be normal`);
|
|
18
|
+
}
|
|
19
|
+
await Promise.all(users.map(async (userId) => {
|
|
20
|
+
const userSelections = allSelections[userId][pieceType];
|
|
21
|
+
if (!userSelections) {
|
|
22
|
+
throw new Error(`Missing selections for ${pieceType}`);
|
|
23
|
+
}
|
|
24
|
+
await (0, validate_user_selection_1.validateUserSelection)(config, pieceType, userSelections, selectionConfig);
|
|
25
|
+
if (!selectionConfig.validation?.customValidation.length) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await Promise.all(selectionConfig.validation.customValidation.map(async (script) => ((0, handle_validation_1.handleValidationResult)(script, runScript({
|
|
29
|
+
config,
|
|
30
|
+
randomSeeds,
|
|
31
|
+
purpose: {
|
|
32
|
+
type: "piece-user-validation",
|
|
33
|
+
pieceType,
|
|
34
|
+
userId,
|
|
35
|
+
input: userSelections,
|
|
36
|
+
},
|
|
37
|
+
entryScript: script
|
|
38
|
+
})))));
|
|
39
|
+
}));
|
|
40
|
+
if (pieceConfig.selectionStrategy === "shared" && !selectionConfig.mergeAlgorithm) {
|
|
41
|
+
throw new Error(`Shared piece ${pieceType} is missing merge algorithm`);
|
|
42
|
+
}
|
|
43
|
+
const usersSelections = {};
|
|
44
|
+
for (const userId of users) {
|
|
45
|
+
usersSelections[userId] = allSelections[userId][pieceType];
|
|
46
|
+
}
|
|
47
|
+
if (!selectionConfig.mergeAlgorithm) {
|
|
48
|
+
return { type: "personal", value: usersSelections };
|
|
49
|
+
}
|
|
50
|
+
const rawResult = await runScript({
|
|
51
|
+
config,
|
|
52
|
+
randomSeeds,
|
|
53
|
+
purpose: {
|
|
54
|
+
type: "piece-merge",
|
|
55
|
+
pieceType,
|
|
56
|
+
users,
|
|
57
|
+
input: usersSelections,
|
|
58
|
+
},
|
|
59
|
+
entryScript: selectionConfig.mergeAlgorithm
|
|
60
|
+
});
|
|
61
|
+
if (pieceConfig.selectionStrategy === "shared") {
|
|
62
|
+
const mergedSelection = (0, cast_result_1.castSharedResult)(rawResult);
|
|
63
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, mergedSelection);
|
|
64
|
+
return { type: "shared", value: mergedSelection };
|
|
65
|
+
}
|
|
66
|
+
if (pieceConfig.selectionStrategy === "personal") {
|
|
67
|
+
const mergedSelection = (0, cast_result_1.castPersonalResult)(rawResult);
|
|
68
|
+
for (const userId of users) {
|
|
69
|
+
if (!mergedSelection[userId]) {
|
|
70
|
+
throw new Error(`Missing selection for ${userId}`);
|
|
71
|
+
}
|
|
72
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, mergedSelection[userId]);
|
|
73
|
+
}
|
|
74
|
+
return { type: "personal", value: mergedSelection };
|
|
75
|
+
}
|
|
76
|
+
throw new Error("Invalid Selection Strategy: " + pieceConfig.selectionStrategy);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/index.ts"],"names":[],"mappings":";;;AAGA,mFAA4E;AAG5E,uEAAkE;AAClE,+DAAiE;AAEjE,+CAAqE;AAE9D,KAAK,gCACV,MAA0B,EAC1B,WAAqB,EACrB,KAAsB,EACtB,SAAoB,EACpB,eAAsC,EACtC,aAAwE,EACxE,SAA+C;IAE/C,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC9D,IAAG,CAAC,WAAW,EAAC,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAG,WAAW,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,mBAAmB,CAAC,CAAC;IACnE,CAAC;IACD,IAAG,WAAW,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,mBAAmB,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAC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tD,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC;QAChC,MAAM;QACN,WAAW;QACX,OAAO,EAAE;YACP,IAAI,EAAE,aAAa;YACnB,SAAS;YACT,KAAK;YACL,KAAK,EAAE,eAAe;SACvB;QACD,WAAW,EAAE,eAAe,CAAC,cAAc;KAC5C,CAAC,CAAC;IAEH,IAAG,WAAW,CAAC,iBAAiB,KAAK,QAAQ,EAAC,CAAC;QAC7C,MAAM,eAAe,GAAG,IAAA,8BAAgB,EAAC,SAAS,CAAC,CAAC;QACpD,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;QAC5D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IACpD,CAAC;IAED,IAAG,WAAW,CAAC,iBAAiB,KAAK,UAAU,EAAC,CAAC;QAC/C,MAAM,eAAe,GAAG,IAAA,gCAAkB,EAAC,SAAS,CAAC,CAAC;QACtD,KAAI,MAAM,MAAM,IAAI,KAAK,EAAC,CAAC;YACzB,IAAG,CAAC,eAAe,CAAC,MAAM,CAAC,EAAC,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;YACrD,CAAC;YACD,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateUserSelection = validateUserSelection;
|
|
4
|
+
const ensure_pieces_are_in_roster_1 = require("../../ensure-pieces-are-in-roster");
|
|
5
|
+
async function validateUserSelection(config, pieceType, userSelections, selectionConfig) {
|
|
6
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, userSelections);
|
|
7
|
+
if (!selectionConfig.validation)
|
|
8
|
+
return;
|
|
9
|
+
validateCount(selectionConfig.validation.count, userSelections);
|
|
10
|
+
const banList = selectionConfig.validation.banList || [];
|
|
11
|
+
const viewed = new Set();
|
|
12
|
+
for (const piece of userSelections) {
|
|
13
|
+
if (banList.includes(piece.id)) {
|
|
14
|
+
throw new Error(`Banned piece ${piece.id} selected for ${pieceType}`);
|
|
15
|
+
}
|
|
16
|
+
if (selectionConfig.validation.unique) {
|
|
17
|
+
if (viewed.has(piece.id)) {
|
|
18
|
+
throw new Error(`Duplicate piece ${piece.id} selected for ${pieceType}`);
|
|
19
|
+
}
|
|
20
|
+
viewed.add(piece.id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function validateCount(countConfig, userSelections) {
|
|
25
|
+
if (!Array.isArray(countConfig)) {
|
|
26
|
+
if (countConfig === "*")
|
|
27
|
+
return;
|
|
28
|
+
if (userSelections.length !== countConfig) {
|
|
29
|
+
throw new Error(`Expected ${countConfig} pieces, got ${userSelections.length}`);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const [min, max] = countConfig;
|
|
34
|
+
if (userSelections.length < min) {
|
|
35
|
+
throw new Error(`Expected at least ${min} pieces, got ${userSelections.length}`);
|
|
36
|
+
}
|
|
37
|
+
if (max === "*")
|
|
38
|
+
return;
|
|
39
|
+
if (userSelections.length > max) {
|
|
40
|
+
throw new Error(`Expected at most ${max} pieces, got ${userSelections.length}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=validate-user-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-user-selection.js","sourceRoot":"","sources":["../../../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/normal/validate-user-selection.ts"],"names":[],"mappings":";;;AACA,mFAA4E;AAGrE,KAAK,gCACV,MAA0B,EAC1B,SAAoB,EACpB,cAAoC,EACpC,eAAsC;IAGtC,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAE3D,IAAG,CAAC,eAAe,CAAC,UAAU;QAAE,OAAO;IAEvC,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAChE,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,CAAC;IACzD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAW,CAAC;IAClC,KAAI,MAAM,KAAK,IAAI,cAAc,EAAC,CAAC;QACjC,IAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAC,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,CAAC,EAAE,iBAAiB,SAAS,EAAE,CAAC,CAAC;QACxE,CAAC;QACD,IAAG,eAAe,CAAC,UAAU,CAAC,MAAM,EAAC,CAAC;YACpC,IAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAC,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,CAAC,EAAE,iBAAiB,SAAS,EAAE,CAAC,CAAC;YAC3E,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,WAAsE,EACtE,cAAoC;IAEpC,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAC,CAAC;QAC9B,IAAG,WAAW,KAAK,GAAG;YAAE,OAAO;QAC/B,IAAG,cAAc,CAAC,MAAM,KAAK,WAAW,EAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,YAAY,WAAW,gBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,WAAW,CAAC;IAC/B,IAAG,cAAc,CAAC,MAAM,GAAG,GAAG,EAAC,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,gBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;IACD,IAAG,GAAG,KAAK,GAAG;QAAE,OAAO;IACvB,IAAG,cAAc,CAAC,MAAM,GAAG,GAAG,EAAC,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,gBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handlePreselectedSelection = handlePreselectedSelection;
|
|
4
|
+
const ensure_pieces_are_in_roster_1 = require("../ensure-pieces-are-in-roster");
|
|
5
|
+
async function handlePreselectedSelection(config, users, pieceType, selectionConfig) {
|
|
6
|
+
const pieceDefinition = config.engine.pieceDefinitions[pieceType];
|
|
7
|
+
if (!pieceDefinition) {
|
|
8
|
+
throw new Error(`Missing piece config for ${pieceType}`);
|
|
9
|
+
}
|
|
10
|
+
if (pieceDefinition.selectionStrategy === "mandatory") {
|
|
11
|
+
throw new Error(`Mandatory piece ${pieceType} cannot be game controlled`);
|
|
12
|
+
}
|
|
13
|
+
if (pieceDefinition.selectionStrategy === "on demand") {
|
|
14
|
+
throw new Error(`On demand piece ${pieceType} cannot be game controlled`);
|
|
15
|
+
}
|
|
16
|
+
(0, ensure_pieces_are_in_roster_1.ensurePiecesAreInRoster)(config, pieceType, selectionConfig.pieces);
|
|
17
|
+
if (pieceDefinition.selectionStrategy === "shared") {
|
|
18
|
+
return { type: "shared", value: selectionConfig.pieces };
|
|
19
|
+
}
|
|
20
|
+
const userSelections = {};
|
|
21
|
+
for (const userId of users) {
|
|
22
|
+
userSelections[userId] = selectionConfig.pieces;
|
|
23
|
+
}
|
|
24
|
+
return { type: "personal", value: userSelections };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=preselected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preselected.js","sourceRoot":"","sources":["../../../../../../../src/match-lock-file/match-config/version-1/usage/validate-select/selection-types/preselected.ts"],"names":[],"mappings":";;;AAIA,gFAAyE;AAGlE,KAAK,qCACV,MAA0B,EAC1B,KAAsB,EACtB,SAAoB,EACpB,eAA2C;IAE3C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClE,IAAG,CAAC,eAAe,EAAC,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAG,eAAe,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IACD,IAAG,eAAe,CAAC,iBAAiB,KAAK,WAAW,EAAC,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,4BAA4B,CAAC,CAAC;IAC5E,CAAC;IAED,IAAA,qDAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAEnE,IAAG,eAAe,CAAC,iBAAiB,KAAK,QAAQ,EAAC,CAAC;QACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC;IAC3D,CAAC;IAED,MAAM,cAAc,GAA2C,EAAE,CAAC;IAClE,KAAI,MAAM,MAAM,IAAI,KAAK,EAAC,CAAC;QACzB,cAAc,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC;IAClD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSONSchemaCaster = void 0;
|
|
4
|
+
const ajv_1 = require("ajv");
|
|
5
|
+
function returnTrue() { return true; }
|
|
6
|
+
function createAJVInstance(engineSchema, engineKeywords, validate = true) {
|
|
7
|
+
const ajv = new ajv_1.Ajv({ allErrors: true, strict: true, allowUnionTypes: true });
|
|
8
|
+
for (const keyword of engineKeywords) {
|
|
9
|
+
ajv.addKeyword({
|
|
10
|
+
keyword: keyword.keyword,
|
|
11
|
+
errors: true,
|
|
12
|
+
schema: true,
|
|
13
|
+
type: keyword.type,
|
|
14
|
+
validate: !validate ? returnTrue : keyword.validate,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return ajv.compile(engineSchema);
|
|
18
|
+
}
|
|
19
|
+
class JSONSchemaCaster {
|
|
20
|
+
schema;
|
|
21
|
+
keywords;
|
|
22
|
+
constructor(schema, keywords) {
|
|
23
|
+
this.schema = schema;
|
|
24
|
+
this.keywords = keywords;
|
|
25
|
+
}
|
|
26
|
+
safeCast(input, validate = true) {
|
|
27
|
+
try {
|
|
28
|
+
return { valid: true, value: this.cast(input, validate) };
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return { valid: false, error: e };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
cast(input, validate = true) {
|
|
35
|
+
const schemaValidator = createAJVInstance(this.schema, this.keywords, validate);
|
|
36
|
+
if (!schemaValidator(input)) {
|
|
37
|
+
if (!schemaValidator.errors)
|
|
38
|
+
throw new Error("Validation failed with no information");
|
|
39
|
+
throw schemaValidator.errors;
|
|
40
|
+
}
|
|
41
|
+
return input;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.JSONSchemaCaster = JSONSchemaCaster;
|
|
45
|
+
//# sourceMappingURL=JSONSchemaCaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONSchemaCaster.js","sourceRoot":"","sources":["../../../../src/match-lock-file/util-types/json-schema/JSONSchemaCaster.ts"],"names":[],"mappings":";;;AAEA,6BAAuD;AAGvD,SAAS,UAAU,KAAI,OAAO,IAAI,CAAC,CAAC,CAAC;AACrC,SAAS,iBAAiB,CACxB,YAA+B,EAC/B,cAA2C,EAC3C,QAAQ,GAAY,IAAI;IAExB,MAAM,GAAG,GAAG,IAAI,SAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,KAAI,MAAM,OAAO,IAAI,cAAc,EAAC,CAAC;QACnC,GAAG,CAAC,UAAU,CAAC;YACb,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ;SACpD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC;AAOD;IAEY,MAAM;IACN,QAAQ;IAFlB,YACU,MAAyB,EACzB,QAAqC;sBADrC,MAAM;wBACN,QAAQ;IAChB,CAAC;IAEH,QAAQ,CAAC,KAAc,EAAE,QAAQ,GAAY,IAAI;QAC/C,IAAI,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5D,CAAC;QAAA,OAAM,CAAC,EAAC,CAAC;YACR,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAuB,EAAE,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,IAAI,CAAC,KAAc,EAAE,QAAQ,GAAY,IAAI;QAC3C,MAAM,eAAe,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChF,IAAG,CAAC,eAAe,CAAC,KAAK,CAAC,EAAC,CAAC;YAC1B,IAAG,CAAC,eAAe,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YACrF,MAAM,eAAe,CAAC,MAAM,CAAC;QAC/B,CAAC;QACD,OAAO,KAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineKeyword = defineKeyword;
|
|
4
|
+
function defineKeyword(definition) {
|
|
5
|
+
return {
|
|
6
|
+
...definition, validate: wrapValidator(definition.keyword, definition.validate)
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function wrapValidator(keyword, validator) {
|
|
10
|
+
const wrapped = function (_schema, value, _parentSchema, dataCxt) {
|
|
11
|
+
if (!dataCxt)
|
|
12
|
+
return true;
|
|
13
|
+
try {
|
|
14
|
+
validator(value, dataCxt.rootData, dataCxt.instancePath);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
wrapped.errors = [{
|
|
19
|
+
instancePath: dataCxt.instancePath,
|
|
20
|
+
schemaPath: "",
|
|
21
|
+
keyword: keyword,
|
|
22
|
+
message: e.message,
|
|
23
|
+
params: {}
|
|
24
|
+
}];
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return wrapped;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=defineKeyword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineKeyword.js","sourceRoot":"","sources":["../../../../src/match-lock-file/util-types/json-schema/defineKeyword.ts"],"names":[],"mappings":";;;AAUA,uBACE,UAIC;IAED,OAAO;QACL,GAAG,UAAU,EAAE,QAAQ,EAAE,aAAa,CAAI,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC;KACnF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,OAAe,EACf,SAAqD;IAErD,MAAM,OAAO,GAA2B,UACtC,OAAO,EACP,KAAU,EACV,aAAa,EACb,OAAO;QAEP,IAAG,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QACzB,IAAI,CAAC;YACH,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,QAAa,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QAAA,OAAM,CAAM,EAAC,CAAC;YACb,OAAO,CAAC,MAAM,GAAG,CAAC;oBAChB,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,UAAU,EAAE,EAAE;oBACd,OAAO,EAAE,OAAO;oBAChB,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./safe-keyword"), exports);
|
|
18
|
+
__exportStar(require("./schema-types"), exports);
|
|
19
|
+
__exportStar(require("./defineKeyword"), exports);
|
|
20
|
+
__exportStar(require("./JSONSchemaCaster"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/match-lock-file/util-types/json-schema/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,iDAA+B;AAC/B,kDAAgC;AAChC,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-keyword.js","sourceRoot":"","sources":["../../../../src/match-lock-file/util-types/json-schema/safe-keyword.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-types.js","sourceRoot":"","sources":["../../../../src/match-lock-file/util-types/json-schema/schema-types.ts"],"names":[],"mappings":""}
|