@vived/app 6.8.0 → 6.10.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 (230) hide show
  1. package/README.md +166 -145
  2. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js +67 -0
  3. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
  4. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js +84 -0
  5. package/dist/cjs/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
  6. package/dist/cjs/Callouts/Factories/index.js +1 -0
  7. package/dist/cjs/Callouts/Factories/index.js.map +1 -1
  8. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js +52 -0
  9. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
  10. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +44 -0
  11. package/dist/cjs/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
  12. package/dist/cjs/ChannelModel/Factories/index.js +1 -0
  13. package/dist/cjs/ChannelModel/Factories/index.js.map +1 -1
  14. package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.js +4 -3
  15. package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.js.map +1 -1
  16. package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.test.js +35 -0
  17. package/dist/cjs/Dispatcher/Factories/DispatcherFeatureFactory.test.js.map +1 -0
  18. package/dist/cjs/Dispatcher/Factories/setupDispatchers.js +1 -0
  19. package/dist/cjs/Dispatcher/Factories/setupDispatchers.js.map +1 -1
  20. package/dist/cjs/Dispatcher/Factories/setupDispatchers.test.js +33 -0
  21. package/dist/cjs/Dispatcher/Factories/setupDispatchers.test.js.map +1 -0
  22. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js +50 -0
  23. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
  24. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js +39 -0
  25. package/dist/cjs/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
  26. package/dist/cjs/Environment/Factories/index.js +2 -1
  27. package/dist/cjs/Environment/Factories/index.js.map +1 -1
  28. package/dist/cjs/Environment/Factories/setupEnvironments.js +19 -0
  29. package/dist/cjs/Environment/Factories/setupEnvironments.js.map +1 -0
  30. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js +69 -0
  31. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
  32. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js +116 -0
  33. package/dist/cjs/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
  34. package/dist/cjs/Hideable/Factories/index.js +1 -0
  35. package/dist/cjs/Hideable/Factories/index.js.map +1 -1
  36. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js +79 -0
  37. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
  38. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +81 -0
  39. package/dist/cjs/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
  40. package/dist/cjs/HoverLabel/Factories/index.js +1 -0
  41. package/dist/cjs/HoverLabel/Factories/index.js.map +1 -1
  42. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js +85 -0
  43. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
  44. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js +100 -0
  45. package/dist/cjs/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
  46. package/dist/cjs/Landmarks/Factories/index.js +1 -0
  47. package/dist/cjs/Landmarks/Factories/index.js.map +1 -1
  48. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js +57 -0
  49. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
  50. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js +60 -0
  51. package/dist/cjs/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
  52. package/dist/cjs/Selection/Factories/index.js +1 -0
  53. package/dist/cjs/Selection/Factories/index.js.map +1 -1
  54. package/dist/cjs/Stick/Factories/StickFeatureFactory.js +45 -0
  55. package/dist/cjs/Stick/Factories/StickFeatureFactory.js.map +1 -0
  56. package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js +44 -0
  57. package/dist/cjs/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
  58. package/dist/cjs/Stick/Factories/index.js +1 -0
  59. package/dist/cjs/Stick/Factories/index.js.map +1 -1
  60. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js +48 -0
  61. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
  62. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js +39 -0
  63. package/dist/cjs/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
  64. package/dist/cjs/StoredView/Factories/index.js +1 -0
  65. package/dist/cjs/StoredView/Factories/index.js.map +1 -1
  66. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js +47 -0
  67. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
  68. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js +35 -0
  69. package/dist/cjs/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
  70. package/dist/cjs/Stylus/Factories/index.js +1 -0
  71. package/dist/cjs/Stylus/Factories/index.js.map +1 -1
  72. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js +70 -0
  73. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
  74. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js +78 -0
  75. package/dist/cjs/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
  76. package/dist/cjs/zSpace/Factory/index.js +1 -0
  77. package/dist/cjs/zSpace/Factory/index.js.map +1 -1
  78. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js +62 -0
  79. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.js.map +1 -0
  80. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js +82 -0
  81. package/dist/esm/Callouts/Factories/CalloutsFeatureFactory.test.js.map +1 -0
  82. package/dist/esm/Callouts/Factories/index.js +1 -0
  83. package/dist/esm/Callouts/Factories/index.js.map +1 -1
  84. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js +47 -0
  85. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.js.map +1 -0
  86. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js +42 -0
  87. package/dist/esm/ChannelModel/Factories/ChannelModelFeatureFactory.test.js.map +1 -0
  88. package/dist/esm/ChannelModel/Factories/index.js +1 -0
  89. package/dist/esm/ChannelModel/Factories/index.js.map +1 -1
  90. package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.js +5 -4
  91. package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.js.map +1 -1
  92. package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.test.js +33 -0
  93. package/dist/esm/Dispatcher/Factories/DispatcherFeatureFactory.test.js.map +1 -0
  94. package/dist/esm/Dispatcher/Factories/setupDispatchers.js +2 -1
  95. package/dist/esm/Dispatcher/Factories/setupDispatchers.js.map +1 -1
  96. package/dist/esm/Dispatcher/Factories/setupDispatchers.test.js +31 -0
  97. package/dist/esm/Dispatcher/Factories/setupDispatchers.test.js.map +1 -0
  98. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js +45 -0
  99. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.js.map +1 -0
  100. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js +37 -0
  101. package/dist/esm/Environment/Factories/EnvironmentFeatureFactory.test.js.map +1 -0
  102. package/dist/esm/Environment/Factories/index.js +2 -1
  103. package/dist/esm/Environment/Factories/index.js.map +1 -1
  104. package/dist/esm/Environment/Factories/setupEnvironments.js +16 -0
  105. package/dist/esm/Environment/Factories/setupEnvironments.js.map +1 -0
  106. package/dist/esm/Hideable/Factories/HideableFeatureFactory.js +64 -0
  107. package/dist/esm/Hideable/Factories/HideableFeatureFactory.js.map +1 -0
  108. package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js +114 -0
  109. package/dist/esm/Hideable/Factories/HideableFeatureFactory.test.js.map +1 -0
  110. package/dist/esm/Hideable/Factories/index.js +1 -0
  111. package/dist/esm/Hideable/Factories/index.js.map +1 -1
  112. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js +74 -0
  113. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.js.map +1 -0
  114. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js +79 -0
  115. package/dist/esm/HoverLabel/Factories/HoverLabelFeatureFactory.test.js.map +1 -0
  116. package/dist/esm/HoverLabel/Factories/index.js +1 -0
  117. package/dist/esm/HoverLabel/Factories/index.js.map +1 -1
  118. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js +80 -0
  119. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.js.map +1 -0
  120. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js +98 -0
  121. package/dist/esm/Landmarks/Factories/LandmarksFeatureFactory.test.js.map +1 -0
  122. package/dist/esm/Landmarks/Factories/index.js +1 -0
  123. package/dist/esm/Landmarks/Factories/index.js.map +1 -1
  124. package/dist/esm/Selection/Factories/SelectionFeatureFactory.js +52 -0
  125. package/dist/esm/Selection/Factories/SelectionFeatureFactory.js.map +1 -0
  126. package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js +58 -0
  127. package/dist/esm/Selection/Factories/SelectionFeatureFactory.test.js.map +1 -0
  128. package/dist/esm/Selection/Factories/index.js +1 -0
  129. package/dist/esm/Selection/Factories/index.js.map +1 -1
  130. package/dist/esm/Stick/Factories/StickFeatureFactory.js +40 -0
  131. package/dist/esm/Stick/Factories/StickFeatureFactory.js.map +1 -0
  132. package/dist/esm/Stick/Factories/StickFeatureFactory.test.js +42 -0
  133. package/dist/esm/Stick/Factories/StickFeatureFactory.test.js.map +1 -0
  134. package/dist/esm/Stick/Factories/index.js +1 -0
  135. package/dist/esm/Stick/Factories/index.js.map +1 -1
  136. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js +43 -0
  137. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.js.map +1 -0
  138. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js +37 -0
  139. package/dist/esm/StoredView/Factories/StoredViewFeatureFactory.test.js.map +1 -0
  140. package/dist/esm/StoredView/Factories/index.js +1 -0
  141. package/dist/esm/StoredView/Factories/index.js.map +1 -1
  142. package/dist/esm/Stylus/Factories/StylusFeatureFactory.js +42 -0
  143. package/dist/esm/Stylus/Factories/StylusFeatureFactory.js.map +1 -0
  144. package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js +33 -0
  145. package/dist/esm/Stylus/Factories/StylusFeatureFactory.test.js.map +1 -0
  146. package/dist/esm/Stylus/Factories/index.js +1 -0
  147. package/dist/esm/Stylus/Factories/index.js.map +1 -1
  148. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js +65 -0
  149. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.js.map +1 -0
  150. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js +76 -0
  151. package/dist/esm/zSpace/Factory/ZSpaceFeatureFactory.test.js.map +1 -0
  152. package/dist/esm/zSpace/Factory/index.js +1 -0
  153. package/dist/esm/zSpace/Factory/index.js.map +1 -1
  154. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts +24 -0
  155. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.d.ts.map +1 -0
  156. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts +2 -0
  157. package/dist/types/Callouts/Factories/CalloutsFeatureFactory.test.d.ts.map +1 -0
  158. package/dist/types/Callouts/Factories/index.d.ts +1 -0
  159. package/dist/types/Callouts/Factories/index.d.ts.map +1 -1
  160. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts +23 -0
  161. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.d.ts.map +1 -0
  162. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts +2 -0
  163. package/dist/types/ChannelModel/Factories/ChannelModelFeatureFactory.test.d.ts.map +1 -0
  164. package/dist/types/ChannelModel/Factories/index.d.ts +1 -0
  165. package/dist/types/ChannelModel/Factories/index.d.ts.map +1 -1
  166. package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.d.ts +3 -3
  167. package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.d.ts.map +1 -1
  168. package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.test.d.ts +2 -0
  169. package/dist/types/Dispatcher/Factories/DispatcherFeatureFactory.test.d.ts.map +1 -0
  170. package/dist/types/Dispatcher/Factories/setupDispatchers.d.ts.map +1 -1
  171. package/dist/types/Dispatcher/Factories/setupDispatchers.test.d.ts +2 -0
  172. package/dist/types/Dispatcher/Factories/setupDispatchers.test.d.ts.map +1 -0
  173. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts +23 -0
  174. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.d.ts.map +1 -0
  175. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts +2 -0
  176. package/dist/types/Environment/Factories/EnvironmentFeatureFactory.test.d.ts.map +1 -0
  177. package/dist/types/Environment/Factories/index.d.ts +2 -1
  178. package/dist/types/Environment/Factories/index.d.ts.map +1 -1
  179. package/dist/types/Environment/Factories/setupEnvironments.d.ts +3 -0
  180. package/dist/types/Environment/Factories/setupEnvironments.d.ts.map +1 -0
  181. package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts +32 -0
  182. package/dist/types/Hideable/Factories/HideableFeatureFactory.d.ts.map +1 -0
  183. package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts +2 -0
  184. package/dist/types/Hideable/Factories/HideableFeatureFactory.test.d.ts.map +1 -0
  185. package/dist/types/Hideable/Factories/index.d.ts +1 -0
  186. package/dist/types/Hideable/Factories/index.d.ts.map +1 -1
  187. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts +34 -0
  188. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.d.ts.map +1 -0
  189. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts +2 -0
  190. package/dist/types/HoverLabel/Factories/HoverLabelFeatureFactory.test.d.ts.map +1 -0
  191. package/dist/types/HoverLabel/Factories/index.d.ts +1 -0
  192. package/dist/types/HoverLabel/Factories/index.d.ts.map +1 -1
  193. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts +26 -0
  194. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.d.ts.map +1 -0
  195. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts +2 -0
  196. package/dist/types/Landmarks/Factories/LandmarksFeatureFactory.test.d.ts.map +1 -0
  197. package/dist/types/Landmarks/Factories/index.d.ts +1 -0
  198. package/dist/types/Landmarks/Factories/index.d.ts.map +1 -1
  199. package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts +27 -0
  200. package/dist/types/Selection/Factories/SelectionFeatureFactory.d.ts.map +1 -0
  201. package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts +2 -0
  202. package/dist/types/Selection/Factories/SelectionFeatureFactory.test.d.ts.map +1 -0
  203. package/dist/types/Selection/Factories/index.d.ts +1 -0
  204. package/dist/types/Selection/Factories/index.d.ts.map +1 -1
  205. package/dist/types/Stick/Factories/StickFeatureFactory.d.ts +23 -0
  206. package/dist/types/Stick/Factories/StickFeatureFactory.d.ts.map +1 -0
  207. package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts +2 -0
  208. package/dist/types/Stick/Factories/StickFeatureFactory.test.d.ts.map +1 -0
  209. package/dist/types/Stick/Factories/index.d.ts +1 -0
  210. package/dist/types/Stick/Factories/index.d.ts.map +1 -1
  211. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts +23 -0
  212. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.d.ts.map +1 -0
  213. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts +2 -0
  214. package/dist/types/StoredView/Factories/StoredViewFeatureFactory.test.d.ts.map +1 -0
  215. package/dist/types/StoredView/Factories/index.d.ts +1 -0
  216. package/dist/types/StoredView/Factories/index.d.ts.map +1 -1
  217. package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts +23 -0
  218. package/dist/types/Stylus/Factories/StylusFeatureFactory.d.ts.map +1 -0
  219. package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts +2 -0
  220. package/dist/types/Stylus/Factories/StylusFeatureFactory.test.d.ts.map +1 -0
  221. package/dist/types/Stylus/Factories/index.d.ts +1 -0
  222. package/dist/types/Stylus/Factories/index.d.ts.map +1 -1
  223. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts +26 -0
  224. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.d.ts.map +1 -0
  225. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts +2 -0
  226. package/dist/types/zSpace/Factory/ZSpaceFeatureFactory.test.d.ts.map +1 -0
  227. package/dist/types/zSpace/Factory/index.d.ts +1 -0
  228. package/dist/types/zSpace/Factory/index.d.ts.map +1 -1
  229. package/package.json +1 -1
  230. package/src/Dispatcher/README.md +9 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC","sourcesContent":["export * from \"./channelModelFactory\";\nexport * from \"./channelObjectFactory\";\nexport * from \"./setupChannelModels\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ChannelModel/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,yDAAuC;AACvC,uDAAqC;AACrC,+DAA6C","sourcesContent":["export * from \"./channelModelFactory\";\r\nexport * from \"./channelObjectFactory\";\r\nexport * from \"./setupChannelModels\";\r\nexport * from \"./ChannelModelFeatureFactory\";\r\n"]}
