@pliancy/salesforce-cpq-sdk 1.13.0 → 2.0.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.
- package/dist/lib/quotes/quotes.d.ts +16 -1
- package/dist/lib/quotes/quotes.js +21 -3
- package/package.json +9 -9
|
@@ -12,6 +12,21 @@ export declare class Quotes {
|
|
|
12
12
|
update(quoteId: string, query: Partial<Omit<Quote, 'Id'>>): Promise<SaveResult>;
|
|
13
13
|
updateLineItemQuantities(lineItems: UpdateQuoteLine[]): Promise<SaveResult[]>;
|
|
14
14
|
order(quoteId: string, options?: UpdateQuoteQuery): Promise<SaveResult>;
|
|
15
|
-
|
|
15
|
+
submitAndApprove(quoteId: string, comments?: string): Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
workItemId: any;
|
|
18
|
+
errors?: undefined;
|
|
19
|
+
error?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
success: boolean;
|
|
22
|
+
errors: any;
|
|
23
|
+
workItemId?: undefined;
|
|
24
|
+
error?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
success: boolean;
|
|
27
|
+
error: any;
|
|
28
|
+
workItemId?: undefined;
|
|
29
|
+
errors?: undefined;
|
|
30
|
+
}>;
|
|
16
31
|
private buildQuery;
|
|
17
32
|
}
|
|
@@ -66,9 +66,27 @@ class Quotes {
|
|
|
66
66
|
const query = this.buildQuery({ Id: quoteId, SBQQ__Ordered__c: true }, options);
|
|
67
67
|
return this.client.update(query);
|
|
68
68
|
}
|
|
69
|
-
async
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
async submitAndApprove(quoteId, comments = '') {
|
|
70
|
+
try {
|
|
71
|
+
const { ApprovalProcess } = require('jsforce/lib/process');
|
|
72
|
+
const approvalProcess = new ApprovalProcess(this.connection);
|
|
73
|
+
const submission = (await approvalProcess.submit(quoteId, comments, {
|
|
74
|
+
skipEntryCriteria: true,
|
|
75
|
+
}));
|
|
76
|
+
if (submission.success) {
|
|
77
|
+
const workItemId = submission === null || submission === void 0 ? void 0 : submission.newWorkItemIds[0];
|
|
78
|
+
if (!workItemId)
|
|
79
|
+
return { success: false, errors: ['No workItemId returned'] };
|
|
80
|
+
await approvalProcess.approve(workItemId);
|
|
81
|
+
return { success: true, workItemId };
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return { success: false, errors: submission.errors };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return { success: false, error: error.message };
|
|
89
|
+
}
|
|
72
90
|
}
|
|
73
91
|
buildQuery(base, options) {
|
|
74
92
|
const query = { ...base };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pliancy/salesforce-cpq-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Salesforce CPQ SDK for Node.js",
|
|
7
7
|
"private": false,
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"jsforce": "3.
|
|
9
|
+
"jsforce": "3.6.3",
|
|
10
10
|
"tslib": "2.6.2"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"@digitalroute/cz-conventional-changelog-for-jira": "8.0.1",
|
|
21
21
|
"@pliancy/eslint-config-ts": "1.1.1",
|
|
22
22
|
"@pliancy/semantic-release-config-npm": "2.2.0",
|
|
23
|
-
"@types/jest": "29.5.
|
|
24
|
-
"@types/node": "22.
|
|
25
|
-
"commitizen": "4.3.
|
|
23
|
+
"@types/jest": "29.5.14",
|
|
24
|
+
"@types/node": "22.10.2",
|
|
25
|
+
"commitizen": "4.3.1",
|
|
26
26
|
"cz-conventional-changelog": "3.3.0",
|
|
27
|
-
"husky": "9.1.
|
|
27
|
+
"husky": "9.1.7",
|
|
28
28
|
"jest": "29.7.0",
|
|
29
|
-
"npm-run-all2": "
|
|
29
|
+
"npm-run-all2": "7.0.2",
|
|
30
30
|
"pinst": "3.0.0",
|
|
31
31
|
"rimraf": "6.0.1",
|
|
32
32
|
"ts-jest": "29.2.5",
|
|
33
|
-
"typescript": "5.
|
|
33
|
+
"typescript": "5.7.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "run-s -l clean test tsc",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"email": "justin.mcmahon@pliancy.com"
|
|
54
54
|
},
|
|
55
55
|
"volta": {
|
|
56
|
-
"node": "22.
|
|
56
|
+
"node": "22.12.0",
|
|
57
57
|
"yarn": "1.22.21"
|
|
58
58
|
},
|
|
59
59
|
"config": {
|