@lead-routing/cli 0.1.13 → 0.3.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.
@@ -19,10 +19,20 @@ trigger AccountTrigger on Account (after insert, after update) {
19
19
  }
20
20
  }
21
21
 
22
- if (!insertIds.isEmpty()) {
23
- RoutingEngineCallout.sendAsync('Account', insertIds, 'INSERT');
22
+ for (Integer i = 0; i < insertIds.size(); i += 100) {
23
+ Integer endIdx = Math.min(i + 100, insertIds.size());
24
+ List<Id> chunk = new List<Id>();
25
+ for (Integer j = i; j < endIdx; j++) {
26
+ chunk.add(insertIds[j]);
27
+ }
28
+ RoutingEngineCallout.sendAsync('Account', chunk, 'INSERT');
24
29
  }
25
- if (!updateIds.isEmpty()) {
26
- RoutingEngineCallout.sendAsync('Account', updateIds, 'UPDATE');
30
+ for (Integer i = 0; i < updateIds.size(); i += 100) {
31
+ Integer endIdx = Math.min(i + 100, updateIds.size());
32
+ List<Id> chunk = new List<Id>();
33
+ for (Integer j = i; j < endIdx; j++) {
34
+ chunk.add(updateIds[j]);
35
+ }
36
+ RoutingEngineCallout.sendAsync('Account', chunk, 'UPDATE');
27
37
  }
28
38
  }
@@ -19,10 +19,20 @@ trigger ContactTrigger on Contact (after insert, after update) {
19
19
  }
20
20
  }
21
21
 
22
- if (!insertIds.isEmpty()) {
23
- RoutingEngineCallout.sendAsync('Contact', insertIds, 'INSERT');
22
+ for (Integer i = 0; i < insertIds.size(); i += 100) {
23
+ Integer endIdx = Math.min(i + 100, insertIds.size());
24
+ List<Id> chunk = new List<Id>();
25
+ for (Integer j = i; j < endIdx; j++) {
26
+ chunk.add(insertIds[j]);
27
+ }
28
+ RoutingEngineCallout.sendAsync('Contact', chunk, 'INSERT');
24
29
  }
25
- if (!updateIds.isEmpty()) {
26
- RoutingEngineCallout.sendAsync('Contact', updateIds, 'UPDATE');
30
+ for (Integer i = 0; i < updateIds.size(); i += 100) {
31
+ Integer endIdx = Math.min(i + 100, updateIds.size());
32
+ List<Id> chunk = new List<Id>();
33
+ for (Integer j = i; j < endIdx; j++) {
34
+ chunk.add(updateIds[j]);
35
+ }
36
+ RoutingEngineCallout.sendAsync('Contact', chunk, 'UPDATE');
27
37
  }
28
38
  }
@@ -19,10 +19,22 @@ trigger LeadTrigger on Lead (after insert, after update) {
19
19
  }
20
20
  }
21
21
 
22
- if (!insertIds.isEmpty()) {
23
- RoutingEngineCallout.sendAsync('Lead', insertIds, 'INSERT');
22
+ // Chunk into batches of 100 to stay within Salesforce callout limits
23
+ // (each @future context allows max 100 HTTP callouts)
24
+ for (Integer i = 0; i < insertIds.size(); i += 100) {
25
+ Integer endIdx = Math.min(i + 100, insertIds.size());
26
+ List<Id> chunk = new List<Id>();
27
+ for (Integer j = i; j < endIdx; j++) {
28
+ chunk.add(insertIds[j]);
29
+ }
30
+ RoutingEngineCallout.sendAsync('Lead', chunk, 'INSERT');
24
31
  }
25
- if (!updateIds.isEmpty()) {
26
- RoutingEngineCallout.sendAsync('Lead', updateIds, 'UPDATE');
32
+ for (Integer i = 0; i < updateIds.size(); i += 100) {
33
+ Integer endIdx = Math.min(i + 100, updateIds.size());
34
+ List<Id> chunk = new List<Id>();
35
+ for (Integer j = i; j < endIdx; j++) {
36
+ chunk.add(updateIds[j]);
37
+ }
38
+ RoutingEngineCallout.sendAsync('Lead', chunk, 'UPDATE');
27
39
  }
28
40
  }
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@lead-routing/cli",
3
- "version": "0.1.13",
3
+ "version": "0.3.0",
4
4
  "description": "Self-hosted deployment CLI for Lead Routing",
5
5
  "homepage": "https://github.com/lead-routing/lead-routing",
6
- "keywords": ["salesforce", "lead-routing", "self-hosted", "deployment", "cli"],
6
+ "keywords": [
7
+ "salesforce",
8
+ "lead-routing",
9
+ "self-hosted",
10
+ "deployment",
11
+ "cli"
12
+ ],
7
13
  "type": "module",
8
14
  "bin": {
9
15
  "lead-routing": "./dist/index.js"
@@ -26,14 +32,16 @@
26
32
  ],
27
33
  "dependencies": {
28
34
  "@clack/prompts": "^0.9.1",
35
+ "@prisma/client": "^6.5.0",
36
+ "archiver": "^7.0.1",
29
37
  "chalk": "^5.4.1",
30
38
  "commander": "^13.1.0",
31
39
  "execa": "^9.5.2",
32
40
  "node-ssh": "^13.2.1",
33
- "@prisma/client": "^6.5.0",
34
41
  "prisma": "^6.5.0"
35
42
  },
36
43
  "devDependencies": {
44
+ "@types/archiver": "^7.0.0",
37
45
  "@types/node": "^22.0.0",
38
46
  "tsup": "^8.4.0",
39
47
  "typescript": "^5.9.3"