@vived/host 4.11.0 → 4.11.2

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 (83) hide show
  1. package/dist/cjs/Apps/Entities/AppEntity.js +75 -14
  2. package/dist/cjs/Apps/Entities/AppEntity.js.map +1 -1
  3. package/dist/cjs/Apps/Factories/AppsFeatureFactory.js +48 -0
  4. package/dist/cjs/Apps/Factories/AppsFeatureFactory.js.map +1 -0
  5. package/dist/cjs/Apps/Factories/index.js +18 -0
  6. package/dist/cjs/Apps/Factories/index.js.map +1 -0
  7. package/dist/cjs/Apps/index.js +1 -0
  8. package/dist/cjs/Apps/index.js.map +1 -1
  9. package/dist/cjs/Assets/UCs/GetAssetBlobURLUC.js +8 -1
  10. package/dist/cjs/Assets/UCs/GetAssetBlobURLUC.js.map +1 -1
  11. package/dist/cjs/VivedAPI/Adapters/apiStageAdapter.js.map +1 -1
  12. package/dist/cjs/VivedAPI/Adapters/index.js.map +1 -1
  13. package/dist/cjs/VivedAPI/Adapters/userTokenAdapter.js.map +1 -1
  14. package/dist/cjs/VivedAPI/Controllers/index.js.map +1 -1
  15. package/dist/cjs/VivedAPI/Controllers/loginUser.js.map +1 -1
  16. package/dist/cjs/VivedAPI/Controllers/logoutUser.js.map +1 -1
  17. package/dist/cjs/VivedAPI/Controllers/setApiStage.js.map +1 -1
  18. package/dist/cjs/VivedAPI/Entities/VivedAPIEntity.js.map +1 -1
  19. package/dist/cjs/VivedAPI/Entities/index.js.map +1 -1
  20. package/dist/cjs/VivedAPI/Factories/index.js.map +1 -1
  21. package/dist/cjs/VivedAPI/Factories/setupVivedAPIForSandbox.js.map +1 -1
  22. package/dist/cjs/VivedAPI/Mocks/MockJsonRequestUC.js.map +1 -1
  23. package/dist/cjs/VivedAPI/Mocks/index.js.map +1 -1
  24. package/dist/cjs/VivedAPI/PMs/ApiStagePM.js.map +1 -1
  25. package/dist/cjs/VivedAPI/PMs/UserTokenPM.js.map +1 -1
  26. package/dist/cjs/VivedAPI/PMs/index.js.map +1 -1
  27. package/dist/cjs/VivedAPI/UCs/BasicFetchUC.js.map +1 -1
  28. package/dist/cjs/VivedAPI/UCs/BlobRequestUC.js.map +1 -1
  29. package/dist/cjs/VivedAPI/UCs/DeleteAssetOnAPIUC.js.map +1 -1
  30. package/dist/cjs/VivedAPI/UCs/FileUploadUC.js.map +1 -1
  31. package/dist/cjs/VivedAPI/UCs/JsonRequestUC.js.map +1 -1
  32. package/dist/cjs/VivedAPI/UCs/PostNewAssetUC.js.map +1 -1
  33. package/dist/cjs/VivedAPI/UCs/SignedAuthTokenUC.js.map +1 -1
  34. package/dist/cjs/VivedAPI/UCs/UserAuthUC.js.map +1 -1
  35. package/dist/cjs/VivedAPI/UCs/index.js.map +1 -1
  36. package/dist/cjs/VivedAPI/index.js.map +1 -1
  37. package/dist/esm/Apps/Entities/AppEntity.js +75 -14
  38. package/dist/esm/Apps/Entities/AppEntity.js.map +1 -1
  39. package/dist/esm/Apps/Factories/AppsFeatureFactory.js +44 -0
  40. package/dist/esm/Apps/Factories/AppsFeatureFactory.js.map +1 -0
  41. package/dist/esm/Apps/Factories/index.js +2 -0
  42. package/dist/esm/Apps/Factories/index.js.map +1 -0
  43. package/dist/esm/Apps/index.js +1 -0
  44. package/dist/esm/Apps/index.js.map +1 -1
  45. package/dist/esm/Assets/UCs/GetAssetBlobURLUC.js +8 -1
  46. package/dist/esm/Assets/UCs/GetAssetBlobURLUC.js.map +1 -1
  47. package/dist/esm/VivedAPI/Adapters/apiStageAdapter.js.map +1 -1
  48. package/dist/esm/VivedAPI/Adapters/index.js.map +1 -1
  49. package/dist/esm/VivedAPI/Adapters/userTokenAdapter.js.map +1 -1
  50. package/dist/esm/VivedAPI/Controllers/index.js.map +1 -1
  51. package/dist/esm/VivedAPI/Controllers/loginUser.js.map +1 -1
  52. package/dist/esm/VivedAPI/Controllers/logoutUser.js.map +1 -1
  53. package/dist/esm/VivedAPI/Controllers/setApiStage.js.map +1 -1
  54. package/dist/esm/VivedAPI/Entities/VivedAPIEntity.js.map +1 -1
  55. package/dist/esm/VivedAPI/Entities/index.js.map +1 -1
  56. package/dist/esm/VivedAPI/Factories/index.js.map +1 -1
  57. package/dist/esm/VivedAPI/Factories/setupVivedAPIForSandbox.js.map +1 -1
  58. package/dist/esm/VivedAPI/Mocks/MockJsonRequestUC.js.map +1 -1
  59. package/dist/esm/VivedAPI/Mocks/index.js.map +1 -1
  60. package/dist/esm/VivedAPI/PMs/ApiStagePM.js.map +1 -1
  61. package/dist/esm/VivedAPI/PMs/UserTokenPM.js.map +1 -1
  62. package/dist/esm/VivedAPI/PMs/index.js.map +1 -1
  63. package/dist/esm/VivedAPI/UCs/BasicFetchUC.js.map +1 -1
  64. package/dist/esm/VivedAPI/UCs/BlobRequestUC.js.map +1 -1
  65. package/dist/esm/VivedAPI/UCs/DeleteAssetOnAPIUC.js.map +1 -1
  66. package/dist/esm/VivedAPI/UCs/FileUploadUC.js.map +1 -1
  67. package/dist/esm/VivedAPI/UCs/JsonRequestUC.js.map +1 -1
  68. package/dist/esm/VivedAPI/UCs/PostNewAssetUC.js.map +1 -1
  69. package/dist/esm/VivedAPI/UCs/SignedAuthTokenUC.js.map +1 -1
  70. package/dist/esm/VivedAPI/UCs/UserAuthUC.js.map +1 -1
  71. package/dist/esm/VivedAPI/UCs/index.js.map +1 -1
  72. package/dist/esm/VivedAPI/index.js.map +1 -1
  73. package/dist/types/Apps/Entities/AppEntity.d.ts +40 -1
  74. package/dist/types/Apps/Entities/AppEntity.d.ts.map +1 -1
  75. package/dist/types/Apps/Factories/AppsFeatureFactory.d.ts +28 -0
  76. package/dist/types/Apps/Factories/AppsFeatureFactory.d.ts.map +1 -0
  77. package/dist/types/Apps/Factories/index.d.ts +2 -0
  78. package/dist/types/Apps/Factories/index.d.ts.map +1 -0
  79. package/dist/types/Apps/index.d.ts +1 -0
  80. package/dist/types/Apps/index.d.ts.map +1 -1
  81. package/dist/types/Assets/UCs/GetAssetBlobURLUC.d.ts +2 -1
  82. package/dist/types/Assets/UCs/GetAssetBlobURLUC.d.ts.map +1 -1
  83. package/package.json +1 -1
@@ -28,14 +28,75 @@ var AppState;
28
28
  * @extends AppObjectEntity from @vived/core
29
29
  */
