@tillhub/javascript-sdk 4.238.0 → 4.239.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/CHANGELOG.md +7 -0
- package/dist/types/v2/products.d.ts +21 -0
- package/dist/v2/products.js +45 -4
- package/dist/v2/products.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [4.239.0](https://github.com/tillhub/tillhub-sdk-javascript/compare/v4.238.0...v4.239.0) (2025-11-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **products:** add getAll function for v2 products endpoint (UNTIL-15271) ([#692](https://github.com/tillhub/tillhub-sdk-javascript/issues/692)) ([ec7b0aa](https://github.com/tillhub/tillhub-sdk-javascript/commit/ec7b0aac26359ddc1c7eba40161e4d8b56f18e57))
|
|
7
|
+
|
|
1
8
|
# [4.238.0](https://github.com/tillhub/tillhub-sdk-javascript/compare/v4.237.0...v4.238.0) (2025-11-06)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -72,11 +72,26 @@ export interface StockConfigurationLocation {
|
|
|
72
72
|
reorder_qty?: number | null;
|
|
73
73
|
reorder_point?: number | null;
|
|
74
74
|
}
|
|
75
|
+
export interface ProductsQuery {
|
|
76
|
+
deleted?: boolean;
|
|
77
|
+
active?: boolean;
|
|
78
|
+
exclude_system_products?: boolean;
|
|
79
|
+
location?: string;
|
|
80
|
+
extended?: boolean;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}
|
|
75
83
|
export interface ProductsOptions {
|
|
76
84
|
user?: string;
|
|
77
85
|
base?: string;
|
|
78
86
|
limit?: number;
|
|
79
87
|
uri?: string;
|
|
88
|
+
query?: ProductsQuery;
|
|
89
|
+
}
|
|
90
|
+
export interface ProductsResponse {
|
|
91
|
+
data?: Product[];
|
|
92
|
+
metaData?: Record<string, unknown>;
|
|
93
|
+
msg?: string;
|
|
94
|
+
next?: () => Promise<ProductsResponse>;
|
|
80
95
|
}
|
|
81
96
|
export interface ProductsBulkImportResponse {
|
|
82
97
|
msg?: string;
|
|
@@ -92,6 +107,7 @@ export declare class Products extends ThBaseHandler {
|
|
|
92
107
|
options: ProductsOptions;
|
|
93
108
|
uriHelper: UriHelper;
|
|
94
109
|
constructor(options: ProductsOptions, http: Client);
|
|
110
|
+
getAll(options?: ProductsOptions | undefined): Promise<ProductsResponse>;
|
|
95
111
|
bulkImport(payload: ProductsBulkImportRequestObject): Promise<ProductsBulkImportResponse>;
|
|
96
112
|
}
|
|
97
113
|
export declare class ProductsBulkImportFailed extends BaseError {
|
|
@@ -99,4 +115,9 @@ export declare class ProductsBulkImportFailed extends BaseError {
|
|
|
99
115
|
name: string;
|
|
100
116
|
constructor(message?: string, properties?: Record<string, unknown>);
|
|
101
117
|
}
|
|
118
|
+
export declare class ProductsFetchFailed extends BaseError {
|
|
119
|
+
message: string;
|
|
120
|
+
name: string;
|
|
121
|
+
constructor(message?: string, properties?: Record<string, unknown>);
|
|
122
|
+
}
|
|
102
123
|
export {};
|
package/dist/v2/products.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProductsBulkImportFailed = exports.Products = void 0;
|
|
3
|
+
exports.ProductsFetchFailed = exports.ProductsBulkImportFailed = exports.Products = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var baseError_1 = require("../errors/baseError");
|
|
6
6
|
var uri_helper_1 = require("../uri-helper");
|
|
@@ -20,9 +20,37 @@ var Products = (function (_super) {
|
|
|
20
20
|
_this.uriHelper = new uri_helper_1.UriHelper(_this.endpoint, _this.options);
|
|
21
21
|
return _this;
|
|
22
22
|
}
|
|
23
|
+
Products.prototype.getAll = function (options) {
|
|
24
|
+
var _a;
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
26
|
+
var base, uri, response, error_1;
|
|
27
|
+
return tslib_1.__generator(this, function (_b) {
|
|
28
|
+
switch (_b.label) {
|
|
29
|
+
case 0:
|
|
30
|
+
_b.trys.push([0, 2, , 3]);
|
|
31
|
+
base = this.uriHelper.generateBaseUri();
|
|
32
|
+
uri = this.uriHelper.generateUriWithQuery(base, options);
|
|
33
|
+
return [4, this.http.getClient().get(uri)];
|
|
34
|
+
case 1:
|
|
35
|
+
response = _b.sent();
|
|
36
|
+
if (response.status !== 200) {
|
|
37
|
+
throw new ProductsFetchFailed(undefined, { status: response.status });
|
|
38
|
+
}
|
|
39
|
+
return [2, {
|
|
40
|
+
data: response.data.results,
|
|
41
|
+
metaData: { count: ((_a = response.data.pagination) === null || _a === void 0 ? void 0 : _a.total) || 0, pagination: response.data.pagination }
|
|
42
|
+
}];
|
|
43
|
+
case 2:
|
|
44
|
+
error_1 = _b.sent();
|
|
45
|
+
throw new ProductsFetchFailed(error_1.message, { error: error_1 });
|
|
46
|
+
case 3: return [2];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
23
51
|
Products.prototype.bulkImport = function (payload) {
|
|
24
52
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
25
|
-
var uri, response,
|
|
53
|
+
var uri, response, error_2;
|
|
26
54
|
return tslib_1.__generator(this, function (_a) {
|
|
27
55
|
switch (_a.label) {
|
|
28
56
|
case 0:
|
|
@@ -40,8 +68,8 @@ var Products = (function (_super) {
|
|
|
40
68
|
msg: response.data.msg
|
|
41
69
|
}];
|
|
42
70
|
case 3:
|
|
43
|
-
|
|
44
|
-
throw new ProductsBulkImportFailed(
|
|
71
|
+
error_2 = _a.sent();
|
|
72
|
+
throw new ProductsBulkImportFailed(error_2.message, { error: error_2 });
|
|
45
73
|
case 4: return [2];
|
|
46
74
|
}
|
|
47
75
|
});
|
|
@@ -64,4 +92,17 @@ var ProductsBulkImportFailed = (function (_super) {
|
|
|
64
92
|
return ProductsBulkImportFailed;
|
|
65
93
|
}(baseError_1.BaseError));
|
|
66
94
|
exports.ProductsBulkImportFailed = ProductsBulkImportFailed;
|
|
95
|
+
var ProductsFetchFailed = (function (_super) {
|
|
96
|
+
tslib_1.__extends(ProductsFetchFailed, _super);
|
|
97
|
+
function ProductsFetchFailed(message, properties) {
|
|
98
|
+
if (message === void 0) { message = 'Could not fetch products'; }
|
|
99
|
+
var _this = _super.call(this, message, properties) || this;
|
|
100
|
+
_this.message = message;
|
|
101
|
+
_this.name = 'ProductsFetchFailed';
|
|
102
|
+
Object.setPrototypeOf(_this, ProductsFetchFailed.prototype);
|
|
103
|
+
return _this;
|
|
104
|
+
}
|
|
105
|
+
return ProductsFetchFailed;
|
|
106
|
+
}(baseError_1.BaseError));
|
|
107
|
+
exports.ProductsFetchFailed = ProductsFetchFailed;
|
|
67
108
|
//# sourceMappingURL=products.js.map
|
package/dist/v2/products.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/v2/products.ts"],"names":[],"mappings":";;;;AACA,iDAA+C;AAC/C,4CAAyC;AACzC,gCAAuC;
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/v2/products.ts"],"names":[],"mappings":";;;;AACA,iDAA+C;AAC/C,4CAAyC;AACzC,gCAAuC;AAmHvC;IAA8B,oCAAa;IAOzC,kBAAa,OAAwB,EAAE,IAAY;;QAAnD,YACE,kBAAM,IAAI,EAAE;YACV,QAAQ,EAAE,QAAQ,CAAC,YAAY;YAC/B,IAAI,QAAE,OAAO,CAAC,IAAI,mCAAI,yBAAyB;SAChD,CAAC,SAOH;QANC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAEhB,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAA;QACrC,KAAI,CAAC,OAAO,CAAC,IAAI,SAAG,KAAI,CAA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