@postman-cse/onboarding-repo-sync 2.6.2 → 2.6.4

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/action.cjs CHANGED
@@ -138419,8 +138419,8 @@ var PostmanGatewayAssetsClient = class {
138419
138419
  return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
138420
138420
  }
138421
138421
  /**
138422
- * Rebind the sole same-name monitor in this workspace onto the current
138423
- * collection UID.
138422
+ * Replace the sole same-name monitor in this workspace when its collection
138423
+ * UID changed.
138424
138424
  *
138425
138425
  * The canonical Smoke collection can legitimately change UID (a bootstrap
138426
138426
  * re-import after a marker/stranger miss, or an operator rebuild). The
@@ -138428,13 +138428,18 @@ var PostmanGatewayAssetsClient = class {
138428
138428
  * (which requires the full collection+environment+name triple) misses and a
138429
138429
  * second monitor with the same name would be created on every run, orphaning
138430
138430
  * the old one. Name plus environment is the stable identity across a
138431
- * collection re-import, so recover it here instead.
138431
+ * collection re-import, so recover it here instead. Monitoring API does not
138432
+ * allow `collection` in a jobTemplate update body, so replacement is the
138433
+ * supported mutation: create or adopt the desired monitor first, then delete
138434
+ * the stale monitor. This order preserves the existing monitor if creation
138435
+ * fails and never deletes the only usable monitor before its replacement
138436
+ * exists.
138432
138437
  *
138433
138438
  * Returns null when nothing needs rebinding (no same-name monitor, or it is
138434
138439
  * already bound to this collection). Refuses to guess when several same-name
138435
138440
  * monitors match, matching `selectExactMatch` semantics elsewhere.
138436
138441
  */