30
30
  class AppEntity extends core_1.AppObjectEntity {
31
- static get(id, appObjects) {
31
+ /**
32
+ * Retrieves an AppEntity from a specific AppObject
33
+ * @param appObj - The AppObject to retrieve the AppEntity from
34
+ * @returns The AppEntity instance if found, undefined otherwise
35
+ * @throws Error if appObj is null or undefined
36
+ * @example
37
+ * ```typescript
38
+ * const appObject = appObjects.getOrCreate("myApp");
39
+ * const appEntity = AppEntity.get(appObject);
40
+ * ```
41
+ */
42
+ static get(appObj) {
43
+ if (!appObj) {
44
+ throw new Error("AppObject cannot be null or undefined");
45
+ }
46
+ return appObj.getComponent(AppEntity.type);
47
+ }
48
+ /**
49
+ * Retrieves an AppEntity by ID from the AppObjectRepo
50
+ * @param id - The unique identifier of the app
51
+ * @param appObjects - The AppObjectRepo to search within
52
+ * @returns The AppEntity instance if found, undefined otherwise
53
+ * @throws Error if id is empty or appObjects is null
54
+ * @example
55
+ * ```typescript
56
+ * const appEntity = AppEntity.getById("myAppId", appObjects);
57
+ * if (appEntity) {
58
+ * console.log(`Found app: ${appEntity.name}`);
59
+ * }
60
+ * ```
61
+ */
62
+ static getById(id, appObjects) {
63
+ if (!id) {
64
+ throw new Error("ID cannot be empty");
65
+ }
66
+ if (!appObjects) {
67
+ throw new Error("AppObjectRepo cannot be null or undefined");
68
+ }
32
69
  const ao = appObjects.get(id);
33
70
  if (!ao) {
34
- appObjects.submitWarning("AppEntity.get", `Unable to find app object by ID: ${id}`);
71
+ appObjects.submitWarning("AppEntity.getById", `Unable to find app object by ID: ${id}`);
35
72
  return;
36
73
  }
37
74
  return ao.getComponent(AppEntity.type);
38
75
  }
76
+ /**
77
+ * Safely creates an AppEntity if it doesn't already exist on the AppObject
78
+ * @param appObject - The AppObject to add the AppEntity to
79
+ * @returns The AppEntity instance (existing or newly created)
80
+ * @throws Error if appObject is null or undefined
81
+ * @example
82
+ * ```typescript
83
+ * const appObject = appObjects.getOrCreate("newApp");
84
+ * const appEntity = AppEntity.addIfMissing(appObject);
85
+ * // appEntity is guaranteed to exist
86
+ * ```
87
+ */
88
+ static addIfMissing(appObject) {
89
+ if (!appObject) {
90
+ throw new Error("AppObject cannot be null or undefined");
91
+ }
92
+ // Check if AppEntity already exists
93
+ const existingEntity = appObject.getComponent(AppEntity.type);
94
+ if (existingEntity) {
95
+ return existingEntity;
96
+ }
97
+ // Create new AppEntity if it doesn't exist
98
+ return makeAppEntity(appObject);
99
+ }
39
100
  }
40
101
  exports.AppEntity = AppEntity;
41
102
  /** Type identifier for the AppEntity component */
@@ -54,29 +115,29 @@ class AppEntityImp extends AppEntity {
54
115
  return this.appObject.id;
55
116
  }
56
117
  get name() {
57
- return this._memoizedName.val;
118
+ return this.memoizedName.val;
58
119
  }
59
120
  set name(val) {
60
- this._memoizedName.val = val;
121
+ this.memoizedName.val = val;
61
122
  }
62
123
  get description() {
63
- return this._memoizedDescription.val;
124
+ return this.memoizedDescription.val;
64
125
  }
65
126
  set description(val) {
66
- this._memoizedDescription.val = val;
127
+ this.memoizedDescription.val = val;
67
128
  }
68
129
  get image_url() {
69
- return this._memoizedImageUrl.val;
130
+ return this.memoizedImageUrl.val;
70
131
  }
71
132
  set image_url(val) {
72
- this._memoizedImageUrl.val = val;
133
+ this.memoizedImageUrl.val = val;
73
134
  }
74
135
  get imageAssetId() {
75
- const value = this._memoizedImageAssetId.val;
136
+ const value = this.memoizedImageAssetId.val;
76
137
  return value === "" ? undefined : value;
77
138
  }
78
139
  set imageAssetId(val) {
79
- this._memoizedImageAssetId.val = val ?? "";
140
+ this.memoizedImageAssetId.val = val ?? "";
80
141
  }
81
142
  get latestVersion() {
82
143
  return core_1.Version.GetLatest(this.versions);
@@ -130,10 +191,10 @@ class AppEntityImp extends AppEntity {
130
191
  }
131
192
  constructor(appObject) {
132
193
  super(appObject, AppEntity.type);
133
- this._memoizedName = new core_1.MemoizedString("", this.notifyOnChange);
134
- this._memoizedDescription = new core_1.MemoizedString("", this.notifyOnChange);
135
- this._memoizedImageUrl = new core_1.MemoizedString("", this.notifyOnChange);
136
- this._memoizedImageAssetId = new core_1.MemoizedString("", this.notifyOnChange);
194
+ this.memoizedName = new core_1.MemoizedString("", this.notifyOnChange);
195
+ this.memoizedDescription = new core_1.MemoizedString("", this.notifyOnChange);
196
+ this.memoizedImageUrl = new core_1.MemoizedString("", this.notifyOnChange);
197
+ this.memoizedImageAssetId = new core_1.MemoizedString("", this.notifyOnChange);
137
198
  this.versions = [];
138
199
  this._state = AppState.INIT;
139
200
  this._assignedToOwner = false;
@@ -1 +1 @@
1
- {"version":3,"file":"AppEntity.js","sourceRoot":"","sources":["../../../../src/Apps/Entities/AppEntity.ts"],"names":[],"mappings":";;;AA0EA,sCAEC;AA5ED,sCAMqB;AAErB;;;;;;;;GAQG;AACH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED;;;;;;;GAOG;AACH,MAAsB,SAAU,SAAQ,sBAAe;IAIrD,MAAM,CAAC,GAAG,CAAC,EAAU,EAAE,UAAyB;QAC9C,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,aAAa,CACtB,eAAe,EACf,oCAAoC,EAAE,EAAE,CACzC,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,EAAE,CAAC,YAAY,CAAY,SAAS,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;;AAfH,8BAkCC;AAjCC,kDAAkD;AAC3C,cAAI,GAAG,WAAW,CAAC;AAkC5B;;;;;GAKG;AACH,SAAgB,aAA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,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QApH3B,kBAAa,GAAmB,IAAI,qBAAc,CACxD,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,yBAAoB,GAAmB,IAAI,qBAAc,CAC/D,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,sBAAiB,GAAmB,IAAI,qBAAc,CAC5D,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,0BAAqB,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAW5E,aAAQ,GAAc,EAAE,CAAC;QA0BjB,WAAM,GAAa,QAAQ,CAAC,IAAI,CAAC;QASjC,qBAAgB,GAAY,KAAK,CAAC;QAa1C,WAAM,GAAa,EAAE,CAAC;IAmBtB,CAAC;CACF","sourcesContent":["import {\n AppObject,\n AppObjectEntity,\n AppObjectRepo,\n Version,\n MemoizedString\n} from \"@vived/core\";\n\n/**\n * Enum representing the possible states of an application\n *\n * @enum {string}\n * @property {string} INIT - Initial state before app loading starts\n * @property {string} LOADING - App is currently loading resources\n * @property {string} READY - App is loaded and ready to use\n * @property {string} ERROR - App encountered an error during loading\n */\nexport enum AppState {\n INIT = \"INIT\",\n LOADING = \"LOADING\",\n READY = \"READY\",\n ERROR = \"ERROR\"\n}\n\n/**\n * AppEntity - Core entity representing an application in the system\n *\n * This abstract class defines the properties and behaviors of an application.\n * It manages app state, versioning, mounting status, and error handling.\n *\n * @extends AppObjectEntity from @vived/core\n */\nexport abstract class AppEntity extends AppObjectEntity {\n /** Type identifier for the AppEntity component */\n static type = \"AppEntity\";\n\n static get(id: string, appObjects: AppObjectRepo) {\n const ao = appObjects.get(id);\n if (!ao) {\n appObjects.submitWarning(\n \"AppEntity.get\",\n `Unable to find app object by ID: ${id}`\n );\n return;\n }\n\n return ao.getComponent<AppEntity>(AppEntity.type);\n }\n\n abstract get id(): string;\n abstract name: string;\n abstract description: string;\n abstract image_url: string;\n abstract imageAssetId: string | undefined;\n abstract versions: Version[];\n abstract get latestVersion(): Version | undefined;\n abstract errorMessage?: string;\n abstract get hasError(): boolean;\n abstract state: AppState;\n abstract assignedToOwner: boolean;\n\n abstract get isMounted(): boolean;\n abstract appAssetFolderURL?: string;\n abstract get updateIsAvailable(): boolean | undefined;\n abstract styles: string[];\n abstract mountedVersion: Version | undefined;\n}\n\n/**\n * Factory function to create a new AppEntity instance\n *\n * @param appObject - The app object to attach the entity to\n * @returns A concrete implementation of AppEntity\n */\nexport function makeAppEntity(appObject: AppObject): AppEntity {\n return new AppEntityImp(appObject);\n}\n\nclass AppEntityImp extends AppEntity {\n get id() {\n return this.appObject.id;\n }\n\n private _memoizedName: MemoizedString = new MemoizedString(\n \"\",\n this.notifyOnChange\n );\n\n get name(): string {\n return this._memoizedName.val;\n }\n\n set name(val: string) {\n this._memoizedName.val = val;\n }\n\n private _memoizedDescription: MemoizedString = new MemoizedString(\n \"\",\n this.notifyOnChange\n );\n\n get description(): string {\n return this._memoizedDescription.val;\n }\n\n set description(val: string) {\n this._memoizedDescription.val = val;\n }\n\n private _memoizedImageUrl: MemoizedString = new MemoizedString(\n \"\",\n this.notifyOnChange\n );\n\n get image_url(): string {\n return this._memoizedImageUrl.val;\n }\n\n set image_url(val: string) {\n this._memoizedImageUrl.val = val;\n }\n\n private _memoizedImageAssetId = new MemoizedString(\"\", this.notifyOnChange);\n\n get imageAssetId(): string | undefined {\n const value = this._memoizedImageAssetId.val;\n return value === \"\" ? undefined : value;\n }\n\n set imageAssetId(val: string | undefined) {\n this._memoizedImageAssetId.val = val ?? \"\";\n }\n\n versions: Version[] = [];\n\n get latestVersion(): Version | undefined {\n return Version.GetLatest(this.versions);\n }\n\n private _mountedVersion: Version | undefined;\n get mountedVersion() {\n return this._mountedVersion;\n }\n set mountedVersion(val: Version | undefined) {\n if (this._mountedVersion === val) return;\n\n this._mountedVersion = val;\n this.notifyOnChange();\n }\n\n get updateIsAvailable(): boolean | undefined {\n if (this._mountedVersion === undefined) return undefined;\n if (this.latestVersion === undefined) return undefined;\n\n return Version.AreEqual(this._mountedVersion, this.latestVersion)\n ? false\n : true;\n }\n\n private _state: AppState = AppState.INIT;\n get state() {\n return this._state;\n }\n set state(val: AppState) {\n this._state = val;\n this.notifyOnChange();\n }\n\n private _assignedToOwner: boolean = false;\n get assignedToOwner(): boolean {\n return this._assignedToOwner;\n }\n set assignedToOwner(val: boolean) {\n this._assignedToOwner = val;\n this.notifyOnChange();\n }\n\n get isMounted(): boolean {\n return this._mountedVersion === undefined ? false : true;\n }\n\n styles: string[] = [];\n appAssetFolderURL: string | undefined;\n\n private _errorMsg?: string;\n get errorMessage() {\n return this._errorMsg;\n }\n set errorMessage(val: string | undefined) {\n if (this._errorMsg === val) return;\n\n this._errorMsg = val;\n this.notifyOnChange();\n }\n get hasError(): boolean {\n return this._errorMsg === undefined ? false : true;\n }\n\n constructor(appObject: AppObject) {\n super(appObject, AppEntity.type);\n }\n}\n"]}
1
+ {"version":3,"file":"AppEntity.js","sourceRoot":"","sources":["../../../../src/Apps/Entities/AppEntity.ts"],"names":[],"mappings":";;;AA4IA,sCAEC;AA9ID,sCAMqB;AAErB;;;;;;;;GAQG;AACH,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAED;;;;;;;GAOG;AACH,MAAsB,SAAU,SAAQ,sBAAe;IAIrD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,GAAG,CAAC,MAAiB;QAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,MAAM,CAAC,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B,IAAI,qBAAc,CACvD,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,wBAAmB,GAAmB,IAAI,qBAAc,CAC9D,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,qBAAgB,GAAmB,IAAI,qBAAc,CAC3D,EAAE,EACF,IAAI,CAAC,cAAc,CACpB,CAAC;QAUM,yBAAoB,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAW3E,aAAQ,GAAc,EAAE,CAAC;QA0BjB,WAAM,GAAa,QAAQ,CAAC,IAAI,CAAC;QASjC,qBAAgB,GAAY,KAAK,CAAC;QAa1C,WAAM,GAAa,EAAE,CAAC;IAmBtB,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo,\r\n Version,\r\n MemoizedString\r\n} from \"@vived/core\";\r\n\r\n/**\r\n * Enum representing the possible states of an application\r\n *\r\n * @enum {string}\r\n * @property {string} INIT - Initial state before app loading starts\r\n * @property {string} LOADING - App is currently loading resources\r\n * @property {string} READY - App is loaded and ready to use\r\n * @property {string} ERROR - App encountered an error during loading\r\n */\r\nexport enum AppState {\r\n INIT = \"INIT\",\r\n LOADING = \"LOADING\",\r\n READY = \"READY\",\r\n ERROR = \"ERROR\"\r\n}\r\n\r\n/**\r\n * AppEntity - Core entity representing an application in the system\r\n *\r\n * This abstract class defines the properties and behaviors of an application.\r\n * It manages app state, versioning, mounting status, and error handling.\r\n *\r\n * @extends AppObjectEntity from @vived/core\r\n */\r\nexport abstract class AppEntity extends AppObjectEntity {\r\n /** Type identifier for the AppEntity component */\r\n static type = \"AppEntity\";\r\n\r\n /**\r\n * Retrieves an AppEntity from a specific AppObject\r\n * @param appObj - The AppObject to retrieve the AppEntity from\r\n * @returns The AppEntity instance if found, undefined otherwise\r\n * @throws Error if appObj is null or undefined\r\n * @example\r\n * ```typescript\r\n * const appObject = appObjects.getOrCreate(\"myApp\");\r\n * const appEntity = AppEntity.get(appObject);\r\n * ```\r\n */\r\n static get(appObj: AppObject): AppEntity | undefined {\r\n if (!appObj) {\r\n throw new Error(\"AppObject cannot be null or undefined\");\r\n }\r\n return appObj.getComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Retrieves an AppEntity by ID from the AppObjectRepo\r\n * @param id - The unique identifier of the app\r\n * @param appObjects - The AppObjectRepo to search within\r\n * @returns The AppEntity instance if found, undefined otherwise\r\n * @throws Error if id is empty or appObjects is null\r\n * @example\r\n * ```typescript\r\n * const appEntity = AppEntity.getById(\"myAppId\", appObjects);\r\n * if (appEntity) {\r\n * console.log(`Found app: ${appEntity.name}`);\r\n * }\r\n * ```\r\n */\r\n static getById(id: string, appObjects: AppObjectRepo): AppEntity | undefined {\r\n if (!id) {\r\n throw new Error(\"ID cannot be empty\");\r\n }\r\n if (!appObjects) {\r\n throw new Error(\"AppObjectRepo cannot be null or undefined\");\r\n }\r\n\r\n const ao = appObjects.get(id);\r\n if (!ao) {\r\n appObjects.submitWarning(\r\n \"AppEntity.getById\",\r\n `Unable to find app object by ID: ${id}`\r\n );\r\n return;\r\n }\r\n\r\n return ao.getComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Safely creates an AppEntity if it doesn't already exist on the AppObject\r\n * @param appObject - The AppObject to add the AppEntity to\r\n * @returns The AppEntity instance (existing or newly created)\r\n * @throws Error if appObject is null or undefined\r\n * @example\r\n * ```typescript\r\n * const appObject = appObjects.getOrCreate(\"newApp\");\r\n * const appEntity = AppEntity.addIfMissing(appObject);\r\n * // appEntity is guaranteed to exist\r\n * ```\r\n */\r\n static addIfMissing(appObject: AppObject): AppEntity {\r\n if (!appObject) {\r\n throw new Error(\"AppObject cannot be null or undefined\");\r\n }\r\n\r\n // Check if AppEntity already exists\r\n const existingEntity = appObject.getComponent<AppEntity>(AppEntity.type);\r\n if (existingEntity) {\r\n return existingEntity;\r\n }\r\n\r\n // Create new AppEntity if it doesn't exist\r\n return makeAppEntity(appObject);\r\n }\r\n\r\n abstract get id(): string;\r\n abstract name: string;\r\n abstract description: string;\r\n abstract image_url: string;\r\n abstract imageAssetId: string | undefined;\r\n abstract versions: Version[];\r\n abstract get latestVersion(): Version | undefined;\r\n abstract errorMessage?: string;\r\n abstract get hasError(): boolean;\r\n abstract state: AppState;\r\n abstract assignedToOwner: boolean;\r\n\r\n abstract get isMounted(): boolean;\r\n abstract appAssetFolderURL?: string;\r\n abstract get updateIsAvailable(): boolean | undefined;\r\n abstract styles: string[];\r\n abstract mountedVersion: Version | undefined;\r\n}\r\n\r\n/**\r\n * Factory function to create a new AppEntity instance\r\n *\r\n * @param appObject - The app object to attach the entity to\r\n * @returns A concrete implementation of AppEntity\r\n */\r\nexport function makeAppEntity(appObject: AppObject): AppEntity {\r\n return new AppEntityImp(appObject);\r\n}\r\n\r\nclass AppEntityImp extends AppEntity {\r\n get id() {\r\n return this.appObject.id;\r\n }\r\n\r\n private memoizedName: MemoizedString = new MemoizedString(\r\n \"\",\r\n this.notifyOnChange\r\n );\r\n\r\n get name(): string {\r\n return this.memoizedName.val;\r\n }\r\n\r\n set name(val: string) {\r\n this.memoizedName.val = val;\r\n }\r\n\r\n private memoizedDescription: MemoizedString = new MemoizedString(\r\n \"\",\r\n this.notifyOnChange\r\n );\r\n\r\n get description(): string {\r\n return this.memoizedDescription.val;\r\n }\r\n\r\n set description(val: string) {\r\n this.memoizedDescription.val = val;\r\n }\r\n\r\n private memoizedImageUrl: MemoizedString = new MemoizedString(\r\n \"\",\r\n this.notifyOnChange\r\n );\r\n\r\n get image_url(): string {\r\n return this.memoizedImageUrl.val;\r\n }\r\n\r\n set image_url(val: string) {\r\n this.memoizedImageUrl.val = val;\r\n }\r\n\r\n private memoizedImageAssetId = new MemoizedString(\"\", this.notifyOnChange);\r\n\r\n get imageAssetId(): string | undefined {\r\n const value = this.memoizedImageAssetId.val;\r\n return value === \"\" ? undefined : value;\r\n }\r\n\r\n set imageAssetId(val: string | undefined) {\r\n this.memoizedImageAssetId.val = val ?? \"\";\r\n }\r\n\r\n versions: Version[] = [];\r\n\r\n get latestVersion(): Version | undefined {\r\n return Version.GetLatest(this.versions);\r\n }\r\n\r\n private _mountedVersion: Version | undefined;\r\n get mountedVersion() {\r\n return this._mountedVersion;\r\n }\r\n set mountedVersion(val: Version | undefined) {\r\n if (this._mountedVersion === val) return;\r\n\r\n this._mountedVersion = val;\r\n this.notifyOnChange();\r\n }\r\n\r\n get updateIsAvailable(): boolean | undefined {\r\n if (this._mountedVersion === undefined) return undefined;\r\n if (this.latestVersion === undefined) return undefined;\r\n\r\n return Version.AreEqual(this._mountedVersion, this.latestVersion)\r\n ? false\r\n : true;\r\n }\r\n\r\n private _state: AppState = AppState.INIT;\r\n get state() {\r\n return this._state;\r\n }\r\n set state(val: AppState) {\r\n this._state = val;\r\n this.notifyOnChange();\r\n }\r\n\r\n private _assignedToOwner: boolean = false;\r\n get assignedToOwner(): boolean {\r\n return this._assignedToOwner;\r\n }\r\n set assignedToOwner(val: boolean) {\r\n this._assignedToOwner = val;\r\n this.notifyOnChange();\r\n }\r\n\r\n get isMounted(): boolean {\r\n return this._mountedVersion === undefined ? false : true;\r\n }\r\n\r\n styles: string[] = [];\r\n appAssetFolderURL: string | undefined;\r\n\r\n private _errorMsg?: string;\r\n get errorMessage() {\r\n return this._errorMsg;\r\n }\r\n set errorMessage(val: string | undefined) {\r\n if (this._errorMsg === val) return;\r\n\r\n this._errorMsg = val;\r\n this.notifyOnChange();\r\n }\r\n get hasError(): boolean {\r\n return this._errorMsg === undefined ? false : true;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, AppEntity.type);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppsFeatureFactory = void 0;
4
+ const core_1 = require("@vived/core");
5
+ const Entities_1 = require("../Entities");
6
+ const PMs_1 = require("../PMs");
7
+ /**
8
+ * Factory responsible for setting up the Apps domain components.
9
+ * This factory initializes all entities, use cases, and presentation models
10
+ * required for the Apps functionality.
11
+ */
12
+ class AppsFeatureFactory extends core_1.DomainFactory {
13
+ constructor(appObject) {
14
+ super(appObject);
15
+ // Unique name for this factory
16
+ this.factoryName = "AppsFeatureFactory";
17
+ }
18
+ /**
19
+ * Sets up all entities required for the Apps system
20
+ */
21
+ setupEntities() {
22
+ this.appRepoAO = this.appObjects.getOrCreate("App Repository");
23
+ // Initialize entities
24
+ (0, Entities_1.makeAppRepo)(this.appRepoAO);
25
+ }
26
+ /**
27
+ * Sets up all use cases for the Apps system
28
+ */
29
+ setupUCs() {
30
+ // Note: App UCs have complex dependencies and should be set up
31
+ // separately to avoid circular dependencies during factory initialization
32
+ }
33
+ /**
34
+ * Sets up all presentation managers for the Apps system
35
+ */
36
+ setupPMs() {
37
+ // App Repository PMs
38
+ (0, PMs_1.makeAppsListPM)(this.appRepoAO);
39
+ }
40
+ /**
41
+ * Performs any final setup operations after all components are initialized
42
+ */
43
+ finalSetup() {
44
+ // No additional setup required for apps
45
+ }
46
+ }
47
+ exports.AppsFeatureFactory = AppsFeatureFactory;
48
+ //# sourceMappingURL=AppsFeatureFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppsFeatureFactory.js","sourceRoot":"","sources":["../../../../src/Apps/Factories/AppsFeatureFactory.ts"],"names":[],"mappings":";;;AAAA,sCAAuD;AACvD,0CAAyD;AACzD,gCAAmD;AAEnD;;;;GAIG;AACH,MAAa,kBAAmB,SAAQ,oBAAa;IAOnD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,CAAC,CAAC;QAPnB,+BAA+B;QACtB,gBAAW,GAAG,oBAAoB,CAAC;IAO5C,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAE/D,sBAAsB;QACtB,IAAA,sBAAW,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,+DAA+D;QAC/D,0EAA0E;IAC5E,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,qBAAqB;QACrB,IAAA,oBAAc,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,wCAAwC;IAC1C,CAAC;CACF;AA3CD,gDA2CC","sourcesContent":["import { AppObject, DomainFactory } from \"@vived/core\";\r\nimport { makeAppEntity, makeAppRepo } from \"../Entities\";\r\nimport { makeAppPM, makeAppsListPM } from \"../PMs\";\r\n\r\n/**\r\n * Factory responsible for setting up the Apps domain components.\r\n * This factory initializes all entities, use cases, and presentation models\r\n * required for the Apps functionality.\r\n */\r\nexport class AppsFeatureFactory extends DomainFactory {\r\n // Unique name for this factory\r\n readonly factoryName = \"AppsFeatureFactory\";\r\n\r\n // Store references to key AppObjects needed across setup phases\r\n private appRepoAO!: AppObject;\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject);\r\n }\r\n\r\n /**\r\n * Sets up all entities required for the Apps system\r\n */\r\n setupEntities(): void {\r\n this.appRepoAO = this.appObjects.getOrCreate(\"App Repository\");\r\n\r\n // Initialize entities\r\n makeAppRepo(this.appRepoAO);\r\n }\r\n\r\n /**\r\n * Sets up all use cases for the Apps system\r\n */\r\n setupUCs(): void {\r\n // Note: App UCs have complex dependencies and should be set up\r\n // separately to avoid circular dependencies during factory initialization\r\n }\r\n\r\n /**\r\n * Sets up all presentation managers for the Apps system\r\n */\r\n setupPMs(): void {\r\n // App Repository PMs\r\n makeAppsListPM(this.appRepoAO);\r\n }\r\n\r\n /**\r\n * Performs any final setup operations after all components are initialized\r\n */\r\n finalSetup(): void {\r\n // No additional setup required for apps\r\n }\r\n}\r\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AppsFeatureFactory"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Apps/Factories/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./AppsFeatureFactory\";\r\n"]}
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  __exportStar(require("./Adapters"), exports);
37
37
  __exportStar(require("./Controllers"), exports);
38
38
  __exportStar(require("./Entities"), exports);
39
+ __exportStar(require("./Factories"), exports);
39
40
  __exportStar(require("./Mocks"), exports);
40
41
  __exportStar(require("./PMs"), exports);
41
42
  __exportStar(require("./UCs"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Apps/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,0CAAwB;AACxB,wCAAsB;AACtB,wCAAsB","sourcesContent":["/**\n * Apps Module - Core module for managing application lifecycle in the VIVED Learning platform\n *\n * This module handles app loading, mounting, starting, stopping, and state management.\n * It follows a clean architecture pattern with the following layers:\n *\n * - Entities: Core domain models (AppEntity, AppRepo)\n * - PMs (Presentation Models): Business logic and state management\n * - UCs (Use Cases): Implementation of specific operations\n * - Adapters: Connect PMs to UI components\n * - Controllers: Entry points for UI interactions\n *\n * To use this module, typically you would:\n * 1. Load an app using the AppEntity\n * 2. Mount the app using MounterUC\n * 3. Start the app using StartAppUC\n * 4. Manage app state via the AppPM or ActiveAppPM\n * 5. Stop the app using StopAppUC when done\n */\n\nexport * from \"./Adapters\";\nexport * from \"./Controllers\";\nexport * from \"./Entities\";\nexport * from \"./Mocks\";\nexport * from \"./PMs\";\nexport * from \"./UCs\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Apps/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;AAEH,6CAA2B;AAC3B,gDAA8B;AAC9B,6CAA2B;AAC3B,8CAA4B;AAC5B,0CAAwB;AACxB,wCAAsB;AACtB,wCAAsB","sourcesContent":["/**\r\n * Apps Module - Core module for managing application lifecycle in the VIVED Learning platform\r\n *\r\n * This module handles app loading, mounting, starting, stopping, and state management.\r\n * It follows a clean architecture pattern with the following layers:\r\n *\r\n * - Entities: Core domain models (AppEntity, AppRepo)\r\n * - PMs (Presentation Models): Business logic and state management\r\n * - UCs (Use Cases): Implementation of specific operations\r\n * - Adapters: Connect PMs to UI components\r\n * - Controllers: Entry points for UI interactions\r\n *\r\n * To use this module, typically you would:\r\n * 1. Load an app using the AppEntity\r\n * 2. Mount the app using MounterUC\r\n * 3. Start the app using StartAppUC\r\n * 4. Manage app state via the AppPM or ActiveAppPM\r\n * 5. Stop the app using StopAppUC when done\r\n */\r\n\r\nexport * from \"./Adapters\";\r\nexport * from \"./Controllers\";\r\nexport * from \"./Entities\";\r\nexport * from \"./Factories\";\r\nexport * from \"./Mocks\";\r\nexport * from \"./PMs\";\r\nexport * from \"./UCs\";\r\n"]}
@@ -107,9 +107,10 @@ class GetAssetBlobURLUCImp extends GetAssetBlobURLUC {
107
107
  * population of higher-level caches for future access optimization.
108
108
  *
109
109
  * @param assetID - The unique identifier of the asset
110
+ * @param useCache - Optional flag to control caching behavior (defaults to true)
110
111
  * @returns Promise resolving to a blob URL for the asset file
111
112
  */
112
- this.getAssetBlobURL = (assetID) => {
113
+ this.getAssetBlobURL = (assetID, useCache = true) => {
113
114
  const assetRepo = this.assetRepo;
114
115
  const getAsset = this.getAsset;
115
116
  const fetchAssetFile = this.fetchAssetFile;
@@ -118,6 +119,12 @@ class GetAssetBlobURLUCImp extends GetAssetBlobURLUC {
118
119
  if (!assetRepo || !getAsset || !fetchAssetFile) {
119
120
  return Promise.reject();
120
121
  }
122
+ // If cache is disabled, skip all cache checks and go directly to API
123
+ if (!useCache) {
124
+ return new Promise((resolve, reject) => {
125
+ this.fetchAssetNormally(assetID, resolve, reject);
126
+ });
127
+ }
121
128
  // Level 1: Check memory cache (existing entities with blob URLs)
122
129
  const existing = assetRepo.get(assetID);
123
130
  if (existing && existing.blobURL) {
@@ -1 +1 @@
1
- {"version":3,"file":"GetAssetBlobURLUC.js","sourceRoot":"","sources":["../../../../src/Assets/UCs/GetAssetBlobURLUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAoDH,sDAEC;AApDD,sCAKqB;AACrB,6CAAyD;AACzD,uCAAuE;AAEvE,qDAAkD;AAClD,6CAA0C;AAE1C;;;;;GAKG;AACH,MAAsB,iBAAkB,SAAQ,kBAAW;IAYzD;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAC1B,iBAAiB,CAAC,IAAI,EACtB,UAAU,CACX,CAAC;IACJ,CAAC;;AAvBH,8CAwBC;AAvBC,wDAAwD;AACjD,sBAAI,GAAG,mBAAmB,CAAC;AAwBpC;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,SAAoB;IACxD,OAAO,IAAI,oBAAoB,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED;;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AK,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;gBAClB,gDAAgD;gBAChD,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,UAAU,GAAG,CAAC,CAAC;oBAC5B,YAAY,CAAC,cAAc,GAAG,KAAK,CAAC;gBACtC,CAAC;gBACD,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QASA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * GetAssetBlobURLUC.ts\r\n *\r\n * This use case provides optimized asset file retrieval with caching support,\r\n * returning blob URLs for immediate use in web applications.\r\n *\r\n * Key Concepts:\r\n * - Provides blob URLs for asset files with multi-level caching optimization\r\n * - Checks memory cache (existing entities) first for immediate access\r\n * - Falls back to persistent cache (IndexedDB/localStorage) for faster retrieval\r\n * - Finally fetches from remote API when cache misses occur\r\n * - Manages fetch state indicators for UI feedback\r\n * - Automatically stores fetched files in cache for future access\r\n *\r\n * Usage Patterns:\r\n * - Singleton use case accessed through static get() method\r\n * - Called with asset ID to retrieve blob URL for display or download\r\n * - Handles async operations with comprehensive error handling\r\n * - Optimizes performance through multi-level caching strategy\r\n */\r\n\r\nimport {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC\r\n} from \"@vived/core\";\r\nimport { FetchAssetFileFromAPIUC } from \"../../VivedAPI\";\r\nimport { GetAssetFromCacheUC, StoreAssetInCacheUC } from \"../../Cache\";\r\nimport { AssetEntity } from \"../Entities/AssetEntity\";\r\nimport { AssetRepo } from \"../Entities/AssetRepo\";\r\nimport { GetAssetUC } from \"./GetAssetUC\";\r\n\r\n/**\r\n * GetAssetBlobURLUC handles optimized retrieval of asset files as blob URLs.\r\n *\r\n * This singleton use case implements a multi-level caching strategy to minimize\r\n * network requests and provide fast access to asset files for web applications.\r\n */\r\nexport abstract class GetAssetBlobURLUC extends AppObjectUC {\r\n /** Static type identifier for component registration */\r\n static type = \"GetAssetBlobURLUC\";\r\n\r\n /**\r\n * Retrieves a blob URL for the specified asset file.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @returns Promise resolving to a blob URL for immediate use\r\n */\r\n abstract getAssetBlobURL(assetID: string): Promise<string>;\r\n\r\n /**\r\n * Retrieves the singleton GetAssetBlobURLUC instance.\r\n *\r\n * @param appObjects - Repository for accessing the singleton component\r\n * @returns GetAssetBlobURLUC instance or undefined if not found\r\n */\r\n static get(appObjects: AppObjectRepo): GetAssetBlobURLUC | undefined {\r\n return getSingletonComponent<GetAssetBlobURLUC>(\r\n GetAssetBlobURLUC.type,\r\n appObjects\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new GetAssetBlobURLUC instance.\r\n *\r\n * @param appObject - The AppObject that will host this singleton use case\r\n * @returns A new GetAssetBlobURLUC implementation instance\r\n */\r\nexport function makeGetAssetBlobURLUC(appObject: AppObject): GetAssetBlobURLUC {\r\n return new GetAssetBlobURLUCImp(appObject);\r\n}\r\n\r\n/**\r\n * Private implementation of GetAssetBlobURLUC with multi-level caching strategy.\r\n *\r\n * Key Implementation Details:\r\n * - Implements three-tier caching: memory (entities), persistent cache, and remote API\r\n * - Manages fetch state indicators for user feedback during operations\r\n * - Automatically caches fetched files for future access optimization\r\n * - Handles cache failures gracefully with fallback to direct API access\r\n * - Converts between Blob and File objects for compatibility\r\n * - Provides detailed error handling and logging for debugging\r\n */\r\nclass GetAssetBlobURLUCImp extends GetAssetBlobURLUC {\r\n /** Gets the asset repository for entity management and lookup */\r\n private get assetRepo() {\r\n return this.getCachedSingleton<AssetRepo>(AssetRepo.type);\r\n }\r\n\r\n /** Gets the API use case for fetching asset files from remote sources */\r\n private get fetchAssetFile() {\r\n return this.getCachedSingleton<FetchAssetFileFromAPIUC>(\r\n FetchAssetFileFromAPIUC.type\r\n )?.doFetch;\r\n }\r\n\r\n /** Gets the use case for retrieving asset metadata */\r\n private get getAsset() {\r\n return this.getCachedSingleton<GetAssetUC>(GetAssetUC.type)?.getAsset;\r\n }\r\n\r\n /** Gets the use case for retrieving assets from persistent cache */\r\n private get getAssetFromCache() {\r\n return this.getCachedSingleton<GetAssetFromCacheUC>(\r\n GetAssetFromCacheUC.type\r\n )?.getAsset;\r\n }\r\n\r\n /** Gets the use case for storing assets in persistent cache */\r\n private get storeAssetInCache() {\r\n return this.getCachedSingleton<StoreAssetInCacheUC>(\r\n StoreAssetInCacheUC.type\r\n )?.storeAsset;\r\n }\r\n\r\n /**\r\n * Retrieves an asset blob URL using optimized multi-level caching.\r\n *\r\n * This method implements a three-tier caching strategy:\r\n * 1. Memory cache: Check if asset entity already has a blob URL\r\n * 2. Persistent cache: Check IndexedDB/localStorage for cached file\r\n * 3. Remote API: Fetch from backend as last resort\r\n *\r\n * Each level provides progressively better performance, with automatic\r\n * population of higher-level caches for future access optimization.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @returns Promise resolving to a blob URL for the asset file\r\n */\r\n getAssetBlobURL = (assetID: string): Promise<string> => {\r\n const assetRepo = this.assetRepo;\r\n const getAsset = this.getAsset;\r\n const fetchAssetFile = this.fetchAssetFile;\r\n const getAssetFromCache = this.getAssetFromCache;\r\n const storeAssetInCache = this.storeAssetInCache;\r\n\r\n if (!assetRepo || !getAsset || !fetchAssetFile) {\r\n return Promise.reject();\r\n }\r\n\r\n // Level 1: Check memory cache (existing entities with blob URLs)\r\n const existing = assetRepo.get(assetID);\r\n if (existing && existing.blobURL) {\r\n return Promise.resolve(existing.blobURL);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n let fetchedAsset: AssetEntity | undefined;\r\n\r\n // Level 2: Check persistent cache\r\n if (getAssetFromCache) {\r\n getAssetFromCache(assetID)\r\n .then((cachedBlob) => {\r\n if (cachedBlob) {\r\n // Asset found in cache, get metadata and create file\r\n return getAsset(assetID).then((asset) => {\r\n fetchedAsset = asset;\r\n const filename = asset.filename || \"cached-asset\";\r\n return new File([cachedBlob], filename, {\r\n type: cachedBlob.type\r\n });\r\n });\r\n } else {\r\n // Level 3: Fetch from remote API\r\n return getAsset(assetID).then((asset) => {\r\n asset.isFetchingFile = true;\r\n asset.fetchError = undefined;\r\n fetchedAsset = asset;\r\n return fetchAssetFile(asset);\r\n });\r\n }\r\n })\r\n .then((file) => {\r\n if (fetchedAsset) {\r\n // Create blob URL and update entity\r\n fetchedAsset.setFile(file);\r\n fetchedAsset.isFetchingFile = false;\r\n\r\n // Store in cache for future access (if not from cache already)\r\n if (storeAssetInCache) {\r\n storeAssetInCache(\r\n assetID,\r\n new Blob([file], { type: file.type }),\r\n file.type\r\n ).catch((e) => {\r\n this.warn(`Failed to cache asset: ${e.message}`);\r\n });\r\n }\r\n\r\n if (fetchedAsset.blobURL) {\r\n resolve(fetchedAsset.blobURL);\r\n return;\r\n }\r\n }\r\n reject(new Error(\"Blob URL is empty\"));\r\n })\r\n .catch((e: Error) => {\r\n // Cache error, fallback to normal flow\r\n this.warn(`Cache error or fetch error: ${e.message}`);\r\n this.fetchAssetNormally(assetID, resolve, reject);\r\n });\r\n } else {\r\n // No cache available, use direct API access\r\n this.fetchAssetNormally(assetID, resolve, reject);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Helper method for direct asset fetching without cache support.\r\n *\r\n * This method handles the direct API fetch workflow when caching\r\n * is not available or has failed. It still attempts to store the\r\n * result in cache for future optimization.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @param resolve - Success callback with blob URL\r\n * @param reject - Error callback with error details\r\n */\r\n private fetchAssetNormally = (\r\n assetID: string,\r\n resolve: (blobURL: string) => void,\r\n reject: (error: Error) => void\r\n ): void => {\r\n const getAsset = this.getAsset;\r\n const fetchAssetFile = this.fetchAssetFile;\r\n const storeAssetInCache = this.storeAssetInCache;\r\n\r\n if (!getAsset || !fetchAssetFile) {\r\n reject(new Error(\"Required dependencies not found\"));\r\n return;\r\n }\r\n\r\n let fetchedAsset: AssetEntity | undefined;\r\n\r\n getAsset(assetID)\r\n .then((asset) => {\r\n // Set loading state for UI feedback\r\n asset.isFetchingFile = true;\r\n asset.fetchError = undefined;\r\n fetchedAsset = asset;\r\n return fetchAssetFile(asset);\r\n })\r\n .then((file) => {\r\n if (fetchedAsset) {\r\n // Create blob URL and update entity\r\n fetchedAsset.setFile(file);\r\n fetchedAsset.isFetchingFile = false;\r\n\r\n // Store in cache for future optimization (if available)\r\n if (storeAssetInCache) {\r\n storeAssetInCache(\r\n assetID,\r\n new Blob([file], { type: file.type }),\r\n file.type\r\n ).catch((e) => {\r\n this.warn(`Failed to cache asset: ${e.message}`);\r\n });\r\n }\r\n\r\n if (fetchedAsset.blobURL) {\r\n resolve(fetchedAsset.blobURL);\r\n return;\r\n }\r\n }\r\n reject(new Error(\"Blob URL is empty\"));\r\n })\r\n .catch((e: Error) => {\r\n // Handle fetch errors with proper state cleanup\r\n if (fetchedAsset) {\r\n fetchedAsset.fetchError = e;\r\n fetchedAsset.isFetchingFile = false;\r\n }\r\n reject(e);\r\n });\r\n };\r\n\r\n /**\r\n * Initializes the GetAssetBlobURLUC and registers it as a singleton.\r\n *\r\n * @param appObject - The AppObject that will host this singleton use case\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetAssetBlobURLUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"GetAssetBlobURLUC.js","sourceRoot":"","sources":["../../../../src/Assets/UCs/GetAssetBlobURLUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAwDH,sDAEC;AAxDD,sCAKqB;AACrB,6CAAyD;AACzD,uCAAuE;AAEvE,qDAAkD;AAClD,6CAA0C;AAE1C;;;;;GAKG;AACH,MAAsB,iBAAkB,SAAQ,kBAAW;IAgBzD;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QACl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,CAAC;oBAEpC,wDAAwD;oBACxD,IAAI,iBAAiB,EAAE,CAAC;wBACtB,iBAAiB,CACf,OAAO,EACP,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EACrC,IAAI,CAAC,IAAI,CACV,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;4BACZ,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;wBACnD,CAAC,CAAC,CAAC;oBACL,CAAC;oBAED,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;wBACzB,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;wBAC9B,OAAO;oBACT,CAAC;gBACH,CAAC;gBACD,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;gBAClB,gDAAgD;gBAChD,IAAI,YAAY,EAAE,CAAC;oBACjB,YAAY,CAAC,UAAU,GAAG,CAAC,CAAC;oBAC5B,YAAY,CAAC,cAAc,GAAG,KAAK,CAAC;gBACtC,CAAC;gBACD,MAAM,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QASA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * GetAssetBlobURLUC.ts\r\n *\r\n * This use case provides optimized asset file retrieval with caching support,\r\n * returning blob URLs for immediate use in web applications.\r\n *\r\n * Key Concepts:\r\n * - Provides blob URLs for asset files with multi-level caching optimization\r\n * - Checks memory cache (existing entities) first for immediate access\r\n * - Falls back to persistent cache (IndexedDB/localStorage) for faster retrieval\r\n * - Finally fetches from remote API when cache misses occur\r\n * - Manages fetch state indicators for UI feedback\r\n * - Automatically stores fetched files in cache for future access\r\n *\r\n * Usage Patterns:\r\n * - Singleton use case accessed through static get() method\r\n * - Called with asset ID to retrieve blob URL for display or download\r\n * - Handles async operations with comprehensive error handling\r\n * - Optimizes performance through multi-level caching strategy\r\n */\r\n\r\nimport {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC\r\n} from \"@vived/core\";\r\nimport { FetchAssetFileFromAPIUC } from \"../../VivedAPI\";\r\nimport { GetAssetFromCacheUC, StoreAssetInCacheUC } from \"../../Cache\";\r\nimport { AssetEntity } from \"../Entities/AssetEntity\";\r\nimport { AssetRepo } from \"../Entities/AssetRepo\";\r\nimport { GetAssetUC } from \"./GetAssetUC\";\r\n\r\n/**\r\n * GetAssetBlobURLUC handles optimized retrieval of asset files as blob URLs.\r\n *\r\n * This singleton use case implements a multi-level caching strategy to minimize\r\n * network requests and provide fast access to asset files for web applications.\r\n */\r\nexport abstract class GetAssetBlobURLUC extends AppObjectUC {\r\n /** Static type identifier for component registration */\r\n static type = \"GetAssetBlobURLUC\";\r\n\r\n /**\r\n * Retrieves a blob URL for the specified asset file.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @param useCache - Optional flag to control caching behavior (defaults to true)\r\n * @returns Promise resolving to a blob URL for immediate use\r\n */\r\n abstract getAssetBlobURL(\r\n assetID: string,\r\n useCache?: boolean\r\n ): Promise<string>;\r\n\r\n /**\r\n * Retrieves the singleton GetAssetBlobURLUC instance.\r\n *\r\n * @param appObjects - Repository for accessing the singleton component\r\n * @returns GetAssetBlobURLUC instance or undefined if not found\r\n */\r\n static get(appObjects: AppObjectRepo): GetAssetBlobURLUC | undefined {\r\n return getSingletonComponent<GetAssetBlobURLUC>(\r\n GetAssetBlobURLUC.type,\r\n appObjects\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new GetAssetBlobURLUC instance.\r\n *\r\n * @param appObject - The AppObject that will host this singleton use case\r\n * @returns A new GetAssetBlobURLUC implementation instance\r\n */\r\nexport function makeGetAssetBlobURLUC(appObject: AppObject): GetAssetBlobURLUC {\r\n return new GetAssetBlobURLUCImp(appObject);\r\n}\r\n\r\n/**\r\n * Private implementation of GetAssetBlobURLUC with multi-level caching strategy.\r\n *\r\n * Key Implementation Details:\r\n * - Implements three-tier caching: memory (entities), persistent cache, and remote API\r\n * - Manages fetch state indicators for user feedback during operations\r\n * - Automatically caches fetched files for future access optimization\r\n * - Handles cache failures gracefully with fallback to direct API access\r\n * - Converts between Blob and File objects for compatibility\r\n * - Provides detailed error handling and logging for debugging\r\n */\r\nclass GetAssetBlobURLUCImp extends GetAssetBlobURLUC {\r\n /** Gets the asset repository for entity management and lookup */\r\n private get assetRepo() {\r\n return this.getCachedSingleton<AssetRepo>(AssetRepo.type);\r\n }\r\n\r\n /** Gets the API use case for fetching asset files from remote sources */\r\n private get fetchAssetFile() {\r\n return this.getCachedSingleton<FetchAssetFileFromAPIUC>(\r\n FetchAssetFileFromAPIUC.type\r\n )?.doFetch;\r\n }\r\n\r\n /** Gets the use case for retrieving asset metadata */\r\n private get getAsset() {\r\n return this.getCachedSingleton<GetAssetUC>(GetAssetUC.type)?.getAsset;\r\n }\r\n\r\n /** Gets the use case for retrieving assets from persistent cache */\r\n private get getAssetFromCache() {\r\n return this.getCachedSingleton<GetAssetFromCacheUC>(\r\n GetAssetFromCacheUC.type\r\n )?.getAsset;\r\n }\r\n\r\n /** Gets the use case for storing assets in persistent cache */\r\n private get storeAssetInCache() {\r\n return this.getCachedSingleton<StoreAssetInCacheUC>(\r\n StoreAssetInCacheUC.type\r\n )?.storeAsset;\r\n }\r\n\r\n /**\r\n * Retrieves an asset blob URL using optimized multi-level caching.\r\n *\r\n * This method implements a three-tier caching strategy:\r\n * 1. Memory cache: Check if asset entity already has a blob URL\r\n * 2. Persistent cache: Check IndexedDB/localStorage for cached file\r\n * 3. Remote API: Fetch from backend as last resort\r\n *\r\n * Each level provides progressively better performance, with automatic\r\n * population of higher-level caches for future access optimization.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @param useCache - Optional flag to control caching behavior (defaults to true)\r\n * @returns Promise resolving to a blob URL for the asset file\r\n */\r\n getAssetBlobURL = (\r\n assetID: string,\r\n useCache: boolean = true\r\n ): Promise<string> => {\r\n const assetRepo = this.assetRepo;\r\n const getAsset = this.getAsset;\r\n const fetchAssetFile = this.fetchAssetFile;\r\n const getAssetFromCache = this.getAssetFromCache;\r\n const storeAssetInCache = this.storeAssetInCache;\r\n\r\n if (!assetRepo || !getAsset || !fetchAssetFile) {\r\n return Promise.reject();\r\n }\r\n\r\n // If cache is disabled, skip all cache checks and go directly to API\r\n if (!useCache) {\r\n return new Promise((resolve, reject) => {\r\n this.fetchAssetNormally(assetID, resolve, reject);\r\n });\r\n }\r\n\r\n // Level 1: Check memory cache (existing entities with blob URLs)\r\n const existing = assetRepo.get(assetID);\r\n if (existing && existing.blobURL) {\r\n return Promise.resolve(existing.blobURL);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n let fetchedAsset: AssetEntity | undefined;\r\n\r\n // Level 2: Check persistent cache\r\n if (getAssetFromCache) {\r\n getAssetFromCache(assetID)\r\n .then((cachedBlob) => {\r\n if (cachedBlob) {\r\n // Asset found in cache, get metadata and create file\r\n return getAsset(assetID).then((asset) => {\r\n fetchedAsset = asset;\r\n const filename = asset.filename || \"cached-asset\";\r\n return new File([cachedBlob], filename, {\r\n type: cachedBlob.type\r\n });\r\n });\r\n } else {\r\n // Level 3: Fetch from remote API\r\n return getAsset(assetID).then((asset) => {\r\n asset.isFetchingFile = true;\r\n asset.fetchError = undefined;\r\n fetchedAsset = asset;\r\n return fetchAssetFile(asset);\r\n });\r\n }\r\n })\r\n .then((file) => {\r\n if (fetchedAsset) {\r\n // Create blob URL and update entity\r\n fetchedAsset.setFile(file);\r\n fetchedAsset.isFetchingFile = false;\r\n\r\n // Store in cache for future access (if not from cache already)\r\n if (storeAssetInCache) {\r\n storeAssetInCache(\r\n assetID,\r\n new Blob([file], { type: file.type }),\r\n file.type\r\n ).catch((e) => {\r\n this.warn(`Failed to cache asset: ${e.message}`);\r\n });\r\n }\r\n\r\n if (fetchedAsset.blobURL) {\r\n resolve(fetchedAsset.blobURL);\r\n return;\r\n }\r\n }\r\n reject(new Error(\"Blob URL is empty\"));\r\n })\r\n .catch((e: Error) => {\r\n // Cache error, fallback to normal flow\r\n this.warn(`Cache error or fetch error: ${e.message}`);\r\n this.fetchAssetNormally(assetID, resolve, reject);\r\n });\r\n } else {\r\n // No cache available, use direct API access\r\n this.fetchAssetNormally(assetID, resolve, reject);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Helper method for direct asset fetching without cache support.\r\n *\r\n * This method handles the direct API fetch workflow when caching\r\n * is not available or has failed. It still attempts to store the\r\n * result in cache for future optimization.\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @param resolve - Success callback with blob URL\r\n * @param reject - Error callback with error details\r\n */\r\n private fetchAssetNormally = (\r\n assetID: string,\r\n resolve: (blobURL: string) => void,\r\n reject: (error: Error) => void\r\n ): void => {\r\n const getAsset = this.getAsset;\r\n const fetchAssetFile = this.fetchAssetFile;\r\n const storeAssetInCache = this.storeAssetInCache;\r\n\r\n if (!getAsset || !fetchAssetFile) {\r\n reject(new Error(\"Required dependencies not found\"));\r\n return;\r\n }\r\n\r\n let fetchedAsset: AssetEntity | undefined;\r\n\r\n getAsset(assetID)\r\n .then((asset) => {\r\n // Set loading state for UI feedback\r\n asset.isFetchingFile = true;\r\n asset.fetchError = undefined;\r\n fetchedAsset = asset;\r\n return fetchAssetFile(asset);\r\n })\r\n .then((file) => {\r\n if (fetchedAsset) {\r\n // Create blob URL and update entity\r\n fetchedAsset.setFile(file);\r\n fetchedAsset.isFetchingFile = false;\r\n\r\n // Store in cache for future optimization (if available)\r\n if (storeAssetInCache) {\r\n storeAssetInCache(\r\n assetID,\r\n new Blob([file], { type: file.type }),\r\n file.type\r\n ).catch((e) => {\r\n this.warn(`Failed to cache asset: ${e.message}`);\r\n });\r\n }\r\n\r\n if (fetchedAsset.blobURL) {\r\n resolve(fetchedAsset.blobURL);\r\n return;\r\n }\r\n }\r\n reject(new Error(\"Blob URL is empty\"));\r\n })\r\n .catch((e: Error) => {\r\n // Handle fetch errors with proper state cleanup\r\n if (fetchedAsset) {\r\n fetchedAsset.fetchError = e;\r\n fetchedAsset.isFetchingFile = false;\r\n }\r\n reject(e);\r\n });\r\n };\r\n\r\n /**\r\n * Initializes the GetAssetBlobURLUC and registers it as a singleton.\r\n *\r\n * @param appObject - The AppObject that will host this singleton use case\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetAssetBlobURLUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"apiStageAdapter.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/apiStageAdapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAGH,0CAAuC;AACvC,kDAA+C;AAE/C;;;GAGG;AACU,QAAA,eAAe,GAAiC;IAC3D,6DAA6D;IAC7D,SAAS,EAAE,mBAAQ,CAAC,UAAU;IAE9B;;;;OAIG;IACH,SAAS,EAAE,CAAC,UAAyB,EAAE,KAA6B,EAAE,EAAE;QACtE,MAAM,EAAE,GAAG,uBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CAAC;YACvE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,WAAW,EAAE,CAAC,UAAyB,EAAE,KAA6B,EAAE,EAAE;QACxE,MAAM,EAAE,GAAG,uBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CAAC;YACvE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/**\r\n * apiStageAdapter.ts\r\n * \r\n * This file defines an adapter for connecting API stage presentation logic to UI frameworks.\r\n * The apiStageAdapter provides a standardized interface for binding API stage configuration\r\n * to view components, handling subscriptions and view model updates.\r\n * \r\n * Key concepts:\r\n * - Adapter implements SingletonPmAdapter interface for UI framework integration\r\n * - Manages subscription lifecycle for view components\r\n * - Provides default view model values for initialization\r\n * - Handles error cases when presentation manager is unavailable\r\n * - Enables reactive UI updates when API stage configuration changes\r\n * \r\n * Usage pattern:\r\n * 1. UI frameworks use this adapter to bind to API stage state\r\n * 2. Adapter manages PM subscriptions and view function callbacks\r\n * 3. View components receive API stage updates automatically\r\n * 4. Proper cleanup handled through unsubscribe mechanism\r\n */\r\n\r\nimport { AppObjectRepo, SingletonPmAdapter } from \"@vived/core\";\r\nimport { APIStage } from \"../Entities\";\r\nimport { ApiStagePM } from \"../PMs/ApiStagePM\";\r\n\r\n/**\r\n * Adapter for connecting API stage presentation logic to UI frameworks.\r\n * Implements SingletonPmAdapter to provide standardized view binding for API stage configuration.\r\n */\r\nexport const apiStageAdapter: SingletonPmAdapter<APIStage> = {\r\n /** Default view model value used when PM is not available */\r\n defaultVM: APIStage.PRODUCTION,\r\n \r\n /**\r\n * Subscribes a view function to receive API stage updates\r\n * @param appObjects The AppObjectRepo containing the ApiStagePM\r\n * @param setVM Callback function to update the view with new API stage values\r\n */\r\n subscribe: (appObjects: AppObjectRepo, setVM: (vm: APIStage) => void) => {\r\n const pm = ApiStagePM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"apiStageAdapter\", \"Unable to find ApiStagePM\");\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n \r\n /**\r\n * Unsubscribes a view function from API stage updates\r\n * @param appObjects The AppObjectRepo containing the ApiStagePM\r\n * @param setVM Callback function to remove from view updates\r\n */\r\n unsubscribe: (appObjects: AppObjectRepo, setVM: (vm: APIStage) => void) => {\r\n const pm = ApiStagePM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"apiStageAdapter\", \"Unable to find ApiStagePM\");\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"apiStageAdapter.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/apiStageAdapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAGH,0CAAuC;AACvC,kDAA+C;AAE/C;;;GAGG;AACU,QAAA,eAAe,GAAiC;IAC3D,6DAA6D;IAC7D,SAAS,EAAE,mBAAQ,CAAC,UAAU;IAE9B;;;;OAIG;IACH,SAAS,EAAE,CAAC,UAAyB,EAAE,KAA6B,EAAE,EAAE;QACtE,MAAM,EAAE,GAAG,uBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CAAC;YACvE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,WAAW,EAAE,CAAC,UAAyB,EAAE,KAA6B,EAAE,EAAE;QACxE,MAAM,EAAE,GAAG,uBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,iBAAiB,EAAE,2BAA2B,CAAC,CAAC;YACvE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/**\r\n * apiStageAdapter.ts\r\n *\r\n * This file defines an adapter for connecting API stage presentation logic to UI frameworks.\r\n * The apiStageAdapter provides a standardized interface for binding API stage configuration\r\n * to view components, handling subscriptions and view model updates.\r\n *\r\n * Key concepts:\r\n * - Adapter implements SingletonPmAdapter interface for UI framework integration\r\n * - Manages subscription lifecycle for view components\r\n * - Provides default view model values for initialization\r\n * - Handles error cases when presentation manager is unavailable\r\n * - Enables reactive UI updates when API stage configuration changes\r\n *\r\n * Usage pattern:\r\n * 1. UI frameworks use this adapter to bind to API stage state\r\n * 2. Adapter manages PM subscriptions and view function callbacks\r\n * 3. View components receive API stage updates automatically\r\n * 4. Proper cleanup handled through unsubscribe mechanism\r\n */\r\n\r\nimport { AppObjectRepo, SingletonPmAdapter } from \"@vived/core\";\r\nimport { APIStage } from \"../Entities\";\r\nimport { ApiStagePM } from \"../PMs/ApiStagePM\";\r\n\r\n/**\r\n * Adapter for connecting API stage presentation logic to UI frameworks.\r\n * Implements SingletonPmAdapter to provide standardized view binding for API stage configuration.\r\n */\r\nexport const apiStageAdapter: SingletonPmAdapter<APIStage> = {\r\n /** Default view model value used when PM is not available */\r\n defaultVM: APIStage.PRODUCTION,\r\n\r\n /**\r\n * Subscribes a view function to receive API stage updates\r\n * @param appObjects The AppObjectRepo containing the ApiStagePM\r\n * @param setVM Callback function to update the view with new API stage values\r\n */\r\n subscribe: (appObjects: AppObjectRepo, setVM: (vm: APIStage) => void) => {\r\n const pm = ApiStagePM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"apiStageAdapter\", \"Unable to find ApiStagePM\");\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n\r\n /**\r\n * Unsubscribes a view function from API stage updates\r\n * @param appObjects The AppObjectRepo containing the ApiStagePM\r\n * @param setVM Callback function to remove from view updates\r\n */\r\n unsubscribe: (appObjects: AppObjectRepo, setVM: (vm: APIStage) => void) => {\r\n const pm = ApiStagePM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"apiStageAdapter\", \"Unable to find ApiStagePM\");\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;AAEH,oDAAkC;AAClC,qDAAmC","sourcesContent":["/**\r\n * VivedAPI Adapters Index\r\n * \r\n * This module exports all adapter objects for the VivedAPI feature.\r\n * Adapters provide standardized interfaces for connecting presentation managers\r\n * to various UI frameworks and libraries, handling subscription lifecycles\r\n * and view model synchronization.\r\n * \r\n * Key Concepts:\r\n * - Adapters implement framework-specific integration patterns\r\n * - They manage subscription and unsubscription to presentation manager updates\r\n * - Adapters provide default view model values for initialization\r\n * - They handle error cases when presentation managers are unavailable\r\n * - Adapters enable reactive UI updates across different frontend technologies\r\n * \r\n * Available Adapters:\r\n * - apiStageAdapter: Connects API stage configuration to UI components\r\n * - userTokenAdapter: Connects user authentication token state to UI displays\r\n */\r\n\r\nexport * from \"./apiStageAdapter\";\r\nexport * from \"./userTokenAdapter\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;AAEH,oDAAkC;AAClC,qDAAmC","sourcesContent":["/**\r\n * VivedAPI Adapters Index\r\n *\r\n * This module exports all adapter objects for the VivedAPI feature.\r\n * Adapters provide standardized interfaces for connecting presentation managers\r\n * to various UI frameworks and libraries, handling subscription lifecycles\r\n * and view model synchronization.\r\n *\r\n * Key Concepts:\r\n * - Adapters implement framework-specific integration patterns\r\n * - They manage subscription and unsubscription to presentation manager updates\r\n * - Adapters provide default view model values for initialization\r\n * - They handle error cases when presentation managers are unavailable\r\n * - Adapters enable reactive UI updates across different frontend technologies\r\n *\r\n * Available Adapters:\r\n * - apiStageAdapter: Connects API stage configuration to UI components\r\n * - userTokenAdapter: Connects user authentication token state to UI displays\r\n */\r\n\r\nexport * from \"./apiStageAdapter\";\r\nexport * from \"./userTokenAdapter\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"userTokenAdapter.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/userTokenAdapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAGH,oDAAiD;AAEjD;;;GAGG;AACU,QAAA,gBAAgB,GAA+B;IAC1D,6DAA6D;IAC7D,SAAS,EAAE,EAAE;IAEb;;;;OAIG;IACH,SAAS,EAAE,CAAC,UAAyB,EAAE,KAA2B,EAAE,EAAE;QACpE,MAAM,EAAE,GAAG,yBAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC;YACzE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,WAAW,EAAE,CAAC,UAAyB,EAAE,KAA2B,EAAE,EAAE;QACtE,MAAM,EAAE,GAAG,yBAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC;YACzE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/**\r\n * userTokenAdapter.ts\r\n * \r\n * This file defines an adapter for connecting user token presentation logic to UI frameworks.\r\n * The userTokenAdapter provides a standardized interface for binding user authentication\r\n * token state to view components, handling subscriptions and view model updates.\r\n * \r\n * Key concepts:\r\n * - Adapter implements SingletonPmAdapter interface for UI framework integration\r\n * - Manages subscription lifecycle for view components displaying user tokens\r\n * - Provides default view model values for initialization (empty string)\r\n * - Handles error cases when presentation manager is unavailable\r\n * - Enables reactive UI updates when user authentication token changes\r\n * \r\n * Usage pattern:\r\n * 1. UI frameworks use this adapter to bind to user token state\r\n * 2. Adapter manages PM subscriptions and view function callbacks\r\n * 3. View components receive token updates automatically\r\n * 4. Proper cleanup handled through unsubscribe mechanism\r\n */\r\n\r\nimport { AppObjectRepo, SingletonPmAdapter } from \"@vived/core\";\r\nimport { UserTokenPM } from \"../PMs/UserTokenPM\";\r\n\r\n/**\r\n * Adapter for connecting user token presentation logic to UI frameworks.\r\n * Implements SingletonPmAdapter to provide standardized view binding for user authentication tokens.\r\n */\r\nexport const userTokenAdapter: SingletonPmAdapter<string> = {\r\n /** Default view model value used when PM is not available */\r\n defaultVM: \"\",\r\n \r\n /**\r\n * Subscribes a view function to receive user token updates\r\n * @param appObjects The AppObjectRepo containing the UserTokenPM\r\n * @param setVM Callback function to update the view with new token values\r\n */\r\n subscribe: (appObjects: AppObjectRepo, setVM: (vm: string) => void) => {\r\n const pm = UserTokenPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"userTokenAdapter\", \"Unable to find UserTokenPM\");\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n \r\n /**\r\n * Unsubscribes a view function from user token updates\r\n * @param appObjects The AppObjectRepo containing the UserTokenPM\r\n * @param setVM Callback function to remove from view updates\r\n */\r\n unsubscribe: (appObjects: AppObjectRepo, setVM: (vm: string) => void) => {\r\n const pm = UserTokenPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"userTokenAdapter\", \"Unable to find UserTokenPM\");\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
1
+ {"version":3,"file":"userTokenAdapter.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Adapters/userTokenAdapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAGH,oDAAiD;AAEjD;;;GAGG;AACU,QAAA,gBAAgB,GAA+B;IAC1D,6DAA6D;IAC7D,SAAS,EAAE,EAAE;IAEb;;;;OAIG;IACH,SAAS,EAAE,CAAC,UAAyB,EAAE,KAA2B,EAAE,EAAE;QACpE,MAAM,EAAE,GAAG,yBAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC;YACzE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,WAAW,EAAE,CAAC,UAAyB,EAAE,KAA2B,EAAE,EAAE;QACtE,MAAM,EAAE,GAAG,yBAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,UAAU,CAAC,WAAW,CAAC,kBAAkB,EAAE,4BAA4B,CAAC,CAAC;YACzE,OAAO;QACT,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;CACF,CAAC","sourcesContent":["/**\r\n * userTokenAdapter.ts\r\n *\r\n * This file defines an adapter for connecting user token presentation logic to UI frameworks.\r\n * The userTokenAdapter provides a standardized interface for binding user authentication\r\n * token state to view components, handling subscriptions and view model updates.\r\n *\r\n * Key concepts:\r\n * - Adapter implements SingletonPmAdapter interface for UI framework integration\r\n * - Manages subscription lifecycle for view components displaying user tokens\r\n * - Provides default view model values for initialization (empty string)\r\n * - Handles error cases when presentation manager is unavailable\r\n * - Enables reactive UI updates when user authentication token changes\r\n *\r\n * Usage pattern:\r\n * 1. UI frameworks use this adapter to bind to user token state\r\n * 2. Adapter manages PM subscriptions and view function callbacks\r\n * 3. View components receive token updates automatically\r\n * 4. Proper cleanup handled through unsubscribe mechanism\r\n */\r\n\r\nimport { AppObjectRepo, SingletonPmAdapter } from \"@vived/core\";\r\nimport { UserTokenPM } from \"../PMs/UserTokenPM\";\r\n\r\n/**\r\n * Adapter for connecting user token presentation logic to UI frameworks.\r\n * Implements SingletonPmAdapter to provide standardized view binding for user authentication tokens.\r\n */\r\nexport const userTokenAdapter: SingletonPmAdapter<string> = {\r\n /** Default view model value used when PM is not available */\r\n defaultVM: \"\",\r\n\r\n /**\r\n * Subscribes a view function to receive user token updates\r\n * @param appObjects The AppObjectRepo containing the UserTokenPM\r\n * @param setVM Callback function to update the view with new token values\r\n */\r\n subscribe: (appObjects: AppObjectRepo, setVM: (vm: string) => void) => {\r\n const pm = UserTokenPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"userTokenAdapter\", \"Unable to find UserTokenPM\");\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n\r\n /**\r\n * Unsubscribes a view function from user token updates\r\n * @param appObjects The AppObjectRepo containing the UserTokenPM\r\n * @param setVM Callback function to remove from view updates\r\n */\r\n unsubscribe: (appObjects: AppObjectRepo, setVM: (vm: string) => void) => {\r\n const pm = UserTokenPM.get(appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"userTokenAdapter\", \"Unable to find UserTokenPM\");\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,+CAA6B;AAC7B,6DAA2C;AAC3C,gDAA8B","sourcesContent":["/**\r\n * VivedAPI Controllers Index\r\n * \r\n * This module exports all controller functions for the VivedAPI feature.\r\n * Controllers handle user input and coordinate operations between UI components\r\n * and the underlying business logic components.\r\n * \r\n * Key Concepts:\r\n * - Controllers provide simple function interfaces for common operations\r\n * - They validate inputs and handle error cases appropriately\r\n * - Controllers coordinate between use cases, entities, and external systems\r\n * - They serve as the primary interface for UI framework integration\r\n * - Error handling and logging are managed at the controller level\r\n * \r\n * Available Controllers:\r\n * - User Authentication: loginUser, logoutUser, refreshAuthenticatedUser\r\n * - API Configuration: setApiStage\r\n */\r\n\r\nexport * from \"./loginUser\";\r\nexport * from \"./logoutUser\";\r\nexport * from \"./refreshAuthenticatedUser\";\r\nexport * from \"./setApiStage\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,+CAA6B;AAC7B,6DAA2C;AAC3C,gDAA8B","sourcesContent":["/**\r\n * VivedAPI Controllers Index\r\n *\r\n * This module exports all controller functions for the VivedAPI feature.\r\n * Controllers handle user input and coordinate operations between UI components\r\n * and the underlying business logic components.\r\n *\r\n * Key Concepts:\r\n * - Controllers provide simple function interfaces for common operations\r\n * - They validate inputs and handle error cases appropriately\r\n * - Controllers coordinate between use cases, entities, and external systems\r\n * - They serve as the primary interface for UI framework integration\r\n * - Error handling and logging are managed at the controller level\r\n *\r\n * Available Controllers:\r\n * - User Authentication: loginUser, logoutUser, refreshAuthenticatedUser\r\n * - API Configuration: setApiStage\r\n */\r\n\r\nexport * from \"./loginUser\";\r\nexport * from \"./logoutUser\";\r\nexport * from \"./refreshAuthenticatedUser\";\r\nexport * from \"./setApiStage\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"loginUser.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/loginUser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAYH,8BAaC;AAtBD,gCAAoC;AAEpC;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,QAAgB,EAChB,QAAgB,EAChB,UAAyB;IAEzB,MAAM,EAAE,GAAG,gBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEtC,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,WAAW,EAAE,2BAA2B,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * loginUser.ts\r\n * \r\n * This file defines a controller function for user authentication login operations.\r\n * The loginUser controller provides a simple interface for authenticating users\r\n * with username and password credentials through the VIVED API.\r\n * \r\n * Key concepts:\r\n * - Controller functions handle user input and direct authentication operations\r\n * - Validates UserAuthUC existence before performing login operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Returns promises for async authentication workflows\r\n * - Coordinates with UserAuthUC for actual authentication logic\r\n * \r\n * Usage pattern:\r\n * 1. Call loginUser with credentials and appObjects repository\r\n * 2. Controller validates UC existence and initiates login workflow\r\n * 3. Handle returned Promise for authentication success or failure\r\n * 4. Error handling provides feedback if authentication UC is unavailable\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { UserAuthUC } from \"../UCs\";\r\n\r\n/**\r\n * Authenticates a user with username and password credentials\r\n * @param userName The user's login username\r\n * @param password The user's login password\r\n * @param appObjects The AppObjectRepo containing the UserAuthUC\r\n * @returns Promise that resolves when login is complete or rejects on error\r\n */\r\nexport function loginUser(\r\n userName: string,\r\n password: string,\r\n appObjects: AppObjectRepo\r\n): Promise<void> {\r\n const uc = UserAuthUC.get(appObjects);\r\n\r\n if (uc) {\r\n return uc.login(userName, password);\r\n } else {\r\n appObjects.submitWarning(\"loginUser\", \"Unable to find UserAuthUC\");\r\n return Promise.reject(new Error(\"Unable to find UserAuthUC\"));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"loginUser.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/loginUser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAYH,8BAaC;AAtBD,gCAAoC;AAEpC;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,QAAgB,EAChB,QAAgB,EAChB,UAAyB;IAEzB,MAAM,EAAE,GAAG,gBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEtC,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,WAAW,EAAE,2BAA2B,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * loginUser.ts\r\n *\r\n * This file defines a controller function for user authentication login operations.\r\n * The loginUser controller provides a simple interface for authenticating users\r\n * with username and password credentials through the VIVED API.\r\n *\r\n * Key concepts:\r\n * - Controller functions handle user input and direct authentication operations\r\n * - Validates UserAuthUC existence before performing login operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Returns promises for async authentication workflows\r\n * - Coordinates with UserAuthUC for actual authentication logic\r\n *\r\n * Usage pattern:\r\n * 1. Call loginUser with credentials and appObjects repository\r\n * 2. Controller validates UC existence and initiates login workflow\r\n * 3. Handle returned Promise for authentication success or failure\r\n * 4. Error handling provides feedback if authentication UC is unavailable\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { UserAuthUC } from \"../UCs\";\r\n\r\n/**\r\n * Authenticates a user with username and password credentials\r\n * @param userName The user's login username\r\n * @param password The user's login password\r\n * @param appObjects The AppObjectRepo containing the UserAuthUC\r\n * @returns Promise that resolves when login is complete or rejects on error\r\n */\r\nexport function loginUser(\r\n userName: string,\r\n password: string,\r\n appObjects: AppObjectRepo\r\n): Promise<void> {\r\n const uc = UserAuthUC.get(appObjects);\r\n\r\n if (uc) {\r\n return uc.login(userName, password);\r\n } else {\r\n appObjects.submitWarning(\"loginUser\", \"Unable to find UserAuthUC\");\r\n return Promise.reject(new Error(\"Unable to find UserAuthUC\"));\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logoutUser.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/logoutUser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,gCASC;AAhBD,gCAAoC;AAEpC;;;;GAIG;AACH,SAAgB,UAAU,CAAC,UAAyB;IAClD,MAAM,EAAE,GAAG,gBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEtC,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * logoutUser.ts\r\n * \r\n * This file defines a controller function for user logout operations.\r\n * The logoutUser controller provides a simple interface for terminating user\r\n * sessions and clearing authentication state through the VIVED API.\r\n * \r\n * Key concepts:\r\n * - Controller functions handle user input and direct logout operations\r\n * - Validates UserAuthUC existence before performing logout operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Returns promises for async logout workflows\r\n * - Coordinates with UserAuthUC for actual logout logic\r\n * \r\n * Usage pattern:\r\n * 1. Call logoutUser with appObjects repository\r\n * 2. Controller validates UC existence and initiates logout workflow\r\n * 3. Handle returned Promise for logout success or failure\r\n * 4. Error handling provides feedback if authentication UC is unavailable\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { UserAuthUC } from \"../UCs\";\r\n\r\n/**\r\n * Logs out the current user and terminates the session\r\n * @param appObjects The AppObjectRepo containing the UserAuthUC\r\n * @returns Promise that resolves when logout is complete or rejects on error\r\n */\r\nexport function logoutUser(appObjects: AppObjectRepo): Promise<void> {\r\n const uc = UserAuthUC.get(appObjects);\r\n\r\n if (uc) {\r\n return uc.logout();\r\n } else {\r\n appObjects.submitWarning(\"logoutUser\", \"Unable to find UserAuthUC\");\r\n return Promise.reject(new Error(\"Unable to find UserAuthUC\"));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"logoutUser.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/logoutUser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,gCASC;AAhBD,gCAAoC;AAEpC;;;;GAIG;AACH,SAAgB,UAAU,CAAC,UAAyB;IAClD,MAAM,EAAE,GAAG,gBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAEtC,IAAI,EAAE,EAAE,CAAC;QACP,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;QACpE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * logoutUser.ts\r\n *\r\n * This file defines a controller function for user logout operations.\r\n * The logoutUser controller provides a simple interface for terminating user\r\n * sessions and clearing authentication state through the VIVED API.\r\n *\r\n * Key concepts:\r\n * - Controller functions handle user input and direct logout operations\r\n * - Validates UserAuthUC existence before performing logout operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Returns promises for async logout workflows\r\n * - Coordinates with UserAuthUC for actual logout logic\r\n *\r\n * Usage pattern:\r\n * 1. Call logoutUser with appObjects repository\r\n * 2. Controller validates UC existence and initiates logout workflow\r\n * 3. Handle returned Promise for logout success or failure\r\n * 4. Error handling provides feedback if authentication UC is unavailable\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { UserAuthUC } from \"../UCs\";\r\n\r\n/**\r\n * Logs out the current user and terminates the session\r\n * @param appObjects The AppObjectRepo containing the UserAuthUC\r\n * @returns Promise that resolves when logout is complete or rejects on error\r\n */\r\nexport function logoutUser(appObjects: AppObjectRepo): Promise<void> {\r\n const uc = UserAuthUC.get(appObjects);\r\n\r\n if (uc) {\r\n return uc.logout();\r\n } else {\r\n appObjects.submitWarning(\"logoutUser\", \"Unable to find UserAuthUC\");\r\n return Promise.reject(new Error(\"Unable to find UserAuthUC\"));\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setApiStage.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/setApiStage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,kCAOC;AAdD,0CAAuD;AAEvD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,KAAe,EAAE,UAAyB;IACpE,MAAM,OAAO,GAAG,yBAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,+BAA+B,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * setApiStage.ts\r\n * \r\n * This file defines a controller function for setting the API stage configuration.\r\n * The setApiStage controller provides a simple interface for changing the API environment\r\n * that the application communicates with.\r\n * \r\n * Key concepts:\r\n * - Controller functions handle user input and direct operations\r\n * - Validates entity existence before performing operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Updates the VivedAPIEntity singleton with new stage configuration\r\n * - Triggers change notifications to update dependent components\r\n * \r\n * Usage pattern:\r\n * 1. Call setApiStage with desired stage and appObjects repository\r\n * 2. Controller validates entity existence and updates configuration\r\n * 3. Change notifications propagate to PMs and UI components\r\n * 4. Error handling provides feedback if entity is not available\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { APIStage, VivedAPIEntity } from \"../Entities\";\r\n\r\n/**\r\n * Sets the API stage configuration for the application\r\n * @param stage The APIStage to set as the current environment\r\n * @param appObjects The AppObjectRepo containing the VivedAPIEntity singleton\r\n */\r\nexport function setApiStage(stage: APIStage, appObjects: AppObjectRepo) {\r\n const sandbox = VivedAPIEntity.get(appObjects);\r\n if (sandbox) {\r\n sandbox.apiStage = stage;\r\n } else {\r\n appObjects.submitWarning(\"setApiStage\", \"Unable to find VivedAPIEntity\");\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"setApiStage.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Controllers/setApiStage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,kCAOC;AAdD,0CAAuD;AAEvD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,KAAe,EAAE,UAAyB;IACpE,MAAM,OAAO,GAAG,yBAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,+BAA+B,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["/**\r\n * setApiStage.ts\r\n *\r\n * This file defines a controller function for setting the API stage configuration.\r\n * The setApiStage controller provides a simple interface for changing the API environment\r\n * that the application communicates with.\r\n *\r\n * Key concepts:\r\n * - Controller functions handle user input and direct operations\r\n * - Validates entity existence before performing operations\r\n * - Provides error handling and warning messages for missing components\r\n * - Updates the VivedAPIEntity singleton with new stage configuration\r\n * - Triggers change notifications to update dependent components\r\n *\r\n * Usage pattern:\r\n * 1. Call setApiStage with desired stage and appObjects repository\r\n * 2. Controller validates entity existence and updates configuration\r\n * 3. Change notifications propagate to PMs and UI components\r\n * 4. Error handling provides feedback if entity is not available\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { APIStage, VivedAPIEntity } from \"../Entities\";\r\n\r\n/**\r\n * Sets the API stage configuration for the application\r\n * @param stage The APIStage to set as the current environment\r\n * @param appObjects The AppObjectRepo containing the VivedAPIEntity singleton\r\n */\r\nexport function setApiStage(stage: APIStage, appObjects: AppObjectRepo) {\r\n const sandbox = VivedAPIEntity.get(appObjects);\r\n if (sandbox) {\r\n sandbox.apiStage = stage;\r\n } else {\r\n appObjects.submitWarning(\"setApiStage\", \"Unable to find VivedAPIEntity\");\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"VivedAPIEntity.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Entities/VivedAPIEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,sCAA6C;AAC7C,sCAKqB;AAErB;;GAEG;AACH,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,4CAA4C;IAC5C,qCAAyB,CAAA;IACzB,qDAAqD;IACrD,+BAAmB,CAAA;IACnB,0CAA0C;IAC1C,uCAA2B,CAAA;IAC3B,oCAAoC;IACpC,2BAAe,CAAA;AACjB,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB;AAED;;;;GAIG;AACH,MAAa,cAAe,SAAQ,sBAAe;IAIjD;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IAiBD;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAe,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,QAAkB;QAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,GAAG,QAAQ,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtD,OAAO,+B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C;;AAhGH,wCAiGC;AAhGC,gDAAgD;AACzC,mBAAI,GAAG,gBAAgB,AAAnB,CAAoB","sourcesContent":["/**\r\n * VivedAPIEntity.ts\r\n * \r\n * This file defines the core entity for managing VIVED API configuration and authentication.\r\n * The VivedAPIEntity acts as a singleton component that centralizes API communication settings,\r\n * including environment-specific base URLs and user authentication tokens.\r\n * \r\n * Key concepts:\r\n * - Manages API stage configuration (Production, Staging, Development, Local)\r\n * - Stores and tracks user authentication tokens\r\n * - Provides environment-specific base URLs for API requests\r\n * - Notifies observers when API settings change\r\n * - Implements singleton pattern for system-wide API configuration\r\n * \r\n * Usage pattern:\r\n * 1. Get the singleton entity using VivedAPIEntity.get(appObjects)\r\n * 2. Configure API stage and user token as needed\r\n * 3. Use baseUrl and getEndpointURL for API requests\r\n * 4. Register change observers to react to configuration updates\r\n */\r\n\r\nimport { MemoizedString } from \"@vived/core\";\r\nimport {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo\r\n} from \"@vived/core\";\r\n\r\n/**\r\n * Enum representing different API environment stages\r\n */\r\nexport enum APIStage {\r\n /** Production environment with live data */\r\n PRODUCTION = \"Production\",\r\n /** Staging environment for pre-production testing */\r\n STAGING = \"Staging\",\r\n /** Development environment for testing */\r\n DEVELOPMENT = \"Development\",\r\n /** Local development environment */\r\n LOCAL = \"LOCAL\"\r\n}\r\n\r\n/**\r\n * VivedAPIEntity manages API configuration and authentication state.\r\n * This singleton entity provides centralized access to API settings including\r\n * environment-specific URLs and user authentication tokens.\r\n */\r\nexport class VivedAPIEntity extends AppObjectEntity {\r\n /** Unique type identifier for this component */\r\n static type = \"VivedAPIEntity\";\r\n\r\n /**\r\n * Retrieves the singleton VivedAPIEntity from the app objects repository\r\n * @param appObjects The AppObjectRepo to get the singleton from\r\n * @returns The VivedAPIEntity singleton or undefined if not found\r\n */\r\n static get(appObjects: AppObjectRepo): VivedAPIEntity | undefined {\r\n return getSingletonComponent(VivedAPIEntity.type, appObjects);\r\n }\r\n\r\n /** Production API base URL */\r\n productionURL = \"https://api.vivedlearning.com\";\r\n /** Staging API base URL */\r\n stagingURL = \"https://api-staging.vivedlearning.com\";\r\n /** Development API base URL */\r\n developmentURL = \"https://api-test.vivedlearning.com\";\r\n /** Local development API base URL */\r\n localURL = \"http://localhost:3001\";\r\n\r\n /** Memoized API stage that notifies on changes */\r\n private memoizedApiState = new MemoizedString(\r\n APIStage.PRODUCTION,\r\n this.notifyOnChange\r\n );\r\n\r\n /**\r\n * Gets the current API stage\r\n * @returns The current APIStage\r\n */\r\n get apiStage() {\r\n return this.memoizedApiState.val as APIStage;\r\n }\r\n \r\n /**\r\n * Sets the API stage and notifies observers of the change\r\n * @param apiState The new APIStage to set\r\n */\r\n set apiStage(apiState: APIStage) {\r\n this.memoizedApiState.val = apiState;\r\n }\r\n\r\n /**\r\n * Gets the base URL for the current API stage\r\n * @returns The base URL string for the current environment\r\n */\r\n get baseUrl(): string {\r\n if (this.memoizedApiState.val === APIStage.PRODUCTION) {\r\n return \"https://api.vivedlearning.com\";\r\n }\r\n if (this.memoizedApiState.val === APIStage.STAGING) {\r\n return \"https://api-staging.vivedlearning.com\";\r\n }\r\n if (this.memoizedApiState.val === APIStage.DEVELOPMENT) {\r\n return \"https://api-test.vivedlearning.com\";\r\n }\r\n return \"http://localhost:3001\";\r\n }\r\n\r\n /**\r\n * Constructs a complete endpoint URL using the current base URL\r\n * @param endpoint The endpoint path to append to the base URL\r\n * @returns A URL object representing the complete endpoint URL\r\n */\r\n getEndpointURL = (endpoint: string): URL => {\r\n return new URL(endpoint, this.baseUrl);\r\n };\r\n\r\n /** Memoized user authentication token that notifies on changes */\r\n private memoizedUserToken = new MemoizedString(\"\", this.notifyOnChange);\r\n \r\n /**\r\n * Gets the current user authentication token\r\n * @returns The current user token string\r\n */\r\n get userToken(): string {\r\n return this.memoizedUserToken.val;\r\n }\r\n \r\n /**\r\n * Sets the user authentication token and notifies observers\r\n * @param val The new user token to set\r\n */\r\n set userToken(val: string) {\r\n this.memoizedUserToken.val = val;\r\n }\r\n\r\n /**\r\n * Constructs a new VivedAPIEntity and registers it as a singleton\r\n * @param appObject The AppObject this entity belongs to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, VivedAPIEntity.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"VivedAPIEntity.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Entities/VivedAPIEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,sCAA6C;AAC7C,sCAKqB;AAErB;;GAEG;AACH,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,4CAA4C;IAC5C,qCAAyB,CAAA;IACzB,qDAAqD;IACrD,+BAAmB,CAAA;IACnB,0CAA0C;IAC1C,uCAA2B,CAAA;IAC3B,oCAAoC;IACpC,2BAAe,CAAA;AACjB,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB;AAED;;;;GAIG;AACH,MAAa,cAAe,SAAQ,sBAAe;IAIjD;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAC,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IAiBD;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAe,CAAC;IAC/C,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ,CAAC,QAAkB;QAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,GAAG,QAAQ,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;YACtD,OAAO,+BAA+B,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,KAAK,QAAQ,CAAC,OAAO,EAA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ivedAPIEntity.ts\r\n *\r\n * This file defines the core entity for managing VIVED API configuration and authentication.\r\n * The VivedAPIEntity acts as a singleton component that centralizes API communication settings,\r\n * including environment-specific base URLs and user authentication tokens.\r\n *\r\n * Key concepts:\r\n * - Manages API stage configuration (Production, Staging, Development, Local)\r\n * - Stores and tracks user authentication tokens\r\n * - Provides environment-specific base URLs for API requests\r\n * - Notifies observers when API settings change\r\n * - Implements singleton pattern for system-wide API configuration\r\n *\r\n * Usage pattern:\r\n * 1. Get the singleton entity using VivedAPIEntity.get(appObjects)\r\n * 2. Configure API stage and user token as needed\r\n * 3. Use baseUrl and getEndpointURL for API requests\r\n * 4. Register change observers to react to configuration updates\r\n */\r\n\r\nimport { MemoizedString } from \"@vived/core\";\r\nimport {\r\n getSingletonComponent,\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo\r\n} from \"@vived/core\";\r\n\r\n/**\r\n * Enum representing different API environment stages\r\n */\r\nexport enum APIStage {\r\n /** Production environment with live data */\r\n PRODUCTION = \"Production\",\r\n /** Staging environment for pre-production testing */\r\n STAGING = \"Staging\",\r\n /** Development environment for testing */\r\n DEVELOPMENT = \"Development\",\r\n /** Local development environment */\r\n LOCAL = \"LOCAL\"\r\n}\r\n\r\n/**\r\n * VivedAPIEntity manages API configuration and authentication state.\r\n * This singleton entity provides centralized access to API settings including\r\n * environment-specific URLs and user authentication tokens.\r\n */\r\nexport class VivedAPIEntity extends AppObjectEntity {\r\n /** Unique type identifier for this component */\r\n static type = \"VivedAPIEntity\";\r\n\r\n /**\r\n * Retrieves the singleton VivedAPIEntity from the app objects repository\r\n * @param appObjects The AppObjectRepo to get the singleton from\r\n * @returns The VivedAPIEntity singleton or undefined if not found\r\n */\r\n static get(appObjects: AppObjectRepo): VivedAPIEntity | undefined {\r\n return getSingletonComponent(VivedAPIEntity.type, appObjects);\r\n }\r\n\r\n /** Production API base URL */\r\n productionURL = \"https://api.vivedlearning.com\";\r\n /** Staging API base URL */\r\n stagingURL = \"https://api-staging.vivedlearning.com\";\r\n /** Development API base URL */\r\n developmentURL = \"https://api-test.vivedlearning.com\";\r\n /** Local development API base URL */\r\n localURL = \"http://localhost:3001\";\r\n\r\n /** Memoized API stage that notifies on changes */\r\n private memoizedApiState = new MemoizedString(\r\n APIStage.PRODUCTION,\r\n this.notifyOnChange\r\n );\r\n\r\n /**\r\n * Gets the current API stage\r\n * @returns The current APIStage\r\n */\r\n get apiStage() {\r\n return this.memoizedApiState.val as APIStage;\r\n }\r\n\r\n /**\r\n * Sets the API stage and notifies observers of the change\r\n * @param apiState The new APIStage to set\r\n */\r\n set apiStage(apiState: APIStage) {\r\n this.memoizedApiState.val = apiState;\r\n }\r\n\r\n /**\r\n * Gets the base URL for the current API stage\r\n * @returns The base URL string for the current environment\r\n */\r\n get baseUrl(): string {\r\n if (this.memoizedApiState.val === APIStage.PRODUCTION) {\r\n return \"https://api.vivedlearning.com\";\r\n }\r\n if (this.memoizedApiState.val === APIStage.STAGING) {\r\n return \"https://api-staging.vivedlearning.com\";\r\n }\r\n if (this.memoizedApiState.val === APIStage.DEVELOPMENT) {\r\n return \"https://api-test.vivedlearning.com\";\r\n }\r\n return \"http://localhost:3001\";\r\n }\r\n\r\n /**\r\n * Constructs a complete endpoint URL using the current base URL\r\n * @param endpoint The endpoint path to append to the base URL\r\n * @returns A URL object representing the complete endpoint URL\r\n */\r\n getEndpointURL = (endpoint: string): URL => {\r\n return new URL(endpoint, this.baseUrl);\r\n };\r\n\r\n /** Memoized user authentication token that notifies on changes */\r\n private memoizedUserToken = new MemoizedString(\"\", this.notifyOnChange);\r\n\r\n /**\r\n * Gets the current user authentication token\r\n * @returns The current user token string\r\n */\r\n get userToken(): string {\r\n return this.memoizedUserToken.val;\r\n }\r\n\r\n /**\r\n * Sets the user authentication token and notifies observers\r\n * @param val The new user token to set\r\n */\r\n set userToken(val: string) {\r\n this.memoizedUserToken.val = val;\r\n }\r\n\r\n /**\r\n * Constructs a new VivedAPIEntity and registers it as a singleton\r\n * @param appObject The AppObject this entity belongs to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, VivedAPIEntity.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Entities/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;AAEH,mDAAiC","sourcesContent":["/**\r\n * VivedAPI Entities Index\r\n * \r\n * This module exports all entity classes for the VivedAPI feature.\r\n * Entities represent the core business objects and data models that store state,\r\n * track changes, and notify observers when modifications occur.\r\n * \r\n * Key Concepts:\r\n * - Entities extend AppObjectEntity and manage domain-specific data\r\n * - They use Memoized types to track changes and trigger notifications\r\n * - Singleton entities provide system-wide access to shared configuration\r\n * - Entities form the foundation for API communication and authentication\r\n * \r\n * Available Entities:\r\n * - VivedAPIEntity: Manages API configuration, authentication, and environment settings\r\n */\r\n\r\nexport * from \"./VivedAPIEntity\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Entities/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;AAEH,mDAAiC","sourcesContent":["/**\r\n * VivedAPI Entities Index\r\n *\r\n * This module exports all entity classes for the VivedAPI feature.\r\n * Entities represent the core business objects and data models that store state,\r\n * track changes, and notify observers when modifications occur.\r\n *\r\n * Key Concepts:\r\n * - Entities extend AppObjectEntity and manage domain-specific data\r\n * - They use Memoized types to track changes and trigger notifications\r\n * - Singleton entities provide system-wide access to shared configuration\r\n * - Entities form the foundation for API communication and authentication\r\n *\r\n * Available Entities:\r\n * - VivedAPIEntity: Manages API configuration, authentication, and environment settings\r\n */\r\n\r\nexport * from \"./VivedAPIEntity\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Factories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;AAEH,4DAA0C;AAC1C,oDAAkC;AAClC,6CAA2B","sourcesContent":["/**\r\n * VivedAPI Factories Index\r\n * \r\n * This module exports all factory functions for the VivedAPI feature.\r\n * Factory functions provide centralized component creation and feature setup,\r\n * ensuring proper initialization and component wiring for different environments.\r\n * \r\n * Key Concepts:\r\n * - Factory functions encapsulate complex component creation workflows\r\n * - They establish proper dependencies and relationships between components\r\n * - Factories provide environment-specific setup (sandbox, production, testing)\r\n * - They ensure singleton registration and component availability\r\n * - Factory functions serve as entry points for feature initialization\r\n * \r\n * Available Factories:\r\n * - setupVivedAPIForSandbox: Complete feature setup for sandbox environments\r\n */\r\n\r\nexport * from \"./setupVivedAPIForSandbox\";\r\nexport * from \"./VivedAPIFactory\";\r\nexport * from \"./setupAPI\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Factories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;;;AAEH,4DAA0C;AAC1C,oDAAkC;AAClC,6CAA2B","sourcesContent":["/**\r\n * VivedAPI Factories Index\r\n *\r\n * This module exports all factory functions for the VivedAPI feature.\r\n * Factory functions provide centralized component creation and feature setup,\r\n * ensuring proper initialization and component wiring for different environments.\r\n *\r\n * Key Concepts:\r\n * - Factory functions encapsulate complex component creation workflows\r\n * - They establish proper dependencies and relationships between components\r\n * - Factories provide environment-specific setup (sandbox, production, testing)\r\n * - They ensure singleton registration and component availability\r\n * - Factory functions serve as entry points for feature initialization\r\n *\r\n * Available Factories:\r\n * - setupVivedAPIForSandbox: Complete feature setup for sandbox environments\r\n */\r\n\r\nexport * from \"./setupVivedAPIForSandbox\";\r\nexport * from \"./VivedAPIFactory\";\r\nexport * from \"./setupAPI\";\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setupVivedAPIForSandbox.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Factories/setupVivedAPIForSandbox.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAuBH,0DAqBC;AAzCD,0CAA6C;AAC7C,gCAAyC;AACzC,gCAYgB;AAEhB;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,UAAyB;IAC/D,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAE/C,WAAW;IACX,IAAI,yBAAc,CAAC,EAAE,CAAC,CAAC;IAEvB,MAAM;IACN,IAAA,4BAAsB,EAAC,EAAE,CAAC,CAAC;IAC3B,IAAA,iCAA2B,EAAC,EAAE,CAAC,CAAC;IAChC,IAAA,iCAA2B,EAAC,EAAE,CAAC,CAAC;IAChC,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;IACrB,IAAA,yBAAmB,EAAC,EAAE,CAAC,CAAC;IACxB,IAAA,oCAA8B,EAAC,EAAE,CAAC,CAAC;IACnC,IAAA,0BAAoB,EAAC,EAAE,CAAC,CAAC;IACzB,IAAA,gCAA0B,EAAC,EAAE,CAAC,CAAC;IAC/B,IAAA,0BAAoB,EAAC,EAAE,CAAC,CAAC;IACzB,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;IACrB,IAAA,wBAAkB,EAAC,EAAE,CAAC,CAAC;IAEvB,MAAM;IACN,IAAA,qBAAe,EAAC,EAAE,CAAC,CAAC;AACtB,CAAC","sourcesContent":["/**\r\n * setupVivedAPIForSandbox.ts\r\n * \r\n * This file defines the factory function for setting up the complete VivedAPI feature\r\n * in a sandbox environment. It initializes all necessary components including entities,\r\n * use cases, and presentation managers required for API communication.\r\n * \r\n * Key concepts:\r\n * - Factory function creates and wires up all VivedAPI components\r\n * - Creates a dedicated AppObject for organizing API-related components\r\n * - Initializes singleton entities for API configuration management\r\n * - Sets up all use cases for various API operations (assets, apps, auth)\r\n * - Establishes presentation managers for UI integration\r\n * - Provides a single entry point for complete feature setup\r\n * \r\n * Usage pattern:\r\n * 1. Call setupVivedAPIForSandbox with AppObjectRepo during initialization\r\n * 2. Function creates all necessary components and registers them\r\n * 3. Components become available through standard AppObject retrieval methods\r\n * 4. Use in sandbox environments for development and testing\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { VivedAPIEntity } from \"../Entities\";\r\nimport { makeUserTokenPM } from \"../PMs\";\r\nimport {\r\n makeDeleteAssetOnAPIUC,\r\n makeFetchAssetFileFromAPIUC,\r\n makeFetchAssetMetaFromAPIUC,\r\n makeFileUploadUC,\r\n makeGetAppFromAPIUC,\r\n makeGetAssetsForOwnerFromAPIUC,\r\n makePatchAssetFileUC,\r\n makePatchAssetIsArchivedUC,\r\n makePatchAssetMetaUC,\r\n makePatchAssetUC,\r\n makePostNewAssetUC\r\n} from \"../UCs\";\r\n\r\n/**\r\n * Sets up the complete VivedAPI feature for sandbox environments\r\n * @param appObjects The AppObjectRepo to register all VivedAPI components in\r\n */\r\nexport function setupVivedAPIForSandbox(appObjects: AppObjectRepo) {\r\n const ao = appObjects.getOrCreate(\"VIVED API\");\r\n\r\n // Entities\r\n new VivedAPIEntity(ao);\r\n\r\n // UCs\r\n makeDeleteAssetOnAPIUC(ao);\r\n makeFetchAssetFileFromAPIUC(ao);\r\n makeFetchAssetMetaFromAPIUC(ao);\r\n makeFileUploadUC(ao);\r\n makeGetAppFromAPIUC(ao);\r\n makeGetAssetsForOwnerFromAPIUC(ao);\r\n makePatchAssetFileUC(ao);\r\n makePatchAssetIsArchivedUC(ao);\r\n makePatchAssetMetaUC(ao);\r\n makePatchAssetUC(ao);\r\n makePostNewAssetUC(ao);\r\n\r\n // PMs\r\n makeUserTokenPM(ao);\r\n}\r\n"]}
1
+ {"version":3,"file":"setupVivedAPIForSandbox.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Factories/setupVivedAPIForSandbox.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAuBH,0DAqBC;AAzCD,0CAA6C;AAC7C,gCAAyC;AACzC,gCAYgB;AAEhB;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,UAAyB;IAC/D,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAE/C,WAAW;IACX,IAAI,yBAAc,CAAC,EAAE,CAAC,CAAC;IAEvB,MAAM;IACN,IAAA,4BAAsB,EAAC,EAAE,CAAC,CAAC;IAC3B,IAAA,iCAA2B,EAAC,EAAE,CAAC,CAAC;IAChC,IAAA,iCAA2B,EAAC,EAAE,CAAC,CAAC;IAChC,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;IACrB,IAAA,yBAAmB,EAAC,EAAE,CAAC,CAAC;IACxB,IAAA,oCAA8B,EAAC,EAAE,CAAC,CAAC;IACnC,IAAA,0BAAoB,EAAC,EAAE,CAAC,CAAC;IACzB,IAAA,gCAA0B,EAAC,EAAE,CAAC,CAAC;IAC/B,IAAA,0BAAoB,EAAC,EAAE,CAAC,CAAC;IACzB,IAAA,sBAAgB,EAAC,EAAE,CAAC,CAAC;IACrB,IAAA,wBAAkB,EAAC,EAAE,CAAC,CAAC;IAEvB,MAAM;IACN,IAAA,qBAAe,EAAC,EAAE,CAAC,CAAC;AACtB,CAAC","sourcesContent":["/**\r\n * setupVivedAPIForSandbox.ts\r\n *\r\n * This file defines the factory function for setting up the complete VivedAPI feature\r\n * in a sandbox environment. It initializes all necessary components including entities,\r\n * use cases, and presentation managers required for API communication.\r\n *\r\n * Key concepts:\r\n * - Factory function creates and wires up all VivedAPI components\r\n * - Creates a dedicated AppObject for organizing API-related components\r\n * - Initializes singleton entities for API configuration management\r\n * - Sets up all use cases for various API operations (assets, apps, auth)\r\n * - Establishes presentation managers for UI integration\r\n * - Provides a single entry point for complete feature setup\r\n *\r\n * Usage pattern:\r\n * 1. Call setupVivedAPIForSandbox with AppObjectRepo during initialization\r\n * 2. Function creates all necessary components and registers them\r\n * 3. Components become available through standard AppObject retrieval methods\r\n * 4. Use in sandbox environments for development and testing\r\n */\r\n\r\nimport { AppObjectRepo } from \"@vived/core\";\r\nimport { VivedAPIEntity } from \"../Entities\";\r\nimport { makeUserTokenPM } from \"../PMs\";\r\nimport {\r\n makeDeleteAssetOnAPIUC,\r\n makeFetchAssetFileFromAPIUC,\r\n makeFetchAssetMetaFromAPIUC,\r\n makeFileUploadUC,\r\n makeGetAppFromAPIUC,\r\n makeGetAssetsForOwnerFromAPIUC,\r\n makePatchAssetFileUC,\r\n makePatchAssetIsArchivedUC,\r\n makePatchAssetMetaUC,\r\n makePatchAssetUC,\r\n makePostNewAssetUC\r\n} from \"../UCs\";\r\n\r\n/**\r\n * Sets up the complete VivedAPI feature for sandbox environments\r\n * @param appObjects The AppObjectRepo to register all VivedAPI components in\r\n */\r\nexport function setupVivedAPIForSandbox(appObjects: AppObjectRepo) {\r\n const ao = appObjects.getOrCreate(\"VIVED API\");\r\n\r\n // Entities\r\n new VivedAPIEntity(ao);\r\n\r\n // UCs\r\n makeDeleteAssetOnAPIUC(ao);\r\n makeFetchAssetFileFromAPIUC(ao);\r\n makeFetchAssetMetaFromAPIUC(ao);\r\n makeFileUploadUC(ao);\r\n makeGetAppFromAPIUC(ao);\r\n makeGetAssetsForOwnerFromAPIUC(ao);\r\n makePatchAssetFileUC(ao);\r\n makePatchAssetIsArchivedUC(ao);\r\n makePatchAssetMetaUC(ao);\r\n makePatchAssetUC(ao);\r\n makePostNewAssetUC(ao);\r\n\r\n // PMs\r\n makeUserTokenPM(ao);\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MockJsonRequestUC.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Mocks/MockJsonRequestUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AA2BH,sDAEC;AA1BD,wDAAqD;AAErD;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,6BAAa;IAIlD;;;OAGG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,6BAAa,CAAC,IAAI,CAAC,CAAC;QARvC,kDAAkD;QAClD,cAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAQtB,CAAC;CACF;AAXD,8CAWC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,UAAyB;IAC7D,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/**\r\n * MockJsonRequestUC.ts\r\n * \r\n * This file provides a mock implementation of JsonRequestUC for testing and development.\r\n * MockJsonRequestUC replaces real HTTP request functionality with Jest mock functions,\r\n * enabling controlled testing scenarios and development without live API dependencies.\r\n * \r\n * Key concepts:\r\n * - Mock extends the real JsonRequestUC class to maintain interface compatibility\r\n * - Uses Jest mock functions to provide controllable request behavior\r\n * - Enables testing of components that depend on JSON HTTP requests\r\n * - Allows simulation of various response scenarios (success, failure, delays)\r\n * - Supports isolated unit testing without external API dependencies\r\n * \r\n * Usage pattern:\r\n * 1. Use makeMockJsonRequestUC to create and register the mock\r\n * 2. Configure mock behavior using Jest mock function methods\r\n * 3. Test components can verify request calls and control responses\r\n * 4. Replace with real implementation for integration testing\r\n */\r\n\r\nimport { AppObject, AppObjectRepo } from \"@vived/core\";\r\nimport { JsonRequestUC } from \"../UCs/JsonRequestUC\";\r\n\r\n/**\r\n * Mock implementation of JsonRequestUC for testing and development\r\n * Provides Jest mock functions instead of real HTTP request functionality\r\n */\r\nexport class MockJsonRequestUC extends JsonRequestUC {\r\n /** Jest mock function for the doRequest method */\r\n doRequest = jest.fn();\r\n\r\n /**\r\n * Constructs a new MockJsonRequestUC\r\n * @param appObject The AppObject this mock UC belongs to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, JsonRequestUC.type);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create and register a MockJsonRequestUC\r\n * @param appObjects The AppObjectRepo to create the mock in\r\n * @returns A new MockJsonRequestUC instance\r\n */\r\nexport function makeMockJsonRequestUC(appObjects: AppObjectRepo) {\r\n return new MockJsonRequestUC(appObjects.getOrCreate(\"MockJsonRequestUC\"));\r\n}\r\n"]}
1
+ {"version":3,"file":"MockJsonRequestUC.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Mocks/MockJsonRequestUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AA2BH,sDAEC;AA1BD,wDAAqD;AAErD;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,6BAAa;IAIlD;;;OAGG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,6BAAa,CAAC,IAAI,CAAC,CAAC;QARvC,kDAAkD;QAClD,cAAS,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAQtB,CAAC;CACF;AAXD,8CAWC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,UAAyB;IAC7D,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/**\r\n * MockJsonRequestUC.ts\r\n *\r\n * This file provides a mock implementation of JsonRequestUC for testing and development.\r\n * MockJsonRequestUC replaces real HTTP request functionality with Jest mock functions,\r\n * enabling controlled testing scenarios and development without live API dependencies.\r\n *\r\n * Key concepts:\r\n * - Mock extends the real JsonRequestUC class to maintain interface compatibility\r\n * - Uses Jest mock functions to provide controllable request behavior\r\n * - Enables testing of components that depend on JSON HTTP requests\r\n * - Allows simulation of various response scenarios (success, failure, delays)\r\n * - Supports isolated unit testing without external API dependencies\r\n *\r\n * Usage pattern:\r\n * 1. Use makeMockJsonRequestUC to create and register the mock\r\n * 2. Configure mock behavior using Jest mock function methods\r\n * 3. Test components can verify request calls and control responses\r\n * 4. Replace with real implementation for integration testing\r\n */\r\n\r\nimport { AppObject, AppObjectRepo } from \"@vived/core\";\r\nimport { JsonRequestUC } from \"../UCs/JsonRequestUC\";\r\n\r\n/**\r\n * Mock implementation of JsonRequestUC for testing and development\r\n * Provides Jest mock functions instead of real HTTP request functionality\r\n */\r\nexport class MockJsonRequestUC extends JsonRequestUC {\r\n /** Jest mock function for the doRequest method */\r\n doRequest = jest.fn();\r\n\r\n /**\r\n * Constructs a new MockJsonRequestUC\r\n * @param appObject The AppObject this mock UC belongs to\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, JsonRequestUC.type);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create and register a MockJsonRequestUC\r\n * @param appObjects The AppObjectRepo to create the mock in\r\n * @returns A new MockJsonRequestUC instance\r\n */\r\nexport function makeMockJsonRequestUC(appObjects: AppObjectRepo) {\r\n return new MockJsonRequestUC(appObjects.getOrCreate(\"MockJsonRequestUC\"));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Mocks/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;AAEH,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,2DAAyC;AACzC,gEAA8C;AAC9C,gEAA8C;AAC9C,mDAAiC;AACjC,wDAAsC;AACtC,4DAA0C;AAC1C,sDAAoC;AACpC,yDAAuC;AACvC,+DAA6C;AAC7C,yDAAuC;AACvC,qDAAmC;AACnC,uDAAqC;AACrC,wDAAsC;AACtC,oDAAkC;AAClC,oDAAkC","sourcesContent":["/**\r\n * VivedAPI Mocks Index\r\n * \r\n * This module exports all mock implementations for the VivedAPI feature.\r\n * Mocks provide test doubles and stub implementations for development and testing\r\n * scenarios where real API communication is not desired or available.\r\n * \r\n * Key Concepts:\r\n * - Mocks implement the same interfaces as production components\r\n * - They provide predictable, controllable behavior for testing\r\n * - Mocks can simulate various success and failure scenarios\r\n * - They enable development without requiring live API connections\r\n * - Mock implementations support isolated unit testing\r\n * \r\n * Available Mock Components:\r\n * - Presentation Manager Mocks: ApiStagePMMock, UserTokenPMMock\r\n * - HTTP Request Mocks: MockBasicFetchUC, MockJsonRequestUC, MockBlobRequestUC\r\n * - Authentication Mocks: MockSignedAuthToken, MockUserLoginUC\r\n * - File Operation Mocks: MockFileUpload, MockFetchAssetFileFromAPIUC, MockPatchAssetFileUC\r\n * - Asset Management Mocks: MockPostNewAssetUC, MockDeleteAssetOnAPIUC, MockGetAssetsForOwnerUC\r\n * - Asset Metadata Mocks: MockFetchAssetMetaFromAPIUC, MockPatchAssetMetaUC, MockPatchAssetIsArchivedUC\r\n * - App Management Mocks: MockGetAppFromAPIUC\r\n * - Asset Update Mocks: MockPatchAssetUC\r\n */\r\n\r\nexport * from \"./ApiStagePMMock\";\r\nexport * from \"./MockBasicFetchUC\";\r\nexport * from \"./MockBlobRequestUC\";\r\nexport * from \"./MockDeleteAssetOnAPIUC\";\r\nexport * from \"./MockFetchAssetFileFromAPIUC\";\r\nexport * from \"./MockFetchAssetMetaFromAPIUC\";\r\nexport * from \"./MockFileUpload\";\r\nexport * from \"./MockGetAppFromAPIUC\";\r\nexport * from \"./MockGetAssetsForOwnerUC\";\r\nexport * from \"./MockJsonRequestUC\";\r\nexport * from \"./MockPatchAssetFileUC\";\r\nexport * from \"./MockPatchAssetIsArchivedUC\";\r\nexport * from \"./MockPatchAssetMetaUC\";\r\nexport * from \"./MockPatchAssetUC\";\r\nexport * from \"./MockPostNewAssetUC\";\r\nexport * from \"./MockSignedAuthToken\";\r\nexport * from \"./MockUserLoginUC\";\r\nexport * from \"./UserTokenPMMock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/VivedAPI/Mocks/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;AAEH,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,2DAAyC;AACzC,gEAA8C;AAC9C,gEAA8C;AAC9C,mDAAiC;AACjC,wDAAsC;AACtC,4DAA0C;AAC1C,sDAAoC;AACpC,yDAAuC;AACvC,+DAA6C;AAC7C,yDAAuC;AACvC,qDAAmC;AACnC,uDAAqC;AACrC,wDAAsC;AACtC,oDAAkC;AAClC,oDAAkC","sourcesContent":["/**\r\n * VivedAPI Mocks Index\r\n *\r\n * This module exports all mock implementations for the VivedAPI feature.\r\n * Mocks provide test doubles and stub implementations for development and testing\r\n * scenarios where real API communication is not desired or available.\r\n *\r\n * Key Concepts:\r\n * - Mocks implement the same interfaces as production components\r\n * - They provide predictable, controllable behavior for testing\r\n * - Mocks can simulate various success and failure scenarios\r\n * - They enable development without requiring live API connections\r\n * - Mock implementations support isolated unit testing\r\n *\r\n * Available Mock Components:\r\n * - Presentation Manager Mocks: ApiStagePMMock, UserTokenPMMock\r\n * - HTTP Request Mocks: MockBasicFetchUC, MockJsonRequestUC, MockBlobRequestUC\r\n * - Authentication Mocks: MockSignedAuthToken, MockUserLoginUC\r\n * - File Operation Mocks: MockFileUpload, MockFetchAssetFileFromAPIUC, MockPatchAssetFileUC\r\n * - Asset Management Mocks: MockPostNewAssetUC, MockDeleteAssetOnAPIUC, MockGetAssetsForOwnerUC\r\n * - Asset Metadata Mocks: MockFetchAssetMetaFromAPIUC, MockPatchAssetMetaUC, MockPatchAssetIsArchivedUC\r\n * - App Management Mocks: MockGetAppFromAPIUC\r\n * - Asset Update Mocks: MockPatchAssetUC\r\n */\r\n\r\nexport * from \"./ApiStagePMMock\";\r\nexport * from \"./MockBasicFetchUC\";\r\nexport * from \"./MockBlobRequestUC\";\r\nexport * from \"./MockDeleteAssetOnAPIUC\";\r\nexport * from \"./MockFetchAssetFileFromAPIUC\";\r\nexport * from \"./MockFetchAssetMetaFromAPIUC\";\r\nexport * from \"./MockFileUpload\";\r\nexport * from \"./MockGetAppFromAPIUC\";\r\nexport * from \"./MockGetAssetsForOwnerUC\";\r\nexport * from \"./MockJsonRequestUC\";\r\nexport * from \"./MockPatchAssetFileUC\";\r\nexport * from \"./MockPatchAssetIsArchivedUC\";\r\nexport * from \"./MockPatchAssetMetaUC\";\r\nexport * from \"./MockPatchAssetUC\";\r\nexport * from \"./MockPostNewAssetUC\";\r\nexport * from \"./MockSignedAuthToken\";\r\nexport * from \"./MockUserLoginUC\";\r\nexport * from \"./UserTokenPMMock\";\r\n"]}