@@ -15,7 +15,7 @@ const UC_1 = require("../UC");
15
15
  *
16
16
  * The factory creates:
17
17
  * - AppDispatcher entity with hostHandler integration
18
- * - All 24 dispatcher-related Use Cases for handling various app operations
18
+ * - All 27 dispatcher-related Use Cases for handling various app operations
19
19
  *
20
20
  * @extends DomainFactory
21
21
  */
@@ -46,11 +46,11 @@ class DispatcherFeatureFactory extends core_1.DomainFactory {
46
46
  /**
47
47
  * Sets up all use cases for the Dispatcher Feature.
48
48
  *
49
- * Initializes all 24 use cases that define the business operations and
49
+ * Initializes all 27 use cases that define the business operations and
50
50
  * workflows available through the dispatcher system. These use cases handle:
51
51
  * - App lifecycle management (ready, state changes)
52
52
  * - ZSpace integration (start, stop, availability)
53
- * - Asset management (fetching, metadata, URLs)
53
+ * - Asset management (fetching, metadata, URLs, activity asset upload)
54
54
  * - State navigation (previous, next, completion)
55
55
  * - UI interactions (alerts, confirmations, editors)
56
56
  * - Result submission and logging
@@ -69,6 +69,7 @@ class DispatcherFeatureFactory extends core_1.DomainFactory {
69
69
  (0, UC_1.makeGetAssetStreamURLUC)(this.appObject);
70
70
  (0, UC_1.makeGetLinkedAssetsUC)(this.appObject);
71
71
  (0, UC_1.makeIsAssetFetchedUC)(this.appObject);
72
+ (0, UC_1.makeSubmitActivityAssetUC)(this.appObject);
72
73
  // State navigation
73
74
  (0, UC_1.makeGoToPreviousStateUC)(this.appObject);
74
75
  (0, UC_1.makeGoToNextStateUC)(this.appObject);
@@ -1 +1 @@
1
- {"version":3,"file":"DispatcherFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/DispatcherFeatureFactory.ts"],"names":[],"mappings":";;;AAiKA,oEAMC;AAvKD,sCAA+E;AAC/E,0CAAgD;AAChD,8BA2Be;AAEf;;;;;;;;;;;;;GAaG;AACH,MAAa,wBAAyB,SAAQ,oBAAa;IAOzD;;;;;OAKG;IACH,YAAY,SAAoB,EAAE,WAAoB;QACpD,KAAK,CAAC,SAAS,CAAC,CAAC;QAbnB,gBAAW,GAAG,0BAA0B,CAAC;QAElC,YAAO,GAAG,KAAK,CAAC;QAYrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,aAAa;QACX,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACnE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ;QACN,qCAAqC;QACrC,IAAA,qBAAgB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,IAAA,8BAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAA,8BAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAA,6BAAwB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzC,mBAAmB;QACnB,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAA,uBAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAA,4BAAuB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAA,0BAAqB,EAAC,IAAI,CA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aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC9D,OAAO,IAAI,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { DomainFactory, AppObject, Handler, AppObjectRepo } from \"@vived/core\";\nimport { makeAppDispatcher } from \"../Entities\";\nimport {\n makeAppIsReadyUC,\n makeDispatchStartZSpaceUC,\n makeDispatchStateChangeUC,\n makeDispatchStopZSpaceUC,\n makeGetAssetBlobURLUC,\n makeGetAssetFolderURLUC,\n makeGetAssetMetaUC,\n makeGetAssetsForOwnerUC,\n makeGetAssetStreamURLUC,\n makeGetLinkedAssetsUC,\n makeGoToNextStateUC,\n makeGoToPreviousStateUC,\n makeHasNextStateUC,\n makeHasPreviousStateUC,\n makeIsAssetFetchedUC,\n makeIsZSpaceAvailableUC,\n makeLogUC,\n makeRegisterExternalStylesheetsUC,\n makeShowAlertUC,\n makeShowConfirmUC,\n makeShowMarkdownEditorUC,\n makeShowSelectModelUC,\n makeShowSpinnerUC,\n makeStateHasChangedUC,\n makeStateIsCompleteUC,\n makeSubmitResultUC,\n} from \"../UC\";\n\n/**\n * Factory responsible for setting up the Dispatcher Feature domain components.\n *\n * This factory initializes the AppDispatcher entity and all associated use cases\n * required for the Dispatcher Feature functionality. It follows the domain-driven\n * design pattern by organizing components into their respective layers and replaces\n * the legacy setupDispatchers function while maintaining backwards compatibility.\n *\n * The factory creates:\n * - AppDispatcher entity with hostHandler integration\n * - All 24 dispatcher-related Use Cases for handling various app operations\n *\n * @extends DomainFactory\n */\nexport class DispatcherFeatureFactory extends DomainFactory {\n factoryName = \"DispatcherFeatureFactory\";\n\n public verbose = false;\n\n private hostHandler: Handler;\n\n /**\n * Creates a new DispatcherFeatureFactory instance.\n *\n * @param appObject The AppObject to attach the factory to\n * @param hostHandler The handler function for processing dispatched requests\n */\n constructor(appObject: AppObject, hostHandler: Handler) {\n super(appObject);\n this.hostHandler = hostHandler;\n }\n\n /**\n * Sets up all entities required for the Dispatcher Feature.\n *\n * Creates the AppDispatcher singleton entity that serves as the main\n * communication bridge between the app and the host environment.\n * The entity is initialized with the provided hostHandler for request processing.\n */\n setupEntities(): void {\n const entity = makeAppDispatcher(this.appObject, this.hostHandler);\n entity.verbose = this.verbose;\n }\n\n /**\n * Sets up all use cases for the Dispatcher Feature.\n *\n * Initializes all 24 use cases that define the business operations and\n * workflows available through the dispatcher system. These use cases handle:\n * - App lifecycle management (ready, state changes)\n * - ZSpace integration (start, stop, availability)\n * - Asset management (fetching, metadata, URLs)\n * - State navigation (previous, next, completion)\n * - UI interactions (alerts, confirmations, editors)\n * - Result submission and logging\n */\n setupUCs(): void {\n // App lifecycle and state management\n makeAppIsReadyUC(this.appObject);\n makeDispatchStartZSpaceUC(this.appObject);\n makeDispatchStateChangeUC(this.appObject);\n makeDispatchStopZSpaceUC(this.appObject);\n\n // Asset management\n makeGetAssetBlobURLUC(this.appObject);\n makeGetAssetFolderURLUC(this.appObject);\n makeGetAssetMetaUC(this.appObject);\n makeGetAssetsForOwnerUC(this.appObject);\n makeGetAssetStreamURLUC(this.appObject);\n makeGetLinkedAssetsUC(this.appObject);\n makeIsAssetFetchedUC(this.appObject);\n\n // State navigation\n makeGoToPreviousStateUC(this.appObject);\n makeGoToNextStateUC(this.appObject);\n makeHasPreviousStateUC(this.appObject);\n makeHasNextStateUC(this.appObject);\n makeStateHasChangedUC(this.appObject);\n makeStateIsCompleteUC(this.appObject);\n\n // ZSpace integration\n makeIsZSpaceAvailableUC(this.appObject);\n\n // Logging and utilities\n makeLogUC(this.appObject);\n makeRegisterExternalStylesheetsUC(this.appObject);\n\n // UI interactions\n makeShowAlertUC(this.appObject);\n makeShowConfirmUC(this.appObject);\n makeShowMarkdownEditorUC(this.appObject);\n makeShowSelectModelUC(this.appObject);\n makeShowSpinnerUC(this.appObject);\n\n // Result submission\n makeSubmitResultUC(this.appObject);\n }\n\n /**\n * Sets up all presentation models for the Dispatcher Feature.\n *\n * Currently no presentation models are required for the dispatcher feature\n * as it primarily handles business logic and communication with the host.\n */\n setupPMs(): void {\n // TODO: Create presentation models if needed for dispatcher UI components\n }\n\n /**\n * Performs any final setup operations after all components are initialized.\n *\n * This method is called after entities, use cases, and presentation models\n * have been set up. Currently no additional setup is required for this feature.\n */\n finalSetup(): void {\n // No additional setup required for this feature\n }\n}\n\n/**\n * Factory function to create a new DispatcherFeatureFactory.\n *\n * This function provides the same functionality as the legacy setupDispatchers\n * function but follows the Clean Architecture pattern with proper separation\n * of concerns and domain-driven design principles.\n *\n * @param appObjectRepo The AppObjectRepo to create the dispatcher AppObject from\n * @param hostHandler The handler function for processing dispatched requests\n * @returns A new DispatcherFeatureFactory instance\n */\nexport function makeDispatcherFeatureFactory(\n appObjectRepo: AppObjectRepo,\n hostHandler: Handler,\n): DispatcherFeatureFactory {\n const appObject = appObjectRepo.getOrCreate(\"App Dispatcher\");\n return new DispatcherFeatureFactory(appObject, hostHandler);\n}\n"]}
1
+ {"version":3,"file":"DispatcherFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/DispatcherFeatureFactory.ts"],"names":[],"mappings":";;;AAmKA,oEAMC;AAzKD,sCAA+E;AAC/E,0CAAgD;AAChD,8BA4Be;AAEf;;;;;;;;;;;;;GAaG;AACH,MAAa,wBAAyB,SAAQ,oBAAa;IAOzD;;;;;OAKG;IACH,YAAY,SAAoB,EAAE,WAAoB;QACpD,KAAK,CAAC,SAAS,CAAC,CAAC;QAbnB,gBAAW,GAAG,0BAA0B,CAAC;QAElC,YAAO,GAAG,KAAK,CAAC;QAYrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,aAAa;QACX,MAAM,MAAM,GAAG,IAAA,4BAAiB,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACnE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAChC,CAAC;IAED;;;;;;;;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B,IAAA,sCAAiC,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAElD,kBAAkB;QAClB,IAAA,oBAAe,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,IAAA,sBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,6BAAwB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAA,0BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,IAAA,sBAAiB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAElC,oBAAoB;QACpB,IAAA,uBAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACN,0EAA0E;IAC5E,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACR,gDAAgD;IAClD,CAAC;CACF;AAxGD,4DAwGC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,4BAA4B,CAC1C,aAA4B,EAC5B,WAAoB;IAEpB,MAAM,SAAS,GAAG,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC9D,OAAO,IAAI,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["import { DomainFactory, AppObject, Handler, AppObjectRepo } from \"@vived/core\";\r\nimport { makeAppDispatcher } from \"../Entities\";\r\nimport {\r\n makeAppIsReadyUC,\r\n makeDispatchStartZSpaceUC,\r\n makeDispatchStateChangeUC,\r\n makeDispatchStopZSpaceUC,\r\n makeGetAssetBlobURLUC,\r\n makeGetAssetFolderURLUC,\r\n makeGetAssetMetaUC,\r\n makeGetAssetsForOwnerUC,\r\n makeGetAssetStreamURLUC,\r\n makeGetLinkedAssetsUC,\r\n makeGoToNextStateUC,\r\n makeGoToPreviousStateUC,\r\n makeHasNextStateUC,\r\n makeHasPreviousStateUC,\r\n makeIsAssetFetchedUC,\r\n makeIsZSpaceAvailableUC,\r\n makeLogUC,\r\n makeRegisterExternalStylesheetsUC,\r\n makeShowAlertUC,\r\n makeShowConfirmUC,\r\n makeShowMarkdownEditorUC,\r\n makeShowSelectModelUC,\r\n makeShowSpinnerUC,\r\n makeStateHasChangedUC,\r\n makeStateIsCompleteUC,\r\n makeSubmitActivityAssetUC,\r\n makeSubmitResultUC,\r\n} from \"../UC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Dispatcher Feature domain components.\r\n *\r\n * This factory initializes the AppDispatcher entity and all associated use cases\r\n * required for the Dispatcher Feature functionality. It follows the domain-driven\r\n * design pattern by organizing components into their respective layers and replaces\r\n * the legacy setupDispatchers function while maintaining backwards compatibility.\r\n *\r\n * The factory creates:\r\n * - AppDispatcher entity with hostHandler integration\r\n * - All 27 dispatcher-related Use Cases for handling various app operations\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class DispatcherFeatureFactory extends DomainFactory {\r\n factoryName = \"DispatcherFeatureFactory\";\r\n\r\n public verbose = false;\r\n\r\n private hostHandler: Handler;\r\n\r\n /**\r\n * Creates a new DispatcherFeatureFactory instance.\r\n *\r\n * @param appObject The AppObject to attach the factory to\r\n * @param hostHandler The handler function for processing dispatched requests\r\n */\r\n constructor(appObject: AppObject, hostHandler: Handler) {\r\n super(appObject);\r\n this.hostHandler = hostHandler;\r\n }\r\n\r\n /**\r\n * Sets up all entities required for the Dispatcher Feature.\r\n *\r\n * Creates the AppDispatcher singleton entity that serves as the main\r\n * communication bridge between the app and the host environment.\r\n * The entity is initialized with the provided hostHandler for request processing.\r\n */\r\n setupEntities(): void {\r\n const entity = makeAppDispatcher(this.appObject, this.hostHandler);\r\n entity.verbose = this.verbose;\r\n }\r\n\r\n /**\r\n * Sets up all use cases for the Dispatcher Feature.\r\n *\r\n * Initializes all 27 use cases that define the business operations and\r\n * workflows available through the dispatcher system. These use cases handle:\r\n * - App lifecycle management (ready, state changes)\r\n * - ZSpace integration (start, stop, availability)\r\n * - Asset management (fetching, metadata, URLs, activity asset upload)\r\n * - State navigation (previous, next, completion)\r\n * - UI interactions (alerts, confirmations, editors)\r\n * - Result submission and logging\r\n */\r\n setupUCs(): void {\r\n // App lifecycle and state management\r\n makeAppIsReadyUC(this.appObject);\r\n makeDispatchStartZSpaceUC(this.appObject);\r\n makeDispatchStateChangeUC(this.appObject);\r\n makeDispatchStopZSpaceUC(this.appObject);\r\n\r\n // Asset management\r\n makeGetAssetBlobURLUC(this.appObject);\r\n makeGetAssetFolderURLUC(this.appObject);\r\n makeGetAssetMetaUC(this.appObject);\r\n makeGetAssetsForOwnerUC(this.appObject);\r\n makeGetAssetStreamURLUC(this.appObject);\r\n makeGetLinkedAssetsUC(this.appObject);\r\n makeIsAssetFetchedUC(this.appObject);\r\n makeSubmitActivityAssetUC(this.appObject);\r\n\r\n // State navigation\r\n makeGoToPreviousStateUC(this.appObject);\r\n makeGoToNextStateUC(this.appObject);\r\n makeHasPreviousStateUC(this.appObject);\r\n makeHasNextStateUC(this.appObject);\r\n makeStateHasChangedUC(this.appObject);\r\n makeStateIsCompleteUC(this.appObject);\r\n\r\n // ZSpace integration\r\n makeIsZSpaceAvailableUC(this.appObject);\r\n\r\n // Logging and utilities\r\n makeLogUC(this.appObject);\r\n makeRegisterExternalStylesheetsUC(this.appObject);\r\n\r\n // UI interactions\r\n makeShowAlertUC(this.appObject);\r\n makeShowConfirmUC(this.appObject);\r\n makeShowMarkdownEditorUC(this.appObject);\r\n makeShowSelectModelUC(this.appObject);\r\n makeShowSpinnerUC(this.appObject);\r\n\r\n // Result submission\r\n makeSubmitResultUC(this.appObject);\r\n }\r\n\r\n /**\r\n * Sets up all presentation models for the Dispatcher Feature.\r\n *\r\n * Currently no presentation models are required for the dispatcher feature\r\n * as it primarily handles business logic and communication with the host.\r\n */\r\n setupPMs(): void {\r\n // TODO: Create presentation models if needed for dispatcher UI components\r\n }\r\n\r\n /**\r\n * Performs any final setup operations after all components are initialized.\r\n *\r\n * This method is called after entities, use cases, and presentation models\r\n * have been set up. Currently no additional setup is required for this feature.\r\n */\r\n finalSetup(): void {\r\n // No additional setup required for this feature\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new DispatcherFeatureFactory.\r\n *\r\n * This function provides the same functionality as the legacy setupDispatchers\r\n * function but follows the Clean Architecture pattern with proper separation\r\n * of concerns and domain-driven design principles.\r\n *\r\n * @param appObjectRepo The AppObjectRepo to create the dispatcher AppObject from\r\n * @param hostHandler The handler function for processing dispatched requests\r\n * @returns A new DispatcherFeatureFactory instance\r\n */\r\nexport function makeDispatcherFeatureFactory(\r\n appObjectRepo: AppObjectRepo,\r\n hostHandler: Handler,\r\n): DispatcherFeatureFactory {\r\n const appObject = appObjectRepo.getOrCreate(\"App Dispatcher\");\r\n return new DispatcherFeatureFactory(appObject, hostHandler);\r\n}\r\n"]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const UC_1 = require("../UC");
5
+ const DispatcherFeatureFactory_1 = require("./DispatcherFeatureFactory");
6
+ function makeTestRig() {
7
+ const appObjects = (0, core_1.makeAppObjectRepo)();
8
+ const hostHandler = jest.fn((request) => {
9
+ if (request.type === "SUBMIT_ACTIVITY_ASSET") {
10
+ request.payload.callback("anAssetID");
11
+ }
12
+ });
13
+ const factory = (0, DispatcherFeatureFactory_1.makeDispatcherFeatureFactory)(appObjects, hostHandler);
14
+ factory.setupEntities();
15
+ factory.setupUCs();
16
+ const testFile = new File(["test"], "model.glb");
17
+ return { appObjects, hostHandler, testFile };
18
+ }
19
+ describe("DispatcherFeatureFactory", () => {
20
+ it("Sets up the SubmitActivityAssetUC", () => {
21
+ const { appObjects } = makeTestRig();
22
+ expect(UC_1.SubmitActivityAssetUC.get(appObjects)).toBeDefined();
23
+ });
24
+ it("Submits an activity asset to the host and resolves with its id", async () => {
25
+ const { appObjects, hostHandler, testFile } = makeTestRig();
26
+ const id = await (0, UC_1.submitActivityAsset)(testFile, appObjects);
27
+ expect(hostHandler).toHaveBeenCalledTimes(1);
28
+ const request = hostHandler.mock.calls[0][0];
29
+ expect(request.type).toEqual("SUBMIT_ACTIVITY_ASSET");
30
+ expect(request.version).toEqual(1);
31
+ expect(request.payload.assetFile).toBe(testFile);
32
+ expect(id).toEqual("anAssetID");
33
+ });
34
+ });
35
+ //# sourceMappingURL=DispatcherFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DispatcherFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/DispatcherFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAAyD;AACzD,8BAAmE;AACnE,yEAA0E;AAE1E,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,OAAgB,EAAE,EAAE;QAC/C,IAAI,OAAO,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;YAC5C,OAAO,CAAC,OAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAA,uDAA4B,EAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACtE,OAAO,CAAC,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEnB,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;IAEjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;QAErC,MAAM,CAAC,0BAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;QAE5D,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAmB,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAE3D,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACtD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAE,OAAO,CAAC,OAAe,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1D,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { makeAppObjectRepo, Request } from \"@vived/core\";\r\nimport { SubmitActivityAssetUC, submitActivityAsset } from \"../UC\";\r\nimport { makeDispatcherFeatureFactory } from \"./DispatcherFeatureFactory\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const hostHandler = jest.fn((request: Request) => {\r\n if (request.type === \"SUBMIT_ACTIVITY_ASSET\") {\r\n (request.payload as any).callback(\"anAssetID\");\r\n }\r\n });\r\n\r\n const factory = makeDispatcherFeatureFactory(appObjects, hostHandler);\r\n factory.setupEntities();\r\n factory.setupUCs();\r\n\r\n const testFile = new File([\"test\"], \"model.glb\");\r\n\r\n return { appObjects, hostHandler, testFile };\r\n}\r\n\r\ndescribe(\"DispatcherFeatureFactory\", () => {\r\n it(\"Sets up the SubmitActivityAssetUC\", () => {\r\n const { appObjects } = makeTestRig();\r\n\r\n expect(SubmitActivityAssetUC.get(appObjects)).toBeDefined();\r\n });\r\n\r\n it(\"Submits an activity asset to the host and resolves with its id\", async () => {\r\n const { appObjects, hostHandler, testFile } = makeTestRig();\r\n\r\n const id = await submitActivityAsset(testFile, appObjects);\r\n\r\n expect(hostHandler).toHaveBeenCalledTimes(1);\r\n const request = hostHandler.mock.calls[0][0];\r\n expect(request.type).toEqual(\"SUBMIT_ACTIVITY_ASSET\");\r\n expect(request.version).toEqual(1);\r\n expect((request.payload as any).assetFile).toBe(testFile);\r\n expect(id).toEqual(\"anAssetID\");\r\n });\r\n});\r\n"]}
@@ -31,6 +31,7 @@ function setupDispatchers(appObjects, hostHandler) {
31
31
  (0, UC_1.makeShowSpinnerUC)(dispatcherAO);
32
32
  (0, UC_1.makeStateHasChangedUC)(dispatcherAO);
33
33
  (0, UC_1.makeStateIsCompleteUC)(dispatcherAO);
34
+ (0, UC_1.makeSubmitActivityAssetUC)(dispatcherAO);
34
35
  (0, UC_1.makeSubmitResultUC)(dispatcherAO);
35
36
  }
