d5-api-initializer 1.0.3 → 1.1.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-api-initializer",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "dependencies": {},
6
6
  "main": "publish/cjs/d5-api-initializer",
@@ -218,7 +218,21 @@ var ApiInvoker = class {
218
218
  set nestedColumns(nestedColumns) {
219
219
  this._jsWapiInvoker = this._jsWapiInvoker.setNestedColumns(nestedColumns);
220
220
  }
221
+ set autocompleteLinkedObjectFields(value) {
222
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteLinkedObjectFields(value));
223
+ }
224
+ set autocompleteKeyField(value) {
225
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteKeyField(value));
226
+ }
221
227
  /* -----------------------------Setters----------------------------- */
228
+ setAutocompleteLinkedObjectFields(value) {
229
+ this.autocompleteLinkedObjectFields = value;
230
+ return this;
231
+ }
232
+ setAutocompleteKeyField(value) {
233
+ this.autocompleteKeyField = value;
234
+ return this;
235
+ }
222
236
  setHierarchy(parentColumn, requestKind) {
223
237
  this._jsWapiInvoker = this._jsWapiInvoker.setHierarchy(parentColumn, requestKind);
224
238
  return this;
@@ -400,6 +414,30 @@ var ApiObjectCollectionIterator = class {
400
414
  }
401
415
  };
402
416
 
417
+ // src/classes/ApiFileInvoker.ts
418
+ var ApiFileInvoker = class {
419
+ constructor(jsWapiInvoker, params) {
420
+ __publicField(this, "_jsWapiInvoker");
421
+ __publicField(this, "_objectName");
422
+ this._jsWapiInvoker = jsWapiInvoker;
423
+ this._objectName = params.objectName;
424
+ this.setParams(params.keyValue, params.fileFieldName);
425
+ }
426
+ get objectName() {
427
+ return this._objectName;
428
+ }
429
+ setParams(keyValue, fileFieldName) {
430
+ this._jsWapiInvoker.setSingleColumn(fileFieldName);
431
+ this._jsWapiInvoker.setKeyValue(keyValue);
432
+ }
433
+ getExcelFileAsJson() {
434
+ return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
435
+ }
436
+ getFileAsString() {
437
+ return this._jsWapiInvoker.invokeAndGetFileAsString();
438
+ }
439
+ };
440
+
403
441
  // src/classes/ApiCore.ts
