@nexushub/client 0.7.2 → 0.7.3

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/index.cjs CHANGED
@@ -1048,23 +1048,26 @@ var ContentEngine = class {
1048
1048
  }
1049
1049
  return includeMetadata ? cached : cached.data;
1050
1050
  }
1051
- if (!forceRefresh && this.localCache.isLoaded()) {
1052
- const localCollection = await this.localCache.getCollection(collectionId);
1053
- if (localCollection) {
1054
- const result = this.applyLocalQuery(
1055
- localCollection,
1056
- normalizedQuery
1057
- );
1058
- if (this.config.debug) {
1059
- console.log(
1060
- `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
1051
+ if (!forceRefresh) {
1052
+ try {
1053
+ const localCollection = await this.localCache.getCollection(collectionId);
1054
+ if (localCollection) {
1055
+ const result = this.applyLocalQuery(
1056
+ localCollection,
1057
+ normalizedQuery
1061
1058
  );
1059
+ if (this.config.debug) {
1060
+ console.log(
1061
+ `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
1062
+ );
1063
+ }
1064
+ this.memoryCache.set(cacheKey, result, {
1065
+ tags: [...tags, CacheTags.collection(collectionId)],
1066
+ revalidate: revalidate === false ? void 0 : revalidate
1067
+ });
1068
+ return result;
1062
1069
  }
1063
- this.memoryCache.set(cacheKey, result, {
1064
- tags: [...tags, CacheTags.collection(collectionId)],
1065
- revalidate: revalidate === false ? void 0 : revalidate
1066
- });
1067
- return result;
1070
+ } catch {
1068
1071
  }
1069
1072
  }
1070
1073
  if (this.circuitBreaker.isOpen()) throw new Error("Circuit open");
@@ -1120,14 +1123,17 @@ var ContentEngine = class {
1120
1123
  return cached;
1121
1124
  }
1122
1125
  }
1123
- if (!forceRefresh && this.localCache.isLoaded()) {
1124
- const localGlobals = await this.localCache.getGlobals();
1125
- if (localGlobals) {
1126
- this.memoryCache.set(cacheKey, localGlobals, {
1127
- tags: [CacheTags.global],
1128
- revalidate: revalidate === false ? void 0 : revalidate
1129
- });
1130
- return localGlobals;
1126
+ if (!forceRefresh) {
1127
+ try {
1128
+ const localGlobals = await this.localCache.getGlobals();
1129
+ if (localGlobals) {
1130
+ this.memoryCache.set(cacheKey, localGlobals, {
1131
+ tags: [CacheTags.global],
1132
+ revalidate: revalidate === false ? void 0 : revalidate
1133
+ });
1134
+ return localGlobals;
1135
+ }
1136
+ } catch {
1131
1137
  }
1132
1138
  }
1133
1139
  try {
@@ -1312,9 +1318,9 @@ var ContentEngine = class {
1312
1318
  };
1313
1319
  }
1314
1320
  }
1315
- if (this.localCache.isLoaded()) {
1316
- if (key.startsWith("page:")) {
1317
- const slug = key.split(":")[1];
1321
+ if (key.startsWith("page:")) {
1322
+ const slug = key.split(":")[1];
1323
+ try {
1318
1324
  const local = await this.localCache.getPage(slug);
1319
1325
  if (local) {
1320
1326
  return {
@@ -1327,6 +1333,7 @@ var ContentEngine = class {
1327
1333
  }
1328
1334
  };
1329
1335
  }
1336
+ } catch {
1330
1337
  }
1331
1338
  }
1332
1339
  return null;
package/dist/index.js CHANGED
@@ -1002,23 +1002,26 @@ var ContentEngine = class {
1002
1002
  }
1003
1003
  return includeMetadata ? cached : cached.data;
1004
1004
  }
1005
- if (!forceRefresh && this.localCache.isLoaded()) {
1006
- const localCollection = await this.localCache.getCollection(collectionId);
1007
- if (localCollection) {
1008
- const result = this.applyLocalQuery(
1009
- localCollection,
1010
- normalizedQuery
1011
- );
1012
- if (this.config.debug) {
1013
- console.log(
1014
- `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
1005
+ if (!forceRefresh) {
1006
+ try {
1007
+ const localCollection = await this.localCache.getCollection(collectionId);
1008
+ if (localCollection) {
1009
+ const result = this.applyLocalQuery(
1010
+ localCollection,
1011
+ normalizedQuery
1015
1012
  );
1013
+ if (this.config.debug) {
1014
+ console.log(
1015
+ `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
1016
+ );
1017
+ }
1018
+ this.memoryCache.set(cacheKey, result, {
1019
+ tags: [...tags, CacheTags.collection(collectionId)],
1020
+ revalidate: revalidate === false ? void 0 : revalidate
1021
+ });
1022
+ return result;
1016
1023
  }
1017
- this.memoryCache.set(cacheKey, result, {
1018
- tags: [...tags, CacheTags.collection(collectionId)],
1019
- revalidate: revalidate === false ? void 0 : revalidate
1020
- });
1021
- return result;
1024
+ } catch {
1022
1025
  }
1023
1026
  }
1024
1027
  if (this.circuitBreaker.isOpen()) throw new Error("Circuit open");
@@ -1074,14 +1077,17 @@ var ContentEngine = class {
1074
1077
  return cached;
1075
1078
  }
1076
1079
  }
