@vived/core 1.5.1 → 2.0.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 (166) hide show
  1. package/README.md +1 -48
  2. package/dist/cjs/AppObject/AppObjectComponent.js +8 -10
  3. package/dist/cjs/AppObject/AppObjectComponent.js.map +1 -1
  4. package/dist/cjs/AppObject/AppObjectEntityRepo.js +99 -11
  5. package/dist/cjs/AppObject/AppObjectEntityRepo.js.map +1 -1
  6. package/dist/cjs/AppObject/AppObjectPM.js +106 -6
  7. package/dist/cjs/AppObject/AppObjectPM.js.map +1 -1
  8. package/dist/cjs/AppObject/AppObjectRepo.js +11 -1
  9. package/dist/cjs/AppObject/AppObjectRepo.js.map +1 -1
  10. package/dist/cjs/AppObject/AppObjectSingletonEntity.js +40 -0
  11. package/dist/cjs/AppObject/AppObjectSingletonEntity.js.map +1 -0
  12. package/dist/cjs/AppObject/AppObjectSingletonEntityRepo.js +54 -0
  13. package/dist/cjs/AppObject/AppObjectSingletonEntityRepo.js.map +1 -0
  14. package/dist/cjs/AppObject/AppObjectSingletonPM.js +69 -0
  15. package/dist/cjs/AppObject/AppObjectSingletonPM.js.map +1 -0
  16. package/dist/cjs/AppObject/AppObjectSingletonUC.js +60 -0
  17. package/dist/cjs/AppObject/AppObjectSingletonUC.js.map +1 -0
  18. package/dist/cjs/AppObject/index.js +4 -0
  19. package/dist/cjs/AppObject/index.js.map +1 -1
  20. package/dist/cjs/DomainFactories/Entities/DomainFactoryRepo.js +5 -0
  21. package/dist/cjs/DomainFactories/Entities/DomainFactoryRepo.js.map +1 -1
  22. package/dist/cjs/Entities/ObserverList.js +6 -0
  23. package/dist/cjs/Entities/ObserverList.js.map +1 -1
  24. package/dist/cjs/ExampleFeature/Entities/ExampleRepo.js +11 -22
  25. package/dist/cjs/ExampleFeature/Entities/ExampleRepo.js.map +1 -1
  26. package/dist/cjs/ExampleFeature/Entities/ExampleSingletonEntity.js +1 -3
  27. package/dist/cjs/ExampleFeature/Entities/ExampleSingletonEntity.js.map +1 -1
  28. package/dist/cjs/ExampleFeature/Factory/ExampleFeatureFactory.js +65 -0
  29. package/dist/cjs/ExampleFeature/Factory/ExampleFeatureFactory.js.map +1 -0
  30. package/dist/cjs/ExampleFeature/PMs/ExamplePM.js +5 -13
  31. package/dist/cjs/ExampleFeature/PMs/ExamplePM.js.map +1 -1
  32. package/dist/cjs/ExampleFeature/PMs/ExampleSingletonPM.js +8 -12
  33. package/dist/cjs/ExampleFeature/PMs/ExampleSingletonPM.js.map +1 -1
  34. package/dist/cjs/ExampleFeature/UCs/EditExampleStringUC.js +0 -4
  35. package/dist/cjs/ExampleFeature/UCs/EditExampleStringUC.js.map +1 -1
  36. package/dist/cjs/ExampleFeature/UCs/ToggleExampleBooleanUC.js +2 -8
  37. package/dist/cjs/ExampleFeature/UCs/ToggleExampleBooleanUC.js.map +1 -1
  38. package/dist/cjs/index.js +0 -1
  39. package/dist/cjs/index.js.map +1 -1
  40. package/dist/esm/AppObject/AppObjectComponent.js +8 -10
  41. package/dist/esm/AppObject/AppObjectComponent.js.map +1 -1
  42. package/dist/esm/AppObject/AppObjectEntityRepo.js +99 -11
  43. package/dist/esm/AppObject/AppObjectEntityRepo.js.map +1 -1
  44. package/dist/esm/AppObject/AppObjectPM.js +107 -7
  45. package/dist/esm/AppObject/AppObjectPM.js.map +1 -1
  46. package/dist/esm/AppObject/AppObjectRepo.js +11 -1
  47. package/dist/esm/AppObject/AppObjectRepo.js.map +1 -1
  48. package/dist/esm/AppObject/AppObjectSingletonEntity.js +36 -0
  49. package/dist/esm/AppObject/AppObjectSingletonEntity.js.map +1 -0
  50. package/dist/esm/AppObject/AppObjectSingletonEntityRepo.js +50 -0
  51. package/dist/esm/AppObject/AppObjectSingletonEntityRepo.js.map +1 -0
  52. package/dist/esm/AppObject/AppObjectSingletonPM.js +65 -0
  53. package/dist/esm/AppObject/AppObjectSingletonPM.js.map +1 -0
  54. package/dist/esm/AppObject/AppObjectSingletonUC.js +56 -0
  55. package/dist/esm/AppObject/AppObjectSingletonUC.js.map +1 -0
  56. package/dist/esm/AppObject/index.js +4 -0
  57. package/dist/esm/AppObject/index.js.map +1 -1
  58. package/dist/esm/DomainFactories/Entities/DomainFactoryRepo.js +4 -0
  59. package/dist/esm/DomainFactories/Entities/DomainFactoryRepo.js.map +1 -1
  60. package/dist/esm/Entities/ObserverList.js +6 -0
  61. package/dist/esm/Entities/ObserverList.js.map +1 -1
  62. package/dist/esm/ExampleFeature/Entities/ExampleRepo.js +11 -22
  63. package/dist/esm/ExampleFeature/Entities/ExampleRepo.js.map +1 -1
  64. package/dist/esm/ExampleFeature/Entities/ExampleSingletonEntity.js +2 -4
  65. package/dist/esm/ExampleFeature/Entities/ExampleSingletonEntity.js.map +1 -1
  66. package/dist/esm/ExampleFeature/Factory/ExampleFeatureFactory.js +60 -0
  67. package/dist/esm/ExampleFeature/Factory/ExampleFeatureFactory.js.map +1 -0
  68. package/dist/esm/ExampleFeature/PMs/ExamplePM.js +5 -13
  69. package/dist/esm/ExampleFeature/PMs/ExamplePM.js.map +1 -1
  70. package/dist/esm/ExampleFeature/PMs/ExampleSingletonPM.js +9 -13
  71. package/dist/esm/ExampleFeature/PMs/ExampleSingletonPM.js.map +1 -1
  72. package/dist/esm/ExampleFeature/UCs/EditExampleStringUC.js +0 -4
  73. package/dist/esm/ExampleFeature/UCs/EditExampleStringUC.js.map +1 -1
  74. package/dist/esm/ExampleFeature/UCs/ToggleExampleBooleanUC.js +3 -9
  75. package/dist/esm/ExampleFeature/UCs/ToggleExampleBooleanUC.js.map +1 -1
  76. package/dist/esm/index.js +0 -1
  77. package/dist/esm/index.js.map +1 -1
  78. package/dist/types/AppObject/AppObjectComponent.d.ts +6 -4
  79. package/dist/types/AppObject/AppObjectComponent.d.ts.map +1 -1
  80. package/dist/types/AppObject/AppObjectEntityRepo.d.ts +72 -7
  81. package/dist/types/AppObject/AppObjectEntityRepo.d.ts.map +1 -1
  82. package/dist/types/AppObject/AppObjectPM.d.ts +82 -2
  83. package/dist/types/AppObject/AppObjectPM.d.ts.map +1 -1
  84. package/dist/types/AppObject/AppObjectRepo.d.ts +13 -0
  85. package/dist/types/AppObject/AppObjectRepo.d.ts.map +1 -1
  86. package/dist/types/AppObject/AppObjectSingletonEntity.d.ts +31 -0
  87. package/dist/types/AppObject/AppObjectSingletonEntity.d.ts.map +1 -0
  88. package/dist/types/AppObject/AppObjectSingletonEntityRepo.d.ts +46 -0
  89. package/dist/types/AppObject/AppObjectSingletonEntityRepo.d.ts.map +1 -0
  90. package/dist/types/AppObject/AppObjectSingletonPM.d.ts +60 -0
  91. package/dist/types/AppObject/AppObjectSingletonPM.d.ts.map +1 -0
  92. package/dist/types/AppObject/AppObjectSingletonUC.d.ts +51 -0
  93. package/dist/types/AppObject/AppObjectSingletonUC.d.ts.map +1 -0
  94. package/dist/types/AppObject/index.d.ts +4 -0
  95. package/dist/types/AppObject/index.d.ts.map +1 -1
  96. package/dist/types/DomainFactories/Entities/DomainFactoryRepo.d.ts +1 -0
  97. package/dist/types/DomainFactories/Entities/DomainFactoryRepo.d.ts.map +1 -1
  98. package/dist/types/Entities/ObserverList.d.ts +4 -0
  99. package/dist/types/Entities/ObserverList.d.ts.map +1 -1
  100. package/dist/types/ExampleFeature/Entities/ExampleRepo.d.ts +0 -4
  101. package/dist/types/ExampleFeature/Entities/ExampleRepo.d.ts.map +1 -1
  102. package/dist/types/ExampleFeature/Entities/ExampleSingletonEntity.d.ts +2 -2
  103. package/dist/types/ExampleFeature/Entities/ExampleSingletonEntity.d.ts.map +1 -1
  104. package/dist/types/ExampleFeature/Factory/ExampleFeatureFactory.d.ts +44 -0
  105. package/dist/types/ExampleFeature/Factory/ExampleFeatureFactory.d.ts.map +1 -0
  106. package/dist/types/ExampleFeature/PMs/ExampleSingletonPM.d.ts +4 -4
  107. package/dist/types/ExampleFeature/PMs/ExampleSingletonPM.d.ts.map +1 -1
  108. package/dist/types/ExampleFeature/UCs/ToggleExampleBooleanUC.d.ts +2 -2
  109. package/dist/types/ExampleFeature/UCs/ToggleExampleBooleanUC.d.ts.map +1 -1
  110. package/dist/types/index.d.ts +0 -1
  111. package/dist/types/index.d.ts.map +1 -1
  112. package/package.json +2 -2
  113. package/dist/cjs/ExampleFeature/Adapters/index.js +0 -19
  114. package/dist/cjs/ExampleFeature/Adapters/index.js.map +0 -1
  115. package/dist/cjs/ExampleFeature/Controllers/index.js +0 -19
  116. package/dist/cjs/ExampleFeature/Controllers/index.js.map +0 -1
  117. package/dist/cjs/ExampleFeature/Entities/index.js +0 -20
  118. package/dist/cjs/ExampleFeature/Entities/index.js.map +0 -1
  119. package/dist/cjs/ExampleFeature/Factory/index.js +0 -18
  120. package/dist/cjs/ExampleFeature/Factory/index.js.map +0 -1
  121. package/dist/cjs/ExampleFeature/Factory/setupExampleFeature.js +0 -29
  122. package/dist/cjs/ExampleFeature/Factory/setupExampleFeature.js.map +0 -1
  123. package/dist/cjs/ExampleFeature/Mocks/index.js +0 -21
  124. package/dist/cjs/ExampleFeature/Mocks/index.js.map +0 -1
  125. package/dist/cjs/ExampleFeature/PMs/index.js +0 -19
  126. package/dist/cjs/ExampleFeature/PMs/index.js.map +0 -1
  127. package/dist/cjs/ExampleFeature/UCs/index.js +0 -19
  128. package/dist/cjs/ExampleFeature/UCs/index.js.map +0 -1
  129. package/dist/cjs/ExampleFeature/index.js +0 -24
  130. package/dist/cjs/ExampleFeature/index.js.map +0 -1
  131. package/dist/esm/ExampleFeature/Adapters/index.js +0 -3
  132. package/dist/esm/ExampleFeature/Adapters/index.js.map +0 -1
  133. package/dist/esm/ExampleFeature/Controllers/index.js +0 -3
  134. package/dist/esm/ExampleFeature/Controllers/index.js.map +0 -1
  135. package/dist/esm/ExampleFeature/Entities/index.js +0 -4
  136. package/dist/esm/ExampleFeature/Entities/index.js.map +0 -1
  137. package/dist/esm/ExampleFeature/Factory/index.js +0 -2
  138. package/dist/esm/ExampleFeature/Factory/index.js.map +0 -1
  139. package/dist/esm/ExampleFeature/Factory/setupExampleFeature.js +0 -26
  140. package/dist/esm/ExampleFeature/Factory/setupExampleFeature.js.map +0 -1
  141. package/dist/esm/ExampleFeature/Mocks/index.js +0 -5
  142. package/dist/esm/ExampleFeature/Mocks/index.js.map +0 -1
  143. package/dist/esm/ExampleFeature/PMs/index.js +0 -3
  144. package/dist/esm/ExampleFeature/PMs/index.js.map +0 -1
  145. package/dist/esm/ExampleFeature/UCs/index.js +0 -3
  146. package/dist/esm/ExampleFeature/UCs/index.js.map +0 -1
  147. package/dist/esm/ExampleFeature/index.js +0 -8
  148. package/dist/esm/ExampleFeature/index.js.map +0 -1
  149. package/dist/types/ExampleFeature/Adapters/index.d.ts +0 -3
  150. package/dist/types/ExampleFeature/Adapters/index.d.ts.map +0 -1
  151. package/dist/types/ExampleFeature/Controllers/index.d.ts +0 -3
  152. package/dist/types/ExampleFeature/Controllers/index.d.ts.map +0 -1
  153. package/dist/types/ExampleFeature/Entities/index.d.ts +0 -4
  154. package/dist/types/ExampleFeature/Entities/index.d.ts.map +0 -1
  155. package/dist/types/ExampleFeature/Factory/index.d.ts +0 -2
  156. package/dist/types/ExampleFeature/Factory/index.d.ts.map +0 -1
  157. package/dist/types/ExampleFeature/Factory/setupExampleFeature.d.ts +0 -17
  158. package/dist/types/ExampleFeature/Factory/setupExampleFeature.d.ts.map +0 -1
  159. package/dist/types/ExampleFeature/Mocks/index.d.ts +0 -5
  160. package/dist/types/ExampleFeature/Mocks/index.d.ts.map +0 -1
  161. package/dist/types/ExampleFeature/PMs/index.d.ts +0 -3
  162. package/dist/types/ExampleFeature/PMs/index.d.ts.map +0 -1
  163. package/dist/types/ExampleFeature/UCs/index.d.ts +0 -3
  164. package/dist/types/ExampleFeature/UCs/index.d.ts.map +0 -1
  165. package/dist/types/ExampleFeature/index.d.ts +0 -8
  166. package/dist/types/ExampleFeature/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppObjectRepo.js","sourceRoot":"","sources":["../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AS,CAAC;QACnB,CAAC;aAAM,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,aAAa,CAChB,eAAe,EACf,YAAY,IAAI,+EAA+E,CAChG,CAAC;YACF,OAAO,UAAU,CAAC,CAAC,CAAM,CAAC;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ObservableEntity, ObserverList } from \"../Entities\";\r\nimport { AppObject, makeAppObject } from \"./AppObject\";\r\nimport { AppObjectComponent } from \"./AppObjectComponent\";\r\n\r\n/**\r\n * Abstract repository class for managing AppObjects and their components.\r\n *\r\n * This class provides the interface for storing, retrieving, and managing application\r\n * objects, their components, and singletons. It also includes logging functionality\r\n * and observer pattern implementation for tracking changes to the repository.\r\n *\r\n * @extends ObservableEntity\r\n */\r\nexport abstract class AppObjectRepo extends ObservableEntity {\r\n /**\r\n * Checks if an AppObject with the specified ID exists in the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to check\r\n * @returns {boolean} True if the AppObject exists, false otherwise\r\n */\r\n abstract has(appObjectID: string): boolean;\r\n\r\n /**\r\n * Adds an AppObject to the repository.\r\n *\r\n * @param {AppObject} appObject - The AppObject to add\r\n */\r\n abstract add(appObject: AppObject): void;\r\n\r\n /**\r\n * Removes an AppObject with the specified ID from the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to remove\r\n */\r\n abstract remove(appObjectID: string): void;\r\n\r\n /**\r\n * Gets an AppObject by its ID.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve\r\n * @returns {AppObject | undefined} The AppObject if found, undefined otherwise\r\n */\r\n abstract get(appObjectID: string): AppObject | undefined;\r\n\r\n /**\r\n * Gets an AppObject by its ID, or creates a new one if it doesn't exist.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve or create\r\n * @returns {AppObject} The existing or newly created AppObject\r\n */\r\n abstract getOrCreate(appObjectID: string): AppObject;\r\n\r\n /**\r\n * Gets all AppObjects in the repository.\r\n *\r\n * @returns {AppObject[]} An array of all AppObjects\r\n */\r\n abstract getAll(): AppObject[];\r\n\r\n /**\r\n * Logs an informational message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The message to log\r\n */\r\n abstract submitLog(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a warning message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The warning message to log\r\n */\r\n abstract submitWarning(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs an error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The error message to log\r\n */\r\n abstract submitError(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a fatal error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The fatal error message to log\r\n */\r\n abstract submitFatal(sender: string, message: string): void;\r\n\r\n /**\r\n * Registers a component as a singleton in the repository.\r\n *\r\n * @param {AppObjectComponent} component - The component to register as a singleton\r\n */\r\n abstract registerSingleton(component: AppObjectComponent): void;\r\n\r\n /**\r\n * Gets a singleton component of the specified type.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of the singleton to retrieve\r\n * @returns {T | undefined} The singleton component if found, undefined otherwise\r\n */\r\n abstract getSingleton<T extends AppObjectComponent>(\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets a component of the specified type from an AppObject.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} appObjectID - The ID of the AppObject containing the component\r\n * @param {string} type - The type of the component to retrieve\r\n * @returns {T | undefined} The component if found, undefined otherwise\r\n */\r\n abstract getAppObjectComponent<T extends AppObjectComponent>(\r\n appObjectID: string,\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets all AppObjects that have a component of the specified type.\r\n *\r\n * @param {string} componentType - The component type to filter by\r\n * @returns {AppObject[]} An array of AppObjects having the specified component type\r\n */\r\n abstract getAllAppObjectsWithComponent(componentType: string): AppObject[];\r\n\r\n /**\r\n * Gets all components of the specified type across all AppObjects.\r\n *\r\n * @template T - Type of the components to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of components to retrieve\r\n * @returns {T[]} An array of all components of the specified type\r\n */\r\n abstract getAllComponents<T extends AppObjectComponent>(type: string): T[];\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is added to the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject addition notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removeAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is removed from the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject removal notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removedAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n}\r\n\r\n/**\r\n * Creates and returns a new AppObjectRepo instance.\r\n *\r\n * @returns {AppObjectRepo} A new AppObjectRepo instance\r\n */\r\nexport function makeAppObjectRepo(): AppObjectRepo {\r\n return new AppObjectRepoImp();\r\n}\r\n\r\n/**\r\n * Implementation of the AppObjectRepo abstract class.\r\n *\r\n * @private\r\n * @extends AppObjectRepo\r\n */\r\nclass AppObjectRepoImp extends AppObjectRepo {\r\n private appObjectLookup = new Map<string, AppObject>();\r\n private singletons = new Map<string, AppObjectComponent>();\r\n\r\n private onAppObjectAddedObserver = new ObserverList<AppObject>();\r\n addAppObjectAddedObserver = (observer: (addedEntity: AppObject) => void) => {\r\n this.onAppObjectAddedObserver.add(observer);\r\n };\r\n removeAppObjectAddedObserver = (\r\n observer: (addedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectAddedObserver.remove(observer);\r\n };\r\n\r\n private onAppObjectRemovedObservers = new ObserverList<AppObject>();\r\n addAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ) => {\r\n this.onAppObjectRemovedObservers.add(observer);\r\n };\r\n removedAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectRemovedObservers.remove(observer);\r\n };\r\n\r\n has = (id: string): boolean => {\r\n return this.appObjectLookup.has(id);\r\n };\r\n\r\n add = (appObject: AppObject) => {\r\n const existing = this.appObjectLookup.get(appObject.id);\r\n if (existing) {\r\n existing.removeObserver(this.notify);\r\n }\r\n\r\n this.appObjectLookup.set(appObject.id, appObject);\r\n appObject.addObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectAddedObserver.notify(appObject);\r\n };\r\n\r\n remove = (id: string) => {\r\n const existing = this.appObjectLookup.get(id);\r\n if (!existing) return;\r\n\r\n this.appObjectLookup.delete(id);\r\n existing.removeObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectRemovedObservers.notify(existing);\r\n };\r\n\r\n get = (id: string): AppObject | undefined => {\r\n return this.appObjectLookup.get(id);\r\n };\r\n\r\n getOrCreate = (id: string): AppObject => {\r\n const existing = this.appObjectLookup.get(id);\r\n\r\n if (!existing) {\r\n return makeAppObject(id, this);\r\n } else {\r\n return existing;\r\n }\r\n };\r\n\r\n getAll = (): AppObject[] => {\r\n return Array.from(this.appObjectLookup.values());\r\n };\r\n\r\n getAllAppObjectsWithComponent(componentType: string): AppObject[] {\r\n const rArray: AppObject[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n if (appObj.hasComponent(componentType)) {\r\n rArray.push(appObj);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAllComponents<T extends AppObjectComponent>(type: string): T[] {\r\n const rArray: T[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n const aoEntity = appObj.getComponent(type);\r\n if (aoEntity) {\r\n rArray.push(aoEntity as T);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAppObjectComponent<T extends AppObjectComponent>(\r\n id: string,\r\n entityType: string\r\n ): T | undefined {\r\n const ao = this.appObjectLookup.get(id);\r\n if (!ao) {\r\n return undefined;\r\n }\r\n\r\n return ao.getComponent(entityType) as T;\r\n }\r\n\r\n submitLog(sender: string, message: string): void {\r\n console.log(`[${sender}]: ${message}`);\r\n }\r\n submitWarning(sender: string, message: string): void {\r\n console.warn(`[${sender}]: ${message}`);\r\n }\r\n submitError(sender: string, message: string): void {\r\n console.error(`[${sender}]: ${message}`);\r\n }\r\n submitFatal(sender: string, message: string): void {\r\n console.error(`FATAL ERROR - [${sender}]: ${message}`);\r\n }\r\n\r\n registerSingleton(component: AppObjectComponent): void {\r\n if (this.singletons.has(component.type)) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Singleton for type ${component.type} already exists. Relpacing`\r\n );\r\n }\r\n\r\n this.singletons.set(component.type, component);\r\n }\r\n\r\n getSingleton<T extends AppObjectComponent>(type: string): T | undefined {\r\n if (this.singletons.has(type)) {\r\n return this.singletons.get(type) as T;\r\n }\r\n\r\n const components = this.getAllComponents<AppObjectComponent>(type);\r\n if (components.length === 1) {\r\n this.singletons.set(components[0].type, components[0]);\r\n return components[0] as T;\r\n } else if (components.length === 0) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Unable to find a singleton for ${type}`\r\n );\r\n return undefined;\r\n } else if (components.length > 1) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Multiple ${type} found. There should only be one if it truly a singleton. Using the first one`\r\n );\r\n return components[0] as T;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"AppObjectRepo.js","sourceRoot":"","sources":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AI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,OAAO,UAAU,CAAC,CAAC,CAAM,CAAC;QAC5B,CAAC;aAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,aAAa,CAChB,eAAe,EACf,kCAAkC,IAAI,EAAE,CACzC,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC;aAAM,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,aAAa,CAChB,eAAe,EACf,YAAY,IAAI,+EAA+E,CAChG,CAAC;YACF,OAAO,UAAU,CAAC,CAAC,CAAM,CAAC;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ObservableEntity, ObserverList } from \"../Entities\";\r\nimport { AppObject, makeAppObject } from \"./AppObject\";\r\nimport { AppObjectComponent } from \"./AppObjectComponent\";\r\n\r\n/**\r\n * Abstract repository class for managing AppObjects and their components.\r\n *\r\n * This class provides the interface for storing, retrieving, and managing application\r\n * objects, their components, and singletons. It also includes logging functionality\r\n * and observer pattern implementation for tracking changes to the repository.\r\n *\r\n * @extends ObservableEntity\r\n */\r\nexport abstract class AppObjectRepo extends ObservableEntity {\r\n /**\r\n * Checks if an AppObject with the specified ID exists in the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to check\r\n * @returns {boolean} True if the AppObject exists, false otherwise\r\n */\r\n abstract has(appObjectID: string): boolean;\r\n\r\n /**\r\n * Adds an AppObject to the repository.\r\n *\r\n * @param {AppObject} appObject - The AppObject to add\r\n */\r\n abstract add(appObject: AppObject): void;\r\n\r\n /**\r\n * Removes an AppObject with the specified ID from the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to remove\r\n */\r\n abstract remove(appObjectID: string): void;\r\n\r\n /**\r\n * Gets an AppObject by its ID.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve\r\n * @returns {AppObject | undefined} The AppObject if found, undefined otherwise\r\n */\r\n abstract get(appObjectID: string): AppObject | undefined;\r\n\r\n /**\r\n * Gets an AppObject by its ID, or creates a new one if it doesn't exist.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve or create\r\n * @returns {AppObject} The existing or newly created AppObject\r\n */\r\n abstract getOrCreate(appObjectID: string): AppObject;\r\n\r\n /**\r\n * Gets all AppObjects in the repository.\r\n *\r\n * @returns {AppObject[]} An array of all AppObjects\r\n */\r\n abstract getAll(): AppObject[];\r\n\r\n /**\r\n * Logs an informational message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The message to log\r\n */\r\n abstract submitLog(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a warning message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The warning message to log\r\n */\r\n abstract submitWarning(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs an error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The error message to log\r\n */\r\n abstract submitError(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a fatal error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The fatal error message to log\r\n */\r\n abstract submitFatal(sender: string, message: string): void;\r\n\r\n /**\r\n * Registers a component as a singleton in the repository.\r\n *\r\n * @param {AppObjectComponent} component - The component to register as a singleton\r\n */\r\n abstract registerSingleton(component: AppObjectComponent): void;\r\n\r\n /**\r\n * Unregisters a singleton component from the repository.\r\n *\r\n * @param {string} type - The type of the singleton to unregister\r\n */\r\n abstract unregisterSingleton(type: string): void;\r\n\r\n /**\r\n * Checks if a singleton component of the specified type exists.\r\n *\r\n * @param {string} type - The type of the singleton to check\r\n * @returns {boolean} True if a singleton of the specified type exists, false otherwise\r\n */\r\n abstract hasSingleton(type: string): boolean;\r\n\r\n /**\r\n * Gets a singleton component of the specified type.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of the singleton to retrieve\r\n * @returns {T | undefined} The singleton component if found, undefined otherwise\r\n */\r\n abstract getSingleton<T extends AppObjectComponent>(\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets a component of the specified type from an AppObject.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} appObjectID - The ID of the AppObject containing the component\r\n * @param {string} type - The type of the component to retrieve\r\n * @returns {T | undefined} The component if found, undefined otherwise\r\n */\r\n abstract getAppObjectComponent<T extends AppObjectComponent>(\r\n appObjectID: string,\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets all AppObjects that have a component of the specified type.\r\n *\r\n * @param {string} componentType - The component type to filter by\r\n * @returns {AppObject[]} An array of AppObjects having the specified component type\r\n */\r\n abstract getAllAppObjectsWithComponent(componentType: string): AppObject[];\r\n\r\n /**\r\n * Gets all components of the specified type across all AppObjects.\r\n *\r\n * @template T - Type of the components to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of components to retrieve\r\n * @returns {T[]} An array of all components of the specified type\r\n */\r\n abstract getAllComponents<T extends AppObjectComponent>(type: string): T[];\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is added to the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject addition notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removeAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is removed from the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject removal notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removedAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n}\r\n\r\n/**\r\n * Creates and returns a new AppObjectRepo instance.\r\n *\r\n * @returns {AppObjectRepo} A new AppObjectRepo instance\r\n */\r\nexport function makeAppObjectRepo(): AppObjectRepo {\r\n return new AppObjectRepoImp();\r\n}\r\n\r\n/**\r\n * Implementation of the AppObjectRepo abstract class.\r\n *\r\n * @private\r\n * @extends AppObjectRepo\r\n */\r\nclass AppObjectRepoImp extends AppObjectRepo {\r\n private appObjectLookup = new Map<string, AppObject>();\r\n private singletons = new Map<string, AppObjectComponent>();\r\n\r\n private onAppObjectAddedObserver = new ObserverList<AppObject>();\r\n addAppObjectAddedObserver = (observer: (addedEntity: AppObject) => void) => {\r\n this.onAppObjectAddedObserver.add(observer);\r\n };\r\n removeAppObjectAddedObserver = (\r\n observer: (addedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectAddedObserver.remove(observer);\r\n };\r\n\r\n private onAppObjectRemovedObservers = new ObserverList<AppObject>();\r\n addAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ) => {\r\n this.onAppObjectRemovedObservers.add(observer);\r\n };\r\n removedAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectRemovedObservers.remove(observer);\r\n };\r\n\r\n has = (id: string): boolean => {\r\n return this.appObjectLookup.has(id);\r\n };\r\n\r\n add = (appObject: AppObject) => {\r\n const existing = this.appObjectLookup.get(appObject.id);\r\n if (existing) {\r\n existing.removeObserver(this.notify);\r\n }\r\n\r\n this.appObjectLookup.set(appObject.id, appObject);\r\n appObject.addObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectAddedObserver.notify(appObject);\r\n };\r\n\r\n remove = (id: string) => {\r\n const existing = this.appObjectLookup.get(id);\r\n if (!existing) return;\r\n\r\n this.appObjectLookup.delete(id);\r\n existing.removeObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectRemovedObservers.notify(existing);\r\n };\r\n\r\n get = (id: string): AppObject | undefined => {\r\n return this.appObjectLookup.get(id);\r\n };\r\n\r\n getOrCreate = (id: string): AppObject => {\r\n const existing = this.appObjectLookup.get(id);\r\n\r\n if (!existing) {\r\n return makeAppObject(id, this);\r\n } else {\r\n return existing;\r\n }\r\n };\r\n\r\n getAll = (): AppObject[] => {\r\n return Array.from(this.appObjectLookup.values());\r\n };\r\n\r\n getAllAppObjectsWithComponent(componentType: string): AppObject[] {\r\n const rArray: AppObject[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n if (appObj.hasComponent(componentType)) {\r\n rArray.push(appObj);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAllComponents<T extends AppObjectComponent>(type: string): T[] {\r\n const rArray: T[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n const aoEntity = appObj.getComponent(type);\r\n if (aoEntity) {\r\n rArray.push(aoEntity as T);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAppObjectComponent<T extends AppObjectComponent>(\r\n id: string,\r\n entityType: string\r\n ): T | undefined {\r\n const ao = this.appObjectLookup.get(id);\r\n if (!ao) {\r\n return undefined;\r\n }\r\n\r\n return ao.getComponent(entityType) as T;\r\n }\r\n\r\n submitLog(sender: string, message: string): void {\r\n console.log(`[${sender}]: ${message}`);\r\n }\r\n submitWarning(sender: string, message: string): void {\r\n console.warn(`[${sender}]: ${message}`);\r\n }\r\n submitError(sender: string, message: string): void {\r\n console.error(`[${sender}]: ${message}`);\r\n }\r\n submitFatal(sender: string, message: string): void {\r\n console.error(`FATAL ERROR - [${sender}]: ${message}`);\r\n }\r\n\r\n registerSingleton(component: AppObjectComponent): void {\r\n if (this.singletons.has(component.type)) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Singleton for type ${component.type} already exists. Replacing`\r\n );\r\n }\r\n\r\n this.singletons.set(component.type, component);\r\n }\r\n\r\n unregisterSingleton(type: string): void {\r\n this.singletons.delete(type);\r\n }\r\n\r\n hasSingleton(type: string): boolean {\r\n if (this.singletons.has(type)) {\r\n return true;\r\n }\r\n\r\n const components = this.getAllComponents<AppObjectComponent>(type);\r\n return components.length === 1;\r\n }\r\n\r\n getSingleton<T extends AppObjectComponent>(type: string): T | undefined {\r\n if (this.singletons.has(type)) {\r\n return this.singletons.get(type) as T;\r\n }\r\n\r\n const components = this.getAllComponents<AppObjectComponent>(type);\r\n if (components.length === 1) {\r\n this.singletons.set(components[0].type, components[0]);\r\n return components[0] as T;\r\n } else if (components.length === 0) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Unable to find a singleton for ${type}`\r\n );\r\n return undefined;\r\n } else if (components.length > 1) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Multiple ${type} found. There should only be one if it truly a singleton. Using the first one`\r\n );\r\n return components[0] as T;\r\n }\r\n }\r\n}\r\n"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppObjectSingletonEntity = void 0;
