@harperfast/harper 5.2.12 → 5.2.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.
Files changed (40) hide show
  1. package/dist/resources/Table.d.ts +2 -2
  2. package/dist/resources/Table.js +182 -61
  3. package/dist/resources/Table.js.map +1 -1
  4. package/dist/utility/errors/hdbError.d.ts +8 -0
  5. package/dist/utility/errors/hdbError.js +29 -0
  6. package/dist/utility/errors/hdbError.js.map +1 -1
  7. package/npm-shrinkwrap.json +2 -2
  8. package/package.json +1 -1
  9. package/resources/Table.ts +177 -62
  10. package/studio/web/assets/{Chat-CokJOjyX.js → Chat-4RrB5134.js} +1 -1
  11. package/studio/web/assets/{FloatingChat-h9BJo6YG.js → FloatingChat-omlNMDcJ.js} +3 -3
  12. package/studio/web/assets/{apiToken-B_g12QrM.js → apiToken-Bke3wvfZ.js} +1 -1
  13. package/studio/web/assets/{applications-Dlq5kJ2O.js → applications-DvFDYJgK.js} +1 -1
  14. package/studio/web/assets/{cssMode-DAjzPoBf.js → cssMode-C1vRa7zh.js} +1 -1
  15. package/studio/web/assets/{editor-VUNQ-5Ye.js → editor-3XRWEDWX.js} +1 -1
  16. package/studio/web/assets/{html-CFqhtdfa.js → html-CTY5tdMr.js} +1 -1
  17. package/studio/web/assets/{htmlMode-CpgOTfjz.js → htmlMode-CG1vSD9t.js} +1 -1
  18. package/studio/web/assets/{index-ZQ1upnh7.js → index-Dfpeofdu.js} +5 -5
  19. package/studio/web/assets/{index.lazy-HDafSRxx.js → index.lazy-B1VOIv-t.js} +1 -1
  20. package/studio/web/assets/{javascript-9l5JXJwc.js → javascript-CJeJzGnI.js} +1 -1
  21. package/studio/web/assets/{jsonMode-BJBH-iR0.js → jsonMode-CYPBwM82.js} +1 -1
  22. package/studio/web/assets/{languageServices-0ZvgO63b.js → languageServices-IKH4GUHl.js} +1 -1
  23. package/studio/web/assets/{lspLanguageFeatures-sNVDopx3.js → lspLanguageFeatures-BC8_gxKG.js} +1 -1
  24. package/studio/web/assets/{notifications-DvBJIIO0.js → notifications-BfKBpYcq.js} +1 -1
  25. package/studio/web/assets/{notifications-BukjVuVe.js → notifications-DFbArTfC.js} +1 -1
  26. package/studio/web/assets/{profile-B-jyYdzV.js → profile-Q4-T6c-S.js} +1 -1
  27. package/studio/web/assets/{regions-GN6Mu5aH.js → regions-CtkV0xje.js} +1 -1
  28. package/studio/web/assets/{register-CU-gCfLP.js → register-1ZZuMsiA.js} +2 -2
  29. package/studio/web/assets/{setComponentFile-D7Fww0lC.js → setComponentFile-ZWLcWv5X.js} +1 -1
  30. package/studio/web/assets/{setup-DG3Ws0Gg.js → setup-DWprJyJy.js} +2 -2
  31. package/studio/web/assets/{status-koJd66XF.js → status--aNm8isn.js} +1 -1
  32. package/studio/web/assets/{toggleHighContrast-CGksgPgv.js → toggleHighContrast-Cq_lt3XD.js} +1 -1
  33. package/studio/web/assets/{tsMode-D3T_5QzW.js → tsMode-pjgytARx.js} +1 -1
  34. package/studio/web/assets/{typescript-BegjUvtB.js → typescript-Cdg0mqUh.js} +1 -1
  35. package/studio/web/assets/{useEntityRestURL-BicFpx_N.js → useEntityRestURL-RZhaY8Rn.js} +1 -1
  36. package/studio/web/assets/{workers-Bmx4l_9B.js → workers-BgoXIqQe.js} +1 -1
  37. package/studio/web/assets/{xml-Bg40Rcra.js → xml-BwSeDMiP.js} +1 -1
  38. package/studio/web/assets/{yaml-DolDvfXE.js → yaml-DotCUG5l.js} +1 -1
  39. package/studio/web/index.html +1 -1
  40. package/utility/errors/hdbError.ts +26 -0
@@ -91,4 +91,12 @@ export declare class AccessViolation extends Violation {
91
91
  constructor(user?: any);
92
92
  }