404
442
  var ApiCore = class {
405
443
  constructor({ http, request }) {
@@ -431,6 +469,13 @@ var ApiCore = class {
431
469
  newApiInvoker(objectName, operName) {
432
470
  return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
433
471
  }
472
+ newApiFileInvoker(objectName, keyValue, fileFieldName) {
473
+ return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
474
+ objectName,
475
+ keyValue,
476
+ fileFieldName
477
+ });
478
+ }
434
479
  newApiObjectCollectionIterator(objectName) {
435
480
  return new ApiObjectCollectionIterator({
436
481
  invoker: this.newApiInvoker(objectName, "List")
@@ -1,5 +1,10 @@
1
1
  declare namespace jsWapi {
2
+ interface JSRequestModesSetter {
3
+ setAutocompleteLinkedObjectFields(isAutocompleteLinkedObjectFields: boolean): void;
4
+ setAutocompleteKeyField(isAutocompleteKeyField: boolean): void;
5
+ }
2
6
  type JSWapiInvoker = {
7
+ putRequestModes(cb: (rm: JSRequestModesSetter) => void): JSWapiInvoker;
3
8
  setFilters(filters: any): JSWapiInvoker;
4
9
  setParams(params: any): JSWapiInvoker;
5
10
  setRowsPerPage(number: number): JSWapiInvoker;
@@ -22,6 +27,10 @@ declare namespace jsWapi {
22
27
  getRequest(objectName?: string): Record<string, any>[];
23
28
  getSrcRequest(): Record<string, any>[];
24
29
  getFirstRows(): number;
30
+ setKeyValue(keyValue: number | string): JSWapiInvoker;
31
+ setSingleColumn(column: string): JSWapiInvoker;
32
+ invokeAndGetFileAsString(): string;
33
+ invokeAndGetExcelFileAsJson(): Map<string, any>;
25
34
  invoke(): JSWapiResponse;
26
35
  };
27
36
  type JSWapiRequest = {
@@ -142,7 +151,7 @@ declare class ApiResponse {
142
151
  setPagesPredict(pagesPredict: number): this;
143
152
  }
144
153
 
145
- interface IInvoker<T> {
154
+ interface IInvoker$1<T> {
146
155
  setColumns(columns: string[]): T;
147
156
  setFilters(filters: IFiltersCollection): T;
148
157
  setSorts(sorts: string[]): T;
@@ -150,7 +159,7 @@ interface IInvoker<T> {
150
159
  addSorts(sorts: string[]): T;
151
160
  objectName: string;
152
161
  }
153
- declare class ApiInvoker implements IInvoker<ApiInvoker> {
162
+ declare class ApiInvoker implements IInvoker$1<ApiInvoker> {
154
163
  _jsWapiInvoker: jsWapi.JSWapiInvoker;
155
164
  protected readonly _objectName: string;
156
165
  constructor(jsWapiInvoker: jsWapi.JSWapiInvoker, objectName: string);
@@ -166,6 +175,10 @@ declare class ApiInvoker implements IInvoker<ApiInvoker> {
166
175
  set sorts(sorts: string[]);
167
176
  set aggregatedColumns(aggregatedColumns: IMappedCollection);
168
177
  set nestedColumns(nestedColumns: IMappedCollection);
178
+ set autocompleteLinkedObjectFields(value: boolean);
179
+ set autocompleteKeyField(value: boolean);
180
+ setAutocompleteLinkedObjectFields(value: boolean): this;
181
+ setAutocompleteKeyField(value: boolean): this;
169
182
  setHierarchy(parentColumn: string, requestKind?: number): this;
170
183
  setFilters(filters: IFiltersCollection): ApiInvoker;
171
184
  setParams(params: IMappedCollection): ApiInvoker;
@@ -287,7 +300,7 @@ declare class ApiRequest {
287
300
  _getWithStringifiedElements(array: any[]): string[];
288
301
  }
289
302
 
290
- declare class ApiObjectCollectionIterator implements IInvoker<ApiObjectCollectionIterator> {
303
+ declare class ApiObjectCollectionIterator implements IInvoker$1<ApiObjectCollectionIterator> {
291
304
  private _invoker;
292
305
  constructor({ invoker }: {
293
306
  invoker: ApiInvoker;
@@ -301,6 +314,26 @@ declare class ApiObjectCollectionIterator implements IInvoker<ApiObjectCollectio
301
314
  invoke(): Generator<ApiResponse>;
302
315
  }
303
316
 
317
+ interface IInvoker {
318
+ getExcelFileAsJson(): Map<string, any>;
319
+ getFileAsString(): string;
320
+ objectName: string;
321
+ }
322
+ interface IParams {
323
+ objectName: string;
324
+ keyValue: string | number;
325
+ fileFieldName: string;
326
+ }
327
+ declare class ApiFileInvoker implements IInvoker {
328
+ _jsWapiInvoker: jsWapi.JSWapiInvoker;
329
+ protected readonly _objectName: string;
330
+ constructor(jsWapiInvoker: jsWapi.JSWapiInvoker, params: IParams);
331
+ get objectName(): string;
332
+ setParams(keyValue: string | number, fileFieldName: string): void;
333
+ getExcelFileAsJson(): Map<string, any>;
334
+ getFileAsString(): string;
335
+ }
336
+
304
337
  type HTTPSender = {
305
338
  newJSWapiHttp(url: string): jsWapi.JSWapiHttp;
306
339
  };
@@ -327,6 +360,7 @@ declare class ApiCore {
327
360
  t(msgKey: string, params?: string[]): string;
328
361
  newHttpRequest(url: string): ApiHttpRequest;
329
362
  newApiInvoker(objectName: string, operName: string): ApiInvoker;
363
+ newApiFileInvoker(objectName: string, keyValue: string | number, fileFieldName: string): ApiFileInvoker;
330
364
  newApiObjectCollectionIterator(objectName: string): ApiObjectCollectionIterator;
331
365
  newApiException(message: string, code?: string | number): Error;
332
366
  }
@@ -182,7 +182,21 @@ var ApiInvoker = class {
182
182
  set nestedColumns(nestedColumns) {
183
183
  this._jsWapiInvoker = this._jsWapiInvoker.setNestedColumns(nestedColumns);
184
184
  }
185
+ set autocompleteLinkedObjectFields(value) {
186
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteLinkedObjectFields(value));
187
+ }
188
+ set autocompleteKeyField(value) {
189
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteKeyField(value));
190
+ }
185
191
  /* -----------------------------Setters----------------------------- */
192
+ setAutocompleteLinkedObjectFields(value) {
193
+ this.autocompleteLinkedObjectFields = value;
194
+ return this;
195
+ }
196
+ setAutocompleteKeyField(value) {
197
+ this.autocompleteKeyField = value;
198
+ return this;
199
+ }
186
200
  setHierarchy(parentColumn, requestKind) {
187
201
  this._jsWapiInvoker = this._jsWapiInvoker.setHierarchy(parentColumn, requestKind);
188
202
  return this;
@@ -364,6 +378,30 @@ var ApiObjectCollectionIterator = class {
364
378
  }
365
379
  };
366
380
 
381
+ // src/classes/ApiFileInvoker.ts
382
+ var ApiFileInvoker = class {
383
+ constructor(jsWapiInvoker, params) {
384
+ __publicField(this, "_jsWapiInvoker");
385
+ __publicField(this, "_objectName");
386
+ this._jsWapiInvoker = jsWapiInvoker;
387
+ this._objectName = params.objectName;
388
+ this.setParams(params.keyValue, params.fileFieldName);
389
+ }
390
+ get objectName() {
391
+ return this._objectName;
392
+ }
393
+ setParams(keyValue, fileFieldName) {
394
+ this._jsWapiInvoker.setSingleColumn(fileFieldName);
395
+ this._jsWapiInvoker.setKeyValue(keyValue);
396
+ }
397
+ getExcelFileAsJson() {
398
+ return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
399
+ }
400
+ getFileAsString() {
401
+ return this._jsWapiInvoker.invokeAndGetFileAsString();
402
+ }
403
+ };
404
+
367
405
  // src/classes/ApiCore.ts
368
406
  var ApiCore = class {
369
407
  constructor({ http, request }) {
@@ -395,6 +433,13 @@ var ApiCore = class {
395
433
  newApiInvoker(objectName, operName) {
396
434
  return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
397
435
  }
436
+ newApiFileInvoker(objectName, keyValue, fileFieldName) {
437
+ return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
438
+ objectName,
439
+ keyValue,
440
+ fileFieldName
441
+ });
442
+ }
398
443
  newApiObjectCollectionIterator(objectName) {
399
444
  return new ApiObjectCollectionIterator({
400
445
  invoker: this.newApiInvoker(objectName, "List")
@@ -182,7 +182,21 @@ var ApiInvoker = class {
182
182
  set nestedColumns(nestedColumns) {
183
183
  this._jsWapiInvoker = this._jsWapiInvoker.setNestedColumns(nestedColumns);
184
184
  }
185
+ set autocompleteLinkedObjectFields(value) {
186
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteLinkedObjectFields(value));
187
+ }
188
+ set autocompleteKeyField(value) {
189
+ this._jsWapiInvoker.putRequestModes((rm) => rm.setAutocompleteKeyField(value));
190
+ }
185
191
  /* -----------------------------Setters----------------------------- */
192
+ setAutocompleteLinkedObjectFields(value) {
193
+ this.autocompleteLinkedObjectFields = value;
194
+ return this;
195
+ }
196
+ setAutocompleteKeyField(value) {
197
+ this.autocompleteKeyField = value;
198
+ return this;
199
+ }
186
200
  setHierarchy(parentColumn, requestKind) {
187
201
  this._jsWapiInvoker = this._jsWapiInvoker.setHierarchy(parentColumn, requestKind);
188
202
  return this;
@@ -364,6 +378,30 @@ var ApiObjectCollectionIterator = class {
364
378
  }
365
379
  };
366
380
 
381
+ // src/classes/ApiFileInvoker.ts
382
+ var ApiFileInvoker = class {
383
+ constructor(jsWapiInvoker, params) {
384
+ __publicField(this, "_jsWapiInvoker");
385
+ __publicField(this, "_objectName");
386
+ this._jsWapiInvoker = jsWapiInvoker;
387
+ this._objectName = params.objectName;
388
+ this.setParams(params.keyValue, params.fileFieldName);
389
+ }
390
+ get objectName() {
391
+ return this._objectName;
392
+ }
393
+ setParams(keyValue, fileFieldName) {
394
+ this._jsWapiInvoker.setSingleColumn(fileFieldName);
395
+ this._jsWapiInvoker.setKeyValue(keyValue);
396
+ }
397
+ getExcelFileAsJson() {
398
+ return this._jsWapiInvoker.invokeAndGetExcelFileAsJson();
399
+ }
400
+ getFileAsString() {
401
+ return this._jsWapiInvoker.invokeAndGetFileAsString();
402
+ }
403
+ };
404
+
367
405
  // src/classes/ApiCore.ts
368
406
  var ApiCore = class {
369
407
  constructor({ http, request }) {
@@ -395,6 +433,13 @@ var ApiCore = class {
395
433
  newApiInvoker(objectName, operName) {
396
434
  return new ApiInvoker(this._request.newJSWapiInvoker(objectName, operName), objectName);
397
435
  }
436
+ newApiFileInvoker(objectName, keyValue, fileFieldName) {
437
+ return new ApiFileInvoker(this._request.newJSWapiInvoker(objectName, "List"), {
438
+ objectName,
439
+ keyValue,
440
+ fileFieldName
441
+ });
442
+ }
398
443
  newApiObjectCollectionIterator(objectName) {
399
444
  return new ApiObjectCollectionIterator({
400
445
  invoker: this.newApiInvoker(objectName, "List")