36
37
  //# sourceMappingURL=setupDispatchers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"setupDispatchers.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/setupDispatchers.ts"],"names":[],"mappings":";;AA+BA,4CAkCC;AAhED,0CAAgD;AAChD,8BA2Be;AAEf,SAAgB,gBAAgB,CAC9B,UAAyB,EACzB,WAAoB;IAEpB,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE9D,IAAA,4BAAiB,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7C,IAAA,qBAAgB,EAAC,YAAY,CAAC,CAAC;IAC/B,IAAA,8BAAyB,EAAC,YAAY,CAAC,CAAC;IACxC,IAAA,8BAAyB,EAAC,YAAY,CAAC,CAAC;IACxC,IAAA,6BAAwB,EAAC,YAAY,CAAC,CAAC;IACvC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;IACjC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,wBAAmB,EAAC,YAAY,CAAC,CAAC;IAClC,IAAA,2BAAsB,EAAC,YAAY,CAAC,CAAC;IACrC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;IACjC,IAAA,yBAAoB,EAAC,YAAY,CAAC,CAAC;IACnC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,cAAS,EAAC,YAAY,CAAC,CAAC;IACxB,IAAA,sCAAiC,EAAC,YAAY,CAAC,CAAC;IAChD,IAAA,oBAAe,EAAC,YAAY,CAAC,CAAC;IAC9B,IAAA,sBAAiB,EAAC,YAAY,CAAC,CAAC;IAChC,IAAA,6BAAwB,EAAC,YAAY,CAAC,CAAC;IACvC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,sBAAiB,EAAC,YAAY,CAAC,CAAC;IAChC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { AppObjectRepo, Handler } from \"@vived/core\";\nimport { makeAppDispatcher } from \"../Entities\";\nimport {\n makeAppIsReadyUC,\n makeDispatchStartZSpaceUC,\n makeDispatchStateChangeUC,\n makeDispatchStopZSpaceUC,\n makeGetAssetBlobURLUC,\n makeGetAssetFolderURLUC,\n makeGetAssetMetaUC,\n makeGetAssetsForOwnerUC,\n makeGetAssetStreamURLUC,\n makeGetLinkedAssetsUC,\n makeGoToNextStateUC,\n makeGoToPreviousStateUC,\n makeHasNextStateUC,\n makeHasPreviousStateUC,\n makeIsAssetFetchedUC,\n makeIsZSpaceAvailableUC,\n makeLogUC,\n makeRegisterExternalStylesheetsUC,\n makeShowAlertUC,\n makeShowConfirmUC,\n makeShowMarkdownEditorUC,\n makeShowSelectModelUC,\n makeShowSpinnerUC,\n makeStateHasChangedUC,\n makeStateIsCompleteUC,\n makeSubmitResultUC,\n} from \"../UC\";\n\nexport function setupDispatchers(\n appObjects: AppObjectRepo,\n hostHandler: Handler,\n) {\n const dispatcherAO = appObjects.getOrCreate(\"App Dispatcher\");\n\n makeAppDispatcher(dispatcherAO, hostHandler);\n\n makeAppIsReadyUC(dispatcherAO);\n makeDispatchStartZSpaceUC(dispatcherAO);\n makeDispatchStateChangeUC(dispatcherAO);\n makeDispatchStopZSpaceUC(dispatcherAO);\n makeGetAssetBlobURLUC(dispatcherAO);\n makeGetAssetFolderURLUC(dispatcherAO);\n makeGetAssetMetaUC(dispatcherAO);\n makeGetAssetsForOwnerUC(dispatcherAO);\n makeGetAssetStreamURLUC(dispatcherAO);\n makeGetLinkedAssetsUC(dispatcherAO);\n makeGoToPreviousStateUC(dispatcherAO);\n makeGoToNextStateUC(dispatcherAO);\n makeHasPreviousStateUC(dispatcherAO);\n makeHasNextStateUC(dispatcherAO);\n makeIsAssetFetchedUC(dispatcherAO);\n makeIsZSpaceAvailableUC(dispatcherAO);\n makeLogUC(dispatcherAO);\n makeRegisterExternalStylesheetsUC(dispatcherAO);\n makeShowAlertUC(dispatcherAO);\n makeShowConfirmUC(dispatcherAO);\n makeShowMarkdownEditorUC(dispatcherAO);\n makeShowSelectModelUC(dispatcherAO);\n makeShowSpinnerUC(dispatcherAO);\n makeStateHasChangedUC(dispatcherAO);\n makeStateIsCompleteUC(dispatcherAO);\n makeSubmitResultUC(dispatcherAO);\n}\n"]}
