d5-api-initializer 1.5.3 → 1.5.4
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/package.json
CHANGED
|
@@ -260,6 +260,42 @@ var ApiResponse = class {
|
|
|
260
260
|
this._jsWapiResponse.setPagesPredict(pagesPredict);
|
|
261
261
|
return this;
|
|
262
262
|
}
|
|
263
|
+
sendZip({ name, contentType = "application/zip", files }) {
|
|
264
|
+
return this._jsWapiResponse.sendZip({
|
|
265
|
+
name,
|
|
266
|
+
contentType,
|
|
267
|
+
callback: (zip) => {
|
|
268
|
+
files.forEach((file) => {
|
|
269
|
+
const isEmptyDirectory = !file.objectName && !file.operation && !file.keyValue && !file.field;
|
|
270
|
+
if (isEmptyDirectory) {
|
|
271
|
+
zip.add({ name: file.name });
|
|
272
|
+
} else {
|
|
273
|
+
zip.add({
|
|
274
|
+
name: file.name,
|
|
275
|
+
file: {
|
|
276
|
+
object: file.objectName,
|
|
277
|
+
oper: file.operation || "List",
|
|
278
|
+
keyValue: file.keyValue,
|
|
279
|
+
field: file.field
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
sendFile({ name, contentType, file }) {
|
|
288
|
+
return this._jsWapiResponse.sendFile({
|
|
289
|
+
name,
|
|
290
|
+
contentType,
|
|
291
|
+
file: {
|
|
292
|
+
object: file.objectName,
|
|
293
|
+
oper: file.operation || "List",
|
|
294
|
+
keyValue: file.keyValue,
|
|
295
|
+
field: file.field
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
263
299
|
};
|
|
264
300
|
|
|
265
301
|
// src/classes/ApiInvoker.ts
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
type SendZipJsWapiArgs = {
|
|
2
|
+
name: string;
|
|
3
|
+
contentType?: string;
|
|
4
|
+
callback: (zip: any) => void;
|
|
5
|
+
};
|
|
6
|
+
type SendFileJsWapiArgs = {
|
|
7
|
+
name: string;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
file: {
|
|
10
|
+
object: string;
|
|
11
|
+
oper: string;
|
|
12
|
+
keyValue: any;
|
|
13
|
+
field: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
1
16
|
declare namespace jsWapi {
|
|
2
17
|
interface JSRequestModesSetter {
|
|
3
18
|
setAutocompleteLinkedObjectFields(isAutocompleteLinkedObjectFields: boolean): void;
|
|
@@ -95,6 +110,8 @@ declare namespace jsWapi {
|
|
|
95
110
|
sendHttpResponse(body: string | BinaryDataStream): void;
|
|
96
111
|
sendHttpResponse(headers: Record<string, any>, body: string | BinaryDataStream): void;
|
|
97
112
|
getPagesPredict(): number;
|
|
113
|
+
sendZip({ name, contentType, callback }: SendZipJsWapiArgs): void;
|
|
114
|
+
sendFile({ name, contentType, file }: SendFileJsWapiArgs): void;
|
|
98
115
|
setPagesPredict(pagesPredict: number): void;
|
|
99
116
|
getPage(): number;
|
|
100
117
|
setPage(page: number): void;
|
|
@@ -280,6 +297,23 @@ declare class ApiHttpRequest {
|
|
|
280
297
|
private _getWrappedCallback;
|
|
281
298
|
}
|
|
282
299
|
|
|
300
|
+
type FileEntry = {
|
|
301
|
+
name: string;
|
|
302
|
+
objectName?: string;
|
|
303
|
+
operation?: string;
|
|
304
|
+
keyValue?: any;
|
|
305
|
+
field?: string;
|
|
306
|
+
};
|
|
307
|
+
type SendZipOptions = {
|
|
308
|
+
name: string;
|
|
309
|
+
contentType?: string;
|
|
310
|
+
files: FileEntry[];
|
|
311
|
+
};
|
|
312
|
+
type SendFileOptions = {
|
|
313
|
+
name: string;
|
|
314
|
+
contentType?: string;
|
|
315
|
+
file: FileEntry;
|
|
316
|
+
};
|
|
283
317
|
declare class ApiResponse {
|
|
284
318
|
private _jsWapiResponse;
|
|
285
319
|
private readonly _objectName;
|
|
@@ -296,6 +330,8 @@ declare class ApiResponse {
|
|
|
296
330
|
setPage(page: number): this;
|
|
297
331
|
getPagesPredict(): number;
|
|
298
332
|
setPagesPredict(pagesPredict: number): this;
|
|
333
|
+
sendZip({ name, contentType, files }: SendZipOptions): void;
|
|
334
|
+
sendFile({ name, contentType, file }: SendFileOptions): void;
|
|
299
335
|
}
|
|
300
336
|
|
|
301
337
|
interface IInvoker$1<T> {
|
|
@@ -221,6 +221,42 @@ var ApiResponse = class {
|
|
|
221
221
|
this._jsWapiResponse.setPagesPredict(pagesPredict);
|
|
222
222
|
return this;
|
|
223
223
|
}
|
|
224
|
+
sendZip({ name, contentType = "application/zip", files }) {
|
|
225
|
+
return this._jsWapiResponse.sendZip({
|
|
226
|
+
name,
|
|
227
|
+
contentType,
|
|
228
|
+
callback: (zip) => {
|
|
229
|
+
files.forEach((file) => {
|
|
230
|
+
const isEmptyDirectory = !file.objectName && !file.operation && !file.keyValue && !file.field;
|
|
231
|
+
if (isEmptyDirectory) {
|
|
232
|
+
zip.add({ name: file.name });
|
|
233
|
+
} else {
|
|
234
|
+
zip.add({
|
|
235
|
+
name: file.name,
|
|
236
|
+
file: {
|
|
237
|
+
object: file.objectName,
|
|
238
|
+
oper: file.operation || "List",
|
|
239
|
+
keyValue: file.keyValue,
|
|
240
|
+
field: file.field
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
sendFile({ name, contentType, file }) {
|
|
249
|
+
return this._jsWapiResponse.sendFile({
|
|
250
|
+
name,
|
|
251
|
+
contentType,
|
|
252
|
+
file: {
|
|
253
|
+
object: file.objectName,
|
|
254
|
+
oper: file.operation || "List",
|
|
255
|
+
keyValue: file.keyValue,
|
|
256
|
+
field: file.field
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
224
260
|
};
|
|
225
261
|
|
|
226
262
|
// src/classes/ApiInvoker.ts
|
|
@@ -221,6 +221,42 @@ var ApiResponse = class {
|
|
|
221
221
|
this._jsWapiResponse.setPagesPredict(pagesPredict);
|
|
222
222
|
return this;
|
|
223
223
|
}
|
|
224
|
+
sendZip({ name, contentType = "application/zip", files }) {
|
|
225
|
+
return this._jsWapiResponse.sendZip({
|
|
226
|
+
name,
|
|
227
|
+
contentType,
|
|
228
|
+
callback: (zip) => {
|
|
229
|
+
files.forEach((file) => {
|
|
230
|
+
const isEmptyDirectory = !file.objectName && !file.operation && !file.keyValue && !file.field;
|
|
231
|
+
if (isEmptyDirectory) {
|
|
232
|
+
zip.add({ name: file.name });
|
|
233
|
+
} else {
|
|
234
|
+
zip.add({
|
|
235
|
+
name: file.name,
|
|
236
|
+
file: {
|
|
237
|
+
object: file.objectName,
|
|
238
|
+
oper: file.operation || "List",
|
|
239
|
+
keyValue: file.keyValue,
|
|
240
|
+
field: file.field
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
sendFile({ name, contentType, file }) {
|
|
249
|
+
return this._jsWapiResponse.sendFile({
|
|
250
|
+
name,
|
|
251
|
+
contentType,
|
|
252
|
+
file: {
|
|
253
|
+
object: file.objectName,
|
|
254
|
+
oper: file.operation || "List",
|
|
255
|
+
keyValue: file.keyValue,
|
|
256
|
+
field: file.field
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
224
260
|
};
|
|
225
261
|
|
|
226
262
|
// src/classes/ApiInvoker.ts
|