d5-api-initializer 1.6.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-api-initializer",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "license": "MIT",
5
5
  "dependencies": {},
6
6
  "main": "publish/cjs/d5-api-initializer",
@@ -43,7 +43,7 @@
43
43
  "eslint": "7.19.0",
44
44
  "rimraf": "5.0.5",
45
45
  "babel-loader": "10.0.0",
46
- "tsup": "7.0.0",
46
+ "tsup": "8.5.0",
47
47
  "typescript": "5.8.3"
48
48
  }
49
49
  }
@@ -17,10 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var __publicField = (obj, key, value) => {
21
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
- return value;
23
- };
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
21
 
25
22
  // src/lib-index.ts
26
23
  var lib_index_exports = {};
@@ -183,6 +180,9 @@ var ApiHttpRequest = class {
183
180
  PUT(body = {}, callback) {
184
181
  return this._jsWapiHttp.PUT(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
185
182
  }
183
+ DELETE(body = {}, callback) {
184
+ return this._jsWapiHttp.DELETE(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
185
+ }
186
186
  PATCH(body = {}, callback) {
187
187
  return this._jsWapiHttp.PATCH(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
188
188
  }
@@ -440,6 +440,10 @@ var ApiInvoker = class {
440
440
  this._jsWapiInvoker = this._jsWapiInvoker.putNestedColumns(nestedColumns);
441
441
  return this;
442
442
  }
443
+ addFilters(filters) {
444
+ this._jsWapiInvoker = this._jsWapiInvoker.putFilters(filters);
445
+ return this;
446
+ }
443
447
  addSorts(sorts) {
444
448
  this._jsWapiInvoker = this._jsWapiInvoker.addSorts(sorts);
445
449
  return this;
@@ -480,8 +484,7 @@ var UserMessages = class {
480
484
  __publicField(this, "_lang", "ua" /* ua */);
481
485
  }
482
486
  appendDictionary(newDictionary) {
483
- if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object")
484
- return;
487
+ if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object") return;
485
488
  for (const key in newDictionary) {
486
489
  if (!this._messages.hasOwnProperty(key)) {
487
490
  this._messages[key] = {};
@@ -996,16 +999,14 @@ var ApiInitializer = class {
996
999
  throw new Error(msg);
997
1000
  };
998
1001
  if (typeof settings === "string") {
999
- if (!operations)
1000
- throwError('The second argument "operations" is required');
1002
+ if (!operations) throwError('The second argument "operations" is required');
1001
1003
  this._operations = operations;
1002
1004
  this.internalCreate(settings);
1003
1005
  options?.translations && this.initTranslation(options.translations);
1004
1006
  return;
1005
1007
  }
1006
1008
  const { objectName, operations: opers, translations } = settings;
1007
- if (!opers)
1008
- throwError('Property "operations" in the settings is required');
1009
+ if (!opers) throwError('Property "operations" in the settings is required');
1009
1010
  this._operations = opers;
1010
1011
  this.internalCreate(objectName);
1011
1012
  translations && this.initTranslation(translations);
@@ -1063,8 +1064,7 @@ var EngineInitializer = class {
1063
1064
  const throwError = (msg) => {
1064
1065
  throw new Error(msg);
1065
1066
  };
1066
- if (!operations)
1067
- throwError('Property "operations" in the settings is required');
1067
+ if (!operations) throwError('Property "operations" in the settings is required');
1068
1068
  this._operations = operations;
1069
1069
  this.internalCreate();
1070
1070
  translations && this.initTranslation(translations);
@@ -1122,8 +1122,7 @@ var ApplicationInitializer = class {
1122
1122
  const throwError = (msg) => {
1123
1123
  throw new Error(msg);
1124
1124
  };
1125
- if (!operations)
1126
- throwError('Property "operations" in the settings is required');
1125
+ if (!operations) throwError('Property "operations" in the settings is required');
1127
1126
  this._operations = operations;
1128
1127
  this.internalCreate();
1129
1128
  }
@@ -33,6 +33,7 @@ declare namespace jsWapi {
33
33
  putAggregatedColumns(columns: any): JSWapiInvoker;
34
34
  setNestedColumns(columns: any): JSWapiInvoker;
35
35
  putNestedColumns(columns: any): JSWapiInvoker;
36
+ putFilters(filters: IFiltersCollection): JSWapiInvoker;
36
37
  setHierarchy(parentColumn: string, requestKind?: number): JSWapiInvoker;
37
38
  setSrcRequest(srcRequest: any): JSWapiInvoker;
38
39
  setFirstRows(number: number): JSWapiInvoker;
@@ -134,6 +135,7 @@ declare namespace jsWapi {
134
135
  GET(cb: IHttpCallback): any;
135
136
  POST(body: string, cb: IHttpCallback): any;
136
137
  POST(body: (req: JSWapiHttpRequest) => JSWapiHttpRequest, cb: IHttpCallback): any;
138
+ DELETE(body: string, cb: IHttpCallback): any;
137
139
  PUT(body: string, cb: IHttpCallback): any;
138
140
  PATCH(body: string, cb: IHttpCallback): any;
139
141
  }
@@ -266,13 +268,13 @@ declare namespace jsWapi {
266
268
  }
267
269
  /**
268
270
  * Вернуть содержимое meta-Excel в виде JSON-объекта:
269
- {
270
- "sheet123": {
271
- "TaxBillHeader" : [
272
- {"R001G3": "", "R01G1": "", ...}, ...
273
- ], ...
274
- }, ...
275
- }
271
+ {
272
+ "sheet123": {
273
+ "TaxBillHeader" : [
274
+ {"R001G3": "", "R01G1": "", ...}, ...
275
+ ], ...
276
+ }, ...
277
+ }
276
278
  *
277
279
  * @param fileRequestId имя поля в multipart-запросе с Excel-файлом
278
280
  */
@@ -320,6 +322,7 @@ declare class ApiHttpRequest {
320
322
  POST(request?: FileLink | FileRequestId | MultipartFormData | Record<string, any> | string, callback?: IHttpCallback): any;
321
323
  private setMultipartBody;
322
324
  PUT(body?: Record<string, any> | string, callback?: IHttpCallback): any;
325
+ DELETE(body?: Record<string, any> | string, callback?: IHttpCallback): any;
323
326
  PATCH(body: Record<string, any> | string, callback: IHttpCallback): any;
324
327
  private _getWrappedCallback;
325
328
  }
@@ -410,6 +413,7 @@ declare class ApiInvoker implements IInvoker$1<ApiInvoker> {
410
413
  addColumns(columns: string[]): ApiInvoker;
411
414
  addAggregatedColumns(aggregatedColumns: IMappedCollection): ApiInvoker;
412
415
  addNestedColumns(nestedColumns: IMappedCollection): ApiInvoker;
416
+ addFilters(filters: IFiltersCollection): ApiInvoker;
413
417
  addSorts(sorts: string[]): ApiInvoker;
414
418
  addFile(fileID: string, fileStream: any): ApiInvoker;
415
419
  addRequestRow(data: Record<string, any>): ApiInvoker;
@@ -753,4 +757,4 @@ declare class UserMessages {
753
757
  }
754
758
  declare const _default: UserMessages;
755
759
 
756
- export { ApiCore, ApiHttpRequest, ApiHttpResponse, ApiInvoker, ApiJoinInvoker, ApiObjectCollectionIterator, ApiRequest, ApiResponse, ApplicationInitializer, EngineInitializer, IApiOperations, IFilter, IFilterValue, IFiltersCollection, IHttpCallback, IMappedCollection, LanguageCode, MultipartFormData, _default as UserMessages, ApiObjectInitializer as default, fileLink, fileRequestId };
760
+ export { ApiCore, ApiHttpRequest, ApiHttpResponse, ApiInvoker, ApiJoinInvoker, ApiObjectCollectionIterator, ApiRequest, ApiResponse, ApplicationInitializer, EngineInitializer, type IApiOperations, type IFilter, type IFilterValue, type IFiltersCollection, type IHttpCallback, type IMappedCollection, LanguageCode, MultipartFormData, _default as UserMessages, ApiObjectInitializer as default, fileLink, fileRequestId };
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
 
8
5
  // src/classes/ApiHttpResponse.ts
9
6
  var ApiHttpResponse = class {
@@ -144,6 +141,9 @@ var ApiHttpRequest = class {
144
141
  PUT(body = {}, callback) {
145
142
  return this._jsWapiHttp.PUT(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
146
143
  }
144
+ DELETE(body = {}, callback) {
145
+ return this._jsWapiHttp.DELETE(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
146
+ }
147
147
  PATCH(body = {}, callback) {
148
148
  return this._jsWapiHttp.PATCH(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
149
149
  }
@@ -401,6 +401,10 @@ var ApiInvoker = class {
401
401
  this._jsWapiInvoker = this._jsWapiInvoker.putNestedColumns(nestedColumns);
402
402
  return this;
403
403
  }
404
+ addFilters(filters) {
405
+ this._jsWapiInvoker = this._jsWapiInvoker.putFilters(filters);
406
+ return this;
407
+ }
404
408
  addSorts(sorts) {
405
409
  this._jsWapiInvoker = this._jsWapiInvoker.addSorts(sorts);
406
410
  return this;
@@ -441,8 +445,7 @@ var UserMessages = class {
441
445
  __publicField(this, "_lang", "ua" /* ua */);
442
446
  }
443
447
  appendDictionary(newDictionary) {
444
- if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object")
445
- return;
448
+ if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object") return;
446
449
  for (const key in newDictionary) {
447
450
  if (!this._messages.hasOwnProperty(key)) {
448
451
  this._messages[key] = {};
@@ -957,16 +960,14 @@ var ApiInitializer = class {
957
960
  throw new Error(msg);
958
961
  };
959
962
  if (typeof settings === "string") {
960
- if (!operations)
961
- throwError('The second argument "operations" is required');
963
+ if (!operations) throwError('The second argument "operations" is required');
962
964
  this._operations = operations;
963
965
  this.internalCreate(settings);
964
966
  options?.translations && this.initTranslation(options.translations);
965
967
  return;
966
968
  }
967
969
  const { objectName, operations: opers, translations } = settings;
968
- if (!opers)
969
- throwError('Property "operations" in the settings is required');
970
+ if (!opers) throwError('Property "operations" in the settings is required');
970
971
  this._operations = opers;
971
972
  this.internalCreate(objectName);
972
973
  translations && this.initTranslation(translations);
@@ -1024,8 +1025,7 @@ var EngineInitializer = class {
1024
1025
  const throwError = (msg) => {
1025
1026
  throw new Error(msg);
1026
1027
  };
1027
- if (!operations)
1028
- throwError('Property "operations" in the settings is required');
1028
+ if (!operations) throwError('Property "operations" in the settings is required');
1029
1029
  this._operations = operations;
1030
1030
  this.internalCreate();
1031
1031
  translations && this.initTranslation(translations);
@@ -1083,8 +1083,7 @@ var ApplicationInitializer = class {
1083
1083
  const throwError = (msg) => {
1084
1084
  throw new Error(msg);
1085
1085
  };
1086
- if (!operations)
1087
- throwError('Property "operations" in the settings is required');
1086
+ if (!operations) throwError('Property "operations" in the settings is required');
1088
1087
  this._operations = operations;
1089
1088
  this.internalCreate();
1090
1089
  }
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
 
8
5
  // src/classes/ApiHttpResponse.ts
9
6
  var ApiHttpResponse = class {
@@ -144,6 +141,9 @@ var ApiHttpRequest = class {
144
141
  PUT(body = {}, callback) {
145
142
  return this._jsWapiHttp.PUT(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
146
143
  }
144
+ DELETE(body = {}, callback) {
145
+ return this._jsWapiHttp.DELETE(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
146
+ }
147
147
  PATCH(body = {}, callback) {
148
148
  return this._jsWapiHttp.PATCH(typeof body === "string" ? body : JSON.stringify(body), this._getWrappedCallback(callback));
149
149
  }
@@ -401,6 +401,10 @@ var ApiInvoker = class {
401
401
  this._jsWapiInvoker = this._jsWapiInvoker.putNestedColumns(nestedColumns);
402
402
  return this;
403
403
  }
404
+ addFilters(filters) {
405
+ this._jsWapiInvoker = this._jsWapiInvoker.putFilters(filters);
406
+ return this;
407
+ }
404
408
  addSorts(sorts) {
405
409
  this._jsWapiInvoker = this._jsWapiInvoker.addSorts(sorts);
406
410
  return this;
@@ -441,8 +445,7 @@ var UserMessages = class {
441
445
  __publicField(this, "_lang", "ua" /* ua */);
442
446
  }
443
447
  appendDictionary(newDictionary) {
444
- if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object")
445
- return;
448
+ if (Array.isArray(newDictionary) || !newDictionary || typeof newDictionary !== "object") return;
446
449
  for (const key in newDictionary) {
447
450
  if (!this._messages.hasOwnProperty(key)) {
448
451
  this._messages[key] = {};
@@ -957,16 +960,14 @@ var ApiInitializer = class {
957
960
  throw new Error(msg);
958
961
  };
959
962
  if (typeof settings === "string") {
960
- if (!operations)
961
- throwError('The second argument "operations" is required');
963
+ if (!operations) throwError('The second argument "operations" is required');
962
964
  this._operations = operations;
963
965
  this.internalCreate(settings);
964
966
  options?.translations && this.initTranslation(options.translations);
965
967
  return;
966
968
  }
967
969
  const { objectName, operations: opers, translations } = settings;
968
- if (!opers)
969
- throwError('Property "operations" in the settings is required');
970
+ if (!opers) throwError('Property "operations" in the settings is required');
970
971
  this._operations = opers;
971
972
  this.internalCreate(objectName);
972
973
  translations && this.initTranslation(translations);
@@ -1024,8 +1025,7 @@ var EngineInitializer = class {
1024
1025
  const throwError = (msg) => {
1025
1026
  throw new Error(msg);
1026
1027
  };
1027
- if (!operations)
1028
- throwError('Property "operations" in the settings is required');
1028
+ if (!operations) throwError('Property "operations" in the settings is required');
1029
1029
  this._operations = operations;
1030
1030
  this.internalCreate();
1031
1031
  translations && this.initTranslation(translations);
@@ -1083,8 +1083,7 @@ var ApplicationInitializer = class {
1083
1083
  const throwError = (msg) => {
1084
1084
  throw new Error(msg);
1085
1085
  };
1086
- if (!operations)
1087
- throwError('Property "operations" in the settings is required');
1086
+ if (!operations) throwError('Property "operations" in the settings is required');
1088
1087
  this._operations = operations;
1089
1088
  this.internalCreate();
1090
1089
  }