@vived/host 4.5.3 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/Apps/Entities/AppEntity.js +29 -3
  2. package/dist/cjs/Apps/Entities/AppEntity.js.map +1 -1
  3. package/dist/cjs/Apps/PMs/AppPM.js +44 -3
  4. package/dist/cjs/Apps/PMs/AppPM.js.map +1 -1
  5. package/dist/cjs/Assets/Adapters/assetFileAdapter.js +45 -0
  6. package/dist/cjs/Assets/Adapters/assetFileAdapter.js.map +1 -0
  7. package/dist/cjs/Assets/Adapters/index.js +1 -0
  8. package/dist/cjs/Assets/Adapters/index.js.map +1 -1
  9. package/dist/cjs/Assets/Factories/setupAssetsForSandbox.js +1 -0
  10. package/dist/cjs/Assets/Factories/setupAssetsForSandbox.js.map +1 -1
  11. package/dist/cjs/Assets/Mocks/AssetFilePMMock.js +24 -0
  12. package/dist/cjs/Assets/Mocks/AssetFilePMMock.js.map +1 -0
  13. package/dist/cjs/Assets/Mocks/index.js +1 -0
  14. package/dist/cjs/Assets/Mocks/index.js.map +1 -1
  15. package/dist/cjs/Assets/PMs/AssetFilePM.js +134 -0
  16. package/dist/cjs/Assets/PMs/AssetFilePM.js.map +1 -0
  17. package/dist/cjs/Assets/PMs/index.js +1 -0
  18. package/dist/cjs/Assets/PMs/index.js.map +1 -1
  19. package/dist/esm/Apps/Entities/AppEntity.js +30 -4
  20. package/dist/esm/Apps/Entities/AppEntity.js.map +1 -1
  21. package/dist/esm/Apps/PMs/AppPM.js +44 -3
  22. package/dist/esm/Apps/PMs/AppPM.js.map +1 -1
  23. package/dist/esm/Assets/Adapters/assetFileAdapter.js +42 -0
  24. package/dist/esm/Assets/Adapters/assetFileAdapter.js.map +1 -0
  25. package/dist/esm/Assets/Adapters/index.js +1 -0
  26. package/dist/esm/Assets/Adapters/index.js.map +1 -1
  27. package/dist/esm/Assets/Factories/setupAssetsForSandbox.js +2 -1
  28. package/dist/esm/Assets/Factories/setupAssetsForSandbox.js.map +1 -1
  29. package/dist/esm/Assets/Mocks/AssetFilePMMock.js +20 -0
  30. package/dist/esm/Assets/Mocks/AssetFilePMMock.js.map +1 -0
  31. package/dist/esm/Assets/Mocks/index.js +1 -0
  32. package/dist/esm/Assets/Mocks/index.js.map +1 -1
  33. package/dist/esm/Assets/PMs/AssetFilePM.js +129 -0
  34. package/dist/esm/Assets/PMs/AssetFilePM.js.map +1 -0
  35. package/dist/esm/Assets/PMs/index.js +1 -0
  36. package/dist/esm/Assets/PMs/index.js.map +1 -1
  37. package/dist/types/Apps/Entities/AppEntity.d.ts +1 -0
  38. package/dist/types/Apps/Entities/AppEntity.d.ts.map +1 -1
  39. package/dist/types/Apps/PMs/AppPM.d.ts +2 -0
  40. package/dist/types/Apps/PMs/AppPM.d.ts.map +1 -1
  41. package/dist/types/Assets/Adapters/assetFileAdapter.d.ts +8 -0
  42. package/dist/types/Assets/Adapters/assetFileAdapter.d.ts.map +1 -0
  43. package/dist/types/Assets/Adapters/index.d.ts +1 -0
  44. package/dist/types/Assets/Adapters/index.d.ts.map +1 -1
  45. package/dist/types/Assets/Factories/setupAssetsForSandbox.d.ts.map +1 -1
  46. package/dist/types/Assets/Mocks/AssetFilePMMock.d.ts +19 -0
  47. package/dist/types/Assets/Mocks/AssetFilePMMock.d.ts.map +1 -0
  48. package/dist/types/Assets/Mocks/index.d.ts +1 -0
  49. package/dist/types/Assets/Mocks/index.d.ts.map +1 -1
  50. package/dist/types/Assets/PMs/AssetFilePM.d.ts +51 -0
  51. package/dist/types/Assets/PMs/AssetFilePM.d.ts.map +1 -0
  52. package/dist/types/Assets/PMs/index.d.ts +1 -0
  53. package/dist/types/Assets/PMs/index.d.ts.map +1 -1
  54. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
1
  import { AppObjectPM } from "@vived/core";
2
2
  import { AppEntity } from "../Entities/AppEntity";
3
+ import { AssetEntity } from "../../Assets/Entities/AssetEntity";
3
4
  /**
4
5
  * Default empty AppVM for initialization
5
6
  */
@@ -7,7 +8,8 @@ export const defaultAppVM = {
7
8
  id: "",
8
9
  description: "",
9
10
  imageURL: "",
10
- name: ""
11
+ name: "",
12
+ isFetching: false
11
13
  };
