@pliancy/salesforce-cpq-sdk 3.13.0 → 3.14.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/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export * from './lib/orders/orders';
15
15
  export * from './lib/orders/order.types';
16
16
  export * from './lib/orders/order-items/order-items';
17
17
  export * from './lib/orders/order-items/order-item.types';
18
+ export * from './lib/custom/custom';
package/dist/index.js CHANGED
@@ -33,3 +33,4 @@ __exportStar(require("./lib/orders/orders"), exports);
33
33
  __exportStar(require("./lib/orders/order.types"), exports);
34
34
  __exportStar(require("./lib/orders/order-items/order-items"), exports);
35
35
  __exportStar(require("./lib/orders/order-items/order-item.types"), exports);
36
+ __exportStar(require("./lib/custom/custom"), exports);
package/dist/lib/cpq.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Accounts } from './accounts/accounts';
2
2
  import { CpqConfig } from './cpq.types';
3
- import { Connection } from 'jsforce';
3
+ import { Connection, Record } from 'jsforce';
4
4
  import { Contracts } from './contracts/contracts';
5
5
  import { Products } from './products/products';
6
6
  import { Subscriptions } from './subscriptions/subscriptions';
@@ -8,6 +8,7 @@ import { Quotes } from './quotes/quotes';
8
8
  import { Orders } from './orders/orders';
9
9
  import { OrderItems } from './orders/order-items/order-items';
10
10
  import { PriceBooks } from './price-books/price-books';
11
+ import { CustomCollection } from './custom/custom';
11
12
  export declare class Cpq {
12
13
  private readonly config;
13
14
  accounts: Accounts;
@@ -21,4 +22,5 @@ export declare class Cpq {
21
22
  subscriptions: Subscriptions;
22
23
  constructor(config: CpqConfig);
23
24
  authorize(): Promise<void>;
25
+ createCustomApi<T extends Record = Record>(collection: string): CustomCollection<T>;
24
26
  }
package/dist/lib/cpq.js CHANGED
@@ -10,6 +10,7 @@ const quotes_1 = require("./quotes/quotes");
10
10
  const orders_1 = require("./orders/orders");
11
11
  const order_items_1 = require("./orders/order-items/order-items");
12
12
  const price_books_1 = require("./price-books/price-books");
13
+ const custom_1 = require("./custom/custom");
13
14
  class Cpq {
14
15
  constructor(config) {
15
16
  this.config = config;
@@ -26,5 +27,8 @@ class Cpq {
26
27
  async authorize() {
27
28
  await this.connection.authorize({ grant_type: 'client_credentials' });
28
29
  }
30
+ createCustomApi(collection) {
31
+ return new custom_1.CustomCollection(this.connection, collection);
32
+ }
29
33
  }
30
34
  exports.Cpq = Cpq;
@@ -0,0 +1,10 @@
1
+ import { Connection, QueryCondition, Schema, Record, SObjectUpdateRecord, SaveResult } from 'jsforce';
2
+ export declare class CustomCollection<T extends Record = Record> {
3
+ private readonly connection;
4
+ private readonly collection;
5
+ private readonly client;
6
+ constructor(connection: Connection, collection: string);
7
+ getMany(query: QueryCondition<Schema, typeof this.collection>): Promise<T[]>;
8
+ getOne(query: QueryCondition<Schema, typeof this.collection>): Promise<T>;
9
+ updateOne(query: SObjectUpdateRecord<Schema, typeof this.collection>): Promise<SaveResult>;
10
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomCollection = void 0;
4
+ class CustomCollection {
5
+ constructor(connection, collection) {
6
+ this.connection = connection;
7
+ this.collection = collection;
8
+ this.client = this.connection.sobject(this.collection);
9
+ }
10
+ async getMany(query) {
11
+ return this.client.find(query);
12
+ }
13
+ async getOne(query) {
14
+ return this.client.findOne(query);
15
+ }
16
+ async updateOne(query) {
17
+ return this.client.update(query);
18
+ }
19
+ }
20
+ exports.CustomCollection = CustomCollection;
@@ -5,6 +5,7 @@ export declare class Subscriptions extends Base<SubscriptionEntity> {
5
5
  private readonly connection;
6
6
  client: SObject<Schema, SubscriptionEntity>;
7
7
  constructor(connection: Connection);
8
+ getById(id: string): Promise<Subscription>;
8
9
  getByContractNumber(contractNumber: string, options?: SubscriptionQuery): Promise<Subscription[]>;
9
10
  update(id: string, update: Partial<Omit<Subscription, 'Id'>>, options?: SubscriptionQuery): Promise<SaveResult>;
10
11
  }
@@ -9,6 +9,9 @@ class Subscriptions extends base_1.Base {
9
9
  this.connection = connection;
10
10
  this.client = this.connection.sobject(subscription_types_1.SubscriptionsCollection);
11
11
  }
12
+ async getById(id) {
13
+ return this.client.findOne({ Id: id });
14
+ }
12
15
  async getByContractNumber(contractNumber, options) {
13
16
  const base = { SBQQ__ContractNumber__c: contractNumber };
14
17
  const query = this.buildQuery(base, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pliancy/salesforce-cpq-sdk",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "description": "Salesforce CPQ SDK for Node.js",