@rangertechnologies/ngnxt 2.1.333 → 2.1.335
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/fesm2022/rangertechnologies-ngnxt.mjs +46 -18
- package/fesm2022/rangertechnologies-ngnxt.mjs.map +1 -1
- package/lib/services/translation/indexeddb-reader.service.d.ts +2 -2
- package/package.json +1 -1
- package/rangertechnologies-ngnxt-2.1.335.tgz +0 -0
- package/rangertechnologies-ngnxt-2.1.333.tgz +0 -0
|
@@ -915,28 +915,56 @@ class IndexedDbReaderService {
|
|
|
915
915
|
dbName = 'ranger'; //SKS3MAR25 MUST match main app
|
|
916
916
|
storeName = 'appStore';
|
|
917
917
|
path = 'translations';
|
|
918
|
-
dbVersion = 1;
|
|
919
918
|
dbPromise;
|
|
920
919
|
constructor() {
|
|
921
920
|
this.dbPromise = this.initDB();
|
|
922
921
|
}
|
|
923
922
|
initDB() {
|
|
924
|
-
return new Promise((resolve
|
|
925
|
-
const request = indexedDB.open(this.dbName
|
|
926
|
-
request.onsuccess = () =>
|
|
927
|
-
|
|
923
|
+
return new Promise((resolve) => {
|
|
924
|
+
const request = indexedDB.open(this.dbName);
|
|
925
|
+
request.onsuccess = () => {
|
|
926
|
+
const db = request.result;
|
|
927
|
+
// SKS7MAR26 Skip if store doesn't exist
|
|
928
|
+
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
929
|
+
resolve(null);
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
resolve(db);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
request.onerror = () => resolve(null); // SKS7MAR26 skip DB if error
|
|
936
|
+
request.onupgradeneeded = (event) => {
|
|
937
|
+
// SKS7MAR26 optional: create store only if needed
|
|
938
|
+
const db = event.target.result;
|
|
939
|
+
if (!db.objectStoreNames.contains(this.storeName)) {
|
|
940
|
+
db.createObjectStore(this.storeName);
|
|
941
|
+
}
|
|
942
|
+
};
|
|
928
943
|
});
|
|
929
944
|
}
|
|
930
945
|
async getTranslation(lang) {
|
|
931
946
|
const db = await this.dbPromise;
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
947
|
+
if (!db) {
|
|
948
|
+
// SKS7MAR26 DB or store not ready → skip gracefully
|
|
949
|
+
return {};
|
|
950
|
+
}
|
|
951
|
+
return this.readTranslation(db, lang);
|
|
952
|
+
}
|
|
953
|
+
readTranslation(db, lang) {
|
|
954
|
+
return new Promise((resolve) => {
|
|
955
|
+
try {
|
|
956
|
+
const tx = db.transaction(this.storeName, 'readonly');
|
|
957
|
+
const request = tx.objectStore(this.storeName).get(this.path);
|
|
958
|
+
request.onsuccess = () => {
|
|
959
|
+
const translations = request.result;
|
|
960
|
+
resolve(translations ? translations[lang] ?? {} : {});
|
|
961
|
+
};
|
|
962
|
+
request.onerror = () => resolve({});
|
|
963
|
+
}
|
|
964
|
+
catch (e) {
|
|
965
|
+
// SKS7MAR26 transaction fails → skip gracefully
|
|
966
|
+
resolve({});
|
|
967
|
+
}
|
|
940
968
|
});
|
|
941
969
|
}
|
|
942
970
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: IndexedDbReaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -976,6 +1004,8 @@ class TranslationService {
|
|
|
976
1004
|
this.updateTranslations(flattened);
|
|
977
1005
|
}
|
|
978
1006
|
else {
|
|
1007
|
+
if (!this.translations)
|
|
1008
|
+
this.translations = {};
|
|
979
1009
|
this.translations[this.currentLang] = {};
|
|
980
1010
|
}
|
|
981
1011
|
this.translationsLoaded.next();
|
|
@@ -1002,11 +1032,9 @@ class TranslationService {
|
|
|
1002
1032
|
return newTranslations;
|
|
1003
1033
|
}
|
|
1004
1034
|
updateTranslations(newTranslations) {
|
|
1005
|
-
const oldTranslations = this.translations && typeof this.translations === 'object'
|
|
1006
|
-
? this.translations
|
|
1007
|
-
: {};
|
|
1035
|
+
const oldTranslations = this.translations && typeof this.translations === 'object' ? this.translations : {};
|
|
1008
1036
|
// SKS17DEC25 Immutable merge (Angular-friendly)
|
|
1009
|
-
this.translations = this.deepMerge(oldTranslations, newTranslations);
|
|
1037
|
+
this.translations = this.deepMerge(oldTranslations, newTranslations) || {};
|
|
1010
1038
|
this.translationsLoaded.next(); // Notify subscribers
|
|
1011
1039
|
}
|
|
1012
1040
|
// SKS17DEC25 Deep Merge (Immutable)
|
|
@@ -59020,7 +59048,7 @@ const VERSION = {
|
|
|
59020
59048
|
"semver": null,
|
|
59021
59049
|
"suffix": "68a4eb8b-dirty",
|
|
59022
59050
|
"semverString": null,
|
|
59023
|
-
"version": "2.1.
|
|
59051
|
+
"version": "2.1.335"
|
|
59024
59052
|
};
|
|
59025
59053
|
/* tslint:enable */
|
|
59026
59054
|
|