@vived/host 4.8.0 → 4.8.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.
- package/dist/cjs/Cache/Factories/setupCache.js +3 -5
- package/dist/cjs/Cache/Factories/setupCache.js.map +1 -1
- package/dist/cjs/Cache/UCs/GetAssetFromCacheUC.js +14 -14
- package/dist/cjs/Cache/UCs/GetAssetFromCacheUC.js.map +1 -1
- package/dist/cjs/Cache/UCs/GetScriptFromCacheUC.js +15 -15
- package/dist/cjs/Cache/UCs/GetScriptFromCacheUC.js.map +1 -1
- package/dist/cjs/Cache/UCs/StoreAssetInCacheUC.js +13 -13
- package/dist/cjs/Cache/UCs/StoreAssetInCacheUC.js.map +1 -1
- package/dist/cjs/Cache/UCs/StoreScriptInCacheUC.js +14 -14
- package/dist/cjs/Cache/UCs/StoreScriptInCacheUC.js.map +1 -1
- package/dist/esm/Cache/Factories/setupCache.js +3 -5
- package/dist/esm/Cache/Factories/setupCache.js.map +1 -1
- package/dist/esm/Cache/UCs/GetAssetFromCacheUC.js +14 -14
- package/dist/esm/Cache/UCs/GetAssetFromCacheUC.js.map +1 -1
- package/dist/esm/Cache/UCs/GetScriptFromCacheUC.js +15 -15
- package/dist/esm/Cache/UCs/GetScriptFromCacheUC.js.map +1 -1
- package/dist/esm/Cache/UCs/StoreAssetInCacheUC.js +13 -13
- package/dist/esm/Cache/UCs/StoreAssetInCacheUC.js.map +1 -1
- package/dist/esm/Cache/UCs/StoreScriptInCacheUC.js +14 -14
- package/dist/esm/Cache/UCs/StoreScriptInCacheUC.js.map +1 -1
- package/dist/types/Cache/Factories/setupCache.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupCache = setupCache;
|
|
4
|
-
const ScriptCacheEntity_1 = require("../Entities/ScriptCacheEntity");
|
|
5
|
-
const CacheEntity_1 = require("../Entities/CacheEntity");
|
|
6
4
|
const AssetCacheEntity_1 = require("../Entities/AssetCacheEntity");
|
|
7
|
-
const
|
|
8
|
-
const StoreScriptInCacheUC_1 = require("../UCs/StoreScriptInCacheUC");
|
|
5
|
+
const ScriptCacheEntity_1 = require("../Entities/ScriptCacheEntity");
|
|
9
6
|
const GetAssetFromCacheUC_1 = require("../UCs/GetAssetFromCacheUC");
|
|
7
|
+
const GetScriptFromCacheUC_1 = require("../UCs/GetScriptFromCacheUC");
|
|
10
8
|
const StoreAssetInCacheUC_1 = require("../UCs/StoreAssetInCacheUC");
|
|
9
|
+
const StoreScriptInCacheUC_1 = require("../UCs/StoreScriptInCacheUC");
|
|
11
10
|
/**
|
|
12
11
|
* Sets up the Cache feature components
|
|
13
12
|
*/
|
|
@@ -15,7 +14,6 @@ function setupCache(appObjects) {
|
|
|
15
14
|
// Create Cache Entity app object
|
|
16
15
|
const cacheEntityAO = appObjects.getOrCreate("Cache");
|
|
17
16
|
// Create entities
|
|
18
|
-
(0, CacheEntity_1.makeCacheEntity)(cacheEntityAO);
|
|
19
17
|
(0, ScriptCacheEntity_1.makeScriptCacheEntity)(cacheEntityAO);
|
|
20
18
|
(0, AssetCacheEntity_1.makeAssetCacheEntity)(cacheEntityAO);
|
|
21
19
|
// Create use cases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupCache.js","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"setupCache.js","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":";;AAWA,gCAaC;AAvBD,mEAAoE;AACpE,qEAAsE;AACtE,oEAAqE;AACrE,sEAAuE;AACvE,oEAAqE;AACrE,sEAAuE;AAEvE;;GAEG;AACH,SAAgB,UAAU,CAAC,UAAyB;IAClD,iCAAiC;IACjC,MAAM,aAAa,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtD,kBAAkB;IAClB,IAAA,yCAAqB,EAAC,aAAa,CAAC,CAAC;IACrC,IAAA,uCAAoB,EAAC,aAAa,CAAC,CAAC;IAEpC,mBAAmB;IACnB,IAAA,+CAAwB,EAAC,aAAa,CAAC,CAAC;IACxC,IAAA,+CAAwB,EAAC,aAAa,CAAC,CAAC;IACxC,IAAA,6CAAuB,EAAC,aAAa,CAAC,CAAC;IACvC,IAAA,6CAAuB,EAAC,aAAa,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport { makeAssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\nimport { makeScriptCacheEntity } from \"../Entities/ScriptCacheEntity\";\r\nimport { makeGetAssetFromCacheUC } from \"../UCs/GetAssetFromCacheUC\";\r\nimport { makeGetScriptFromCacheUC } from \"../UCs/GetScriptFromCacheUC\";\r\nimport { makeStoreAssetInCacheUC } from \"../UCs/StoreAssetInCacheUC\";\r\nimport { makeStoreScriptInCacheUC } from \"../UCs/StoreScriptInCacheUC\";\r\n\r\n/**\r\n * Sets up the Cache feature components\r\n */\r\nexport function setupCache(appObjects: AppObjectRepo): void {\r\n // Create Cache Entity app object\r\n const cacheEntityAO = appObjects.getOrCreate(\"Cache\");\r\n\r\n // Create entities\r\n makeScriptCacheEntity(cacheEntityAO);\r\n makeAssetCacheEntity(cacheEntityAO);\r\n\r\n // Create use cases\r\n makeGetScriptFromCacheUC(cacheEntityAO);\r\n makeStoreScriptInCacheUC(cacheEntityAO);\r\n makeGetAssetFromCacheUC(cacheEntityAO);\r\n makeStoreAssetInCacheUC(cacheEntityAO);\r\n}\r\n"]}
|
|
@@ -18,22 +18,22 @@ class GetAssetFromCacheUCImp extends GetAssetFromCacheUC {
|
|
|
18
18
|
get assetCacheEntity() {
|
|
19
19
|
return this.getCachedSingleton(AssetCacheEntity_1.AssetCacheEntity.type);
|
|
20
20
|
}
|
|
21
|
-
async getAsset(assetId) {
|
|
22
|
-
const assetCache = this.assetCacheEntity;
|
|
23
|
-
if (!assetCache) {
|
|
24
|
-
this.warn("AssetCacheEntity not found");
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
return await assetCache.getAsset(assetId);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
this.warn(`Error retrieving asset from cache for ID: ${assetId}`);
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
21
|
constructor(appObject) {
|
|
36
22
|
super(appObject, GetAssetFromCacheUC.type);
|
|
23
|
+
this.getAsset = async (assetId) => {
|
|
24
|
+
const assetCache = this.assetCacheEntity;
|
|
25
|
+
if (!assetCache) {
|
|
26
|
+
this.warn("AssetCacheEntity not found");
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
return await assetCache.getAsset(assetId);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
this.warn(`Error retrieving asset from cache for ID: ${assetId}`);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
37
|
this.appObjects.registerSingleton(this);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetAssetFromCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/GetAssetFromCacheUC.ts"],"names":[],"mappings":";;;AAkBA,0DAIC;AAtBD,sCAKqB;AACrB,mEAAgE;AAEhE,MAAsB,mBAAoB,SAAQ,kBAAW;IAK3D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAC,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;;AAPH,kDAQC;AAPiB,wBAAI,GAAG,qBAAqB,CAAC;AAS/C,SAAgB,uBAAuB,CACrC,SAAoB;IAEpB,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;A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,6CAA6C,OAAO,EAAE,CAAC,CAAC;gBAClE,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,CAAA;QAIC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { AssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\n\r\nexport abstract class GetAssetFromCacheUC extends AppObjectUC {\r\n static readonly type = \"GetAssetFromCacheUC\";\r\n\r\n abstract getAsset(assetId: string): Promise<Blob | undefined>;\r\n\r\n static get(appObjects: AppObjectRepo): GetAssetFromCacheUC | undefined {\r\n return getSingletonComponent(GetAssetFromCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeGetAssetFromCacheUC(\r\n appObject: AppObject\r\n): GetAssetFromCacheUC {\r\n return new GetAssetFromCacheUCImp(appObject);\r\n}\r\n\r\nclass GetAssetFromCacheUCImp extends GetAssetFromCacheUC {\r\n private get assetCacheEntity(): AssetCacheEntity | undefined {\r\n return this.getCachedSingleton<AssetCacheEntity>(AssetCacheEntity.type);\r\n }\r\n\r\n getAsset = async (assetId: string): Promise<Blob | undefined> => {\r\n const assetCache = this.assetCacheEntity;\r\n if (!assetCache) {\r\n this.warn(\"AssetCacheEntity not found\");\r\n return undefined;\r\n }\r\n\r\n try {\r\n return await assetCache.getAsset(assetId);\r\n } catch (e) {\r\n this.warn(`Error retrieving asset from cache for ID: ${assetId}`);\r\n return undefined;\r\n }\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetAssetFromCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -18,21 +18,6 @@ class GetScriptFromCacheUCImp extends GetScriptFromCacheUC {
|
|
|
18
18
|
get scriptCacheEntity() {
|
|
19
19
|
return this.getCachedSingleton(ScriptCacheEntity_1.ScriptCacheEntity.type);
|
|
20
20
|
}
|
|
21
|
-
async getScript(url) {
|
|
22
|
-
const scriptCache = this.scriptCacheEntity;
|
|
23
|
-
if (!scriptCache) {
|
|
24
|
-
this.warn("ScriptCacheEntity not found");
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
29
|
-
return await scriptCache.getScript(appId, version, scriptPath);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
this.warn(`Error retrieving script from cache for URL: ${url}`);
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
21
|
extractScriptInfo(url) {
|
|
37
22
|
const scriptCache = this.scriptCacheEntity;
|
|
38
23
|
if (!scriptCache) {
|
|
@@ -43,6 +28,21 @@ class GetScriptFromCacheUCImp extends GetScriptFromCacheUC {
|
|
|
43
28
|
}
|
|
44
29
|
constructor(appObject) {
|
|
45
30
|
super(appObject, GetScriptFromCacheUC.type);
|
|
31
|
+
this.getScript = async (url) => {
|
|
32
|
+
const scriptCache = this.scriptCacheEntity;
|
|
33
|
+
if (!scriptCache) {
|
|
34
|
+
this.warn("ScriptCacheEntity not found");
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
39
|
+
return await scriptCache.getScript(appId, version, scriptPath);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
this.warn(`Error retrieving script from cache for URL: ${url}`);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
46
|
this.appObjects.registerSingleton(this);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetScriptFromCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/GetScriptFromCacheUC.ts"],"names":[],"mappings":";;;AAuBA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AAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;QA/B7C,cAAS,GAAI,KAAK,EAAC,GAAW,EAA+B,EAAE;YAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;gBACzC,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;gBACnE,OAAO,MAAM,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YACjE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,+CAA+C,GAAG,EAAE,CAAC,CAAC;gBAChE,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,CAAA;QAkBC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { ScriptCacheEntity } from \"../Entities/ScriptCacheEntity\";\r\n\r\nexport abstract class GetScriptFromCacheUC extends AppObjectUC {\r\n static readonly type = \"GetScriptFromCacheUC\";\r\n\r\n abstract getScript(url: string): Promise<string | undefined>;\r\n abstract extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n };\r\n\r\n static get(appObjects: AppObjectRepo): GetScriptFromCacheUC | undefined {\r\n return getSingletonComponent(GetScriptFromCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeGetScriptFromCacheUC(\r\n appObject: AppObject\r\n): GetScriptFromCacheUC {\r\n return new GetScriptFromCacheUCImp(appObject);\r\n}\r\n\r\nclass GetScriptFromCacheUCImp extends GetScriptFromCacheUC {\r\n private get scriptCacheEntity(): ScriptCacheEntity | undefined {\r\n return this.getCachedSingleton<ScriptCacheEntity>(ScriptCacheEntity.type);\r\n }\r\n\r\n getScript = async(url: string): Promise<string | undefined> => {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return undefined;\r\n }\r\n\r\n try {\r\n const { appId, version, scriptPath } = this.extractScriptInfo(url);\r\n return await scriptCache.getScript(appId, version, scriptPath);\r\n } catch (e) {\r\n this.warn(`Error retrieving script from cache for URL: ${url}`);\r\n return undefined;\r\n }\r\n }\r\n\r\n extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n } {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return { appId: \"unknown\", version: \"unknown\", scriptPath: \"unknown\" };\r\n }\r\n\r\n return scriptCache.extractScriptInfo(url);\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetScriptFromCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -18,21 +18,21 @@ class StoreAssetInCacheUCImp extends StoreAssetInCacheUC {
|
|
|
18
18
|
get assetCacheEntity() {
|
|
19
19
|
return this.getCachedSingleton(AssetCacheEntity_1.AssetCacheEntity.type);
|
|
20
20
|
}
|
|
21
|
-
async storeAsset(assetId, content, contentType) {
|
|
22
|
-
const assetCache = this.assetCacheEntity;
|
|
23
|
-
if (!assetCache) {
|
|
24
|
-
this.warn("AssetCacheEntity not found");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
await assetCache.storeAsset(assetId, content, contentType);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
this.warn(`Error storing asset in cache for ID: ${assetId}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
21
|
constructor(appObject) {
|
|
35
22
|
super(appObject, StoreAssetInCacheUC.type);
|
|
23
|
+
this.storeAsset = async (assetId, content, contentType) => {
|
|
24
|
+
const assetCache = this.assetCacheEntity;
|
|
25
|
+
if (!assetCache) {
|
|
26
|
+
this.warn("AssetCacheEntity not found");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
await assetCache.storeAsset(assetId, content, contentType);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
this.warn(`Error storing asset in cache for ID: ${assetId}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
36
|
this.appObjects.registerSingleton(this);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreAssetInCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/StoreAssetInCacheUC.ts"],"names":[],"mappings":";;;AAsBA,0DAIC;AA1BD,sCAKqB;AACrB,mEAAgE;AAEhE,MAAsB,mBAAoB,SAAQ,kBAAW;IAS3D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,IAAA,4BAAqB,EAAC,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;;AAXH,kDAYC;AAXiB,wBAAI,GAAG,qBAAqB,CAAC;AAa/C,SAAgB,uBAAuB,CACrC,SAAoB;IAEpB,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,sBAAuB,SAAQ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EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAA;QAIC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { AssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\n\r\nexport abstract class StoreAssetInCacheUC extends AppObjectUC {\r\n static readonly type = \"StoreAssetInCacheUC\";\r\n\r\n abstract storeAsset(\r\n assetId: string,\r\n content: Blob,\r\n contentType?: string\r\n ): Promise<void>;\r\n\r\n static get(appObjects: AppObjectRepo): StoreAssetInCacheUC | undefined {\r\n return getSingletonComponent(StoreAssetInCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeStoreAssetInCacheUC(\r\n appObject: AppObject\r\n): StoreAssetInCacheUC {\r\n return new StoreAssetInCacheUCImp(appObject);\r\n}\r\n\r\nclass StoreAssetInCacheUCImp extends StoreAssetInCacheUC {\r\n private get assetCacheEntity(): AssetCacheEntity | undefined {\r\n return this.getCachedSingleton<AssetCacheEntity>(AssetCacheEntity.type);\r\n }\r\n\r\n storeAsset = async (\r\n assetId: string,\r\n content: Blob,\r\n contentType?: string\r\n ): Promise<void> => {\r\n const assetCache = this.assetCacheEntity;\r\n if (!assetCache) {\r\n this.warn(\"AssetCacheEntity not found\");\r\n return;\r\n }\r\n\r\n try {\r\n await assetCache.storeAsset(assetId, content, contentType);\r\n } catch (e) {\r\n this.warn(`Error storing asset in cache for ID: ${assetId}`);\r\n }\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, StoreAssetInCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -18,20 +18,6 @@ class StoreScriptInCacheUCImp extends StoreScriptInCacheUC {
|
|
|
18
18
|
get scriptCacheEntity() {
|
|
19
19
|
return this.getCachedSingleton(ScriptCacheEntity_1.ScriptCacheEntity.type);
|
|
20
20
|
}
|
|
21
|
-
async storeScript(url, content) {
|
|
22
|
-
const scriptCache = this.scriptCacheEntity;
|
|
23
|
-
if (!scriptCache) {
|
|
24
|
-
this.warn("ScriptCacheEntity not found");
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
29
|
-
await scriptCache.storeScript(appId, version, scriptPath, content);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
this.warn(`Error storing script in cache for URL: ${url}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
21
|
extractScriptInfo(url) {
|
|
36
22
|
const scriptCache = this.scriptCacheEntity;
|
|
37
23
|
if (!scriptCache) {
|
|
@@ -42,6 +28,20 @@ class StoreScriptInCacheUCImp extends StoreScriptInCacheUC {
|
|
|
42
28
|
}
|
|
43
29
|
constructor(appObject) {
|
|
44
30
|
super(appObject, StoreScriptInCacheUC.type);
|
|
31
|
+
this.storeScript = async (url, content) => {
|
|
32
|
+
const scriptCache = this.scriptCacheEntity;
|
|
33
|
+
if (!scriptCache) {
|
|
34
|
+
this.warn("ScriptCacheEntity not found");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
39
|
+
await scriptCache.storeScript(appId, version, scriptPath, content);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
this.warn(`Error storing script in cache for URL: ${url}`);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
45
|
this.appObjects.registerSingleton(this);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreScriptInCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/StoreScriptInCacheUC.ts"],"names":[],"mappings":";;;AAuBA,4DAIC;AA3BD,sCAKqB;AACr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AC,CAAC;YACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,WAAW,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;QA9B9C,gBAAW,GAAG,KAAK,EAAE,GAAW,EAAE,OAAe,EAAiB,EAAE;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;gBACzC,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;gBACnE,MAAM,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,0CAA0C,GAAG,EAAE,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC;QAkBA,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { ScriptCacheEntity } from \"../Entities/ScriptCacheEntity\";\r\n\r\nexport abstract class StoreScriptInCacheUC extends AppObjectUC {\r\n static readonly type = \"StoreScriptInCacheUC\";\r\n\r\n abstract storeScript(url: string, content: string): Promise<void>;\r\n abstract extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n };\r\n\r\n static get(appObjects: AppObjectRepo): StoreScriptInCacheUC | undefined {\r\n return getSingletonComponent(StoreScriptInCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeStoreScriptInCacheUC(\r\n appObject: AppObject\r\n): StoreScriptInCacheUC {\r\n return new StoreScriptInCacheUCImp(appObject);\r\n}\r\n\r\nclass StoreScriptInCacheUCImp extends StoreScriptInCacheUC {\r\n private get scriptCacheEntity(): ScriptCacheEntity | undefined {\r\n return this.getCachedSingleton<ScriptCacheEntity>(ScriptCacheEntity.type);\r\n }\r\n\r\n storeScript = async (url: string, content: string): Promise<void> => {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return;\r\n }\r\n\r\n try {\r\n const { appId, version, scriptPath } = this.extractScriptInfo(url);\r\n await scriptCache.storeScript(appId, version, scriptPath, content);\r\n } catch (e) {\r\n this.warn(`Error storing script in cache for URL: ${url}`);\r\n }\r\n };\r\n\r\n extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n } {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return { appId: \"unknown\", version: \"unknown\", scriptPath: \"unknown\" };\r\n }\r\n\r\n return scriptCache.extractScriptInfo(url);\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, StoreScriptInCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { makeScriptCacheEntity } from "../Entities/ScriptCacheEntity";
|
|
2
|
-
import { makeCacheEntity } from "../Entities/CacheEntity";
|
|
3
1
|
import { makeAssetCacheEntity } from "../Entities/AssetCacheEntity";
|
|
4
|
-
import {
|
|
5
|
-
import { makeStoreScriptInCacheUC } from "../UCs/StoreScriptInCacheUC";
|
|
2
|
+
import { makeScriptCacheEntity } from "../Entities/ScriptCacheEntity";
|
|
6
3
|
import { makeGetAssetFromCacheUC } from "../UCs/GetAssetFromCacheUC";
|
|
4
|
+
import { makeGetScriptFromCacheUC } from "../UCs/GetScriptFromCacheUC";
|
|
7
5
|
import { makeStoreAssetInCacheUC } from "../UCs/StoreAssetInCacheUC";
|
|
6
|
+
import { makeStoreScriptInCacheUC } from "../UCs/StoreScriptInCacheUC";
|
|
8
7
|
/**
|
|
9
8
|
* Sets up the Cache feature components
|
|
10
9
|
*/
|
|
@@ -12,7 +11,6 @@ export function setupCache(appObjects) {
|
|
|
12
11
|
// Create Cache Entity app object
|
|
13
12
|
const cacheEntityAO = appObjects.getOrCreate("Cache");
|
|
14
13
|
// Create entities
|
|
15
|
-
makeCacheEntity(cacheEntityAO);
|
|
16
14
|
makeScriptCacheEntity(cacheEntityAO);
|
|
17
15
|
makeAssetCacheEntity(cacheEntityAO);
|
|
18
16
|
// Create use cases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupCache.js","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"setupCache.js","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,UAAyB;IAClD,iCAAiC;IACjC,MAAM,aAAa,GAAG,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtD,kBAAkB;IAClB,qBAAqB,CAAC,aAAa,CAAC,CAAC;IACrC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAEpC,mBAAmB;IACnB,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACxC,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACxC,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACvC,uBAAuB,CAAC,aAAa,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { AppObjectRepo } from \"@vived/core\";\r\nimport { makeAssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\nimport { makeScriptCacheEntity } from \"../Entities/ScriptCacheEntity\";\r\nimport { makeGetAssetFromCacheUC } from \"../UCs/GetAssetFromCacheUC\";\r\nimport { makeGetScriptFromCacheUC } from \"../UCs/GetScriptFromCacheUC\";\r\nimport { makeStoreAssetInCacheUC } from \"../UCs/StoreAssetInCacheUC\";\r\nimport { makeStoreScriptInCacheUC } from \"../UCs/StoreScriptInCacheUC\";\r\n\r\n/**\r\n * Sets up the Cache feature components\r\n */\r\nexport function setupCache(appObjects: AppObjectRepo): void {\r\n // Create Cache Entity app object\r\n const cacheEntityAO = appObjects.getOrCreate(\"Cache\");\r\n\r\n // Create entities\r\n makeScriptCacheEntity(cacheEntityAO);\r\n makeAssetCacheEntity(cacheEntityAO);\r\n\r\n // Create use cases\r\n makeGetScriptFromCacheUC(cacheEntityAO);\r\n makeStoreScriptInCacheUC(cacheEntityAO);\r\n makeGetAssetFromCacheUC(cacheEntityAO);\r\n makeStoreAssetInCacheUC(cacheEntityAO);\r\n}\r\n"]}
|
|
@@ -13,22 +13,22 @@ class GetAssetFromCacheUCImp extends GetAssetFromCacheUC {
|
|
|
13
13
|
get assetCacheEntity() {
|
|
14
14
|
return this.getCachedSingleton(AssetCacheEntity.type);
|
|
15
15
|
}
|
|
16
|
-
async getAsset(assetId) {
|
|
17
|
-
const assetCache = this.assetCacheEntity;
|
|
18
|
-
if (!assetCache) {
|
|
19
|
-
this.warn("AssetCacheEntity not found");
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
return await assetCache.getAsset(assetId);
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
this.warn(`Error retrieving asset from cache for ID: ${assetId}`);
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
16
|
constructor(appObject) {
|
|
31
17
|
super(appObject, GetAssetFromCacheUC.type);
|
|
18
|
+
this.getAsset = async (assetId) => {
|
|
19
|
+
const assetCache = this.assetCacheEntity;
|
|
20
|
+
if (!assetCache) {
|
|
21
|
+
this.warn("AssetCacheEntity not found");
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return await assetCache.getAsset(assetId);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
this.warn(`Error retrieving asset from cache for ID: ${assetId}`);
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
32
|
this.appObjects.registerSingleton(this);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetAssetFromCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/GetAssetFromCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,OAAgB,mBAAoB,SAAQ,WAAW;IAK3D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;;AANe,wBAAI,GAAG,qBAAqB,CAAC;AAS/C,MAAM,UAAU,uBAAuB,CACrC,SAAoB;IAEpB,OAAO,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAA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YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,6CAA6C,OAAO,EAAE,CAAC,CAAC;gBAClE,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,CAAA;QAIC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { AssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\n\r\nexport abstract class GetAssetFromCacheUC extends AppObjectUC {\r\n static readonly type = \"GetAssetFromCacheUC\";\r\n\r\n abstract getAsset(assetId: string): Promise<Blob | undefined>;\r\n\r\n static get(appObjects: AppObjectRepo): GetAssetFromCacheUC | undefined {\r\n return getSingletonComponent(GetAssetFromCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeGetAssetFromCacheUC(\r\n appObject: AppObject\r\n): GetAssetFromCacheUC {\r\n return new GetAssetFromCacheUCImp(appObject);\r\n}\r\n\r\nclass GetAssetFromCacheUCImp extends GetAssetFromCacheUC {\r\n private get assetCacheEntity(): AssetCacheEntity | undefined {\r\n return this.getCachedSingleton<AssetCacheEntity>(AssetCacheEntity.type);\r\n }\r\n\r\n getAsset = async (assetId: string): Promise<Blob | undefined> => {\r\n const assetCache = this.assetCacheEntity;\r\n if (!assetCache) {\r\n this.warn(\"AssetCacheEntity not found\");\r\n return undefined;\r\n }\r\n\r\n try {\r\n return await assetCache.getAsset(assetId);\r\n } catch (e) {\r\n this.warn(`Error retrieving asset from cache for ID: ${assetId}`);\r\n return undefined;\r\n }\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetAssetFromCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -13,21 +13,6 @@ class GetScriptFromCacheUCImp extends GetScriptFromCacheUC {
|
|
|
13
13
|
get scriptCacheEntity() {
|
|
14
14
|
return this.getCachedSingleton(ScriptCacheEntity.type);
|
|
15
15
|
}
|
|
16
|
-
async getScript(url) {
|
|
17
|
-
const scriptCache = this.scriptCacheEntity;
|
|
18
|
-
if (!scriptCache) {
|
|
19
|
-
this.warn("ScriptCacheEntity not found");
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
24
|
-
return await scriptCache.getScript(appId, version, scriptPath);
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
this.warn(`Error retrieving script from cache for URL: ${url}`);
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
16
|
extractScriptInfo(url) {
|
|
32
17
|
const scriptCache = this.scriptCacheEntity;
|
|
33
18
|
if (!scriptCache) {
|
|
@@ -38,6 +23,21 @@ class GetScriptFromCacheUCImp extends GetScriptFromCacheUC {
|
|
|
38
23
|
}
|
|
39
24
|
constructor(appObject) {
|
|
40
25
|
super(appObject, GetScriptFromCacheUC.type);
|
|
26
|
+
this.getScript = async (url) => {
|
|
27
|
+
const scriptCache = this.scriptCacheEntity;
|
|
28
|
+
if (!scriptCache) {
|
|
29
|
+
this.warn("ScriptCacheEntity not found");
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
34
|
+
return await scriptCache.getScript(appId, version, scriptPath);
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
this.warn(`Error retrieving script from cache for URL: ${url}`);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
41
|
this.appObjects.registerSingleton(this);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetScriptFromCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/GetScriptFromCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,OAAgB,oBAAqB,SAAQ,WAAW;IAU5D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtE,CAAC;;AAXe,yBAAI,GAAG,sBAAsB,CAAC;AAchD,MAAM,UAAU,wBAAwB,CACtC,SAAoB;IAEpB,OAAO,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,uBAAwB,SAAQ,oBAAoB;IACxD,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAoB,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;
|
|
1
|
+
{"version":3,"file":"GetScriptFromCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/GetScriptFromCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,OAAgB,oBAAqB,SAAQ,WAAW;IAU5D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtE,CAAC;;AAXe,yBAAI,GAAG,sBAAsB,CAAC;AAchD,MAAM,UAAU,wBAAwB,CACtC,SAAoB;IAEpB,OAAO,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,uBAAwB,SAAQ,oBAAoB;IACxD,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAoB,iBAAiB,CAAC,IAAI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Entity } from \"../Entities/ScriptCacheEntity\";\r\n\r\nexport abstract class GetScriptFromCacheUC extends AppObjectUC {\r\n static readonly type = \"GetScriptFromCacheUC\";\r\n\r\n abstract getScript(url: string): Promise<string | undefined>;\r\n abstract extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n };\r\n\r\n static get(appObjects: AppObjectRepo): GetScriptFromCacheUC | undefined {\r\n return getSingletonComponent(GetScriptFromCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeGetScriptFromCacheUC(\r\n appObject: AppObject\r\n): GetScriptFromCacheUC {\r\n return new GetScriptFromCacheUCImp(appObject);\r\n}\r\n\r\nclass GetScriptFromCacheUCImp extends GetScriptFromCacheUC {\r\n private get scriptCacheEntity(): ScriptCacheEntity | undefined {\r\n return this.getCachedSingleton<ScriptCacheEntity>(ScriptCacheEntity.type);\r\n }\r\n\r\n getScript = async(url: string): Promise<string | undefined> => {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return undefined;\r\n }\r\n\r\n try {\r\n const { appId, version, scriptPath } = this.extractScriptInfo(url);\r\n return await scriptCache.getScript(appId, version, scriptPath);\r\n } catch (e) {\r\n this.warn(`Error retrieving script from cache for URL: ${url}`);\r\n return undefined;\r\n }\r\n }\r\n\r\n extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n } {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return { appId: \"unknown\", version: \"unknown\", scriptPath: \"unknown\" };\r\n }\r\n\r\n return scriptCache.extractScriptInfo(url);\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, GetScriptFromCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -13,21 +13,21 @@ class StoreAssetInCacheUCImp extends StoreAssetInCacheUC {
|
|
|
13
13
|
get assetCacheEntity() {
|
|
14
14
|
return this.getCachedSingleton(AssetCacheEntity.type);
|
|
15
15
|
}
|
|
16
|
-
async storeAsset(assetId, content, contentType) {
|
|
17
|
-
const assetCache = this.assetCacheEntity;
|
|
18
|
-
if (!assetCache) {
|
|
19
|
-
this.warn("AssetCacheEntity not found");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
await assetCache.storeAsset(assetId, content, contentType);
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
this.warn(`Error storing asset in cache for ID: ${assetId}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
16
|
constructor(appObject) {
|
|
30
17
|
super(appObject, StoreAssetInCacheUC.type);
|
|
18
|
+
this.storeAsset = async (assetId, content, contentType) => {
|
|
19
|
+
const assetCache = this.assetCacheEntity;
|
|
20
|
+
if (!assetCache) {
|
|
21
|
+
this.warn("AssetCacheEntity not found");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
await assetCache.storeAsset(assetId, content, contentType);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
this.warn(`Error storing asset in cache for ID: ${assetId}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
31
|
this.appObjects.registerSingleton(this);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreAssetInCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/StoreAssetInCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,OAAgB,mBAAoB,SAAQ,WAAW;IAS3D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,mBAAmB,CAAC,IAAI,EAA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ChB,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;gBACxC,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,wCAAwC,OAAO,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAA;QAIC,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { AssetCacheEntity } from \"../Entities/AssetCacheEntity\";\r\n\r\nexport abstract class StoreAssetInCacheUC extends AppObjectUC {\r\n static readonly type = \"StoreAssetInCacheUC\";\r\n\r\n abstract storeAsset(\r\n assetId: string,\r\n content: Blob,\r\n contentType?: string\r\n ): Promise<void>;\r\n\r\n static get(appObjects: AppObjectRepo): StoreAssetInCacheUC | undefined {\r\n return getSingletonComponent(StoreAssetInCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeStoreAssetInCacheUC(\r\n appObject: AppObject\r\n): StoreAssetInCacheUC {\r\n return new StoreAssetInCacheUCImp(appObject);\r\n}\r\n\r\nclass StoreAssetInCacheUCImp extends StoreAssetInCacheUC {\r\n private get assetCacheEntity(): AssetCacheEntity | undefined {\r\n return this.getCachedSingleton<AssetCacheEntity>(AssetCacheEntity.type);\r\n }\r\n\r\n storeAsset = async (\r\n assetId: string,\r\n content: Blob,\r\n contentType?: string\r\n ): Promise<void> => {\r\n const assetCache = this.assetCacheEntity;\r\n if (!assetCache) {\r\n this.warn(\"AssetCacheEntity not found\");\r\n return;\r\n }\r\n\r\n try {\r\n await assetCache.storeAsset(assetId, content, contentType);\r\n } catch (e) {\r\n this.warn(`Error storing asset in cache for ID: ${assetId}`);\r\n }\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, StoreAssetInCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -13,20 +13,6 @@ class StoreScriptInCacheUCImp extends StoreScriptInCacheUC {
|
|
|
13
13
|
get scriptCacheEntity() {
|
|
14
14
|
return this.getCachedSingleton(ScriptCacheEntity.type);
|
|
15
15
|
}
|
|
16
|
-
async storeScript(url, content) {
|
|
17
|
-
const scriptCache = this.scriptCacheEntity;
|
|
18
|
-
if (!scriptCache) {
|
|
19
|
-
this.warn("ScriptCacheEntity not found");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
24
|
-
await scriptCache.storeScript(appId, version, scriptPath, content);
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
this.warn(`Error storing script in cache for URL: ${url}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
16
|
extractScriptInfo(url) {
|
|
31
17
|
const scriptCache = this.scriptCacheEntity;
|
|
32
18
|
if (!scriptCache) {
|
|
@@ -37,6 +23,20 @@ class StoreScriptInCacheUCImp extends StoreScriptInCacheUC {
|
|
|
37
23
|
}
|
|
38
24
|
constructor(appObject) {
|
|
39
25
|
super(appObject, StoreScriptInCacheUC.type);
|
|
26
|
+
this.storeScript = async (url, content) => {
|
|
27
|
+
const scriptCache = this.scriptCacheEntity;
|
|
28
|
+
if (!scriptCache) {
|
|
29
|
+
this.warn("ScriptCacheEntity not found");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const { appId, version, scriptPath } = this.extractScriptInfo(url);
|
|
34
|
+
await scriptCache.storeScript(appId, version, scriptPath, content);
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
this.warn(`Error storing script in cache for URL: ${url}`);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
40
|
this.appObjects.registerSingleton(this);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreScriptInCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/StoreScriptInCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,OAAgB,oBAAqB,SAAQ,WAAW;IAU5D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtE,CAAC;;AAXe,yBAAI,GAAG,sBAAsB,CAAC;AAchD,MAAM,UAAU,wBAAwB,CACtC,SAAoB;IAEpB,OAAO,IAAI,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,uBAAwB,SAAQ,oBAAoB;IACxD,IAAY,iBAAiB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAoB,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;
|
|
1
|
+
{"version":3,"file":"StoreScriptInCacheUC.js","sourceRoot":"","sources":["../../../../src/Cache/UCs/StoreScriptInCacheUC.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,OAAgB,oBAAqB,SAAQ,WAAW;IAU5D,MAAM,CAAC,GAAG,CAAC,UAAyB;QAClC,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtE,CAAC;;AAXe,yBAAI,GAAG,sBAAsB,CAAC;AAchD,MAAM,UAAU,wBAAwB,CACtC,SAAoB;IAEpB,OAA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AiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC,\r\n getSingletonComponent\r\n} from \"@vived/core\";\r\nimport { ScriptCacheEntity } from \"../Entities/ScriptCacheEntity\";\r\n\r\nexport abstract class StoreScriptInCacheUC extends AppObjectUC {\r\n static readonly type = \"StoreScriptInCacheUC\";\r\n\r\n abstract storeScript(url: string, content: string): Promise<void>;\r\n abstract extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n };\r\n\r\n static get(appObjects: AppObjectRepo): StoreScriptInCacheUC | undefined {\r\n return getSingletonComponent(StoreScriptInCacheUC.type, appObjects);\r\n }\r\n}\r\n\r\nexport function makeStoreScriptInCacheUC(\r\n appObject: AppObject\r\n): StoreScriptInCacheUC {\r\n return new StoreScriptInCacheUCImp(appObject);\r\n}\r\n\r\nclass StoreScriptInCacheUCImp extends StoreScriptInCacheUC {\r\n private get scriptCacheEntity(): ScriptCacheEntity | undefined {\r\n return this.getCachedSingleton<ScriptCacheEntity>(ScriptCacheEntity.type);\r\n }\r\n\r\n storeScript = async (url: string, content: string): Promise<void> => {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return;\r\n }\r\n\r\n try {\r\n const { appId, version, scriptPath } = this.extractScriptInfo(url);\r\n await scriptCache.storeScript(appId, version, scriptPath, content);\r\n } catch (e) {\r\n this.warn(`Error storing script in cache for URL: ${url}`);\r\n }\r\n };\r\n\r\n extractScriptInfo(url: string): {\r\n appId: string;\r\n version: string;\r\n scriptPath: string;\r\n } {\r\n const scriptCache = this.scriptCacheEntity;\r\n if (!scriptCache) {\r\n this.warn(\"ScriptCacheEntity not found\");\r\n return { appId: \"unknown\", version: \"unknown\", scriptPath: \"unknown\" };\r\n }\r\n\r\n return scriptCache.extractScriptInfo(url);\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, StoreScriptInCacheUC.type);\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupCache.d.ts","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"setupCache.d.ts","sourceRoot":"","sources":["../../../../src/Cache/Factories/setupCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQ5C;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CAa1D"}
|