d5-api-initializer 1.0.3 → 1.1.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/README.md
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Для локальної роботи з даною бібліотекою потрібно слідувати наступної інструкції -
|
|
2
|
+
1. Підключаємо бібліотеку через команду yarn link.
|
|
3
|
+
2. На проекті, до якого треба підключити дану бібліотеку, виконуємо команду yarn link "d5-api-initializer".
|
|
4
|
+
3. Білдимо бібліотеку через команду yarn compile.
|
|
5
|
+
|
|
6
|
+
Ура, все підключилось. Тепер ви можете користуватись бібліотекою локально. Гарної роботи!
|
package/package.json
CHANGED
|
@@ -400,6 +400,30 @@ var ApiObjectCollectionIterator = class {
|
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
402
|
|
|
403
|
+
// src/classes/ApiFileInvoker.ts
|
|
404
|
+
var ApiFileInvoker = class {
|
|
405
|
+
constructor(jsWapiInvoker, params) {
|
|
406
|
+
__publicField(this, "_jsWapiInvoker");
|
|
407
|
+
__publicField(this, "_objectName");
|
|
408
|
+
this._jsWapiInvoker = jsWapiInvoker;
|
|
409
|
+
this._objectName = params.objectName;
|
|
410
|
+
this.setParams(params.keyValue, params.fileFieldName);
|
|
411
|
+
}
|
|
412
|
+
get objectName() {
|
|
413
|
+
return this._objectName;
|
|
414
|
+
}
|
|
415
|
+
setParams(keyValue, fileFieldName) {
|
|
416
|
+
this._jsWapiInvoker.setSingleColumn(fileFieldName);
|
|
417
|
+
this._jsWapiInvoker.setKeyValue(keyValue);
|
|
418
|
+
}
|
|
419
|
+
getExcelFileAsJson() {
|
|
420
|
+
return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
|
|
421
|
+
}
|
|
422
|
+
getFileAsString() {
|
|
423
|
+
return this._jsWapiInvoker.invokeAndGetFileAsString();
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
403
427
|
// src/classes/ApiCore.ts
|
|
404
428
|
var ApiCore = class {
|
|
405
429
|
constructor({ http, request }) {
|
|
@@ -431,6 +455,13 @@ var ApiCore = class {
|
|
|
431
455
|
newApiInvoker(objectName, operName) {
|
|
432
456
|
return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
|
|
433
457
|
}
|
|
458
|
+
newApiFileInvoker(objectName, keyValue, fileFieldName) {
|
|
459
|
+
return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
|
|
460
|
+
objectName,
|
|
461
|
+
keyValue,
|
|
462
|
+
fileFieldName
|
|
463
|
+
});
|
|
464
|
+
}
|
|
434
465
|
newApiObjectCollectionIterator(objectName) {
|
|
435
466
|
return new ApiObjectCollectionIterator({
|
|
436
467
|
invoker: this.newApiInvoker(objectName, "List")
|
|
@@ -22,6 +22,10 @@ declare namespace jsWapi {
|
|
|
22
22
|
getRequest(objectName?: string): Record<string, any>[];
|
|
23
23
|
getSrcRequest(): Record<string, any>[];
|
|
24
24
|
getFirstRows(): number;
|
|
25
|
+
setKeyValue(keyValue: number | string): JSWapiInvoker;
|
|
26
|
+
setSingleColumn(column: string): JSWapiInvoker;
|
|
27
|
+
invokeAndGetFileAsString(): string;
|
|
28
|
+
invokeAndGetExcelFileAsJson(): Map<string, any>;
|
|
25
29
|
invoke(): JSWapiResponse;
|
|
26
30
|
};
|
|
27
31
|
type JSWapiRequest = {
|
|
@@ -142,7 +146,7 @@ declare class ApiResponse {
|
|
|
142
146
|
setPagesPredict(pagesPredict: number): this;
|
|
143
147
|
}
|
|
144
148
|
|
|
145
|
-
interface IInvoker<T> {
|
|
149
|
+
interface IInvoker$1<T> {
|
|
146
150
|
setColumns(columns: string[]): T;
|
|
147
151
|
setFilters(filters: IFiltersCollection): T;
|
|
148
152
|
setSorts(sorts: string[]): T;
|
|
@@ -150,7 +154,7 @@ interface IInvoker<T> {
|
|
|
150
154
|
addSorts(sorts: string[]): T;
|
|
151
155
|
objectName: string;
|
|
152
156
|
}
|
|
153
|
-
declare class ApiInvoker implements IInvoker<ApiInvoker> {
|
|
157
|
+
declare class ApiInvoker implements IInvoker$1<ApiInvoker> {
|
|
154
158
|
_jsWapiInvoker: jsWapi.JSWapiInvoker;
|
|
155
159
|
protected readonly _objectName: string;
|
|
156
160
|
constructor(jsWapiInvoker: jsWapi.JSWapiInvoker, objectName: string);
|
|
@@ -287,7 +291,7 @@ declare class ApiRequest {
|
|
|
287
291
|
_getWithStringifiedElements(array: any[]): string[];
|
|
288
292
|
}
|
|
289
293
|
|
|
290
|
-
declare class ApiObjectCollectionIterator implements IInvoker<ApiObjectCollectionIterator> {
|
|
294
|
+
declare class ApiObjectCollectionIterator implements IInvoker$1<ApiObjectCollectionIterator> {
|
|
291
295
|
private _invoker;
|
|
292
296
|
constructor({ invoker }: {
|
|
293
297
|
invoker: ApiInvoker;
|
|
@@ -301,6 +305,26 @@ declare class ApiObjectCollectionIterator implements IInvoker<ApiObjectCollectio
|
|
|
301
305
|
invoke(): Generator<ApiResponse>;
|
|
302
306
|
}
|
|
303
307
|
|
|
308
|
+
interface IInvoker {
|
|
309
|
+
getExcelFileAsJson(): Map<string, any>;
|
|
310
|
+
getFileAsString(): string;
|
|
311
|
+
objectName: string;
|
|
312
|
+
}
|
|
313
|
+
interface IParams {
|
|
314
|
+
objectName: string;
|
|
315
|
+
keyValue: string | number;
|
|
316
|
+
fileFieldName: string;
|
|
317
|
+
}
|
|
318
|
+
declare class ApiFileInvoker implements IInvoker {
|
|
319
|
+
_jsWapiInvoker: jsWapi.JSWapiInvoker;
|
|
320
|
+
protected readonly _objectName: string;
|
|
321
|
+
constructor(jsWapiInvoker: jsWapi.JSWapiInvoker, params: IParams);
|
|
322
|
+
get objectName(): string;
|
|
323
|
+
setParams(keyValue: string | number, fileFieldName: string): void;
|
|
324
|
+
getExcelFileAsJson(): Map<string, any>;
|
|
325
|
+
getFileAsString(): string;
|
|
326
|
+
}
|
|
327
|
+
|
|
304
328
|
type HTTPSender = {
|
|
305
329
|
newJSWapiHttp(url: string): jsWapi.JSWapiHttp;
|
|
306
330
|
};
|
|
@@ -327,6 +351,7 @@ declare class ApiCore {
|
|
|
327
351
|
t(msgKey: string, params?: string[]): string;
|
|
328
352
|
newHttpRequest(url: string): ApiHttpRequest;
|
|
329
353
|
newApiInvoker(objectName: string, operName: string): ApiInvoker;
|
|
354
|
+
newApiFileInvoker(objectName: string, keyValue: string | number, fileFieldName: string): ApiFileInvoker;
|
|
330
355
|
newApiObjectCollectionIterator(objectName: string): ApiObjectCollectionIterator;
|
|
331
356
|
newApiException(message: string, code?: string | number): Error;
|
|
332
357
|
}
|
|
@@ -364,6 +364,30 @@ var ApiObjectCollectionIterator = class {
|
|
|
364
364
|
}
|
|
365
365
|
};
|
|
366
366
|
|
|
367
|
+
// src/classes/ApiFileInvoker.ts
|
|
368
|
+
var ApiFileInvoker = class {
|
|
369
|
+
constructor(jsWapiInvoker, params) {
|
|
370
|
+
__publicField(this, "_jsWapiInvoker");
|
|
371
|
+
__publicField(this, "_objectName");
|
|
372
|
+
this._jsWapiInvoker = jsWapiInvoker;
|
|
373
|
+
this._objectName = params.objectName;
|
|
374
|
+
this.setParams(params.keyValue, params.fileFieldName);
|
|
375
|
+
}
|
|
376
|
+
get objectName() {
|
|
377
|
+
return this._objectName;
|
|
378
|
+
}
|
|
379
|
+
setParams(keyValue, fileFieldName) {
|
|
380
|
+
this._jsWapiInvoker.setSingleColumn(fileFieldName);
|
|
381
|
+
this._jsWapiInvoker.setKeyValue(keyValue);
|
|
382
|
+
}
|
|
383
|
+
getExcelFileAsJson() {
|
|
384
|
+
return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
|
|
385
|
+
}
|
|
386
|
+
getFileAsString() {
|
|
387
|
+
return this._jsWapiInvoker.invokeAndGetFileAsString();
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
367
391
|
// src/classes/ApiCore.ts
|
|
368
392
|
var ApiCore = class {
|
|
369
393
|
constructor({ http, request }) {
|
|
@@ -395,6 +419,13 @@ var ApiCore = class {
|
|
|
395
419
|
newApiInvoker(objectName, operName) {
|
|
396
420
|
return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
|
|
397
421
|
}
|
|
422
|
+
newApiFileInvoker(objectName, keyValue, fileFieldName) {
|
|
423
|
+
return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
|
|
424
|
+
objectName,
|
|
425
|
+
keyValue,
|
|
426
|
+
fileFieldName
|
|
427
|
+
});
|
|
428
|
+
}
|
|
398
429
|
newApiObjectCollectionIterator(objectName) {
|
|
399
430
|
return new ApiObjectCollectionIterator({
|
|
400
431
|
invoker: this.newApiInvoker(objectName, "List")
|
|
@@ -364,6 +364,30 @@ var ApiObjectCollectionIterator = class {
|
|
|
364
364
|
}
|
|
365
365
|
};
|
|
366
366
|
|
|
367
|
+
// src/classes/ApiFileInvoker.ts
|
|
368
|
+
var ApiFileInvoker = class {
|
|
369
|
+
constructor(jsWapiInvoker, params) {
|
|
370
|
+
__publicField(this, "_jsWapiInvoker");
|
|
371
|
+
__publicField(this, "_objectName");
|
|
372
|
+
this._jsWapiInvoker = jsWapiInvoker;
|
|
373
|
+
this._objectName = params.objectName;
|
|
374
|
+
this.setParams(params.keyValue, params.fileFieldName);
|
|
375
|
+
}
|
|
376
|
+
get objectName() {
|
|
377
|
+
return this._objectName;
|
|
378
|
+
}
|
|
379
|
+
setParams(keyValue, fileFieldName) {
|
|
380
|
+
this._jsWapiInvoker.setSingleColumn(fileFieldName);
|
|
381
|
+
this._jsWapiInvoker.setKeyValue(keyValue);
|
|
382
|
+
}
|
|
383
|
+
getExcelFileAsJson() {
|
|
384
|
+
return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
|
|
385
|
+
}
|
|
386
|
+
getFileAsString() {
|
|
387
|
+
return this._jsWapiInvoker.invokeAndGetFileAsString();
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
367
391
|
// src/classes/ApiCore.ts
|
|
368
392
|
var ApiCore = class {
|
|
369
393
|
constructor({ http, request }) {
|
|
@@ -395,6 +419,13 @@ var ApiCore = class {
|
|
|
395
419
|
newApiInvoker(objectName, operName) {
|
|
396
420
|
return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
|
|
397
421
|
}
|
|
422
|
+
newApiFileInvoker(objectName, keyValue, fileFieldName) {
|
|
423
|
+
return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
|
|
424
|
+
objectName,
|
|
425
|
+
keyValue,
|
|
426
|
+
fileFieldName
|
|
427
|
+
});
|
|
428
|
+
}
|
|
398
429
|
newApiObjectCollectionIterator(objectName) {
|
|
399
430
|
return new ApiObjectCollectionIterator({
|
|
400
431
|
invoker: this.newApiInvoker(objectName, "List")
|