12
14
  /**
13
15
  * Presentation Manager for App entities
@@ -74,8 +76,23 @@ class AppPMImp extends AppPM {
74
76
  return false;
75
77
  if (a.imageURL !== b.imageURL)
76
78
  return false;
79
+ if (a.isFetching !== b.isFetching)
80
+ return false;
77
81
  return true;
78
82
  }
83
+ /**
84
+ * Retrieves the asset entity for the image
85
+ *
86
+ * @returns The image asset entity or undefined if not found
87
+ */
88
+ getImageAsset() {
89
+ if (!this.app?.imageAssetId)
90
+ return undefined;
91
+ const assetAO = this.appObject.appObjectRepo.get(this.app.imageAssetId);
92
+ if (!assetAO)
93
+ return undefined;
94
+ return AssetEntity.get(assetAO);
95
+ }
79
96
  /**
80
97
  * Creates a new AppPM instance
81
98
  *
@@ -90,15 +107,39 @@ class AppPMImp extends AppPM {
90
107
  this.onEntityChange = () => {
91
108
  if (!this.app)
92
109
  return;
110
+ let imageURL = this.app.image_url;
111
+ let isFetching = false;
112
+ // Check for an image asset and use its blob URL if available
113
+ const imageAsset = this.getImageAsset();
114
+ if (imageAsset) {
115
+ if (imageAsset.fetchError) {
116
+ // If there's an error fetching the asset, return empty string for imageURL
117
+ imageURL = "";
118
+ }
119
+ else if (imageAsset.isFetchingFile) {
120
+ // If the asset is being fetched, set isFetching to true and use the default image_url
121
+ isFetching = true;
122
+ }
123
+ else if (imageAsset.blobURL) {
124
+ // If the asset has a blob URL, use it
125
+ imageURL = imageAsset.blobURL || imageURL;
126
+ }
127
+ }
93
128
  const vm = {
94
129
  description: this.app.description,
95
130
  id: this.app.id,
96
- imageURL: this.app.image_url,
97
- name: this.app.name
131
+ imageURL,
132
+ name: this.app.name,
133
+ isFetching
98
134
  };
99
135
  this.doUpdateView(vm);
100
136
  };
101
137
  this.app?.addChangeObserver(this.onEntityChange);
138
+ // Also listen for changes to the image asset if it exists
139
+ const imageAsset = this.getImageAsset();
140
+ if (imageAsset) {
141
+ imageAsset.addChangeObserver(this.onEntityChange);
142
+ }
102
143
  this.onEntityChange();
103
144
  }
104
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppPM.js","sourceRoot":"","sources":["../../../../src/Apps/PMs/AppPM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAiB,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBlD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,EAAE,EAAE,EAAE;IACN,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,KAAM,SAAQ,WAAkB;IAGpD;;;;;;OAMG;IACH,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,OAAO;QACT,CAAC;QAED,OAAO,EAAE,CAAC,YAAY,CAAQ,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;;AAhBM,UAAI,GAAG,OAAO,CAAC;AAmBxB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,SAAoB;IAC5C,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,QAAS,SAAQ,KAAK;IAC1B;;OAEG;IACH,IAAY,GAAG;QACb,OAAO,IAAI,CAAC,uBAAuB,CAAY,SAAS,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,CAAQ,EAAE,CAAQ;QAC5B,IAAI,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAClD,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAmBD;;;;OAIG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAvB/B;;;WAGG;QACK,mBAAc,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,GAAG;gBAAE,OAAO;YAEtB,MAAM,EAAE,GAAU;gBAChB,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW;gBACjC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;gBACf,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;gBAC5B,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;aACpB,CAAC;YAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;QAUA,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF","sourcesContent":["import { AppObject, AppObjectPM, AppObjectRepo } from \"@vived/core\";\r\nimport { AppEntity } from \"../Entities/AppEntity\";\r\n\r\n/**\r\n * View Model for App information\r\n * Represents the data needed by the view to display an app\r\n */\r\nexport interface AppVM {\r\n /** Unique identifier for the app */\r\n id: string;\r\n /** Display name of the app */\r\n name: string;\r\n /** Description text for the app */\r\n description: string;\r\n /** URL to the app's thumbnail or preview image */\r\n imageURL: string;\r\n}\r\n\r\n/**\r\n * Default empty AppVM for initialization\r\n */\r\nexport const defaultAppVM: AppVM = {\r\n id: \"\",\r\n description: \"\",\r\n imageURL: \"\",\r\n name: \"\"\r\n};\r\n\r\n/**\r\n * Presentation Manager for App entities\r\n * \r\n * The AppPM is responsible for:\r\n * - Converting the AppEntity data into a view-friendly format (AppVM)\r\n * - Notifying the view when app data changes\r\n * - Providing comparison utilities for view models\r\n * \r\n * Usage:\r\n * 1. Retrieve an instance with `AppPM.get(appId, appObjects)`\r\n * 2. Subscribe to view updates with `pm.addViewUpdateObserver(callback)`\r\n * 3. Access current view data with `pm.lastVM`\r\n */\r\nexport abstract class AppPM extends AppObjectPM<AppVM> {\r\n static type = \"AppPM\";\r\n\r\n /**\r\n * Retrieves an AppPM instance for a specific app by ID\r\n * \r\n * @param id - The unique identifier of the app\r\n * @param appObjects - The repository of app objects\r\n * @returns The AppPM instance or undefined if not found\r\n */\r\n static get(id: string, appObjects: AppObjectRepo) {\r\n const ao = appObjects.get(id);\r\n if (!ao) {\r\n return;\r\n }\r\n\r\n return ao.getComponent<AppPM>(AppPM.type);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a new AppPM instance\r\n * \r\n * @param appObject - The app object to associate with this PM\r\n * @returns A new AppPM instance\r\n */\r\nexport function makeAppPM(appObject: AppObject): AppPM {\r\n return new AppPMImp(appObject);\r\n}\r\n\r\n/**\r\n * Implementation of the AppPM abstract class\r\n * Handles the connection between AppEntity and view\r\n */\r\nclass AppPMImp extends AppPM {\r\n /**\r\n * Gets the associated AppEntity\r\n */\r\n private get app() {\r\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Compares two AppVM instances for equality\r\n * Used to determine if the view needs to update\r\n * \r\n * @param a - First AppVM to compare\r\n * @param b - Second AppVM to compare\r\n * @returns True if view models are equal, false otherwise\r\n */\r\n vmsAreEqual(a: AppVM, b: AppVM): boolean {\r\n if (a.description !== b.description) return false;\r\n if (a.name !== b.name) return false;\r\n if (a.imageURL !== b.imageURL) return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Observer callback that updates the view model when the entity changes\r\n * Transforms entity data into view model format\r\n */\r\n private onEntityChange = () => {\r\n if (!this.app) return;\r\n\r\n const vm: AppVM = {\r\n description: this.app.description,\r\n id: this.app.id,\r\n imageURL: this.app.image_url,\r\n name: this.app.name\r\n };\r\n\r\n this.doUpdateView(vm);\r\n };\r\n\r\n /**\r\n * Creates a new AppPM instance\r\n * \r\n * @param appObject - The app object to associate with this PM\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, AppPM.type);\r\n\r\n this.app?.addChangeObserver(this.onEntityChange);\r\n this.onEntityChange();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"AppPM.js","sourceRoot":"","sources":["../../../../src/Apps/PMs/AppPM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAiB,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAmBhE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,EAAE,EAAE,EAAE;IACN,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,KAAM,SAAQ,WAAkB;IAGpD;;;;;;OAMG;IACH,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,OAAO;QACT,CAAC;QAED,OAAO,EAAE,CAAC,YAAY,CAAQ,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;;AAhBM,UAAI,GAAG,OAAO,CAAC;AAmBxB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,SAAoB;IAC5C,OAAO,IAAI,QAAQ,CAAC,SAAS,C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M,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACxC,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;oBAC1B,2EAA2E;oBAC3E,QAAQ,GAAG,EAAE,CAAC;gBAChB,CAAC;qBAAM,IAAI,UAAU,CAAC,cAAc,EAAE,CAAC;oBACrC,sFAAsF;oBACtF,UAAU,GAAG,IAAI,CAAC;gBACpB,CAAC;qBAAM,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBAC9B,sCAAsC;oBACtC,QAAQ,GAAG,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;gBAC5C,CAAC;YACH,CAAC;YAED,MAAM,EAAE,GAAU;gBAChB,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW;gBACjC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;gBACf,QAAQ;gBACR,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI;gBACnB,UAAU;aACX,CAAC;YAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;QAUA,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEjD,0DAA0D;QAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF","sourcesContent":["import { AppObject, AppObjectPM, AppObjectRepo } from \"@vived/core\";\r\nimport { AppEntity } from \"../Entities/AppEntity\";\r\nimport { AssetEntity } from \"../../Assets/Entities/AssetEntity\";\r\n\r\n/**\r\n * View Model for App information\r\n * Represents the data needed by the view to display an app\r\n */\r\nexport interface AppVM {\r\n /** Unique identifier for the app */\r\n id: string;\r\n /** Display name of the app */\r\n name: string;\r\n /** Description text for the app */\r\n description: string;\r\n /** URL to the app's thumbnail or preview image */\r\n imageURL: string;\r\n /** Whether the image asset is currently being fetched */\r\n isFetching: boolean;\r\n}\r\n\r\n/**\r\n * Default empty AppVM for initialization\r\n */\r\nexport const defaultAppVM: AppVM = {\r\n id: \"\",\r\n description: \"\",\r\n imageURL: \"\",\r\n name: \"\",\r\n isFetching: false\r\n};\r\n\r\n/**\r\n * Presentation Manager for App entities\r\n *\r\n * The AppPM is responsible for:\r\n * - Converting the AppEntity data into a view-friendly format (AppVM)\r\n * - Notifying the view when app data changes\r\n * - Providing comparison utilities for view models\r\n *\r\n * Usage:\r\n * 1. Retrieve an instance with `AppPM.get(appId, appObjects)`\r\n * 2. Subscribe to view updates with `pm.addViewUpdateObserver(callback)`\r\n * 3. Access current view data with `pm.lastVM`\r\n */\r\nexport abstract class AppPM extends AppObjectPM<AppVM> {\r\n static type = \"AppPM\";\r\n\r\n /**\r\n * Retrieves an AppPM instance for a specific app by ID\r\n *\r\n * @param id - The unique identifier of the app\r\n * @param appObjects - The repository of app objects\r\n * @returns The AppPM instance or undefined if not found\r\n */\r\n static get(id: string, appObjects: AppObjectRepo) {\r\n const ao = appObjects.get(id);\r\n if (!ao) {\r\n return;\r\n }\r\n\r\n return ao.getComponent<AppPM>(AppPM.type);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a new AppPM instance\r\n *\r\n * @param appObject - The app object to associate with this PM\r\n * @returns A new AppPM instance\r\n */\r\nexport function makeAppPM(appObject: AppObject): AppPM {\r\n return new AppPMImp(appObject);\r\n}\r\n\r\n/**\r\n * Implementation of the AppPM abstract class\r\n * Handles the connection between AppEntity and view\r\n */\r\nclass AppPMImp extends AppPM {\r\n /**\r\n * Gets the associated AppEntity\r\n */\r\n private get app() {\r\n return this.getCachedLocalComponent<AppEntity>(AppEntity.type);\r\n }\r\n\r\n /**\r\n * Compares two AppVM instances for equality\r\n * Used to determine if the view needs to update\r\n *\r\n * @param a - First AppVM to compare\r\n * @param b - Second AppVM to compare\r\n * @returns True if view models are equal, false otherwise\r\n */\r\n vmsAreEqual(a: AppVM, b: AppVM): boolean {\r\n if (a.description !== b.description) return false;\r\n if (a.name !== b.name) return false;\r\n if (a.imageURL !== b.imageURL) return false;\r\n if (a.isFetching !== b.isFetching) return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Retrieves the asset entity for the image\r\n *\r\n * @returns The image asset entity or undefined if not found\r\n */\r\n private getImageAsset(): AssetEntity | undefined {\r\n if (!this.app?.imageAssetId) return undefined;\r\n\r\n const assetAO = this.appObject.appObjectRepo.get(this.app.imageAssetId);\r\n if (!assetAO) return undefined;\r\n\r\n return AssetEntity.get(assetAO);\r\n }\r\n\r\n /**\r\n * Observer callback that updates the view model when the entity changes\r\n * Transforms entity data into view model format\r\n */\r\n private onEntityChange = () => {\r\n if (!this.app) return;\r\n\r\n let imageURL = this.app.image_url;\r\n let isFetching = false;\r\n\r\n // Check for an image asset and use its blob URL if available\r\n const imageAsset = this.getImageAsset();\r\n if (imageAsset) {\r\n if (imageAsset.fetchError) {\r\n // If there's an error fetching the asset, return empty string for imageURL\r\n imageURL = \"\";\r\n } else if (imageAsset.isFetchingFile) {\r\n // If the asset is being fetched, set isFetching to true and use the default image_url\r\n isFetching = true;\r\n } else if (imageAsset.blobURL) {\r\n // If the asset has a blob URL, use it\r\n imageURL = imageAsset.blobURL || imageURL;\r\n }\r\n }\r\n\r\n const vm: AppVM = {\r\n description: this.app.description,\r\n id: this.app.id,\r\n imageURL,\r\n name: this.app.name,\r\n isFetching\r\n };\r\n\r\n this.doUpdateView(vm);\r\n };\r\n\r\n /**\r\n * Creates a new AppPM instance\r\n *\r\n * @param appObject - The app object to associate with this PM\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, AppPM.type);\r\n\r\n this.app?.addChangeObserver(this.onEntityChange);\r\n\r\n // Also listen for changes to the image asset if it exists\r\n const imageAsset = this.getImageAsset();\r\n if (imageAsset) {\r\n imageAsset.addChangeObserver(this.onEntityChange);\r\n }\r\n\r\n this.onEntityChange();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,42 @@
1
+ import { AssetFilePM, defaultAssetFileVM } from "../PMs/AssetFilePM";
2
+ /**
3
+ * Adapter for connecting AssetFilePM to UI components
4
+ * Provides the interface for React components to subscribe to AssetFileVM updates
5
+ */
6
+ export const assetFileAdapter = {
7
+ /**
8
+ * Default view model used before subscription is established
9
+ */
10
+ defaultVM: defaultAssetFileVM,
11
+ /**
12
+ * Subscribe a view function to updates from the presentation manager
13
+ *
14
+ * @param id - ID of the asset to observe
15
+ * @param appObjects - Repository of app objects
16
+ * @param setVM - Callback function that will receive view model updates
17
+ */
18
+ subscribe: (id, appObjects, setVM) => {
19
+ const pm = AssetFilePM.getByID(id, appObjects);
20
+ if (!pm) {
21
+ appObjects.submitError("assetFileAdapter", "Unable to find AssetFilePM");
22
+ return;
23
+ }
24
+ pm.addView(setVM);
25
+ },
26
+ /**
27
+ * Unsubscribe a view function from updates
28
+ *
29
+ * @param id - ID of the asset to stop observing
30
+ * @param appObjects - Repository of app objects
31
+ * @param setVM - Callback function to remove from updates
32
+ */
33
+ unsubscribe: (id, appObjects, setVM) => {
34
+ const pm = AssetFilePM.getByID(id, appObjects);
35
+ if (!pm) {
36
+ appObjects.submitError("assetFileAdapter", "Unable to find AssetFilePM");
37
+ return;
38
+ }
39
+ pm.removeView(setVM);
40
+ }
41
+ };
42
+ //# sourceMappingURL=assetFileAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetFileAdapter.js","sourceRoot":"","sources":["../../../../src/Assets/Adapters/assetFileAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EAEX,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD;;OAEG;IACH,SAAS,EAAE,kBAAkB;IAE7B;;;;;;OAMG;IACH,SAAS,EAAE,CACT,EAAU,EACV,UAAyB,EACzB,KAAgC,EAChC,EAAE;QACF,MAAM,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/C,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;;;;;;OAMG;IACH,WAAW,EAAE,CACX,EAAU,EACV,UAAyB,EACzB,KAAgC,EAChC,EAAE;QACF,MAAM,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/C,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":["// filepath: c:\\Users\\amosp\\Documents\\WebGL\\vivedlearning_host\\src\\Assets\\Adapters\\assetFileAdapter.ts\r\nimport { AppObjectRepo, PmAdapter } from \"@vived/core\";\r\nimport {\r\n AssetFilePM,\r\n AssetFileVM,\r\n defaultAssetFileVM\r\n} from \"../PMs/AssetFilePM\";\r\n\r\n/**\r\n * Adapter for connecting AssetFilePM to UI components\r\n * Provides the interface for React components to subscribe to AssetFileVM updates\r\n */\r\nexport const assetFileAdapter: PmAdapter<AssetFileVM> = {\r\n /**\r\n * Default view model used before subscription is established\r\n */\r\n defaultVM: defaultAssetFileVM,\r\n\r\n /**\r\n * Subscribe a view function to updates from the presentation manager\r\n *\r\n * @param id - ID of the asset to observe\r\n * @param appObjects - Repository of app objects\r\n * @param setVM - Callback function that will receive view model updates\r\n */\r\n subscribe: (\r\n id: string,\r\n appObjects: AppObjectRepo,\r\n setVM: (vm: AssetFileVM) => void\r\n ) => {\r\n const pm = AssetFilePM.getByID(id, appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"assetFileAdapter\", \"Unable to find AssetFilePM\");\r\n return;\r\n }\r\n pm.addView(setVM);\r\n },\r\n\r\n /**\r\n * Unsubscribe a view function from updates\r\n *\r\n * @param id - ID of the asset to stop observing\r\n * @param appObjects - Repository of app objects\r\n * @param setVM - Callback function to remove from updates\r\n */\r\n unsubscribe: (\r\n id: string,\r\n appObjects: AppObjectRepo,\r\n setVM: (vm: AssetFileVM) => void\r\n ) => {\r\n const pm = AssetFilePM.getByID(id, appObjects);\r\n if (!pm) {\r\n appObjects.submitError(\"assetFileAdapter\", \"Unable to find AssetFilePM\");\r\n return;\r\n }\r\n pm.removeView(setVM);\r\n }\r\n};\r\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from "./appAssetListAdapter";
2
2
  export * from "./assetAdapter";
3
+ export * from "./assetFileAdapter";
3
4
  export * from "./editingAppAssetAdapter";
4
5
  export * from "./showArchivedAppAssetAdapter";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/Adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC","sourcesContent":["export * from \"./appAssetListAdapter\";\r\nexport * from \"./assetAdapter\";\r\nexport * from \"./editingAppAssetAdapter\";\r\nexport * from \"./showArchivedAppAssetAdapter\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/Adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC","sourcesContent":["export * from \"./appAssetListAdapter\";\r\nexport * from \"./assetAdapter\";\r\nexport * from \"./assetFileAdapter\";\r\nexport * from \"./editingAppAssetAdapter\";\r\nexport * from \"./showArchivedAppAssetAdapter\";\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { makeAppAssets, makeAssetEntity, makeAssetRepo } from "../Entities";
2
- import { makeAppAssetListPM, makeAssetPM, makeEditingAppAssetPM, makeShowArchivedAppAssetPM } from "../PMs";
2
+ import { makeAppAssetListPM, makeAssetFilePM, makeAssetPM, makeEditingAppAssetPM, makeShowArchivedAppAssetPM } from "../PMs";
3
3
  import { makeArchiveAssetUC, makeDeleteAssetUC, makeDownloadAssetFileUC, makeEditAppAsset, makeGetAppAssetUC, makeGetAssetBlobURLUC, makeGetAssetFileUC, makeGetAssetUC, makeNewAppAssetUC, makeNewAssetUC, makePrefetchAssets, makeUpdateAppAssetMetaUC, makeUpdateAssetFileUC } from "../UCs";
4
4
  export function setupAssetsForSandbox(appObjects) {
5
5
  const assetRepoAO = appObjects.getOrCreate("Asset Repository");
@@ -35,6 +35,7 @@ function makeAssetFactory(appObjects) {
35
35
  makeUpdateAppAssetMetaUC(ao);
36
36
  // PMs
37
37
  makeAssetPM(ao);
38
+ makeAssetFilePM(ao); // Add our new PM to each asset
38
39
  return entity;
39
40
  };
40
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setupAssetsForSandbox.js","sourceRoot":"","sources":["../../../../src/Assets/Factories/setupAssetsForSandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EA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BAAwB,CAAC,EAAE,CAAC,CAAC;QAE7B,MAAM;QACN,WAAW,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport {\r\n AssetEntity,\r\n makeAppAssets,\r\n makeAssetEntity,\r\n makeAssetRepo\r\n} from \"../Entities\";\r\nimport {\r\n makeAppAssetListPM,\r\n makeAssetPM,\r\n makeEditingAppAssetPM,\r\n makeShowArchivedAppAssetPM\r\n} from \"../PMs\";\r\nimport {\r\n makeArchiveAssetUC,\r\n makeDeleteAssetUC,\r\n makeDownloadAssetFileUC,\r\n makeEditAppAsset,\r\n makeGetAppAssetUC,\r\n makeGetAssetBlobURLUC,\r\n makeGetAssetFileUC,\r\n makeGetAssetUC,\r\n makeNewAppAssetUC,\r\n makeNewAssetUC,\r\n makePrefetchAssets,\r\n makeUpdateAppAssetMetaUC,\r\n makeUpdateAssetFileUC\r\n} from \"../UCs\";\r\n\r\nexport function setupAssetsForSandbox(appObjects: AppObjectRepo) {\r\n const assetRepoAO = appObjects.getOrCreate(\"Asset Repository\");\r\n const appAssetsAO = appObjects.getOrCreate(\"App Assets\");\r\n\r\n // Entities\r\n const assetRepo = makeAssetRepo(assetRepoAO);\r\n assetRepo.assetFactory = makeAssetFactory(appObjects);\r\n makeAppAssets(appAssetsAO);\r\n\r\n // UCs\r\n makeEditAppAsset(assetRepoAO);\r\n makeGetAssetBlobURLUC(assetRepoAO);\r\n makeGetAssetFileUC(assetRepoAO);\r\n makeGetAssetUC(assetRepoAO);\r\n makePrefetchAssets(assetRepoAO);\r\n makeNewAssetUC(assetRepoAO);\r\n makeNewAppAssetUC(appAssetsAO);\r\n makeGetAppAssetUC(appAssetsAO);\r\n\r\n // PMs\r\n makeAppAssetListPM(appAssetsAO);\r\n makeShowArchivedAppAssetPM(appAssetsAO);\r\n makeEditingAppAssetPM(appAssetsAO);\r\n}\r\n\r\nfunction makeAssetFactory(appObjects: AppObjectRepo) {\r\n return function assetFactory(id: string): AssetEntity {\r\n const ao = appObjects.getOrCreate(id);\r\n\r\n // Entities\r\n const entity = makeAssetEntity(ao);\r\n\r\n // UCs\r\n makeArchiveAssetUC(ao);\r\n makeDeleteAssetUC(ao);\r\n makeDownloadAssetFileUC(ao);\r\n makeUpdateAssetFileUC(ao);\r\n makeUpdateAppAssetMetaUC(ao);\r\n\r\n // PMs\r\n makeAssetPM(ao);\r\n return entity;\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"setupAssetsForSandbox.js","sourceRoot":"","sources":["../../../../src/Assets/Factories/setupAssetsForSandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,QAAQ,CAAC;AAEhB,MAAM,UAAU,qBAAqB,CAAC,UAAyB;IAC7D,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAEzD,WAAW;IACX,MAAM,SAAS,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IAC7C,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACtD,aAAa,CAAC,WAAW,CAAC,CAAC;IAE3B,MAAM;IACN,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC9B,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACnC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC5B,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC5B,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/B,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAE/B,MAAM;IACN,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChC,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACxC,qBAAqB,CAAC,WAAW,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAyB;IACjD,OAAO,SAAS,YAAY,CAAC,EAAU;QACrC,MAAM,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAEtC,WAAW;QACX,MAAM,MAAM,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;QAEnC,MAAM;QACN,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACvB,iBAAiB,CAAC,EAAE,CAAC,CAAC;QACtB,uBAAuB,CAAC,EAAE,CAAC,CAAC;QAC5B,qBAAqB,CAAC,EAAE,CAAC,CAAC;QAC1B,wBAAwB,CAAC,EAAE,CAAC,CAAC;QAE7B,MAAM;QACN,WAAW,CAAC,EAAE,CAAC,CAAC;QAChB,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,+BAA+B;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport {\r\n AssetEntity,\r\n makeAppAssets,\r\n makeAssetEntity,\r\n makeAssetRepo\r\n} from \"../Entities\";\r\nimport {\r\n makeAppAssetListPM,\r\n makeAssetFilePM,\r\n makeAssetPM,\r\n makeEditingAppAssetPM,\r\n makeShowArchivedAppAssetPM\r\n} from \"../PMs\";\r\nimport {\r\n makeArchiveAssetUC,\r\n makeDeleteAssetUC,\r\n makeDownloadAssetFileUC,\r\n makeEditAppAsset,\r\n makeGetAppAssetUC,\r\n makeGetAssetBlobURLUC,\r\n makeGetAssetFileUC,\r\n makeGetAssetUC,\r\n makeNewAppAssetUC,\r\n makeNewAssetUC,\r\n makePrefetchAssets,\r\n makeUpdateAppAssetMetaUC,\r\n makeUpdateAssetFileUC\r\n} from \"../UCs\";\r\n\r\nexport function setupAssetsForSandbox(appObjects: AppObjectRepo) {\r\n const assetRepoAO = appObjects.getOrCreate(\"Asset Repository\");\r\n const appAssetsAO = appObjects.getOrCreate(\"App Assets\");\r\n\r\n // Entities\r\n const assetRepo = makeAssetRepo(assetRepoAO);\r\n assetRepo.assetFactory = makeAssetFactory(appObjects);\r\n makeAppAssets(appAssetsAO);\r\n\r\n // UCs\r\n makeEditAppAsset(assetRepoAO);\r\n makeGetAssetBlobURLUC(assetRepoAO);\r\n makeGetAssetFileUC(assetRepoAO);\r\n makeGetAssetUC(assetRepoAO);\r\n makePrefetchAssets(assetRepoAO);\r\n makeNewAssetUC(assetRepoAO);\r\n makeNewAppAssetUC(appAssetsAO);\r\n makeGetAppAssetUC(appAssetsAO);\r\n\r\n // PMs\r\n makeAppAssetListPM(appAssetsAO);\r\n makeShowArchivedAppAssetPM(appAssetsAO);\r\n makeEditingAppAssetPM(appAssetsAO);\r\n}\r\n\r\nfunction makeAssetFactory(appObjects: AppObjectRepo) {\r\n return function assetFactory(id: string): AssetEntity {\r\n const ao = appObjects.getOrCreate(id);\r\n\r\n // Entities\r\n const entity = makeAssetEntity(ao);\r\n\r\n // UCs\r\n makeArchiveAssetUC(ao);\r\n makeDeleteAssetUC(ao);\r\n makeDownloadAssetFileUC(ao);\r\n makeUpdateAssetFileUC(ao);\r\n makeUpdateAppAssetMetaUC(ao);\r\n\r\n // PMs\r\n makeAssetPM(ao);\r\n makeAssetFilePM(ao); // Add our new PM to each asset\r\n return entity;\r\n };\r\n}\r\n"]}
@@ -0,0 +1,20 @@
1
+ import { AssetFilePM } from "../PMs/AssetFilePM";
2
+ /**
3
+ * Mock implementation of AssetFilePM for testing
4
+ * Provides Jest mock functions for testing adapters and other components
5
+ */
6
+ export class AssetFilePMMock extends AssetFilePM {
7
+ /**
8
+ * Creates a new AssetFilePMMock instance
9
+ *
10
+ * @param appObject - The app object to associate with this mock PM
11
+ */
12
+ constructor(appObject) {
13
+ super(appObject, AssetFilePM.type);
14
+ /**
15
+ * Mock implementation of vmsAreEqual for testing
16
+ */
17
+ this.vmsAreEqual = jest.fn();
18
+ }
19
+ }
20
+ //# sourceMappingURL=AssetFilePMMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetFilePMMock.js","sourceRoot":"","sources":["../../../../src/Assets/Mocks/AssetFilePMMock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAM9C;;;;OAIG;IACH,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAXrC;;WAEG;QACH,gBAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IASxB,CAAC;CACF","sourcesContent":["// filepath: c:\\Users\\amosp\\Documents\\WebGL\\vivedlearning_host\\src\\Assets\\Mocks\\AssetFilePMMock.ts\r\nimport { AppObject } from \"@vived/core\";\r\nimport { AssetFilePM } from \"../PMs/AssetFilePM\";\r\n\r\n/**\r\n * Mock implementation of AssetFilePM for testing\r\n * Provides Jest mock functions for testing adapters and other components\r\n */\r\nexport class AssetFilePMMock extends AssetFilePM {\r\n /**\r\n * Mock implementation of vmsAreEqual for testing\r\n */\r\n vmsAreEqual = jest.fn();\r\n\r\n /**\r\n * Creates a new AssetFilePMMock instance\r\n *\r\n * @param appObject - The app object to associate with this mock PM\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, AssetFilePM.type);\r\n }\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from "./AppAssetListPMMock";
2
2
  export * from "./AssetPMMock";
3
+ export * from "./AssetFilePMMock";
3
4
  export * from "./EditingAppAssetPMMock";
4
5
  export * from "./MockArchiveAsset";
5
6
  export * from "./MockDeleteAssetUC";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/Mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./AppAssetListPMMock\";\r\nexport * from \"./AssetPMMock\";\r\nexport * from \"./EditingAppAssetPMMock\";\r\nexport * from \"./MockArchiveAsset\";\r\nexport * from \"./MockDeleteAssetUC\";\r\nexport * from \"./MockDownloadAssetFileUC\";\r\nexport * from \"./MockEditAppAssetUC\";\r\nexport * from \"./MockGetAppAssetsUC\";\r\nexport * from \"./MockGetAssetBlobURLUC\";\r\nexport * from \"./MockGetAssetFileUC\";\r\nexport * from \"./MockGetAssetUC\";\r\nexport * from \"./MockNewAppAsset\";\r\nexport * from \"./MockNewAssetUC\";\r\nexport * from \"./MockPrefetchAssets\";\r\nexport * from \"./MockUpdateAssetFileUC\";\r\nexport * from \"./MockUpdateAppAssetMetaUC\";\r\nexport * from \"./ShowArchivedAppAssetPMMock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/Mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./AppAssetListPMMock\";\r\nexport * from \"./AssetPMMock\";\r\nexport * from \"./AssetFilePMMock\";\r\nexport * from \"./EditingAppAssetPMMock\";\r\nexport * from \"./MockArchiveAsset\";\r\nexport * from \"./MockDeleteAssetUC\";\r\nexport * from \"./MockDownloadAssetFileUC\";\r\nexport * from \"./MockEditAppAssetUC\";\r\nexport * from \"./MockGetAppAssetsUC\";\r\nexport * from \"./MockGetAssetBlobURLUC\";\r\nexport * from \"./MockGetAssetFileUC\";\r\nexport * from \"./MockGetAssetUC\";\r\nexport * from \"./MockNewAppAsset\";\r\nexport * from \"./MockNewAssetUC\";\r\nexport * from \"./MockPrefetchAssets\";\r\nexport * from \"./MockUpdateAssetFileUC\";\r\nexport * from \"./MockUpdateAppAssetMetaUC\";\r\nexport * from \"./ShowArchivedAppAssetPMMock\";\r\n"]}