4
+ const AppObjectEntity_1 = require("./AppObjectEntity");
5
+ /**
6
+ * Singleton entity component that manages application state
7
+ *
8
+ * AppObjectSingletonEntity extends AppObjectEntity and automatically registers itself
9
+ * as a singleton in the AppObjectRepo upon construction. This ensures only one instance
10
+ * of this entity type exists across the entire application.
11
+ *
12
+ * Use this class when you need an entity that should have only one instance globally,
13
+ * such as application-wide configuration or shared state managers.
14
+ */
15
+ class AppObjectSingletonEntity extends AppObjectEntity_1.AppObjectEntity {
16
+ /**
17
+ * Creates a new singleton entity component and attaches it to the specified AppObject
18
+ * Automatically registers itself as a singleton in the AppObjectRepo
19
+ *
20
+ * @param appObject The parent AppObject this component will be attached to
21
+ * @param type The unique type identifier for this component
22
+ */
23
+ constructor(appObject, type) {
24
+ super(appObject, type);
25
+ this.appObjects.registerSingleton(this);
26
+ }
27
+ /**
28
+ * Cleans up resources and unregisters the singleton
29
+ *
30
+ * This method:
31
+ * 1. Unregisters itself from the singleton registry
32
+ * 2. Calls the parent class dispose method
33
+ */
34
+ dispose() {
35
+ this.appObjects.unregisterSingleton(this.type);
36
+ super.dispose();
37
+ }
38
+ }
39
+ exports.AppObjectSingletonEntity = AppObjectSingletonEntity;
40
+ //# sourceMappingURL=AppObjectSingletonEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppObjectSingletonEntity.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectSingletonEntity.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAEpD;;;;;;;;;GASG;AACH,MAAa,wBAAyB,SAAQ,iCAAe;IAC3D;;;;;;OAMG;IACH,YAAY,SAAoB,EAAE,IAAY;QAC5C,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAEvB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAzBD,4DAyBC","sourcesContent":["import { AppObject } from \"./AppObject\";\r\nimport { AppObjectEntity } from \"./AppObjectEntity\";\r\n\r\n/**\r\n * Singleton entity component that manages application state\r\n *\r\n * AppObjectSingletonEntity extends AppObjectEntity and automatically registers itself\r\n * as a singleton in the AppObjectRepo upon construction. This ensures only one instance\r\n * of this entity type exists across the entire application.\r\n *\r\n * Use this class when you need an entity that should have only one instance globally,\r\n * such as application-wide configuration or shared state managers.\r\n */\r\nexport class AppObjectSingletonEntity extends AppObjectEntity {\r\n /**\r\n * Creates a new singleton entity component and attaches it to the specified AppObject\r\n * Automatically registers itself as a singleton in the AppObjectRepo\r\n *\r\n * @param appObject The parent AppObject this component will be attached to\r\n * @param type The unique type identifier for this component\r\n */\r\n constructor(appObject: AppObject, type: string) {\r\n super(appObject, type);\r\n\r\n this.appObjects.registerSingleton(this);\r\n }\r\n\r\n /**\r\n * Cleans up resources and unregisters the singleton\r\n *\r\n * This method:\r\n * 1. Unregisters itself from the singleton registry\r\n * 2. Calls the parent class dispose method\r\n */\r\n dispose() {\r\n this.appObjects.unregisterSingleton(this.type);\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppObjectSingletonEntityRepo = void 0;
4
+ const AppObjectEntityRepo_1 = require("./AppObjectEntityRepo");
5
+ /**
6
+ * A singleton repository for managing collections of AppObjectEntity instances.
7
+ *
8
+ * This generic class extends AppObjectEntityRepo and automatically registers itself
9
+ * as a singleton in the AppObjectRepo upon construction. This ensures only one instance
10
+ * of this repository type exists across the entire application.
11
+ *
12
+ * Use this class when you need a centralized repository that should have only one instance
13
+ * globally, such as application-wide entity collections or shared resource managers.
14
+ *
15
+ * @template T - The type of entities managed by this repository, must extend AppObjectEntity
16
+ * @extends AppObjectEntityRepo
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Create a singleton repository for player entities
21
+ * class PlayerRepo extends AppObjectSingletonEntityRepo<PlayerEntity> {
22
+ * static type = "playerRepo";
23
+ * constructor(appObject: AppObject) {
24
+ * super(appObject, PlayerRepo.type);
25
+ * }
26
+ * }
27
+ * ```
28
+ */
29
+ class AppObjectSingletonEntityRepo extends AppObjectEntityRepo_1.AppObjectEntityRepo {
30
+ /**
31
+ * Creates a new singleton entity repository component and attaches it to the specified AppObject
32
+ * Automatically registers itself as a singleton in the AppObjectRepo
33
+ *
34
+ * @param appObject The parent AppObject this component will be attached to
35
+ * @param type The unique type identifier for this component
36
+ */
37
+ constructor(appObject, type) {
38
+ super(appObject, type);
39
+ this.appObjects.registerSingleton(this);
40
+ }
41
+ /**
42
+ * Cleans up resources and unregisters the singleton
43
+ *
44
+ * This method:
45
+ * 1. Unregisters itself from the singleton registry
46
+ * 2. Calls the parent class dispose method
47
+ */
48
+ dispose() {
49
+ this.appObjects.unregisterSingleton(this.type);
50
+ super.dispose();
51
+ }
52
+ }
53
+ exports.AppObjectSingletonEntityRepo = AppObjectSingletonEntityRepo;
54
+ //# sourceMappingURL=AppObjectSingletonEntityRepo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppObjectSingletonEntityRepo.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectSingletonEntityRepo.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,4BAEX,SAAQ,yCAAsB;IAC9B;;;;;;OAMG;IACH,YAAY,SAAoB,EAAE,IAAY;QAC5C,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAEvB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AA3BD,oEA2BC","sourcesContent":["import { AppObject } from \"./AppObject\";\r\nimport { AppObjectEntity } from \"./AppObjectEntity\";\r\nimport { AppObjectEntityRepo } from \"./AppObjectEntityRepo\";\r\n\r\n/**\r\n * A singleton repository for managing collections of AppObjectEntity instances.\r\n *\r\n * This generic class extends AppObjectEntityRepo and automatically registers itself\r\n * as a singleton in the AppObjectRepo upon construction. This ensures only one instance\r\n * of this repository type exists across the entire application.\r\n *\r\n * Use this class when you need a centralized repository that should have only one instance\r\n * globally, such as application-wide entity collections or shared resource managers.\r\n *\r\n * @template T - The type of entities managed by this repository, must extend AppObjectEntity\r\n * @extends AppObjectEntityRepo\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a singleton repository for player entities\r\n * class PlayerRepo extends AppObjectSingletonEntityRepo<PlayerEntity> {\r\n * static type = \"playerRepo\";\r\n * constructor(appObject: AppObject) {\r\n * super(appObject, PlayerRepo.type);\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport class AppObjectSingletonEntityRepo<\r\n T extends AppObjectEntity,\r\n> extends AppObjectEntityRepo<T> {\r\n /**\r\n * Creates a new singleton entity repository component and attaches it to the specified AppObject\r\n * Automatically registers itself as a singleton in the AppObjectRepo\r\n *\r\n * @param appObject The parent AppObject this component will be attached to\r\n * @param type The unique type identifier for this component\r\n */\r\n constructor(appObject: AppObject, type: string) {\r\n super(appObject, type);\r\n\r\n this.appObjects.registerSingleton(this);\r\n }\r\n\r\n /**\r\n * Cleans up resources and unregisters the singleton\r\n *\r\n * This method:\r\n * 1. Unregisters itself from the singleton registry\r\n * 2. Calls the parent class dispose method\r\n */\r\n dispose() {\r\n this.appObjects.unregisterSingleton(this.type);\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppObjectSingletonPM = void 0;
4
+ const AppObjectPM_1 = require("./AppObjectPM");
5
+ /**
6
+ * Singleton Presentation Manager (PM) component that transforms application state into view models
7
+ *
8
+ * AppObjectSingletonPM extends AppObjectPM and automatically registers itself as a singleton
9
+ * in the AppObjectRepo upon construction. This ensures only one instance of this PM type exists
10
+ * across the entire application.
11
+ *
12
+ * Use this class when you need a presentation manager that should have only one instance globally,
13
+ * such as application-wide UI state managers or shared view model providers.
14
+ *
15
+ * A singleton PM typically:
16
+ * 1. Observes entity changes
17
+ * 2. Transforms entity data into view models
18
+ * 3. Notifies attached views when view models change
19
+ * 4. Handles view model caching and optimization
20
+ * 5. Exists as a single instance across the application
21
+ *
22
+ * @typeparam T The view model type this PM produces
23
+ * @extends AppObjectPM
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * class GlobalSettingsPM extends AppObjectSingletonPM<SettingsVM> {
28
+ * static type = "globalSettingsPM";
29
+ *
30
+ * constructor(appObject: AppObject) {
31
+ * super(appObject, GlobalSettingsPM.type);
32
+ * }
33
+ *
34
+ * vmsAreEqual(a: SettingsVM, b: SettingsVM): boolean {
35
+ * return a.theme === b.theme && a.language === b.language;
36
+ * }
37
+ *
38
+ * formVM(): void {
39
+ * // Form view model from entities
40
+ * }
41
+ * }
42
+ * ```
43
+ */
44
+ class AppObjectSingletonPM extends AppObjectPM_1.AppObjectPM {
45
+ /**
46
+ * Creates a new singleton presentation manager component and attaches it to the specified AppObject
47
+ * Automatically registers itself as a singleton in the AppObjectRepo
48
+ *
49
+ * @param appObject The parent AppObject this component will be attached to
50
+ * @param type The unique type identifier for this component
51
+ */
52
+ constructor(appObject, type) {
53
+ super(appObject, type);
54
+ this.appObjects.registerSingleton(this);
55
+ }
56
+ /**
57
+ * Cleans up resources and unregisters the singleton
58
+ *
59
+ * This method:
60
+ * 1. Unregisters itself from the singleton registry
61
+ * 2. Calls the parent class dispose method (which handles entity observers and views)
62
+ */
63
+ dispose() {
64
+ this.appObjects.unregisterSingleton(this.type);
65
+ super.dispose();
66
+ }
67
+ }
68
+ exports.AppObjectSingletonPM = AppObjectSingletonPM;
69
+ //# sourceMappingURL=AppObjectSingletonPM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppObjectSingletonPM.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectSingletonPM.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAsB,oBAAwB,SAAQ,yBAAc;IAClE;;;;;;OAMG;IACH,YAAY,SAAoB,EAAE,IAAY;QAC5C,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAEvB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAzBD,oDAyBC","sourcesContent":["import { AppObject } from \"./AppObject\";\r\nimport { AppObjectPM } from \"./AppObjectPM\";\r\n\r\n/**\r\n * Singleton Presentation Manager (PM) component that transforms application state into view models\r\n *\r\n * AppObjectSingletonPM extends AppObjectPM and automatically registers itself as a singleton\r\n * in the AppObjectRepo upon construction. This ensures only one instance of this PM type exists\r\n * across the entire application.\r\n *\r\n * Use this class when you need a presentation manager that should have only one instance globally,\r\n * such as application-wide UI state managers or shared view model providers.\r\n *\r\n * A singleton PM typically:\r\n * 1. Observes entity changes\r\n * 2. Transforms entity data into view models\r\n * 3. Notifies attached views when view models change\r\n * 4. Handles view model caching and optimization\r\n * 5. Exists as a single instance across the application\r\n *\r\n * @typeparam T The view model type this PM produces\r\n * @extends AppObjectPM\r\n *\r\n * @example\r\n * ```typescript\r\n * class GlobalSettingsPM extends AppObjectSingletonPM<SettingsVM> {\r\n * static type = \"globalSettingsPM\";\r\n *\r\n * constructor(appObject: AppObject) {\r\n * super(appObject, GlobalSettingsPM.type);\r\n * }\r\n *\r\n * vmsAreEqual(a: SettingsVM, b: SettingsVM): boolean {\r\n * return a.theme === b.theme && a.language === b.language;\r\n * }\r\n *\r\n * formVM(): void {\r\n * // Form view model from entities\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport abstract class AppObjectSingletonPM<T> extends AppObjectPM<T> {\r\n /**\r\n * Creates a new singleton presentation manager component and attaches it to the specified AppObject\r\n * Automatically registers itself as a singleton in the AppObjectRepo\r\n *\r\n * @param appObject The parent AppObject this component will be attached to\r\n * @param type The unique type identifier for this component\r\n */\r\n constructor(appObject: AppObject, type: string) {\r\n super(appObject, type);\r\n\r\n this.appObjects.registerSingleton(this);\r\n }\r\n\r\n /**\r\n * Cleans up resources and unregisters the singleton\r\n *\r\n * This method:\r\n * 1. Unregisters itself from the singleton registry\r\n * 2. Calls the parent class dispose method (which handles entity observers and views)\r\n */\r\n dispose() {\r\n this.appObjects.unregisterSingleton(this.type);\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppObjectSingletonUC = void 0;
4
+ const AppObjectUC_1 = require("./AppObjectUC");
5
+ /**
6
+ * AppObjectSingletonUC (Use Case) serves as a singleton use case class within the application framework.
7
+ *
8
+ * This class extends AppObjectUC and automatically registers itself as a singleton in the
9
+ * AppObjectRepo upon construction. This ensures only one instance of this use case type exists
10
+ * across the entire application.
11
+ *
12
+ * Use Cases are components that represent specific application operations or workflows.
13
+ * They encapsulate business rules and coordinate interactions between different parts
14
+ * of the application. Use this singleton version when the use case should exist as a
15
+ * single instance globally, such as application-wide orchestration or workflow managers.
16
+ *
17
+ * @extends AppObjectUC
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * class GlobalPurchaseManagerUC extends AppObjectSingletonUC {
22
+ * static type = "globalPurchaseManagerUC";
23
+ *
24
+ * constructor(appObject: AppObject) {
25
+ * super(appObject, GlobalPurchaseManagerUC.type);
26
+ * }
27
+ *
28
+ * execute(itemId: string, quantity: number): boolean {
29
+ * // Implement the purchase item use case
30
+ * return true; // if successful
31
+ * }
32
+ * }
33
+ * ```
34
+ */
35
+ class AppObjectSingletonUC extends AppObjectUC_1.AppObjectUC {
36
+ /**
37
+ * Creates a new singleton use case component and attaches it to the specified AppObject
38
+ * Automatically registers itself as a singleton in the AppObjectRepo
39
+ *
40
+ * @param appObject The parent AppObject this component will be attached to
41
+ * @param type The unique type identifier for this component
42
+ */
43
+ constructor(appObject, type) {
44
+ super(appObject, type);
45
+ this.appObjects.registerSingleton(this);
46
+ }
47
+ /**
48
+ * Cleans up resources and unregisters the singleton
49
+ *
50
+ * This method:
51
+ * 1. Unregisters itself from the singleton registry
52
+ * 2. Calls the parent class dispose method
53
+ */
54
+ dispose() {
55
+ this.appObjects.unregisterSingleton(this.type);
56
+ super.dispose();
57
+ }
58
+ }
59
+ exports.AppObjectSingletonUC = AppObjectSingletonUC;
60
+ //# sourceMappingURL=AppObjectSingletonUC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppObjectSingletonUC.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectSingletonUC.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,oBAAqB,SAAQ,yBAAW;IACnD;;;;;;OAMG;IACH,YAAY,SAAoB,EAAE,IAAY;QAC5C,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAEvB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAzBD,oDAyBC","sourcesContent":["import { AppObject } from \"./AppObject\";\r\nimport { AppObjectUC } from \"./AppObjectUC\";\r\n\r\n/**\r\n * AppObjectSingletonUC (Use Case) serves as a singleton use case class within the application framework.\r\n *\r\n * This class extends AppObjectUC and automatically registers itself as a singleton in the\r\n * AppObjectRepo upon construction. This ensures only one instance of this use case type exists\r\n * across the entire application.\r\n *\r\n * Use Cases are components that represent specific application operations or workflows.\r\n * They encapsulate business rules and coordinate interactions between different parts\r\n * of the application. Use this singleton version when the use case should exist as a\r\n * single instance globally, such as application-wide orchestration or workflow managers.\r\n *\r\n * @extends AppObjectUC\r\n *\r\n * @example\r\n * ```typescript\r\n * class GlobalPurchaseManagerUC extends AppObjectSingletonUC {\r\n * static type = \"globalPurchaseManagerUC\";\r\n *\r\n * constructor(appObject: AppObject) {\r\n * super(appObject, GlobalPurchaseManagerUC.type);\r\n * }\r\n *\r\n * execute(itemId: string, quantity: number): boolean {\r\n * // Implement the purchase item use case\r\n * return true; // if successful\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport class AppObjectSingletonUC extends AppObjectUC {\r\n /**\r\n * Creates a new singleton use case component and attaches it to the specified AppObject\r\n * Automatically registers itself as a singleton in the AppObjectRepo\r\n *\r\n * @param appObject The parent AppObject this component will be attached to\r\n * @param type The unique type identifier for this component\r\n */\r\n constructor(appObject: AppObject, type: string) {\r\n super(appObject, type);\r\n\r\n this.appObjects.registerSingleton(this);\r\n }\r\n\r\n /**\r\n * Cleans up resources and unregisters the singleton\r\n *\r\n * This method:\r\n * 1. Unregisters itself from the singleton registry\r\n * 2. Calls the parent class dispose method\r\n */\r\n dispose() {\r\n this.appObjects.unregisterSingleton(this.type);\r\n super.dispose();\r\n }\r\n}\r\n"]}
@@ -22,6 +22,10 @@ __exportStar(require("./AppObjectRepo"), exports);
22
22
  __exportStar(require("./AppObjectUC"), exports);
