@pliancy/salesforce-cpq-sdk 1.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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/dist/index.d.ts +17 -0
  4. package/dist/index.js +35 -0
  5. package/dist/lib/accounts/account.types.d.ts +63 -0
  6. package/dist/lib/accounts/account.types.js +2 -0
  7. package/dist/lib/accounts/accounts.d.ts +10 -0
  8. package/dist/lib/accounts/accounts.js +18 -0
  9. package/dist/lib/contracts/contract.types.d.ts +86 -0
  10. package/dist/lib/contracts/contract.types.js +2 -0
  11. package/dist/lib/contracts/contracts.d.ts +9 -0
  12. package/dist/lib/contracts/contracts.js +22 -0
  13. package/dist/lib/cpq.d.ts +20 -0
  14. package/dist/lib/cpq.js +29 -0
  15. package/dist/lib/cpq.types.d.ts +11 -0
  16. package/dist/lib/cpq.types.js +2 -0
  17. package/dist/lib/orders/order-items/order-item.types.d.ts +65 -0
  18. package/dist/lib/orders/order-items/order-item.types.js +2 -0
  19. package/dist/lib/orders/order-items/order-items.d.ts +8 -0
  20. package/dist/lib/orders/order-items/order-items.js +13 -0
  21. package/dist/lib/orders/order.types.d.ts +75 -0
  22. package/dist/lib/orders/order.types.js +2 -0
  23. package/dist/lib/orders/orders.d.ts +10 -0
  24. package/dist/lib/orders/orders.js +27 -0
  25. package/dist/lib/products/product.types.d.ts +93 -0
  26. package/dist/lib/products/product.types.js +2 -0
  27. package/dist/lib/products/products.d.ts +8 -0
  28. package/dist/lib/products/products.js +13 -0
  29. package/dist/lib/quotes/quote-lines/quote-line.types.d.ts +146 -0
  30. package/dist/lib/quotes/quote-lines/quote-line.types.js +2 -0
  31. package/dist/lib/quotes/quote-lines/quote-lines.d.ts +10 -0
  32. package/dist/lib/quotes/quote-lines/quote-lines.js +16 -0
  33. package/dist/lib/quotes/quote.types.d.ts +98 -0
  34. package/dist/lib/quotes/quote.types.js +2 -0
  35. package/dist/lib/quotes/quotes.d.ts +12 -0
  36. package/dist/lib/quotes/quotes.js +35 -0
  37. package/dist/lib/subscriptions/subscription.types.d.ts +89 -0
  38. package/dist/lib/subscriptions/subscription.types.js +2 -0
  39. package/dist/lib/subscriptions/subscriptions.d.ts +8 -0
  40. package/dist/lib/subscriptions/subscriptions.js +13 -0
  41. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) justin <santese@pliancy.com> (github.com/santese)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @pliancy/duo-sdk
