@warmhub/sdk-ts 0.78.0 → 0.79.1

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.
@@ -32,11 +32,16 @@ var isStoredContentName = (n) => STORED_CONTENT_NAMES.includes(n);
32
32
  var isSynthesizedContentName = (n) => SYNTHESIZED_CONTENT_NAMES.includes(n);
33
33
  var BUILTIN_VIEW_SHAPE_NAMES = ["View"];
34
34
  var isViewShape = (name) => BUILTIN_VIEW_SHAPE_NAMES.includes(name);
35
+ var BUILTIN_LICENSE_SHAPE_NAMES = [
36
+ "LicenseSubject",
37
+ "LicenseDeclaration"
38
+ ];
39
+ var isLicenseShape = (name) => BUILTIN_LICENSE_SHAPE_NAMES.includes(name);
35
40
  function isRenameableSquattedShape(name) {
36
- return isReservedCollectionShape(name) || isViewShape(name);
41
+ return isReservedCollectionShape(name) || isViewShape(name) || isLicenseShape(name);
37
42
  }
38
43
  function isBuiltinShape(name) {
39
- return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name) || BUILTIN_VIEW_SHAPE_NAMES.includes(name);
44
+ return BUILTIN_SHAPE_NAMES.includes(name) || BUILTIN_CONTENT_SHAPE_NAMES.includes(name) || BUILTIN_VIEW_SHAPE_NAMES.includes(name) || BUILTIN_LICENSE_SHAPE_NAMES.includes(name);
40
45
  }
41
46
 
42
47
  // ../rules/src/client-header.ts
@@ -6767,10 +6772,13 @@ function hasAnyTokens(s) {
6767
6772
  // ../rules/src/preflight-commit.ts
6768
6773
  function preflightCommitDiagnostics(operations, options) {
6769
6774
  const errors = [];
6770
- rejectCommitTokenSyntax(operations, errors);
6771
- illegalOpSequences(operations, errors, options?.checkAddAdd ?? true);
6775
+ rejectCommitTokenSyntax(operations, errors, options);
6776
+ illegalOpSequences(operations, errors, options?.checkAddAdd ?? true, options);
6772
6777
  return errors;
6773
6778
  }
6779
+ function sourceOperationIndex(filteredIndex, options) {
6780
+ return options?.sourceOperationIndexes?.[filteredIndex] ?? filteredIndex;
6781
+ }
6774
6782
  function getOpName(op) {
6775
6783
  return op.name;
6776
6784
  }
@@ -6784,7 +6792,7 @@ function tokenStringFields(op) {
6784
6792
  }
6785
6793
  return fields;
6786
6794
  }