@@ -0,0 +1,129 @@
1
+ // filepath: c:\Users\amosp\Documents\WebGL\vivedlearning_host\src\Assets\PMs\AssetFilePM.ts
2
+ import { AppObjectPM } from "@vived/core";
3
+ import { AssetEntity } from "../Entities/AssetEntity";
4
+ /**
5
+ * Default empty AssetFileVM for initialization
6
+ */
7
+ export const defaultAssetFileVM = {
8
+ blobURL: undefined,
9
+ isFetchingFile: false,
10
+ fileHasBeenFetched: false,
11
+ fetchError: undefined
12
+ };
13
+ /**
14
+ * Presentation Manager for Asset file status
15
+ *
16
+ * The AssetFilePM is responsible for:
17
+ * - Converting the file-related properties of AssetEntity into a view-friendly format (AssetFileVM)
18
+ * - Notifying the view when asset file status changes
19
+ * - Providing comparison utilities for view models
20
+ *
21
+ * Usage:
22
+ * 1. Retrieve an instance with `AssetFilePM.getByID(assetId, appObjects)`
23
+ * 2. Subscribe to view updates with `pm.addView(callback)`
24
+ * 3. Access current view data with `pm.lastVM`
25
+ */
26
+ export class AssetFilePM extends AppObjectPM {
27
+ /**
28
+ * Retrieves an AssetFilePM instance for a specific asset by ID
29
+ *
30
+ * @param assetID - The unique identifier of the asset
31
+ * @param appObjects - The repository of app objects
32
+ * @returns The AssetFilePM instance or undefined if not found
33
+ */
34
+ static getByID(assetID, appObjects) {
35
+ const appObject = appObjects.get(assetID);
36
+ if (!appObject) {
37
+ appObjects.submitWarning("AssetFilePM.getByID", "Unable to find app object by ID " + assetID);
38
+ return;
39
+ }
40
+ const pm = appObject.getComponent(AssetFilePM.type);
41
+ if (!pm) {
42
+ appObjects.submitWarning("AssetFilePM.getByID", "App Object does not have a AssetFilePM");
43
+ return;
44
+ }
45
+ return pm;
46
+ }
47
+ }
48
+ AssetFilePM.type = "AssetFilePM";
49
+ /**
50
+ * Creates a new AssetFilePM instance
51
+ *
52
+ * @param appObject - The app object to associate with this PM
53
+ * @returns A new AssetFilePM instance
54
+ */
55
+ export function makeAssetFilePM(appObject) {
56
+ return new AssetFilePMImp(appObject);
57
+ }
58
+ /**
59
+ * Implementation of the AssetFilePM abstract class
60
+ * Handles the connection between AssetEntity file properties and view
61
+ */
62
+ class AssetFilePMImp extends AssetFilePM {
63
+ get asset() {
64
+ return this.getCachedLocalComponent(AssetEntity.type);
65
+ }
66
+ /**
67
+ * Compares two AssetFileVM instances for equality
68
+ * Used to determine if the view needs to update
69
+ *
70
+ * @param a - First AssetFileVM to compare
71
+ * @param b - Second AssetFileVM to compare
72
+ * @returns True if view models are equal, false otherwise
73
+ */
74
+ vmsAreEqual(a, b) {
75
+ if (a.blobURL !== b.blobURL)
76
+ return false;
77
+ if (a.isFetchingFile !== b.isFetchingFile)
78
+ return false;
79
+ if (a.fileHasBeenFetched !== b.fileHasBeenFetched)
80
+ return false;
81
+ // Handle errors comparison (both undefined, or same message)
82
+ if (a.fetchError !== b.fetchError) {
83
+ if (a.fetchError === undefined && b.fetchError !== undefined)
84
+ return false;
85
+ if (a.fetchError !== undefined && b.fetchError === undefined)
86
+ return false;
87
+ if (a.fetchError !== undefined &&
88
+ b.fetchError !== undefined &&
89
+ a.fetchError.message !== b.fetchError.message)
90
+ return false;
91
+ }
92
+ return true;
93
+ }
94
+ /**
95
+ * Cleans up resources and removes observers when the PM is disposed
96
+ */
97
+ dispose() {
98
+ if (this.asset) {
99
+ this.asset.removeChangeObserver(this.onAssetChange);
100
+ }
101
+ super.dispose();
102
+ }
103
+ /**
104
+ * Creates a new AssetFilePMImp instance
105
+ *
106
+ * @param appObject - The app object to associate with this PM
107
+ */
108
+ constructor(appObject) {
109
+ super(appObject, AssetFilePM.type);
110
+ /**
111
+ * Observer callback that updates the view model when the entity changes
112
+ * Transforms entity data into view model format
113
+ */
114
+ this.onAssetChange = () => {
115
+ if (!this.asset)
116
+ return;
117
+ const vm = {
118
+ blobURL: this.asset.blobURL,
119
+ isFetchingFile: this.asset.isFetchingFile,
120
+ fileHasBeenFetched: this.asset.fileHasBeenFetched,
121
+ fetchError: this.asset.fetchError
122
+ };
123
+ this.doUpdateView(vm);
124
+ };
125
+ this.asset?.addChangeObserver(this.onAssetChange);
126
+ this.onAssetChange();
127
+ }
128
+ }
129
+ //# sourceMappingURL=AssetFilePM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetFilePM.js","sourceRoot":"","sources":["../../../../src/Assets/PM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,IAAI,CAAC,KAAK,CAAC,cAAc;gBACzC,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;gBACjD,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;aAClC,CAAC;YAEF,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;QAoBA,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;CACF","sourcesContent":["// filepath: c:\\Users\\amosp\\Documents\\WebGL\\vivedlearning_host\\src\\Assets\\PMs\\AssetFilePM.ts\r\nimport { AppObject, AppObjectPM, AppObjectRepo } from \"@vived/core\";\r\nimport { AssetEntity } from \"../Entities/AssetEntity\";\r\n\r\n/**\r\n * View Model for Asset file information\r\n * Represents the data needed by the view to display asset file status\r\n */\r\nexport interface AssetFileVM {\r\n /** URL to the asset's file blob for direct access */\r\n blobURL: string | undefined;\r\n /** Whether the asset file is currently being fetched */\r\n isFetchingFile: boolean;\r\n /** Whether the asset file has been successfully fetched */\r\n fileHasBeenFetched: boolean;\r\n /** Error that occurred during file fetching, if any */\r\n fetchError: Error | undefined;\r\n}\r\n\r\n/**\r\n * Default empty AssetFileVM for initialization\r\n */\r\nexport const defaultAssetFileVM: AssetFileVM = {\r\n blobURL: undefined,\r\n isFetchingFile: false,\r\n fileHasBeenFetched: false,\r\n fetchError: undefined\r\n};\r\n\r\n/**\r\n * Presentation Manager for Asset file status\r\n *\r\n * The AssetFilePM is responsible for:\r\n * - Converting the file-related properties of AssetEntity into a view-friendly format (AssetFileVM)\r\n * - Notifying the view when asset file status changes\r\n * - Providing comparison utilities for view models\r\n *\r\n * Usage:\r\n * 1. Retrieve an instance with `AssetFilePM.getByID(assetId, appObjects)`\r\n * 2. Subscribe to view updates with `pm.addView(callback)`\r\n * 3. Access current view data with `pm.lastVM`\r\n */\r\nexport abstract class AssetFilePM extends AppObjectPM<AssetFileVM> {\r\n static type = \"AssetFilePM\";\r\n\r\n /**\r\n * Retrieves an AssetFilePM instance for a specific asset by ID\r\n *\r\n * @param assetID - The unique identifier of the asset\r\n * @param appObjects - The repository of app objects\r\n * @returns The AssetFilePM instance or undefined if not found\r\n */\r\n static getByID(\r\n assetID: string,\r\n appObjects: AppObjectRepo\r\n ): AssetFilePM | undefined {\r\n const appObject = appObjects.get(assetID);\r\n if (!appObject) {\r\n appObjects.submitWarning(\r\n \"AssetFilePM.getByID\",\r\n \"Unable to find app object by ID \" + assetID\r\n );\r\n return;\r\n }\r\n\r\n const pm = appObject.getComponent<AssetFilePM>(AssetFilePM.type);\r\n if (!pm) {\r\n appObjects.submitWarning(\r\n \"AssetFilePM.getByID\",\r\n \"App Object does not have a AssetFilePM\"\r\n );\r\n return;\r\n }\r\n return pm;\r\n }\r\n}\r\n\r\n/**\r\n * Creates a new AssetFilePM instance\r\n *\r\n * @param appObject - The app object to associate with this PM\r\n * @returns A new AssetFilePM instance\r\n */\r\nexport function makeAssetFilePM(appObject: AppObject): AssetFilePM {\r\n return new AssetFilePMImp(appObject);\r\n}\r\n\r\n/**\r\n * Implementation of the AssetFilePM abstract class\r\n * Handles the connection between AssetEntity file properties and view\r\n */\r\nclass AssetFilePMImp extends AssetFilePM {\r\n private get asset() {\r\n\t\treturn this.getCachedLocalComponent<AssetEntity>(AssetEntity.type);\r\n\t}\r\n\r\n /**\r\n * Compares two AssetFileVM instances for equality\r\n * Used to determine if the view needs to update\r\n *\r\n * @param a - First AssetFileVM to compare\r\n * @param b - Second AssetFileVM to compare\r\n * @returns True if view models are equal, false otherwise\r\n */\r\n vmsAreEqual(a: AssetFileVM, b: AssetFileVM): boolean {\r\n if (a.blobURL !== b.blobURL) return false;\r\n if (a.isFetchingFile !== b.isFetchingFile) return false;\r\n if (a.fileHasBeenFetched !== b.fileHasBeenFetched) return false;\r\n\r\n // Handle errors comparison (both undefined, or same message)\r\n if (a.fetchError !== b.fetchError) {\r\n if (a.fetchError === undefined && b.fetchError !== undefined)\r\n return false;\r\n if (a.fetchError !== undefined && b.fetchError === undefined)\r\n return false;\r\n if (\r\n a.fetchError !== undefined &&\r\n b.fetchError !== undefined &&\r\n a.fetchError.message !== b.fetchError.message\r\n )\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Observer callback that updates the view model when the entity changes\r\n * Transforms entity data into view model format\r\n */\r\n private onAssetChange = () => {\r\n if (!this.asset) return;\r\n\r\n const vm: AssetFileVM = {\r\n blobURL: this.asset.blobURL,\r\n isFetchingFile: this.asset.isFetchingFile,\r\n fileHasBeenFetched: this.asset.fileHasBeenFetched,\r\n fetchError: this.asset.fetchError\r\n };\r\n\r\n this.doUpdateView(vm);\r\n };\r\n\r\n /**\r\n * Cleans up resources and removes observers when the PM is disposed\r\n */\r\n dispose(): void {\r\n if (this.asset) {\r\n this.asset.removeChangeObserver(this.onAssetChange);\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Creates a new AssetFilePMImp instance\r\n *\r\n * @param appObject - The app object to associate with this PM\r\n */\r\n constructor(appObject: AppObject) {\r\n super(appObject, AssetFilePM.type);\r\n\r\n this.asset?.addChangeObserver(this.onAssetChange);\r\n this.onAssetChange();\r\n }\r\n}\r\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from "./AppAssetListPM";
2
2
  export * from "./AssetPM";