93
93
  export declare function isHDBError(e: any): boolean;
94
+ /**
95
+ * Append context to an error's message, tolerating errors whose `message` cannot be assigned.
96
+ *
97
+ * A `DOMException` - what `fetch` rejects with when an `AbortSignal.timeout` fires - inherits
98
+ * `message` as a getter-only accessor, so a plain assignment throws under strict mode. Callers use
99
+ * this where losing the context is acceptable but throwing from a catch block is not.
100
+ */
101
+ export declare function appendErrorContext(error: unknown, context: string): void;
94
102
  export { hdbErrors };
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.hdbErrors = exports.AccessViolation = exports.Violation = exports.ValidationError = exports.IndexRebuildingError = exports.ServerError = exports.ClientError = exports.HdbError = void 0;
40
40
  exports.handleHDBError = handleHDBError;
41
41
  exports.isHDBError = isHDBError;
42
+ exports.appendErrorContext = appendErrorContext;
42
43
  const harper_logger_ts_1 = __importDefault(require("../logging/harper_logger.js"));
43
44
  const hdbErrors = __importStar(require("./commonErrors.js"));
44
45
  exports.hdbErrors = hdbErrors;
@@ -205,4 +206,32 @@ exports.AccessViolation = AccessViolation;
205
206
  function isHDBError(e) {
206
207
  return e.__proto__.constructor.name === HdbError.name;
207
208
  }
209
+ /**
210
+ * Append context to an error's message, tolerating errors whose `message` cannot be assigned.
211
+ *
212
+ * A `DOMException` - what `fetch` rejects with when an `AbortSignal.timeout` fires - inherits
213
+ * `message` as a getter-only accessor, so a plain assignment throws under strict mode. Callers use
214
+ * this where losing the context is acceptable but throwing from a catch block is not.
215
+ */
216
+ function appendErrorContext(error, context) {
217
+ try {
218
+ if (typeof error?.message !== 'string')
219
+ return;
220
+ const annotated = `${error.message}${context}`;
221
+ try {
222
+ error.message = annotated;
223
+ }
224
+ catch {
225
+ // A getter-only `message` (DOMException) takes an own property instead.
226
+ Object.defineProperty(error, 'message', {
227
+ value: annotated,
228
+ writable: true,
229
+ configurable: true,
230
+ });
231
+ }
232
+ }
233
+ catch {
234
+ /* frozen, or a throwing accessor - the original message still propagates */
235
+ }
236
+ }
208
237
  //# sourceMappingURL=hdbError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hdbError.js","sourceRoot":"","sources":["../../../utility/errors/hdbError.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoIb,wCAoBC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
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "harper",
9
- "version": "5.2.12",
9
+ "version": "5.2.13",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-s3": "^3.1012.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harperfast/harper",
3
3
  "description": "Harper is an open-source Node.js performance platform that unifies database, cache, application, and messaging layers into one in-memory process.",