6787
- function rejectCommitTokenSyntax(operations, errors) {
6795
+ function rejectCommitTokenSyntax(operations, errors, options) {
6788
6796
  for (let i = 0; i < operations.length; i++) {
6789
6797
  const op = operations[i];
6790
6798
  if (!op) continue;
@@ -6792,7 +6800,7 @@ function rejectCommitTokenSyntax(operations, errors) {
6792
6800
  if (field && hasAnyTokens(field)) {
6793
6801
  errors.push({
6794
6802
  code: "COMMIT_TOKEN_SYNTAX_REMOVED",
6795
- operationIndex: i,
6803
+ operationIndex: sourceOperationIndex(i, options),
6796
6804
  message: COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE
6797
6805
  });
6798
6806
  break;
@@ -6800,7 +6808,7 @@ function rejectCommitTokenSyntax(operations, errors) {
6800
6808
  }
6801
6809
  }
6802
6810
  }
6803
- function illegalOpSequences(operations, errors, checkAddAdd) {
6811
+ function illegalOpSequences(operations, errors, checkAddAdd, options) {
6804
6812
  const opHistory = /* @__PURE__ */ new Map();
6805
6813
  for (let i = 0; i < operations.length; i++) {
6806
6814
  const op = operations[i];
@@ -6811,7 +6819,10 @@ function illegalOpSequences(operations, errors, checkAddAdd) {
6811
6819
  const kind = inferOperationKind({ ...op, name });
6812
6820
  const qualName = kind === "shape" ? `shape:${name}` : `thing:${name}`;
6813
6821
  const history = opHistory.get(qualName) ?? [];
6814
- history.push({ operation: op.operation, index: i });
6822
+ history.push({
6823
+ operation: op.operation,
6824
+ index: sourceOperationIndex(i, options)
6825
+ });
6815
6826
  opHistory.set(qualName, history);
6816
6827
  }
6817
6828
  for (const [qualName, history] of opHistory) {
@@ -8552,7 +8563,7 @@ var SDK_DEVELOPMENT_VERSION = "0.0.0-development";
8552
8563
  function sdkVersionIsDevelopment(version) {
8553
8564
  return version === SDK_DEVELOPMENT_VERSION;
8554
8565
  }
8555
- var SDK_VERSION = "0.78.0" ;
8566
+ var SDK_VERSION = "0.79.1" ;
8556
8567
 
8557
8568
  // src/component-cli.ts
8558
8569
  var SUPPORTED_METHODS = /* @__PURE__ */ new Set([
@@ -9213,19 +9224,38 @@ var OperationBuilder = class {
9213
9224
  message: diagnostic.message
9214
9225
  });
9215
9226
  }
9216
- const preflightOps = this.ops.filter((op) => op.operation !== "retract").map((op) => {
9227
+ const preflightEntries = this.ops.flatMap((op, operationIndex) => {
9228
+ if (op.operation === "retract") {
9229
+ return [];
9230
+ }
9217
9231
  if (op.operation === "add") {
9218
- return toPreflightOp(op, normalizeAddKind(op));
9232
+ return [
9233
+ {
9234
+ op: toPreflightOp(op, normalizeAddKind(op)),
9235
+ operationIndex
9236
+ }
9237
+ ];
9219
9238
  }
9220
9239
  const target = op.name ?? op.wref;
9221
- return toPreflightOp(
9222
- op,
9223
- target ? normalizeReviseKind(op, target) : "thing"
9224
- );
9225
- });
9226
- const diagnostics = preflightCommitDiagnostics2(preflightOps, {
9227
- checkAddAdd: false
9240
+ return [
9241
+ {
9242
+ op: toPreflightOp(
9243
+ op,
9244
+ target ? normalizeReviseKind(op, target) : "thing"
9245
+ ),
9246
+ operationIndex
9247
+ }
9248
+ ];
9228
9249
  });
9250
+ const diagnostics = preflightCommitDiagnostics2(
9251
+ preflightEntries.map(({ op }) => op),
9252
+ {
9253
+ checkAddAdd: false,
9254
+ sourceOperationIndexes: preflightEntries.map(
9255
+ ({ operationIndex }) => operationIndex
9256
+ )
9257
+ }
9258
+ );
9229
9259
  for (const diagnostic of diagnostics) {
9230
9260
  errors.push({
9231
9261
  code: diagnostic.code,
@@ -9251,7 +9281,7 @@ var OperationBuilder = class {
9251
9281
  * @param params.message Optional commit message.
9252
9282
  * @param params.committer Optional wref identifying the actor on whose behalf the write is made.
9253
9283
  * @param params.chunkSize Maximum operations per stream append.
9254
- * @param params.streamId Advanced continuation hook for caller-managed streams.
9284
+ * @param params.streamId Caller-managed stream identity for observability and diagnostic correlation.
9255
9285
  * @param params.returnRepoSeq Return the writer's own repository-sequence acknowledgement.
9256
9286
  * @param params.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry.
9257
9287
  */
@@ -10175,7 +10205,7 @@ var WarmHubClient = class _WarmHubClient {
10175
10205
  * @param opts.componentRef Attribute writes to an installed component, identified by its `Org/Name` ref, when the caller is allowed to claim it.
10176
10206
  * @param opts.chunkSize Maximum operations per stream append. Values are clamped by the SDK.
10177
10207
  * @param opts.skipExisting Return `noop` for add operations whose target already exists.
10178
- * @param opts.streamId Advanced continuation hook for caller-managed streams.
10208
+ * @param opts.streamId Caller-managed stream identity for observability and diagnostic correlation.
10179
10209
  * @param opts.returnRepoSeq Return the sequence allocated to the writer's
10180
10210
  * own commit acknowledgement. This does not disclose a reader-facing
10181
10211
  * repository head. Multi-chunk submissions return the last sequence
@@ -10838,6 +10868,37 @@ var WarmHubClient = class _WarmHubClient {
10838
10868
  throw toWarmHubError(error);
10839
10869
  }
10840
10870
  },
10871
+ /**
10872
+ * Fetch the repository's normalized license declaration.
10873
+ *
10874
+ * Returns `null` when no valid active declaration is visible to the caller.
10875
+ */
10876
+ getLicense: async (orgName, repoName) => {
10877
+ try {
10878
+ return await this.trpc.repo.getLicense.query({
10879
+ orgName,
10880
+ repoName
10881
+ });
10882
+ } catch (error) {
10883
+ throw toWarmHubError(error);
10884
+ }
10885
+ },
10886
+ /**
10887
+ * Return the repository's aggregate describe model.
10888
+ *
10889
+ * The aggregate includes subscription metadata and therefore retains the
10890
+ * backend's `subscriptions:read` authorization requirement.
10891
+ */
10892
+ describe: async (orgName, repoName) => {
10893
+ try {
10894
+ return await this.trpc.repo.describe.query({
10895
+ orgName,
10896
+ repoName
10897
+ });
10898
+ } catch (error) {
10899
+ throw toWarmHubError(error);
10900
+ }
10901
+ },
10841
10902
  /**
10842
10903
  * Commit a new `Content/Readme` value.
10843
10904
  *
@@ -12919,5 +12980,5 @@ re2js/build/index.js:
12919
12980
  */
12920
12981
 
12921
12982
  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 };
12922
- //# sourceMappingURL=chunk-27SITT67.js.map
12923
- //# sourceMappingURL=chunk-27SITT67.js.map
12983
+ //# sourceMappingURL=chunk-54YQD67L.js.map
12984
+ //# sourceMappingURL=chunk-54YQD67L.js.map