@pliancy/salesforce-cpq-sdk 3.20.0 → 3.22.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.
|
@@ -7,4 +7,5 @@ export declare class CustomCollection<T extends Record = Record> {
|
|
|
7
7
|
getMany(query: QueryCondition<Schema, typeof this.collection>): Promise<T[]>;
|
|
8
8
|
getOne(query: QueryCondition<Schema, typeof this.collection>): Promise<T>;
|
|
9
9
|
updateOne(query: SObjectUpdateRecord<Schema, typeof this.collection>): Promise<SaveResult>;
|
|
10
|
+
create(record: Partial<T>): Promise<T>;
|
|
10
11
|
}
|
|
@@ -16,5 +16,9 @@ class CustomCollection {
|
|
|
16
16
|
async updateOne(query) {
|
|
17
17
|
return this.client.update(query);
|
|
18
18
|
}
|
|
19
|
+
async create(record) {
|
|
20
|
+
const res = await this.client.create(record);
|
|
21
|
+
return this.getOne({ Id: res.id });
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
exports.CustomCollection = CustomCollection;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Connection, QueryCondition, Schema } from 'jsforce';
|
|
2
|
-
import { Product } from './product.types';
|
|
3
|
-
|
|
1
|
+
import { Connection, QueryCondition, SaveResult, Schema } from 'jsforce';
|
|
2
|
+
import { Product, ProductEntity } from './product.types';
|
|
3
|
+
import { Base } from '../base/base';
|
|
4
|
+
export declare class Products extends Base<ProductEntity> {
|
|
4
5
|
private readonly connection;
|
|
5
6
|
private readonly client;
|
|
6
7
|
private readonly options;
|
|
7
8
|
constructor(connection: Connection);
|
|
8
|
-
get(query: QueryCondition<Schema,
|
|
9
|
+
get(query: QueryCondition<Schema, ProductEntity>): Promise<Product[]>;
|
|
9
10
|
getById(id: string): Promise<Product | null>;
|
|
10
11
|
getOptionsByProductCode(code: string): Promise<import("./product-options/product-option.types").ProductOption[]>;
|
|
12
|
+
update(id: string, update: Partial<Omit<Product, 'Id'>>, options?: QueryCondition<Schema, ProductEntity>): Promise<SaveResult>;
|
|
11
13
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Products = void 0;
|
|
4
|
+
const product_types_1 = require("./product.types");
|
|
4
5
|
const product_options_1 = require("./product-options/product-options");
|
|
5
|
-
|
|
6
|
+
const base_1 = require("../base/base");
|
|
7
|
+
class Products extends base_1.Base {
|
|
6
8
|
constructor(connection) {
|
|
9
|
+
super();
|
|
7
10
|
this.connection = connection;
|
|
8
|
-
this.client = this.connection.sobject(
|
|
11
|
+
this.client = this.connection.sobject(product_types_1.ProductsCollection);
|
|
9
12
|
this.options = new product_options_1.ProductOptions(this.connection);
|
|
10
13
|
}
|
|
11
14
|
async get(query) {
|
|
@@ -14,8 +17,12 @@ class Products {
|
|
|
14
17
|
async getById(id) {
|
|
15
18
|
return this.client.findOne({ Id: id });
|
|
16
19
|
}
|
|
17
|
-
getOptionsByProductCode(code) {
|
|
20
|
+
async getOptionsByProductCode(code) {
|
|
18
21
|
return this.options.getByProductCode(code);
|
|
19
22
|
}
|
|
23
|
+
async update(id, update, options) {
|
|
24
|
+
const query = this.buildQuery({ Id: id, ...update }, options);
|
|
25
|
+
return this.client.update(query);
|
|
26
|
+
}
|
|
20
27
|
}
|
|
21
28
|
exports.Products = Products;
|