@warmhub/sdk-ts 0.58.0 → 0.59.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.
@@ -3661,7 +3661,7 @@ function validateWarmHubClientOptions(options) {
3661
3661
  throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
3662
3662
  }
3663
3663
  }
3664
- var SDK_VERSION = "0.58.0" ;
3664
+ var SDK_VERSION = "0.59.0" ;
3665
3665
  var DEFAULT_API_URL = "https://api.warmhub.ai";
3666
3666
  var UNBATCHED_TRPC_PATHS = /* @__PURE__ */ new Set([
3667
3667
  "repo.shapeInstanceCounts",
@@ -3729,6 +3729,27 @@ function chunkArray(items, chunkSize) {
3729
3729
  }
3730
3730
  return chunks;
3731
3731
  }
3732
+ function toSubscriptionRef(args) {
3733
+ const [first, repoName, name] = args;
3734
+ return typeof first === "string" ? { orgName: first, repoName, name } : first;
3735
+ }
3736
+ function toSubscriptionListRef(args) {
3737
+ const [first, repoName] = args;
3738
+ return typeof first === "string" ? { orgName: first, repoName } : first;
3739
+ }
3740
+ function toSubscriptionBindRef(args) {
3741
+ const [first, repoName, subscriptionName, credentialSetName] = args;
3742
+ return typeof first === "string" ? {
3743
+ orgName: first,
3744
+ repoName,
3745
+ subscriptionName,
3746
+ credentialSetName
3747
+ } : first;
3748
+ }
3749
+ function toSubscriptionUnbindRef(args) {
3750
+ const [first, repoName, subscriptionName] = args;
3751
+ return typeof first === "string" ? { orgName: first, repoName, subscriptionName } : first;
3752
+ }
3732
3753
  function sanitizeSubscriptionCreateInput(input) {
3733
3754
  const {
3734
3755
  actionContainer: _actionContainer,
@@ -5233,14 +5254,16 @@ var WarmHubClient = class _WarmHubClient {
5233
5254
  },
5234
5255
  /**
5235
5256
  * Get one subscription by name.
5257
+ *
5258
+ * Repo-scoped subscriptions are addressed by `(orgName, repoName, name)`;
5259
+ * org-scoped subscriptions (`org.renamed`) omit `repoName` via the object
5260
+ * form: `get({ orgName, name })`.
5236
5261
  */
5237
- get: async (orgName, repoName, name) => {
5262
+ get: async (...args) => {
5238
5263
  try {
5239
- const result = await this.trpc.subscription.get.query({
5240
- orgName,
5241
- repoName,
5242
- name
5243
- });
5264
+ const result = await this.trpc.subscription.get.query(
5265
+ toSubscriptionRef(args)
5266
+ );
5244
5267
  return normalizeSubscriptionInfo(result);
5245
5268
  } catch (error) {
5246
5269
  throw toWarmHubError(error);
@@ -5256,26 +5279,27 @@ var WarmHubClient = class _WarmHubClient {
5256
5279
  * setup token) may reveal only the subscriptions it is scoped to — a
5257
5280
  * stricter contract than the redacted `get`/`list`, which are unscoped.
5258
5281
  */
5259
- reveal: async (orgName, repoName, name) => {
5282
+ reveal: async (...args) => {
5260
5283
  try {
5261
- return await this.trpc.subscription.reveal.query({
5262
- orgName,
5263
- repoName,
5264
- name
5265
- });
5284
+ return await this.trpc.subscription.reveal.query(
5285
+ toSubscriptionRef(args)
5286
+ );
5266
5287
  } catch (error) {
5267
5288
  throw toWarmHubError(error);
5268
5289
  }
5269
5290
  },
5270
5291
  /**
5271
- * List subscriptions attached to a repository.
5292
+ * List subscriptions in a scope.
5293
+ *
5294
+ * Pass `(orgName, repoName)` to list a repository's subscriptions, or omit
5295
+ * `repoName` — `list(orgName)` or `list({ orgName })` — to list the
5296
+ * org-scoped (`org.renamed`) subscriptions.
5272
5297
  */
5273
- list: async (orgName, repoName) => {
5298
+ list: async (...args) => {
5274
5299
  try {
5275
- const result = await this.trpc.subscription.list.query({
5276
- orgName,
5277
- repoName
5278
- });
5300
+ const result = await this.trpc.subscription.list.query(
5301
+ toSubscriptionListRef(args)
5302
+ );
5279
5303
  return normalizeSubscriptionList(result);
5280
5304
  } catch (error) {
5281
5305
  throw toWarmHubError(error);
@@ -5298,71 +5322,71 @@ var WarmHubClient = class _WarmHubClient {
5298
5322
  },
5299
5323
  /**
5300
5324
  * Pause a subscription.
5325
+ *
5326
+ * Omit `repoName` (object form) to pause an org-scoped subscription.
5301
5327
  */
5302
- pause: async (orgName, repoName, name) => {
5328
+ pause: async (...args) => {
5303
5329
  try {
5304
- return await this.trpc.subscription.pause.mutate({
5305
- orgName,
5306
- repoName,
5307
- name
5308
- });
5330
+ return await this.trpc.subscription.pause.mutate(
5331
+ toSubscriptionRef(args)
5332
+ );
5309
5333
  } catch (error) {
5310
5334
  throw toWarmHubError(error);
5311
5335
  }
5312
5336
  },
5313
5337
  /**
5314
5338
  * Resume a paused subscription.
5339
+ *
5340
+ * Omit `repoName` (object form) to resume an org-scoped subscription.
5315
5341
  */
5316
- resume: async (orgName, repoName, name) => {
5342
+ resume: async (...args) => {
5317
5343
  try {
5318
- return await this.trpc.subscription.resume.mutate({
5319
- orgName,
5320
- repoName,
5321
- name
5322
- });
5344
+ return await this.trpc.subscription.resume.mutate(
5345
+ toSubscriptionRef(args)
5346
+ );
5323
5347
  } catch (error) {
5324
5348
  throw toWarmHubError(error);
5325
5349
  }
5326
5350
  },
5327
5351
  /**
5328
5352
  * Delete a subscription.
5353
+ *
5354
+ * Omit `repoName` (object form) to delete an org-scoped subscription.
5329
5355
  */
5330
- remove: async (orgName, repoName, name) => {
5356
+ remove: async (...args) => {
5331
5357
  try {
5332
- return await this.trpc.subscription.remove.mutate({
5333
- orgName,
5334
- repoName,
5335
- name
5336
- });
5358
+ return await this.trpc.subscription.remove.mutate(
5359
+ toSubscriptionRef(args)
5360
+ );
5337
5361
  } catch (error) {
5338
5362
  throw toWarmHubError(error);
5339
5363
  }
5340
5364
  },
5341
5365
  /**
5342
5366
  * Bind a credential set to a subscription for outbound webhook authentication.
5367
+ *
5368
+ * Omit `repoName` (object form) to bind an org-scoped subscription to one of
5369
+ * the org's org-scoped credential sets.
5343
5370
  */
5344
- bindCredentials: async (orgName, repoName, subscriptionName, credentialSetName) => {
5371
+ bindCredentials: async (...args) => {
5345
5372
  try {
5346
- return await this.trpc.subscription.bindCredentials.mutate({
5347
- orgName,
5348
- repoName,
5349
- subscriptionName,
5350
- credentialSetName
5351
- });
5373
+ return await this.trpc.subscription.bindCredentials.mutate(
5374
+ toSubscriptionBindRef(args)
5375
+ );
5352
5376
  } catch (error) {
5353
5377
  throw toWarmHubError(error);
5354
5378
  }
5355
5379
  },
5356
5380
  /**
5357
5381
  * Remove the credential set currently bound to a subscription.
5382
+ *
5383
+ * Omit `repoName` (object form) for an org-scoped subscription.
5358
5384
  */
5359
- unbindCredentials: async (orgName, repoName, subscriptionName) => {
5385
+ unbindCredentials: async (...args) => {
5360
5386
  try {
5361
- return await this.trpc.subscription.unbindCredentials.mutate({
5362
- orgName,
5363
- repoName,
5364
- subscriptionName
5365
- });
5387
+ return await this.trpc.subscription.unbindCredentials.mutate(
5388
+ toSubscriptionUnbindRef(args)
5389
+ );
5366
5390
  } catch (error) {
5367
5391
  throw toWarmHubError(error);
5368
5392
  }
@@ -6815,5 +6839,5 @@ function isAbortError(error) {
6815
6839
  }
6816
6840
 
6817
6841
  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
6842
+ //# sourceMappingURL=chunk-ZXAWTFKV.js.map
6843
+ //# sourceMappingURL=chunk-ZXAWTFKV.js.map