1077
- if (!forceRefresh && this.localCache.isLoaded()) {
1078
- const localGlobals = await this.localCache.getGlobals();
1079
- if (localGlobals) {
1080
- this.memoryCache.set(cacheKey, localGlobals, {
1081
- tags: [CacheTags.global],
1082
- revalidate: revalidate === false ? void 0 : revalidate
1083
- });
1084
- return localGlobals;
1080
+ if (!forceRefresh) {
1081
+ try {
1082
+ const localGlobals = await this.localCache.getGlobals();
1083
+ if (localGlobals) {
1084
+ this.memoryCache.set(cacheKey, localGlobals, {
1085
+ tags: [CacheTags.global],
1086
+ revalidate: revalidate === false ? void 0 : revalidate
1087
+ });
1088
+ return localGlobals;
1089
+ }
1090
+ } catch {
1085
1091
  }
1086
1092
  }
1087
1093
  try {
@@ -1266,9 +1272,9 @@ var ContentEngine = class {
1266
1272
  };
1267
1273
  }
1268
1274
  }
1269
- if (this.localCache.isLoaded()) {
1270
- if (key.startsWith("page:")) {
1271
- const slug = key.split(":")[1];
1275
+ if (key.startsWith("page:")) {
1276
+ const slug = key.split(":")[1];
1277
+ try {
1272
1278
  const local = await this.localCache.getPage(slug);
1273
1279
  if (local) {
1274
1280
  return {
@@ -1281,6 +1287,7 @@ var ContentEngine = class {
1281
1287
  }
1282
1288
  };
1283
1289
  }
1290
+ } catch {
1284
1291
  }
1285
1292
  }
1286
1293
  return null;
package/dist/react.cjs CHANGED
@@ -647,23 +647,26 @@ var ContentEngine = class {
647
647
  }
648
648
  return includeMetadata ? cached : cached.data;
649
649
  }
650
- if (!forceRefresh && this.localCache.isLoaded()) {
651
- const localCollection = await this.localCache.getCollection(collectionId);
652
- if (localCollection) {
653
- const result = this.applyLocalQuery(
654
- localCollection,
655
- normalizedQuery
656
- );
657
- if (this.config.debug) {
658
- console.log(
659
- `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
650
+ if (!forceRefresh) {
651
+ try {
652
+ const localCollection = await this.localCache.getCollection(collectionId);
653
+ if (localCollection) {
654
+ const result = this.applyLocalQuery(
655
+ localCollection,
656
+ normalizedQuery
660
657
  );
658
+ if (this.config.debug) {
659
+ console.log(
660
+ `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
661
+ );
662
+ }
663
+ this.memoryCache.set(cacheKey, result, {
664
+ tags: [...tags, CacheTags.collection(collectionId)],
665
+ revalidate: revalidate === false ? void 0 : revalidate
666
+ });
667
+ return result;
661
668
  }
662
- this.memoryCache.set(cacheKey, result, {
663
- tags: [...tags, CacheTags.collection(collectionId)],
664
- revalidate: revalidate === false ? void 0 : revalidate
665
- });
666
- return result;
669
+ } catch (e5) {
667
670
  }
668
671
  }
669
672
  if (this.circuitBreaker.isOpen()) throw new Error("Circuit open");
@@ -719,14 +722,17 @@ var ContentEngine = class {
719
722
  return cached;
720
723
  }
721
724
  }