23
23
  __exportStar(require("./AppObjectController"), exports);
24
24
  __exportStar(require("./AppObjectView"), exports);
25
+ __exportStar(require("./AppObjectSingletonEntity"), exports);
26
+ __exportStar(require("./AppObjectSingletonEntityRepo"), exports);
27
+ __exportStar(require("./AppObjectSingletonPM"), exports);
28
+ __exportStar(require("./AppObjectSingletonUC"), exports);
25
29
  __exportStar(require("./getSingletonComponent"), exports);
26
30
  __exportStar(require("./printAppObjectDetails"), exports);
27
31
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/AppObject/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,oDAAiC;AACjC,wDAAqC;AACrC,gDAA6B;AAC7B,kDAA+B;AAC/B,gDAA6B;AAC7B,wDAAqC;AACrC,kDAA+B;AAC/B,0DAAwC;AACxC,0DAAwC","sourcesContent":["export * from \"./AppObject\"\r\nexport * from \"./AppObjectEntity\"\r\nexport * from \"./AppObjectEntityRepo\"\r\nexport * from \"./AppObjectPM\"\r\nexport * from \"./AppObjectRepo\"\r\nexport * from \"./AppObjectUC\"\r\nexport * from \"./AppObjectController\"\r\nexport * from \"./AppObjectView\"\r\nexport * from \"./getSingletonComponent\";\r\nexport * from \"./printAppObjectDetails\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/AppObject/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,kDAAgC;AAChC,gDAA8B;AAC9B,wDAAsC;AACtC,kDAAgC;AAChC,6DAA2C;AAC3C,iEAA+C;AAC/C,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,0DAAwC","sourcesContent":["export * from \"./AppObject\";\r\nexport * from \"./AppObjectEntity\";\r\nexport * from \"./AppObjectEntityRepo\";\r\nexport * from \"./AppObjectPM\";\r\nexport * from \"./AppObjectRepo\";\r\nexport * from \"./AppObjectUC\";\r\nexport * from \"./AppObjectController\";\r\nexport * from \"./AppObjectView\";\r\nexport * from \"./AppObjectSingletonEntity\";\r\nexport * from \"./AppObjectSingletonEntityRepo\";\r\nexport * from \"./AppObjectSingletonPM\";\r\nexport * from \"./AppObjectSingletonUC\";\r\nexport * from \"./getSingletonComponent\";\r\nexport * from \"./printAppObjectDetails\";\r\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DomainFactoryRepo = void 0;
4
+ exports.makeDomainFactoryRepo = makeDomainFactoryRepo;
4
5
  const AppObject_1 = require("../../AppObject");
5
6
  /**
6
7
  * Repository for managing DomainFactory instances in the application.
@@ -69,4 +70,8 @@ class DomainFactoryRepo extends AppObject_1.AppObjectEntityRepo {
69
70
  exports.DomainFactoryRepo = DomainFactoryRepo;
70
71
  /** Unique type identifier for this component */
71
72
  DomainFactoryRepo.type = "DomainFactoryRepo";
73
+ function makeDomainFactoryRepo(appObjects) {
74
+ const appObject = appObjects.getOrCreate("DomainFactoryRepo");
75
+ return new DomainFactoryRepo(appObject);
76
+ }
72
77
  //# sourceMappingURL=DomainFactoryRepo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DomainFactoryRepo.js","sourceRoot":"","sources":["../../../../src/DomainFactories/Entities/DomainFactoryRepo.ts"],"names":[],"mappings":";;;AAAA,+CAKyB;AAGzB;;;;;;;;;;;;;GAaG;AACH,MAAa,iBAAkB,SAAQ,+BAAkC;IAIvE;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,iCAAqB,EAC1B,iBAAiB,CAAC,IAAI,EACtB,UAAU,CACX,CAAC;IACJ,CAAC;IA+BD;;;;OAIG;IACH,SAAS,CAAC,IAAY;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;QA5C3C;;;;WAIG;QACH,gBAAW,GAAG,GAAG,EAAE;YACjB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAEnC,qCAAqC;YACrC,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,aAAa,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;YAEH,qCAAqC;YACrC,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,4CAA4C;YAC5C,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,0CAA0C;YAC1C,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAkBF,CAAC;;AA7DH,8CA8DC;AA7DC,gDAAgD;AACzC,sBAAI,GAAG,mBAAmB,AAAtB,CAAuB","sourcesContent":["import {\r\n AppObject,\r\n AppObjectEntityRepo,\r\n AppObjectRepo,\r\n getSingletonComponent,\r\n} from \"../../AppObject\";\r\nimport { DomainFactory } from \"./DomainFactory\";\r\n\r\n/**\r\n * Repository for managing DomainFactory instances in the application.\r\n *\r\n * DomainFactoryRepo is implemented as a singleton that coordinates the setup\r\n * and initialization of all domain factories. It ensures that the setup phases\r\n * are executed in the correct order across all registered factories:\r\n * 1. All factories set up their entities first\r\n * 2. Then all factories set up their use cases\r\n * 3. Next all factories set up their presentation managers\r\n * 4. Finally, all factories perform their final setup operations\r\n *\r\n * This phased approach ensures that components in one domain can depend on\r\n * components from another domain being properly initialized.\r\n */\r\nexport class DomainFactoryRepo extends AppObjectEntityRepo<DomainFactory> {\r\n /** Unique type identifier for this component */\r\n static type = \"DomainFactoryRepo\";\r\n\r\n /**\r\n * Global accessor for the singleton repository\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton DomainFactoryRepo or undefined if not created yet\r\n */\r\n static get(appObjects: AppObjectRepo) {\r\n return getSingletonComponent<DomainFactoryRepo>(\r\n DomainFactoryRepo.type,\r\n appObjects\r\n );\r\n }\r\n\r\n /**\r\n * Orchestrates the setup of the entire domain layer in the correct sequence.\r\n * Calls each setup phase on all factories before proceeding to the next phase.\r\n * This ensures cross-domain dependencies are properly resolved.\r\n */\r\n setupDomain = () => {\r\n const allFactories = this.getAll();\r\n\r\n // Phase 1: Set up all entities first\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupEntities();\r\n });\r\n\r\n // Phase 2: Set up all use cases next\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupUCs();\r\n });\r\n\r\n // Phase 3: Set up all presentation managers\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupPMs();\r\n });\r\n\r\n // Phase 4: Perform final setup operations\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.finalSetup();\r\n });\r\n };\r\n\r\n /**\r\n * Retrieves a domain factory by its name.\r\n * @param name The name of the domain factory to find\r\n * @returns The matching domain factory or undefined if not found\r\n */\r\n getByName(name: string): DomainFactory | undefined {\r\n const allFactories = this.getAll();\r\n return allFactories.find((factory) => factory.factoryName === name);\r\n }\r\n\r\n /**\r\n * Creates a new DomainFactoryRepo and registers it with the given AppObject.\r\n * @param appObject The parent AppObject this component will be attached to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, DomainFactoryRepo.type);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DomainFactoryRepo.js","sourceRoot":"","sources":["../../../../src/DomainFactories/Entities/DomainFactoryRepo.ts"],"names":[],"mappings":";;;AAsFA,sDAGC;AAzFD,+CAKyB;AAGzB;;;;;;;;;;;;;GAaG;AACH,MAAa,iBAAkB,SAAQ,+BAAkC;IAIvE;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,iCAAqB,EAC1B,iBAAiB,CAAC,IAAI,EACtB,UAAU,CACX,CAAC;IACJ,CAAC;IA+BD;;;;OAIG;IACH,SAAS,CAAC,IAAY;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;QA5C3C;;;;WAIG;QACH,gBAAW,GAAG,GAAG,EAAE;YACjB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAEnC,qCAAqC;YACrC,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,aAAa,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;YAEH,qCAAqC;YACrC,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,4CAA4C;YAC5C,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,0CAA0C;YAC1C,YAAY,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;gBACrC,aAAa,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAkBF,CAAC;;AA7DH,8CA8DC;AA7DC,gDAAgD;AACzC,sBAAI,GAAG,mBAAmB,AAAtB,CAAuB;AA8DpC,SAAgB,qBAAqB,CAAC,UAAyB;IAC7D,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC9D,OAAO,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import {\r\n AppObject,\r\n AppObjectEntityRepo,\r\n AppObjectRepo,\r\n getSingletonComponent,\r\n} from \"../../AppObject\";\r\nimport { DomainFactory } from \"./DomainFactory\";\r\n\r\n/**\r\n * Repository for managing DomainFactory instances in the application.\r\n *\r\n * DomainFactoryRepo is implemented as a singleton that coordinates the setup\r\n * and initialization of all domain factories. It ensures that the setup phases\r\n * are executed in the correct order across all registered factories:\r\n * 1. All factories set up their entities first\r\n * 2. Then all factories set up their use cases\r\n * 3. Next all factories set up their presentation managers\r\n * 4. Finally, all factories perform their final setup operations\r\n *\r\n * This phased approach ensures that components in one domain can depend on\r\n * components from another domain being properly initialized.\r\n */\r\nexport class DomainFactoryRepo extends AppObjectEntityRepo<DomainFactory> {\r\n /** Unique type identifier for this component */\r\n static type = \"DomainFactoryRepo\";\r\n\r\n /**\r\n * Global accessor for the singleton repository\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton DomainFactoryRepo or undefined if not created yet\r\n */\r\n static get(appObjects: AppObjectRepo) {\r\n return getSingletonComponent<DomainFactoryRepo>(\r\n DomainFactoryRepo.type,\r\n appObjects\r\n );\r\n }\r\n\r\n /**\r\n * Orchestrates the setup of the entire domain layer in the correct sequence.\r\n * Calls each setup phase on all factories before proceeding to the next phase.\r\n * This ensures cross-domain dependencies are properly resolved.\r\n */\r\n setupDomain = () => {\r\n const allFactories = this.getAll();\r\n\r\n // Phase 1: Set up all entities first\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupEntities();\r\n });\r\n\r\n // Phase 2: Set up all use cases next\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupUCs();\r\n });\r\n\r\n // Phase 3: Set up all presentation managers\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.setupPMs();\r\n });\r\n\r\n // Phase 4: Perform final setup operations\r\n allFactories.forEach((domainFactory) => {\r\n domainFactory.finalSetup();\r\n });\r\n };\r\n\r\n /**\r\n * Retrieves a domain factory by its name.\r\n * @param name The name of the domain factory to find\r\n * @returns The matching domain factory or undefined if not found\r\n */\r\n getByName(name: string): DomainFactory | undefined {\r\n const allFactories = this.getAll();\r\n return allFactories.find((factory) => factory.factoryName === name);\r\n }\r\n\r\n /**\r\n * Creates a new DomainFactoryRepo and registers it with the given AppObject.\r\n * @param appObject The parent AppObject this component will be attached to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, DomainFactoryRepo.type);\r\n }\r\n}\r\n\r\nexport function makeDomainFactoryRepo(appObjects: AppObjectRepo) {\r\n const appObject = appObjects.getOrCreate(\"DomainFactoryRepo\");\r\n return new DomainFactoryRepo(appObject);\r\n}"]}
@@ -43,6 +43,12 @@ class ObserverList {
43
43
  this.observers = [];
44
44
  };
45
45
  }