4
- "version": "5.2.12",
4
+ "version": "5.2.13",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://harper.fast",
7
7
  "bugs": {
@@ -49,6 +49,7 @@ import {
49
49
  ServerError,
50
50
  AccessViolation,
51
51
  ValidationError,
52
+ appendErrorContext,
52
53
  type ValidationIssue,
53
54
  } from '../utility/errors/hdbError.ts';
54
55
  import * as signalling from '../utility/signalling.ts';
@@ -139,6 +140,20 @@ const EVICTION_BATCH_SIZE = 100;
139
140
  // letting an unbounded number of open transactions (and their snapshots) accumulate.
140
141
  const MAX_INFLIGHT_EVICTION_BATCHES = 4;
141
142
  const CACHEABLE_STATUS_CODES = new Set([200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, 501]);
143
+ // Smallest forward sample `getRecordCount` will extrapolate a record rate from; below it the scan runs
144
+ // to completion and reports an exact count.
145
+ const MIN_ESTIMATOR_SAMPLE = 1_000;
146
+ // Budget intervals the forward scan may spend before it must estimate rather than keep scanning.
147
+ const MAX_ESTIMATE_CHECKPOINTS = 20;
148
+ // A store estimate's `count`, or 0 when the store answered with a shape that cannot be trusted --
149
+ // DESIGN.md's invariant for this API family is that such an answer degrades rather than poisons.
150
+ function usableCount(estimate: any): number {
151
+ const { count, confidence } = estimate ?? {};
152
+ // `confidence` needs its own finiteness check, not just the range: `null >= 0 && null <= 1` is true
153
+ if (!Number.isFinite(count) || count < 0 || !Number.isFinite(confidence) || confidence < 0 || confidence > 1)
154
+ return 0;
155
+ return count;
156
+ }
142
157
  envMngr.initSync();
143
158
  const LMDB_PREFETCH_WRITES = envMngr.get(CONFIG_PARAMS.STORAGE_PREFETCHWRITES);
144
159
  const LOCK_TIMEOUT = 10000;
@@ -1595,8 +1610,7 @@ export function makeTable(options) {
1595
1610
  records: './', // an href to the records themselves
1596
1611
  name: tableName,
1597
1612
  database: databaseName,
1598
- auditSize:
1599
- auditStore instanceof RocksDatabase ? auditStore.getKeysCount() : auditStore?.getStats().entryCount,
1613
+ auditSize: auditStore?.getStats().entryCount,
1600
1614
  attributes,
1601
1615
  recordCount: undefined,
1602
1616
  estimatedRecordRange: undefined,
@@ -4896,82 +4910,174 @@ export function makeTable(options) {
4896
4910
  const exactCount = options?.exactCount;
4897
4911
  const TIME_LIMIT = options?.timeLimit ?? 1000 / 2; // one second time limit, enforced by seeing if we are halfway through at 500ms
4898
4912
  const start = performance.now();
4899
- // `entryCount` (the exact key count) is only needed once the scan blows the time budget --
4900
- // to decide whether to estimate and as the extrapolation base. On RocksDB it is a full
4901
- // key-only scan, so we defer it: tables that finish within budget (the common case) and
4902
- // `exact_count` requests never pay for it. `halfway`/`entryCount` stay 0 until first computed.
4903
4913
  let entryCount = 0;
4904
- let halfway = 0;
4905
- let counted = false;
4906
- let completeForExact = false;
4914
+ let remainderPhysical = 0;
4915
+ let estimator;
4916
+ // feature-detected per DESIGN.md's invariant for this API family; LMDB stores do not implement it
4917
+ const canEstimate =
4918
+ typeof primaryStore.createCountEstimator === 'function' && typeof primaryStore.estimateCount === 'function';
4919
+ let estimatorFailed = false;
4920
+ let warnedNoBase = false;
4921
+ let checkpoints = 0;
4922
+ let checkpointedEntries = 0;
4907
4923
  let recordCount = 0;
4908
4924
  let entriesScanned = 0;
4925
+ let lastKey;
4909
4926
  let limit: number;
4910
- for (const { value } of primaryStore.getRange({ start: true, lazy: true, snapshot: false })) {
4927
+ let nextCheckAt = start + TIME_LIMIT;
4928
+ for (const { key, value } of primaryStore.getRange({ start: true, lazy: true, snapshot: false })) {
4911
4929
  if (value != null) recordCount++;
4912
4930
  entriesScanned++;
4931
+ lastKey = key;
4913
4932
  await rest();
4914
- if (!exactCount && !completeForExact && performance.now() - start > TIME_LIMIT) {
4915
- if (!counted) {
4916
- counted = true;
4917
- entryCount = isRocksDB
4918
- ? primaryStore.getKeysCount({ start: undefined })
4919
- : primaryStore.getStats().entryCount;
4920
- halfway = Math.floor(entryCount / 2);
4933
+ // a table too small to reach the floor is small enough to finish exactly
4934
+ if (exactCount || entriesScanned < MIN_ESTIMATOR_SAMPLE) continue;
4935
+ const now = performance.now();
4936
+ if (now <= nextCheckAt) continue;
4937
+ nextCheckAt = now + TIME_LIMIT;
4938
+ checkpoints++;
4939
+ if (canEstimate && !estimatorFailed) {
4940
+ try {
4941
+ estimator ??= primaryStore.createCountEstimator({ start: true });
4942
+ estimator.advance(lastKey, entriesScanned - checkpointedEntries);
4943
+ checkpointedEntries = entriesScanned;
4944
+ entryCount = usableCount(estimator.estimate());
4945
+ } catch (error) {
4946
+ // a store closing concurrently -- drop_table can, while this scan is parked in a yield
4947
+ logger.debug?.('Count estimator unavailable, falling back to an exact scan', error);
4948
+ estimatorFailed = true;
4949
+ estimator = undefined;
4950
+ entryCount = 0;
4921
4951
  }
4922
- if (entriesScanned < halfway) {
4923
- // it is taking too long, so we will just take this sample and a sample from the end to estimate
4924
- limit = entriesScanned;
4925
- break;
4952
+ } else if (!canEstimate) {
4953
+ // `canEstimate` false is not the same as "LMDB": a RocksDB store whose native module predates
4954
+ // the estimator API lands here too, and `RocksDatabase.getStats()` carries no `entryCount`.
4955
+ try {
4956
+ const stats = primaryStore.getStats?.();
4957
+ entryCount = Number.isFinite(stats?.entryCount) && stats.entryCount > 0 ? stats.entryCount : 0;
4958
+ } catch {
4959
+ entryCount = 0;
4926
4960
  }
4927
- // Past the halfway point already: finishing the scan for an exact count is cheaper
4928
- // than estimating. Set the flag so we stop re-evaluating the budget on each remaining iteration.
4929
- completeForExact = true;
4961
+ }
4962
+ if (!entryCount && canEstimate && !estimatorFailed) {
4963
+ // Range estimates are block-granular and can report 0 for a store whose entries are still
4964
+ // in the memtable. Without a base the escape cannot fire at all, so fall back to the
4965
+ // whole-store property rather than silently walking the table.
4966
+ try {
4967
+ const wholeStore = primaryStore.getEstimatedKeyCount();
4968
+ entryCount = Number.isFinite(wholeStore) && wholeStore > 0 ? wholeStore : 0;
4969
+ } catch {
4970
+ entryCount = 0;
4971
+ }
4972
+ if (!entryCount && !warnedNoBase) {
4973
+ warnedNoBase = true;
4974
+ logger.debug?.(`No usable key-count estimate for ${tableName}; counting records by full scan`);
4975
+ }
4976
+ }
4977
+ // Zero is "no usable base": degrade to the exact scan. The checkpoint ceiling is what stops a
4978
+ // base that keeps undershooting from holding the halfway test false forever and walking the
4979
+ // whole table; the reverse sample is bounded by `limit` in turn.
4980
+ if (
4981
+ entryCount > 0 &&
4982
+ (checkpoints >= MAX_ESTIMATE_CHECKPOINTS || entriesScanned < Math.floor(entryCount / 2))
4983
+ ) {
4984
+ if (canEstimate) {
4985
+ try {
4986
+ const remaining = primaryStore.estimateCount({ start: lastKey, exclusiveStart: true });
4987
+ // widened by its own reported untrustworthiness: block-granular, so it can land below
4988
+ // the live count it is meant to bound
4989
+ const remainingCount = usableCount(remaining);
4990
+ remainderPhysical = remainingCount > 0 ? remainingCount * (2 - remaining.confidence) : 0;
4991
+ } catch {
4992
+ remainderPhysical = 0;
4993
+ }
4994
+ // A zero or unusable remainder is valid -- entries still in the memtable read as none
4995
+ // through range statistics -- but it would leave `baseMax` resting on the sampled ends
4996
+ // alone. The whole-store property is a separate, non-range source, so fall back to it.
4997
+ if (!remainderPhysical) {
4998
+ try {
4999
+ const wholeStore = primaryStore.getEstimatedKeyCount();
5000
+ if (Number.isFinite(wholeStore)) remainderPhysical = Math.max(wholeStore - entriesScanned, 0);
5001
+ } catch {
5002
+ remainderPhysical = 0;
5003
+ }
5004
+ }
5005
+ }
5006
+ limit = entriesScanned;
5007
+ break;
4930
5008
  }
4931
5009
  }
4932
5010
  if (limit) {
4933
5011
  // in this case we are going to make an estimate of the table count using the first thousand
4934
5012
  // entries and last thousand entries
4935
5013
  const firstRecordCount = recordCount;
5014
+ const firstKey = lastKey;
4936
5015
  recordCount = 0;
4937
5016
  // Bound the reverse scan explicitly. The getRange `limit` option is honored by lmdb-js but
4938
5017
  // ignored by rocksdb-js; without this break the scan reads the whole table, so `recordRate`
4939
5018
  // blows up to ~entryCount/(2*limit) and the estimate scales with entryCount^2 -- the source
4940
5019
  // of the wildly inflated `record_count` (e.g. 20,000,000 for ~105k rows) on large RocksDB
4941
- // tables. The early-exit above guarantees limit < entryCount/2, so the two samples stay disjoint.
5020
+ // tables.
4942
5021
  let reverseScanned = 0;
4943
- for (const { value } of primaryStore.getRange({
5022
+ // Sized independently of the forward scan. `entriesScanned` is whatever the forward pass
5023
+ // covered before it escaped, and the checkpoint ceiling lets that run twenty budget
5024
+ // intervals when the base keeps undershooting; matching it here would read that same count
5025
+ // again and double the wall clock of the call this path exists to bound.
5026
+ const reverseLimit = Math.min(limit, MIN_ESTIMATOR_SAMPLE);
5027
+ // Disjointness is enforced against the forward scan's own last key rather than inferred from
5028
+ // the base, which is an estimate that can overshoot by more than 2x.
5029
+ let sampledWholeTable = false;
5030
+ for (const { key, value } of primaryStore.getRange({
4944
5031
  start: '\uffff',
4945
5032
  reverse: true,
4946
5033
  lazy: true,
4947
- limit,
5034
+ limit: reverseLimit,
4948
5035
  snapshot: false,
4949
5036
  })) {
5037
+ if (compareKeys(key, firstKey) <= 0) {
5038
+ sampledWholeTable = true;
5039
+ break;
5040
+ }
4950
5041
  if (value != null) recordCount++;
4951
5042
  reverseScanned++;
4952
5043
  await rest();
4953
- if (reverseScanned >= limit) break;
5044
+ if (reverseScanned >= reverseLimit) break;
4954
5045
  }
5046
+ // the samples met, so between them they covered every entry
5047
+ if (sampledWholeTable) return { recordCount: recordCount + firstRecordCount };
4955
5048
  // Use the actual entries sampled, not limit*2: the reverse scan can yield fewer than `limit`
4956
5049
  // (concurrent deletions under snapshot:false, or an overestimated entryCount), and counting
4957
5050
  // those un-scanned slots would inflate the denominator and underestimate the rate.
4958
- const sampleSize = limit + reverseScanned;
4959
- const recordRate = (recordCount + firstRecordCount) / sampleSize;
4960
- const variance =
4961
- Math.pow((recordCount - firstRecordCount + 1) / limit / 2, 2) + // variance between samples
4962
- (recordRate * (1 - recordRate)) / sampleSize;
4963
- const sd = Math.max(Math.sqrt(variance) * entryCount, 1);
4964
- const estimatedRecordCount = Math.round(recordRate * entryCount);
4965
- // TODO: This uses a normal/Wald interval, but a binomial confidence interval is probably better calculated using
4966
- // Wilson score interval or Agresti-Coull interval (I think the latter is a little easier to calculate/implement).
4967
- const lowerCiLimit = Math.max(estimatedRecordCount - 1.96 * sd, recordCount + firstRecordCount);
4968
- const upperCiLimit = Math.min(estimatedRecordCount + 1.96 * sd, entryCount);
4969
- let significantUnit = Math.pow(10, Math.round(Math.log10(sd)));
4970
- if (significantUnit > estimatedRecordCount) significantUnit = significantUnit / 10;
4971
- recordCount = Math.round(estimatedRecordCount / significantUnit) * significantUnit;
5051
+ const sampledRecords = recordCount + firstRecordCount;
5052
+ const recordRate = sampledRecords / (limit + reverseScanned);
5053
+ // Endpoints for the extrapolation base, spanning both ways an estimated base can be wrong:
5054
+ // every remaining entry superseded (only what was sampled is live) through every remaining
5055
+ // entry live (the uncalibrated physical count). Churn concentrated outside the sampled ends
5056
+ // calibrates to nothing, so an interval derived from the estimator's confidence would sit
5057
+ // narrowly around the wrong number. Both endpoints are themselves estimates on RocksDB, so
5058
+ // this is a widened heuristic interval, not a guaranteed bound on the live count.
5059
+ const baseMin = entriesScanned + reverseScanned;
5060
+ const baseMax = Math.max(entriesScanned + remainderPhysical, entryCount, baseMin);
5061
+ const estimatedRecordCount = Math.round(recordRate * Math.max(entryCount, baseMin));
5062
+ // The samples counted these directly, and the entries between them can only add; everything
5063
+ // outside the samples could be live. A statistical interval inside those endpoints would be
5064
+ // narrowest exactly where the ends are least representative of the middle -- sampled ends
5065
+ // that are all deletion entries give a rate of 0, collapsing an upper end to ~0 with live
5066
+ // rows in between -- so the endpoints are the evidence itself.
5067
+ const lower = sampledRecords;
5068
+ const upper = Math.round(baseMax);
5069
+ // Report only the precision the interval supports, but never so coarse a unit that the
5070
+ // estimate rounds away: `baseMax` is physical and can exceed a calibrated estimate by
5071
+ // orders of magnitude, which a single division cannot walk back.
5072
+ let significantUnit = Math.pow(10, Math.round(Math.log10(Math.max((upper - lower) / 2, 1))));
5073
+ while (significantUnit > estimatedRecordCount && significantUnit > 1) significantUnit /= 10;
5074
+ recordCount = Math.min(
5075
+ Math.max(Math.round(estimatedRecordCount / significantUnit) * significantUnit, lower),
5076
+ upper
5077
+ );
4972
5078
  return {
4973
5079
  recordCount,
4974
- estimatedRange: [Math.round(lowerCiLimit), Math.round(upperCiLimit)],
5080
+ estimatedRange: [lower, upper],
4975
5081
  };
4976
5082
  }
4977
5083
  return {
@@ -6089,25 +6195,34 @@ export function makeTable(options) {
6089
6195
  }
6090
6196
  resolve(resolvedEntry);
6091
6197
  } catch (error) {
6092
- error.message += ` while resolving record ${id} for ${tableName}`;
6093
- if (
6094
- existingRecord &&
6095
- (((error.code === 'ECONNRESET' || error.code === 'ECONNREFUSED' || error.code === 'EAI_AGAIN') &&
6096
- !context?.mustRevalidate) ||
6097
- (context?.staleIfError &&
6098
- (error.statusCode === 500 ||
6099
- error.statusCode === 502 ||
6100
- error.statusCode === 503 ||
6101
- error.statusCode === 504)))
6102
- ) {
6103
- // these are conditions under which we can use stale data after an error
6104
- resolve({
6105
- key: id,
6106
- version: existingVersion,
6107
- value: existingRecord,
6108
- } as any);
6109
- logger.trace?.(error.message, '(returned stale record)');
6110
- } else reject(error);
6198
+ // A source may reject with anything at all, so deciding how to settle is itself
6199
+ // fallible: `message` is not assignable on every error (a DOMException from
6200
+ // AbortSignal.timeout), and a nullish rejection makes the reads below throw.
6201
+ // Leaving this promise unsettled hangs the caller forever, so every path here
6202
+ // has to end in resolve() or reject().
6203
+ try {
6204
+ appendErrorContext(error, ` while resolving record ${id} for ${tableName}`);
6205
+ if (
6206
+ existingRecord &&
6207
+ (((error.code === 'ECONNRESET' || error.code === 'ECONNREFUSED' || error.code === 'EAI_AGAIN') &&
6208
+ !context?.mustRevalidate) ||
6209
+ (context?.staleIfError &&
6210
+ (error.statusCode === 500 ||
6211
+ error.statusCode === 502 ||
6212
+ error.statusCode === 503 ||
6213
+ error.statusCode === 504)))
6214
+ ) {
6215
+ // these are conditions under which we can use stale data after an error
6216
+ resolve({
6217
+ key: id,
6218
+ version: existingVersion,
6219
+ value: existingRecord,
6220
+ } as any);
6221
+ logger.trace?.((error as Error)?.message, '(returned stale record)');
6222
+ } else reject(error);
6223
+ } catch (settlingError) {
6224
+ reject(error ?? settlingError);
6225
+ }
6111
6226
  const resolveDuration = performance.now() - start;
6112
6227
  recordAction(resolveDuration, 'cache-resolution', tableName, null, 'fail');
6113
6228
  if (responseHeaders)
@@ -1,4 +1,4 @@
1
- import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,v as y,x as b,y as x}from"./vendor-core-c2JRRJpV.js";import{i as S,t as C}from"./button-BIsUKRZq.js";import{a as ee}from"./vendor-datadog-CLUcJXOo.js";import{r as te}from"./vendor-react-CJV_K1u4.js";import{L as ne,k as re,q as ie,z as ae}from"./vendor-tanstack-DxzraizX.js";import{n as oe}from"./setSessionStorage-B0bf71m4.js";import{It as se}from"./vendor-ui-BUjK0h8a.js";import{t as w}from"./createLucideIcon-CzW9508A.js";import{n as ce,r as le,t as ue}from"./chevron-up-DtKGqDn3.js";import{c as de,f as fe,g as pe,h as me,i as he,l as ge,m as _e,p as ve,r as ye,t as be,u as xe}from"./setComponentFile-D7Fww0lC.js";import{t as Se}from"./x-DIzaLEdK.js";import{n as Ce}from"./setLocalStorage-D_kflv4U.js";import{t as we}from"./useLocalStorage-BqMR3D8_.js";import{An as Te,Dr as Ee,En as De,H as Oe,It as ke,Mr as Ae,Mt as je,Nt as Me,Or as Ne,Pt as Pe,Tr as Fe,V as Ie,Z as Le,br as Re,c as ze,cr as Be,d as Ve,f as He,fr as Ue,ft as We,hr as Ge,in as Ke,m as qe,or as Je,ur as Ye,ut as Xe,yr as Ze,yt as Qe}from"./index-ZQ1upnh7.js";import{t as $e}from"./useEntityRestURL-BicFpx_N.js";import{n as et,t as tt}from"./FloatingChat-h9BJo6YG.js";import{n as nt}from"./getAnalytics-GHK8ORfM.js";var rt=w(`between-horizontal-start`,[[`rect`,{width:`13`,height:`7`,x:`8`,y:`3`,rx:`1`,key:`pkso9a`}],[`path`,{d:`m2 9 3 3-3 3`,key:`1agib5`}],[`rect`,{width:`13`,height:`7`,x:`8`,y:`14`,rx:`1`,key:`1q5fc1`}]]),it=w(`book`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),at=w(`chart-area`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z`,key:`q0gr47`}]]),ot=w(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),st=w(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),ct=w(`logs`,[[`path`,{d:`M3 5h1`,key:`1mv5vm`}],[`path`,{d:`M3 12h1`,key:`lp3yf2`}],[`path`,{d:`M3 19h1`,key:`w6f3n9`}],[`path`,{d:`M8 5h1`,key:`1nxr5w`}],[`path`,{d:`M8 12h1`,key:`1con00`}],[`path`,{d:`M8 19h1`,key:`k7p10e`}],[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}]]),lt=w(`message-square-heart`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7.5 9.5c0 .687.265 1.383.697 1.844l3.009 3.264a1.14 1.14 0 0 0 .407.314 1 1 0 0 0 .783-.004 1.14 1.14 0 0 0 .398-.31l3.008-3.264A2.77 2.77 0 0 0 16.5 9.5 2.5 2.5 0 0 0 12 8a2.5 2.5 0 0 0-4.5 1.5`,key:`1faxuh`}]]),ut=w(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),dt=w(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]);async function ft(){await S.delete(`/Chat/Messages/`)}var T=e(ee(),1),E=te();function pt({setMessages:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useCallback)(async()=>{if(!t){n(!0);try{await ft(),e([])}catch(e){console.error(`Failed to clear chat:`,e)}finally{n(!1)}}},[t,e]);return(0,E.jsxs)(`button`,{type:`button`,className:`clear-chat-button gap-1`,onClick:r,disabled:t,title:`Clear chat`,children:[t?(0,E.jsx)(Ze,{className:`animate-spin`,size:18}):(0,E.jsx)(Ye,{size:18}),`Clear`]})}async function mt(){let{data:e}=await S.get(`/Chat/Messages/`);return e}var ht=`vercel.ai.error`,gt=Symbol.for(ht),_t,vt,D=class e extends (vt=Error,_t=gt,vt){constructor({name:e,message:t,cause:n}){super(t),this[_t]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,ht)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};function yt(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var bt=`AI_InvalidArgumentError`,xt=`vercel.ai.error.${bt}`,St=Symbol.for(xt),Ct,wt,Tt=class extends (wt=D,Ct=St,wt){constructor({message:e,cause:t,argument:n}){super({name:bt,message:e,cause:t}),this[Ct]=!0,this.argument=n}static isInstance(e){return D.hasMarker(e,xt)}},Et=`AI_JSONParseError`,Dt=`vercel.ai.error.${Et}`,Ot=Symbol.for(Dt),kt,At,jt=class extends (At=D,kt=Ot,At){constructor({text:e,cause:t}){super({name:Et,message:`JSON parsing failed: Text: ${e}.
1
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,v as y,x as b,y as x}from"./vendor-core-c2JRRJpV.js";import{i as S,t as C}from"./button-BIsUKRZq.js";import{a as ee}from"./vendor-datadog-CLUcJXOo.js";import{r as te}from"./vendor-react-CJV_K1u4.js";import{L as ne,k as re,q as ie,z as ae}from"./vendor-tanstack-DxzraizX.js";import{n as oe}from"./setSessionStorage-B0bf71m4.js";import{It as se}from"./vendor-ui-BUjK0h8a.js";import{t as w}from"./createLucideIcon-CzW9508A.js";import{n as ce,r as le,t as ue}from"./chevron-up-DtKGqDn3.js";import{c as de,f as fe,g as pe,h as me,i as he,l as ge,m as _e,p as ve,r as ye,t as be,u as xe}from"./setComponentFile-ZWLcWv5X.js";import{t as Se}from"./x-DIzaLEdK.js";import{n as Ce}from"./setLocalStorage-D_kflv4U.js";import{t as we}from"./useLocalStorage-BqMR3D8_.js";import{An as Te,Dr as Ee,En as De,H as Oe,It as ke,Mr as Ae,Mt as je,Nt as Me,Or as Ne,Pt as Pe,Tr as Fe,V as Ie,Z as Le,br as Re,c as ze,cr as Be,d as Ve,f as He,fr as Ue,ft as We,hr as Ge,in as Ke,m as qe,or as Je,ur as Ye,ut as Xe,yr as Ze,yt as Qe}from"./index-Dfpeofdu.js";import{t as $e}from"./useEntityRestURL-RZhaY8Rn.js";import{n as et,t as tt}from"./FloatingChat-omlNMDcJ.js";import{n as nt}from"./getAnalytics-GHK8ORfM.js";var rt=w(`between-horizontal-start`,[[`rect`,{width:`13`,height:`7`,x:`8`,y:`3`,rx:`1`,key:`pkso9a`}],[`path`,{d:`m2 9 3 3-3 3`,key:`1agib5`}],[`rect`,{width:`13`,height:`7`,x:`8`,y:`14`,rx:`1`,key:`1q5fc1`}]]),it=w(`book`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),at=w(`chart-area`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z`,key:`q0gr47`}]]),ot=w(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),st=w(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),ct=w(`logs`,[[`path`,{d:`M3 5h1`,key:`1mv5vm`}],[`path`,{d:`M3 12h1`,key:`lp3yf2`}],[`path`,{d:`M3 19h1`,key:`w6f3n9`}],[`path`,{d:`M8 5h1`,key:`1nxr5w`}],[`path`,{d:`M8 12h1`,key:`1con00`}],[`path`,{d:`M8 19h1`,key:`k7p10e`}],[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}]]),lt=w(`message-square-heart`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7.5 9.5c0 .687.265 1.383.697 1.844l3.009 3.264a1.14 1.14 0 0 0 .407.314 1 1 0 0 0 .783-.004 1.14 1.14 0 0 0 .398-.31l3.008-3.264A2.77 2.77 0 0 0 16.5 9.5 2.5 2.5 0 0 0 12 8a2.5 2.5 0 0 0-4.5 1.5`,key:`1faxuh`}]]),ut=w(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),dt=w(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]);async function ft(){await S.delete(`/Chat/Messages/`)}var T=e(ee(),1),E=te();function pt({setMessages:e}){let[t,n]=(0,T.useState)(!1),r=(0,T.useCallback)(async()=>{if(!t){n(!0);try{await ft(),e([])}catch(e){console.error(`Failed to clear chat:`,e)}finally{n(!1)}}},[t,e]);return(0,E.jsxs)(`button`,{type:`button`,className:`clear-chat-button gap-1`,onClick:r,disabled:t,title:`Clear chat`,children:[t?(0,E.jsx)(Ze,{className:`animate-spin`,size:18}):(0,E.jsx)(Ye,{size:18}),`Clear`]})}async function mt(){let{data:e}=await S.get(`/Chat/Messages/`);return e}var ht=`vercel.ai.error`,gt=Symbol.for(ht),_t,vt,D=class e extends (vt=Error,_t=gt,vt){constructor({name:e,message:t,cause:n}){super(t),this[_t]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,ht)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};function yt(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}var bt=`AI_InvalidArgumentError`,xt=`vercel.ai.error.${bt}`,St=Symbol.for(xt),Ct,wt,Tt=class extends (wt=D,Ct=St,wt){constructor({message:e,cause:t,argument:n}){super({name:bt,message:e,cause:t}),this[Ct]=!0,this.argument=n}static isInstance(e){return D.hasMarker(e,xt)}},Et=`AI_JSONParseError`,Dt=`vercel.ai.error.${Et}`,Ot=Symbol.for(Dt),kt,At,jt=class extends (At=D,kt=Ot,At){constructor({text:e,cause:t}){super({name:Et,message:`JSON parsing failed: Text: ${e}.
2
2
  Error message: ${yt(t)}`,cause:t}),this[kt]=!0,this.text=e}static isInstance(e){return D.hasMarker(e,Dt)}},Mt=`AI_TypeValidationError`,Nt=`vercel.ai.error.${Mt}`,Pt=Symbol.for(Nt),Ft,It,O=class e extends (It=D,Ft=Pt,It){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:Mt,message:`${r}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${yt(t)}`,cause:t}),this[Ft]=!0,this.value=e,this.context=n}static isInstance(e){return D.hasMarker(e,Nt)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},Lt=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Rt=10,zt=13,k=32;function Bt(e){}function Vt(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Bt,onError:n=Bt,onRetry:r=Bt,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
4
4
  `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new Lt(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`