@inforge/migrations-tools-cli 1.2.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -33
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -508,43 +508,24 @@ var TriggersHandler = class {
508
508
  triggerNames,
509
509
  status
510
510
  });
511
- const query = `
512
- SELECT Id, Name
513
- FROM ApexTrigger
514
- WHERE Name IN (${triggerNames.map((n) => `'${n}'`).join(", ")})
515
- `;
516
- await this.logger.debug("Executing Tooling API query", { query });
517
511
  try {
518
- const result = await connection.tooling.query(query);
519
- await this.logger.debug("Query result", {
520
- recordCount: result.records.length,
521
- records: result.records
522
- });
523
- if (result.records.length === 0) {
524
- await this.logger.error("No triggers found with specified names", null, {
525
- triggerNames,
526
- query
527
- });
528
- throw new Error("No triggers found with the specified names");
529
- }
530
- const updates = result.records.map((trigger) => ({
531
- Id: trigger.Id,
532
- Status: status
512
+ const updates = triggerNames.map((name) => ({
513
+ fullName: name,
514
+ status
533
515
  }));
534
- await this.logger.debug("Preparing Tooling API update", { updates });
535
- const results = await connection.tooling.update("ApexTrigger", updates);
536
- await this.logger.debug("Tooling API update results", {
516
+ await this.logger.debug("Preparing Metadata API update", { updates });
517
+ const results = await connection.metadata.update("ApexTrigger", updates);
518
+ await this.logger.debug("Metadata API update results", {
537
519
  results: Array.isArray(results) ? results : [results]
538
520
  });
539
- if (Array.isArray(results)) {
540
- const failures = results.filter((r) => !r.success);
541
- if (failures.length > 0) {
542
- await this.logger.error("Some triggers failed to update", null, {
543
- failures,
544
- totalAttempted: results.length
545
- });
546
- throw new Error(`Failed to update ${failures.length} trigger(s): ${JSON.stringify(failures)}`);
547
- }
521
+ const resultArray = Array.isArray(results) ? results : [results];
522
+ const failures = resultArray.filter((r) => !r.success);
523
+ if (failures.length > 0) {
524
+ await this.logger.error("Some triggers failed to update", null, {
525
+ failures,
526
+ totalAttempted: resultArray.length
527
+ });
528
+ throw new Error(`Failed to update ${failures.length} trigger(s): ${JSON.stringify(failures)}`);
548
529
  }
549
530
  await this.logger.info("Successfully updated trigger status", {
550
531
  triggerCount: triggerNames.length,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inforge/migrations-tools-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Inforge's interactive CLI for side-effect-free Salesforce data operations by managing automation",
5
5
  "main": "index.js",
6
6
  "type": "module",