138437
- async rebindMonitorByName(name, collectionUid, environmentUid) {
138442
+ async rebindMonitorByName(name, collectionUid, environmentUid, cronSchedule) {
138438
138443
  const monitorName = String(name ?? "").trim();
138439
138444
  const collection = String(collectionUid ?? "").trim();
138440
138445
  const environment = String(environmentUid ?? "").trim();
@@ -138466,16 +138471,19 @@ var PostmanGatewayAssetsClient = class {
138466
138471
  if (match.collectionUid === collection) {
138467
138472
  return null;
138468
138473
  }
138469
- await this.gateway.requestJson(
138470
- {
138471
- service: "monitors",
138472
- method: "put",
138473
- path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
138474
- body: { collection }
138475
- },
138476
- { retryTransient: false }
138474
+ const replacementUid = await this.createMonitor(
138475
+ this.workspaceId,
138476
+ monitorName,
138477
+ collection,
138478
+ environment,
138479
+ cronSchedule
138477
138480
  );
138478
- return { uid: match.uid, previousCollectionUid: match.collectionUid };
138481
+ await this.deleteMonitor(match.uid);
138482
+ return {
138483
+ uid: replacementUid,
138484
+ previousUid: match.uid,
138485
+ previousCollectionUid: match.collectionUid
138486
+ };
138479
138487
  }
138480
138488
  async runMonitor(uid) {
138481
138489
  await this.gateway.requestJson(
@@ -141620,35 +141628,25 @@ async function runRepoSyncInner(inputs, dependencies) {
141620
141628
  const rebound = await dependencies.postman.rebindMonitorByName(
141621
141629
  monitorName,
141622
141630
  inputs.smokeCollectionId,
141623
- monitorEnvUid
141631
+ monitorEnvUid,
141632
+ effectiveCron || void 0
141624
141633
  );
141625
141634
  if (rebound) {
141626
141635
  resolvedMonitorId = rebound.uid;
141627
141636
  dependencies.core.info(
141628
- `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
141637
+ `Replaced stale monitor ${rebound.previousUid} ("${monitorName}") from collection ${rebound.previousCollectionUid} with ${rebound.uid} on ${inputs.smokeCollectionId}`
141629
141638
  );
141630
141639
  }
141631
141640
  } catch (error2) {
141632
- if (error2 instanceof AmbiguousMonitorRebindError) {
141633
- throw new Error(
141634
- formatOrchestrationIssue({
141635
- operation: "Monitor rebind",
141636
- entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141637
- cause: error2,
141638
- remediation: monitorRemediation,
141639
- mask
141640
- }),
141641
- { cause: error2 }
141642
- );
141643
- }
141644
- dependencies.core.warning(
141641
+ throw new Error(
141645
141642
  formatOrchestrationIssue({
141646
141643
  operation: "Monitor rebind",
141647
141644
  entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141648
141645
  cause: error2,
141649
141646
  remediation: monitorRemediation,
141650
141647
  mask
141651
- })
141648
+ }),
141649
+ { cause: error2 }
141652
141650
  );
141653
141651
  }
141654
141652
  }
package/dist/cli.cjs CHANGED
@@ -136524,8 +136524,8 @@ var PostmanGatewayAssetsClient = class {
136524
136524
  return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
136525
136525
  }
136526
136526
  /**
136527
- * Rebind the sole same-name monitor in this workspace onto the current
136528
- * collection UID.
136527
+ * Replace the sole same-name monitor in this workspace when its collection
136528
+ * UID changed.
136529
136529
  *
136530
136530
  * The canonical Smoke collection can legitimately change UID (a bootstrap
136531
136531
  * re-import after a marker/stranger miss, or an operator rebuild). The
@@ -136533,13 +136533,18 @@ var PostmanGatewayAssetsClient = class {
136533
136533
  * (which requires the full collection+environment+name triple) misses and a
136534
136534
  * second monitor with the same name would be created on every run, orphaning
136535
136535
  * the old one. Name plus environment is the stable identity across a
136536
- * collection re-import, so recover it here instead.
136536
+ * collection re-import, so recover it here instead. Monitoring API does not
136537
+ * allow `collection` in a jobTemplate update body, so replacement is the
136538
+ * supported mutation: create or adopt the desired monitor first, then delete
136539
+ * the stale monitor. This order preserves the existing monitor if creation
136540
+ * fails and never deletes the only usable monitor before its replacement
136541
+ * exists.
136537
136542
  *
136538
136543
  * Returns null when nothing needs rebinding (no same-name monitor, or it is
136539
136544
  * already bound to this collection). Refuses to guess when several same-name
136540
136545
  * monitors match, matching `selectExactMatch` semantics elsewhere.
136541
136546
  */
136542
- async rebindMonitorByName(name, collectionUid, environmentUid) {
136547
+ async rebindMonitorByName(name, collectionUid, environmentUid, cronSchedule) {
136543
136548
  const monitorName = String(name ?? "").trim();
136544
136549
  const collection = String(collectionUid ?? "").trim();
136545
136550
  const environment = String(environmentUid ?? "").trim();
@@ -136571,16 +136576,19 @@ var PostmanGatewayAssetsClient = class {
136571
136576
  if (match.collectionUid === collection) {
136572
136577
  return null;
136573
136578
  }
136574
- await this.gateway.requestJson(
136575
- {
136576
- service: "monitors",
136577
- method: "put",
136578
- path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
136579
- body: { collection }
136580
- },
136581
- { retryTransient: false }
136579
+ const replacementUid = await this.createMonitor(
136580
+ this.workspaceId,
136581
+ monitorName,
136582
+ collection,
136583
+ environment,
136584
+ cronSchedule
136582
136585
  );
136583
- return { uid: match.uid, previousCollectionUid: match.collectionUid };
136586
+ await this.deleteMonitor(match.uid);
136587
+ return {
136588
+ uid: replacementUid,
136589
+ previousUid: match.uid,
136590
+ previousCollectionUid: match.collectionUid
136591
+ };
136584
136592
  }
136585
136593
  async runMonitor(uid) {
136586
136594
  await this.gateway.requestJson(
@@ -139528,35 +139536,25 @@ async function runRepoSyncInner(inputs, dependencies) {
139528
139536
  const rebound = await dependencies.postman.rebindMonitorByName(
139529
139537
  monitorName,
139530
139538
  inputs.smokeCollectionId,
139531
- monitorEnvUid
139539
+ monitorEnvUid,
139540
+ effectiveCron || void 0
139532
139541
  );
139533
139542
  if (rebound) {
139534
139543
  resolvedMonitorId = rebound.uid;
139535
139544
  dependencies.core.info(
139536
- `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
139545
+ `Replaced stale monitor ${rebound.previousUid} ("${monitorName}") from collection ${rebound.previousCollectionUid} with ${rebound.uid} on ${inputs.smokeCollectionId}`
139537
139546
  );
139538
139547
  }
139539
139548
  } catch (error) {
139540
- if (error instanceof AmbiguousMonitorRebindError) {
139541
- throw new Error(
139542
- formatOrchestrationIssue({
139543
- operation: "Monitor rebind",
139544
- entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139545
- cause: error,
139546
- remediation: monitorRemediation,
139547
- mask
139548
- }),
139549
- { cause: error }
139550
- );
139551
- }
139552
- dependencies.core.warning(
139549
+ throw new Error(
139553
139550
  formatOrchestrationIssue({
139554
139551
  operation: "Monitor rebind",
139555
139552
  entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
139556
139553
  cause: error,
139557
139554
  remediation: monitorRemediation,
139558
139555
  mask
139559
- })
139556
+ }),
139557
+ { cause: error }
139560
139558
  );
139561
139559
  }
139562
139560
  }
package/dist/index.cjs CHANGED
@@ -138442,8 +138442,8 @@ var PostmanGatewayAssetsClient = class {
138442
138442
  return { candidates, nameOnlyMatchCount: nameOnly.length, nameOnlyEnvironments };
138443
138443
  }
138444
138444
  /**
138445
- * Rebind the sole same-name monitor in this workspace onto the current
138446
- * collection UID.
138445
+ * Replace the sole same-name monitor in this workspace when its collection
138446
+ * UID changed.
138447
138447
  *
138448
138448
  * The canonical Smoke collection can legitimately change UID (a bootstrap
138449
138449
  * re-import after a marker/stranger miss, or an operator rebuild). The
@@ -138451,13 +138451,18 @@ var PostmanGatewayAssetsClient = class {
138451
138451
  * (which requires the full collection+environment+name triple) misses and a
138452
138452
  * second monitor with the same name would be created on every run, orphaning
138453
138453
  * the old one. Name plus environment is the stable identity across a
138454
- * collection re-import, so recover it here instead.
138454
+ * collection re-import, so recover it here instead. Monitoring API does not
138455
+ * allow `collection` in a jobTemplate update body, so replacement is the
138456
+ * supported mutation: create or adopt the desired monitor first, then delete
138457
+ * the stale monitor. This order preserves the existing monitor if creation
138458
+ * fails and never deletes the only usable monitor before its replacement
138459
+ * exists.
138455
138460
  *
138456
138461
  * Returns null when nothing needs rebinding (no same-name monitor, or it is
138457
138462
  * already bound to this collection). Refuses to guess when several same-name
138458
138463
  * monitors match, matching `selectExactMatch` semantics elsewhere.
138459
138464
  */
138460
- async rebindMonitorByName(name, collectionUid, environmentUid) {
138465
+ async rebindMonitorByName(name, collectionUid, environmentUid, cronSchedule) {
138461
138466
  const monitorName = String(name ?? "").trim();
138462
138467
  const collection = String(collectionUid ?? "").trim();
138463
138468
  const environment = String(environmentUid ?? "").trim();
@@ -138489,16 +138494,19 @@ var PostmanGatewayAssetsClient = class {
138489
138494
  if (match.collectionUid === collection) {
138490
138495
  return null;
138491
138496
  }
138492
- await this.gateway.requestJson(
138493
- {
138494
- service: "monitors",
138495
- method: "put",
138496
- path: `/jobTemplates/${this.toModelId(match.uid)}?_etc=true`,
138497
- body: { collection }
138498
- },
138499
- { retryTransient: false }
138497
+ const replacementUid = await this.createMonitor(
138498
+ this.workspaceId,
138499
+ monitorName,
138500
+ collection,
138501
+ environment,
138502
+ cronSchedule
138500
138503
  );
138501
- return { uid: match.uid, previousCollectionUid: match.collectionUid };
138504
+ await this.deleteMonitor(match.uid);
138505
+ return {
138506
+ uid: replacementUid,
138507
+ previousUid: match.uid,
138508
+ previousCollectionUid: match.collectionUid
138509
+ };
138502
138510
  }
138503
138511
  async runMonitor(uid) {
138504
138512
  await this.gateway.requestJson(
@@ -141643,35 +141651,25 @@ async function runRepoSyncInner(inputs, dependencies) {
141643
141651
  const rebound = await dependencies.postman.rebindMonitorByName(
141644
141652
  monitorName,
141645
141653
  inputs.smokeCollectionId,
141646
- monitorEnvUid
141654
+ monitorEnvUid,
141655
+ effectiveCron || void 0
141647
141656
  );
141648
141657
  if (rebound) {
141649
141658
  resolvedMonitorId = rebound.uid;
141650
141659
  dependencies.core.info(
141651
- `Rebound existing monitor ${rebound.uid} ("${monitorName}") from collection ${rebound.previousCollectionUid} to ${inputs.smokeCollectionId}`
141660
+ `Replaced stale monitor ${rebound.previousUid} ("${monitorName}") from collection ${rebound.previousCollectionUid} with ${rebound.uid} on ${inputs.smokeCollectionId}`
141652
141661
  );
141653
141662
  }
141654
141663
  } catch (error2) {
141655
- if (error2 instanceof AmbiguousMonitorRebindError) {
141656
- throw new Error(
141657
- formatOrchestrationIssue({
141658
- operation: "Monitor rebind",
141659
- entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141660
- cause: error2,
141661
- remediation: monitorRemediation,
141662
- mask
141663
- }),
141664
- { cause: error2 }
141665
- );
141666
- }
141667
- dependencies.core.warning(
141664
+ throw new Error(
141668
141665
  formatOrchestrationIssue({
141669
141666
  operation: "Monitor rebind",
141670
141667
  entity: `monitor "${monitorName}" workspace ${inputs.workspaceId} collection ${inputs.smokeCollectionId} environment ${monitorEnvUid}`,
141671
141668
  cause: error2,
141672
141669
  remediation: monitorRemediation,
141673
141670
  mask
141674
- })
141671
+ }),
141672
+ { cause: error2 }
141675
141673
  );
141676
141674
  }
141677
141675
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman-cse/onboarding-repo-sync",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "Postman repo sync GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",