722
- if (!forceRefresh && this.localCache.isLoaded()) {
723
- const localGlobals = await this.localCache.getGlobals();
724
- if (localGlobals) {
725
- this.memoryCache.set(cacheKey, localGlobals, {
726
- tags: [CacheTags.global],
727
- revalidate: revalidate === false ? void 0 : revalidate
728
- });
729
- return localGlobals;
725
+ if (!forceRefresh) {
726
+ try {
727
+ const localGlobals = await this.localCache.getGlobals();
728
+ if (localGlobals) {
729
+ this.memoryCache.set(cacheKey, localGlobals, {
730
+ tags: [CacheTags.global],
731
+ revalidate: revalidate === false ? void 0 : revalidate
732
+ });
733
+ return localGlobals;
734
+ }
735
+ } catch (e6) {
730
736
  }
731
737
  }
732
738
  try {
@@ -911,9 +917,9 @@ var ContentEngine = class {
911
917
  };
912
918
  }
913
919
  }
914
- if (this.localCache.isLoaded()) {
915
- if (key.startsWith("page:")) {
916
- const slug = key.split(":")[1];
920
+ if (key.startsWith("page:")) {
921
+ const slug = key.split(":")[1];
922
+ try {
917
923
  const local = await this.localCache.getPage(slug);
918
924
  if (local) {
919
925
  return {
@@ -926,6 +932,7 @@ var ContentEngine = class {
926
932
  }
927
933
  };
928
934
  }
935
+ } catch (e7) {
929
936
  }
930
937
  }
931
938
  return null;
@@ -1208,7 +1215,7 @@ var generateCanvasHash = async () => {
1208
1215
  hash = hash & hash;
1209
1216
  }
1210
1217
  return hash.toString(16);
1211
- } catch (e5) {
1218
+ } catch (e8) {
1212
1219
  return "";
1213
1220
  }
1214
1221
  };
@@ -1440,20 +1447,20 @@ var SDK_VERSION = "0.1.0";
1440
1447
  var safeGetItem = (key) => {
1441
1448
  try {
1442
1449
  return localStorage.getItem(key);
1443
- } catch (e6) {
1450
+ } catch (e9) {
1444
1451
  return null;
1445
1452
  }
1446
1453
  };
1447
1454
  var safeSetItem = (key, value) => {
1448
1455
  try {
1449
1456
  localStorage.setItem(key, value);
1450
- } catch (e7) {
1457
+ } catch (e10) {
1451
1458
  }
1452
1459
  };
1453
1460
  var safeRemoveItem = (key) => {
1454
1461
  try {
1455
1462
  localStorage.removeItem(key);
1456
- } catch (e8) {
1463
+ } catch (e11) {
1457
1464
  }
1458
1465
  };
1459
1466
  var generateUUID = () => {
@@ -1642,7 +1649,7 @@ function extractUtmParams(url) {
1642
1649
  if (val) result[key] = val;
1643
1650
  });
1644
1651
  return result;
1645
- } catch (e9) {
1652
+ } catch (e12) {
1646
1653
  return {};
1647
1654
  }
1648
1655
  }
@@ -1651,7 +1658,7 @@ function extractUtmParams(url) {
1651
1658
  var safeRemoveItem2 = (key) => {
1652
1659
  try {
1653
1660
  localStorage.removeItem(key);
1654
- } catch (e10) {
1661
+ } catch (e13) {
1655
1662
  }
1656
1663
  };
1657
1664
  var AnalyticsEngine = class {
@@ -1870,7 +1877,7 @@ var AnalyticsEngine = class {
1870
1877
  "outbound_click"
1871
1878
  );
1872
1879
  }
1873
- } catch (e11) {
1880
+ } catch (e14) {
1874
1881
  }