3
+ export * from "./AssetFilePM";
3
4
  export * from "./EditingAppAssetPM";
4
5
  export * from "./ShowArchivedAppAssetPM";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/PMs/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./AppAssetListPM\";\r\nexport * from \"./AssetPM\";\r\nexport * from \"./EditingAppAssetPM\";\r\nexport * from \"./ShowArchivedAppAssetPM\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Assets/PMs/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./AppAssetListPM\";\r\nexport * from \"./AssetPM\";\r\nexport * from \"./AssetFilePM\";\r\nexport * from \"./EditingAppAssetPM\";\r\nexport * from \"./ShowArchivedAppAssetPM\";\r\n"]}
@@ -30,6 +30,7 @@ export declare abstract class AppEntity extends AppObjectEntity {
30
30
  abstract name: string;
31
31
  abstract description: string;
32
32
  abstract image_url: string;
33
+ abstract imageAssetId: string | undefined;
33
34
  abstract versions: Version[];
34
35
  abstract get latestVersion(): Version | undefined;
35
36
  abstract errorMessage?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AppEntity.d.ts","sourceRoot":"","sources":["../../../../src/Apps/Entities/AppEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,aAAa,EACb,OAAO,EACR,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,8BAAsB,SAAU,SAAQ,eAAe;IACrD,kDAAkD;IAClD,MAAM,CAAC,IAAI,SAAe;IAE1B,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;IAahD,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC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AC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7B,QAAQ,KAAK,aAAa,IAAI,OAAO,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAElC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC;IAClC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,KAAK,iBAAiB,IAAI,OAAO,GAAG,SAAS,CAAC;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAE7D"}
@@ -12,6 +12,8 @@ export interface AppVM {
12
12
  description: string;
13
13
  /** URL to the app's thumbnail or preview image */
14
14
  imageURL: string;
15
+ /** Whether the image asset is currently being fetched */
16
+ isFetching: boolean;
15
17
  }
16
18
  /**
17
19
  * Default empty AppVM for initialization
@@ -1 +1 @@
1
- {"version":3,"file":"AppPM.d.ts","sourceRoot":"","sources":["../../../../src/Apps/PMs/AppPM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGpE;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,8BAAsB,KAAM,SAAQ,WAAW,CAAC,KAAK,CAAC;IACpD,MAAM,CAAC,IAAI,SAAW;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;CAQjD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,CAErD"}
1
+ {"version":3,"file":"AppPM.d.ts","sourceRoot":"","sources":["../../../../src/Apps/PMs/AppPM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIpE;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,8BAAsB,KAAM,SAAQ,WAAW,CAAC,KAAK,CAAC;IACpD,MAAM,CAAC,IAAI,SAAW;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa;CAQjD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK,CAErD"}
@@ -0,0 +1,8 @@
1
+ import { PmAdapter } from "@vived/core";
2
+ import { AssetFileVM } from "../PMs/AssetFilePM";
3
+ /**
4
+ * Adapter for connecting AssetFilePM to UI components
5
+ * Provides the interface for React components to subscribe to AssetFileVM updates
6
+ */
7
+ export declare const assetFileAdapter: PmAdapter<AssetFileVM>;
8
+ //# sourceMappingURL=assetFileAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetFileAdapter.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Adapters/assetFileAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,SAAS,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAEL,WAAW,EAEZ,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,CAAC,WAAW,CA6CnD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./appAssetListAdapter";
2
2
  export * from "./assetAdapter";
3
+ export * from "./assetFileAdapter";
3
4
  export * from "./editingAppAssetAdapter";
4
5
  export * from "./showArchivedAppAssetAdapter";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"setupAssetsForSandbox.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Factories/setupAssetsForSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA6B5C,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,aAAa,QAuB9D"}
