@warmhub/sdk-ts 0.58.0 → 0.60.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.
@@ -2512,6 +2512,14 @@ function toBackendStreamOperation(operation) {
2512
2512
  ...operation.leaseId ? { leaseId: operation.leaseId } : {}
2513
2513
  };
2514
2514
  }
2515
+ if (operation.operation === "rename") {
2516
+ return {
2517
+ operation: "rename",
2518
+ name: operation.name,
2519
+ newName: operation.newName,
2520
+ ...operation.kind ? { kind: operation.kind } : {}
2521
+ };
2522
+ }
2515
2523
  if (operation.operation === "revise") {
2516
2524
  const name = operation.name ?? operation.wref;
2517
2525
  if (!name) {
@@ -2959,7 +2967,7 @@ function toSubmittedStreamResult(writeResult, committer, createdByEmail, message
2959
2967
  operations: results.map((result) => ({
2960
2968
  ...result.opIndex !== void 0 ? { opIndex: result.opIndex } : {},
2961
2969
  name: result.name ?? "",
2962
- operation: result.operation === "revise" || result.operation === "retract" || result.operation === "noop" ? result.operation : "add",
2970
+ operation: result.operation === "revise" || result.operation === "retract" || result.operation === "rename" || result.operation === "noop" ? result.operation : "add",
2963
2971
  dataHash: result.dataHash ?? "",
2964
2972
  version: result.version ?? 0,
2965
2973
  status: streamAppendResultStatus(result),
@@ -3661,7 +3669,7 @@ function validateWarmHubClientOptions(options) {
3661
3669
  throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
3662
3670
  }
3663
3671
  }
3664
- var SDK_VERSION = "0.58.0" ;
3672
+ var SDK_VERSION = "0.60.0" ;
3665
3673
  var DEFAULT_API_URL = "https://api.warmhub.ai";
3666
3674
  var UNBATCHED_TRPC_PATHS = /* @__PURE__ */ new Set([
3667
3675
  "repo.shapeInstanceCounts",
@@ -3729,6 +3737,27 @@ function chunkArray(items, chunkSize) {
3729
3737
  }
3730
3738
  return chunks;
3731
3739
  }
3740
+ function toSubscriptionRef(args) {
3741
+ const [first, repoName, name] = args;
3742
+ return typeof first === "string" ? { orgName: first, repoName, name } : first;
3743
+ }
3744
+ function toSubscriptionListRef(args) {
3745
+ const [first, repoName] = args;
3746
+ return typeof first === "string" ? { orgName: first, repoName } : first;
3747
+ }
3748
+ function toSubscriptionBindRef(args) {
3749
+ const [first, repoName, subscriptionName, credentialSetName] = args;
3750
+ return typeof first === "string" ? {
3751
+ orgName: first,
3752
+ repoName,
3753
+ subscriptionName,
3754
+ credentialSetName
3755
+ } : first;
3756
+ }
3757
+ function toSubscriptionUnbindRef(args) {
3758
+ const [first, repoName, subscriptionName] = args;
3759
+ return typeof first === "string" ? { orgName: first, repoName, subscriptionName } : first;
3760
+ }
3732
3761
  function sanitizeSubscriptionCreateInput(input) {
3733
3762
  const {
3734
3763
  actionContainer: _actionContainer,
@@ -5233,14 +5262,16 @@ var WarmHubClient = class _WarmHubClient {
5233
5262
  },
5234
5263
  /**
5235
5264
  * Get one subscription by name.
5265
+ *
5266
+ * Repo-scoped subscriptions are addressed by `(orgName, repoName, name)`;
5267
+ * org-scoped subscriptions (`org.renamed`) omit `repoName` via the object
5268
+ * form: `get({ orgName, name })`.
5236
5269
  */
5237
- get: async (orgName, repoName, name) => {
5270
+ get: async (...args) => {
5238
5271
  try {
5239
- const result = await this.trpc.subscription.get.query({
5240
- orgName,
5241
- repoName,
5242
- name
5243
- });
5272
+ const result = await this.trpc.subscription.get.query(
5273
+ toSubscriptionRef(args)
5274
+ );
5244
5275
  return normalizeSubscriptionInfo(result);
5245
5276
  } catch (error) {
5246
5277
  throw toWarmHubError(error);
@@ -5256,26 +5287,27 @@ var WarmHubClient = class _WarmHubClient {
5256
5287
  * setup token) may reveal only the subscriptions it is scoped to — a
5257
5288
  * stricter contract than the redacted `get`/`list`, which are unscoped.
5258
5289
  */
5259
- reveal: async (orgName, repoName, name) => {
5290
+ reveal: async (...args) => {
5260
5291
  try {
5261
- return await this.trpc.subscription.reveal.query({
5262
- orgName,
5263
- repoName,
5264
- name
5265
- });
5292
+ return await this.trpc.subscription.reveal.query(
5293
+ toSubscriptionRef(args)
5294
+ );
5266
5295
  } catch (error) {
5267
5296
  throw toWarmHubError(error);
5268
5297
  }
5269
5298
  },
5270
5299
  /**
5271
- * List subscriptions attached to a repository.
5300
+ * List subscriptions in a scope.
5301
+ *
5302
+ * Pass `(orgName, repoName)` to list a repository's subscriptions, or omit
5303
+ * `repoName` — `list(orgName)` or `list({ orgName })` — to list the
5304
+ * org-scoped (`org.renamed`) subscriptions.
5272
5305
  */
5273
- list: async (orgName, repoName) => {
5306
+ list: async (...args) => {
5274
5307
  try {
5275
- const result = await this.trpc.subscription.list.query({
5276
- orgName,
5277
- repoName
5278
- });
5308
+ const result = await this.trpc.subscription.list.query(
5309
+ toSubscriptionListRef(args)
5310
+ );
5279
5311
  return normalizeSubscriptionList(result);
5280
5312
  } catch (error) {
5281
5313
  throw toWarmHubError(error);
@@ -5298,71 +5330,71 @@ var WarmHubClient = class _WarmHubClient {
5298
5330
  },
5299
5331
  /**
5300
5332
  * Pause a subscription.
5333
+ *
5334
+ * Omit `repoName` (object form) to pause an org-scoped subscription.
5301
5335
  */
5302
- pause: async (orgName, repoName, name) => {
5336
+ pause: async (...args) => {
5303
5337
  try {
5304
- return await this.trpc.subscription.pause.mutate({
5305
- orgName,
5306
- repoName,
5307
- name
5308
- });
5338
+ return await this.trpc.subscription.pause.mutate(
5339
+ toSubscriptionRef(args)
5340
+ );
5309
5341
  } catch (error) {
5310
5342
  throw toWarmHubError(error);
5311
5343
  }
5312
5344
  },
5313
5345
  /**
5314
5346
  * Resume a paused subscription.
5347
+ *
5348
+ * Omit `repoName` (object form) to resume an org-scoped subscription.
5315
5349
  */
5316
- resume: async (orgName, repoName, name) => {
5350
+ resume: async (...args) => {
5317
5351
  try {
5318
- return await this.trpc.subscription.resume.mutate({
5319
- orgName,
5320
- repoName,
5321
- name
5322
- });
5352
+ return await this.trpc.subscription.resume.mutate(
5353
+ toSubscriptionRef(args)
5354
+ );
5323
5355
  } catch (error) {
5324
5356
  throw toWarmHubError(error);
5325
5357
  }
5326
5358
  },
5327
5359
  /**
5328
5360
  * Delete a subscription.
5361
+ *
5362
+ * Omit `repoName` (object form) to delete an org-scoped subscription.
5329
5363
  */
5330
- remove: async (orgName, repoName, name) => {
5364
+ remove: async (...args) => {
5331
5365
  try {
5332
- return await this.trpc.subscription.remove.mutate({
5333
- orgName,
5334
- repoName,
5335
- name
5336
- });
5366
+ return await this.trpc.subscription.remove.mutate(
5367
+ toSubscriptionRef(args)
5368
+ );
5337
5369
  } catch (error) {
5338
5370
  throw toWarmHubError(error);
5339
5371
  }
5340
5372
  },
5341
5373
  /**
5342
5374
  * Bind a credential set to a subscription for outbound webhook authentication.
5375
+ *
5376
+ * Omit `repoName` (object form) to bind an org-scoped subscription to one of
5377
+ * the org's org-scoped credential sets.
5343
5378
  */
5344
- bindCredentials: async (orgName, repoName, subscriptionName, credentialSetName) => {
5379
+ bindCredentials: async (...args) => {
5345
5380
  try {
5346
- return await this.trpc.subscription.bindCredentials.mutate({
5347
- orgName,
5348
- repoName,
5349
- subscriptionName,
5350
- credentialSetName
5351
- });
5381
+ return await this.trpc.subscription.bindCredentials.mutate(
5382
+ toSubscriptionBindRef(args)
5383
+ );
5352
5384
  } catch (error) {
5353
5385
  throw toWarmHubError(error);
5354
5386
  }
5355
5387
  },
5356
5388
  /**
5357
5389
  * Remove the credential set currently bound to a subscription.
5390
+ *
5391
+ * Omit `repoName` (object form) for an org-scoped subscription.
5358
5392
  */
5359
- unbindCredentials: async (orgName, repoName, subscriptionName) => {
5393
+ unbindCredentials: async (...args) => {
5360
5394
  try {
5361
- return await this.trpc.subscription.unbindCredentials.mutate({
5362
- orgName,
5363
- repoName,
5364
- subscriptionName
5365
- });
5395
+ return await this.trpc.subscription.unbindCredentials.mutate(
5396
+ toSubscriptionUnbindRef(args)
5397
+ );
5366
5398
  } catch (error) {
5367
5399
  throw toWarmHubError(error);
5368
5400
  }
@@ -5771,7 +5803,7 @@ var WarmHubClient = class _WarmHubClient {
5771
5803
  },
5772
5804
  /**
5773
5805
  * Batched lightweight per-thing change probe — returns
5774
- * `{ wref, durableId, version, active, versionCreatedAt }` per wref with NO
5806
+ * `{ wref, durableId, version, active, revisedOn }` per wref with NO
5775
5807
  * payload. Use it to check whether locally-cached copies are still fresh
5776
5808
  * without pulling `data`: a value is stale if `durableId` differs (the wref
5777
5809
  * now points to a different thing), `version`/`active` differ (the same
@@ -6815,5 +6847,5 @@ function isAbortError(error) {
6815
6847
  }
6816
6848
 
6817
6849
  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 };
6818
- //# sourceMappingURL=chunk-OUMYNKVW.js.map
6819
- //# sourceMappingURL=chunk-OUMYNKVW.js.map
6850
+ //# sourceMappingURL=chunk-E4ZCBSQZ.js.map
6851
+ //# sourceMappingURL=chunk-E4ZCBSQZ.js.map