@warmhub/sdk-ts 0.74.0 → 0.75.0

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.
@@ -6992,6 +6992,7 @@ var RE2JS = class RE2JS2 {
6992
6992
  // ../rules/src/shape-validation-types.ts
6993
6993
  var MAX_CONTENT_FIELD_BYTES = 64 * 1024;
6994
6994
  var MAX_INDEXABLE_SCALAR_FIELDS_PER_SHAPE = 256;
6995
+ var MAX_INDEXABLE_FIELD_PATH_BYTES = 256;
6995
6996
  var UNSUPPORTED_REGEX_SYNTAX_REASON = "uses unsupported regex syntax";
6996
6997
  var CONTENT_FIELD_LIMIT_ERROR = `WarmHub content fields are limited to ${MAX_CONTENT_FIELD_BYTES} bytes. WarmHub is not a document store; store large documents in S3, Box, Drive, or another document system and reference them from WarmHub instead.`;
6997
6998
  var textEncoder = new TextEncoder();
@@ -7782,6 +7783,12 @@ function validateShapeDefinition(data, options = {}) {
7782
7783
  const seenIndexableFieldPaths = /* @__PURE__ */ new Set();
7783
7784
  const duplicateIndexableFieldPaths = /* @__PURE__ */ new Set();
7784
7785
  for (const fieldPath of indexableFieldPaths) {
7786
+ const pathBytes = utf8ByteLength(fieldPath);
7787
+ if (pathBytes > MAX_INDEXABLE_FIELD_PATH_BYTES) {
7788
+ errors.push(
7789
+ `Indexable field path "${escapeFieldNameForDisplay(fieldPath)}" is ${pathBytes} bytes; maximum is ${MAX_INDEXABLE_FIELD_PATH_BYTES}`
7790
+ );
7791
+ }
7785
7792
  const foldedPath = foldFieldPath(fieldPath);
7786
7793
  if (seenIndexableFieldPaths.has(foldedPath)) {
7787
7794
  duplicateIndexableFieldPaths.add(foldedPath);
@@ -8103,6 +8110,12 @@ var PartialStreamSubmissionError = class extends Error {
8103
8110
  * repository state before retrying manually.
8104
8111
  */
8105
8112
  completedOperations;
8113
+ /**
8114
+ * Number of operations covered by append responses the SDK received before
8115
+ * the failure. This can exceed `completedOperations.length` when the backend
8116
+ * returns sparse or empty result rows.
8117
+ */
8118
+ acknowledgedOperationCount;
8106
8119
  /**
8107
8120
  * Underlying error that triggered the partial submission, preserved for
8108
8121
  * diagnostics. Inspect via `isWarmHubError(err.cause)` / `err.cause.kind`.
@@ -8115,6 +8128,7 @@ var PartialStreamSubmissionError = class extends Error {
8115
8128
  this.name = "WarmHubError";
8116
8129
  this.cause = input.cause;
8117
8130
  this.completedOperations = input.completedOperations;
8131
+ this.acknowledgedOperationCount = input.acknowledgedOperationCount ?? input.completedOperations.length;
8118
8132
  }
8119
8133
  };
8120
8134
  var AllStreamOperationsFailedError = class extends Error {
@@ -8310,6 +8324,7 @@ async function submitOperationsViaStream(client, args) {
8310
8324
  let createdByEmail;
8311
8325
  let repoSeq;
8312
8326
  const chunkResults = [];
8327
+ let acknowledgedOperationCount = 0;
8313
8328
  let sawAmbiguousAttempt = false;
8314
8329
  for (const { operations: chunk, start: chunkStart } of chunkOperations(
8315
8330
  operations,
@@ -8341,12 +8356,13 @@ async function submitOperationsViaStream(client, args) {
8341
8356
  chunkResults.push(
8342
8357
  ...offsetChunkResultIndexes(appendResult.results, chunkStart)
8343
8358
  );
8359
+ acknowledgedOperationCount += chunk.length;
8344
8360
  break;
8345
8361
  } catch (cause) {
8346
- if (chunkResults.length === 0 && !priorAttemptAmbiguous && isDefiniteClientError(cause)) {
8362
+ if (acknowledgedOperationCount === 0 && !priorAttemptAmbiguous && isDefiniteClientError(cause)) {
8347
8363
  throw cause;
8348
8364
  }
8349
- if (chunkResults.length === 0 && chunkIsAtomic && policy !== false && attempt < policy.maxAttempts && isTransientStreamFailure(cause)) {
8365
+ if (acknowledgedOperationCount === 0 && chunkIsAtomic && policy !== false && attempt < policy.maxAttempts && isTransientStreamFailure(cause)) {
8350
8366
  await sleep(computeBackoffDelayMs(attempt, policy));
8351
8367
  attempt += 1;
8352
8368
  priorAttemptAmbiguous = true;
@@ -8370,7 +8386,8 @@ async function submitOperationsViaStream(client, args) {
8370
8386
  );
8371
8387
  throw new PartialStreamSubmissionError({
8372
8388
  cause,
8373
- completedOperations
8389
+ completedOperations,
8390
+ acknowledgedOperationCount
8374
8391
  });
8375
8392
  }
8376
8393
  }
@@ -8391,7 +8408,8 @@ async function submitOperationsViaStream(client, args) {
8391
8408
  if (sawAmbiguousAttempt) {
8392
8409
  throw new PartialStreamSubmissionError({
8393
8410
  cause: failure,
8394
- completedOperations: completedOperationsFrom(result)
8411
+ completedOperations: completedOperationsFrom(result),
8412
+ acknowledgedOperationCount
8395
8413
  });
8396
8414
  }
8397
8415
  throw failure;
@@ -9204,7 +9222,7 @@ var OperationBuilder = class {
9204
9222
  /**
9205
9223
  * Validate, submit, and seal the builder.
9206
9224
  *
9207
- * A successful call submits operations through the same stream path as `client.commit.apply` and makes the builder single-use. Validation failures throw before any server request is made. Ambiguous multi-chunk failures surface as `PartialStreamSubmissionError`; deterministic all-failed batches surface as `AllStreamOperationsFailedError` with per-op failure data.
9225
+ * A successful call submits operations through the same stream path as `client.commit.apply` and makes the builder single-use. A `PartialStreamSubmissionError` also seals the builder to prevent blind replay. Validation failures throw before any server request is made. Deterministic all-failed batches surface as `AllStreamOperationsFailedError` with per-op failure data.
9208
9226
  *
9209
9227
  * @param params.client WarmHub client or compatible stream client used for submission.
9210
9228
  * @param params.message Optional commit message.
@@ -9240,6 +9258,11 @@ var OperationBuilder = class {
9240
9258
  });
9241
9259
  this.submitted = true;
9242
9260
  return result;
9261
+ } catch (error) {
9262
+ if (error instanceof PartialStreamSubmissionError) {
9263
+ this.submitted = true;
9264
+ }
9265
+ throw error;
9243
9266
  } finally {
9244
9267
  this.inFlight = false;
9245
9268
  }
@@ -9287,7 +9310,7 @@ function validateWarmHubClientOptions(options) {
9287
9310
  throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
9288
9311
  }
9289
9312
  }
9290
- var SDK_VERSION = "0.74.0" ;
9313
+ var SDK_VERSION = "0.75.0" ;
9291
9314
  var DEFAULT_API_URL = "https://api.warmhub.ai";
9292
9315
  var UNBATCHED_TRPC_PATHS = /* @__PURE__ */ new Set([
9293
9316
  "repo.shapeInstanceCounts",
@@ -12860,5 +12883,5 @@ re2js/build/index.js:
12860
12883
  */
12861
12884
 
12862
12885
  export { AllStreamOperationsFailedError, CLI_INSTALL_REPO_HEADER, CLI_SIGNATURE_HEADER, CLI_TIMESTAMP_HEADER, CONTENT_FIELD_LIMIT_ERROR, CliCallVerificationError, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT2 as MAX_STREAM_APPEND_OPERATION_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall };
12863
- //# sourceMappingURL=chunk-AFP7ZGMR.js.map
12864
- //# sourceMappingURL=chunk-AFP7ZGMR.js.map
12886
+ //# sourceMappingURL=chunk-QQTES2LQ.js.map
12887
+ //# sourceMappingURL=chunk-QQTES2LQ.js.map