1
+ {"version":3,"file":"setupAssetsForSandbox.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Factories/setupAssetsForSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA8B5C,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,aAAa,QAuB9D"}
@@ -0,0 +1,19 @@
1
+ import { AppObject } from "@vived/core";
2
+ import { AssetFilePM } from "../PMs/AssetFilePM";
3
+ /**
4
+ * Mock implementation of AssetFilePM for testing
5
+ * Provides Jest mock functions for testing adapters and other components
6
+ */
7
+ export declare class AssetFilePMMock extends AssetFilePM {
8
+ /**
9
+ * Mock implementation of vmsAreEqual for testing
10
+ */
11
+ vmsAreEqual: jest.Mock<any, any, any>;
12
+ /**
13
+ * Creates a new AssetFilePMMock instance
14
+ *
15
+ * @param appObject - The app object to associate with this mock PM
16
+ */
17
+ constructor(appObject: AppObject);
18
+ }
19
+ //# sourceMappingURL=AssetFilePMMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetFilePMMock.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Mocks/AssetFilePMMock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;OAEG;IACH,WAAW,2BAAa;IAExB;;;;OAIG;gBACS,SAAS,EAAE,SAAS;CAGjC"}
@@ -1,5 +1,6 @@
1
1
  export * from "./AppAssetListPMMock";
