@computec/uibase 1.0.8 → 1.0.10

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.
Files changed (134) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist-amd/communication/ConnectionOptions.d.ts +48 -0
  5. package/dist-amd/communication/ConnectionOptions.d.ts.map +1 -0
  6. package/dist-amd/communication/ConnectionOptions.js +11 -0
  7. package/dist-amd/communication/HttpClient.d.ts +249 -0
  8. package/dist-amd/communication/HttpClient.d.ts.map +1 -0
  9. package/dist-amd/communication/HttpClient.js +362 -0
  10. package/dist-amd/communication/HttpClientCacheOptions.d.ts +9 -0
  11. package/dist-amd/communication/HttpClientCacheOptions.d.ts.map +1 -0
  12. package/dist-amd/communication/HttpClientCacheOptions.js +27 -0
  13. package/dist-amd/communication/IBaseHttpClientOptions.d.ts +18 -0
  14. package/dist-amd/communication/IBaseHttpClientOptions.d.ts.map +1 -0
  15. package/dist-amd/communication/IBaseHttpClientOptions.js +4 -0
  16. package/dist-amd/communication/IConnectionInfo.d.ts +17 -0
  17. package/dist-amd/communication/IConnectionInfo.d.ts.map +1 -0
  18. package/dist-amd/communication/IConnectionInfo.js +4 -0
  19. package/dist-amd/communication/ISignalRHubClient.d.ts +47 -0
  20. package/dist-amd/communication/ISignalRHubClient.d.ts.map +1 -0
  21. package/dist-amd/communication/ISignalRHubClient.js +4 -0
  22. package/dist-amd/communication/ISignalRMessage.d.ts +8 -0
  23. package/dist-amd/communication/ISignalRMessage.d.ts.map +1 -0
  24. package/dist-amd/communication/ISignalRMessage.js +4 -0
  25. package/dist-amd/communication/SignalRHubClient.d.ts +26 -0
  26. package/dist-amd/communication/SignalRHubClient.d.ts.map +1 -0
  27. package/dist-amd/communication/SignalRHubClient.js +135 -0
  28. package/dist-amd/communication/SignalRMessage.d.ts +10 -0
  29. package/dist-amd/communication/SignalRMessage.d.ts.map +1 -0
  30. package/dist-amd/communication/SignalRMessage.js +11 -0
  31. package/dist-amd/communication/SubscribeProperties.d.ts +17 -0
  32. package/dist-amd/communication/SubscribeProperties.d.ts.map +1 -0
  33. package/dist-amd/communication/SubscribeProperties.js +27 -0
  34. package/dist-amd/helpers/ErrorHelper.d.ts +15 -0
  35. package/dist-amd/helpers/ErrorHelper.d.ts.map +1 -0
  36. package/dist-amd/helpers/ErrorHelper.js +51 -0
  37. package/dist-amd/helpers/HttpClientHelper.d.ts +42 -0
  38. package/dist-amd/helpers/HttpClientHelper.d.ts.map +1 -0
  39. package/dist-amd/helpers/HttpClientHelper.js +188 -0
  40. package/dist-amd/helpers/NavigationHelper.d.ts +52 -0
  41. package/dist-amd/helpers/NavigationHelper.d.ts.map +1 -0
  42. package/dist-amd/helpers/NavigationHelper.js +73 -0
  43. package/dist-amd/helpers/WebClientNavigationHelper.d.ts +52 -0
  44. package/dist-amd/helpers/WebClientNavigationHelper.d.ts.map +1 -0
  45. package/dist-amd/helpers/WebClientNavigationHelper.js +73 -0
  46. package/dist-amd/index.d.ts +37 -0
  47. package/dist-amd/index.d.ts.map +1 -0
  48. package/dist-amd/index.js +56 -0
  49. package/dist-amd/models/AppEngineConfiguration.d.ts +26 -0
  50. package/dist-amd/models/AppEngineConfiguration.d.ts.map +1 -0
  51. package/dist-amd/models/AppEngineConfiguration.js +11 -0
  52. package/dist-amd/models/AppEngineException.d.ts +21 -0
  53. package/dist-amd/models/AppEngineException.d.ts.map +1 -0
  54. package/dist-amd/models/AppEngineException.js +46 -0
  55. package/dist-amd/models/BaseBusinessObject.d.ts +157 -0
  56. package/dist-amd/models/BaseBusinessObject.d.ts.map +1 -0
  57. package/dist-amd/models/BaseBusinessObject.js +189 -0
  58. package/dist-amd/models/BaseError.d.ts +51 -0
  59. package/dist-amd/models/BaseError.d.ts.map +1 -0
  60. package/dist-amd/models/BaseError.js +55 -0
  61. package/dist-amd/models/CompanyInfo.d.ts +11 -0
  62. package/dist-amd/models/CompanyInfo.d.ts.map +1 -0
  63. package/dist-amd/models/CompanyInfo.js +24 -0
  64. package/dist-amd/models/DocumentedException.d.ts +22 -0
  65. package/dist-amd/models/DocumentedException.d.ts.map +1 -0
  66. package/dist-amd/models/DocumentedException.js +50 -0
  67. package/dist-amd/models/HttpResponse.d.ts +7 -0
  68. package/dist-amd/models/HttpResponse.d.ts.map +1 -0
  69. package/dist-amd/models/HttpResponse.js +11 -0
  70. package/dist-amd/models/IOdataResponse.d.ts +6 -0
  71. package/dist-amd/models/IOdataResponse.d.ts.map +1 -0
  72. package/dist-amd/models/IOdataResponse.js +4 -0
  73. package/dist-amd/models/LocalStorage.d.ts +9 -0
  74. package/dist-amd/models/LocalStorage.d.ts.map +1 -0
  75. package/dist-amd/models/LocalStorage.js +55 -0
  76. package/dist-amd/models/OdataError.d.ts +56 -0
  77. package/dist-amd/models/OdataError.d.ts.map +1 -0
  78. package/dist-amd/models/OdataError.js +90 -0
  79. package/dist-amd/models/ProblemDetails.d.ts +23 -0
  80. package/dist-amd/models/ProblemDetails.d.ts.map +1 -0
  81. package/dist-amd/models/ProblemDetails.js +39 -0
  82. package/dist-amd/models/Session.d.ts +19 -0
  83. package/dist-amd/models/Session.d.ts.map +1 -0
  84. package/dist-amd/models/Session.js +11 -0
  85. package/dist-amd/models/UserInfo.d.ts +33 -0
  86. package/dist-amd/models/UserInfo.d.ts.map +1 -0
  87. package/dist-amd/models/UserInfo.js +11 -0
  88. package/dist-amd/models/ValidationProblemDetails.d.ts +19 -0
  89. package/dist-amd/models/ValidationProblemDetails.d.ts.map +1 -0
  90. package/dist-amd/models/ValidationProblemDetails.js +43 -0
  91. package/dist-amd/models/Version.d.ts +35 -0
  92. package/dist-amd/models/Version.d.ts.map +1 -0
  93. package/dist-amd/models/Version.js +187 -0
  94. package/dist-amd/models/enums/HeadersContentTypeEnum.d.ts +15 -0
  95. package/dist-amd/models/enums/HeadersContentTypeEnum.d.ts.map +1 -0
  96. package/dist-amd/models/enums/HeadersContentTypeEnum.js +19 -0
  97. package/dist-amd/models/enums/StorageTypeEnum.d.ts +5 -0
  98. package/dist-amd/models/enums/StorageTypeEnum.d.ts.map +1 -0
  99. package/dist-amd/models/enums/StorageTypeEnum.js +10 -0
  100. package/dist-amd/models/interfaces/IAppEngineConfiguration.d.ts +24 -0
  101. package/dist-amd/models/interfaces/IAppEngineConfiguration.d.ts.map +1 -0
  102. package/dist-amd/models/interfaces/IAppEngineConfiguration.js +4 -0
  103. package/dist-amd/models/interfaces/IAppEngineException.d.ts +57 -0
  104. package/dist-amd/models/interfaces/IAppEngineException.d.ts.map +1 -0
  105. package/dist-amd/models/interfaces/IAppEngineException.js +4 -0
  106. package/dist-amd/models/interfaces/IDocumentedException.d.ts +60 -0
  107. package/dist-amd/models/interfaces/IDocumentedException.d.ts.map +1 -0
  108. package/dist-amd/models/interfaces/IDocumentedException.js +4 -0
  109. package/dist-amd/models/interfaces/IHttpResponse.d.ts +5 -0
  110. package/dist-amd/models/interfaces/IHttpResponse.d.ts.map +1 -0
  111. package/dist-amd/models/interfaces/IHttpResponse.js +4 -0
  112. package/dist-amd/models/interfaces/IOdataError.d.ts +182 -0
  113. package/dist-amd/models/interfaces/IOdataError.d.ts.map +1 -0
  114. package/dist-amd/models/interfaces/IOdataError.js +4 -0
  115. package/dist-amd/models/interfaces/IProblemDetails.d.ts +93 -0
  116. package/dist-amd/models/interfaces/IProblemDetails.d.ts.map +1 -0
  117. package/dist-amd/models/interfaces/IProblemDetails.js +4 -0
  118. package/dist-amd/models/interfaces/IValidationProblemDetails.d.ts +82 -0
  119. package/dist-amd/models/interfaces/IValidationProblemDetails.d.ts.map +1 -0
  120. package/dist-amd/models/interfaces/IValidationProblemDetails.js +4 -0
  121. package/dist-ui5/resources/computec/appengine/uibase/.library +1 -1
  122. package/dist-ui5/resources/computec/appengine/uibase/helpers/WebClientNavigationHelper-dbg.js +100 -0
  123. package/dist-ui5/resources/computec/appengine/uibase/helpers/WebClientNavigationHelper.js +2 -0
  124. package/dist-ui5/resources/computec/appengine/uibase/helpers/WebClientNavigationHelper.js.map +1 -0
  125. package/dist-ui5/resources/computec/appengine/uibase/index-dbg.js +3 -1
  126. package/dist-ui5/resources/computec/appengine/uibase/index.js +1 -1
  127. package/dist-ui5/resources/computec/appengine/uibase/index.js.map +1 -1
  128. package/dist-ui5/resources/computec/appengine/uibase/library-dbg.js +1 -1
  129. package/dist-ui5/resources/computec/appengine/uibase/library-preload.js +6 -3
  130. package/dist-ui5/resources/computec/appengine/uibase/library-preload.js.map +1 -1
  131. package/dist-ui5/resources/computec/appengine/uibase/library.js +1 -1
  132. package/dist-ui5/resources/computec/appengine/uibase/library.js.map +1 -1
  133. package/dist-ui5/resources/computec/appengine/uibase/manifest.json +1 -1
  134. package/package.json +2 -1
