@pliancy/salesforce-cpq-sdk 1.0.0 → 1.1.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.
|
@@ -5,6 +5,9 @@ export declare class Accounts {
|
|
|
5
5
|
private readonly connection;
|
|
6
6
|
private readonly client;
|
|
7
7
|
constructor(connection: Connection);
|
|
8
|
+
getAll(): Promise<({
|
|
9
|
+
[name: string]: import("jsforce").SObjectFieldType | null;
|
|
10
|
+
} & import("jsforce").Record)[]>;
|
|
8
11
|
getById(id: string): Promise<Account | null>;
|
|
9
12
|
getByCustomField(field: string, value: string): Promise<(Account & CustomFieldQuery<Account>) | null>;
|
|
10
13
|
}
|
|
@@ -6,6 +6,9 @@ class Accounts {
|
|
|
6
6
|
this.connection = connection;
|
|
7
7
|
this.client = this.connection.sobject('Account');
|
|
8
8
|
}
|
|
9
|
+
async getAll() {
|
|
10
|
+
return this.client.find({ Type: 'Customer', IsDeleted: false });
|
|
11
|
+
}
|
|
9
12
|
async getById(id) {
|
|
10
13
|
return this.client.findOne({ Id: id });
|
|
11
14
|
}
|
package/dist/lib/cpq.js
CHANGED
|
@@ -11,10 +11,7 @@ const orders_1 = require("./orders/orders");
|
|
|
11
11
|
class Cpq {
|
|
12
12
|
constructor(config) {
|
|
13
13
|
this.config = config;
|
|
14
|
-
this.connection = new jsforce_1.Connection(
|
|
15
|
-
...this.config,
|
|
16
|
-
oauth2: new jsforce_1.OAuth2(this.config.oauth2),
|
|
17
|
-
});
|
|
14
|
+
this.connection = new jsforce_1.Connection(this.config);
|
|
18
15
|
this.accounts = new accounts_1.Accounts(this.connection);
|
|
19
16
|
this.contracts = new contracts_1.Contracts(this.connection);
|
|
20
17
|
this.orders = new orders_1.Orders(this.connection);
|
|
@@ -95,4 +95,5 @@ export type QuoteType = 'Quote' | 'Renewal' | 'Amendment' | 'Re-Quote';
|
|
|
95
95
|
export type QuoteWithLineItems = Quote & {
|
|
96
96
|
lineItems: QuoteLine[];
|
|
97
97
|
};
|
|
98
|
-
export type
|
|
98
|
+
export type UpdateQuoteLine = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
|
|
99
|
+
export type UpdateQuoteLinesRequest = UpdateQuoteLine[];
|
|
@@ -7,6 +7,7 @@ export declare class Quotes {
|
|
|
7
7
|
constructor(connection: Connection);
|
|
8
8
|
getById(id: string): Promise<QuoteWithLineItems | null>;
|
|
9
9
|
getRenewalQuoteByAccountId(accountId: string): Promise<QuoteWithLineItems | null>;
|
|
10
|
+
getRenewalQuotesForBillingPeriod(startDate: string, endDate: string): Promise<QuoteWithLineItems[]>;
|
|
10
11
|
updateLineItemQuantities(lineItems: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
|
|
11
12
|
order(quoteId: string): Promise<SaveResult>;
|
|
12
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Quotes = void 0;
|
|
4
|
+
const jsforce_1 = require("jsforce");
|
|
4
5
|
const quote_lines_1 = require("./quote-lines/quote-lines");
|
|
5
6
|
class Quotes {
|
|
6
7
|
constructor(connection) {
|
|
@@ -25,6 +26,19 @@ class Quotes {
|
|
|
25
26
|
quote.lineItems = await this.items.getByQuoteId(quote.Id);
|
|
26
27
|
return quote;
|
|
27
28
|
}
|
|
29
|
+
async getRenewalQuotesForBillingPeriod(startDate, endDate) {
|
|
30
|
+
const quotes = (await this.client.find({
|
|
31
|
+
SBQQ__Type__c: 'Renewal',
|
|
32
|
+
SBQQ__StartDate__c: { $eq: new jsforce_1.SfDate(startDate) },
|
|
33
|
+
SBQQ__EndDate__c: { $eq: new jsforce_1.SfDate(endDate) },
|
|
34
|
+
}));
|
|
35
|
+
if (!(quotes && quotes.length))
|
|
36
|
+
return [];
|
|
37
|
+
for (const quote of quotes) {
|
|
38
|
+
quote.lineItems = await this.items.getByQuoteId(quote.Id);
|
|
39
|
+
}
|
|
40
|
+
return quotes;
|
|
41
|
+
}
|
|
28
42
|
async updateLineItemQuantities(lineItems) {
|
|
29
43
|
return this.items.update(lineItems);
|
|
30
44
|
}
|