1875
1882
  };
1876
1883
  window.addEventListener("click", outboundHandler, { passive: true });
@@ -2366,7 +2373,7 @@ async function parseError(res) {
2366
2373
  code: json.code || "UNKNOWN_ERROR",
2367
2374
  message: json.message || "An error occurred during authentication"
2368
2375
  };
2369
- } catch (e12) {
2376
+ } catch (e15) {
2370
2377
  return {
2371
2378
  status: res.status,
2372
2379
  code: "NETWORK_ERROR",
package/dist/react.js CHANGED
@@ -647,23 +647,26 @@ var ContentEngine = class {
647
647
  }
648
648
  return includeMetadata ? cached : cached.data;
649
649
  }
650
- if (!forceRefresh && this.localCache.isLoaded()) {
651
- const localCollection = await this.localCache.getCollection(collectionId);
652
- if (localCollection) {
653
- const result = this.applyLocalQuery(
654
- localCollection,
655
- normalizedQuery
656
- );
657
- if (this.config.debug) {
658
- console.log(
659
- `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
650
+ if (!forceRefresh) {
651
+ try {
652
+ const localCollection = await this.localCache.getCollection(collectionId);
653
+ if (localCollection) {
654
+ const result = this.applyLocalQuery(
655
+ localCollection,
656
+ normalizedQuery
660
657
  );
658
+ if (this.config.debug) {
659
+ console.log(
660
+ `[NexusHub] \u{1F4C1} Compiled collection '${collectionId}' from local offline binaries.`
661
+ );
662
+ }
663
+ this.memoryCache.set(cacheKey, result, {
664
+ tags: [...tags, CacheTags.collection(collectionId)],
665
+ revalidate: revalidate === false ? void 0 : revalidate
666
+ });
667
+ return result;
661
668
  }
662
- this.memoryCache.set(cacheKey, result, {
663
- tags: [...tags, CacheTags.collection(collectionId)],
664
- revalidate: revalidate === false ? void 0 : revalidate
665
- });
666
- return result;
669
+ } catch {
667
670
  }
668
671
  }
669
672
  if (this.circuitBreaker.isOpen()) throw new Error("Circuit open");
@@ -719,14 +722,17 @@ var ContentEngine = class {
719
722
  return cached;
720
723
  }
721
724
  }
722
- if (!forceRefresh && this.localCache.isLoaded()) {
723
- const localGlobals = await this.localCache.getGlobals();
724
- if (localGlobals) {
725
- this.memoryCache.set(cacheKey, localGlobals, {
726
- tags: [CacheTags.global],
727
- revalidate: revalidate === false ? void 0 : revalidate
728
- });
729
- return localGlobals;
725
+ if (!forceRefresh) {
726
+ try {
727
+ const localGlobals = await this.localCache.getGlobals();
728
+ if (localGlobals) {
729
+ this.memoryCache.set(cacheKey, localGlobals, {
730
+ tags: [CacheTags.global],
731
+ revalidate: revalidate === false ? void 0 : revalidate
732
+ });
733
+ return localGlobals;
734
+ }
735
+ } catch {
730
736
  }
731
737
  }
732
738
  try {
@@ -911,9 +917,9 @@ var ContentEngine = class {
911
917
  };
912
918
  }
913
919
  }
914
- if (this.localCache.isLoaded()) {
915
- if (key.startsWith("page:")) {
916
- const slug = key.split(":")[1];
920
+ if (key.startsWith("page:")) {
921
+ const slug = key.split(":")[1];
922
+ try {
917
923
  const local = await this.localCache.getPage(slug);
918
924
  if (local) {
919
925
  return {
@@ -926,6 +932,7 @@ var ContentEngine = class {
926
932
  }
927
933
  };
928
934
  }
935
+ } catch {
929
936
  }
930
937
  }
931
938
  return null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexushub/client",
3
3
  "private": false,
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "description": "The God-Tier NexusHub SDK",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",