@@ -0,0 +1,362 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
13
+ define(["require", "exports", "../models/LocalStorage", "../helpers/ErrorHelper", "../models/enums/HeadersContentTypeEnum", "../helpers/HttpClientHelper", "./HttpClientCacheOptions", "../models/HttpResponse"], function (require, exports, LocalStorage_1, ErrorHelper_1, HeadersContentTypeEnum_1, HttpClientHelper_1, HttpClientCacheOptions_1, HttpResponse_1) {
14
+ "use strict";
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ LocalStorage_1 = __importDefault(LocalStorage_1);
17
+ ErrorHelper_1 = __importDefault(ErrorHelper_1);
18
+ HeadersContentTypeEnum_1 = __importDefault(HeadersContentTypeEnum_1);
19
+ HttpClientHelper_1 = __importDefault(HttpClientHelper_1);
20
+ HttpClientCacheOptions_1 = __importDefault(HttpClientCacheOptions_1);
21
+ HttpResponse_1 = __importDefault(HttpResponse_1);
22
+ /**
23
+ * @class
24
+ * @description This class is used to make requests to the server. It is a wrapper for the jQuery.ajax method.
25
+ * @method request - This method is used to make a other requests to the server. Remember, that you should use the other methods of this class instead of this method. This is the 2nd version of the request method. The first version is in the {@link Http}.
26
+ * @method get - This method is used to make a GET request to the server.
27
+ * @method getCache - This method is used to make a GET request to the server.
28
+ * @method post - This method is used to make a POST request to the server.
29
+ * @method postJSON - This method is used to make a POST request to the server with a JSON body.
30
+ * @method postFile - This method is used to make a POST request to the server with a file.
31
+ * @method put - This method is used to make a PUT request to the server.
32
+ * @method putJSON - This method is used to make a PUT request to the server with a JSON body.
33
+ * @method patch - This method is used to make a PATCH request to the server.
34
+ * @method patchJSON - This method is used to make a PATCH request to the server with a JSON body.
35
+ * @method remove - This method is used to make a DELETE request to the server.
36
+ *
37
+ * @example
38
+ *
39
+ * import HttpClient from 'computec/appengine/uicore/communication/HttpClient';
40
+ *
41
+ * const getProduct = async () => {
42
+ * const data = await HttpClient.get({
43
+ * url: "odata/odata.svc/Products",
44
+ * useCache: true
45
+ * });
46
+ *
47
+ * return data;
48
+ * }u
49
+ *
50
+ * const createProduct = () => {
51
+ * return HttpClient.postJSON({
52
+ * url: "odata/odata.svc/Products",
53
+ * data: {
54
+ * Name: "Test"
55
+ * }
56
+ * });
57
+ * }
58
+ */
59
+ class HttpClient {
60
+ //#region cache methods
61
+ /**
62
+ * @memberof computec.appengine.uicore.communication.HttpClient
63
+ * @static
64
+ * @public
65
+ * @description This method is used to clear the cache from service worker.
66
+ * @example
67
+ * import HttpClient from 'computec/appengine/uicore/communication/HttpClient';
68
+ *
69
+ * HttpClient.clearCache();
70
+ */
71
+ static clearCache() {
72
+ if (navigator.serviceWorker.controller) {
73
+ navigator.serviceWorker.controller.postMessage({
74
+ type: "CT_AppEngine_pwa",
75
+ });
76
+ }
77
+ else {
78
+ console.warn("No active service worker found.");
79
+ }
80
+ }
81
+ /**
82
+ * @obsolete Use cacheControl with refresh option instead
83
+ * @memberof computec.appengine.uicore.communication.HttpClient
84
+ * @static
85
+ * @public
86
+ * @description This method is used to remove a specific url from the cache.
87
+ * @param {string} url - The url to remove from the cache.
88
+ * @example
89
+ * import HttpClient from 'computec/appengine/uicore/communication/HttpClient';
90
+ *
91
+ * HttpClient.removeCache("odata/odata.svc/Products");
92
+ */
93
+ static removeCache(url) {
94
+ this.clearCache();
95
+ }
96
+ //#endregion
97
+ /**
98
+ * @memberof computec.appengine.uicore.communication.HttpClient
99
+ * @static
100
+ * @public
101
+ * @async
102
+ * @description This method is used to make a other requests to the server. Remember, that you should use the other methods of this class instead of this method.
103
+ * @param {IBasicHttpRequest} options - The options for the request.
104
+ * @param {boolean} failHandling - If true, the request will be handled as a failure.
105
+ * @param {boolean} handleBusy - If true, the request will be handled as a busy request.
106
+ * @param {boolean} includeResponse - If true, the full response will be returned and data (HttpResponse<T>) will be in the "data" property.
107
+ * @param {MBusyIndicator} busyIndicator - The busy indicator to show.
108
+ * @returns {Promise<T>} - The response of the request.
109
+ * @example
110
+ * import HttpClient from 'computec/appengine/uicore/communication/HttpClient';
111
+ *
112
+ * const getProduct = async () => {
113
+ * const data = await HttpClient.request({
114
+ * url: "odata/odata.svc/Products",
115
+ * method: "GET",
116
+ * headers: {
117
+ * "Content-Type": "application/json"
118
+ * Accepted: "application/json"
119
+ * },
120
+ * busyIndicator: this.getView().byId("busyIndicator")
121
+ * });
122
+ *
123
+ * return data;
124
+ * }
125
+ *
126
+ * void getProduct();
127
+ */
128
+ static request() {
129
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
130
+ var _a, _b, _c;
131
+ const companyId = (_a = LocalStorage_1.default.get("CTS_Session")) === null || _a === void 0 ? void 0 : _a.CompanyId;
132
+ const restOptions = Object.assign({ headers: new Headers({
133
+ "Content-Type": "application/json",
134
+ Accepted: "application/json",
135
+ }), includeResponse: false }, options);
136
+ if (companyId) {
137
+ this._appendToHeaders(restOptions.headers, "x-b1-companyid", companyId);
138
+ }
139
+ const cacheOptions = (_b = options.cacheOptions) === null || _b === void 0 ? void 0 : _b.getCacheControlHeader();
140
+ const useCtCache = (_c = options.cacheOptions) === null || _c === void 0 ? void 0 : _c.getComputecCustomCacheControlHeader();
141
+ if (cacheOptions) {
142
+ this._appendToHeaders(restOptions.headers, "cache-control", cacheOptions);
143
+ }
144
+ if (useCtCache) {
145
+ this._appendToHeaders(restOptions.headers, useCtCache[0], useCtCache[1]);
146
+ }
147
+ const url = HttpClientHelper_1.default.getFullUrl(restOptions.url);
148
+ try {
149
+ const response = yield fetch(url, restOptions);
150
+ yield HttpClientHelper_1.default.validateResponse(response, restOptions);
151
+ if (options.includeResponse) {
152
+ return new HttpResponse_1.default(yield HttpClientHelper_1.default.fetchData(response), response);
153
+ }
154
+ return HttpClientHelper_1.default.fetchData(response);
155
+ }
156
+ catch (e) {
157
+ const error = ErrorHelper_1.default.getError(e);
158
+ throw error;
159
+ }
160
+ });
161
+ }
162
+ /**
163
+ *
164
+ * @description get request. You can set options to the request. You can also choose if you want to use local cache. If data is already in cache, it will be returned from cache. Otherwise it will be requested from server and cached. Remember to use "useCache" when you know, that data is not changable.
165
+ * @see {@link IGetHttpClientOptions}
166
+ * @param url url
167
+ * @param options options
168
+ * @param options.headers by default Content-Type: "application/json", Accepted: "json"
169
+ * @param options.useCache This is a boolean value. If true, the data will be cached. If data is already in cache, it will be returned from cache. Otherwise it will be requested from server and cached. Remember to use "useCache" when you know, that data is not changable.
170
+ * @returns {T}
171
+ * @memberof HttpClient
172
+ * @static
173
+ * @example
174
+ * import HttpClient from "computec/appengine/uicore/model/Http";
175
+ *
176
+ * console.log("get account from server, without cache");
177
+ * const getAccounts = async () => {
178
+ * const account = await Http.get<IAccount>(`/api/Account/${id}`);
179
+ * return account;
180
+ * }
181
+ *
182
+ * @example
183
+ * import HttpClient from "computec/appengine/uicore/model/Http";
184
+ *
185
+ * console.log("get account from cache");
186
+ * const getAccounts = async () => {
187
+ * const account = await Http.get<IAccount>(`/api/Account/${id}`, {useCache: true});
188
+ * return account;
189
+ * }
190
+ *
191
+ */
192
+ static get(url, options = {}) {
193
+ const restOptions = Object.assign(Object.assign({}, options), { method: "GET", url: url });
194
+ if (options.useCache)
195
+ restOptions.cacheOptions = new HttpClientCacheOptions_1.default(true);
196
+ return this.request(restOptions);
197
+ }
198
+ /**
199
+ *
200
+ * @description get request with cache as true. You can set options to the request. If data is already in cache, it will be returned from cache. Otherwise it will be requested from server and cached. Remember to use "useCache" when you know, that data is not changable.
201
+ * @see {@link IGetHttpClientOptions}
202
+ * @param url url
203
+ * @param options options
204
+ * @param options.headers by default Content-Type: "application/json", Accepted: "json"
205
+ * @returns {T}
206
+ * @memberof HttpClient
207
+ * @static
208
+ *
209
+ * @example
210
+ * import HttpClient from "computec/appengine/uicore/model/Http";
211
+ *
212
+ * console.log("get account from cache");
213
+ * const getAccounts = async () => {
214
+ * const account = await Http.getCache<IAccount>(`/api/Account/${id}`, {useCache: true});
215
+ * return account;
216
+ * }
217
+ *
218
+ */
219
+ static getCache(url, options = {
220
+ cacheOptions: new HttpClientCacheOptions_1.default(true),
221
+ }) {
222
+ return this.get(url, options);
223
+ }
224
+ /**
225
+ * @description post request. You can set options to the request. {@link IBaseHttpClientOptions}
226
+ * @param data data
227
+ * @param url url
228
+ * @param options options
229
+ * @param options.headers by default {Content-Type: "application/json", Accepted: "json"}
230
+ * @returns {T} value. It depends from server response
231
+ *
232
+ * @example
233
+ * import HttpClient from "computec/appengine/uicore/model/Http";
234
+ *
235
+ * console.log("post account to server");
236
+ * const postAccount = async () => {
237
+ * const dataInJSON = JSON.stringify({name: "test"});
238
+ * const account = await Http.post<IAccount>(`/api/Account`, dataInJSON);
239
+ * return account;
240
+ * }
241
+ */
242
+ static post(data, url, options = {}) {
243
+ return this.request(Object.assign(Object.assign({}, options), { method: "POST", url: url, body: data }));
244
+ }
245
+ /**
246
+ * @description post request with JSON data. You can set options to the request. {@link IBaseHttpClientOptions}
247
+ * @param data data
248
+ * @param url url
249
+ * @param options options
250
+ * @returns {T} value. It depends from server response
251
+ *
252
+ * @example
253
+ * import HttpClient from "computec/appengine/uicore/model/Http";
254
+ *
255
+ * console.log("post account to server");
256
+ * const postAccount = async () => {
257
+ * const account = await Http.postJSON<IAccount>(`/api/Account`, {name: "test"});
258
+ * return account;
259
+ * }
260
+ *
261
+ */
262
+ static postJSON(data, url, options = {}) {
263
+ return this.post(JSON.stringify(data), url, Object.assign({ headers: {
264
+ "Content-Type": "application/json",
265
+ } }, options));
266
+ }
267
+ /**
268
+ * @description post request with File as data. You can set options to the request. {@link IBaseHttpClientOptions}
269
+ * @param data - file that will be send to server
270
+ * @param url url
271
+ * @param options options
272
+ * @param options.headers by default {Content-Type: "application/json", Accepted: "json"}
273
+ * @returns {T} value. It depends from server response
274
+ *
275
+ * @example
276
+ * import HttpClient from "computec/appengine/uicore/model/Http";
277
+ *
278
+ * console.log("send attachment to server");
279
+ * const setAttachment = async (file: File) => {
280
+ * const isPicture = file.type.includes("image").toString();
281
+ * const data = await HttpClient.postFile<IAttachment[]>(file, `api/Attachments/SetAttachment/${isPicture}/true`);
282
+ * return data[0];
283
+ * }
284
+ *
285
+ */
286
+ static postFile(data, url, options = {}) {
287
+ const formData = new FormData();
288
+ formData.append("file", data);
289
+ return this.request(Object.assign(Object.assign({ headers: {} }, options), { method: "POST", url: url, body: formData, cache: "no-cache" }));
290
+ }
291
+ /**
292
+ * @description put request. You can set options to the request. {@link IBaseHttpClientOptions}
293
+ * @param data data
294
+ * @param url url
295
+ * @param options options
296
+ * @param options.headers by default {Content-Type: "application/json", Accepted: "json"}
297
+ * @returns {T} value. It depends from server response
298
+ */
299
+ static put(data, url, options = {}) {
300
+ return this.request(Object.assign(Object.assign({}, options), { method: "PUT", url: url, body: data }));
301
+ }
302
+ /**
303
+ * @description put request with JSON data. You can set options to the request. {@link IBaseHttpClientOptions}
304
+ * @param data data
305
+ * @param url url
306
+ * @param options options
307
+ * @returns {T} value. It depends from server response
308
+ */
309
+ static putJSON(data, url, options = {}) {
310
+ return this.put(JSON.stringify(data), url, Object.assign({ headers: {
311
+ "Content-Type": "application/json",
312
+ } }, options));
313
+ }
314
+ /**
315
+ * @description patch request. You can set options to the request. {@link IBaseHttpClientOptions}
316
+ * @param data data
317
+ * @param url url
318
+ * @param options options
319
+ * @param options.headers by default {Content-Type: "application/json", Accepted: "json"}
320
+ * @returns {T} value. It depends from server response
321
+ */
322
+ static patch(data, url, options = {}) {
323
+ return this.request(Object.assign(Object.assign({}, options), { method: "PATCH", url: url, body: data }));
324
+ }
325
+ /**
326
+ * @description patch request with JSON data. You can set options to the request. {@link IBaseHttpClientOptions}
327
+ * @param data data
328
+ * @param url url
329
+ * @param options options
330
+ * @returns {T} value. It depends from server response
331
+ */
332
+ static patchJSON(data, url, options = {}) {
333
+ return this.patch(JSON.stringify(data), url, Object.assign({ headers: {
334
+ "Content-Type": "application/json",
335
+ } }, options));
336
+ }
337
+ /**
338
+ * @description delete request. You can set options to the request. {@link IBaseHttpClientOptions}
339
+ * @param url url
340
+ * @param contentType by default "application/json"
341
+ * @returns {T} value. It depends from server response
342
+ */
343
+ static remove(url, options = {}) {
344
+ return this.request(Object.assign(Object.assign({ headers: {
345
+ Accepted: `${HeadersContentTypeEnum_1.default.Null},${HeadersContentTypeEnum_1.default.Text}`,
346
+ } }, options), { method: "DELETE", url: url, cache: "no-cache" }));
347
+ }
348
+ //#region private methods
349
+ static _appendToHeaders(headers, key, value) {
350
+ if (headers instanceof Headers) {
351
+ if (!headers.has(key))
352
+ headers.append(key, value);
353
+ }
354
+ if (HttpClientHelper_1.default.isHeadersArrayType(headers)) {
355
+ if (!headers.find(([k]) => k === key))
356
+ headers.push([key, value]);
357
+ }
358
+ return (headers[key] = value);
359
+ }
360
+ }
361
+ exports.default = HttpClient;
362
+ });
@@ -0,0 +1,9 @@
1
+ export default class HttpClientCacheOptions {
2
+ useCache: boolean;
3
+ refresh: boolean;
4
+ maxAge?: number;
5
+ constructor(cache?: boolean, refresh?: boolean, maxAge?: number);
6
+ getCacheControlHeader(): string;
7
+ getComputecCustomCacheControlHeader(): [string, string];
8
+ }
9
+ //# sourceMappingURL=HttpClientCacheOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpClientCacheOptions.d.ts","sourceRoot":"","sources":["../../src/communication/HttpClientCacheOptions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;gBACJ,KAAK,GAAE,OAAe,EAAE,OAAO,GAAE,OAAe,EAAE,MAAM,CAAC,EAAE,MAAM;IAM7E,qBAAqB;IASrB,mCAAmC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;CAIvD"}
@@ -0,0 +1,27 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ class HttpClientCacheOptions {
5
+ constructor(cache = false, refresh = false, maxAge) {
6
+ this.useCache = cache;
7
+ this.refresh = refresh;
8
+ this.maxAge = maxAge;
9
+ }
10
+ getCacheControlHeader() {
11
+ if (!this.useCache)
12
+ return "no-store";
13
+ if (this.refresh)
14
+ return "no-cache";
15
+ if (this.maxAge) {
16
+ return `max-age=${this.maxAge}`;
17
+ }
18
+ return null;
19
+ }
20
+ getComputecCustomCacheControlHeader() {
21
+ if (this.useCache)
22
+ return ["use-ct-cache", "true"];
23
+ return null;
24
+ }
25
+ }
26
+ exports.default = HttpClientCacheOptions;
27
+ });
@@ -0,0 +1,18 @@
1
+ import HttpClientCacheOptions from "./HttpClientCacheOptions";
2
+ export interface IBaseHttpClientOptions {
3
+ headers?: HeadersInit;
4
+ cacheOptions?: HttpClientCacheOptions;
5
+ includeResponse?: boolean;
6
+ }
7
+ export interface IGetHttpClientOptions extends IBaseHttpClientOptions {
8
+ useCache?: boolean;
9
+ }
10
+ export interface ICustomViewHttpClientOptions extends IGetHttpClientOptions {
11
+ parameters?: string;
12
+ viewParameters?: string;
13
+ options?: string;
14
+ }
15
+ export interface IBasicHttpRequest extends RequestInit, IBaseHttpClientOptions {
16
+ url?: string;
17
+ }
18
+ //# sourceMappingURL=IBaseHttpClientOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBaseHttpClientOptions.d.ts","sourceRoot":"","sources":["../../src/communication/IBaseHttpClientOptions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACtC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;IAEpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW,EAAE,sBAAsB;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,4 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Represents the connection information for a SignalR hub.
3
+ * @interface IConnectionInfo
4
+ * @property {string} path - The path to the SignalR hub endpoint.
5
+ * @property {signalR.HubConnection} connection - The SignalR HubConnection instance.
6
+ */
7
+ export default interface IConnectionInfo {
8
+ /**
9
+ * The path to the SignalR hub endpoint.
10
+ */
11
+ path: string;
12
+ /**
13
+ * The SignalR HubConnection instance.
14
+ */
15
+ connection: signalR.HubConnection;
16
+ }
17
+ //# sourceMappingURL=IConnectionInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IConnectionInfo.d.ts","sourceRoot":"","sources":["../../src/communication/IConnectionInfo.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe;IACvC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC;CAClC"}
@@ -0,0 +1,4 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
@@ -0,0 +1,47 @@
1
+ import * as signalR from "@microsoft/signalr";
2
+ import { SubscribeProperties } from "./SubscribeProperties";
3
+ /**
4
+ * Interface for a SignalR Hub client, providing methods and properties to manage SignalR connections and subscriptions.
5
+ * @interface ISignalRHubClient
6
+ */
7
+ export default interface ISignalRHubClient {
8
+ /**
9
+ * @deprecated Use {@link initialized} promise instead.
10
+ * A promise that resolves when the client is initialized (deprecated).
11
+ */
12
+ promise: Promise<void>;
13
+ /**
14
+ * A promise that resolves when the client is initialized.
15
+ */
16
+ initialized: Promise<void>;
17
+ /**
18
+ * Gets the current SignalR HubConnection instance.
19
+ */
20
+ get connection(): signalR.HubConnection;
21
+ /**
22
+ * Gets a promise that resolves when the client is automatically connected.
23
+ */
24
+ get autoConnectPromise(): Promise<void>;
25
+ /**
26
+ * Connects to the SignalR hub.
27
+ * @returns {Promise<void>} A promise that resolves when the connection is established.
28
+ */
29
+ connect(): Promise<void>;
30
+ /**
31
+ * Disconnects from the SignalR hub.
32
+ */
33
+ disconnect(): void;
34
+ /**
35
+ * Subscribes to a SignalR hub.
36
+ * @param {SubscribeProperties} options - Options for the subscription.
37
+ * @returns {Promise<void>} A promise that resolves when the subscription is successful.
38
+ */
39
+ subscribe(options: SubscribeProperties): Promise<void>;
40
+ /**
41
+ * Registers a handler for a specific method name received from the SignalR hub.
42
+ * @param {string} methodName - The name of the method to handle.
43
+ * @param {(...args: any[]) => any} newMethod - The handler function to execute when the method is received.
44
+ */
45
+ on(methodName: string, newMethod: (...args: any[]) => any): void;
46
+ }
47
+ //# sourceMappingURL=ISignalRHubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISignalRHubClient.d.ts","sourceRoot":"","sources":["../../src/communication/ISignalRHubClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,iBAAiB;IACzC;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAExC;;OAEG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;;;OAIG;IACH,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,IAAI,CAAC;CACjE"}
@@ -0,0 +1,4 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
@@ -0,0 +1,8 @@
1
+ export default interface ISignalRMessage {
2
+ CompanyId: string;
3
+ EventType: string;
4
+ FormType: string;
5
+ ObjectKey: string;
6
+ UserName: string;
7
+ }
8
+ //# sourceMappingURL=ISignalRMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISignalRMessage.d.ts","sourceRoot":"","sources":["../../src/communication/ISignalRMessage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,eAAe;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,4 @@
1
+ define(["require", "exports"], function (require, exports) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ });
@@ -0,0 +1,26 @@
1
+ import IConnectionInfo from "./IConnectionInfo";
2
+ import ConnectionOptions from "./ConnectionOptions";
3
+ import ISignalRHubClient from "./ISignalRHubClient";
4
+ import { SubscribeProperties } from "./SubscribeProperties";
5
+ export default class SignalRHubClient implements ISignalRHubClient {
6
+ protected _globalConnections: Array<IConnectionInfo>;
7
+ protected _connection: signalR.HubConnection;
8
+ options: ConnectionOptions;
9
+ initialized: Promise<void>;
10
+ get promise(): Promise<void>;
11
+ get autoConnectPromise(): Promise<void>;
12
+ get connection(): signalR.HubConnection;
13
+ constructor(options?: ConnectionOptions);
14
+ connect(): Promise<any>;
15
+ disconnect(): void;
16
+ subscribe(options: SubscribeProperties): Promise<void>;
17
+ on<T, TU>(methodName: string, callback: (message: T) => TU): void;
18
+ off: (methodName: string) => any;
19
+ protected _subscribe(options: SubscribeProperties): Promise<void>;
20
+ private _addQueries;
21
+ private _initNewConnection;
22
+ private _setAutoReconnect;
23
+ private _getSharedConnection;
24
+ private _getConnection;
25
+ }
26
+ //# sourceMappingURL=SignalRHubClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignalRHubClient.d.ts","sourceRoot":"","sources":["../../src/communication/SignalRHubClient.ts"],"names":[],"mappings":"AAGA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,OAAO,OAAO,gBAAiB,YAAW,iBAAiB;IACjE,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACrD,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC;IAC7C,OAAO,EAAE,iBAAiB,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAW,OAAO,kBAEjB;IACD,IAAW,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE7C;IACD,IAAW,UAAU,0BAEpB;gBACW,OAAO,CAAC,EAAE,iBAAiB;IAiBjC,OAAO;IAIb,UAAU;IAKH,SAAS,CAAC,OAAO,EAAE,mBAAmB;IAGtC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE;IAI1D,GAAG,GAAI,YAAY,MAAM,SAAsC;cAEtD,UAAU,CAAC,OAAO,EAAE,mBAAmB;IAavD,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,cAAc;CAOtB"}