@nexushub/client 1.1.11 → 1.1.13

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
@@ -939,7 +939,7 @@ var ContentEngine = class {
939
939
  );
940
940
  if (this.config.debug && duration > 100) {
941
941
  console.warn(
942
- `[GN-Apex] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
942
+ `[NexusHub] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
943
943
  );
944
944
  }
945
945
  return result;
@@ -976,7 +976,7 @@ var ContentEngine = class {
976
976
  }
977
977
  }
978
978
  if (this.circuitBreaker.isOpen()) {
979
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
979
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
980
980
  }
981
981
  try {
982
982
  await this.rateLimiter.checkLimit();
@@ -993,22 +993,21 @@ var ContentEngine = class {
993
993
  return includeMetadata ? data : data.data;
994
994
  } catch (error) {
995
995
  this.circuitBreaker.recordFailure();
996
- try {
997
- const local = await this.localCache.getPage(slug);
998
- if (local) {
999
- console.warn(
1000
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${slug}', successfully recovered from local cache.`
1001
- );
1002
- return includeMetadata ? {
1003
- data: local,
1004
- metadata: {
1005
- timestamp: Date.now(),
1006
- expiresAt: Infinity,
1007
- tags: []
1008
- }
1009
- } : local;
996
+ if (process.env.NODE_ENV === "development") {
997
+ try {
998
+ const local = await this.localCache.getPage(slug);
999
+ if (local) {
1000
+ return includeMetadata ? {
1001
+ data: local,
1002
+ metadata: {
1003
+ timestamp: Date.now(),
1004
+ expiresAt: Infinity,
1005
+ tags: []
1006
+ }
1007
+ } : local;
1008
+ }
1009
+ } catch {
1010
1010
  }
1011
- } catch {
1012
1011
  }
1013
1012
  throw this.normalizeError(error, `Failed to fetch page '${slug}'`);
1014
1013
  }
@@ -1037,17 +1036,17 @@ var ContentEngine = class {
1037
1036
  localCollection,
1038
1037
  normalizedQuery
1039
1038
  );
1040
- return includeMetadata ? result : result;
1039
+ return result;
1041
1040
  }
1042
1041
  } catch {
1043
1042
  }
1044
1043
  }
1045
1044
  if (this.circuitBreaker.isOpen()) {
1046
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
1045
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
1047
1046
  }