46
+ /**
47
+ * Gets the number of observers in the list
48
+ */
49
+ get length() {
50
+ return this.observers.length;
51
+ }
46
52
  }
47
53
  exports.ObserverList = ObserverList;
48
54
  //# sourceMappingURL=ObserverList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObserverList.js","sourceRoot":"","sources":["../../../src/Entities/ObserverList.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,YAAY;IAAzB;QACU,cAAS,GAAyB,EAAE,CAAC;QAE7C;;;WAGG;QACI,WAAM,GAAG,CAAC,GAAM,EAAE,EAAE;YACzB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7B,GAAG,CAAC,GAAG,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF;;;WAGG;QACI,QAAG,GAAG,CAAC,GAAqB,EAAE,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF;;;WAGG;QACI,WAAM,GAAG,CAAC,GAAqB,EAAE,EAAE;YACxC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC;QAEF;;WAEG;QACI,UAAK,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CAAA;AAtCD,oCAsCC","sourcesContent":["/**\r\n * A generic implementation of the Observer pattern.\r\n * Maintains a list of observer functions that can be notified with a message.\r\n *\r\n * @typeParam T - The type of message that will be passed to observers\r\n */\r\nexport class ObserverList<T> {\r\n private observers: ((msg: T) => void)[] = [];\r\n\r\n /**\r\n * Notifies all observers by calling them with the provided message\r\n * @param msg - The message to send to all observers\r\n */\r\n public notify = (msg: T) => {\r\n this.observers.forEach((obs) => {\r\n obs(msg);\r\n });\r\n };\r\n\r\n /**\r\n * Adds a new observer function to the list\r\n * @param obs - The observer function to add\r\n */\r\n public add = (obs: (msg: T) => void) => {\r\n this.observers.push(obs);\r\n };\r\n\r\n /**\r\n * Removes an observer from the list\r\n * @param obs - The observer function to remove\r\n */\r\n public remove = (obs: (msg: T) => void) => {\r\n const index = this.observers.indexOf(obs);\r\n if (index >= 0) {\r\n this.observers.splice(index, 1);\r\n }\r\n };\r\n\r\n /**\r\n * Removes all observers from the list\r\n */\r\n public clear = () => {\r\n this.observers = [];\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"ObserverList.js","sourceRoot":"","sources":["../../../src/Entities/ObserverList.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,YAAY;IAAzB;QACU,cAAS,GAAyB,EAAE,CAAC;QAS7C;;;WAGG;QACI,WAAM,GAAG,CAAC,GAAM,EAAE,EAAE;YACzB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC7B,GAAG,CAAC,GAAG,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF;;;WAGG;QACI,QAAG,GAAG,CAAC,GAAqB,EAAE,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEF;;;WAGG;QACI,WAAM,GAAG,CAAC,GAAqB,EAAE,EAAE;YACxC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC;QAEF;;WAEG;QACI,UAAK,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;IA1CC;;OAEG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B,CAAC;CAqCF;AA7CD,oCA6CC","sourcesContent":["/**\r\n * A generic implementation of the Observer pattern.\r\n * Maintains a list of observer functions that can be notified with a message.\r\n *\r\n * @typeParam T - The type of message that will be passed to observers\r\n */\r\nexport class ObserverList<T> {\r\n private observers: ((msg: T) => void)[] = [];\r\n\r\n /**\r\n * Gets the number of observers in the list\r\n */\r\n public get length(): number {\r\n return this.observers.length;\r\n }\r\n\r\n /**\r\n * Notifies all observers by calling them with the provided message\r\n * @param msg - The message to send to all observers\r\n */\r\n public notify = (msg: T) => {\r\n this.observers.forEach((obs) => {\r\n obs(msg);\r\n });\r\n };\r\n\r\n /**\r\n * Adds a new observer function to the list\r\n * @param obs - The observer function to add\r\n */\r\n public add = (obs: (msg: T) => void) => {\r\n this.observers.push(obs);\r\n };\r\n\r\n /**\r\n * Removes an observer from the list\r\n * @param obs - The observer function to remove\r\n */\r\n public remove = (obs: (msg: T) => void) => {\r\n const index = this.observers.indexOf(obs);\r\n if (index >= 0) {\r\n this.observers.splice(index, 1);\r\n }\r\n };\r\n\r\n /**\r\n * Removes all observers from the list\r\n */\r\n public clear = () => {\r\n this.observers = [];\r\n };\r\n}\r\n"]}
