@gamepark/rules-api 5.23.2 → 6.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/Action.d.ts +4 -5
  2. package/dist/Action.js +6 -6
  3. package/dist/Action.js.map +1 -1
  4. package/dist/ApplyAutomaticMoves.d.ts +1 -1
  5. package/dist/ApplyAutomaticMoves.js +1 -1
  6. package/dist/ApplyAutomaticMoves.js.map +1 -1
  7. package/dist/Competitive.d.ts +2 -2
  8. package/dist/Dummy.d.ts +2 -2
  9. package/dist/Dummy.js +2 -1
  10. package/dist/Dummy.js.map +1 -1
  11. package/dist/Eliminations.d.ts +1 -1
  12. package/dist/IncompleteInformation.d.ts +2 -2
  13. package/dist/RandomMove.d.ts +2 -2
  14. package/dist/RandomMove.js +4 -2
  15. package/dist/RandomMove.js.map +1 -1
  16. package/dist/Robot.d.ts +1 -2
  17. package/dist/Rules.d.ts +2 -1
  18. package/dist/Rules.js +2 -1
  19. package/dist/Rules.js.map +1 -1
  20. package/dist/RulesCreator.d.ts +2 -2
  21. package/dist/TimeLimit.d.ts +2 -2
  22. package/dist/Undo.d.ts +2 -2
  23. package/dist/UnpredictableMove.d.ts +12 -0
  24. package/dist/UnpredictableMove.js +43 -0
  25. package/dist/UnpredictableMove.js.map +1 -0
  26. package/dist/index.d.ts +13 -18
  27. package/dist/index.js +13 -17
  28. package/dist/index.js.map +1 -1
  29. package/dist/material/HiddenMaterialRules.d.ts +19 -0
  30. package/dist/material/HiddenMaterialRules.js +138 -0
  31. package/dist/material/HiddenMaterialRules.js.map +1 -0
  32. package/dist/material/MaterialGame.d.ts +11 -0
  33. package/dist/material/MaterialGame.js +3 -0
  34. package/dist/material/MaterialGame.js.map +1 -0
  35. package/dist/material/MaterialRules.d.ts +32 -0
  36. package/dist/material/MaterialRules.js +216 -0
  37. package/dist/material/MaterialRules.js.map +1 -0
  38. package/dist/material/SecretMaterialRules.d.ts +12 -0
  39. package/dist/material/SecretMaterialRules.js +52 -0
  40. package/dist/material/SecretMaterialRules.js.map +1 -0
  41. package/dist/material/helper/MaterialMoveBuilder.d.ts +9 -0
  42. package/dist/material/helper/MaterialMoveBuilder.js +28 -0
  43. package/dist/material/helper/MaterialMoveBuilder.js.map +1 -0
  44. package/dist/material/helper/MaterialSearchHelper.d.ts +18 -0
  45. package/dist/material/helper/MaterialSearchHelper.js +62 -0
  46. package/dist/material/helper/MaterialSearchHelper.js.map +1 -0
  47. package/dist/material/helper/index.d.ts +2 -0
  48. package/dist/material/helper/index.js +19 -0
  49. package/dist/material/helper/index.js.map +1 -0
  50. package/dist/material/index.d.ts +9 -0
  51. package/dist/material/index.js +26 -0
  52. package/dist/material/index.js.map +1 -0
  53. package/dist/material/items/Material.d.ts +30 -0
  54. package/dist/material/items/Material.js +149 -0
  55. package/dist/material/items/Material.js.map +1 -0
  56. package/dist/material/items/MaterialItem.d.ts +10 -0
  57. package/dist/material/items/MaterialItem.js +3 -0
  58. package/dist/material/items/MaterialItem.js.map +1 -0
  59. package/dist/material/items/MaterialOperation.d.ts +20 -0
  60. package/dist/material/items/MaterialOperation.js +147 -0
  61. package/dist/material/items/MaterialOperation.js.map +1 -0
  62. package/dist/material/items/index.d.ts +3 -0
  63. package/dist/material/items/index.js +20 -0
  64. package/dist/material/items/index.js.map +1 -0
  65. package/dist/material/location/Location.d.ts +14 -0
  66. package/dist/material/location/Location.js +12 -0
  67. package/dist/material/location/Location.js.map +1 -0
  68. package/dist/material/location/index.d.ts +2 -0
  69. package/dist/material/location/index.js +19 -0
  70. package/dist/material/location/index.js.map +1 -0
  71. package/dist/material/location/strategy/LocationStrategy.d.ts +5 -0
  72. package/dist/material/location/strategy/LocationStrategy.js +3 -0
  73. package/dist/material/location/strategy/LocationStrategy.js.map +1 -0
  74. package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +11 -0
  75. package/dist/material/location/strategy/PositiveSequenceStrategy.js +42 -0
  76. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -0
  77. package/dist/material/location/strategy/index.d.ts +2 -0
  78. package/dist/material/location/strategy/index.js +19 -0
  79. package/dist/material/location/strategy/index.js.map +1 -0
  80. package/dist/material/moves/CreateItem.d.ts +7 -0
  81. package/dist/material/moves/CreateItem.js +3 -0
  82. package/dist/material/moves/CreateItem.js.map +1 -0
  83. package/dist/material/moves/CustomMove.d.ts +6 -0
  84. package/dist/material/moves/CustomMove.js +3 -0
  85. package/dist/material/moves/CustomMove.js.map +1 -0
  86. package/dist/material/moves/DeleteItem.d.ts +7 -0
  87. package/dist/material/moves/DeleteItem.js +3 -0
  88. package/dist/material/moves/DeleteItem.js.map +1 -0
  89. package/dist/material/moves/MaterialMove.d.ts +11 -0
  90. package/dist/material/moves/MaterialMove.js +3 -0
  91. package/dist/material/moves/MaterialMove.js.map +1 -0
  92. package/dist/material/moves/MaterialMoveType.d.ts +6 -0
  93. package/dist/material/moves/MaterialMoveType.js +11 -0
  94. package/dist/material/moves/MaterialMoveType.js.map +1 -0
  95. package/dist/material/moves/MaterialMovesBuilder.d.ts +8 -0
  96. package/dist/material/moves/MaterialMovesBuilder.js +34 -0
  97. package/dist/material/moves/MaterialMovesBuilder.js.map +1 -0
  98. package/dist/material/moves/MaterialRulesMove.d.ts +6 -0
  99. package/dist/material/moves/MaterialRulesMove.js +3 -0
  100. package/dist/material/moves/MaterialRulesMove.js.map +1 -0
  101. package/dist/material/moves/MoveItem.d.ts +17 -0
  102. package/dist/material/moves/MoveItem.js +54 -0
  103. package/dist/material/moves/MoveItem.js.map +1 -0
  104. package/dist/material/moves/MoveKind.d.ts +6 -0
  105. package/dist/material/moves/MoveKind.js +11 -0
  106. package/dist/material/moves/MoveKind.js.map +1 -0
  107. package/dist/material/moves/Shuffle.d.ts +9 -0
  108. package/dist/material/moves/Shuffle.js +3 -0
  109. package/dist/material/moves/Shuffle.js.map +1 -0
  110. package/dist/material/moves/index.d.ts +11 -0
  111. package/dist/material/moves/index.js +28 -0
  112. package/dist/material/moves/index.js.map +1 -0
  113. package/dist/material/moves/local/LocalMove.d.ts +6 -0
  114. package/dist/material/moves/local/LocalMove.js +9 -0
  115. package/dist/material/moves/local/LocalMove.js.map +1 -0
  116. package/dist/material/moves/local/RulesDisplay.d.ts +32 -0
  117. package/dist/material/moves/local/RulesDisplay.js +26 -0
  118. package/dist/material/moves/local/RulesDisplay.js.map +1 -0
  119. package/dist/material/moves/local/index.d.ts +2 -0
  120. package/dist/material/moves/local/index.js +19 -0
  121. package/dist/material/moves/local/index.js.map +1 -0
  122. package/dist/material/moves/rules/EndGame.d.ts +4 -0
  123. package/dist/material/moves/rules/EndGame.js +3 -0
  124. package/dist/material/moves/rules/EndGame.js.map +1 -0
  125. package/dist/material/moves/rules/RuleMove.d.ts +16 -0
  126. package/dist/material/moves/rules/RuleMove.js +19 -0
  127. package/dist/material/moves/rules/RuleMove.js.map +1 -0
  128. package/dist/material/moves/rules/StartPlayerTurn.d.ts +7 -0
  129. package/dist/material/moves/rules/StartPlayerTurn.js +3 -0
  130. package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -0
  131. package/dist/material/moves/rules/StartRule.d.ts +7 -0
  132. package/dist/material/moves/rules/StartRule.js +3 -0
  133. package/dist/material/moves/rules/StartRule.js.map +1 -0
  134. package/dist/material/moves/rules/index.d.ts +4 -0
  135. package/dist/material/moves/rules/index.js +21 -0
  136. package/dist/material/moves/rules/index.js.map +1 -0
  137. package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +10 -0
  138. package/dist/material/rules/MaterialRulesMovesBuilder.js +35 -0
  139. package/dist/material/rules/MaterialRulesMovesBuilder.js.map +1 -0
  140. package/dist/material/rules/MaterialStepRules.d.ts +22 -0
  141. package/dist/material/rules/MaterialStepRules.js +101 -0
  142. package/dist/material/rules/MaterialStepRules.js.map +1 -0
  143. package/dist/material/rules/PlayerTurnRule.d.ts +10 -0
  144. package/dist/material/rules/PlayerTurnRule.js +53 -0
  145. package/dist/material/rules/PlayerTurnRule.js.map +1 -0
  146. package/dist/material/rules/RuleStep.d.ts +6 -0
  147. package/dist/material/rules/RuleStep.js +3 -0
  148. package/dist/material/rules/RuleStep.js.map +1 -0
  149. package/dist/material/rules/index.d.ts +3 -0
  150. package/dist/material/rules/index.js +20 -0
  151. package/dist/material/rules/index.js.map +1 -0
  152. package/dist/options/EnumOption.d.ts +2 -3
  153. package/dist/options/EnumOption.js.map +1 -1
  154. package/dist/options/Option.d.ts +1 -2
  155. package/dist/options/OptionSpecOf.d.ts +3 -4
  156. package/dist/options/OptionsSpec.d.ts +4 -5
  157. package/dist/options/OptionsValidationError.d.ts +1 -1
  158. package/dist/options/OptionsValidationError.js +2 -1
  159. package/dist/options/OptionsValidationError.js.map +1 -1
  160. package/dist/options/PlayerIdSpec.d.ts +2 -3
  161. package/dist/options/PlayerIdSpec.js.map +1 -1
  162. package/dist/options/PlayersOptionsSpec.d.ts +3 -4
  163. package/dist/options/WithIdOption.d.ts +1 -2
  164. package/dist/options/WithPlayerOptionsSpec.d.ts +2 -3
  165. package/dist/options/WithPlayersOptions.d.ts +1 -2
  166. package/dist/options/getFallbackPlayerName.d.ts +3 -3
  167. package/dist/options/getFallbackPlayerName.js +4 -6
  168. package/dist/options/getFallbackPlayerName.js.map +1 -1
  169. package/dist/options/index.d.ts +12 -12
  170. package/dist/options/index.js +12 -12
  171. package/dist/options/index.js.map +1 -1
  172. package/dist/options/isWithPlayerIdOptions.d.ts +4 -4
  173. package/dist/options/isWithPlayerIdOptions.js +2 -1
  174. package/dist/options/isWithPlayerIdOptions.js.map +1 -1
  175. package/dist/options/providePlayerIds.d.ts +6 -6
  176. package/dist/options/providePlayerIds.js +5 -7
  177. package/dist/options/providePlayerIds.js.map +1 -1
  178. package/package.json +9 -3
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.MaterialStepRules = void 0;
30
+ var Rules_1 = require("../../Rules");
31
+ var items_1 = require("../items");
32
+ var MaterialRulesMovesBuilder_1 = require("./MaterialRulesMovesBuilder");
33
+ var MaterialStepRules = /** @class */ (function (_super) {
34
+ __extends(MaterialStepRules, _super);
35
+ function MaterialStepRules() {
36
+ return _super !== null && _super.apply(this, arguments) || this;
37
+ }
38
+ MaterialStepRules.prototype.material = function (type) {
39
+ var _a;
40
+ return new items_1.Material(type, Array.from(((_a = this.game.items[type]) !== null && _a !== void 0 ? _a : []).entries()).filter(function (entry) { return entry[1].quantity !== 0; }));
41
+ };
42
+ MaterialStepRules.prototype.beforeMaterialMove = function (_move) {
43
+ return [];
44
+ };
45
+ MaterialStepRules.prototype.afterMaterialMove = function (_move) {
46
+ return [];
47
+ };
48
+ MaterialStepRules.prototype.onRuleStart = function (_move, _previousRule) {
49
+ return [];
50
+ };
51
+ MaterialStepRules.prototype.onRuleEnd = function (_move) {
52
+ return [];
53
+ };
54
+ MaterialStepRules.prototype.onCustomMove = function (_move) {
55
+ return [];
56
+ };
57
+ MaterialStepRules.prototype.rules = function () {
58
+ return new MaterialRulesMovesBuilder_1.MaterialRulesMovesBuilder(this.game);
59
+ };
60
+ MaterialStepRules.prototype.getMemory = function (player) {
61
+ var _a, _b, _c;
62
+ if (player !== undefined) {
63
+ return ((_b = (_a = this.game.rule.playersMemory) === null || _a === void 0 ? void 0 : _a[player]) !== null && _b !== void 0 ? _b : {});
64
+ }
65
+ else {
66
+ return ((_c = this.game.rule.memory) !== null && _c !== void 0 ? _c : {});
67
+ }
68
+ };
69
+ MaterialStepRules.prototype.memorize = function (memory, player) {
70
+ if (player !== undefined) {
71
+ if (!this.game.rule.playersMemory)
72
+ this.game.rule.playersMemory = {};
73
+ this.game.rule.playersMemory[player] = __assign(__assign({}, this.game.rule.playersMemory[player]), memory);
74
+ }
75
+ else {
76
+ this.game.rule.memory = __assign(__assign({}, this.game.rule.memory), memory);
77
+ }
78
+ };
79
+ MaterialStepRules.prototype.getGameMemory = function (player) {
80
+ var _a, _b, _c;
81
+ if (player !== undefined) {
82
+ return ((_b = (_a = this.game.playersMemory) === null || _a === void 0 ? void 0 : _a[player]) !== null && _b !== void 0 ? _b : {});
83
+ }
84
+ else {
85
+ return ((_c = this.game.memory) !== null && _c !== void 0 ? _c : {});
86
+ }
87
+ };
88
+ MaterialStepRules.prototype.memorizeOnGame = function (memory, player) {
89
+ if (player !== undefined) {
90
+ if (!this.game.playersMemory)
91
+ this.game.playersMemory = {};
92
+ this.game.playersMemory[player] = __assign(__assign({}, this.game.playersMemory[player]), memory);
93
+ }
94
+ else {
95
+ this.game.memory = __assign(__assign({}, this.game.memory), memory);
96
+ }
97
+ };
98
+ return MaterialStepRules;
99
+ }(Rules_1.Rules));
100
+ exports.MaterialStepRules = MaterialStepRules;
101
+ //# sourceMappingURL=MaterialStepRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaterialStepRules.js","sourceRoot":"","sources":["../../../src/material/rules/MaterialStepRules.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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CAAC,AAjED,CACU,aAAK,GAgEd;AAjEqB,8CAAiB"}
@@ -0,0 +1,10 @@
1
+ import { MaterialStepRules } from './MaterialStepRules';
2
+ import { MaterialRulesMove } from '../moves';
3
+ export declare abstract class PlayerTurnRule<Player extends number = number, MaterialType extends number = number, LocationType extends number = number> extends MaterialStepRules<Player, MaterialType, LocationType> {
4
+ get player(): Player;
5
+ get nextPlayer(): Player;
6
+ getActivePlayer(): Player;
7
+ initializeMoves(): MaterialRulesMove<Player, MaterialType, LocationType>[];
8
+ getLegalMoves(player: Player): MaterialRulesMove<Player, MaterialType, LocationType>[];
9
+ abstract getPlayerMoves(): MaterialRulesMove<Player, MaterialType, LocationType>[];
10
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PlayerTurnRule = void 0;
19
+ var MaterialStepRules_1 = require("./MaterialStepRules");
20
+ var PlayerTurnRule = /** @class */ (function (_super) {
21
+ __extends(PlayerTurnRule, _super);
22
+ function PlayerTurnRule() {
23
+ return _super !== null && _super.apply(this, arguments) || this;
24
+ }
25
+ Object.defineProperty(PlayerTurnRule.prototype, "player", {
26
+ get: function () {
27
+ return this.game.rule.player;
28
+ },
29
+ enumerable: false,
30
+ configurable: true
31
+ });
32
+ Object.defineProperty(PlayerTurnRule.prototype, "nextPlayer", {
33
+ get: function () {
34
+ return this.game.players[(this.game.players.indexOf(this.player) + 1) % this.game.players.length];
35
+ },
36
+ enumerable: false,
37
+ configurable: true
38
+ });
39
+ PlayerTurnRule.prototype.getActivePlayer = function () {
40
+ return this.player;
41
+ };
42
+ PlayerTurnRule.prototype.initializeMoves = function () {
43
+ return [];
44
+ };
45
+ PlayerTurnRule.prototype.getLegalMoves = function (player) {
46
+ if (player !== this.getActivePlayer())
47
+ return [];
48
+ return this.getPlayerMoves();
49
+ };
50
+ return PlayerTurnRule;
51
+ }(MaterialStepRules_1.MaterialStepRules));
52
+ exports.PlayerTurnRule = PlayerTurnRule;
53
+ //# sourceMappingURL=PlayerTurnRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayerTurnRule.js","sourceRoot":"","sources":["../../../src/material/rules/PlayerTurnRule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yDAAuD;AAGvD;IACU,kCAAqD;IAD/D;;IAyBA,CAAC;IAtBC,sBAAI,kCAAM;aAAV;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAK,CAAC,MAAO,CAAA;QAChC,CAAC;;;OAAA;IAED,sBAAI,sCAAU;aAAd;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACnG,CAAC;;;OAAA;IAED,wCAAe,GAAf;QACE,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,wCAAe,GAAf;QACE,OAAO,EAAE,CAAA;IACX,CAAC;IAED,sCAAa,GAAb,UAAc,MAAc;QAC1B,IAAI,MAAM,KAAK,IAAI,CAAC,eAAe,EAAE;YAAE,OAAO,EAAE,CAAA;QAChD,OAAO,IAAI,CAAC,cAAc,EAAE,CAAA;IAC9B,CAAC;IAGH,qBAAC;AAAD,CAAC,AAzBD,CACU,qCAAiB,GAwB1B;AAzBqB,wCAAc"}
@@ -0,0 +1,6 @@
1
+ export declare type RuleStep<Player extends number = number, RuleId extends number = number> = {
2
+ id: RuleId;
3
+ player?: Player;
4
+ memory?: Record<string, any>;
5
+ playersMemory?: Partial<Record<Player, Record<string, any>>>;
6
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RuleStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuleStep.js","sourceRoot":"","sources":["../../../src/material/rules/RuleStep.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './RuleStep';
2
+ export * from './MaterialStepRules';
3
+ export * from './PlayerTurnRule';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./RuleStep"), exports);
18
+ __exportStar(require("./MaterialStepRules"), exports);
19
+ __exportStar(require("./PlayerTurnRule"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/material/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,sDAAmC;AACnC,mDAAgC"}
@@ -1,7 +1,6 @@
1
- import Option from './Option';
2
- declare type EnumOption<T = any> = Option & {
1
+ import { Option } from './Option';
2
+ export declare type EnumOption<T = any> = Option & {
3
3
  values: T[];
4
4
  valueSpec: (value: T) => Option;
5
5
  };
6
- export default EnumOption;
7
6
  export declare function isEnumOption<T = any>(option: Option): option is EnumOption<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"EnumOption.js","sourceRoot":"","sources":["../../src/options/EnumOption.ts"],"names":[],"mappings":";;;AASA,SAAgB,YAAY,CAAU,MAAc;IAClD,OAAO,KAAK,CAAC,OAAO,CAAE,MAAqB,CAAC,MAAM,CAAC,CAAA;AACrD,CAAC;AAFD,oCAEC"}
1
+ {"version":3,"file":"EnumOption.js","sourceRoot":"","sources":["../../src/options/EnumOption.ts"],"names":[],"mappings":";;;AAOA,SAAgB,YAAY,CAAU,MAAc;IAClD,OAAO,KAAK,CAAC,OAAO,CAAE,MAAqB,CAAC,MAAM,CAAC,CAAA;AACrD,CAAC;AAFD,oCAEC"}
@@ -1,9 +1,8 @@
1
1
  import { TFunction } from 'i18next';
2
- declare type Option = {
2
+ export declare type Option = {
3
3
  label: (t: TFunction) => string;
4
4
  help?: (t: TFunction) => string;
5
5
  warn?: (t: TFunction) => string;
6
6
  subscriberRequired?: boolean;
7
7
  competitiveDisabled?: boolean;
8
8
  };
9
- export default Option;
@@ -1,4 +1,3 @@
1
- import EnumOption from './EnumOption';
2
- import Option from './Option';
3
- declare type OptionSpecOf<T> = [T] extends [boolean] ? Option : EnumOption<T>;
4
- export default OptionSpecOf;
1
+ import { EnumOption } from './EnumOption';
2
+ import { Option } from './Option';
3
+ export declare type OptionSpecOf<T> = [T] extends [boolean] ? Option : EnumOption<T>;
@@ -1,10 +1,9 @@
1
1
  import { TFunction } from 'i18next';
2
- import OptionSpecOf from './OptionSpecOf';
3
- import WithPlayerOptionsSpec from './WithPlayerOptionsSpec';
4
- import WithPlayersOptions from './WithPlayersOptions';
5
- declare type OptionsSpec<Options> = (Options extends WithPlayersOptions<infer P> ? WithPlayerOptionsSpec<P> : {}) & {
2
+ import { OptionSpecOf } from './OptionSpecOf';
3
+ import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
+ import { WithPlayersOptions } from './WithPlayersOptions';
5
+ export declare type OptionsSpec<Options> = (Options extends WithPlayersOptions<infer P> ? WithPlayerOptionsSpec<P> : {}) & {
6
6
  [key in keyof Omit<Options, 'players'>]: OptionSpecOf<Options[key]>;
7
7
  } & {
8
8
  validate?: (options: Partial<Options>, t: TFunction) => void;
9
9
  };
10
- export default OptionsSpec;
@@ -1,4 +1,4 @@
1
- export default class OptionsValidationError extends Error {
1
+ export declare class OptionsValidationError extends Error {
2
2
  fields: string[];
3
3
  constructor(message: string, fields?: string[]);
4
4
  }
@@ -15,6 +15,7 @@ var __extends = (this && this.__extends) || (function () {
15
15
  };
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.OptionsValidationError = void 0;
18
19
  var OptionsValidationError = /** @class */ (function (_super) {
19
20
  __extends(OptionsValidationError, _super);
20
21
  function OptionsValidationError(message, fields) {
@@ -25,5 +26,5 @@ var OptionsValidationError = /** @class */ (function (_super) {
25
26
  }
26
27
  return OptionsValidationError;
27
28
  }(Error));
28
- exports.default = OptionsValidationError;
29
+ exports.OptionsValidationError = OptionsValidationError;
29
30
  //# sourceMappingURL=OptionsValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsValidationError.js","sourceRoot":"","sources":["../../src/options/OptionsValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;IAAoD,0CAAK;IAGvD,gCAAY,OAAe,EAAE,MAAqB;QAArB,uBAAA,EAAA,WAAqB;QAAlD,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IACH,6BAAC;AAAD,CAAC,AAPD,CAAoD,KAAK,GAOxD"}
1
+ {"version":3,"file":"OptionsValidationError.js","sourceRoot":"","sources":["../../src/options/OptionsValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAA4C,0CAAK;IAG/C,gCAAY,OAAe,EAAE,MAAqB;QAArB,uBAAA,EAAA,WAAqB;QAAlD,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IACH,6BAAC;AAAD,CAAC,AAPD,CAA4C,KAAK,GAOhD;AAPY,wDAAsB"}
@@ -1,8 +1,7 @@
1
- import EnumOption from './EnumOption';
2
- declare type PlayerIdSpec<Id> = EnumOption<Id> & {
1
+ import { EnumOption } from './EnumOption';
2
+ export declare type PlayerIdSpec<Id> = EnumOption<Id> & {
3
3
  mandatory?: (players: number) => Id[];
4
4
  unavailable?: (players: number) => Id[];
5
5
  };
6
- export default PlayerIdSpec;
7
6
  export declare function getMandatoryIds<Id>(spec: PlayerIdSpec<Id>, players: number): Id[];
8
7
  export declare function getAvailableIds<Id>(spec: PlayerIdSpec<Id>, players: number): Id[];
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerIdSpec.js","sourceRoot":"","sources":["../../src/options/PlayerIdSpec.ts"],"names":[],"mappings":";;;AASA,SAAgB,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,IAAI,IAAI,CAAC,WAAW,EAAE;QACpB,IAAM,gBAAc,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAA,EAAE,IAAI,OAAA,CAAC,gBAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,EAA5B,CAA4B,CAAC,CAAA;KAC9D;SAAM;QACL,OAAO,IAAI,CAAC,MAAM,CAAA;KACnB;AACH,CAAC;AAPD,0CAOC"}
1
+ {"version":3,"file":"PlayerIdSpec.js","sourceRoot":"","sources":["../../src/options/PlayerIdSpec.ts"],"names":[],"mappings":";;;AAOA,SAAgB,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,IAAI,IAAI,CAAC,WAAW,EAAE;QACpB,IAAM,gBAAc,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAA,EAAE,IAAI,OAAA,CAAC,gBAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,EAA5B,CAA4B,CAAC,CAAA;KAC9D;SAAM;QACL,OAAO,IAAI,CAAC,MAAM,CAAA;KACnB;AACH,CAAC;AAPD,0CAOC"}
@@ -1,8 +1,7 @@
1
- import PlayerIdSpec from './PlayerIdSpec';
2
- import WithIdOption from './WithIdOption';
3
- declare type PlayersOptionsSpec<Options> = (Options extends WithIdOption<infer Id> ? {
1
+ import { PlayerIdSpec } from './PlayerIdSpec';
2
+ import { WithIdOption } from './WithIdOption';
3
+ export declare type PlayersOptionsSpec<Options> = (Options extends WithIdOption<infer Id> ? {
4
4
  id: PlayerIdSpec<Id>;
5
5
  } : {}) & {
6
6
  [key in keyof Omit<Options, 'id'>]: any;
7
7
  };
8
- export default PlayersOptionsSpec;
@@ -1,4 +1,3 @@
1
- declare type WithIdOption<PlayerId> = {
1
+ export declare type WithIdOption<PlayerId> = {
2
2
  id: PlayerId;
3
3
  };
4
- export default WithIdOption;
@@ -1,5 +1,4 @@
1
- import PlayersOptionsSpec from './PlayersOptionsSpec';
2
- declare type WithPlayerOptionsSpec<P> = {
1
+ import { PlayersOptionsSpec } from './PlayersOptionsSpec';
2
+ export declare type WithPlayerOptionsSpec<P> = {
3
3
  players: PlayersOptionsSpec<P>;
4
4
  };
5
- export default WithPlayerOptionsSpec;
@@ -1,4 +1,3 @@
1
- declare type WithPlayersOptions<P> = {
1
+ export declare type WithPlayersOptions<P> = {
2
2
  players: P[];
3
3
  };
4
- export default WithPlayersOptions;
@@ -1,4 +1,4 @@
1
1
  import { TFunction } from 'i18next';
2
- import OptionsSpec from './OptionsSpec';
3
- import WithIdOption from './WithIdOption';
4
- export default function getFallbackPlayerName<Id, P extends WithIdOption<Id>, Options>(id: Id, t: TFunction, optionsSpec?: OptionsSpec<Options>): string;
2
+ import { OptionsSpec } from './OptionsSpec';
3
+ import { WithIdOption } from './WithIdOption';
4
+ export declare function getFallbackPlayerName<Id, P extends WithIdOption<Id>, Options>(id: Id, t: TFunction, optionsSpec?: OptionsSpec<Options>): string;
@@ -1,16 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var isWithPlayerIdOptions_1 = __importDefault(require("./isWithPlayerIdOptions"));
3
+ exports.getFallbackPlayerName = void 0;
4
+ var isWithPlayerIdOptions_1 = require("./isWithPlayerIdOptions");
7
5
  function getFallbackPlayerName(id, t, optionsSpec) {
8
- if (optionsSpec && (0, isWithPlayerIdOptions_1.default)(optionsSpec)) {
6
+ if (optionsSpec && (0, isWithPlayerIdOptions_1.isWithPlayerIdOptions)(optionsSpec)) {
9
7
  return optionsSpec.players.id.valueSpec(id).label(t);
10
8
  }
11
9
  else {
12
10
  return t('Player {number}', { number: id });
13
11
  }
14
12
  }
15
- exports.default = getFallbackPlayerName;
13
+ exports.getFallbackPlayerName = getFallbackPlayerName;
16
14
  //# sourceMappingURL=getFallbackPlayerName.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFallbackPlayerName.js","sourceRoot":"","sources":["../../src/options/getFallbackPlayerName.ts"],"names":[],"mappings":";;;;;AACA,kFAA2D;AAI3D,SAAwB,qBAAqB,CAA0C,EAAM,EAAE,CAAY,EAAE,WAAkC;IAC7I,IAAI,WAAW,IAAI,IAAA,+BAAqB,EAAiB,WAAW,CAAC,EAAE;QACrE,OAAO,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACrD;SAAM;QACL,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,CAAC,CAAA;KAC1C;AACH,CAAC;AAND,wCAMC"}
1
+ {"version":3,"file":"getFallbackPlayerName.js","sourceRoot":"","sources":["../../src/options/getFallbackPlayerName.ts"],"names":[],"mappings":";;;AACA,iEAA+D;AAI/D,SAAgB,qBAAqB,CAA0C,EAAM,EAAE,CAAY,EAAE,WAAkC;IACrI,IAAI,WAAW,IAAI,IAAA,6CAAqB,EAAiB,WAAW,CAAC,EAAE;QACrE,OAAO,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACrD;SAAM;QACL,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,CAAC,CAAA;KAC1C;AACH,CAAC;AAND,sDAMC"}
@@ -1,13 +1,13 @@
1
- export { default as OptionsSpec } from './OptionsSpec';
2
- export { default as OptionSpecOf } from './OptionSpecOf';
3
- export { default as Option } from './Option';
4
- export { default as EnumOption } from './EnumOption';
5
1
  export * from './EnumOption';
6
- export { default as PlayersOptionsSpec } from './PlayersOptionsSpec';
7
- export { default as PlayerIdSpec } from './PlayerIdSpec';
8
- export { default as WithPlayersOptions } from './WithPlayersOptions';
9
- export { default as WithIdOption } from './WithIdOption';
10
- export { default as providePlayerIds } from './providePlayerIds';
11
- export { default as isWithPlayerIdOptions } from './isWithPlayerIdOptions';
12
- export { default as getFallbackPlayerName } from './getFallbackPlayerName';
13
- export { default as OptionsValidationError } from './OptionsValidationError';
2
+ export * from './getFallbackPlayerName';
3
+ export * from './isWithPlayerIdOptions';
4
+ export * from './Option';
5
+ export * from './OptionSpecOf';
6
+ export * from './OptionsSpec';
7
+ export * from './OptionsValidationError';
8
+ export * from './PlayerIdSpec';
9
+ export * from './PlayersOptionsSpec';
10
+ export * from './providePlayerIds';
11
+ export * from './WithIdOption';
12
+ export * from './WithPlayerOptionsSpec';
13
+ export * from './WithPlayersOptions';
@@ -13,18 +13,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.OptionsValidationError = exports.getFallbackPlayerName = exports.isWithPlayerIdOptions = exports.providePlayerIds = void 0;
21
17
  __exportStar(require("./EnumOption"), exports);
22
- var providePlayerIds_1 = require("./providePlayerIds");
23
- Object.defineProperty(exports, "providePlayerIds", { enumerable: true, get: function () { return __importDefault(providePlayerIds_1).default; } });
24
- var isWithPlayerIdOptions_1 = require("./isWithPlayerIdOptions");
25
- Object.defineProperty(exports, "isWithPlayerIdOptions", { enumerable: true, get: function () { return __importDefault(isWithPlayerIdOptions_1).default; } });
26
- var getFallbackPlayerName_1 = require("./getFallbackPlayerName");
27
- Object.defineProperty(exports, "getFallbackPlayerName", { enumerable: true, get: function () { return __importDefault(getFallbackPlayerName_1).default; } });
28
- var OptionsValidationError_1 = require("./OptionsValidationError");
29
- Object.defineProperty(exports, "OptionsValidationError", { enumerable: true, get: function () { return __importDefault(OptionsValidationError_1).default; } });
18
+ __exportStar(require("./getFallbackPlayerName"), exports);
19
+ __exportStar(require("./isWithPlayerIdOptions"), exports);
20
+ __exportStar(require("./Option"), exports);
21
+ __exportStar(require("./OptionSpecOf"), exports);
22
+ __exportStar(require("./OptionsSpec"), exports);
23
+ __exportStar(require("./OptionsValidationError"), exports);
24
+ __exportStar(require("./PlayerIdSpec"), exports);
25
+ __exportStar(require("./PlayersOptionsSpec"), exports);
26
+ __exportStar(require("./providePlayerIds"), exports);
27
+ __exportStar(require("./WithIdOption"), exports);
28
+ __exportStar(require("./WithPlayerOptionsSpec"), exports);
29
+ __exportStar(require("./WithPlayersOptions"), exports);
30
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,+CAA4B;AAK5B,uDAA8D;AAAtD,qIAAA,OAAO,OAAoB;AACnC,iEAAwE;AAAhE,+IAAA,OAAO,OAAyB;AACxC,iEAAwE;AAAhE,+IAAA,OAAO,OAAyB;AACxC,mEAA0E;AAAlE,iJAAA,OAAO,OAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,0DAAuC;AACvC,0DAAuC;AACvC,2CAAwB;AACxB,iDAA8B;AAC9B,gDAA6B;AAC7B,2DAAwC;AACxC,iDAA8B;AAC9B,uDAAoC;AACpC,qDAAkC;AAClC,iDAA8B;AAC9B,0DAAuC;AACvC,uDAAoC"}
@@ -1,4 +1,4 @@
1
- import OptionsSpec from './OptionsSpec';
2
- import WithIdOption from './WithIdOption';
3
- import WithPlayerOptionsSpec from './WithPlayerOptionsSpec';
4
- export default function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
1
+ import { OptionsSpec } from './OptionsSpec';
2
+ import { WithIdOption } from './WithIdOption';
3
+ import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
+ export declare function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWithPlayerIdOptions = void 0;
3
4
  function isWithPlayerIdOptions(optionsSpec) {
4
5
  var playersOptions = optionsSpec.players;
5
6
  if (!playersOptions)
@@ -7,5 +8,5 @@ function isWithPlayerIdOptions(optionsSpec) {
7
8
  var idOptions = playersOptions.id;
8
9
  return !!idOptions;
9
10
  }
10
- exports.default = isWithPlayerIdOptions;
11
+ exports.isWithPlayerIdOptions = isWithPlayerIdOptions;
11
12
  //# sourceMappingURL=isWithPlayerIdOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isWithPlayerIdOptions.js","sourceRoot":"","sources":["../../src/options/isWithPlayerIdOptions.ts"],"names":[],"mappings":";;AAKA,SAAwB,qBAAqB,CAA0C,WAAiC;IACtH,IAAM,cAAc,GAAI,WAA+D,CAAC,OAAO,CAAA;IAC/F,IAAI,CAAC,cAAc;QAAE,OAAO,KAAK,CAAA;IACjC,IAAM,SAAS,GAAI,cAA2D,CAAC,EAAE,CAAA;IACjF,OAAO,CAAC,CAAC,SAAS,CAAA;AACpB,CAAC;AALD,wCAKC"}
1
+ {"version":3,"file":"isWithPlayerIdOptions.js","sourceRoot":"","sources":["../../src/options/isWithPlayerIdOptions.ts"],"names":[],"mappings":";;;AAKA,SAAgB,qBAAqB,CAA0C,WAAiC;IAC9G,IAAM,cAAc,GAAI,WAA+D,CAAC,OAAO,CAAA;IAC/F,IAAI,CAAC,cAAc;QAAE,OAAO,KAAK,CAAA;IACjC,IAAM,SAAS,GAAI,cAA2D,CAAC,EAAE,CAAA;IACjF,OAAO,CAAC,CAAC,SAAS,CAAA;AACpB,CAAC;AALD,sDAKC"}
@@ -1,6 +1,6 @@
1
- import WithIdOption from './WithIdOption';
2
- import WithPlayersOptions from './WithPlayersOptions';
3
- export default function providePlayerIds(players: number): number[];
4
- export default function providePlayerIds<Options>(players: number, options: Options): number[];
5
- export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: number, options: Options): Id[];
6
- export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: (Id | null)[], options: Options): Id[];
1
+ import { WithIdOption } from './WithIdOption';
2
+ import { WithPlayersOptions } from './WithPlayersOptions';
3
+ export declare function providePlayerIds(players: number): number[];
4
+ export declare function providePlayerIds<Options>(players: number, options: Options): number[];
5
+ export declare function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: number, options: Options): Id[];
6
+ export declare function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: (Id | null)[], options: Options): Id[];
@@ -8,23 +8,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8
8
  }
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- var isWithPlayerIdOptions_1 = __importDefault(require("./isWithPlayerIdOptions"));
12
+ exports.providePlayerIds = void 0;
13
+ var isWithPlayerIdOptions_1 = require("./isWithPlayerIdOptions");
16
14
  var PlayerIdSpec_1 = require("./PlayerIdSpec");
17
15
  function providePlayerIds(players, optionsSpec) {
18
16
  var result = typeof players === 'number' ? Array(players).fill(null) : __spreadArray([], players, true);
19
17
  var numberOfPlayers = typeof players === 'number' ? players : players.length;
20
- var mandatoryIds = optionsSpec && (0, isWithPlayerIdOptions_1.default)(optionsSpec) ? (0, PlayerIdSpec_1.getMandatoryIds)(optionsSpec.players.id, numberOfPlayers) : [];
18
+ var mandatoryIds = optionsSpec && (0, isWithPlayerIdOptions_1.isWithPlayerIdOptions)(optionsSpec) ? (0, PlayerIdSpec_1.getMandatoryIds)(optionsSpec.players.id, numberOfPlayers) : [];
21
19
  while (mandatoryIds.some(function (id) { return !result.includes(id); })) {
22
20
  var mandatoryId = mandatoryIds.find(function (id) { return !result.includes(id); });
23
21
  var potentialIndexes = result.map(function (id, index) { return ({ id: id, index: index }); }).filter(function (r) { return !mandatoryIds.includes(r.id); }).map(function (r) { return r.index; });
24
22
  var index = potentialIndexes[Math.floor(Math.random() * potentialIndexes.length)];
25
23
  result[index] = mandatoryId;
26
24
  }
27
- var potentialIds = (optionsSpec && (0, isWithPlayerIdOptions_1.default)(optionsSpec) ? (0, PlayerIdSpec_1.getAvailableIds)(optionsSpec.players.id, numberOfPlayers)
25
+ var potentialIds = (optionsSpec && (0, isWithPlayerIdOptions_1.isWithPlayerIdOptions)(optionsSpec) ? (0, PlayerIdSpec_1.getAvailableIds)(optionsSpec.players.id, numberOfPlayers)
28
26
  : Array.from(Array(numberOfPlayers).keys()).map(function (id) { return id + 1; }));
29
27
  var remainingIds = potentialIds.filter(function (id) { return !result.includes(id); });
30
28
  for (var i = 0; i < result.length; i++) {
@@ -34,5 +32,5 @@ function providePlayerIds(players, optionsSpec) {
34
32
  }
35
33
  return result;
36
34
  }
37
- exports.default = providePlayerIds;
35
+ exports.providePlayerIds = providePlayerIds;
38
36
  //# sourceMappingURL=providePlayerIds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"providePlayerIds.js","sourceRoot":"","sources":["../../src/options/providePlayerIds.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kFAA2D;AAE3D,+CAA+D;AAS/D,SAAwB,gBAAgB,CAAc,OAA+B,EAAE,WAA8B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AC,WAAW,IAAI,IAAA,6CAAqB,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAA,8BAAe,EAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC;QAChI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAA,EAAE,IAAI,OAAA,EAAE,GAAG,CAAC,EAAN,CAAM,CAAC,CAAS,CAAA;IACxE,IAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,UAAA,EAAE,IAAI,OAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAApB,CAAoB,CAAC,CAAA;IACpE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;YAC3D,MAAM,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;SACvF;KACF;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAvBD,4CAuBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamepark/rules-api",
3
- "version": "5.23.2",
3
+ "version": "6.0.1-alpha.0",
4
4
  "description": "API to implement the rules of a board game",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,13 +19,19 @@
19
19
  "author": "Romain Fromi <romain@game-park.com> (https://game-park.com/)",
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
- "fast-deep-equal": "^3.1.3"
22
+ "fast-deep-equal": "^3.1.3",
23
+ "lodash.mapvalues": "^4.6.0",
24
+ "lodash.maxby": "^4.6.0",
25
+ "lodash.minby": "^4.6.0"
23
26
  },
24
27
  "publishConfig": {
25
28
  "access": "public"
26
29
  },
27
30
  "devDependencies": {
31
+ "@types/lodash.mapvalues": "^4.6.7",
32
+ "@types/lodash.maxby": "^4.6.7",
33
+ "@types/lodash.minby": "^4.6.7",
28
34
  "i18next": ">=21.3.0"
29
35
  },
30
- "gitHead": "317a703a17f04f117eb91ab4a7a547a28bf87b0d"
36
+ "gitHead": "6743256139b4328bcdd2436f03ddc3b3cacecb71"
31
37
  }