@warmhub/sdk-ts 0.72.0 → 0.74.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.
|
@@ -385,10 +385,11 @@ function illegalOpSequences(operations, errors, checkAddAdd) {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
// ../rules/src/preflight-operation.ts
|
|
388
|
-
var collectionTypes = ["
|
|
388
|
+
var collectionTypes = ["arc", "bond", "set", "list", "pair"];
|
|
389
|
+
var canonicalCollectionTypes = ["arc", "bond", "set", "list"];
|
|
389
390
|
var collectionOps = ["add", "revise"];
|
|
390
391
|
var COLLECTION_CREATE_REQUIRES_NAME_MESSAGE = "Collection create requires a name. Collections are ordinary named things (ADR 0004).";
|
|
391
|
-
var COLLECTION_ABOUT_REMOVED_MESSAGE = 'about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"
|
|
392
|
+
var COLLECTION_ABOUT_REMOVED_MESSAGE = 'about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';
|
|
392
393
|
function preflightOpDiagnostics(op, operationIndex) {
|
|
393
394
|
const errors = [];
|
|
394
395
|
errors.push(...builtinShapeGuard(op, operationIndex));
|
|
@@ -529,7 +530,7 @@ function validateCollectionOps(op, operationIndex) {
|
|
|
529
530
|
errors.push({
|
|
530
531
|
code: "VALIDATION_ERROR",
|
|
531
532
|
operationIndex,
|
|
532
|
-
message: `Collection "type"
|
|
533
|
+
message: `Collection "type" is invalid. Use one of: ${canonicalCollectionTypes.join(", ")}. Got: "${op.type ?? ""}"`
|
|
533
534
|
});
|
|
534
535
|
}
|
|
535
536
|
if (!op.members || !Array.isArray(op.members)) {
|
|
@@ -566,6 +567,10 @@ function validateCollectionOps(op, operationIndex) {
|
|
|
566
567
|
}
|
|
567
568
|
function collectionArityError(tag, members) {
|
|
568
569
|
switch (tag) {
|
|
570
|
+
case "arc":
|
|
571
|
+
return members.length !== 2 ? `Arc requires exactly 2 members, got ${members.length}` : null;
|
|
572
|
+
case "bond":
|
|
573
|
+
return members.length !== 2 ? `Bond requires exactly 2 members, got ${members.length}` : null;
|
|
569
574
|
case "pair":
|
|
570
575
|
return members.length !== 2 ? `Pair requires exactly 2 members, got ${members.length}` : null;
|
|
571
576
|
case "set":
|
|
@@ -7876,7 +7881,13 @@ function shapeDefinitionPreflightError(name, data, verb) {
|
|
|
7876
7881
|
}
|
|
7877
7882
|
|
|
7878
7883
|
// src/collection-operation-normalize.ts
|
|
7879
|
-
var collectionTypes2 = /* @__PURE__ */ new Set([
|
|
7884
|
+
var collectionTypes2 = /* @__PURE__ */ new Set([
|
|
7885
|
+
"arc",
|
|
7886
|
+
"bond",
|
|
7887
|
+
"pair",
|
|
7888
|
+
"set",
|
|
7889
|
+
"list"
|
|
7890
|
+
]);
|
|
7880
7891
|
function normalizeBackendCollectionAdd(operation, source) {
|
|
7881
7892
|
const normalized = normalizeCollectionWrite(operation, source, "add");
|
|
7882
7893
|
return {
|
|
@@ -7922,7 +7933,7 @@ function normalizeCollectionWrite(operation, source, writeOperation) {
|
|
|
7922
7933
|
const type = normalizeCollectionType(operation.type);
|
|
7923
7934
|
if (!type) {
|
|
7924
7935
|
throw new Error(
|
|
7925
|
-
`${source}: collection ${writeOperation} requires 'type'
|
|
7936
|
+
`${source}: collection ${writeOperation} requires 'type'. Use one of: arc, bond, set, list`
|
|
7926
7937
|
);
|
|
7927
7938
|
}
|
|
7928
7939
|
if (!Array.isArray(operation.members)) {
|
|
@@ -8297,6 +8308,7 @@ async function submitOperationsViaStream(client, args) {
|
|
|
8297
8308
|
const policy = args.streamId !== void 0 ? false : resolveRetryPolicy(args.retry);
|
|
8298
8309
|
let allocatedTokenRanges = [];
|
|
8299
8310
|
let createdByEmail;
|
|
8311
|
+
let repoSeq;
|
|
8300
8312
|
const chunkResults = [];
|
|
8301
8313
|
let sawAmbiguousAttempt = false;
|
|
8302
8314
|
for (const { operations: chunk, start: chunkStart } of chunkOperations(
|
|
@@ -8316,12 +8328,16 @@ async function submitOperationsViaStream(client, args) {
|
|
|
8316
8328
|
componentRef: args.componentRef,
|
|
8317
8329
|
committer: args.committer,
|
|
8318
8330
|
message: args.message,
|
|
8331
|
+
...args.returnRepoSeq !== void 0 ? { returnRepoSeq: args.returnRepoSeq } : {},
|
|
8319
8332
|
operations: chunk
|
|
8320
8333
|
});
|
|
8321
8334
|
allocatedTokenRanges = appendResult.allocatedTokenRanges;
|
|
8322
8335
|
if (appendResult.createdByEmail !== void 0) {
|
|
8323
8336
|
createdByEmail = appendResult.createdByEmail;
|
|
8324
8337
|
}
|
|
8338
|
+
if (appendResult.repoSeq !== void 0) {
|
|
8339
|
+
repoSeq = appendResult.repoSeq;
|
|
8340
|
+
}
|
|
8325
8341
|
chunkResults.push(
|
|
8326
8342
|
...offsetChunkResultIndexes(appendResult.results, chunkStart)
|
|
8327
8343
|
);
|
|
@@ -8346,6 +8362,7 @@ async function submitOperationsViaStream(client, args) {
|
|
|
8346
8362
|
},
|
|
8347
8363
|
args.committer,
|
|
8348
8364
|
createdByEmail,
|
|
8365
|
+
repoSeq,
|
|
8349
8366
|
args.message,
|
|
8350
8367
|
chunkResults,
|
|
8351
8368
|
operations
|
|
@@ -8364,6 +8381,7 @@ async function submitOperationsViaStream(client, args) {
|
|
|
8364
8381
|
},
|
|
8365
8382
|
args.committer,
|
|
8366
8383
|
createdByEmail,
|
|
8384
|
+
repoSeq,
|
|
8367
8385
|
args.message,
|
|
8368
8386
|
chunkResults,
|
|
8369
8387
|
operations
|
|
@@ -8442,16 +8460,18 @@ function offsetChunkResultIndexes(results, chunkStart) {
|
|
|
8442
8460
|
opIndex: chunkStart + (result.opIndex ?? index)
|
|
8443
8461
|
}));
|
|
8444
8462
|
}
|
|
8445
|
-
function toSubmittedStreamResult(writeResult, committer, createdByEmail, message, results, operations) {
|
|
8463
|
+
function toSubmittedStreamResult(writeResult, committer, createdByEmail, repoSeq, message, results, operations) {
|
|
8446
8464
|
const statusCounts = countStreamAppendResultStatuses(results);
|
|
8447
8465
|
const partial = statusCounts.error > 0;
|
|
8466
|
+
const dedupedResults = dedupeDeprecationsByShape(results);
|
|
8448
8467
|
return {
|
|
8449
8468
|
committer,
|
|
8450
8469
|
...createdByEmail !== void 0 ? { createdByEmail } : {},
|
|
8451
8470
|
message,
|
|
8452
8471
|
operationCount: writeResult.operationCount,
|
|
8472
|
+
...repoSeq !== void 0 ? { repoSeq } : {},
|
|
8453
8473
|
...partial ? { partial, statusCounts } : {},
|
|
8454
|
-
operations:
|
|
8474
|
+
operations: dedupedResults.map((result) => ({
|
|
8455
8475
|
...result.opIndex !== void 0 ? { opIndex: result.opIndex } : {},
|
|
8456
8476
|
name: result.name ?? "",
|
|
8457
8477
|
operation: result.operation === "revise" || result.operation === "retract" || result.operation === "rename" || result.operation === "noop" ? result.operation : "add",
|
|
@@ -8466,6 +8486,32 @@ function toSubmittedStreamResult(writeResult, committer, createdByEmail, message
|
|
|
8466
8486
|
}))
|
|
8467
8487
|
};
|
|
8468
8488
|
}
|
|
8489
|
+
function dedupeDeprecationsByShape(results) {
|
|
8490
|
+
if (!results.some(
|
|
8491
|
+
(result) => result.status !== "failed" && result.warnings?.deprecations?.length
|
|
8492
|
+
)) {
|
|
8493
|
+
return results;
|
|
8494
|
+
}
|
|
8495
|
+
const seenShapes = /* @__PURE__ */ new Set();
|
|
8496
|
+
let deduped;
|
|
8497
|
+
for (const [index, result] of results.entries()) {
|
|
8498
|
+
if (result.status === "failed") continue;
|
|
8499
|
+
const operationWarnings = result.warnings;
|
|
8500
|
+
const deprecations = operationWarnings?.deprecations;
|
|
8501
|
+
if (!deprecations) continue;
|
|
8502
|
+
const retained = deprecations.filter((warning) => {
|
|
8503
|
+
if (seenShapes.has(warning.shape)) return false;
|
|
8504
|
+
seenShapes.add(warning.shape);
|
|
8505
|
+
return true;
|
|
8506
|
+
});
|
|
8507
|
+
if (retained.length === deprecations.length) continue;
|
|
8508
|
+
const { deprecations: _deprecations, ...otherWarnings } = operationWarnings;
|
|
8509
|
+
const warnings = retained.length > 0 ? { ...otherWarnings, deprecations: retained } : Object.keys(otherWarnings).length > 0 ? otherWarnings : void 0;
|
|
8510
|
+
deduped ??= [...results];
|
|
8511
|
+
deduped[index] = { ...result, warnings };
|
|
8512
|
+
}
|
|
8513
|
+
return deduped ?? results;
|
|
8514
|
+
}
|
|
8469
8515
|
|
|
8470
8516
|
// src/component-cli.ts
|
|
8471
8517
|
var SUPPORTED_METHODS = /* @__PURE__ */ new Set([
|
|
@@ -9165,6 +9211,7 @@ var OperationBuilder = class {
|
|
|
9165
9211
|
* @param params.committer Optional wref identifying the actor on whose behalf the write is made.
|
|
9166
9212
|
* @param params.chunkSize Maximum operations per stream append.
|
|
9167
9213
|
* @param params.streamId Advanced continuation hook for caller-managed streams.
|
|
9214
|
+
* @param params.returnRepoSeq Return the writer's own repository-sequence acknowledgement.
|
|
9168
9215
|
* @param params.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry.
|
|
9169
9216
|
*/
|
|
9170
9217
|
async commit(params) {
|
|
@@ -9187,6 +9234,7 @@ var OperationBuilder = class {
|
|
|
9187
9234
|
message: params.message,
|
|
9188
9235
|
chunkSize: params.chunkSize,
|
|
9189
9236
|
streamId: params.streamId,
|
|
9237
|
+
returnRepoSeq: params.returnRepoSeq,
|
|
9190
9238
|
retry: params.retry,
|
|
9191
9239
|
operations
|
|
9192
9240
|
});
|
|
@@ -9239,7 +9287,7 @@ function validateWarmHubClientOptions(options) {
|
|
|
9239
9287
|
throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
|
|
9240
9288
|
}
|
|
9241
9289
|
}
|
|
9242
|
-
var SDK_VERSION = "0.
|
|
9290
|
+
var SDK_VERSION = "0.74.0" ;
|
|
9243
9291
|
var DEFAULT_API_URL = "https://api.warmhub.ai";
|
|
9244
9292
|
var UNBATCHED_TRPC_PATHS = /* @__PURE__ */ new Set([
|
|
9245
9293
|
"repo.shapeInstanceCounts",
|
|
@@ -9371,7 +9419,7 @@ function hasExplicitCollectionMembers(opts) {
|
|
|
9371
9419
|
function collectionTypeFromWref(wref) {
|
|
9372
9420
|
const local = wref.replace(/^wh:[^/]+\/[^/]+\//, "").replace(/@(?:HEAD|ALL|v\d+)$/, "");
|
|
9373
9421
|
const shape = local.split("/")[0]?.toLowerCase();
|
|
9374
|
-
return shape === "pair" || shape === "set" || shape === "list" ? shape : void 0;
|
|
9422
|
+
return shape === "arc" || shape === "bond" || shape === "pair" || shape === "set" || shape === "list" ? shape : void 0;
|
|
9375
9423
|
}
|
|
9376
9424
|
function assertSelectorBackedCollectionType(type, opts) {
|
|
9377
9425
|
if (hasCollectionQuerySource(opts.query) && !hasCollectionSelectorAnchor(opts.query)) {
|
|
@@ -10082,6 +10130,10 @@ var WarmHubClient = class _WarmHubClient {
|
|
|
10082
10130
|
* @param opts.chunkSize Maximum operations per stream append. Values are clamped by the SDK.
|
|
10083
10131
|
* @param opts.skipExisting Return `noop` for add operations whose target already exists.
|
|
10084
10132
|
* @param opts.streamId Advanced continuation hook for caller-managed streams.
|
|
10133
|
+
* @param opts.returnRepoSeq Return the sequence allocated to the writer's
|
|
10134
|
+
* own commit acknowledgement. This does not disclose a reader-facing
|
|
10135
|
+
* repository head. Multi-chunk submissions return the last sequence
|
|
10136
|
+
* actually allocated; a later no-op or failed chunk does not erase it.
|
|
10085
10137
|
* @param opts.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry.
|
|
10086
10138
|
*/
|
|
10087
10139
|
apply: async (orgName, repoName, message, operations, opts) => {
|
|
@@ -10095,6 +10147,7 @@ var WarmHubClient = class _WarmHubClient {
|
|
|
10095
10147
|
chunkSize: opts?.chunkSize,
|
|
10096
10148
|
skipExisting: opts?.skipExisting,
|
|
10097
10149
|
streamId: opts?.streamId,
|
|
10150
|
+
returnRepoSeq: opts?.returnRepoSeq,
|
|
10098
10151
|
retry: opts?.retry,
|
|
10099
10152
|
operations
|
|
10100
10153
|
});
|
|
@@ -11871,6 +11924,7 @@ var WarmHubClient = class _WarmHubClient {
|
|
|
11871
11924
|
includeRetracted: opts?.includeRetracted,
|
|
11872
11925
|
depth: opts?.depth,
|
|
11873
11926
|
resolveCollections: opts?.resolveCollections,
|
|
11927
|
+
role: opts?.role,
|
|
11874
11928
|
limit: opts?.limit,
|
|
11875
11929
|
cursor: opts?.cursor,
|
|
11876
11930
|
where: opts?.where
|
|
@@ -11940,6 +11994,7 @@ var WarmHubClient = class _WarmHubClient {
|
|
|
11940
11994
|
match: opts?.match,
|
|
11941
11995
|
includeRetracted: opts?.includeRetracted,
|
|
11942
11996
|
resolveCollections: opts?.resolveCollections,
|
|
11997
|
+
role: opts?.role,
|
|
11943
11998
|
limit: opts?.limit,
|
|
11944
11999
|
cursor: opts?.cursor,
|
|
11945
12000
|
componentRef: opts?.componentRef,
|
|
@@ -12805,5 +12860,5 @@ re2js/build/index.js:
|
|
|
12805
12860
|
*/
|
|
12806
12861
|
|
|
12807
12862
|
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 };
|
|
12808
|
-
//# sourceMappingURL=chunk-
|
|
12809
|
-
//# sourceMappingURL=chunk-
|
|
12863
|
+
//# sourceMappingURL=chunk-AFP7ZGMR.js.map
|
|
12864
|
+
//# sourceMappingURL=chunk-AFP7ZGMR.js.map
|