@@ -21,7 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.ExampleRepo = void 0;
22
22
  exports.makeExampleRepo = makeExampleRepo;
23
23
  const AppObject_1 = require("../../AppObject");
24
- const generateUniqueID_1 = require("../../Utilities/generateUniqueID");
25
24
  const ExampleEntity_1 = require("./ExampleEntity");
26
25
  /**
27
26
  * ExampleRepo manages a collection of ExampleEntity instances.
@@ -76,38 +75,28 @@ function makeExampleRepo(appObject) {
76
75
  * This private class handles the actual implementation details
77
76
  */
78
77
  class ExampleRepoImp extends ExampleRepo {
78
+ /**
79
+ * Factory implementation for creating ExampleEntity instances
80
+ * @param id The ID for the entity's AppObject
81
+ * @returns A newly created ExampleEntity
82
+ */
83
+ entityFactory(id) {
84
+ const ao = this.appObjects.getOrCreate(id);
85
+ return (0, ExampleEntity_1.makeExampleEntity)(ao);
86
+ }
79
87
  /**
80
88
  * Deletes an ExampleEntity from the repository by its AppObject ID
81
89
  * @param id The ID of the entity's AppObject
82
90
  */
83
91
  deleteExampleEntity(id) {
84
- const entity = this.getForAppObject(id);
92
+ const entity = this.getById(id);
85
93
  if (!entity)
86
94
  return;
87
95
  entity.appObject.dispose();
88
- this.removeForAppObject(id);
96
+ this.removeById(id);
89
97
  }
90
98
  constructor(appObject) {
91
99
  super(appObject, ExampleRepo.type);
92
- /**
93
- * Creates a new ExampleEntity and adds it to the repository
94
- * @param id Optional ID for the entity's AppObject (generates one if not provided)
95
- * @returns The newly created ExampleEntity
96
- */
97
- this.createExampleEntity = (id) => {
98
- const idToUse = id ?? (0, generateUniqueID_1.generateUniqueID)();
99
- const entity = this.exampleEntityFactory(idToUse);
100
- this.add(entity);
101
- return entity;
102
- };
103
- /**
104
- * Default factory implementation for creating ExampleEntity instances
105
- * Can be overridden to create specialized entities
106
- */
107
- this.exampleEntityFactory = (id) => {
108
- const ao = this.appObjects.getOrCreate(id);
109
- return (0, ExampleEntity_1.makeExampleEntity)(ao);
110
- };
111
100
  }
112
101
  }
