jitz-sharepoint-utilities 2.0.6 → 2.0.7
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/data/context/List.ts
CHANGED
@@ -149,6 +149,25 @@ export default class List<T extends IModel> implements IList<T> {
|
|
149
149
|
}
|
150
150
|
}
|
151
151
|
|
152
|
+
getItemsIndexedRecursive = async (filter: string): Promise<T[]> => {
|
153
|
+
var results = await this.getItemsIndexed(filter);
|
154
|
+
var moreData: any[] = await this.continueFetch();
|
155
|
+
results = [...results, ...moreData];
|
156
|
+
return results;
|
157
|
+
};
|
158
|
+
|
159
|
+
continueFetch = async () => {
|
160
|
+
var data: any[] = [];
|
161
|
+
try {
|
162
|
+
data = await this.loadMoreIndexed();
|
163
|
+
if (this.lowerId > 0) {
|
164
|
+
var moreData: any[] = await this.continueFetch();
|
165
|
+
data = [...data, ...moreData];
|
166
|
+
}
|
167
|
+
} catch {}
|
168
|
+
return data;
|
169
|
+
};
|
170
|
+
|
152
171
|
getData = async (filter: string): Promise<T[]> => {
|
153
172
|
var expandFields = (
|
154
173
|
[...this.lookUpFields, ...this.userTypeFields] || []
|
package/data/interfaces/IList.ts
CHANGED
@@ -22,6 +22,8 @@ export default class List<T extends IModel> implements IList<T> {
|
|
22
22
|
loadMore: () => Promise<T[]>;
|
23
23
|
getItemsIndexed: (filterQuery?: string, orderby?: string, top?: number) => Promise<T[]>;
|
24
24
|
loadMoreIndexed(): Promise<T[]>;
|
25
|
+
getItemsIndexedRecursive: (filter: string) => Promise<T[]>;
|
26
|
+
continueFetch: () => Promise<any[]>;
|
25
27
|
getData: (filter: string) => Promise<T[]>;
|
26
28
|
private getLowerId;
|
27
29
|
getItemById: (id: number) => Promise<T>;
|
package/lib/data/context/List.js
CHANGED
@@ -140,6 +140,47 @@ var List = /** @class */ (function () {
|
|
140
140
|
}
|
141
141
|
});
|
142
142
|
}); };
|
143
|
+
this.getItemsIndexedRecursive = function (filter) { return __awaiter(_this, void 0, void 0, function () {
|
144
|
+
var results, moreData;
|
145
|
+
return __generator(this, function (_a) {
|
146
|
+
switch (_a.label) {
|
147
|
+
case 0: return [4 /*yield*/, this.getItemsIndexed(filter)];
|
148
|
+
case 1:
|
149
|
+
results = _a.sent();
|
150
|
+
return [4 /*yield*/, this.continueFetch()];
|
151
|
+
case 2:
|
152
|
+
moreData = _a.sent();
|
153
|
+
results = __spreadArray(__spreadArray([], results, true), moreData, true);
|
154
|
+
return [2 /*return*/, results];
|
155
|
+
}
|
156
|
+
});
|
157
|
+
}); };
|
158
|
+
this.continueFetch = function () { return __awaiter(_this, void 0, void 0, function () {
|
159
|
+
var data, moreData, _a;
|
160
|
+
return __generator(this, function (_b) {
|
161
|
+
switch (_b.label) {
|
162
|
+
case 0:
|
163
|
+
data = [];
|
164
|
+
_b.label = 1;
|
165
|
+
case 1:
|
166
|
+
_b.trys.push([1, 5, , 6]);
|
167
|
+
return [4 /*yield*/, this.loadMoreIndexed()];
|
168
|
+
case 2:
|
169
|
+
data = _b.sent();
|
170
|
+
if (!(this.lowerId > 0)) return [3 /*break*/, 4];
|
171
|
+
return [4 /*yield*/, this.continueFetch()];
|
172
|
+
case 3:
|
173
|
+
moreData = _b.sent();
|
174
|
+
data = __spreadArray(__spreadArray([], data, true), moreData, true);
|
175
|
+
_b.label = 4;
|
176
|
+
case 4: return [3 /*break*/, 6];
|
177
|
+
case 5:
|
178
|
+
_a = _b.sent();
|
179
|
+
return [3 /*break*/, 6];
|
180
|
+
case 6: return [2 /*return*/, data];
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}); };
|
143
184
|
this.getData = function (filter) { return __awaiter(_this, void 0, void 0, function () {
|
144
185
|
var expandFields, selectFields, response;
|
145
186
|
return __generator(this, function (_a) {
|
@@ -15,6 +15,7 @@ export interface IList<T extends IModel> {
|
|
15
15
|
delete(id: number): Promise<boolean>;
|
16
16
|
getItemsIndexed(filterQuery?: string, orderby?: string, top?: number): Promise<T[]>;
|
17
17
|
loadMoreIndexed(): Promise<T[]>;
|
18
|
+
getItemsIndexedRecursive(filterQuery?: string): Promise<T[]>;
|
18
19
|
_nextPageLink?: string;
|
19
20
|
top: number;
|
20
21
|
indexLimit: number;
|