1048
1047
  try {
1049
1048
  await this.rateLimiter.checkLimit();
1050
- const entry = await this.backoff.execute(async () => {
1049
+ const result = await this.backoff.execute(async () => {
1051
1050
  return this.fetchCollection(
1052
1051
  collectionId,
1053
1052
  normalizedQuery,
@@ -1058,22 +1057,20 @@ var ContentEngine = class {
1058
1057
  );
1059
1058
  });
1060
1059
  this.circuitBreaker.recordSuccess();
1061
- return includeMetadata ? entry : entry.data;
1060
+ return includeMetadata ? result : result.data;
1062
1061
  } catch (error) {
1063
1062
  this.circuitBreaker.recordFailure();
1064
- try {
1065
- const localCollection = await this.localCache.getCollection(collectionId);
1066
- if (localCollection) {
1067
- console.warn(
1068
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${collectionId}', successfully recovered from local cache.`
1069
- );
1070
- const result = this.applyLocalQuery(
1071
- localCollection,
1072
- normalizedQuery
1073
- );
1074
- return includeMetadata ? result : result;
1063
+ if (process.env.NODE_ENV === "development") {
1064
+ try {
1065
+ const localCollection = await this.localCache.getCollection(collectionId);
1066
+ if (localCollection) {
1067
+ return this.applyLocalQuery(
1068
+ localCollection,
1069
+ normalizedQuery
1070
+ );
1071
+ }
1072
+ } catch {
1075
1073
  }
1076
- } catch {
1077
1074
  }
1078
1075
  throw this.normalizeError(
1079
1076
  error,
@@ -1132,15 +1129,14 @@ var ContentEngine = class {
1132
1129
  }
1133
1130
  return data;
1134
1131
  } catch (error) {
1135
- try {
1136
- const localGlobals = await this.localCache.getGlobals();
1137
- if (localGlobals) {
1138
- console.warn(
1139
- `[GN-Apex] \u26A0\uFE0F Network timeout on globals, successfully recovered from local cache.`
1140
- );
1141
- return localGlobals;
1132
+ if (process.env.NODE_ENV === "development") {
1133
+ try {
1134
+ const localGlobals = await this.localCache.getGlobals();
1135
+ if (localGlobals) {
1136
+ return localGlobals;
1137
+ }
1138
+ } catch {
1142
1139
  }
1143
- } catch {
1144
1140
  }
1145
1141
  throw this.normalizeError(error, "Failed to fetch globals");
1146
1142
  }
@@ -1291,7 +1287,7 @@ var ContentEngine = class {
1291
1287
  };
1292
1288
  }
1293
1289
  writeCache(key, data, options) {
1294
- const ttlSeconds = options.revalidate === false ? 5 : Math.max(1, options.revalidate);
1290
+ const ttlSeconds = options.revalidate === false ? 60 : Math.max(1, options.revalidate);
1295
1291
  if (this.cacheStrategy === "memory") {
1296
1292
  this.memoryCache.set(key, data, {
1297
1293
  tags: options.tags,
@@ -1454,7 +1450,7 @@ var ContentEngine = class {
1454
1450
  }
1455
1451
  async fetchWithTimeout(url, options = {}) {
1456
1452
  const {
1457
- timeout = this.config.timeout || 25e3,
1453
+ timeout = this.config.timeout || 1e4,
1458
1454
  tags = [],
1459
1455
  revalidate,
1460
1456
  forceRefresh = false,
package/dist/index.js CHANGED
@@ -883,7 +883,7 @@ var ContentEngine = class {
883
883
  );
884
884
  if (this.config.debug && duration > 100) {
885
885
  console.warn(
886
- `[GN-Apex] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
886
+ `[NexusHub] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
887
887
  );
888
888
  }
889
889
  return result;
@@ -920,7 +920,7 @@ var ContentEngine = class {
920
920
  }
921
921
  }
922
922
  if (this.circuitBreaker.isOpen()) {
923
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
923
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
924
924
  }
925
925
  try {
926
926
  await this.rateLimiter.checkLimit();
@@ -937,22 +937,21 @@ var ContentEngine = class {
937
937
  return includeMetadata ? data : data.data;
938
938
  } catch (error) {
939
939
  this.circuitBreaker.recordFailure();
940
- try {
941
- const local = await this.localCache.getPage(slug);
942
- if (local) {
943
- console.warn(
944
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${slug}', successfully recovered from local cache.`
945
- );
946
- return includeMetadata ? {
947
- data: local,
948
- metadata: {
949
- timestamp: Date.now(),
950
- expiresAt: Infinity,
951
- tags: []
952
- }
953
- } : local;
940
+ if (process.env.NODE_ENV === "development") {
941
+ try {
942
+ const local = await this.localCache.getPage(slug);
943
+ if (local) {
944
+ return includeMetadata ? {
945
+ data: local,
946
+ metadata: {
947
+ timestamp: Date.now(),
948
+ expiresAt: Infinity,
949
+ tags: []
950
+ }
951
+ } : local;
952
+ }
953
+ } catch {
954
954
  }
955
- } catch {
956
955
  }
957
956
  throw this.normalizeError(error, `Failed to fetch page '${slug}'`);
958
957
  }
@@ -981,17 +980,17 @@ var ContentEngine = class {
981
980
  localCollection,
982
981
  normalizedQuery
983
982
  );
984
- return includeMetadata ? result : result;
983
+ return result;
985
984
  }
986
985
  } catch {
987
986
  }
988
987
  }
989
988
  if (this.circuitBreaker.isOpen()) {
990
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
989
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
991
990
  }
992
991
  try {
993
992
  await this.rateLimiter.checkLimit();
994
- const entry = await this.backoff.execute(async () => {
993
+ const result = await this.backoff.execute(async () => {
995
994
  return this.fetchCollection(
996
995
  collectionId,
997
996
  normalizedQuery,
@@ -1002,22 +1001,20 @@ var ContentEngine = class {
1002
1001
  );
1003
1002
  });
1004
1003
  this.circuitBreaker.recordSuccess();
1005
- return includeMetadata ? entry : entry.data;
1004
+ return includeMetadata ? result : result.data;
1006
1005
  } catch (error) {
1007
1006
  this.circuitBreaker.recordFailure();
1008
- try {
1009
- const localCollection = await this.localCache.getCollection(collectionId);
1010
- if (localCollection) {
1011
- console.warn(
1012
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${collectionId}', successfully recovered from local cache.`
1013
- );
1014
- const result = this.applyLocalQuery(
1015
- localCollection,
1016
- normalizedQuery
1017
- );
1018
- return includeMetadata ? result : result;
1007
+ if (process.env.NODE_ENV === "development") {
1008
+ try {
1009
+ const localCollection = await this.localCache.getCollection(collectionId);
1010
+ if (localCollection) {
1011
+ return this.applyLocalQuery(
1012
+ localCollection,
1013
+ normalizedQuery
1014
+ );
1015
+ }
1016
+ } catch {
1019
1017
  }
1020
- } catch {
1021
1018
  }
1022
1019
  throw this.normalizeError(
1023
1020
  error,
@@ -1076,15 +1073,14 @@ var ContentEngine = class {
1076
1073
  }
1077
1074
  return data;
1078
1075
  } catch (error) {
1079
- try {
1080
- const localGlobals = await this.localCache.getGlobals();
1081
- if (localGlobals) {
1082
- console.warn(
1083
- `[GN-Apex] \u26A0\uFE0F Network timeout on globals, successfully recovered from local cache.`
1084
- );
1085
- return localGlobals;
1076
+ if (process.env.NODE_ENV === "development") {
1077
+ try {
1078
+ const localGlobals = await this.localCache.getGlobals();
1079
+ if (localGlobals) {
1080
+ return localGlobals;
1081
+ }
1082
+ } catch {
1086
1083
  }
1087
- } catch {
1088
1084
  }
1089
1085
  throw this.normalizeError(error, "Failed to fetch globals");
1090
1086
  }
@@ -1235,7 +1231,7 @@ var ContentEngine = class {
1235
1231
  };
1236
1232
  }
1237
1233
  writeCache(key, data, options) {
1238
- const ttlSeconds = options.revalidate === false ? 5 : Math.max(1, options.revalidate);
1234
+ const ttlSeconds = options.revalidate === false ? 60 : Math.max(1, options.revalidate);
1239
1235
  if (this.cacheStrategy === "memory") {
1240
1236
  this.memoryCache.set(key, data, {
1241
1237
  tags: options.tags,
@@ -1398,7 +1394,7 @@ var ContentEngine = class {
1398
1394
  }
1399
1395
  async fetchWithTimeout(url, options = {}) {
1400
1396
  const {
1401
- timeout = this.config.timeout || 25e3,
1397
+ timeout = this.config.timeout || 1e4,
1402
1398
  tags = [],
1403
1399
  revalidate,
1404
1400
  forceRefresh = false,
package/dist/react.cjs CHANGED
@@ -865,7 +865,7 @@ var ContentEngine = class {
865
865
  );
866
866
  if (this.config.debug && duration > 100) {
867
867
  console.warn(
868
- `[GN-Apex] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
868
+ `[NexusHub] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
869
869
  );
870
870
  }
871
871
  return result;
@@ -902,7 +902,7 @@ var ContentEngine = class {
902
902
  }
903
903
  }
904
904
  if (this.circuitBreaker.isOpen()) {
905
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
905
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
906
906
  }
907
907
  try {
908
908
  await this.rateLimiter.checkLimit();
@@ -919,22 +919,21 @@ var ContentEngine = class {
919
919
  return includeMetadata ? data : data.data;
920
920
  } catch (error) {
921
921
  this.circuitBreaker.recordFailure();
922
- try {
923
- const local = await this.localCache.getPage(slug);
924
- if (local) {
925
- console.warn(
926
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${slug}', successfully recovered from local cache.`
927
- );
928
- return includeMetadata ? {
929
- data: local,
930
- metadata: {
931
- timestamp: Date.now(),
932
- expiresAt: Infinity,
933
- tags: []
934
- }
935
- } : local;
922
+ if (process.env.NODE_ENV === "development") {
923
+ try {
924
+ const local = await this.localCache.getPage(slug);
925
+ if (local) {
926
+ return includeMetadata ? {
927
+ data: local,
928
+ metadata: {
929
+ timestamp: Date.now(),
930
+ expiresAt: Infinity,
931
+ tags: []
932
+ }
933
+ } : local;
934
+ }
935
+ } catch (e7) {
936
936
  }
937
- } catch (e7) {
938
937
  }
939
938
  throw this.normalizeError(error, `Failed to fetch page '${slug}'`);
940
939
  }
@@ -963,17 +962,17 @@ var ContentEngine = class {
963
962
  localCollection,
964
963
  normalizedQuery
965
964
  );
966
- return includeMetadata ? result : result;
965
+ return result;
967
966
  }
968
967
  } catch (e8) {
969
968
  }
970
969
  }
971
970
  if (this.circuitBreaker.isOpen()) {
972
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
971
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
973
972
  }
974
973
  try {
975
974
  await this.rateLimiter.checkLimit();
976
- const entry = await this.backoff.execute(async () => {
975
+ const result = await this.backoff.execute(async () => {
977
976
  return this.fetchCollection(
978
977
  collectionId,
979
978
  normalizedQuery,
@@ -984,22 +983,20 @@ var ContentEngine = class {
984
983
  );
985
984
  });
986
985
  this.circuitBreaker.recordSuccess();
987
- return includeMetadata ? entry : entry.data;
986
+ return includeMetadata ? result : result.data;
988
987
  } catch (error) {
989
988
  this.circuitBreaker.recordFailure();
990
- try {
991
- const localCollection = await this.localCache.getCollection(collectionId);
992
- if (localCollection) {
993
- console.warn(
994
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${collectionId}', successfully recovered from local cache.`
995
- );
996
- const result = this.applyLocalQuery(
997
- localCollection,
998
- normalizedQuery
999
- );
1000
- return includeMetadata ? result : result;
989
+ if (process.env.NODE_ENV === "development") {
990
+ try {
991
+ const localCollection = await this.localCache.getCollection(collectionId);
992
+ if (localCollection) {
993
+ return this.applyLocalQuery(
994
+ localCollection,
995
+ normalizedQuery
996
+ );
997
+ }
998
+ } catch (e9) {
1001
999
  }
1002
- } catch (e9) {
1003
1000
  }
1004
1001
  throw this.normalizeError(
1005
1002
  error,
@@ -1058,15 +1055,14 @@ var ContentEngine = class {
1058
1055
  }
1059
1056
  return data;
1060
1057
  } catch (error) {
1061
- try {
1062
- const localGlobals = await this.localCache.getGlobals();
1063
- if (localGlobals) {
1064
- console.warn(
1065
- `[GN-Apex] \u26A0\uFE0F Network timeout on globals, successfully recovered from local cache.`
1066
- );
1067
- return localGlobals;
1058
+ if (process.env.NODE_ENV === "development") {
1059
+ try {
1060
+ const localGlobals = await this.localCache.getGlobals();
1061
+ if (localGlobals) {
1062
+ return localGlobals;
1063
+ }
1064
+ } catch (e11) {
1068
1065
  }
1069
- } catch (e11) {
1070
1066
  }
1071
1067
  throw this.normalizeError(error, "Failed to fetch globals");
1072
1068
  }
@@ -1217,7 +1213,7 @@ var ContentEngine = class {
1217
1213
  };
1218
1214
  }
1219
1215
  writeCache(key, data, options) {
1220
- const ttlSeconds = options.revalidate === false ? 5 : Math.max(1, options.revalidate);
1216
+ const ttlSeconds = options.revalidate === false ? 60 : Math.max(1, options.revalidate);
1221
1217
  if (this.cacheStrategy === "memory") {
1222
1218
  this.memoryCache.set(key, data, {
1223
1219
  tags: options.tags,
@@ -1380,7 +1376,7 @@ var ContentEngine = class {
1380
1376
  }
1381
1377
  async fetchWithTimeout(url, options = {}) {
1382
1378
  const {
1383
- timeout = this.config.timeout || 25e3,
1379
+ timeout = this.config.timeout || 1e4,
1384
1380
  tags = [],
1385
1381
  revalidate,
1386
1382
  forceRefresh = false,
package/dist/react.js CHANGED
@@ -865,7 +865,7 @@ var ContentEngine = class {
865
865
  );
866
866
  if (this.config.debug && duration > 100) {
867
867
  console.warn(
868
- `[GN-Apex] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
868
+ `[NexusHub] \u26A0\uFE0F getPage("${slug}") took ${duration.toFixed(2)}ms`
869
869
  );
870
870
  }
871
871
  return result;
@@ -902,7 +902,7 @@ var ContentEngine = class {
902
902
  }
903
903
  }
904
904
  if (this.circuitBreaker.isOpen()) {
905
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
905
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
906
906
  }
907
907
  try {
908
908
  await this.rateLimiter.checkLimit();
@@ -919,22 +919,21 @@ var ContentEngine = class {
919
919
  return includeMetadata ? data : data.data;
920
920
  } catch (error) {
921
921
  this.circuitBreaker.recordFailure();
922
- try {
923
- const local = await this.localCache.getPage(slug);
924
- if (local) {
925
- console.warn(
926
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${slug}', successfully recovered from local cache.`
927
- );
928
- return includeMetadata ? {
929
- data: local,
930
- metadata: {
931
- timestamp: Date.now(),
932
- expiresAt: Infinity,
933
- tags: []
934
- }
935
- } : local;
922
+ if (process.env.NODE_ENV === "development") {
923
+ try {
924
+ const local = await this.localCache.getPage(slug);
925
+ if (local) {
926
+ return includeMetadata ? {
927
+ data: local,
928
+ metadata: {
929
+ timestamp: Date.now(),
930
+ expiresAt: Infinity,
931
+ tags: []
932
+ }
933
+ } : local;
934
+ }
935
+ } catch {
936
936
  }
937
- } catch {
938
937
  }
939
938
  throw this.normalizeError(error, `Failed to fetch page '${slug}'`);
940
939
  }
@@ -963,17 +962,17 @@ var ContentEngine = class {
963
962
  localCollection,
964
963
  normalizedQuery
965
964
  );
966
- return includeMetadata ? result : result;
965
+ return result;
967
966
  }
968
967
  } catch {
969
968
  }
970
969
  }
971
970
  if (this.circuitBreaker.isOpen()) {
972
- throw new Error("[GN-Apex] Circuit open. API is unavailable.");
971
+ throw new Error("[NexusHub] Circuit open. API is unavailable.");
973
972
  }
974
973
  try {
975
974
  await this.rateLimiter.checkLimit();
976
- const entry = await this.backoff.execute(async () => {
975
+ const result = await this.backoff.execute(async () => {
977
976
  return this.fetchCollection(
978
977
  collectionId,
979
978
  normalizedQuery,
@@ -984,22 +983,20 @@ var ContentEngine = class {
984
983
  );
985
984
  });
986
985
  this.circuitBreaker.recordSuccess();
987
- return includeMetadata ? entry : entry.data;
986
+ return includeMetadata ? result : result.data;
988
987
  } catch (error) {
989
988
  this.circuitBreaker.recordFailure();
990
- try {
991
- const localCollection = await this.localCache.getCollection(collectionId);
992
- if (localCollection) {
993
- console.warn(
994
- `[GN-Apex] \u26A0\uFE0F Network timeout on '${collectionId}', successfully recovered from local cache.`
995
- );
996
- const result = this.applyLocalQuery(
997
- localCollection,
998
- normalizedQuery
999
- );
1000
- return includeMetadata ? result : result;
989
+ if (process.env.NODE_ENV === "development") {
990
+ try {
991
+ const localCollection = await this.localCache.getCollection(collectionId);
992
+ if (localCollection) {
993
+ return this.applyLocalQuery(
994
+ localCollection,
995
+ normalizedQuery
996
+ );
997
+ }
998
+ } catch {
1001
999
  }
1002
- } catch {
1003
1000
  }
1004
1001
  throw this.normalizeError(
1005
1002
  error,
@@ -1058,15 +1055,14 @@ var ContentEngine = class {
1058
1055
  }
1059
1056
  return data;
1060
1057
  } catch (error) {
1061
- try {
1062
- const localGlobals = await this.localCache.getGlobals();
1063
- if (localGlobals) {
1064
- console.warn(
1065
- `[GN-Apex] \u26A0\uFE0F Network timeout on globals, successfully recovered from local cache.`
1066
- );
1067
- return localGlobals;
1058
+ if (process.env.NODE_ENV === "development") {
1059
+ try {
1060
+ const localGlobals = await this.localCache.getGlobals();
1061
+ if (localGlobals) {
1062
+ return localGlobals;
1063
+ }
1064
+ } catch {
1068
1065
  }
1069
- } catch {
1070
1066
  }
1071
1067
  throw this.normalizeError(error, "Failed to fetch globals");
1072
1068
  }
@@ -1217,7 +1213,7 @@ var ContentEngine = class {
1217
1213
  };
1218
1214
  }
1219
1215
  writeCache(key, data, options) {
1220
- const ttlSeconds = options.revalidate === false ? 5 : Math.max(1, options.revalidate);
1216
+ const ttlSeconds = options.revalidate === false ? 60 : Math.max(1, options.revalidate);
1221
1217
  if (this.cacheStrategy === "memory") {
1222
1218
  this.memoryCache.set(key, data, {
1223
1219
  tags: options.tags,
@@ -1380,7 +1376,7 @@ var ContentEngine = class {
1380
1376
  }
1381
1377
  async fetchWithTimeout(url, options = {}) {
1382
1378
  const {
1383
- timeout = this.config.timeout || 25e3,
1379
+ timeout = this.config.timeout || 1e4,
1384
1380
  tags = [],
1385
1381
  revalidate,
1386
1382
  forceRefresh = false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexushub/client",
3
3
  "private": false,
4
- "version": "1.1.11",
4
+ "version": "1.1.13",
5
5
  "description": "GN-Apex zero-config production runtime SDK",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",