113
102
  //# sourceMappingURL=ExampleRepo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleRepo.js","sourceRoot":"","sources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C;IAC9B,CAAC;IAWD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAlCrC;;;;WAIG;QACH,wBAAmB,GAAG,CAAC,EAAsB,EAAiB,EAAE;YAC9D,MAAM,OAAO,GAAG,EAAE,IAAI,IAAA,mCAAgB,GAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjB,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;QAcF;;;WAGG;QACH,yBAAoB,GAAG,CAAC,EAAU,EAAiB,EAAE;YACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC3C,OAAO,IAAA,iCAAiB,EAAC,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC;IAIF,CAAC;CACF","sourcesContent":["/**\r\n * ExampleRepo.ts\r\n * \r\n * This file demonstrates how to implement a repository to manage collections of entities.\r\n * Repositories are responsible for creating, retrieving, and deleting entities.\r\n * \r\n * Key concepts:\r\n * - Repositories extend AppObjectEntityRepo<T> where T is the entity type\r\n * - They provide methods to create and delete entities\r\n * - They manage collections of entities and provide access to them\r\n * - They can use custom entity factories to create specialized entities\r\n * \r\n * Usage pattern:\r\n * 1. Get or create a repository using getById, get, or addIfMissing\r\n * 2. Use the repository to create new entities\r\n * 3. Access entities through the repository's getters\r\n * 4. Delete entities through the repository when they're no longer needed\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectEntityRepo,\r\n AppObjectRepo\r\n} from \"../../AppObject\";\r\nimport { generateUniqueID } from \"../../Utilities/generateUniqueID\";\r\nimport { ExampleEntity, makeExampleEntity } from \"./ExampleEntity\";\r\n\r\n/** Type definition for a factory function that creates ExampleEntity instances */\r\nexport type ExampleEntityFactory = (id: string) => ExampleEntity;\r\n\r\n/**\r\n * ExampleRepo manages a collection of ExampleEntity instances.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class ExampleRepo extends AppObjectEntityRepo<ExampleEntity> {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExampleRepoType\";\r\n\r\n /** Factory function used to create new entities */\r\n abstract exampleEntityFactory: ExampleEntityFactory;\r\n\r\n /** Creates a new entity with an optional ID */\r\n abstract createExampleEntity(id?: string): ExampleEntity;\r\n \r\n /** Deletes an entity by its AppObject ID */\r\n abstract deleteExampleEntity(id: string): void;\r\n\r\n /**\r\n * Retrieves an ExampleRepo component from an AppObject\r\n * @param appObj The AppObject to get the component from\r\n * @returns The ExampleRepo component or undefined if not found\r\n */\r\n static get(appObj: AppObject): ExampleRepo | undefined {\r\n return appObj.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Retrieves an ExampleRepo by its parent AppObject's ID\r\n * @param id The ID of the parent AppObject\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The ExampleRepo component or undefined if not found\r\n */\r\n static getById(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): ExampleRepo | undefined {\r\n return appObjects.get(id)?.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Ensures an ExampleRepo exists on the AppObject, creating one if needed\r\n * @param appObject The AppObject to check/add the component to\r\n * @returns The existing or newly created ExampleRepo\r\n */\r\n static addIfMissing(appObject: AppObject): ExampleRepo {\r\n const existing = appObject.getComponent<ExampleRepo>(ExampleRepo.type);\r\n if (existing) {\r\n return existing;\r\n } else {\r\n return makeExampleRepo(appObject);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ExampleRepo\r\n * @param appObject The AppObject to attach the repo to\r\n * @returns A new ExampleRepo instance\r\n */\r\nexport function makeExampleRepo(appObject: AppObject): ExampleRepo {\r\n return new ExampleRepoImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExampleRepo\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExampleRepoImp extends ExampleRepo {\r\n /**\r\n * Creates a new ExampleEntity and adds it to the repository\r\n * @param id Optional ID for the entity's AppObject (generates one if not provided)\r\n * @returns The newly created ExampleEntity\r\n */\r\n createExampleEntity = (id: string | undefined): ExampleEntity => {\r\n const idToUse = id ?? generateUniqueID();\r\n const entity = this.exampleEntityFactory(idToUse);\r\n this.add(entity);\r\n return entity;\r\n };\r\n\r\n /**\r\n * Deletes an ExampleEntity from the repository by its AppObject ID\r\n * @param id The ID of the entity's AppObject\r\n */\r\n deleteExampleEntity(id: string): void {\r\n const entity = this.getForAppObject(id);\r\n if (!entity) return;\r\n\r\n entity.appObject.dispose();\r\n this.removeForAppObject(id);\r\n }\r\n\r\n /**\r\n * Default factory implementation for creating ExampleEntity instances\r\n * Can be overridden to create specialized entities\r\n */\r\n exampleEntityFactory = (id: string): ExampleEntity => {\r\n const ao = this.appObjects.getOrCreate(id);\r\n return makeExampleEntity(ao);\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleRepo.type);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ExampleRepo.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleRepo.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AA6DH,0CAEC;AA7DD,+CAAgF;AAChF,mDAAmE;AAKnE;;;GAGG;AACH,MAAsB,WAAY,SAAQ,+BAAkC;IAO1E;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,MAAiB;QAC1B,OAAO,MAAM,CAAC,YAAY,CAAc,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,EAAU,EACV,UAAyB;QAEzB,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAc,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,SAAoB;QACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,CAAc,WAAW,CAAC,IAAI,CAAC,CAAC;QACvE,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;;AAzCH,kCA0CC;AAzCC,gDAAgD;AAChC,gBAAI,GAAG,iBAAiB,CAAC;AA0C3C;;;;GAIG;AACH,SAAgB,eAAe,CAAC,SAAoB;IAClD,OAAO,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,cAAe,SAAQ,WAAW;IACtC;;;;OAIG;IACH,aAAa,CAAC,EAAU;QACtB,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC3C,OAAO,IAAA,iCAAiB,EAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,mBAAmB,CAAC,EAAU;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["/**\r\n * ExampleRepo.ts\r\n *\r\n * This file demonstrates how to implement a repository to manage collections of entities.\r\n * Repositories are responsible for creating, retrieving, and deleting entities.\r\n *\r\n * Key concepts:\r\n * - Repositories extend AppObjectEntityRepo<T> where T is the entity type\r\n * - They provide methods to create and delete entities\r\n * - They manage collections of entities and provide access to them\r\n * - They can use custom entity factories to create specialized entities\r\n *\r\n * Usage pattern:\r\n * 1. Get or create a repository using getById, get, or addIfMissing\r\n * 2. Use the repository to create new entities\r\n * 3. Access entities through the repository's getters\r\n * 4. Delete entities through the repository when they're no longer needed\r\n */\r\n\r\nimport { AppObject, AppObjectEntityRepo, AppObjectRepo } from \"../../AppObject\";\r\nimport { ExampleEntity, makeExampleEntity } from \"./ExampleEntity\";\r\n\r\n/** Type definition for a factory function that creates ExampleEntity instances */\r\nexport type ExampleEntityFactory = (id: string) => ExampleEntity;\r\n\r\n/**\r\n * ExampleRepo manages a collection of ExampleEntity instances.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class ExampleRepo extends AppObjectEntityRepo<ExampleEntity> {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExampleRepoType\";\r\n\r\n /** Deletes an entity by its AppObject ID */\r\n abstract deleteExampleEntity(id: string): void;\r\n\r\n /**\r\n * Retrieves an ExampleRepo component from an AppObject\r\n * @param appObj The AppObject to get the component from\r\n * @returns The ExampleRepo component or undefined if not found\r\n */\r\n static get(appObj: AppObject): ExampleRepo | undefined {\r\n return appObj.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Retrieves an ExampleRepo by its parent AppObject's ID\r\n * @param id The ID of the parent AppObject\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The ExampleRepo component or undefined if not found\r\n */\r\n static getById(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): ExampleRepo | undefined {\r\n return appObjects.get(id)?.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Ensures an ExampleRepo exists on the AppObject, creating one if needed\r\n * @param appObject The AppObject to check/add the component to\r\n * @returns The existing or newly created ExampleRepo\r\n */\r\n static addIfMissing(appObject: AppObject): ExampleRepo {\r\n const existing = appObject.getComponent<ExampleRepo>(ExampleRepo.type);\r\n if (existing) {\r\n return existing;\r\n } else {\r\n return makeExampleRepo(appObject);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ExampleRepo\r\n * @param appObject The AppObject to attach the repo to\r\n * @returns A new ExampleRepo instance\r\n */\r\nexport function makeExampleRepo(appObject: AppObject): ExampleRepo {\r\n return new ExampleRepoImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExampleRepo\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExampleRepoImp extends ExampleRepo {\r\n /**\r\n * Factory implementation for creating ExampleEntity instances\r\n * @param id The ID for the entity's AppObject\r\n * @returns A newly created ExampleEntity\r\n */\r\n entityFactory(id: string): ExampleEntity {\r\n const ao = this.appObjects.getOrCreate(id);\r\n return makeExampleEntity(ao);\r\n }\r\n\r\n /**\r\n * Deletes an ExampleEntity from the repository by its AppObject ID\r\n * @param id The ID of the entity's AppObject\r\n */\r\n deleteExampleEntity(id: string): void {\r\n const entity = this.getById(id);\r\n if (!entity) return;\r\n\r\n entity.appObject.dispose();\r\n this.removeById(id);\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleRepo.type);\r\n }\r\n}\r\n"]}