1
+ {"version":3,"file":"setupDispatchers.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/setupDispatchers.ts"],"names":[],"mappings":";;AAgCA,4CAmCC;AAlED,0CAAgD;AAChD,8BA4Be;AAEf,SAAgB,gBAAgB,CAC9B,UAAyB,EACzB,WAAoB;IAEpB,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE9D,IAAA,4BAAiB,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7C,IAAA,qBAAgB,EAAC,YAAY,CAAC,CAAC;IAC/B,IAAA,8BAAyB,EAAC,YAAY,CAAC,CAAC;IACxC,IAAA,8BAAyB,EAAC,YAAY,CAAC,CAAC;IACxC,IAAA,6BAAwB,EAAC,YAAY,CAAC,CAAC;IACvC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;IACjC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,wBAAmB,EAAC,YAAY,CAAC,CAAC;IAClC,IAAA,2BAAsB,EAAC,YAAY,CAAC,CAAC;IACrC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;IACjC,IAAA,yBAAoB,EAAC,YAAY,CAAC,CAAC;IACnC,IAAA,4BAAuB,EAAC,YAAY,CAAC,CAAC;IACtC,IAAA,cAAS,EAAC,YAAY,CAAC,CAAC;IACxB,IAAA,sCAAiC,EAAC,YAAY,CAAC,CAAC;IAChD,IAAA,oBAAe,EAAC,YAAY,CAAC,CAAC;IAC9B,IAAA,sBAAiB,EAAC,YAAY,CAAC,CAAC;IAChC,IAAA,6BAAwB,EAAC,YAAY,CAAC,CAAC;IACvC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,sBAAiB,EAAC,YAAY,CAAC,CAAC;IAChC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,0BAAqB,EAAC,YAAY,CAAC,CAAC;IACpC,IAAA,8BAAyB,EAAC,YAAY,CAAC,CAAC;IACxC,IAAA,uBAAkB,EAAC,YAAY,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { AppObjectRepo, Handler } from \"@vived/core\";\r\nimport { makeAppDispatcher } from \"../Entities\";\r\nimport {\r\n makeAppIsReadyUC,\r\n makeDispatchStartZSpaceUC,\r\n makeDispatchStateChangeUC,\r\n makeDispatchStopZSpaceUC,\r\n makeGetAssetBlobURLUC,\r\n makeGetAssetFolderURLUC,\r\n makeGetAssetMetaUC,\r\n makeGetAssetsForOwnerUC,\r\n makeGetAssetStreamURLUC,\r\n makeGetLinkedAssetsUC,\r\n makeGoToNextStateUC,\r\n makeGoToPreviousStateUC,\r\n makeHasNextStateUC,\r\n makeHasPreviousStateUC,\r\n makeIsAssetFetchedUC,\r\n makeIsZSpaceAvailableUC,\r\n makeLogUC,\r\n makeRegisterExternalStylesheetsUC,\r\n makeShowAlertUC,\r\n makeShowConfirmUC,\r\n makeShowMarkdownEditorUC,\r\n makeShowSelectModelUC,\r\n makeShowSpinnerUC,\r\n makeStateHasChangedUC,\r\n makeStateIsCompleteUC,\r\n makeSubmitActivityAssetUC,\r\n makeSubmitResultUC,\r\n} from \"../UC\";\r\n\r\nexport function setupDispatchers(\r\n appObjects: AppObjectRepo,\r\n hostHandler: Handler,\r\n) {\r\n const dispatcherAO = appObjects.getOrCreate(\"App Dispatcher\");\r\n\r\n makeAppDispatcher(dispatcherAO, hostHandler);\r\n\r\n makeAppIsReadyUC(dispatcherAO);\r\n makeDispatchStartZSpaceUC(dispatcherAO);\r\n makeDispatchStateChangeUC(dispatcherAO);\r\n makeDispatchStopZSpaceUC(dispatcherAO);\r\n makeGetAssetBlobURLUC(dispatcherAO);\r\n makeGetAssetFolderURLUC(dispatcherAO);\r\n makeGetAssetMetaUC(dispatcherAO);\r\n makeGetAssetsForOwnerUC(dispatcherAO);\r\n makeGetAssetStreamURLUC(dispatcherAO);\r\n makeGetLinkedAssetsUC(dispatcherAO);\r\n makeGoToPreviousStateUC(dispatcherAO);\r\n makeGoToNextStateUC(dispatcherAO);\r\n makeHasPreviousStateUC(dispatcherAO);\r\n makeHasNextStateUC(dispatcherAO);\r\n makeIsAssetFetchedUC(dispatcherAO);\r\n makeIsZSpaceAvailableUC(dispatcherAO);\r\n makeLogUC(dispatcherAO);\r\n makeRegisterExternalStylesheetsUC(dispatcherAO);\r\n makeShowAlertUC(dispatcherAO);\r\n makeShowConfirmUC(dispatcherAO);\r\n makeShowMarkdownEditorUC(dispatcherAO);\r\n makeShowSelectModelUC(dispatcherAO);\r\n makeShowSpinnerUC(dispatcherAO);\r\n makeStateHasChangedUC(dispatcherAO);\r\n makeStateIsCompleteUC(dispatcherAO);\r\n makeSubmitActivityAssetUC(dispatcherAO);\r\n makeSubmitResultUC(dispatcherAO);\r\n}\r\n"]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const UC_1 = require("../UC");
5
+ const setupDispatchers_1 = require("./setupDispatchers");
6
+ function makeTestRig() {
7
+ const appObjects = (0, core_1.makeAppObjectRepo)();
8
+ const hostHandler = jest.fn((request) => {
9
+ if (request.type === "SUBMIT_ACTIVITY_ASSET") {
10
+ request.payload.callback("anAssetID");
11
+ }
12
+ });
13
+ (0, setupDispatchers_1.setupDispatchers)(appObjects, hostHandler);
14
+ const testFile = new File(["test"], "model.glb");
15
+ return { appObjects, hostHandler, testFile };
16
+ }
17
+ describe("setupDispatchers", () => {
18
+ it("Sets up the SubmitActivityAssetUC", () => {
19
+ const { appObjects } = makeTestRig();
20
+ expect(UC_1.SubmitActivityAssetUC.get(appObjects)).toBeDefined();
21
+ });
22
+ it("Submits an activity asset to the host and resolves with its id", async () => {
23
+ const { appObjects, hostHandler, testFile } = makeTestRig();
24
+ const id = await (0, UC_1.submitActivityAsset)(testFile, appObjects);
25
+ expect(hostHandler).toHaveBeenCalledTimes(1);
26
+ const request = hostHandler.mock.calls[0][0];
27
+ expect(request.type).toEqual("SUBMIT_ACTIVITY_ASSET");
28
+ expect(request.version).toEqual(1);
29
+ expect(request.payload.assetFile).toBe(testFile);
30
+ expect(id).toEqual("anAssetID");
31
+ });
32
+ });
33
+ //# sourceMappingURL=setupDispatchers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupDispatchers.test.js","sourceRoot":"","sources":["../../../../src/Dispatcher/Factories/setupDispatchers.test.ts"],"names":[],"mappings":";;AAAA,sCAAyD;AACzD,8BAAmE;AACnE,yDAAsD;AAEtD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,OAAgB,EAAE,EAAE;QAC/C,IAAI,OAAO,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;YAC5C,OAAO,CAAC,OAAe,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAA,mCAAgB,EAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;IAEjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC;AAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,CAAC;QAErC,MAAM,CAAC,0BAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;QAE5D,MAAM,EAAE,GAAG,MAAM,IAAA,wBAAmB,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAE3D,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QACtD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAE,OAAO,CAAC,OAAe,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1D,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { makeAppObjectRepo, Request } from \"@vived/core\";\r\nimport { SubmitActivityAssetUC, submitActivityAsset } from \"../UC\";\r\nimport { setupDispatchers } from \"./setupDispatchers\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const hostHandler = jest.fn((request: Request) => {\r\n if (request.type === \"SUBMIT_ACTIVITY_ASSET\") {\r\n (request.payload as any).callback(\"anAssetID\");\r\n }\r\n });\r\n\r\n setupDispatchers(appObjects, hostHandler);\r\n\r\n const testFile = new File([\"test\"], \"model.glb\");\r\n\r\n return { appObjects, hostHandler, testFile };\r\n}\r\n\r\ndescribe(\"setupDispatchers\", () => {\r\n it(\"Sets up the SubmitActivityAssetUC\", () => {\r\n const { appObjects } = makeTestRig();\r\n\r\n expect(SubmitActivityAssetUC.get(appObjects)).toBeDefined();\r\n });\r\n\r\n it(\"Submits an activity asset to the host and resolves with its id\", async () => {\r\n const { appObjects, hostHandler, testFile } = makeTestRig();\r\n\r\n const id = await submitActivityAsset(testFile, appObjects);\r\n\r\n expect(hostHandler).toHaveBeenCalledTimes(1);\r\n const request = hostHandler.mock.calls[0][0];\r\n expect(request.type).toEqual(\"SUBMIT_ACTIVITY_ASSET\");\r\n expect(request.version).toEqual(1);\r\n expect((request.payload as any).assetFile).toBe(testFile);\r\n expect(id).toEqual(\"anAssetID\");\r\n });\r\n});\r\n"]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvironmentFeatureFactory = void 0;
4
+ exports.makeEnvironmentFeatureFactory = makeEnvironmentFeatureFactory;
5
+ const core_1 = require("@vived/core");
6
+ const Environment_1 = require("../Entities/Environment");
7
+ const EnvironmentalIntensityPM_1 = require("../PMs/EnvironmentalIntensityPM");
8
+ const TexturalEnvironmentPM_1 = require("../PMs/TexturalEnvironmentPM");
9
+ const SerializeEnvironment_1 = require("../UCs/SerializeEnvironment");
10
+ const SetEnvironmentIntensityUC_1 = require("../UCs/SetEnvironmentIntensityUC");
11
+ const SetTexturalEnvironmentUC_1 = require("../UCs/SetTexturalEnvironmentUC");
12
+ /**
13
+ * Factory responsible for setting up the Environment Feature domain components.
14
+ *
15
+ * Builds the same components as the legacy setupEnvironments function, split
16
+ * into the DomainFactory phases.
17
+ *
18
+ * @extends DomainFactory
19
+ */
20
+ class EnvironmentFeatureFactory extends core_1.DomainFactory {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.factoryName = "EnvironmentFeatureFactory";
24
+ }
25
+ setupEntities() {
26
+ (0, Environment_1.makeEnvironmentEntity)(this.appObject);
27
+ }
28
+ setupUCs() {
29
+ (0, SetTexturalEnvironmentUC_1.makeSetTexturalEnvironmentUC)(this.appObject);
30
+ new SerializeEnvironment_1.SerializeEnvironment(this.appObject);
31
+ (0, SetEnvironmentIntensityUC_1.makeSetEnvironmentIntensityUC)(this.appObject);
32
+ }
33
+ setupPMs() {
34
+ (0, TexturalEnvironmentPM_1.makeTexturalEnvironmentPM)(this.appObject);
35
+ (0, EnvironmentalIntensityPM_1.makeEnvironmentalIntensityPM)(this.appObject);
36
+ }
37
+ finalSetup() {
38
+ // No final setup needed
39
+ }
40
+ }
41
+ exports.EnvironmentFeatureFactory = EnvironmentFeatureFactory;
42
+ /**
43
+ * Factory function to create a new EnvironmentFeatureFactory
44
+ * @param appObjects The AppObjectRepo to get or create the Environments AppObject from
45
+ * @returns A new EnvironmentFeatureFactory instance
46
+ */
47
+ function makeEnvironmentFeatureFactory(appObjects) {
48
+ return new EnvironmentFeatureFactory(appObjects.getOrCreate("Environments"));
49
+ }
50
+ //# sourceMappingURL=EnvironmentFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFeatureFactory.ts"],"names":[],"mappings":";;;AA4CA,sEAIC;AAhDD,sCAA2D;AAC3D,yDAAgE;AAChE,8EAA+E;AAC/E,wEAAyE;AACzE,sEAAmE;AACnE,gFAAiF;AACjF,8EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,oBAAa;IAA5D;;QACE,gBAAW,GAAG,2BAA2B,CAAC;IAoB5C,CAAC;IAlBC,aAAa;QACX,IAAA,mCAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ;QACN,IAAA,uDAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,2CAAoB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzC,IAAA,yDAA6B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED,QAAQ;QACN,IAAA,iDAAyB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAA,uDAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU;QACR,wBAAwB;IAC1B,CAAC;CACF;AArBD,8DAqBC;AAED;;;;GAIG;AACH,SAAgB,6BAA6B,CAC3C,UAAyB;IAEzB,OAAO,IAAI,yBAAyB,CAAC,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { makeEnvironmentEntity } from \"../Entities/Environment\";\r\nimport { makeEnvironmentalIntensityPM } from \"../PMs/EnvironmentalIntensityPM\";\r\nimport { makeTexturalEnvironmentPM } from \"../PMs/TexturalEnvironmentPM\";\r\nimport { SerializeEnvironment } from \"../UCs/SerializeEnvironment\";\r\nimport { makeSetEnvironmentIntensityUC } from \"../UCs/SetEnvironmentIntensityUC\";\r\nimport { makeSetTexturalEnvironmentUC } from \"../UCs/SetTexturalEnvironmentUC\";\r\n\r\n/**\r\n * Factory responsible for setting up the Environment Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupEnvironments function, split\r\n * into the DomainFactory phases.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class EnvironmentFeatureFactory extends DomainFactory {\r\n factoryName = \"EnvironmentFeatureFactory\";\r\n\r\n setupEntities(): void {\r\n makeEnvironmentEntity(this.appObject);\r\n }\r\n\r\n setupUCs(): void {\r\n makeSetTexturalEnvironmentUC(this.appObject);\r\n new SerializeEnvironment(this.appObject);\r\n makeSetEnvironmentIntensityUC(this.appObject);\r\n }\r\n\r\n setupPMs(): void {\r\n makeTexturalEnvironmentPM(this.appObject);\r\n makeEnvironmentalIntensityPM(this.appObject);\r\n }\r\n\r\n finalSetup(): void {\r\n // No final setup needed\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new EnvironmentFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Environments AppObject from\r\n * @returns A new EnvironmentFeatureFactory instance\r\n */\r\nexport function makeEnvironmentFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n): EnvironmentFeatureFactory {\r\n return new EnvironmentFeatureFactory(appObjects.getOrCreate(\"Environments\"));\r\n}\r\n"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const StateMachine_1 = require("../../StateMachine");
5
+ const EnvironmentFeatureFactory_1 = require("./EnvironmentFeatureFactory");
6
+ const setupEnvironments_1 = require("./setupEnvironments");
7
+ function makeTestRig() {
8
+ const appObjects = (0, core_1.makeAppObjectRepo)();
9
+ const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
10
+ const mockError = jest.fn();
11
+ appObjects.submitError = mockError;
12
+ return { appObjects, factories, mockError };
13
+ }
14
+ function componentTypes(appObjects) {
15
+ const types = {};
16
+ appObjects.getAll().forEach((ao) => {
17
+ types[ao.id] = ao
18
+ .allComponents()
19
+ .filter((c) => !(c instanceof core_1.DomainFactory))
20
+ .map((c) => c.type)
21
+ .sort();
22
+ });
23
+ return types;
24
+ }
25
+ describe("EnvironmentFeatureFactory", () => {
26
+ it("Builds the same components as setupEnvironments", () => {
27
+ const legacy = makeTestRig();
28
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(legacy.appObjects);
29
+ legacy.factories.setupDomain();
30
+ (0, setupEnvironments_1.setupEnvironments)(legacy.appObjects);
31
+ const { appObjects, factories, mockError } = makeTestRig();
32
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
33
+ (0, EnvironmentFeatureFactory_1.makeEnvironmentFeatureFactory)(appObjects);
34
+ factories.setupDomain();
35
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
36
+ expect(mockError).not.toHaveBeenCalled();
37
+ });
38
+ });
39
+ //# sourceMappingURL=EnvironmentFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/EnvironmentFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,qDAAoE;AACpE,2EAA4E;AAC5E,2DAAwD;AAExD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5B,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,cAAc,CAAC,UAAyB;IAC/C,MAAM,KAAK,GAA+B,EAAE,CAAC;IAC7C,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE;aACd,aAAa,EAAE;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,oBAAa,CAAC,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;aAClB,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAC7B,IAAA,6CAA8B,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAA,qCAAiB,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAErC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAC3D,IAAA,6CAA8B,EAAC,UAAU,CAAC,CAAC;QAC3C,IAAA,yDAA6B,EAAC,UAAU,CAAC,CAAC;QAC1C,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CACxC,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAClC,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeEnvironmentFeatureFactory } from \"./EnvironmentFeatureFactory\";\r\nimport { setupEnvironments } from \"./setupEnvironments\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\ndescribe(\"EnvironmentFeatureFactory\", () => {\r\n it(\"Builds the same components as setupEnvironments\", () => {\r\n const legacy = makeTestRig();\r\n makeStateMachineFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupEnvironments(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n makeStateMachineFeatureFactory(appObjects);\r\n makeEnvironmentFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n});\r\n"]}
@@ -14,5 +14,6 @@ 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
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./setupEnvironmnets"), exports);
17
+ __exportStar(require("./setupEnvironments"), exports);
18
+ __exportStar(require("./EnvironmentFeatureFactory"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC","sourcesContent":["export * from \"./setupEnvironmnets\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,8DAA4C","sourcesContent":["export * from \"./setupEnvironments\";\r\nexport * from \"./EnvironmentFeatureFactory\";\r\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupEnvironments = setupEnvironments;
4
+ const Environment_1 = require("../Entities/Environment");
5
+ const EnvironmentalIntensityPM_1 = require("../PMs/EnvironmentalIntensityPM");
6
+ const TexturalEnvironmentPM_1 = require("../PMs/TexturalEnvironmentPM");
7
+ const SerializeEnvironment_1 = require("../UCs/SerializeEnvironment");
8
+ const SetEnvironmentIntensityUC_1 = require("../UCs/SetEnvironmentIntensityUC");
9
+ const SetTexturalEnvironmentUC_1 = require("../UCs/SetTexturalEnvironmentUC");
10
+ function setupEnvironments(appObjects) {
11
+ const ao = appObjects.getOrCreate("Environments");
12
+ (0, Environment_1.makeEnvironmentEntity)(ao);
13
+ (0, SetTexturalEnvironmentUC_1.makeSetTexturalEnvironmentUC)(ao);
14
+ new SerializeEnvironment_1.SerializeEnvironment(ao);
15
+ (0, SetEnvironmentIntensityUC_1.makeSetEnvironmentIntensityUC)(ao);
16
+ (0, TexturalEnvironmentPM_1.makeTexturalEnvironmentPM)(ao);
17
+ (0, EnvironmentalIntensityPM_1.makeEnvironmentalIntensityPM)(ao);
18
+ }
19
+ //# sourceMappingURL=setupEnvironments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupEnvironments.js","sourceRoot":"","sources":["../../../../src/Environment/Factories/setupEnvironments.ts"],"names":[],"mappings":";;AAQA,8CAWC;AAlBD,yDAAgE;AAChE,8EAA+E;AAC/E,wEAAyE;AACzE,sEAAmE;AACnE,gFAAiF;AACjF,8EAA+E;AAE/E,SAAgB,iBAAiB,CAAC,UAAyB;IACzD,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAElD,IAAA,mCAAqB,EAAC,EAAE,CAAC,CAAC;IAE1B,IAAA,uDAA4B,EAAC,EAAE,CAAC,CAAC;IACjC,IAAI,2CAAoB,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAA,yDAA6B,EAAC,EAAE,CAAC,CAAC;IAElC,IAAA,iDAAyB,EAAC,EAAE,CAAC,CAAC;IAC9B,IAAA,uDAA4B,EAAC,EAAE,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport { makeEnvironmentEntity } from \"../Entities/Environment\";\r\nimport { makeEnvironmentalIntensityPM } from \"../PMs/EnvironmentalIntensityPM\";\r\nimport { makeTexturalEnvironmentPM } from \"../PMs/TexturalEnvironmentPM\";\r\nimport { SerializeEnvironment } from \"../UCs/SerializeEnvironment\";\r\nimport { makeSetEnvironmentIntensityUC } from \"../UCs/SetEnvironmentIntensityUC\";\r\nimport { makeSetTexturalEnvironmentUC } from \"../UCs/SetTexturalEnvironmentUC\";\r\n\r\nexport function setupEnvironments(appObjects: AppObjectRepo) {\r\n const ao = appObjects.getOrCreate(\"Environments\");\r\n\r\n makeEnvironmentEntity(ao);\r\n\r\n makeSetTexturalEnvironmentUC(ao);\r\n new SerializeEnvironment(ao);\r\n makeSetEnvironmentIntensityUC(ao);\r\n\r\n makeTexturalEnvironmentPM(ao);\r\n makeEnvironmentalIntensityPM(ao);\r\n}\r\n"]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HideableFeatureFactory = void 0;
4
+ exports.makeHideableFeatureFactory = makeHideableFeatureFactory;
5
+ const core_1 = require("@vived/core");
6
+ const Tools_1 = require("../../Tools");
7
+ const Controllers_1 = require("../Controllers");
8
+ const UCs_1 = require("../UCs");
9
+ /**
10
+ * Factory responsible for setting up the Hideable Feature domain components.
11
+ *
12
+ * Builds the same components as the legacy setupHideable function, split into
13
+ * the DomainFactory phases. The HIDE tool is created in finalSetup, so its
14
+ * place in the toolbar follows the order the factories are registered.
15
+ *
16
+ * @extends DomainFactory
17
+ */
18
+ class HideableFeatureFactory extends core_1.DomainFactory {
19
+ /**
20
+ * @param appObject The Hideable AppObject
21
+ * @param options Optional configuration, as for setupHideable
22
+ */
23
+ constructor(appObject, options) {
24
+ super(appObject);
25
+ this.factoryName = "HideableFeatureFactory";
26
+ this.options = options;
27
+ }
28
+ setupEntities() {
29
+ // No entities for this feature
30
+ }
31
+ setupUCs() {
32
+ (0, UCs_1.makeTryHideWithPickUC)(this.appObject);
33
+ if (this.options?.skipSerializer !== true) {
34
+ (0, UCs_1.makeSerializeHideableObjects)(this.appObject);
35
+ }
36
+ }
37
+ setupPMs() {
38
+ // No PMs for this feature
39
+ }
40
+ finalSetup() {
41
+ new Controllers_1.HideMC(this.appObject);
42
+ new Controllers_1.HideTC(this.appObject);
43
+ if (this.options?.skipSetupTool === true)
44
+ return;
45
+ const toolRepo = Tools_1.ToolRepository.get(this.appObjects);
46
+ if (!toolRepo) {
47
+ this.appObjects.submitWarning(this.factoryName, "Unable to find tool repo");
48
+ return;
49
+ }
50
+ toolRepo.makeToolFromData({
51
+ toolType: "HIDE",
52
+ isDefault: false,
53
+ label: "Hide",
54
+ shortcutLabel: "h",
55
+ hotkeys: [{ keyCode: "KeyH" }],
56
+ });
57
+ }
58
+ }
59
+ exports.HideableFeatureFactory = HideableFeatureFactory;
60
+ /**
61
+ * Factory function to create a new HideableFeatureFactory
62
+ * @param appObjects The AppObjectRepo to get or create the Hideable AppObject from
63
+ * @param options Optional configuration, as for setupHideable
64
+ * @returns A new HideableFeatureFactory instance
65
+ */
66
+ function makeHideableFeatureFactory(appObjects, options) {
67
+ return new HideableFeatureFactory(appObjects.getOrCreate("Hideable"), options);
68
+ }
69
+ //# sourceMappingURL=HideableFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HideableFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/HideableFeatureFactory.ts"],"names":[],"mappings":";;;AA4EA,gEAQC;AApFD,sCAAsE;AACtE,uCAA6C;AAC7C,gDAAgD;AAChD,gCAA6E;AAG7E;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,oBAAa;IAKvD;;;OAGG;IACH,YAAY,SAAoB,EAAE,OAA8B;QAC9D,KAAK,CAAC,SAAS,CAAC,CAAC;QATnB,gBAAW,GAAG,wBAAwB,CAAC;QAUrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,aAAa;QACX,+BAA+B;IACjC,CAAC;IAED,QAAQ;QACN,IAAA,2BAAqB,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,EAAE,CAAC;YAC1C,IAAA,kCAA4B,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,QAAQ;QACN,0BAA0B;IAC5B,CAAC;IAED,UAAU;QACR,IAAI,oBAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,oBAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE3B,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;YAAE,OAAO;QAEjD,MAAM,QAAQ,GAAG,sBAAc,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,aAAa,CAC3B,IAAI,CAAC,WAAW,EAChB,0BAA0B,CAC3B,CAAC;YACF,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC;YACxB,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,MAAM;YACb,aAAa,EAAE,GAAG;YAClB,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AArDD,wDAqDC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,UAAyB,EACzB,OAA8B;IAE9B,OAAO,IAAI,sBAAsB,CAC/B,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,EAClC,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { AppObject, AppObjectRepo, DomainFactory } from \"@vived/core\";\r\nimport { ToolRepository } from \"../../Tools\";\r\nimport { HideMC, HideTC } from \"../Controllers\";\r\nimport { makeSerializeHideableObjects, makeTryHideWithPickUC } from \"../UCs\";\r\nimport { SetupHideableOptions } from \"./setupHideable\";\r\n\r\n/**\r\n * Factory responsible for setting up the Hideable Feature domain components.\r\n *\r\n * Builds the same components as the legacy setupHideable function, split into\r\n * the DomainFactory phases. The HIDE tool is created in finalSetup, so its\r\n * place in the toolbar follows the order the factories are registered.\r\n *\r\n * @extends DomainFactory\r\n */\r\nexport class HideableFeatureFactory extends DomainFactory {\r\n factoryName = \"HideableFeatureFactory\";\r\n\r\n private options?: SetupHideableOptions;\r\n\r\n /**\r\n * @param appObject The Hideable AppObject\r\n * @param options Optional configuration, as for setupHideable\r\n */\r\n constructor(appObject: AppObject, options?: SetupHideableOptions) {\r\n super(appObject);\r\n this.options = options;\r\n }\r\n\r\n setupEntities(): void {\r\n // No entities for this feature\r\n }\r\n\r\n setupUCs(): void {\r\n makeTryHideWithPickUC(this.appObject);\r\n\r\n if (this.options?.skipSerializer !== true) {\r\n makeSerializeHideableObjects(this.appObject);\r\n }\r\n }\r\n\r\n setupPMs(): void {\r\n // No PMs for this feature\r\n }\r\n\r\n finalSetup(): void {\r\n new HideMC(this.appObject);\r\n new HideTC(this.appObject);\r\n\r\n if (this.options?.skipSetupTool === true) return;\r\n\r\n const toolRepo = ToolRepository.get(this.appObjects);\r\n if (!toolRepo) {\r\n this.appObjects.submitWarning(\r\n this.factoryName,\r\n \"Unable to find tool repo\",\r\n );\r\n return;\r\n }\r\n\r\n toolRepo.makeToolFromData({\r\n toolType: \"HIDE\",\r\n isDefault: false,\r\n label: \"Hide\",\r\n shortcutLabel: \"h\",\r\n hotkeys: [{ keyCode: \"KeyH\" }],\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new HideableFeatureFactory\r\n * @param appObjects The AppObjectRepo to get or create the Hideable AppObject from\r\n * @param options Optional configuration, as for setupHideable\r\n * @returns A new HideableFeatureFactory instance\r\n */\r\nexport function makeHideableFeatureFactory(\r\n appObjects: AppObjectRepo,\r\n options?: SetupHideableOptions,\r\n): HideableFeatureFactory {\r\n return new HideableFeatureFactory(\r\n appObjects.getOrCreate(\"Hideable\"),\r\n options,\r\n );\r\n}\r\n"]}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@vived/core");
4
+ const Callouts_1 = require("../../Callouts");
5
+ const KeyboardInput_1 = require("../../KeyboardInput");
6
+ const MouseInput_1 = require("../../MouseInput");
7
+ const StateMachine_1 = require("../../StateMachine");
8
+ const Tools_1 = require("../../Tools");
9
+ const TouchController_1 = require("../../TouchController");
10
+ const UCs_1 = require("../UCs");
11
+ const HideableFeatureFactory_1 = require("./HideableFeatureFactory");
12
+ const setupHideable_1 = require("./setupHideable");
13
+ function makeTestRig() {
14
+ const appObjects = (0, core_1.makeAppObjectRepo)();
15
+ const factories = (0, core_1.makeDomainFactoryRepo)(appObjects);
16
+ const mockError = jest.fn();
17
+ appObjects.submitError = mockError;
18
+ return { appObjects, factories, mockError };
19
+ }
20
+ function registerCollaborators(appObjects) {
21
+ (0, KeyboardInput_1.makeKeyboardInputFeatureFactory)(appObjects);
22
+ (0, MouseInput_1.makeMouseInputFeatureFactory)(appObjects);
23
+ (0, TouchController_1.makeTouchControllerFeatureFactory)(appObjects);
24
+ (0, StateMachine_1.makeStateMachineFeatureFactory)(appObjects);
25
+ }
26
+ function componentTypes(appObjects) {
27
+ const types = {};
28
+ appObjects.getAll().forEach((ao) => {
29
+ types[ao.id] = ao
30
+ .allComponents()
31
+ .filter((c) => !(c instanceof core_1.DomainFactory))
32
+ .map((c) => c.type)
33
+ .sort();
34
+ });
35
+ return types;
36
+ }
37
+ function toolTypes(appObjects) {
38
+ return Tools_1.ToolRepository.get(appObjects).allTools.map((t) => t.toolType);
39
+ }
40
+ describe("HideableFeatureFactory", () => {
41
+ it("Builds the same components as setupHideable", () => {
42
+ const legacy = makeTestRig();
43
+ registerCollaborators(legacy.appObjects);
44
+ (0, Tools_1.makeToolsFeatureFactory)(legacy.appObjects);
45
+ legacy.factories.setupDomain();
46
+ (0, setupHideable_1.setupHideable)(legacy.appObjects);
47
+ const { appObjects, factories, mockError } = makeTestRig();
48
+ registerCollaborators(appObjects);
49
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
50
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
51
+ factories.setupDomain();
52
+ expect(componentTypes(appObjects)).toEqual(componentTypes(legacy.appObjects));
53
+ expect(mockError).not.toHaveBeenCalled();
54
+ });
55
+ it("Builds the serializer in setupUCs", () => {
56
+ const { appObjects, factories } = makeTestRig();
57
+ registerCollaborators(appObjects);
58
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
59
+ const all = factories.getAll();
60
+ all.forEach((f) => f.setupEntities());
61
+ all.forEach((f) => f.setupUCs());
62
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(true);
63
+ });
64
+ it("Creates the HIDE tool in finalSetup", () => {
65
+ const { appObjects, factories } = makeTestRig();
66
+ registerCollaborators(appObjects);
67
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
68
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects);
69
+ const all = factories.getAll();
70
+ all.forEach((f) => f.setupEntities());
71
+ all.forEach((f) => f.setupUCs());
72
+ all.forEach((f) => f.setupPMs());
73
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
74
+ all.forEach((f) => f.finalSetup());
75
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
76
+ });
77
+ it("Creates tools in factory registration order", () => {
78
+ const first = makeTestRig();
79
+ registerCollaborators(first.appObjects);
80
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(first.appObjects);
81
+ (0, Callouts_1.makeCalloutsFeatureFactory)(first.appObjects);
82
+ (0, Tools_1.makeToolsFeatureFactory)(first.appObjects);
83
+ first.factories.setupDomain();
84
+ const second = makeTestRig();
85
+ registerCollaborators(second.appObjects);
86
+ (0, Callouts_1.makeCalloutsFeatureFactory)(second.appObjects);
87
+ (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(second.appObjects);
88
+ (0, Tools_1.makeToolsFeatureFactory)(second.appObjects);
89
+ second.factories.setupDomain();
90
+ expect(toolTypes(first.appObjects)).toEqual(["HIDE", "CALLOUT"]);
91
+ expect(toolTypes(second.appObjects)).toEqual(["CALLOUT", "HIDE"]);
92
+ });
93
+ it("Skips the serializer when skipSerializer is set", () => {
94
+ const { appObjects, factories } = makeTestRig();
95
+ registerCollaborators(appObjects);
96
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
97
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects, {
98
+ skipSerializer: true,
99
+ });
100
+ factories.setupDomain();
101
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(false);
102
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeDefined();
103
+ });
104
+ it("Skips the tool when skipSetupTool is set", () => {
105
+ const { appObjects, factories } = makeTestRig();
106
+ registerCollaborators(appObjects);
107
+ (0, Tools_1.makeToolsFeatureFactory)(appObjects);
108
+ const factory = (0, HideableFeatureFactory_1.makeHideableFeatureFactory)(appObjects, {
109
+ skipSetupTool: true,
110
+ });
111
+ factories.setupDomain();
112
+ expect(factory.appObject.hasComponent(UCs_1.SerializeHideableObjects.type)).toBe(true);
113
+ expect(Tools_1.ToolRepository.get(appObjects).getTool("HIDE")).toBeUndefined();
114
+ });
115
+ });
116
+ //# sourceMappingURL=HideableFeatureFactory.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HideableFeatureFactory.test.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/HideableFeatureFactory.test.ts"],"names":[],"mappings":";;AAAA,sCAKqB;AACrB,6CAA4D;AAC5D,uDAAsE;AACtE,iDAAgE;AAChE,qDAAoE;AACpE,uCAAsE;AACtE,2DAA0E;AAC1E,gCAAkD;AAClD,qEAAsE;AACtE,mDAAgD;AAEhD,SAAS,WAAW;IAClB,MAAM,UAAU,GAAG,IAAA,wBAAiB,GAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAA,4BAAqB,EAAC,UAAU,CAAC,CAAC;IA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AAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CAAC;QAChD,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAClC,IAAA,+BAAuB,EAAC,UAAU,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,IAAA,mDAA0B,EAAC,UAAU,EAAE;YACrD,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,EAAE,CAAC;QAExB,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,8BAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACxE,IAAI,CACL,CAAC;QACF,MAAM,CAAC,sBAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\r\n AppObjectRepo,\r\n DomainFactory,\r\n makeAppObjectRepo,\r\n makeDomainFactoryRepo,\r\n} from \"@vived/core\";\r\nimport { makeCalloutsFeatureFactory } from \"../../Callouts\";\r\nimport { makeKeyboardInputFeatureFactory } from \"../../KeyboardInput\";\r\nimport { makeMouseInputFeatureFactory } from \"../../MouseInput\";\r\nimport { makeStateMachineFeatureFactory } from \"../../StateMachine\";\r\nimport { makeToolsFeatureFactory, ToolRepository } from \"../../Tools\";\r\nimport { makeTouchControllerFeatureFactory } from \"../../TouchController\";\r\nimport { SerializeHideableObjects } from \"../UCs\";\r\nimport { makeHideableFeatureFactory } from \"./HideableFeatureFactory\";\r\nimport { setupHideable } from \"./setupHideable\";\r\n\r\nfunction makeTestRig() {\r\n const appObjects = makeAppObjectRepo();\r\n const factories = makeDomainFactoryRepo(appObjects);\r\n\r\n const mockError = jest.fn();\r\n appObjects.submitError = mockError;\r\n\r\n return { appObjects, factories, mockError };\r\n}\r\n\r\nfunction registerCollaborators(appObjects: AppObjectRepo) {\r\n makeKeyboardInputFeatureFactory(appObjects);\r\n makeMouseInputFeatureFactory(appObjects);\r\n makeTouchControllerFeatureFactory(appObjects);\r\n makeStateMachineFeatureFactory(appObjects);\r\n}\r\n\r\nfunction componentTypes(appObjects: AppObjectRepo) {\r\n const types: { [id: string]: string[] } = {};\r\n appObjects.getAll().forEach((ao) => {\r\n types[ao.id] = ao\r\n .allComponents()\r\n .filter((c) => !(c instanceof DomainFactory))\r\n .map((c) => c.type)\r\n .sort();\r\n });\r\n return types;\r\n}\r\n\r\nfunction toolTypes(appObjects: AppObjectRepo) {\r\n return ToolRepository.get(appObjects)!.allTools.map((t) => t.toolType);\r\n}\r\n\r\ndescribe(\"HideableFeatureFactory\", () => {\r\n it(\"Builds the same components as setupHideable\", () => {\r\n const legacy = makeTestRig();\r\n registerCollaborators(legacy.appObjects);\r\n makeToolsFeatureFactory(legacy.appObjects);\r\n legacy.factories.setupDomain();\r\n setupHideable(legacy.appObjects);\r\n\r\n const { appObjects, factories, mockError } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeHideableFeatureFactory(appObjects);\r\n factories.setupDomain();\r\n\r\n expect(componentTypes(appObjects)).toEqual(\r\n componentTypes(legacy.appObjects),\r\n );\r\n expect(mockError).not.toHaveBeenCalled();\r\n });\r\n\r\n it(\"Builds the serializer in setupUCs\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n const factory = makeHideableFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n\r\n expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n true,\r\n );\r\n });\r\n\r\n it(\"Creates the HIDE tool in finalSetup\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n makeHideableFeatureFactory(appObjects);\r\n\r\n const all = factories.getAll();\r\n all.forEach((f) => f.setupEntities());\r\n all.forEach((f) => f.setupUCs());\r\n all.forEach((f) => f.setupPMs());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeUndefined();\r\n\r\n all.forEach((f) => f.finalSetup());\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeDefined();\r\n });\r\n\r\n it(\"Creates tools in factory registration order\", () => {\r\n const first = makeTestRig();\r\n registerCollaborators(first.appObjects);\r\n makeHideableFeatureFactory(first.appObjects);\r\n makeCalloutsFeatureFactory(first.appObjects);\r\n makeToolsFeatureFactory(first.appObjects);\r\n first.factories.setupDomain();\r\n\r\n const second = makeTestRig();\r\n registerCollaborators(second.appObjects);\r\n makeCalloutsFeatureFactory(second.appObjects);\r\n makeHideableFeatureFactory(second.appObjects);\r\n makeToolsFeatureFactory(second.appObjects);\r\n second.factories.setupDomain();\r\n\r\n expect(toolTypes(first.appObjects)).toEqual([\"HIDE\", \"CALLOUT\"]);\r\n expect(toolTypes(second.appObjects)).toEqual([\"CALLOUT\", \"HIDE\"]);\r\n });\r\n\r\n it(\"Skips the serializer when skipSerializer is set\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n const factory = makeHideableFeatureFactory(appObjects, {\r\n skipSerializer: true,\r\n });\r\n factories.setupDomain();\r\n\r\n expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n false,\r\n );\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeDefined();\r\n });\r\n\r\n it(\"Skips the tool when skipSetupTool is set\", () => {\r\n const { appObjects, factories } = makeTestRig();\r\n registerCollaborators(appObjects);\r\n makeToolsFeatureFactory(appObjects);\r\n const factory = makeHideableFeatureFactory(appObjects, {\r\n skipSetupTool: true,\r\n });\r\n factories.setupDomain();\r\n\r\n expect(factory.appObject.hasComponent(SerializeHideableObjects.type)).toBe(\r\n true,\r\n );\r\n expect(ToolRepository.get(appObjects)!.getTool(\"HIDE\")).toBeUndefined();\r\n });\r\n});\r\n"]}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./setupHideable"), exports);
18
+ __exportStar(require("./HideableFeatureFactory"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC","sourcesContent":["export * from \"./setupHideable\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Hideable/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2DAAyC","sourcesContent":["export * from \"./setupHideable\";\r\nexport * from \"./HideableFeatureFactory\";\r\n"]}