@warmhub/sdk-ts 0.83.0 → 0.84.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.
- package/dist/{chunk-6AHGGJL6.js → chunk-CLDVXOJD.js} +57 -29
- package/dist/chunk-CLDVXOJD.js.map +1 -0
- package/dist/index.d.ts +67 -31
- package/dist/index.js +1 -1
- package/dist/react.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-6AHGGJL6.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -644,6 +644,7 @@ type StreamAppendInput$1 = {
|
|
|
644
644
|
name: string;
|
|
645
645
|
kind?: 'shape' | 'thing' | 'assertion' | 'collection';
|
|
646
646
|
reason?: string;
|
|
647
|
+
expectedVersion?: number;
|
|
647
648
|
leaseId?: string;
|
|
648
649
|
} | {
|
|
649
650
|
operation: 'rename';
|
|
@@ -1250,6 +1251,11 @@ interface RetractOperation {
|
|
|
1250
1251
|
* Optional human-readable retraction reason.
|
|
1251
1252
|
*/
|
|
1252
1253
|
reason?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* Optional optimistic-concurrency precondition. When supplied, the retract
|
|
1256
|
+
* is applied only if the target is still at this version number.
|
|
1257
|
+
*/
|
|
1258
|
+
expectedVersion?: number;
|
|
1253
1259
|
/**
|
|
1254
1260
|
* Optional read-lease token (#3625) returned by `thing.getWithLease`. A
|
|
1255
1261
|
* matching token auto-releases the lease on commit; a mismatch (or absence
|
|
@@ -1408,9 +1414,11 @@ type StreamFailureCause = {
|
|
|
1408
1414
|
*
|
|
1409
1415
|
* The `completedOperations` field contains returned rows the SDK knows
|
|
1410
1416
|
* completed. `acknowledgedOperationCount` also records progress when an append
|
|
1411
|
-
* response contains sparse or empty result rows.
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1417
|
+
* response contains sparse or empty result rows. If the attempted append is
|
|
1418
|
+
* outcome-unknown, stop writes until it can no longer apply, then obtain a
|
|
1419
|
+
* later verified checkpoint and reconcile it with the acknowledged receipt.
|
|
1420
|
+
* Branch on `attemptedAppendOutcome`; the underlying `cause` is diagnostic and
|
|
1421
|
+
* may describe a later rejection that followed an earlier ambiguous attempt.
|
|
1414
1422
|
*
|
|
1415
1423
|
* @see https://docs.warmhub.ai/sdk/transient-retry/#partial-submissions
|
|
1416
1424
|
*/
|
|
@@ -1421,8 +1429,8 @@ declare class PartialStreamSubmissionError extends Error {
|
|
|
1421
1429
|
readonly code = "PARTIAL_STREAM_SUBMISSION";
|
|
1422
1430
|
/**
|
|
1423
1431
|
* Operations the SDK confirmed completed before the ambiguous or failing
|
|
1424
|
-
* append. The
|
|
1425
|
-
*
|
|
1432
|
+
* append. The attempted append may or may not have landed; do not blindly
|
|
1433
|
+
* replay it.
|
|
1426
1434
|
* @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#completedoperations
|
|
1427
1435
|
*/
|
|
1428
1436
|
readonly completedOperations: SubmittedStreamResult['operations'];
|
|
@@ -1433,9 +1441,23 @@ declare class PartialStreamSubmissionError extends Error {
|
|
|
1433
1441
|
* @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#acknowledgedoperationcount
|
|
1434
1442
|
*/
|
|
1435
1443
|
readonly acknowledgedOperationCount: number;
|
|
1444
|
+
/**
|
|
1445
|
+
* Last repository sequence returned by an acknowledged chunk that persisted
|
|
1446
|
+
* an event. This is a lower bound for known completed work, never evidence
|
|
1447
|
+
* that the attempted append did not land.
|
|
1448
|
+
*/
|
|
1449
|
+
readonly lastAcknowledgedRepoSeq?: number;
|
|
1450
|
+
/**
|
|
1451
|
+
* Authoritative outcome of the attempted append. `not_applied` is used only
|
|
1452
|
+
* when the SDK received explicit server rejection evidence; `unknown` means
|
|
1453
|
+
* callers must stop writes and reconcile from a later verified checkpoint.
|
|
1454
|
+
* @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#attemptedappendoutcome
|
|
1455
|
+
*/
|
|
1456
|
+
readonly attemptedAppendOutcome: 'not_applied' | 'unknown';
|
|
1436
1457
|
/**
|
|
1437
1458
|
* Underlying error that triggered the partial submission, preserved for
|
|
1438
|
-
* diagnostics.
|
|
1459
|
+
* diagnostics. Do not infer append outcome from this field; branch on
|
|
1460
|
+
* `attemptedAppendOutcome` instead.
|
|
1439
1461
|
* @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#cause
|
|
1440
1462
|
*/
|
|
1441
1463
|
readonly cause: unknown;
|
|
@@ -1443,6 +1465,8 @@ declare class PartialStreamSubmissionError extends Error {
|
|
|
1443
1465
|
cause: unknown;
|
|
1444
1466
|
completedOperations: SubmittedStreamResult['operations'];
|
|
1445
1467
|
acknowledgedOperationCount?: number;
|
|
1468
|
+
lastAcknowledgedRepoSeq?: number;
|
|
1469
|
+
attemptedAppendOutcome: 'not_applied' | 'unknown';
|
|
1446
1470
|
});
|
|
1447
1471
|
}
|
|
1448
1472
|
/**
|
|
@@ -1463,41 +1487,50 @@ declare class AllStreamOperationsFailedError extends Error {
|
|
|
1463
1487
|
* Submit `operations` to the WarmHub stream-append surface, chunked to
|
|
1464
1488
|
* stay under MAX_STREAM_APPEND_OPERATION_COUNT.
|
|
1465
1489
|
*
|
|
1466
|
-
* **Retry policy (default-on, first-chunk + single-op
|
|
1467
|
-
* transport-ambiguous failure (timeout / 5xx / network reset
|
|
1468
|
-
* error) on the first chunk triggers a bounded retry — but
|
|
1469
|
-
* the first chunk contains exactly one operation
|
|
1470
|
-
*
|
|
1490
|
+
* **Retry policy (default-on, first-chunk + single-op + replay-safe
|
|
1491
|
+
* only).** A transport-ambiguous failure (timeout / 5xx / network reset
|
|
1492
|
+
* / no-code error) on the first chunk triggers a bounded retry — but
|
|
1493
|
+
* only when the first chunk contains exactly one operation and that
|
|
1494
|
+
* operation carries a server-enforceable replay fence (see below). The
|
|
1495
|
+
* SDK mints a fresh `streamId`, sleeps with jittered
|
|
1471
1496
|
* exponential backoff, and re-issues the same operation. The retried
|
|
1472
1497
|
* call is observationally indistinguishable from a single clean
|
|
1473
1498
|
* apply — the SDK does not rewrite the request or the response.
|
|
1474
1499
|
*
|
|
1475
|
-
* Multi-op chunks bypass retry entirely
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
* also bypass retry. Both surface
|
|
1480
|
-
*
|
|
1500
|
+
* Multi-op chunks bypass retry entirely. One `stream.append` executes in one
|
|
1501
|
+
* database transaction, but a lost response still leaves its per-operation
|
|
1502
|
+
* result vector and repository sequence unknown. Replaying it could produce
|
|
1503
|
+
* different noops, conflicts, or dependency outcomes. Multi-chunk mid-flight
|
|
1504
|
+
* failures (`acknowledgedOperationCount > 0`) also bypass retry. Both surface
|
|
1505
|
+
* `PartialStreamSubmissionError`; callers must stop writes and reconcile the
|
|
1506
|
+
* attempted append from a later verified checkpoint.
|
|
1507
|
+
*
|
|
1508
|
+
* **Unfenced `revise` never auto-retries.** A `revise` without
|
|
1509
|
+
* `expectedVersion` has no server-side precondition, so a replay could
|
|
1510
|
+
* silently overwrite a concurrent revision (lost update). Its ambiguous
|
|
1511
|
+
* failure surfaces as `PartialStreamSubmissionError` instead, preserving
|
|
1512
|
+
* the stop-and-reconcile guidance. Canonical rationale:
|
|
1513
|
+
* `isReplaySafeOperation` in stream-submit-utils.ts.
|
|
1481
1514
|
*
|
|
1482
1515
|
* Definite client rejections (`UNAUTHENTICATED`, `VALIDATION_ERROR`,
|
|
1483
1516
|
* `CONFLICT`, `RATE_LIMITED`, `ALREADY_RETRACTED`, …) on the first chunk
|
|
1484
1517
|
* still rethrow the raw cause unchanged — they
|
|
1485
1518
|
* are not transient, and structured detail (e.g. `retryAfter` on
|
|
1486
1519
|
* `RATE_LIMITED`) survives. If the caller's original attempt landed but
|
|
1487
|
-
* the response was lost,
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1520
|
+
* the response was lost, a resulting `CONFLICT` (for `add`) or
|
|
1521
|
+
* `ALREADY_RETRACTED` (for `retract`) on the retry does not disprove that the
|
|
1522
|
+
* first attempt landed, so the SDK preserves the ambiguous partial error.
|
|
1490
1523
|
*
|
|
1491
1524
|
* `COMMIT_OUTCOME_UNKNOWN` is terminal but ambiguous: the SDK never
|
|
1492
1525
|
* replays it and surfaces `PartialStreamSubmissionError` with the original
|
|
1493
|
-
* cause so callers must
|
|
1526
|
+
* cause so callers must stop writes and reconcile from a later checkpoint.
|
|
1494
1527
|
*
|
|
1495
1528
|
* **Ambiguity preservation across attempts.** Once any attempt has
|
|
1496
1529
|
* been transport-ambiguous (timeout / 5xx / reset), a subsequent
|
|
1497
1530
|
* definite-reject (e.g. `RATE_LIMITED` on a quota check) does *not*
|
|
1498
1531
|
* prove the prior attempt didn't land. In that case the SDK wraps the
|
|
1499
1532
|
* cause as `PartialStreamSubmissionError` instead of rethrowing raw,
|
|
1500
|
-
* so the
|
|
1533
|
+
* so the stop-and-reconcile warning survives.
|
|
1501
1534
|
*
|
|
1502
1535
|
* **Operation normalization.** `args.operations` accepts the public
|
|
1503
1536
|
* `Operation[]` write contract. The SDK normalizes operations to the
|
|
@@ -1515,8 +1548,9 @@ declare class AllStreamOperationsFailedError extends Error {
|
|
|
1515
1548
|
* `args.skipExisting: true` applies `skipExisting: true` to every
|
|
1516
1549
|
* normalized `add` op. The server then returns `noop` for `add` ops
|
|
1517
1550
|
* whose target already exists. `revise` is naturally idempotent on
|
|
1518
|
-
* equal `dataHash` + `aboutThingId
|
|
1519
|
-
*
|
|
1551
|
+
* equal `dataHash` + `aboutThingId`, but only against an exact replay —
|
|
1552
|
+
* that no-op gate does not make an unfenced `revise` retry-safe (see
|
|
1553
|
+
* above); built-in collection adds dedupe on `dataHash`.
|
|
1520
1554
|
*
|
|
1521
1555
|
* Pass `args.retry: false` to disable retry entirely; pass
|
|
1522
1556
|
* `args.retry: { maxAttempts, baseDelayMs, maxDelayMs }` to override
|
|
@@ -1821,6 +1855,11 @@ interface RetractOp {
|
|
|
1821
1855
|
* Optional human-readable retraction reason.
|
|
1822
1856
|
*/
|
|
1823
1857
|
readonly reason?: string;
|
|
1858
|
+
/**
|
|
1859
|
+
* Optional optimistic-concurrency precondition. When supplied, the retract
|
|
1860
|
+
* is applied only if the target is still at this version number.
|
|
1861
|
+
*/
|
|
1862
|
+
readonly expectedVersion?: number;
|
|
1824
1863
|
/**
|
|
1825
1864
|
* Optional read-lease token (#3625) returned by `thing.getWithLease`. When
|
|
1826
1865
|
* it matches the target's active lease the lease auto-releases on commit;
|
|
@@ -1943,15 +1982,11 @@ declare class OperationBuilder {
|
|
|
1943
1982
|
/**
|
|
1944
1983
|
* Add a retract operation.
|
|
1945
1984
|
*
|
|
1946
|
-
* Pass a wref string shorthand or an object with
|
|
1985
|
+
* Pass a wref string shorthand or an object with retract options such as a
|
|
1986
|
+
* kind safety hint, reason, expected version, or lease ID.
|
|
1947
1987
|
* @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#retract
|
|
1948
1988
|
*/
|
|
1949
|
-
retract(target: string |
|
|
1950
|
-
name: string;
|
|
1951
|
-
kind?: CommitOperationKind;
|
|
1952
|
-
reason?: string;
|
|
1953
|
-
leaseId?: string;
|
|
1954
|
-
}): this;
|
|
1989
|
+
retract(target: string | Omit<RetractOp, 'operation'>): this;
|
|
1955
1990
|
/**
|
|
1956
1991
|
* Return the queued operations.
|
|
1957
1992
|
*
|
|
@@ -2998,6 +3033,7 @@ type LiveRepoEvent = {
|
|
|
2998
3033
|
};
|
|
2999
3034
|
/** @internal */
|
|
3000
3035
|
type ActionListRunsOptions = {
|
|
3036
|
+
runId?: string;
|
|
3001
3037
|
subscriptionName?: string;
|
|
3002
3038
|
status?: 'pending' | 'running' | 'processing' | 'retry_wait' | 'succeeded' | 'suppressed' | 'failed_terminal' | 'dead_letter';
|
|
3003
3039
|
outcome?: 'succeeded' | 'failed';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
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_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall } from './chunk-
|
|
1
|
+
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_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall } from './chunk-CLDVXOJD.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WarmHubClient } from './chunk-
|
|
2
|
-
export { DEFAULT_API_URL, SDK_VERSION, WarmHubClient, WarmHubError, toWarmHubError } from './chunk-
|
|
1
|
+
import { WarmHubClient } from './chunk-CLDVXOJD.js';
|
|
2
|
+
export { DEFAULT_API_URL, SDK_VERSION, WarmHubClient, WarmHubError, toWarmHubError } from './chunk-CLDVXOJD.js';
|
|
3
3
|
import { createContext, useMemo, useState, useEffect, useContext } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
package/package.json
CHANGED