dyo-tools 0.3.2 → 0.4.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 (209) hide show
  1. package/.c8rc.json +4 -4
  2. package/.eslintignore +1 -1
  3. package/.eslintrc.json +47 -47
  4. package/Makefile +34 -34
  5. package/dist/constants.d.ts +1 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +24 -20
  8. package/dist/constants.js.map +1 -1
  9. package/dist/core/DTAction.d.ts +6 -4
  10. package/dist/core/DTAction.d.ts.map +1 -0
  11. package/dist/core/DTAction.js +3 -6
  12. package/dist/core/DTAction.js.map +1 -1
  13. package/dist/core/DTBunch.d.ts +8 -5
  14. package/dist/core/DTBunch.d.ts.map +1 -0
  15. package/dist/core/DTBunch.js +53 -19
  16. package/dist/core/DTBunch.js.map +1 -1
  17. package/dist/core/DTComponent.d.ts +13 -10
  18. package/dist/core/DTComponent.d.ts.map +1 -0
  19. package/dist/core/DTComponent.js +23 -10
  20. package/dist/core/DTComponent.js.map +1 -1
  21. package/dist/core/DTComponentPhysical.d.ts +11 -8
  22. package/dist/core/DTComponentPhysical.d.ts.map +1 -0
  23. package/dist/core/DTComponentPhysical.js +21 -6
  24. package/dist/core/DTComponentPhysical.js.map +1 -1
  25. package/dist/core/DTComponentWithMeta.d.ts +6 -3
  26. package/dist/core/DTComponentWithMeta.d.ts.map +1 -0
  27. package/dist/core/DTComponentWithMeta.js +21 -7
  28. package/dist/core/DTComponentWithMeta.js.map +1 -1
  29. package/dist/core/DTElement.d.ts +10 -8
  30. package/dist/core/DTElement.d.ts.map +1 -0
  31. package/dist/core/DTElement.js +8 -9
  32. package/dist/core/DTElement.js.map +1 -1
  33. package/dist/core/DTError.d.ts +8 -7
  34. package/dist/core/DTError.d.ts.map +1 -0
  35. package/dist/core/DTError.js +1 -5
  36. package/dist/core/DTError.js.map +1 -1
  37. package/dist/core/DTManager.d.ts +17 -14
  38. package/dist/core/DTManager.d.ts.map +1 -0
  39. package/dist/core/DTManager.js +84 -26
  40. package/dist/core/DTManager.js.map +1 -1
  41. package/dist/core/DTMaster.d.ts +19 -16
  42. package/dist/core/DTMaster.d.ts.map +1 -0
  43. package/dist/core/DTMaster.js +48 -31
  44. package/dist/core/DTMaster.js.map +1 -1
  45. package/dist/core/DTModule.d.ts +8 -5
  46. package/dist/core/DTModule.d.ts.map +1 -0
  47. package/dist/core/DTModule.js +6 -6
  48. package/dist/core/DTModule.js.map +1 -1
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +12 -28
  52. package/dist/index.js.map +1 -1
  53. package/dist/libs/DYOFinder.d.ts +1 -0
  54. package/dist/libs/DYOFinder.d.ts.map +1 -0
  55. package/dist/libs/DYOFinder.js +10 -14
  56. package/dist/libs/DYOFinder.js.map +1 -1
  57. package/dist/libs/dix/DIXModule.module.d.ts +8 -0
  58. package/dist/libs/dix/DIXModule.module.d.ts.map +1 -0
  59. package/dist/libs/dix/DIXModule.module.js +73 -0
  60. package/dist/libs/player/DTPlayer.element.d.ts +3 -2
  61. package/dist/libs/player/DTPlayer.element.d.ts.map +1 -0
  62. package/dist/libs/player/DTPlayer.element.js +2 -6
  63. package/dist/libs/player/DTPlayer.element.js.map +1 -1
  64. package/dist/libs/player/DTPlayer.manager.d.ts +8 -7
  65. package/dist/libs/player/DTPlayer.manager.d.ts.map +1 -0
  66. package/dist/libs/player/DTPlayer.manager.js +13 -20
  67. package/dist/libs/player/DTPlayer.manager.js.map +1 -1
  68. package/dist/tsconfig.dev.tsbuildinfo +1 -0
  69. package/dist/tsconfig.tsbuildinfo +1 -1
  70. package/dist/types/core.d.ts +40 -12
  71. package/dist/types/core.d.ts.map +1 -0
  72. package/dist/types/core.js +2 -6
  73. package/dist/types/core.js.map +1 -1
  74. package/dist/types/index.d.ts +1 -0
  75. package/dist/types/index.d.ts.map +1 -0
  76. package/dist/types/index.js +2 -19
  77. package/dist/types/index.js.map +1 -1
  78. package/dist/types/player.d.ts +1 -1
  79. package/dist/types/player.d.ts.map +1 -0
  80. package/dist/types/player.js +1 -3
  81. package/integration/data/components/DTHero.ts +42 -0
  82. package/integration/data/components/DTHeroManager.ts +11 -0
  83. package/integration/data/components/DTHeroPlayZone.ts +6 -0
  84. package/integration/data/components/DTHeroPlayerHand.ts +11 -0
  85. package/integration/data/components/index.ts +5 -0
  86. package/integration/data/in/heroIn.helper.ts +8 -0
  87. package/integration/data/in/playerIn.helper.ts +13 -0
  88. package/integration/data/out/heroOut.helper.ts +48 -0
  89. package/integration/endings/synchronisation.ending.ts +25 -0
  90. package/integration/scenes/drawCard.scene.ts +31 -0
  91. package/integration/scenes/empty.scene.ts +6 -0
  92. package/integration/scenes/playCard.scene.ts +23 -0
  93. package/integration/scenes/playerLeave.scene.ts +33 -0
  94. package/integration/stages/baseDix.stage.ts +137 -0
  95. package/integration/stages/syncDix.stage.ts +36 -0
  96. package/integration/tests/scenario1.spec.ts +55 -0
  97. package/integration/types/index.ts +24 -0
  98. package/jest-integration.config.ts +25 -0
  99. package/jest.config.ts +26 -0
  100. package/package.json +31 -19
  101. package/src/constants.ts +2 -0
  102. package/src/core/DTAction.ts +7 -5
  103. package/src/core/DTBunch.ts +78 -14
  104. package/src/core/DTComponent.ts +48 -15
  105. package/src/core/DTComponentPhysical.ts +45 -11
  106. package/src/core/DTComponentWithMeta.ts +37 -4
  107. package/src/core/DTElement.ts +19 -10
  108. package/src/core/DTError.ts +7 -7
  109. package/src/core/DTManager.ts +120 -30
  110. package/src/core/DTMaster.ts +76 -28
  111. package/src/core/DTModule.ts +12 -6
  112. package/src/index.ts +17 -17
  113. package/src/libs/DYOFinder.ts +175 -175
  114. package/src/libs/dix/DIXModule.module.ts +98 -0
  115. package/src/libs/player/DTPlayer.element.ts +2 -2
  116. package/src/libs/player/DTPlayer.manager.ts +20 -34
  117. package/src/types/core.ts +39 -4
  118. package/src/types/index.ts +2 -2
  119. package/src/types/player.ts +0 -1
  120. package/test/core/DTAction.double.ts +12 -28
  121. package/test/core/DTAction.spec.ts +8 -16
  122. package/test/core/DTBunch.double.ts +49 -135
  123. package/test/core/DTBunch.spec.ts +157 -245
  124. package/test/core/DTComponent.double.ts +17 -2
  125. package/test/core/DTComponent.spec.ts +6 -4
  126. package/test/core/DTComponentPhysical.double.ts +29 -43
  127. package/test/core/DTComponentPhysical.spec.ts +22 -19
  128. package/test/core/DTComponentWithMeta.double.ts +38 -31
  129. package/test/core/DTComponentWithMeta.spec.ts +23 -18
  130. package/test/core/DTElement.double.ts +32 -53
  131. package/test/core/DTElement.spec.ts +15 -38
  132. package/test/core/DTError.double.ts +18 -53
  133. package/test/core/DTError.spec.ts +21 -32
  134. package/test/core/DTManager.double.ts +74 -141
  135. package/test/core/DTManager.spec.ts +289 -380
  136. package/test/core/DTMaster.double.ts +56 -80
  137. package/test/core/DTMaster.spec.ts +185 -232
  138. package/test/core/DTModule.double.ts +12 -25
  139. package/test/core/DTModule.spec.ts +14 -28
  140. package/test/core/copy.spec.ts +9 -30
  141. package/tsconfig.dev.json +5 -8
  142. package/tsconfig.json +5 -8
  143. package/cucumber-report.html +0 -48
  144. package/docs/assets/navigation.js +0 -1
  145. package/docs/classes/core_DTAction.DYOToolsAction.html +0 -89
  146. package/docs/classes/core_DTBunch.DYOToolsBunch.html +0 -254
  147. package/docs/classes/core_DTComponent.DYOToolsComponent.html +0 -76
  148. package/docs/classes/core_DTComponentPhysical.DYOToolsComponentPhysical.html +0 -110
  149. package/docs/classes/core_DTComponentWithMeta.DYOToolsComponentWithMeta.html +0 -96
  150. package/docs/classes/core_DTElement.DYOToolsElement.html +0 -135
  151. package/docs/classes/core_DTError.DYOToolsError.html +0 -37
  152. package/docs/classes/core_DTManager.DYOToolsManager.html +0 -237
  153. package/docs/classes/core_DTMaster.DYOToolsMaster.html +0 -150
  154. package/docs/classes/core_DTModule.DYOToolsModule.html +0 -92
  155. package/docs/classes/libs_DYOFinder.DYOFinder.html +0 -34
  156. package/docs/classes/libs_player_DTPlayer_element.DYOToolsPlayer.html +0 -134
  157. package/docs/classes/libs_player_DTPlayer_manager.DYOToolsPlayerManager.html +0 -243
  158. package/docs/enums/types_core.FilterOperatorType.html +0 -10
  159. package/docs/hierarchy.html +0 -1
  160. package/docs/interfaces/types_core.DTBunchFilters.html +0 -6
  161. package/docs/interfaces/types_core.DTBunchOptions.html +0 -19
  162. package/docs/interfaces/types_core.DTBunchToObject.html +0 -7
  163. package/docs/interfaces/types_core.DTComponentOptions.html +0 -5
  164. package/docs/interfaces/types_core.DTComponentToObject.html +0 -4
  165. package/docs/interfaces/types_core.DTElementToObject.html +0 -7
  166. package/docs/interfaces/types_core.DTManagerFilters.html +0 -6
  167. package/docs/interfaces/types_core.DTManagerOptions.html +0 -8
  168. package/docs/interfaces/types_core.DTManagerToObject.html +0 -5
  169. package/docs/interfaces/types_core.DTMasterToObject.html +0 -8
  170. package/docs/interfaces/types_core.DTModuleToObject.html +0 -6
  171. package/docs/interfaces/types_core.DYOFinderConfigurationPropDefault.html +0 -4
  172. package/docs/interfaces/types_core.DYOFinderConfigurationPropObjectSearch.html +0 -4
  173. package/docs/interfaces/types_core.DYOFinderFilterOperatorAdvanced.html +0 -5
  174. package/docs/interfaces/types_core.DYOFinderFilterOperatorBase.html +0 -5
  175. package/docs/interfaces/types_player.DTPlayerManagerSimpleConfiguration.html +0 -3
  176. package/docs/modules/constants.html +0 -6
  177. package/docs/modules/core_DTAction.html +0 -2
  178. package/docs/modules/core_DTBunch.html +0 -2
  179. package/docs/modules/core_DTComponent.html +0 -2
  180. package/docs/modules/core_DTComponentPhysical.html +0 -2
  181. package/docs/modules/core_DTComponentWithMeta.html +0 -2
  182. package/docs/modules/core_DTElement.html +0 -2
  183. package/docs/modules/core_DTError.html +0 -2
  184. package/docs/modules/core_DTManager.html +0 -2
  185. package/docs/modules/core_DTMaster.html +0 -2
  186. package/docs/modules/core_DTModule.html +0 -2
  187. package/docs/modules/libs_DYOFinder.html +0 -2
  188. package/docs/modules/libs_player_DTPlayer_element.html +0 -2
  189. package/docs/modules/libs_player_DTPlayer_manager.html +0 -2
  190. package/docs/modules/types.html +0 -29
  191. package/docs/modules/types_core.html +0 -28
  192. package/docs/modules/types_player.html +0 -2
  193. package/docs/types/types_core.DTAcceptedMetaData.html +0 -2
  194. package/docs/types/types_core.DTManagerItemType.html +0 -1
  195. package/docs/types/types_core.DTManagerItemsType.html +0 -2
  196. package/docs/types/types_core.DYOFinderComponentType.html +0 -1
  197. package/docs/types/types_core.DYOFinderConfiguration.html +0 -2
  198. package/docs/types/types_core.DYOFinderConfigurationProp.html +0 -1
  199. package/docs/types/types_core.DYOFinderFilterOperator.html +0 -1
  200. package/docs/types/types_core.DYOFinderFilterOperatorArgument.html +0 -1
  201. package/docs/types/types_core.DYOFinderFilters.html +0 -1
  202. package/docs/types/types_core.StandardPrimitiveType.html +0 -2
  203. package/docs/types/types_core.StandardPrimitiveTypeWithArray.html +0 -1
  204. package/docs/variables/constants.bunchDefaultOptions.html +0 -2
  205. package/docs/variables/constants.componentBunchDefaultFinderConfiguration.html +0 -1
  206. package/docs/variables/constants.componentManagerDefaultFinderConfiguration.html +0 -1
  207. package/docs/variables/constants.componentPhysicalDefaultFinderConfiguration.html +0 -1
  208. package/docs/variables/constants.managerDefaultOptions.html +0 -2
  209. package/jest.config.js +0 -6
