@pliancy/salesforce-cpq-sdk 3.3.0 → 3.5.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,8 +1,9 @@
1
- import { Connection } from 'jsforce';
1
+ import { Connection, QueryCondition, Schema } from 'jsforce';
2
2
  import { Product } from './product.types';
3
3
  export declare class Products {
4
4
  private readonly connection;
5
5
  private readonly client;
6
6
  constructor(connection: Connection);
7
+ get(query: QueryCondition<Schema, 'Product2'>): Promise<Product[]>;
7
8
  getById(id: string): Promise<Product | null>;
8
9
  }
@@ -6,6 +6,9 @@ class Products {
6
6
  this.connection = connection;
7
7
  this.client = this.connection.sobject('Product2');
8
8
  }
9
+ async get(query) {
10
+ return this.client.find(query);
11
+ }
9
12
  async getById(id) {
10
13
  return this.client.findOne({ Id: id });
11
14
  }
@@ -7,4 +7,5 @@ export declare class QuoteLines {
7
7
  constructor(connection: Connection);
8
8
  getByQuoteId(id: string): Promise<QuoteLine[]>;
9
9
  update(items: UpdateQuoteLinesRequest): Promise<SaveResult[]>;
10
+ delete(ids: string[]): Promise<SaveResult[]>;
10
11
  }
@@ -12,5 +12,8 @@ class QuoteLines {
12
12
  async update(items) {
13
13
  return this.client.update(items);
14
14
  }
15
+ async delete(ids) {
16
+ return this.client.delete(ids);
17
+ }
15
18
  }
16
19
  exports.QuoteLines = QuoteLines;
@@ -103,8 +103,12 @@ export declare enum QuoteType {
103
103
  export type QuoteWithLineItems = Quote & {
104
104
  lineItems: QuoteLine[];
105
105
  };
106
- export type UpdateQuoteLine = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
107
- export type UpdateQuoteLinesRequest = UpdateQuoteLine[];
106
+ export type UpdateQuoteLineQuantities = Pick<QuoteLine, 'Id' | 'SBQQ__Quantity__c'>;
107
+ export interface UpdateQuoteLine {
108
+ Id: string;
109
+ [index: string]: keyof QuoteLine;
110
+ }
111
+ export type UpdateQuoteLinesRequest = UpdateQuoteLineQuantities[] | UpdateQuoteLine[];
108
112
  export declare enum ApprovalStatus {
109
113
  APPROVED = "Approved",
110
114
  REJECTED = "Rejected",
@@ -1,5 +1,5 @@
1
1
  import { Connection, SaveResult } from 'jsforce';
2
- import { Quote, QuoteQuery, QuoteWithLineItems, UpdateQuoteLine, UpdateQuoteQuery } from './quote.types';
2
+ import { Quote, QuoteQuery, QuoteWithLineItems, UpdateQuoteLineQuantities, UpdateQuoteLine, UpdateQuoteQuery } from './quote.types';
3
3
  export declare class Quotes {
4
4
  private readonly connection;
5
5
  private readonly client;
@@ -10,7 +10,9 @@ export declare class Quotes {
10
10
  getByAccountId(accountId: string, options?: QuoteQuery): Promise<QuoteWithLineItems[]>;
11
11
  getOriginal(accountId: string): Promise<Quote | undefined>;
12
12
  update(quoteId: string, query: Partial<Omit<Quote, 'Id'>>): Promise<SaveResult>;
13
- updateLineItemQuantities(lineItems: UpdateQuoteLine[]): Promise<SaveResult[]>;
13
+ updateLineItemQuantities(lineItems: UpdateQuoteLineQuantities[]): Promise<SaveResult[]>;
14
+ updateLineItems(lineItems: UpdateQuoteLine[]): Promise<SaveResult[]>;
15
+ deleteLineItems(ids: string[]): Promise<SaveResult[]>;
14
16
  order(quoteId: string, options?: UpdateQuoteQuery): Promise<SaveResult>;
15
17
  submitAndApprove(quoteId: string, comments?: string): Promise<{
16
18
  success: boolean;
@@ -62,6 +62,12 @@ class Quotes {
62
62
  async updateLineItemQuantities(lineItems) {
63
63
  return this.items.update(lineItems);
64
64
  }
65
+ async updateLineItems(lineItems) {
66
+ return this.items.update(lineItems);
67
+ }
68
+ async deleteLineItems(ids) {
69
+ return this.items.delete(ids);
70
+ }
65
71
  async order(quoteId, options) {
66
72
  const query = this.buildQuery({ Id: quoteId, SBQQ__Ordered__c: true }, options);
67
73
  return this.client.update(query);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pliancy/salesforce-cpq-sdk",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "description": "Salesforce CPQ SDK for Node.js",