2
2
  export * from "./AssetPMMock";
3
+ export * from "./AssetFilePMMock";
3
4
  export * from "./EditingAppAssetPMMock";
4
5
  export * from "./MockArchiveAsset";
5
6
  export * from "./MockDeleteAssetUC";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/Mocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { AppObject, AppObjectPM, AppObjectRepo } from "@vived/core";
2
+ /**
3
+ * View Model for Asset file information
4
+ * Represents the data needed by the view to display asset file status
5
+ */
6
+ export interface AssetFileVM {
7
+ /** URL to the asset's file blob for direct access */
8
+ blobURL: string | undefined;
9
+ /** Whether the asset file is currently being fetched */
10
+ isFetchingFile: boolean;
11
+ /** Whether the asset file has been successfully fetched */
12
+ fileHasBeenFetched: boolean;
13
+ /** Error that occurred during file fetching, if any */
14
+ fetchError: Error | undefined;
15
+ }
16
+ /**
17
+ * Default empty AssetFileVM for initialization
18
+ */
19
+ export declare const defaultAssetFileVM: AssetFileVM;
20
+ /**
21
+ * Presentation Manager for Asset file status
22
+ *
23
+ * The AssetFilePM is responsible for:
24
+ * - Converting the file-related properties of AssetEntity into a view-friendly format (AssetFileVM)
25
+ * - Notifying the view when asset file status changes
26
+ * - Providing comparison utilities for view models
27
+ *
28
+ * Usage:
29
+ * 1. Retrieve an instance with `AssetFilePM.getByID(assetId, appObjects)`
30
+ * 2. Subscribe to view updates with `pm.addView(callback)`
31
+ * 3. Access current view data with `pm.lastVM`
32
+ */
33
+ export declare abstract class AssetFilePM extends AppObjectPM<AssetFileVM> {
34
+ static type: string;
35
+ /**
36
+ * Retrieves an AssetFilePM instance for a specific asset by ID
37
+ *
38
+ * @param assetID - The unique identifier of the asset
39
+ * @param appObjects - The repository of app objects
40
+ * @returns The AssetFilePM instance or undefined if not found
41
+ */
42
+ static getByID(assetID: string, appObjects: AppObjectRepo): AssetFilePM | undefined;
43
+ }
44
+ /**
45
+ * Creates a new AssetFilePM instance
46
+ *
47
+ * @param appObject - The app object to associate with this PM
48
+ * @returns A new AssetFilePM instance
49
+ */
50
+ export declare function makeAssetFilePM(appObject: AppObject): AssetFilePM;
51
+ //# sourceMappingURL=AssetFilePM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetFilePM.d.ts","sourceRoot":"","sources":["../../../../src/Assets/PMs/AssetFilePM.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGpE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,wDAAwD;IACxD,cAAc,EAAE,OAAO,CAAC;IACxB,2DAA2D;IAC3D,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uDAAuD;IACvD,UAAU,EAAE,KAAK,GAAG,SAAS,CAAC;CAC/B;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAKhC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,8BAAsB,WAAY,SAAQ,WAAW,CAAC,WAAW,CAAC;IAChE,MAAM,CAAC,IAAI,SAAiB;IAE5B;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CACZ,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,aAAa,GACxB,WAAW,GAAG,SAAS;CAoB3B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,WAAW,CAEjE"}
@@ -1,5 +1,6 @@
1
1
  export * from "./AppAssetListPM";
2
2
  export * from "./AssetPM";
3
+ export * from "./AssetFilePM";
3
4
  export * from "./EditingAppAssetPM";
4
5
  export * from "./ShowArchivedAppAssetPM";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/PMs/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Assets/PMs/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}