2
+
3
+ ## Usage
4
+
5
+ ```typescript
6
+ import { Cpq } from '@pliancy/salesforce-cpq-sdk'
7
+ const cpq = new Cpq({
8
+ instanceUrl: 'https://example.com',
9
+ oauth2: {
10
+ clientId: 'clientId',
11
+ clientSecret: 'clientSecret',
12
+ loginUrl: 'https://example.com',
13
+ }
14
+ })
15
+
16
+ await cpq.authorize()
17
+ const account = await cpq.accounts.getByExternalId('EXTERNAL_ID')
18
+
19
+ ```
20
+
21
+ ## Test
22
+
23
+ ```bash
24
+ yarn test
25
+ ```
@@ -0,0 +1,17 @@
1
+ export { Cpq } from './lib/cpq';
2
+ export * from './lib/accounts/accounts';
3
+ export * from './lib/accounts/account.types';
4
+ export * from './lib/contracts/contracts';
5
+ export * from './lib/contracts/contract.types';
6
+ export * from './lib/products/products';
7
+ export * from './lib/products/product.types';
8
+ export * from './lib/subscriptions/subscriptions';
9
+ export * from './lib/subscriptions/subscription.types';
10
+ export * from './lib/quotes/quotes';
11
+ export * from './lib/quotes/quote.types';
12
+ export * from './lib/quotes/quote-lines/quote-lines';
13
+ export * from './lib/quotes/quote-lines/quote-line.types';
14
+ export * from './lib/orders/orders';
15
+ export * from './lib/orders/order.types';
16
+ export * from './lib/orders/order-items/order-items';
17
+ export * from './lib/orders/order-items/order-item.types';
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Cpq = void 0;
18
+ var cpq_1 = require("./lib/cpq");
19
+ Object.defineProperty(exports, "Cpq", { enumerable: true, get: function () { return cpq_1.Cpq; } });
20
+ __exportStar(require("./lib/accounts/accounts"), exports);
21
+ __exportStar(require("./lib/accounts/account.types"), exports);
22
+ __exportStar(require("./lib/contracts/contracts"), exports);
23
+ __exportStar(require("./lib/contracts/contract.types"), exports);
24
+ __exportStar(require("./lib/products/products"), exports);
25
+ __exportStar(require("./lib/products/product.types"), exports);
26
+ __exportStar(require("./lib/subscriptions/subscriptions"), exports);
27
+ __exportStar(require("./lib/subscriptions/subscription.types"), exports);
28
+ __exportStar(require("./lib/quotes/quotes"), exports);
29
+ __exportStar(require("./lib/quotes/quote.types"), exports);
30
+ __exportStar(require("./lib/quotes/quote-lines/quote-lines"), exports);
31
+ __exportStar(require("./lib/quotes/quote-lines/quote-line.types"), exports);
32
+ __exportStar(require("./lib/orders/orders"), exports);
33
+ __exportStar(require("./lib/orders/order.types"), exports);
34
+ __exportStar(require("./lib/orders/order-items/order-items"), exports);
35
+ __exportStar(require("./lib/orders/order-items/order-item.types"), exports);
@@ -0,0 +1,63 @@
1
+ import { Address } from 'jsforce';
2
+ export interface Account {
3
+ Id: string;
4
+ IsDeleted: boolean;
5
+ MasterRecordId?: string;
6
+ Name: string;
7
+ Type: string;
8
+ ParentId?: string;
9
+ BillingStreet: string;
10
+ BillingCity: string;
11
+ BillingState: string;
12
+ BillingPostalCode: string;
13
+ BillingCountry: string;
14
+ BillingStateCode: string;
15
+ BillingCountryCode: string;
16
+ BillingLatitude?: string;
17
+ BillingLongitude?: string;
18
+ BillingGeocodeAccuracy?: string;
19
+ BillingAddress: Address;
20
+ ShippingStreet?: string;
21
+ ShippingCity?: string;
22
+ ShippingState?: string;
23
+ ShippingPostalCode?: string;
24
+ ShippingCountry: string;
25
+ ShippingStateCode?: string;
26
+ ShippingCountryCode: string;
27
+ ShippingLatitude?: string;
28
+ ShippingLongitude?: string;
29
+ ShippingGeocodeAccuracy?: string;
30
+ ShippingAddress: Address;
31
+ Phone?: string;
32
+ Website: string;
33
+ PhotoUrl: string;
34
+ Industry: string;
35
+ AnnualRevenue: number;
36
+ NumberOfEmployees?: string;
37
+ Description: string;
38
+ CurrencyIsoCode: string;
39
+ OwnerId: string;
40
+ CreatedDate: string;
41
+ CreatedById: string;
42
+ LastModifiedDate: string;
43
+ LastModifiedById: string;
44
+ SystemModstamp: string;
45
+ LastActivityDate: string;
46
+ LastViewedDate: string;
47
+ LastReferencedDate: string;
48
+ Jigsaw?: string;
49
+ JigsawCompanyId?: string;
50
+ AccountSource: string;
51
+ SicDesc?: string;
52
+ SBQQ__AssetQuantitiesCombined__c: boolean;
53
+ SBQQ__CoTermedContractsCombined__c: boolean;
54
+ SBQQ__ContractCoTermination__c?: string;
55
+ SBQQ__DefaultOpportunity__c?: string;
56
+ SBQQ__IgnoreParentContractedPrices__c: boolean;
57
+ SBQQ__PreserveBundle__c: boolean;
58
+ SBQQ__PriceHoldEnd__c?: string;
59
+ SBQQ__RenewalModel__c?: string;
60
+ SBQQ__RenewalPricingMethod__c?: string;
61
+ SBQQ__TaxExempt__c?: string;
62
+ SBQQ__CoTerminationEvent__c: null;
63
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Connection } from 'jsforce';
2
+ import { Account } from './account.types';
3
+ import { CustomFieldQuery } from '../cpq.types';
4
+ export declare class Accounts {
5
+ private readonly connection;
6
+ private readonly client;
7
+ constructor(connection: Connection);
8
+ getById(id: string): Promise<Account | null>;
9
+ getByCustomField(field: string, value: string): Promise<(Account & CustomFieldQuery<Account>) | null>;
10
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Accounts = void 0;
4
+ class Accounts {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ this.client = this.connection.sobject('Account');
8
+ }
9
+ async getById(id) {
10
+ return this.client.findOne({ Id: id });
11
+ }
12
+ async getByCustomField(field, value) {
13
+ const query = {};
14
+ query[field] = value;
15
+ return this.client.findOne(query);
16
+ }
17
+ }
18
+ exports.Accounts = Accounts;
@@ -0,0 +1,86 @@
1
+ import { Address } from 'jsforce';
2
+ export interface Contract {
3
+ Id: string;
4
+ AccountId: string;
5
+ CurrencyIsoCode: string;
6
+ Pricebook2Id?: string;
7
+ OwnerExpirationNotice?: string;
8
+ StartDate: string;
9
+ EndDate: string;
10
+ BillingStreet?: string;
11
+ BillingCity?: string;
12
+ BillingState?: string;
13
+ BillingPostalCode?: string;
14
+ BillingCountry: string;
15
+ BillingStateCode?: string;
16
+ BillingCountryCode: string;
17
+ BillingLatitude?: string;
18
+ BillingLongitude?: string;
19
+ BillingGeocodeAccuracy?: string;
20
+ BillingAddress: Address;
21
+ ShippingStreet?: string;
22
+ ShippingCity?: string;
23
+ ShippingState?: string;
24
+ ShippingPostalCode?: string;
25
+ ShippingCountry: string;
26
+ ShippingStateCode?: string;
27
+ ShippingCountryCode: string;
28
+ ShippingLatitude?: string;
29
+ ShippingLongitude?: string;
30
+ ShippingGeocodeAccuracy?: string;
31
+ ShippingAddress: Address;
32
+ ContractTerm: number;
33
+ OwnerId: string;
34
+ Status: ContractStatus;
35
+ CompanySignedId?: string;
36
+ CompanySignedDate?: string;
37
+ CustomerSignedId?: string;
38
+ CustomerSignedTitle?: string;
39
+ CustomerSignedDate?: string;
40
+ SpecialTerms?: string;
41
+ ActivatedById?: string;
42
+ ActivatedDate?: string;
43
+ StatusCode: string;
44
+ Description?: string;
45
+ IsDeleted: boolean;
46
+ ContractNumber: string;
47
+ LastApprovedDate?: string;
48
+ CreatedDate: string;
49
+ CreatedById: string;
50
+ LastModifiedDate: string;
51
+ LastModifiedById: string;
52
+ SystemModstamp: string;
53
+ LastActivityDate?: string;
54
+ LastViewedDate?: string;
55
+ LastReferencedDate?: string;
56
+ SBQQ__AmendmentOpportunityRecordTypeId__c?: string;
57
+ SBQQ__AmendmentOpportunityStage__c?: string;
58
+ SBQQ__AmendmentOwner__c?: string;
59
+ SBQQ__AmendmentPricebookId__c?: string;
60
+ SBQQ__AmendmentRenewalBehavior__c: string;
61
+ SBQQ__AmendmentStartDate__c?: string;
62
+ SBQQ__DefaultRenewalContactRoles__c: boolean;
63
+ SBQQ__DefaultRenewalPartners__c: boolean;
64
+ SBQQ__DisableAmendmentCoTerm__c: boolean;
65
+ SBQQ__Evergreen__c: boolean;
66
+ SBQQ__ExpirationDate__c: string;
67
+ SBQQ__MDQRenewalBehavior__c?: string;
68
+ SBQQ__MasterContract__c: boolean;
69
+ SBQQ__Opportunity__c: string;
70
+ SBQQ__Order__c?: string;
71
+ SBQQ__PreserveBundleStructureUponRenewals__c: boolean;
72
+ SBQQ__Quote__c: string;
73
+ SBQQ__RenewalForecast__c: boolean;
74
+ SBQQ__RenewalOpportunityRecordTypeId__c?: string;
75
+ SBQQ__RenewalOpportunityStage__c?: string;
76
+ SBQQ__RenewalOpportunity__c?: string;
77
+ SBQQ__RenewalOwner__c?: string;
78
+ SBQQ__RenewalPricebookId__c?: string;
79
+ SBQQ__RenewalQuoted__c: boolean;
80
+ SBQQ__RenewalTerm__c: number;
81
+ SBQQ__RenewalUpliftRate__c?: string;
82
+ SBQQ__SubscriptionQuantitiesCombined__c: boolean;
83
+ SBQQ__ActiveContract__c: number;
84
+ SBQQ__OpportunityPricebookId__c: string;
85
+ }
86
+ export type ContractStatus = 'Draft' | 'Activated' | 'In Approval Process';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { Connection } from 'jsforce';
2
+ import { Contract } from './contract.types';
3
+ export declare class Contracts {
4
+ private readonly connection;
5
+ private readonly client;
6
+ constructor(connection: Connection);
7
+ getById(id: string): Promise<Contract | null>;
8
+ getDraftsByBillingPeriod(accountId: string, start: string, end: string): Promise<Contract[]>;
9
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Contracts = void 0;
4
+ const jsforce_1 = require("jsforce");
5
+ class Contracts {
6
+ constructor(connection) {
7
+ this.connection = connection;
8
+ this.client = this.connection.sobject('Contract');
9
+ }
10
+ async getById(id) {
11
+ return this.client.findOne({ Id: id });
12
+ }
13
+ async getDraftsByBillingPeriod(accountId, start, end) {
14
+ return this.client.find({
15
+ AccountId: accountId,
16
+ Status: 'Draft',
17
+ StartDate: { $gte: new jsforce_1.SfDate(start) },
18
+ EndDate: { $lte: new jsforce_1.SfDate(end) },
19
+ });
20
+ }
21
+ }
22
+ exports.Contracts = Contracts;
@@ -0,0 +1,20 @@
1
+ import { Accounts } from './accounts/accounts';
2
+ import { CpqConfig } from './cpq.types';
3
+ import { Connection } from 'jsforce';
4
+ import { Contracts } from './contracts/contracts';
5
+ import { Products } from './products/products';
6
+ import { Subscriptions } from './subscriptions/subscriptions';
7
+ import { Quotes } from './quotes/quotes';
8
+ import { Orders } from './orders/orders';
9
+ export declare class Cpq {
10
+ private readonly config;
11
+ accounts: Accounts;
12
+ connection: Connection;
13
+ contracts: Contracts;
14
+ orders: Orders;
15
+ products: Products;
16
+ quotes: Quotes;
17
+ subscriptions: Subscriptions;
18
+ constructor(config: CpqConfig);
19
+ authorize(): Promise<void>;
20
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Cpq = void 0;
4
+ const accounts_1 = require("./accounts/accounts");
5
+ const jsforce_1 = require("jsforce");
6
+ const contracts_1 = require("./contracts/contracts");
7
+ const products_1 = require("./products/products");
8
+ const subscriptions_1 = require("./subscriptions/subscriptions");
9
+ const quotes_1 = require("./quotes/quotes");
10
+ const orders_1 = require("./orders/orders");
11
+ class Cpq {
12
+ constructor(config) {
13
+ this.config = config;
14
+ this.connection = new jsforce_1.Connection({
15
+ ...this.config,
16
+ oauth2: new jsforce_1.OAuth2(this.config.oauth2),
17
+ });
18
+ this.accounts = new accounts_1.Accounts(this.connection);
19
+ this.contracts = new contracts_1.Contracts(this.connection);
20
+ this.orders = new orders_1.Orders(this.connection);
21
+ this.products = new products_1.Products(this.connection);
22
+ this.subscriptions = new subscriptions_1.Subscriptions(this.connection);
23
+ this.quotes = new quotes_1.Quotes(this.connection);
24
+ }
25
+ async authorize() {
26
+ await this.connection.authorize({ grant_type: 'client_credentials' });
27
+ }
28
+ }
29
+ exports.Cpq = Cpq;
@@ -0,0 +1,11 @@
1
+ export interface CpqConfig {
2
+ instanceUrl: string;
3
+ oauth2: {
4
+ clientId: string;
5
+ clientSecret: string;
6
+ loginUrl: string;
7
+ };
8
+ }
9
+ export type CustomFieldQuery<T> = Partial<T & {
10
+ [index: string]: string;
11
+ }>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,65 @@
1
+ import { OrderStatus } from '../order.types';
2
+ export interface OrderItem {
3
+ Id: string;
4
+ Product2Id: string;
5
+ IsDeleted: boolean;
6
+ OrderId: string;
7
+ PricebookEntryId: string;
8
+ OriginalOrderItemId?: string;
9
+ AvailableQuantity: number;
10
+ Quantity: number;
11
+ CurrencyIsoCode: string;
12
+ UnitPrice: number;
13
+ ListPrice: number;
14
+ TotalPrice: number;
15
+ ServiceDate: string;
16
+ EndDate?: string;
17
+ Description?: string;
18
+ CreatedDate: string;
19
+ CreatedById: string;
20
+ LastModifiedDate: string;
21
+ LastModifiedById: string;
22
+ SystemModstamp: string;
23
+ OrderItemNumber: string;
24
+ SBQQ__Activated__c: boolean;
25
+ SBQQ__Asset__c?: string;
26
+ SBQQ__BillingFrequency__c?: string;
27
+ SBQQ__BillingType__c?: string;
28
+ SBQQ__BlockPrice__c?: string;
29
+ SBQQ__BookingsIndicator__c: string;
30
+ SBQQ__BundleRoot__c?: string;
31
+ SBQQ__ChargeType__c?: string;
32
+ SBQQ__ContractAction__c: string;
33
+ SBQQ__Contract__c?: string;
34
+ SBQQ__Contracted__c: boolean;
35
+ SBQQ__ContractingMethod__c: string;
36
+ SBQQ__DefaultSubscriptionTerm__c?: string;
37
+ SBQQ__DimensionType__c?: string;
38
+ SBQQ__DiscountSchedule__c?: string;
39
+ SBQQ__OrderedQuantity__c: number;
40
+ SBQQ__PriceDimension__c?: string;
41
+ SBQQ__PriceSchedule__c?: string;
42
+ SBQQ__PricingMethod__c: string;
43
+ SBQQ__ProductSubscriptionType__c: string;
44
+ SBQQ__ProrateMultiplier__c: number;
45
+ SBQQ__QuoteLine__c: string;
46
+ SBQQ__QuotedListPrice__c: number;
47
+ SBQQ__QuotedQuantity__c: number;
48
+ SBQQ__RequiredBy__c?: string;
49
+ SBQQ__RevisedOrderProduct__c?: string;
50
+ SBQQ__SegmentIndex__c?: string;
51
+ SBQQ__SegmentKey__c?: string;
52
+ SBQQ__ShippingAccount__c?: string;
53
+ SBQQ__Status__c: OrderStatus;
54
+ SBQQ__SubscriptionPricing__c?: string;
55
+ SBQQ__SubscriptionTerm__c?: string;
56
+ SBQQ__Subscription__c?: string;
57
+ SBQQ__TaxAmount__c?: string;
58
+ SBQQ__TaxCode__c?: string;
59
+ SBQQ__TermDiscountSchedule__c?: string;
60
+ SBQQ__TerminatedDate__c?: string;
61
+ SBQQ__UnproratedNetPrice__c?: string;
62
+ SBQQ__UpgradedSubscription__c?: string;
63
+ SBQQ__OrderProductBookings__c: number;
64
+ SBQQ__SubscriptionType__c: string;
65
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Connection } from 'jsforce';
2
+ import { OrderItem } from './order-item.types';
3
+ export declare class OrderItems {
4
+ private readonly connection;
5
+ private readonly client;
6
+ constructor(connection: Connection);
7
+ getByOrderId(id: string): Promise<OrderItem[]>;
8
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrderItems = void 0;
4
+ class OrderItems {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ this.client = this.connection.sobject('OrderItem');
8
+ }
9
+ async getByOrderId(id) {
10
+ return this.client.find({ OrderId: id });
11
+ }
12
+ }
13
+ exports.OrderItems = OrderItems;
@@ -0,0 +1,75 @@
1
+ import { Address } from 'jsforce';
2
+ import { OrderItem } from './order-items/order-item.types';
3
+ export interface Order {
4
+ Id: string;
5
+ OwnerId: string;
6
+ ContractId?: string;
7
+ AccountId: string;
8
+ Pricebook2Id: string;
9
+ OriginalOrderId?: string;
10
+ OpportunityId: string;
11
+ EffectiveDate: string;
12
+ EndDate?: string;
13
+ IsReductionOrder: boolean;
14
+ Status: OrderStatus;
15
+ Description?: string;
16
+ CustomerAuthorizedById?: string;
17
+ CompanyAuthorizedById?: string;
18
+ Type: string;
19
+ BillingStreet?: string;
20
+ BillingCity?: string;
21
+ BillingState?: string;
22
+ BillingPostalCode?: string;
23
+ BillingCountry: string;
24
+ BillingStateCode?: string;
25
+ BillingCountryCode: string;
26
+ BillingLatitude?: string;
27
+ BillingLongitude?: string;
28
+ BillingGeocodeAccuracy?: string;
29
+ BillingAddress: Address;
30
+ ShippingStreet?: string;
31
+ ShippingCity?: string;
32
+ ShippingState?: string;
33
+ ShippingPostalCode?: string;
34
+ ShippingCountry: string;
35
+ ShippingStateCode?: string;
36
+ ShippingCountryCode: string;
37
+ ShippingLatitude?: string;
38
+ ShippingLongitude?: string;
39
+ ShippingGeocodeAccuracy?: string;
40
+ ShippingAddress: Address;
41
+ Name?: string;
42
+ PoDate?: string;
43
+ PoNumber?: string;
44
+ OrderReferenceNumber?: string;
45
+ BillToContactId?: string;
46
+ ShipToContactId?: string;
47
+ ActivatedDate?: string;
48
+ ActivatedById?: string;
49
+ StatusCode: string;
50
+ CurrencyIsoCode: string;
51
+ OrderNumber: string;
52
+ TotalAmount: number;
53
+ CreatedDate: string;
54
+ CreatedById: string;
55
+ LastModifiedDate: string;
56
+ LastModifiedById: string;
57
+ IsDeleted: boolean;
58
+ SystemModstamp: string;
59
+ LastViewedDate?: string;
60
+ LastReferencedDate?: string;
61
+ SBQQ__Contracted__c: boolean;
62
+ SBQQ__ContractingMethod__c: string;
63
+ SBQQ__PaymentTerm__c: string;
64
+ SBQQ__PriceCalcStatusMessage__c?: string;
65
+ SBQQ__PriceCalcStatus__c: string;
66
+ SBQQ__Quote__c: string;
67
+ SBQQ__RenewalTerm__c?: string;
68
+ SBQQ__RenewalUpliftRate__c?: string;
69
+ SBQQ__TaxAmount__c: 0;
70
+ SBQQ__OrderBookings__c: number;
71
+ }
72
+ export type FullOrder = Order & {
73
+ lineItems: OrderItem[];
74
+ };
75
+ export type OrderStatus = 'Draft' | 'Activated';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Connection, SaveResult } from 'jsforce';
2
+ import { FullOrder, OrderStatus } from './order.types';
3
+ export declare class Orders {
4
+ private readonly connection;
5
+ private readonly client;
6
+ private readonly items;
7
+ constructor(connection: Connection);
8
+ getByStartDateForAccount(accountId: string, startDate: string, status: OrderStatus): Promise<FullOrder[]>;
9
+ activate(orderId: string): Promise<SaveResult>;
10
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Orders = void 0;
4
+ const jsforce_1 = require("jsforce");
5
+ const order_items_1 = require("./order-items/order-items");
6
+ class Orders {
7
+ constructor(connection) {
8
+ this.connection = connection;
9
+ this.client = this.connection.sobject('Order');
10
+ this.items = new order_items_1.OrderItems(this.connection);
11
+ }
12
+ async getByStartDateForAccount(accountId, startDate, status) {
13
+ const orders = (await this.client.find({
14
+ AccountId: accountId,
15
+ Status: status,
16
+ EffectiveDate: { $eq: new jsforce_1.SfDate(startDate) },
17
+ }));
18
+ for (const order of orders) {
19
+ order.lineItems = await this.items.getByOrderId(order.Id);
20
+ }
21
+ return orders;
22
+ }
23
+ async activate(orderId) {
24
+ return this.client.update({ Id: orderId, Status: 'Activated' });
25
+ }
26
+ }
27
+ exports.Orders = Orders;
@@ -0,0 +1,93 @@
1
+ export interface Product {
2
+ Id: string;
3
+ Name: string;
4
+ ProductCode: string;
5
+ Description?: string;
6
+ IsActive: boolean;
7
+ CreatedDate: string;
8
+ CreatedById: string;
9
+ LastModifiedDate: string;
10
+ LastModifiedById: string;
11
+ SystemModstamp: string;
12
+ Family: string;
13
+ CurrencyIsoCode: string;
14
+ ExternalDataSourceId?: string;
15
+ ExternalId: string;
16
+ DisplayUrl?: string;
17
+ QuantityUnitOfMeasure?: string;
18
+ IsDeleted: boolean;
19
+ IsArchived: boolean;
20
+ LastViewedDate?: string;
21
+ LastReferencedDate?: string;
22
+ StockKeepingUnit?: string;
23
+ SBQQ__AssetAmendmentBehavior__c?: string;
24
+ SBQQ__AssetConversion__c?: string;
25
+ SBQQ__BatchQuantity__c?: string;
26
+ SBQQ__BillingFrequency__c?: string;
27
+ SBQQ__BillingType__c?: string;
28
+ SBQQ__BlockPricingField__c?: string;
29
+ SBQQ__ChargeType__c?: string;
30
+ SBQQ__Component__c: boolean;
31
+ SBQQ__CompoundDiscountRate__c?: string;
32
+ SBQQ__ConfigurationFieldSet__c?: string;
33
+ SBQQ__ConfigurationFields__c?: string;
34
+ SBQQ__ConfigurationFormTitle__c?: string;
35
+ SBQQ__ConfigurationType__c?: string;
36
+ SBQQ__ConfigurationValidator__c?: string;
37
+ SBQQ__ConfiguredCodePattern__c?: string;
38
+ SBQQ__ConfiguredDescriptionPattern__c?: string;
39
+ SBQQ__CostEditable__c: boolean;
40
+ SBQQ__CostSchedule__c?: string;
41
+ SBQQ__CustomConfigurationPage__c?: string;
42
+ SBQQ__CustomConfigurationRequired__c: boolean;
43
+ SBQQ__CustomerCommunityAvailability__c?: string;
44
+ SBQQ__DefaultPricingTable__c?: string;
45
+ SBQQ__DefaultQuantity__c?: string;
46
+ SBQQ__DescriptionLocked__c: boolean;
47
+ SBQQ__DiscountCategory__c?: string;
48
+ SBQQ__DiscountSchedule__c?: string;
49
+ SBQQ__DynamicPricingConstraint__c?: string;
50
+ SBQQ__EnableLargeConfiguration__c: boolean;
51
+ SBQQ__ExcludeFromMaintenance__c: boolean;
52
+ SBQQ__ExcludeFromOpportunity__c: boolean;
53
+ SBQQ__ExternallyConfigurable__c: boolean;
54
+ SBQQ__GenerateContractedPrice__c?: string;
55
+ SBQQ__HasConfigurationAttributes__c: boolean;
56
+ SBQQ__HasConsumptionSchedule__c: boolean;
57
+ SBQQ__Hidden__c: boolean;
58
+ SBQQ__HidePriceInSearchResults__c: boolean;
59
+ SBQQ__IncludeInMaintenance__c: boolean;
60
+ SBQQ__NewQuoteGroup__c: boolean;
61
+ SBQQ__NonDiscountable__c: boolean;
62
+ SBQQ__NonPartnerDiscountable__c: boolean;
63
+ SBQQ__OptionLayout__c?: string;
64
+ SBQQ__OptionSelectionMethod__c?: string;
65
+ SBQQ__Optional__c: boolean;
66
+ SBQQ__PriceEditable__c: boolean;
67
+ SBQQ__PricingGuidance__c?: string;
68
+ SBQQ__PricingMethodEditable__c: boolean;
69
+ SBQQ__PricingMethod__c?: string;
70
+ SBQQ__ProductPictureID__c?: string;
71
+ SBQQ__QuantityEditable__c: boolean;
72
+ SBQQ__QuantityScale__c?: string;
73
+ SBQQ__ReconfigurationDisabled__c: boolean;
74
+ SBQQ__RenewalProduct__c?: string;
75
+ SBQQ__SortOrder__c?: string;
76
+ SBQQ__Specifications__c?: string;
77
+ SBQQ__SubscriptionBase__c?: string;
78
+ SBQQ__SubscriptionCategory__c?: string;
79
+ SBQQ__SubscriptionPercent__c?: string;
80
+ SBQQ__SubscriptionPricing__c: string;
81
+ SBQQ__SubscriptionTarget__c?: string;
82
+ SBQQ__SubscriptionTerm__c: number;
83
+ SBQQ__SubscriptionType__c: string;
84
+ SBQQ__TaxCode__c?: string;
85
+ SBQQ__Taxable__c: boolean;
86
+ SBQQ__TermDiscountLevel__c?: string;
87
+ SBQQ__TermDiscountSchedule__c?: string;
88
+ SBQQ__UpgradeCredit__c?: string;
89
+ SBQQ__UpgradeRatio__c?: string;
90
+ SBQQ__UpgradeSource__c?: string;
91
+ SBQQ__UpgradeTarget__c?: string;
92
+ SBQQ__ConfigurationEvent__c?: string;
93
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Connection } from 'jsforce';
2
+ import { Product } from './product.types';
3
+ export declare class Products {
4
+ private readonly connection;
5
+ private readonly client;
6
+ constructor(connection: Connection);
7
+ getById(id: string): Promise<Product | null>;
8
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Products = void 0;
4
+ class Products {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ this.client = this.connection.sobject('Product2');
8
+ }
9
+ async getById(id) {
10
+ return this.client.findOne({ Id: id });
11
+ }
12
+ }
13
+ exports.Products = Products;
@@ -0,0 +1,146 @@
1
+ export interface QuoteLine {
2
+ Id: string;
3
+ IsDeleted: boolean;
4
+ Name: string;
5
+ CurrencyIsoCode: string;
6
+ CreatedDate: string;
7
+ CreatedById: string;
8
+ LastModifiedDate: string;
9
+ LastModifiedById: string;
10
+ SystemModstamp: string;
11
+ SBQQ__Quote__c: string;
12
+ SBQQ__AdditionalDiscountAmount__c?: string;
13
+ SBQQ__AdditionalQuantity__c?: string;
14
+ SBQQ__AllowAssetRefund__c: boolean;
15
+ SBQQ__BatchQuantity__c?: string;
16
+ SBQQ__BillingFrequency__c?: string;
17
+ SBQQ__BillingType__c?: string;
18
+ SBQQ__BlockPrice__c?: string;
19
+ SBQQ__Bundle__c: boolean;
20
+ SBQQ__BundledQuantity__c?: string;
21
+ SBQQ__Bundled__c: boolean;
22
+ SBQQ__CarryoverLine__c: boolean;
23
+ SBQQ__ChargeType__c?: string;
24
+ SBQQ__ComponentCost__c?: string;
25
+ SBQQ__ComponentDiscountedByPackage__c: boolean;
26
+ SBQQ__ComponentListTotal__c?: string;
27
+ SBQQ__ComponentSubscriptionScope__c?: string;
28
+ SBQQ__ComponentTotal__c?: string;
29
+ SBQQ__ComponentUpliftedByPackage__c: boolean;
30
+ SBQQ__CompoundDiscountRate__c?: string;
31
+ SBQQ__ConfigurationRequired__c: boolean;
32
+ SBQQ__ContractedPrice__c?: string;
33
+ SBQQ__CostEditable__c: boolean;
34
+ SBQQ__Cost__c?: string;
35
+ SBQQ__CustomerPrice__c: number;
36
+ SBQQ__DefaultSubscriptionTerm__c: number;
37
+ SBQQ__Description__c?: string;
38
+ SBQQ__Dimension__c?: string;
39
+ SBQQ__DiscountScheduleType__c?: string;
40
+ SBQQ__DiscountSchedule__c?: string;
41
+ SBQQ__DiscountTier__c?: string;
42
+ SBQQ__Discount__c?: string;
43
+ SBQQ__DistributorDiscount__c?: string;
44
+ SBQQ__DynamicOptionId__c?: string;
45
+ SBQQ__EarliestValidAmendmentStartDate__c?: string;
46
+ SBQQ__EndDate__c?: string;
47
+ SBQQ__Existing__c: boolean;
48
+ SBQQ__Favorite__c?: string;
49
+ SBQQ__GenerateContractedPrice__c?: string;
50
+ SBQQ__GrossProfit__c?: string;
51
+ SBQQ__Group__c?: string;
52
+ SBQQ__Guidance__c?: string;
53
+ SBQQ__HasConsumptionSchedule__c: boolean;
54
+ SBQQ__Hidden__c: boolean;
55
+ SBQQ__Incomplete__c: boolean;
56
+ SBQQ__ListPrice__c: number;
57
+ SBQQ__MarkupAmount__c?: string;
58
+ SBQQ__MarkupRate__c?: string;
59
+ SBQQ__MaximumPrice__c?: string;
60
+ SBQQ__MinimumPrice__c?: string;
61
+ SBQQ__NetPrice__c: number;
62
+ SBQQ__NonDiscountable__c: boolean;
63
+ SBQQ__NonPartnerDiscountable__c: boolean;
64
+ SBQQ__Number__c: number;
65
+ SBQQ__OptionDiscountAmount__c?: string;
66
+ SBQQ__OptionDiscount__c?: string;
67
+ SBQQ__OptionLevel__c: number;
68
+ SBQQ__OptionType__c: string;
69
+ SBQQ__Optional__c: boolean;
70
+ SBQQ__OriginalPrice__c: number;
71
+ SBQQ__OriginalQuoteLineId__c?: string;
72
+ SBQQ__OriginalUnitCost__c?: string;
73
+ SBQQ__PackageProductCode__c?: string;
74
+ SBQQ__PackageProductDescription__c?: string;
75
+ SBQQ__PartnerDiscount__c?: string;
76
+ SBQQ__PartnerPrice__c: number;
77
+ SBQQ__PreviousSegmentPrice__c?: string;
78
+ SBQQ__PreviousSegmentUplift__c?: string;
79
+ SBQQ__PriceEditable__c: boolean;
80
+ SBQQ__PricebookEntryId__c: string;
81
+ SBQQ__PricingMethodEditable__c: boolean;
82
+ SBQQ__PricingMethod__c: string;
83
+ SBQQ__PriorQuantity__c?: string;
84
+ SBQQ__ProductOption__c: string;
85
+ SBQQ__ProductSubscriptionType__c: string;
86
+ SBQQ__Product__c: string;
87
+ SBQQ__ProrateMultiplier__c: number;
88
+ SBQQ__ProratedListPrice__c: number;
89
+ SBQQ__ProratedPrice__c: number;
90
+ SBQQ__Quantity__c: number;
91
+ SBQQ__RegularPrice__c: number;
92
+ SBQQ__Renewal__c: boolean;
93
+ SBQQ__RenewedAsset__c?: string;
94
+ SBQQ__RenewedSubscription__c?: string;
95
+ SBQQ__RequiredBy__c: string;
96
+ SBQQ__SegmentIndex__c?: string;
97
+ SBQQ__SegmentKey__c?: string;
98
+ SBQQ__SegmentLabel__c?: string;
99
+ SBQQ__Source__c?: string;
100
+ SBQQ__SpecialPriceDescription__c?: string;
101
+ SBQQ__SpecialPriceType__c?: string;
102
+ SBQQ__SpecialPrice__c: number;
103
+ SBQQ__StartDate__c?: string;
104
+ SBQQ__SubscribedAssetIds__c?: string;
105
+ SBQQ__SubscriptionBase__c?: string;
106
+ SBQQ__SubscriptionCategory__c: string;
107
+ SBQQ__SubscriptionPercent__c?: string;
108
+ SBQQ__SubscriptionPricing__c: string;
109
+ SBQQ__SubscriptionScope__c: string;
110
+ SBQQ__SubscriptionTargetPrice__c?: string;
111
+ SBQQ__SubscriptionTerm__c?: string;
112
+ SBQQ__TaxCode__c?: string;
113
+ SBQQ__Taxable__c: boolean;
114
+ SBQQ__TermDiscountSchedule__c?: string;
115
+ SBQQ__TermDiscountTier__c?: string;
116
+ SBQQ__TermDiscount__c?: string;
117
+ SBQQ__UnitCost__c?: string;
118
+ SBQQ__UnproratedNetPrice__c?: string;
119
+ SBQQ__UpgradedAsset__c?: string;
120
+ SBQQ__UpgradedQuantity__c?: string;
121
+ SBQQ__UpgradedSubscription__c?: string;
122
+ SBQQ__UpliftAmount__c: number;
123
+ SBQQ__Uplift__c: number;
124
+ SBQQ__VolumeDiscount__c?: string;
125
+ SBQQ__AdditionalDiscount__c: number;
126
+ SBQQ__ComponentVisibility__c?: string;
127
+ SBQQ__CustomerTotal__c: number;
128
+ SBQQ__EffectiveEndDate__c?: string;
129
+ SBQQ__EffectiveQuantity__c: number;
130
+ SBQQ__EffectiveStartDate__c: string;
131
+ SBQQ__EffectiveSubscriptionTerm__c?: string;
132
+ SBQQ__ListTotal__c: number;
133
+ SBQQ__Markup__c: number;
134
+ SBQQ__NetTotal__c: number;
135
+ SBQQ__PackageCost__c: number;
136
+ SBQQ__PackageListTotal__c: number;
137
+ SBQQ__PackageTotal__c: number;
138
+ SBQQ__PartnerTotal__c: number;
139
+ SBQQ__ProductCode__c: string;
140
+ SBQQ__ProductFamily__c: string;
141
+ SBQQ__ProductName__c: string;
142
+ SBQQ__RegularTotal__c: number;
143
+ SBQQ__SubscriptionType__c: string;
144
+ SBQQ__TotalDiscountAmount__c: number;
145
+ SBQQ__TotalDiscountRate__c: number;
146
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Connection, SaveResult } from 'jsforce';
2
+ import { QuoteLine } from './quote-line.types';
3
+ import { UpdateQuoteLinesRequest } from '../quote.types';
4
+ export declare class QuoteLines {
5
+ private readonly connection;
6
+ private readonly client;
7
+ constructor(connection: Connection);
8
+ getByQuoteId(id: string): Promise<QuoteLine[]>;
9
+ update(items: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
10
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuoteLines = void 0;
4
+ class QuoteLines {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ this.client = this.connection.sobject('SBQQ__QuoteLine__c');
8
+ }
9
+ async getByQuoteId(id) {
10
+ return this.client.find({ SBQQ__Quote__c: id });
11
+ }
12
+ async update(items) {
13
+ return this.client.update(items);
14
+ }
15
+ }
16
+ exports.QuoteLines = QuoteLines;
@@ -0,0 +1,98 @@
1
+ import { QuoteLine } from './quote-lines/quote-line.types';
2
+ export interface Quote {
3
+ Id: string;
4
+ OwnerId: string;
5
+ IsDeleted: boolean;
6
+ Name: string;
7
+ CurrencyIsoCode: string;
8
+ CreatedDate: string;
9
+ CreatedById: string;
10
+ LastModifiedDate: string;
11
+ LastModifiedById: string;
12
+ SystemModstamp: string;
13
+ LastActivityDate?: string;
14
+ LastViewedDate: string;
15
+ LastReferencedDate: string;
16
+ SBQQ__Account__c: string;
17
+ SBQQ__BillingCity__c: string;
18
+ SBQQ__BillingCountry__c: string;
19
+ SBQQ__BillingFrequency__c?: string;
20
+ SBQQ__BillingName__c: string;
21
+ SBQQ__BillingPostalCode__c: string;
22
+ SBQQ__BillingState__c: string;
23
+ SBQQ__BillingStreet__c: string;
24
+ SBQQ__ConsumptionRateOverride__c: boolean;
25
+ SBQQ__ContractingMethod__c: string;
26
+ SBQQ__CustomerDiscount__c?: string;
27
+ SBQQ__DefaultTemplate__c?: string;
28
+ SBQQ__DeliveryMethod__c?: string;
29
+ SBQQ__DistributorDiscount__c?: string;
30
+ SBQQ__Distributor__c?: string;
31
+ SBQQ__DocumentStatus__c?: string;
32
+ SBQQ__EmailTemplateId__c?: string;
33
+ SBQQ__EndDate__c?: string;
34
+ SBQQ__FirstSegmentTermEndDate__c?: string;
35
+ SBQQ__GenerateContractedPrice__c?: string;
36
+ SBQQ__Introduction__c?: string;
37
+ SBQQ__Key__c?: string;
38
+ SBQQ__LastCalculatedOn__c: string;
39
+ SBQQ__LastSavedOn__c: string;
40
+ SBQQ__LineItemsGrouped__c: boolean;
41
+ SBQQ__LineItemsPrinted__c: boolean;
42
+ SBQQ__MarkupRate__c?: string;
43
+ SBQQ__MasterContract__c?: string;
44
+ SBQQ__MasterEvergreenContract__c?: string;
45
+ SBQQ__Notes__c?: string;
46
+ SBQQ__Opportunity2__c: string;
47
+ SBQQ__OrderByQuoteLineGroup__c: boolean;
48
+ SBQQ__OrderBy__c?: string;
49
+ SBQQ__OrderGroupID__c?: string;
50
+ SBQQ__Ordered__c: boolean;
51
+ SBQQ__OriginalQuote__c?: string;
52
+ SBQQ__PaperSize__c: string;
53
+ SBQQ__PartnerDiscount__c?: string;
54
+ SBQQ__Partner__c?: string;
55
+ SBQQ__PaymentTerms__c: string;
56
+ SBQQ__PriceBook__c: string;
57
+ SBQQ__PricebookId__c: string;
58
+ SBQQ__PrimaryContact__c?: string;
59
+ SBQQ__Primary__c: boolean;
60
+ SBQQ__ProrationDayOfMonth__c?: string;
61
+ SBQQ__QuoteLanguage__c?: string;
62
+ SBQQ__QuoteProcessId__c?: string;
63
+ SBQQ__QuoteTemplateId__c?: string;
64
+ SBQQ__RenewalTerm__c?: string;
65
+ SBQQ__RenewalUpliftRate__c?: string;
66
+ SBQQ__SalesRep__c: string;
67
+ SBQQ__ShippingCity__c: string;
68
+ SBQQ__ShippingCountry__c: string;
69
+ SBQQ__ShippingName__c: string;
70
+ SBQQ__ShippingPostalCode__c: string;
71
+ SBQQ__ShippingState__c: string;
72
+ SBQQ__ShippingStreet__c: string;
73
+ SBQQ__Source__c?: string;
74
+ SBQQ__StartDate__c: string;
75
+ SBQQ__Status__c: string;
76
+ SBQQ__SubscriptionTerm__c?: string;
77
+ SBQQ__TargetCustomerAmount__c?: string;
78
+ SBQQ__Type__c: QuoteType;
79
+ SBQQ__Unopened__c: boolean;
80
+ SBQQ__WatermarkShown__c: boolean;
81
+ SBQQ__LineItemCount__c: number;
82
+ SBQQ__AdditionalDiscountAmount__c: number;
83
+ SBQQ__AverageCustomerDiscount__c: number;
84
+ SBQQ__AveragePartnerDiscount__c: number;
85
+ SBQQ__DaysQuoteOpen__c: number;
86
+ SBQQ__ExpirationDate__c: string;
87
+ SBQQ__TotalCustomerDiscountAmount__c: number;
88
+ SBQQ__Uncalculated__c: boolean;
89
+ SBQQ__CustomerAmount__c: number;
90
+ SBQQ__ListAmount__c: number;
91
+ SBQQ__NetAmount__c: number;
92
+ SBQQ__RegularAmount__c: number;
93
+ }
94
+ export type QuoteType = 'Quote' | 'Renewal' | 'Amendment' | 'Re-Quote';
95
+ export type QuoteWithLineItems = Quote & {
96
+ lineItems: QuoteLine[];
97
+ };
98
+ export type UpdateQuoteLinesRequest = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { Connection, SaveResult } from 'jsforce';
2
+ import { QuoteWithLineItems, UpdateQuoteLinesRequest } from './quote.types';
3
+ export declare class Quotes {
4
+ private readonly connection;
5
+ private readonly client;
6
+ private readonly items;
7
+ constructor(connection: Connection);
8
+ getById(id: string): Promise<QuoteWithLineItems | null>;
9
+ getRenewalQuoteByAccountId(accountId: string): Promise<QuoteWithLineItems | null>;
10
+ updateLineItemQuantities(lineItems: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
11
+ order(quoteId: string): Promise<SaveResult>;
12
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Quotes = void 0;
4
+ const quote_lines_1 = require("./quote-lines/quote-lines");
5
+ class Quotes {
6
+ constructor(connection) {
7
+ this.connection = connection;
8
+ this.client = this.connection.sobject('SBQQ__Quote__c');
9
+ this.items = new quote_lines_1.QuoteLines(this.connection);
10
+ }
11
+ async getById(id) {
12
+ const quote = (await this.client.findOne({ Id: id }));
13
+ if (!quote)
14
+ return null;
15
+ quote.lineItems = await this.items.getByQuoteId(quote.Id);
16
+ return quote;
17
+ }
18
+ async getRenewalQuoteByAccountId(accountId) {
19
+ const quote = (await this.client.findOne({
20
+ SBQQ__Account__c: accountId,
21
+ SBQQ__Type__c: 'Renewal',
22
+ }));
23
+ if (!quote)
24
+ return null;
25
+ quote.lineItems = await this.items.getByQuoteId(quote.Id);
26
+ return quote;
27
+ }
28
+ async updateLineItemQuantities(lineItems) {
29
+ return this.items.update(lineItems);
30
+ }
31
+ async order(quoteId) {
32
+ return this.client.update({ Id: quoteId, SBQQ__Ordered__c: true });
33
+ }
34
+ }
35
+ exports.Quotes = Quotes;
@@ -0,0 +1,89 @@
1
+ export interface Subscription {
2
+ Id: string;
3
+ OwnerId: string;
4
+ IsDeleted: boolean;
5
+ Name: string;
6
+ CurrencyIsoCode: string;
7
+ CreatedDate: string;
8
+ CreatedById: string;
9
+ LastModifiedDate: string;
10
+ LastModifiedById: string;
11
+ SystemModstamp: string;
12
+ SBQQ__Account__c: string;
13
+ SBQQ__AdditionalDiscountAmount__c: number;
14
+ SBQQ__BillingFrequency__c?: string;
15
+ SBQQ__BillingType__c?: string;
16
+ SBQQ__Bundle__c: boolean;
17
+ SBQQ__BundledQuantity__c?: string;
18
+ SBQQ__Bundled__c: boolean;
19
+ SBQQ__ChargeType__c?: string;
20
+ SBQQ__ComponentDiscountedByPackage__c: boolean;
21
+ SBQQ__ComponentSubscriptionScope__c?: string;
22
+ SBQQ__Contract__c: string;
23
+ SBQQ__CustomerPrice__c: number;
24
+ SBQQ__Dimension__c?: string;
25
+ SBQQ__DiscountScheduleType__c?: string;
26
+ SBQQ__DiscountSchedule__c?: string;
27
+ SBQQ__Discount__c?: string;
28
+ SBQQ__DistributorDiscount__c?: string;
29
+ SBQQ__DynamicOptionId__c: string;
30
+ SBQQ__HasConsumptionSchedule__c: boolean;
31
+ SBQQ__ListPrice__c: number;
32
+ SBQQ__MarkupAmount__c?: string;
33
+ SBQQ__MarkupRate__c?: string;
34
+ SBQQ__NetPrice__c: number;
35
+ SBQQ__Number__c: number;
36
+ SBQQ__OptionDiscountAmount__c?: string;
37
+ SBQQ__OptionDiscount__c?: string;
38
+ SBQQ__OptionLevel__c: number;
39
+ SBQQ__OptionType__c: string;
40
+ SBQQ__OrderProduct__c: string;
41
+ SBQQ__OriginalQuoteLine__c: string;
42
+ SBQQ__OriginalUnitCost__c?: string;
43
+ SBQQ__PackageProductCode__c?: string;
44
+ SBQQ__PackageProductDescription__c?: string;
45
+ SBQQ__PartnerDiscount__c?: string;
46
+ SBQQ__PricingMethod__c: string;
47
+ SBQQ__ProductOption__c: string;
48
+ SBQQ__ProductSubscriptionType__c: string;
49
+ SBQQ__Product__c: string;
50
+ SBQQ__ProrateMultiplier__c: number;
51
+ SBQQ__Quantity__c: number;
52
+ SBQQ__QuoteLine__c: string;
53
+ SBQQ__RegularPrice__c: number;
54
+ SBQQ__RenewalPrice__c?: string;
55
+ SBQQ__RenewalQuantity__c: number;
56
+ SBQQ__RenewalUpliftRate__c?: string;
57
+ SBQQ__RenewedDate__c?: string;
58
+ SBQQ__RequiredById__c: string;
59
+ SBQQ__RequiredByProduct__c: string;
60
+ SBQQ__RevisedSubscription__c?: string;
61
+ SBQQ__RootId__c: string;
62
+ SBQQ__SegmentEndDate__c?: string;
63
+ SBQQ__SegmentIndex__c?: string;
64
+ SBQQ__SegmentKey__c?: string;
65
+ SBQQ__SegmentLabel__c?: string;
66
+ SBQQ__SegmentQuantity__c?: string;
67
+ SBQQ__SegmentStartDate__c?: string;
68
+ SBQQ__SegmentUpliftAmount__c?: string;
69
+ SBQQ__SegmentUplift__c?: string;
70
+ SBQQ__SpecialPrice__c: number;
71
+ SBQQ__SubscriptionEndDate__c?: string;
72
+ SBQQ__SubscriptionPricing__c: string;
73
+ SBQQ__SubscriptionStartDate__c: string;
74
+ SBQQ__TermDiscountSchedule__c?: string;
75
+ SBQQ__TerminatedDate__c?: string;
76
+ SBQQ__UnitCost__c?: string;
77
+ SBQQ__ContractNumber__c: string;
78
+ SBQQ__CreditProductId__c?: string;
79
+ SBQQ__DimensionType__c?: string;
80
+ SBQQ__EndDate__c: string;
81
+ SBQQ__ProductId__c: string;
82
+ SBQQ__ProductName__c: string;
83
+ SBQQ__RenewalProductId__c: string;
84
+ SBQQ__RenewalProductOptionId__c?: string;
85
+ SBQQ__RenewalProductOptionProductId__c?: string;
86
+ SBQQ__RenewalProductOptionSubscriptionPricing__c?: string;
87
+ SBQQ__StartDate__c: string;
88
+ SBQQ__SubscriptionType__c: string;
89
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Connection, Schema, SObject } from 'jsforce';
2
+ import { Subscription } from './subscription.types';
3
+ export declare class Subscriptions {
4
+ private readonly connection;
5
+ client: SObject<Schema, 'SBQQ__Subscription__c'>;
6
+ constructor(connection: Connection);
7
+ getByContractNumber(contractNumber: string): Promise<Subscription[]>;
8
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Subscriptions = void 0;
4
+ class Subscriptions {
5
+ constructor(connection) {
6
+ this.connection = connection;
7
+ this.client = this.connection.sobject('SBQQ__Subscription__c');
8
+ }
9
+ async getByContractNumber(contractNumber) {
10
+ return this.client.find({ SBQQ__ContractNumber__c: contractNumber });
11
+ }
12
+ }
13
+ exports.Subscriptions = Subscriptions;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@pliancy/salesforce-cpq-sdk",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "license": "MIT",
6
+ "description": "Salesforce CPQ SDK for Node.js",
7
+ "private": false,
8
+ "dependencies": {
9
+ "jsforce": "3.4.1",
10
+ "tslib": "2.6.2"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/pliancy/salesforce-cpq-sdk"
18
+ },
19
+ "devDependencies": {
20
+ "@digitalroute/cz-conventional-changelog-for-jira": "8.0.1",
21
+ "@pliancy/eslint-config-ts": "1.1.1",
22
+ "@pliancy/semantic-release-config-npm": "2.2.0",
23
+ "@types/jest": "29.5.13",
24
+ "@types/node": "22.5.5",
25
+ "commitizen": "4.3.0",
26
+ "cz-conventional-changelog": "3.3.0",
27
+ "husky": "9.1.6",
28
+ "jest": "29.7.0",
29
+ "npm-run-all2": "5.0.2",
30
+ "pinst": "3.0.0",
31
+ "rimraf": "6.0.1",
32
+ "ts-jest": "29.2.5",
33
+ "typescript": "5.6.2"
34
+ },
35
+ "scripts": {
36
+ "build": "run-s -l clean test tsc",
37
+ "build:check": "tsc --noEmit",
38
+ "clean": "rimraf coverage dist tmp",
39
+ "lint": "eslint \"src/**/*.ts\" --fix",
40
+ "_postinstall": "husky",
41
+ "prepublishOnly": "pinst --disable",
42
+ "postpublish": "pinst --enable",
43
+ "qa": "run-s -l lint test clean build:check",
44
+ "semantic-release": "semantic-release",
45
+ "test": "jest",
46
+ "tsc": "tsc -p tsconfig.build.json"
47
+ },
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "author": {
52
+ "name": "Justin",
53
+ "email": "justin.mcmahon@pliancy.com"
54
+ },
55
+ "volta": {
56
+ "node": "22.9.0",
57
+ "yarn": "1.22.21"
58
+ },
59
+ "config": {
60
+ "commitizen": {
61
+ "path": "./node_modules/@digitalroute/cz-conventional-changelog-for-jira",
62
+ "skipScope": false
63
+ }
64
+ }
65
+ }