@pliancy/salesforce-cpq-sdk 3.9.0 → 3.11.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address } from 'jsforce';
|
|
1
|
+
import { Address, QueryCondition, Schema } from 'jsforce';
|
|
2
2
|
export interface Contract {
|
|
3
3
|
[index: string]: any;
|
|
4
4
|
Id: string;
|
|
@@ -85,3 +85,4 @@ export interface Contract {
|
|
|
85
85
|
SBQQ__OpportunityPricebookId__c: string;
|
|
86
86
|
}
|
|
87
87
|
export type ContractStatus = 'Draft' | 'Activated' | 'In Approval Process';
|
|
88
|
+
export type ContractQuery = QueryCondition<Schema, 'SBQQ__Contract__c'>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Connection } from 'jsforce';
|
|
2
|
-
import { Contract } from './contract.types';
|
|
2
|
+
import { Contract, ContractQuery } from './contract.types';
|
|
3
3
|
export declare class Contracts {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
private readonly client;
|
|
6
6
|
constructor(connection: Connection);
|
|
7
7
|
getById(id: string): Promise<Contract | null>;
|
|
8
|
-
getLatestActivatedByAccountId(id: string): Promise<Contract | undefined>;
|
|
8
|
+
getLatestActivatedByAccountId(id: string, options?: ContractQuery): Promise<Contract | undefined>;
|
|
9
9
|
getDraftsByBillingPeriod(accountId: string, start: string, end: string): Promise<Contract[]>;
|
|
10
|
+
private buildQuery;
|
|
10
11
|
}
|
|
@@ -10,8 +10,8 @@ class Contracts {
|
|
|
10
10
|
async getById(id) {
|
|
11
11
|
return this.client.findOne({ Id: id });
|
|
12
12
|
}
|
|
13
|
-
async getLatestActivatedByAccountId(id) {
|
|
14
|
-
const query = { AccountId: id, Status: 'Activated' };
|
|
13
|
+
async getLatestActivatedByAccountId(id, options) {
|
|
14
|
+
const query = this.buildQuery({ AccountId: id, Status: 'Activated' }, options);
|
|
15
15
|
const contracts = (await this.client.find(query));
|
|
16
16
|
if (!(contracts && contracts.length))
|
|
17
17
|
return undefined;
|
|
@@ -34,5 +34,11 @@ class Contracts {
|
|
|
34
34
|
EndDate: { $lte: new jsforce_1.SfDate(end) },
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
buildQuery(base, options) {
|
|
38
|
+
const query = { ...base };
|
|
39
|
+
if (options)
|
|
40
|
+
Object.assign(query, options);
|
|
41
|
+
return query;
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
exports.Contracts = Contracts;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Connection, Schema, SObject } from 'jsforce';
|
|
1
|
+
import { Connection, SaveResult, Schema, SObject } from 'jsforce';
|
|
2
2
|
import { Subscription } from './subscription.types';
|
|
3
3
|
export declare class Subscriptions {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
client: SObject<Schema, 'SBQQ__Subscription__c'>;
|
|
6
6
|
constructor(connection: Connection);
|
|
7
7
|
getByContractNumber(contractNumber: string): Promise<Subscription[]>;
|
|
8
|
+
update(id: string, update: Partial<Omit<Subscription, 'Id'>>): Promise<SaveResult>;
|
|
8
9
|
}
|
|
@@ -9,5 +9,11 @@ class Subscriptions {
|
|
|
9
9
|
async getByContractNumber(contractNumber) {
|
|
10
10
|
return this.client.find({ SBQQ__ContractNumber__c: contractNumber });
|
|
11
11
|
}
|
|
12
|
+
async update(id, update) {
|
|
13
|
+
return this.client.update({
|
|
14
|
+
Id: id,
|
|
15
|
+
...update,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
exports.Subscriptions = Subscriptions;
|