@partium/js-sdk 14.2.0 → 14.4.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.
|
@@ -78,29 +78,22 @@ var PaginatedRequestServiceImpl = /** @class */ (function () {
|
|
|
78
78
|
return this.paginatedList && this.paginatedList.moreResultsAvailable();
|
|
79
79
|
};
|
|
80
80
|
PaginatedRequestServiceImpl.prototype.loadMore = function () {
|
|
81
|
-
if (this.cursorPaginationEnabled) {
|
|
82
|
-
/* this.paginatedList.nextPage (the BE value) returns :
|
|
83
|
-
http://api.beta.partium.io/v3/assemblies?cursor=cj0xJnA9MzY2OTE2&max_depth=1&page_size=5&paginator=cursor&root_nodes=true
|
|
84
|
-
it does not work because we need:
|
|
85
|
-
https://api.beta.partium.io/1/_data/assemblies?cursor=cj0xJnA9MzY2OTE2&max_depth=1&page_size=5&paginator=cursor&root_nodes=true
|
|
86
|
-
we only need to append the cursor to the current url and not to fetch the whole url returned by the BE
|
|
87
|
-
TODO fix in FND-2382
|
|
88
|
-
*/
|
|
89
|
-
var nextPageParams = this.paginatedList.nextPage.split('?');
|
|
90
|
-
var urlParams = new URLSearchParams(nextPageParams[1]);
|
|
91
|
-
this.urlParams = this.removeUrlParam(this.urlParams, 'cursor');
|
|
92
|
-
this.urlParams = __spreadArray(__spreadArray([], this.urlParams, true), [{ cursor: urlParams.get('cursor') }], false);
|
|
93
|
-
return this.loadPage(null);
|
|
94
|
-
}
|
|
95
81
|
if (!this.isInitialPageLoaded()) {
|
|
96
|
-
// no search active/initial result not yet returned
|
|
97
82
|
return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.INITIAL_ITEMS_NOT_YET_LOADED, null));
|
|
98
83
|
}
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
84
|
+
if (this.cursorPaginationEnabled) {
|
|
85
|
+
// For cursor pagination, check if nextPage is available
|
|
86
|
+
if (!this.paginatedList.nextPage) {
|
|
87
|
+
return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_MORE_ITEMS_AVAILABLE, null, 'can not load more items, last page reached'));
|
|
88
|
+
}
|
|
89
|
+
// Use the nextPage URL directly without incrementing pageIdx
|
|
90
|
+
return this.loadPage(this.paginatedList.currentPageIdx);
|
|
102
91
|
}
|
|
103
92
|
else {
|
|
93
|
+
// For regular pagination, check if we are at the last page
|
|
94
|
+
if (this.paginatedList.currentPageIdx >= this.paginatedList.totalPages) {
|
|
95
|
+
return (0, rxjs_1.throwError)(new error_1.SdkError(error_1.SDK_ERROR_CODES.NO_MORE_ITEMS_AVAILABLE, null, 'can not load more items, last page reached'));
|
|
96
|
+
}
|
|
104
97
|
return this.loadPage(this.paginatedList.currentPageIdx + 1);
|
|
105
98
|
}
|
|
106
99
|
};
|
|
@@ -136,10 +129,21 @@ var PaginatedRequestServiceImpl = /** @class */ (function () {
|
|
|
136
129
|
*/
|
|
137
130
|
PaginatedRequestServiceImpl.prototype.fetchPaginatedListFromServer = function (pageIdx) {
|
|
138
131
|
var _this = this;
|
|
132
|
+
var _a;
|
|
133
|
+
var requestUrl;
|
|
134
|
+
var requestParams;
|
|
135
|
+
if (this.cursorPaginationEnabled && ((_a = this.paginatedList) === null || _a === void 0 ? void 0 : _a.nextPage)) {
|
|
136
|
+
requestUrl = this.paginatedList.nextPage;
|
|
137
|
+
requestParams = [];
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
requestUrl = this.url;
|
|
141
|
+
requestParams = __spreadArray(__spreadArray([], this.urlParams, true), [
|
|
142
|
+
__assign({}, (!!this.cursorPaginationEnabled ? { paginator: 'cursor' } : { page: pageIdx })),
|
|
143
|
+
], false);
|
|
144
|
+
}
|
|
139
145
|
return this.httpsService
|
|
140
|
-
.get(
|
|
141
|
-
__assign({}, (!!this.cursorPaginationEnabled ? { paginator: 'cursor' } : { page: pageIdx })),
|
|
142
|
-
], false), this.backendService)
|
|
146
|
+
.get(requestUrl, requestParams, this.backendService)
|
|
143
147
|
.pipe((0, operators_1.map)(function (res) {
|
|
144
148
|
var items = res['results'].map(function (resItem) { return _this.createObject(resItem); });
|
|
145
149
|
var list = new paginated_list_1.PaginatedList(items, pageIdx || undefined, !!res['pagination']['items_count'] || res['pagination']['items_count'] === 0
|
package/gen/sdk-version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Copyright © 2022-2025 Partium, Inc. DBA Partium
|
|
2
|
-
export declare const SDK_VERSION_NUMBER = "14.
|
|
2
|
+
export declare const SDK_VERSION_NUMBER = "14.4.0";
|
package/gen/sdk-version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@partium/js-sdk",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.0",
|
|
4
4
|
"author": "Partium Inc.",
|
|
5
5
|
"license": "See LICENSE.txt",
|
|
6
6
|
"description": "The Partium Find SDK enables integration of Partium’s parts and materials search capabilities into JavaScript-based applications.",
|