@@ -27,7 +27,7 @@ const MemoizedBoolean_1 = require("../../Entities/MemoizedBoolean");
27
27
  * SingletonEntityExample represents a global entity with a boolean property.
28
28
  * As a singleton, only one instance exists in the application.
29
29
  */
30
- class SingletonEntityExample extends AppObject_1.AppObjectEntity {
30
+ class SingletonEntityExample extends AppObject_1.AppObjectSingletonEntity {
31
31
  }
32
32
  exports.SingletonEntityExample = SingletonEntityExample;
33
33
  /** Unique type identifier for this component */
@@ -62,8 +62,6 @@ class SingletonEntityExampleImp extends SingletonEntityExample {
62
62
  super(appObject, SingletonEntityExample.type);
63
63
  // MemoizedBoolean tracks changes to the boolean value and calls notifyOnChange when updated
64
64
  this.memoizedIsAuthoring = new MemoizedBoolean_1.MemoizedBoolean(false, this.notifyOnChange);
65
- // Register this entity as a singleton so it can be accessed globally
66
- this.appObjects.registerSingleton(this);
67
65
  }
68
66
  }
69
67
  //# sourceMappingURL=ExampleSingletonEntity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleSingletonEntity.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleSingletonEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAsCH,gEAIC;AAxCD,+CAIyB;AACzB,iFAA8E;AAC9E,oEAAiE;AAEjE;;;GAGG;AACH,MAAsB,sBAAuB,SAAQ,2BAAe;;AAApE,wDAiBC;AAhBC,gDAAgD;AAChC,2BAAI,GAAG,4BAA4B,CAAC;AAMpD;;;;GAIG;AACI,0BAAG,GAAG,CACX,UAAyB,EACW,EAAE,CACtC,IAAA,6CAAqB,EAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAGnE;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,SAAoB;IAEpB,OAAO,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,yBAA0B,SAAQ,sBAAsB;IAI5D,iDAAiD;IACjD,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,IAAI,aAAa,CAAC,GAAY;QAC5B,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAbhD,4FAA4F;QACpF,wBAAmB,GAAG,IAAI,iCAAe,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAa5E,qEAAqE;QACrE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * ExampleSingletonEntity.ts\r\n * \r\n * This file demonstrates how to implement a singleton entity in the application.\r\n * Singleton entities are special entities that exist only once in the application\r\n * and can be accessed globally from anywhere.\r\n * \r\n * Key concepts:\r\n * - Singleton entities extend AppObjectEntity like regular entities\r\n * - They register themselves as singletons with appObjects.registerSingleton()\r\n * - They're accessed through a static get() method using getSingletonComponent()\r\n * - There's only one instance of a singleton entity in the entire application\r\n * \r\n * Usage pattern:\r\n * 1. Access the singleton entity using the static get() method\r\n * 2. Access or modify properties via getters/setters\r\n * 3. Register change observers to react to property updates\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo\r\n} from \"../../AppObject\";\r\nimport { getSingletonComponent } from \"../../AppObject/getSingletonComponent\";\r\nimport { MemoizedBoolean } from \"../../Entities/MemoizedBoolean\";\r\n\r\n/**\r\n * SingletonEntityExample represents a global entity with a boolean property.\r\n * As a singleton, only one instance exists in the application.\r\n */\r\nexport abstract class SingletonEntityExample extends AppObjectEntity {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"SingletonEntityExampleType\";\r\n\r\n /** Boolean property accessor methods that must be implemented */\r\n abstract get aBoolProperty(): boolean;\r\n abstract set aBoolProperty(val: boolean);\r\n\r\n /**\r\n * Global accessor for the singleton entity\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton entity or undefined if not created yet\r\n */\r\n static get = (\r\n appObjects: AppObjectRepo\r\n ): SingletonEntityExample | undefined =>\r\n getSingletonComponent(SingletonEntityExample.type, appObjects);\r\n}\r\n\r\n/**\r\n * Factory function to create a new SingletonEntityExample\r\n * @param appObject The AppObject to attach the entity to\r\n * @returns A new SingletonEntityExample instance\r\n */\r\nexport function makeSingletonEntityExample(\r\n appObject: AppObject\r\n): SingletonEntityExample {\r\n return new SingletonEntityExampleImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of SingletonEntityExample\r\n * This private class handles the actual implementation details\r\n */\r\nclass SingletonEntityExampleImp extends SingletonEntityExample {\r\n // MemoizedBoolean tracks changes to the boolean value and calls notifyOnChange when updated\r\n private memoizedIsAuthoring = new MemoizedBoolean(false, this.notifyOnChange);\r\n \r\n // Property accessors that use the memoized value\r\n get aBoolProperty() {\r\n return this.memoizedIsAuthoring.val;\r\n }\r\n \r\n set aBoolProperty(val: boolean) {\r\n this.memoizedIsAuthoring.val = val;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, SingletonEntityExample.type);\r\n // Register this entity as a singleton so it can be accessed globally\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ExampleSingletonEntity.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleSingletonEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAsCH,gEAIC;AAxCD,+CAIyB;AACzB,iFAA8E;AAC9E,oEAAiE;AAEjE;;;GAGG;AACH,MAAsB,sBAAuB,SAAQ,oCAAwB;;AAA7E,wDAiBC;AAhBC,gDAAgD;AAChC,2BAAI,GAAG,4BAA4B,CAAC;AAMpD;;;;GAIG;AACI,0BAAG,GAAG,CACX,UAAyB,EACW,EAAE,CACtC,IAAA,6CAAqB,EAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAGnE;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,SAAoB;IAEpB,OAAO,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,yBAA0B,SAAQ,sBAAsB;IAI5D,iDAAiD;IACjD,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,IAAI,aAAa,CAAC,GAAY;QAC5B,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAbhD,4FAA4F;QACpF,wBAAmB,GAAG,IAAI,iCAAe,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAa9E,CAAC;CACF","sourcesContent":["/**\r\n * ExampleSingletonEntity.ts\r\n *\r\n * This file demonstrates how to implement a singleton entity in the application.\r\n * Singleton entities are special entities that exist only once in the application\r\n * and can be accessed globally from anywhere.\r\n *\r\n * Key concepts:\r\n * - Singleton entities extend AppObjectEntity like regular entities\r\n * - They register themselves as singletons with appObjects.registerSingleton()\r\n * - They're accessed through a static get() method using getSingletonComponent()\r\n * - There's only one instance of a singleton entity in the entire application\r\n *\r\n * Usage pattern:\r\n * 1. Access the singleton entity using the static get() method\r\n * 2. Access or modify properties via getters/setters\r\n * 3. Register change observers to react to property updates\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectSingletonEntity,\r\n} from \"../../AppObject\";\r\nimport { getSingletonComponent } from \"../../AppObject/getSingletonComponent\";\r\nimport { MemoizedBoolean } from \"../../Entities/MemoizedBoolean\";\r\n\r\n/**\r\n * SingletonEntityExample represents a global entity with a boolean property.\r\n * As a singleton, only one instance exists in the application.\r\n */\r\nexport abstract class SingletonEntityExample extends AppObjectSingletonEntity {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"SingletonEntityExampleType\";\r\n\r\n /** Boolean property accessor methods that must be implemented */\r\n abstract get aBoolProperty(): boolean;\r\n abstract set aBoolProperty(val: boolean);\r\n\r\n /**\r\n * Global accessor for the singleton entity\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton entity or undefined if not created yet\r\n */\r\n static get = (\r\n appObjects: AppObjectRepo\r\n ): SingletonEntityExample | undefined =>\r\n getSingletonComponent(SingletonEntityExample.type, appObjects);\r\n}\r\n\r\n/**\r\n * Factory function to create a new SingletonEntityExample\r\n * @param appObject The AppObject to attach the entity to\r\n * @returns A new SingletonEntityExample instance\r\n */\r\nexport function makeSingletonEntityExample(\r\n appObject: AppObject\r\n): SingletonEntityExample {\r\n return new SingletonEntityExampleImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of SingletonEntityExample\r\n * This private class handles the actual implementation details\r\n */\r\nclass SingletonEntityExampleImp extends SingletonEntityExample {\r\n // MemoizedBoolean tracks changes to the boolean value and calls notifyOnChange when updated\r\n private memoizedIsAuthoring = new MemoizedBoolean(false, this.notifyOnChange);\r\n\r\n // Property accessors that use the memoized value\r\n get aBoolProperty() {\r\n return this.memoizedIsAuthoring.val;\r\n }\r\n\r\n set aBoolProperty(val: boolean) {\r\n this.memoizedIsAuthoring.val = val;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, SingletonEntityExample.type);\r\n }\r\n}\r\n"]}