@nexushub/client 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/dist/cli.cjs +60 -60
- package/dist/index.cjs +33 -26
- package/dist/index.js +33 -26
- package/dist/react.cjs +41 -34
- package/dist/react.js +33 -26
- package/package.json +1 -1
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
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
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
|
-
|
|
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
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
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 (
|
|
1316
|
-
|
|
1317
|
-
|
|
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
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
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
|
-
|
|
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
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
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 (
|
|
1270
|
-
|
|
1271
|
-
|
|
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
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
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
|
-
|
|
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
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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 (
|
|
915
|
-
|
|
916
|
-
|
|
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 (
|
|
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 (
|
|
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 (
|
|
1457
|
+
} catch (e10) {
|
|
1451
1458
|
}
|
|
1452
1459
|
};
|
|
1453
1460
|
var safeRemoveItem = (key) => {
|
|
1454
1461
|
try {
|
|
1455
1462
|
localStorage.removeItem(key);
|
|
1456
|
-
} catch (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
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
|
-
|
|
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
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
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 (
|
|
915
|
-
|
|
916
|
-
|
|
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;
|