asma-helpers 0.7.2 → 0.7.4
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/lib/helpers/clearCacheData.d.ts +9 -0
- package/lib/helpers/clearCacheData.d.ts.map +1 -1
- package/lib/helpers/clearCacheData.js +8 -0
- package/lib/helpers/clearCacheData.js.map +1 -1
- package/lib/helpers/initASMAAppVitals.d.ts +2 -3
- package/lib/helpers/initASMAAppVitals.d.ts.map +1 -1
- package/lib/helpers/initASMAAppVitals.js +1 -4
- package/lib/helpers/initASMAAppVitals.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/InitializeIDBListenersOnMstSnapshots.ts +1 -0
- package/src/helpers/clearCacheData.ts +14 -0
- package/src/helpers/initASMAAppVitals.ts +3 -10
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__ASMA_clearCacheDataCalled__: boolean;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @imortant When using in micro-apps combination shell/child make sure this app is called only once and only in shell app! otherwise it will have unexpected behaviour with no errors or warnings
|
|
9
|
+
*/
|
|
1
10
|
export declare const clearCacheData: (CACHE_VERSION: string) => Promise<void>;
|
|
2
11
|
//# sourceMappingURL=clearCacheData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearCacheData.d.ts","sourceRoot":"","sources":["../../src/helpers/clearCacheData.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,kBAAyB,MAAM,
|
|
1
|
+
{"version":3,"file":"clearCacheData.d.ts","sourceRoot":"","sources":["../../src/helpers/clearCacheData.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,6BAA6B,EAAE,OAAO,CAAA;KACzC;CACJ;AACD;;;GAGG;AACH,eAAO,MAAM,cAAc,kBAAyB,MAAM,kBAgBzD,CAAA"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @imortant When using in micro-apps combination shell/child make sure this app is called only once and only in shell app! otherwise it will have unexpected behaviour with no errors or warnings
|
|
4
|
+
*/
|
|
1
5
|
export const clearCacheData = async (CACHE_VERSION) => {
|
|
6
|
+
if (window.__ASMA_clearCacheDataCalled__) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
window.__ASMA_clearCacheDataCalled__ = true;
|
|
2
10
|
const version = localStorage.getItem('version');
|
|
3
11
|
if ((!version || version !== CACHE_VERSION) && indexedDB && typeof indexedDB['databases'] === 'function') {
|
|
4
12
|
const IndexedDBS = await indexedDB.databases();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearCacheData.js","sourceRoot":"","sources":["../../src/helpers/clearCacheData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clearCacheData.js","sourceRoot":"","sources":["../../src/helpers/clearCacheData.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,aAAqB,EAAE,EAAE;IAC1D,IAAI,MAAM,CAAC,6BAA6B,EAAE;QACtC,OAAM;KACT;IACD,MAAM,CAAC,6BAA6B,GAAG,IAAI,CAAA;IAE3C,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC/C,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,aAAa,CAAC,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,WAAW,CAAC,KAAK,UAAU,EAAE;QACtG,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,SAAS,EAAE,CAAA;QAE9C,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC7B,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;QAEF,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;KACjD;AACL,CAAC,CAAA"}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
*
|
|
3
3
|
* @imporant make sure this method allways is called first when startsFe() on both on child and shell apps
|
|
4
4
|
*/
|
|
5
|
-
export declare function initASMAAppVitals({ authenticated, is_child_app, subdomain_check,
|
|
5
|
+
export declare function initASMAAppVitals({ authenticated, is_child_app, subdomain_check, setLoadMicroApp, }: {
|
|
6
6
|
/**
|
|
7
7
|
* //TODO invesigate how to internalyze this variable
|
|
8
8
|
* use this method from asma-qiankun-react-loader
|
|
9
|
-
|
|
9
|
+
*/
|
|
10
10
|
setLoadMicroApp(dev_mode: boolean): Promise<void>;
|
|
11
11
|
is_child_app?: boolean;
|
|
12
|
-
mst_stores_to_persisit: Object[];
|
|
13
12
|
/**
|
|
14
13
|
* //TODO invesigate how to internalyze this variable
|
|
15
14
|
* add qiankunWindow.__POWERED_BY_QIANKUN__ there where qiankunWindow is awailable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initASMAAppVitals.d.ts","sourceRoot":"","sources":["../../src/helpers/initASMAAppVitals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initASMAAppVitals.d.ts","sourceRoot":"","sources":["../../src/helpers/initASMAAppVitals.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,EACpC,aAAa,EACb,YAAoB,EACpB,eAAe,EACf,eAAe,GAClB,EAAE;IACC;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,aAAa,EAAE,MAAM,OAAO,CAAA;IAC5B,eAAe,EAAE;QACb;;;WAGG;QACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;QAChC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;QACnD;;WAEG;QACH,KAAK,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAA;SAAE,CAAA;QACnD;;WAEG;QACH,OAAO,EAAE,WAAW,GAAG,YAAY,GAAG,eAAe,CAAA;KACxD,CAAA;CACJ,2CAyBA"}
|
|
@@ -2,12 +2,11 @@ import { checkForRegisteredSubdomain } from './checkForRegisteredSubdomains';
|
|
|
2
2
|
import { clearCacheData } from './clearCacheData';
|
|
3
3
|
import { EnvConfigsFnInternal, fetchConfigsInternal } from './generateEnvConfigsBindings';
|
|
4
4
|
import { getCachedJwtInternal } from './generateSrvAuthBindings';
|
|
5
|
-
import { initiatieIDBListenersOnMstSnaphsots } from './InitializeIDBListenersOnMstSnapshots';
|
|
6
5
|
/**
|
|
7
6
|
*
|
|
8
7
|
* @imporant make sure this method allways is called first when startsFe() on both on child and shell apps
|
|
9
8
|
*/
|
|
10
|
-
export async function initASMAAppVitals({ authenticated, is_child_app = false, subdomain_check,
|
|
9
|
+
export async function initASMAAppVitals({ authenticated, is_child_app = false, subdomain_check, setLoadMicroApp, }) {
|
|
11
10
|
/**
|
|
12
11
|
* !!!ORDER IS VERY IMPORTANT!!!
|
|
13
12
|
* EnvConfigsFn from EnvCongigs.ts
|
|
@@ -18,8 +17,6 @@ export async function initASMAAppVitals({ authenticated, is_child_app = false, s
|
|
|
18
17
|
await fetchConfigsInternal();
|
|
19
18
|
await clearCacheData(EnvConfigsFnInternal().CACHE_VERSION);
|
|
20
19
|
await setLoadMicroApp(EnvConfigsFnInternal().DEVELOPMENT);
|
|
21
|
-
const promises = mst_stores_to_persisit.map((store) => initiatieIDBListenersOnMstSnaphsots(store));
|
|
22
|
-
await Promise.allSettled(promises);
|
|
23
20
|
let registeredSubdomain = true;
|
|
24
21
|
if (!is_child_app) {
|
|
25
22
|
const [registeredSubdomain1] = await checkForRegisteredSubdomain({ ...subdomain_check, authenticated });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initASMAAppVitals.js","sourceRoot":"","sources":["../../src/helpers/initASMAAppVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"initASMAAppVitals.js","sourceRoot":"","sources":["../../src/helpers/initASMAAppVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACpC,aAAa,EACb,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,eAAe,GA6BlB;IACG;;;;;;OAMG;IACH,MAAM,oBAAoB,EAAE,CAAA;IAE5B,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC,aAAa,CAAC,CAAA;IAE1D,MAAM,eAAe,CAAC,oBAAoB,EAAE,CAAC,WAAW,CAAC,CAAA;IAEzD,IAAI,mBAAmB,GAAG,IAAI,CAAA;IAE9B,IAAI,CAAC,YAAY,EAAE;QACf,MAAM,CAAC,oBAAoB,CAAC,GAAG,MAAM,2BAA2B,CAAC,EAAE,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC,CAAA;QAEvG,mBAAmB,GAAG,oBAAoB,CAAA;QAE1C,aAAa,EAAE,IAAI,CAAC,MAAM,oBAAoB,EAAE,CAAC,CAAA;KACpD;IAED,OAAO,CAAC,mBAAmB,CAAmC,CAAA;AAClE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__ASMA_clearCacheDataCalled__: boolean
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @imortant When using in micro-apps combination shell/child make sure this app is called only once and only in shell app! otherwise it will have unexpected behaviour with no errors or warnings
|
|
9
|
+
*/
|
|
1
10
|
export const clearCacheData = async (CACHE_VERSION: string) => {
|
|
11
|
+
if (window.__ASMA_clearCacheDataCalled__) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
window.__ASMA_clearCacheDataCalled__ = true
|
|
15
|
+
|
|
2
16
|
const version = localStorage.getItem('version')
|
|
3
17
|
if ((!version || version !== CACHE_VERSION) && indexedDB && typeof indexedDB['databases'] === 'function') {
|
|
4
18
|
const IndexedDBS = await indexedDB.databases()
|
|
@@ -2,7 +2,6 @@ import { checkForRegisteredSubdomain } from './checkForRegisteredSubdomains'
|
|
|
2
2
|
import { clearCacheData } from './clearCacheData'
|
|
3
3
|
import { EnvConfigsFnInternal, fetchConfigsInternal } from './generateEnvConfigsBindings'
|
|
4
4
|
import { getCachedJwtInternal } from './generateSrvAuthBindings'
|
|
5
|
-
import { initiatieIDBListenersOnMstSnaphsots } from './InitializeIDBListenersOnMstSnapshots'
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
*
|
|
@@ -12,16 +11,14 @@ export async function initASMAAppVitals({
|
|
|
12
11
|
authenticated,
|
|
13
12
|
is_child_app = false,
|
|
14
13
|
subdomain_check,
|
|
15
|
-
mst_stores_to_persisit,
|
|
16
14
|
setLoadMicroApp,
|
|
17
15
|
}: {
|
|
18
16
|
/**
|
|
19
17
|
* //TODO invesigate how to internalyze this variable
|
|
20
18
|
* use this method from asma-qiankun-react-loader
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
mst_stores_to_persisit: Object[]
|
|
19
|
+
*/
|
|
20
|
+
setLoadMicroApp(dev_mode: boolean): Promise<void>
|
|
21
|
+
is_child_app?: boolean
|
|
25
22
|
/**
|
|
26
23
|
* //TODO invesigate how to internalyze this variable
|
|
27
24
|
* add qiankunWindow.__POWERED_BY_QIANKUN__ there where qiankunWindow is awailable
|
|
@@ -57,10 +54,6 @@ export async function initASMAAppVitals({
|
|
|
57
54
|
|
|
58
55
|
await setLoadMicroApp(EnvConfigsFnInternal().DEVELOPMENT)
|
|
59
56
|
|
|
60
|
-
const promises = mst_stores_to_persisit.map((store) => initiatieIDBListenersOnMstSnaphsots(store))
|
|
61
|
-
|
|
62
|
-
await Promise.allSettled(promises)
|
|
63
|
-
|
|
64
57
|
let registeredSubdomain = true
|
|
65
58
|
|
|
66
59
|
if (!is_child_app) {
|