@@ -1,7 +1,7 @@
1
1
  import {expect, jest} from "@jest/globals";
2
- import {DTAction, DTManager, DTMaster, DTModule} from "../../src";
2
+ import {DTMaster} from "../../src";
3
3
  import {DTManagerStub, IDTest as IDManagerTest, manager1IDTest, manager1KeyTest} from "./DTManager.double";
4
- import {DTActionStub, IDTest as IDActionTest, action1IDTest, action1KeyTest} from "./DTAction.double";
4
+ import {action1IDTest, action1KeyTest, DTActionStub, IDTest as IDActionTest} from "./DTAction.double";
5
5
  import {DTModuleStub, IDTest as IDModuleTest, module1IDTest, module1KeyTest} from "./DTModule.double";
6
6
 
7
7
  /** ****************** STUB PROPERTIES CONSTANTS
@@ -15,48 +15,66 @@ export const KeyTest = 'DTMaster-key-1234567';
15
15
  * Providing methods to property access and other facilities, in order to avoid using class methods
16
16
  * **** */
17
17
  export class DTMasterTest extends DTMaster {
18
- th_get_id(): string {
19
- return this._id;
20
- }
21
-
22
- th_set_id(id: string): void {
18
+ constructor(
19
+ id: string = IDTest,
20
+ key: string = KeyTest,
21
+ managers: Record<string, DTManagerStub> = {},
22
+ actions: Record<string, DTActionStub> = {},
23
+ modules: Record<string, DTModuleStub> = {},
24
+ ) {
25
+ super(key);
23
26
  this._id = id;
27
+ this._managers = managers;
28
+ this._actions = actions;
29
+ this._modules = modules;
24
30
  }
25
31
 
26
- th_get_key(): string {
27
- return this._key;
28
- }
29
-
30
- th_set_key(key: string): void {
31
- this._key = key;
32
- }
33
-
34
- th_get_componentType(): string {
35
- return this._componentType;
36
- }
37
-
38
- th_get_managers(): Record<string, DTManager<any>> {
32
+ _getManagers() {
39
33
  return this._managers;
40
34
  }
41
35
 
42
- th_set_managers(managers: Record<string, DTManager<any>>): void {
43
- this._managers = managers;
44
- }
45
-
46
- th_get_actions(): Record<string, DTAction> {
36
+ _getActions() {
47
37
  return this._actions;
48
38
  }
49
39
 
50
- th_set_actions(actions: Record<string, DTAction>): void {
51
- this._actions = actions;
52
- }
53
-
54
- th_get_modules(): Record<string, DTModule> {
40
+ _getModules() {
55
41
  return this._modules;
56
42
  }
57
43
 
58
- th_set_modules(modules: Record<string, DTModule>): void {
59
- this._modules = modules;
44
+ populate() {
45
+ // Managers
46
+ const manager1 = new DTManagerStub();
47
+ const manager2 = new DTManagerStub();
48
+ manager2._setId(manager1IDTest);
49
+ manager2._setKey(manager1KeyTest);
50
+
51
+ this._managers = {
52
+ [IDManagerTest]: manager1,
53
+ [manager1IDTest]: manager2
54
+ };
55
+
56
+ // Actions
57
+ const action1 = new DTActionStub();
58
+ const action2 = new DTActionStub();
59
+ action2._setId(action1IDTest);
60
+ action2._setKey(action1KeyTest);
61
+
62
+ this._actions = {
63
+ [IDActionTest]: action1,
64
+ [action1IDTest]: action2
65
+ };
66
+
67
+ // Modules
68
+ const module1 = new DTModuleStub();
69
+ const module2 = new DTModuleStub();
70
+ module2._setId(module1IDTest);
71
+ module2._setKey(module1KeyTest);
72
+ module2.disable();
73
+
74
+ this._modules = {
75
+ [IDModuleTest]: module1,
76
+ [module1IDTest]: module2
77
+ };
60
78
  }
61
79
  }
62
80
 
@@ -70,8 +88,8 @@ export class DTMasterTest extends DTMaster {
70
88
  * **** */
71
89
  export const checkMasterManagers = (master: DTMasterTest, ids: string[]) => {
72
90
  let i = 0;
73
- expect(Object.keys(master.th_get_managers()).length).toBe(ids.length);
74
- for (let [id, manager] of Object.entries(master.th_get_managers())) {
91
+ expect(Object.keys(master._getManagers()).length).toBe(ids.length);
92
+ for (let [id, manager] of Object.entries(master._getManagers())) {
75
93
  expect(id).toBe(ids[i]);
76
94
  expect(manager.getId()).toBe(ids[i]);
77
95
  i++;
@@ -80,8 +98,8 @@ export const checkMasterManagers = (master: DTMasterTest, ids: string[]) => {
80
98
 
81
99
  export const checkMasterActions = (master: DTMasterTest, ids: string[]) => {
82
100
  let i = 0;
83
- expect(Object.keys(master.th_get_actions()).length).toBe(ids.length);
84
- for (let [id, action] of Object.entries(master.th_get_actions())) {
101
+ expect(Object.keys(master._getActions()).length).toBe(ids.length);
102
+ for (let [id, action] of Object.entries(master._getActions())) {
85
103
  expect(id).toBe(ids[i]);
86
104
  expect(action.getId()).toBe(ids[i]);
87
105
  i++;
@@ -90,52 +108,10 @@ export const checkMasterActions = (master: DTMasterTest, ids: string[]) => {
90
108
 
91
109
  export const checkMasterModules = (master: DTMasterTest, ids: string[]) => {
92
110
  let i = 0;
93
- expect(Object.keys(master.th_get_modules()).length).toBe(ids.length);
94
- for (let [id, module] of Object.entries(master.th_get_modules())) {
111
+ expect(Object.keys(master._getModules()).length).toBe(ids.length);
112
+ for (let [id, module] of Object.entries(master._getModules())) {
95
113
  expect(id).toBe(ids[i]);
96
114
  expect(module.getId()).toBe(ids[i]);
97
115
  i++;
98
116
  }
99
- }
100
-
101
- export const populateMaster = (master: DTMasterTest) => {
102
- // Managers
103
- const manager1 = new DTManagerStub();
104
- const manager2 = new DTManagerStub();
105
- manager2.th_set_id(manager1IDTest);
106
- manager2.th_set_key(manager1KeyTest);
107
- jest.spyOn(manager2, 'getId').mockReturnValue(manager1IDTest);
108
- jest.spyOn(manager2, 'getKey').mockReturnValue(manager1KeyTest);
109
-
110
- master.th_set_managers({
111
- [IDManagerTest]: manager1,
112
- [manager1IDTest]: manager2
113
- });
114
-
115
- // Actions
116
- const action1 = new DTActionStub();
117
- const action2 = new DTActionStub();
118
- action2.th_set_id(action1IDTest);
119
- action2.th_set_key(action1KeyTest);
120
- jest.spyOn(action2, 'getId').mockReturnValue(action1IDTest);
121
- jest.spyOn(action2, 'getKey').mockReturnValue(action1KeyTest);
122
-
123
- master.th_set_actions({
124
- [IDActionTest]: action1,
125
- [action1IDTest]: action2
126
- });
127
-
128
- // Modules
129
- const module1 = new DTModuleStub();
130
- const module2 = new DTModuleStub();
131
- module2.th_set_id(module1IDTest);
132
- module2.th_set_key(module1KeyTest);
133
- module2.th_set_enabled(false);
134
- jest.spyOn(module2, 'getId').mockReturnValue(module1IDTest);
135
- jest.spyOn(module2, 'getKey').mockReturnValue(module1KeyTest);
136
-
137
- master.th_set_modules({
138
- [IDModuleTest]: module1,
139
- [module1IDTest]: module2
140
- });
141
117
  }