@nomalism-com/api 0.52.0 → 0.52.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/dist/index.cjs +89 -69
- package/dist/index.js +89 -69
- package/dist/modules/document/materialEntrance.d.ts +2 -2
- package/dist/modules/documentManagement/multimedia.d.ts +1 -0
- package/dist/modules/integration/settings.d.ts +3 -4
- package/dist/modules/print/schedulePrintJob.d.ts +1 -0
- package/dist/modules/stock/gmails.d.ts +1 -1
- package/dist/modules/stock/onlineStore.d.ts +1 -0
- package/dist/modules/stock/queryList.d.ts +1 -1
- package/dist/modules/stock/stockMovement.d.ts +1 -1
- package/dist/modules/supply/currentAccount.d.ts +1 -1
- package/dist/modules/supply/documentHeader.d.ts +1 -1
- package/dist/modules/supply/orderManagement.d.ts +1 -1
- package/dist/modules/supply/saft.d.ts +1 -1
- package/dist/modules/tickets/clt.d.ts +0 -2
- package/dist/modules/user/persona.d.ts +0 -1
- package/dist/modules/user/reasonForExemption.d.ts +1 -1
- package/dist/modules/view/webSocket.d.ts +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -234,6 +234,22 @@ var ApiError = class _ApiError extends Error {
|
|
|
234
234
|
function isApiError(error) {
|
|
235
235
|
return error instanceof ApiError;
|
|
236
236
|
}
|
|
237
|
+
var MENSAGEM_POR_ESTADO = {
|
|
238
|
+
400: "Os dados enviados n\xE3o s\xE3o v\xE1lidos. Verifique-os e tente novamente.",
|
|
239
|
+
401: "A sess\xE3o terminou. Inicie sess\xE3o novamente.",
|
|
240
|
+
403: "N\xE3o tem permiss\xE3o para realizar esta opera\xE7\xE3o.",
|
|
241
|
+
404: "O que pediu n\xE3o foi encontrado. Atualize a p\xE1gina e tente novamente.",
|
|
242
|
+
409: "Esta opera\xE7\xE3o entra em conflito com dados j\xE1 existentes. Atualize a p\xE1gina e tente novamente.",
|
|
243
|
+
413: "O pedido \xE9 demasiado grande. Reduza a quantidade de informa\xE7\xE3o ou o tamanho do ficheiro.",
|
|
244
|
+
422: "Os dados enviados n\xE3o s\xE3o v\xE1lidos. Verifique-os e tente novamente.",
|
|
245
|
+
429: "Foram feitos demasiados pedidos seguidos. Aguarde um momento e tente novamente.",
|
|
246
|
+
502: "O servidor n\xE3o est\xE1 a responder neste momento. Tente novamente dentro de instantes.",
|
|
247
|
+
503: "O servidor n\xE3o est\xE1 dispon\xEDvel neste momento. Tente novamente dentro de instantes.",
|
|
248
|
+
504: "O servidor demorou demasiado a responder. Tente novamente dentro de instantes."
|
|
249
|
+
};
|
|
250
|
+
function messageForStatus(status) {
|
|
251
|
+
return MENSAGEM_POR_ESTADO[status] ?? (status >= 500 ? "O sistema teve um problema ao tratar o pedido. Tente novamente; se o problema continuar, contacte o suporte." : "N\xE3o foi poss\xEDvel concluir a opera\xE7\xE3o. Tente novamente.");
|
|
252
|
+
}
|
|
237
253
|
function extractServerMessage(data, fallback) {
|
|
238
254
|
if (typeof data === "string" && data.trim()) return data;
|
|
239
255
|
if (isRecord(data)) {
|
|
@@ -255,21 +271,24 @@ function parseApiError(error) {
|
|
|
255
271
|
const code = axiosError.code;
|
|
256
272
|
if (axiosError.response) {
|
|
257
273
|
const { status, data } = axiosError.response;
|
|
258
|
-
const message = extractServerMessage(
|
|
259
|
-
data,
|
|
260
|
-
`Request failed with status ${status}`
|
|
261
|
-
);
|
|
274
|
+
const message = extractServerMessage(data, messageForStatus(status));
|
|
262
275
|
return new ApiError(
|
|
263
276
|
{ kind: "response", message, status, code, method, url, data },
|
|
264
277
|
error
|
|
265
278
|
);
|
|
266
279
|
}
|
|
267
280
|
if (axiosError.request) {
|
|
268
|
-
const message = code === "ECONNABORTED" ?
|
|
281
|
+
const message = code === "ECONNABORTED" ? "O servidor demorou demasiado a responder. Tente novamente dentro de instantes." : "N\xE3o foi poss\xEDvel comunicar com o servidor. Verifique a liga\xE7\xE3o \xE0 internet e tente novamente.";
|
|
269
282
|
return new ApiError({ kind: "request", message, code, method, url }, error);
|
|
270
283
|
}
|
|
271
284
|
return new ApiError(
|
|
272
|
-
{
|
|
285
|
+
{
|
|
286
|
+
kind: "setup",
|
|
287
|
+
message: "N\xE3o foi poss\xEDvel enviar o pedido. Atualize a p\xE1gina e tente novamente.",
|
|
288
|
+
code,
|
|
289
|
+
method,
|
|
290
|
+
url
|
|
291
|
+
},
|
|
273
292
|
error
|
|
274
293
|
);
|
|
275
294
|
}
|
|
@@ -369,7 +388,8 @@ var Repository4 = class {
|
|
|
369
388
|
prison,
|
|
370
389
|
note,
|
|
371
390
|
availableStock,
|
|
372
|
-
token
|
|
391
|
+
token,
|
|
392
|
+
as
|
|
373
393
|
}) {
|
|
374
394
|
const qs = new URLSearchParams();
|
|
375
395
|
qs.set("ef_name", ef_name);
|
|
@@ -382,7 +402,8 @@ var Repository4 = class {
|
|
|
382
402
|
}
|
|
383
403
|
qs.set("prison", prison.toString());
|
|
384
404
|
qs.set("availableStock", availableStock.toString());
|
|
385
|
-
qs.set("token", token);
|
|
405
|
+
if (token) qs.set("token", token);
|
|
406
|
+
if (as) qs.set("as", as);
|
|
386
407
|
return `${this.route}print_label_pdf/${product_id}?${qs.toString()}`;
|
|
387
408
|
}
|
|
388
409
|
printBulkLabelToPdfUrl({
|
|
@@ -391,7 +412,8 @@ var Repository4 = class {
|
|
|
391
412
|
notOk,
|
|
392
413
|
clientOrders,
|
|
393
414
|
saved_em_picking_ids,
|
|
394
|
-
token
|
|
415
|
+
token,
|
|
416
|
+
as
|
|
395
417
|
}) {
|
|
396
418
|
const qs = new URLSearchParams();
|
|
397
419
|
qs.set("groupLabel", groupLabel.toString());
|
|
@@ -399,7 +421,8 @@ var Repository4 = class {
|
|
|
399
421
|
qs.set("notOk", notOk);
|
|
400
422
|
qs.set("clientOrders", clientOrders);
|
|
401
423
|
qs.set("saved_em_picking_ids", saved_em_picking_ids);
|
|
402
|
-
qs.set("token", token);
|
|
424
|
+
if (token) qs.set("token", token);
|
|
425
|
+
if (as) qs.set("as", as);
|
|
403
426
|
return `${this.route}print_bulk_label_pdf?${qs.toString()}`;
|
|
404
427
|
}
|
|
405
428
|
};
|
|
@@ -952,6 +975,13 @@ var Repository21 = class {
|
|
|
952
975
|
}
|
|
953
976
|
);
|
|
954
977
|
}
|
|
978
|
+
async setPublic(data) {
|
|
979
|
+
const response = await this.api.post(
|
|
980
|
+
`${this.route}public`,
|
|
981
|
+
data
|
|
982
|
+
);
|
|
983
|
+
return response.data;
|
|
984
|
+
}
|
|
955
985
|
};
|
|
956
986
|
|
|
957
987
|
// src/modules/integration/emailLog.ts
|
|
@@ -1266,13 +1296,6 @@ var Repository32 = class {
|
|
|
1266
1296
|
this.api = api;
|
|
1267
1297
|
this.route = route;
|
|
1268
1298
|
}
|
|
1269
|
-
async create(body) {
|
|
1270
|
-
const response = await this.api.post(
|
|
1271
|
-
`${this.route}`,
|
|
1272
|
-
body
|
|
1273
|
-
);
|
|
1274
|
-
return response.data;
|
|
1275
|
-
}
|
|
1276
1299
|
async findByKey(params) {
|
|
1277
1300
|
const response = await this.api.get(
|
|
1278
1301
|
`${this.route}by_key`,
|
|
@@ -1460,6 +1483,10 @@ var Repository36 = class {
|
|
|
1460
1483
|
);
|
|
1461
1484
|
return response.data;
|
|
1462
1485
|
}
|
|
1486
|
+
async findToday() {
|
|
1487
|
+
const response = await this.api.get(`${this.route}today`);
|
|
1488
|
+
return response.data;
|
|
1489
|
+
}
|
|
1463
1490
|
async findByOwner(params) {
|
|
1464
1491
|
const response = await this.api.get(
|
|
1465
1492
|
`${this.route}by_owner`,
|
|
@@ -1857,9 +1884,10 @@ var Repository47 = class {
|
|
|
1857
1884
|
const response = await this.api.get(`${this.route}auth`);
|
|
1858
1885
|
return response.data;
|
|
1859
1886
|
}
|
|
1860
|
-
async emails() {
|
|
1887
|
+
async emails(params) {
|
|
1861
1888
|
const response = await this.api.get(
|
|
1862
|
-
`${this.route}emails
|
|
1889
|
+
`${this.route}emails`,
|
|
1890
|
+
{ params }
|
|
1863
1891
|
);
|
|
1864
1892
|
return response.data;
|
|
1865
1893
|
}
|
|
@@ -1940,6 +1968,13 @@ var Repository50 = class {
|
|
|
1940
1968
|
);
|
|
1941
1969
|
return response.data;
|
|
1942
1970
|
}
|
|
1971
|
+
async cancelOrder(body) {
|
|
1972
|
+
const response = await this.api.post(
|
|
1973
|
+
`${this.route}orders/cancel`,
|
|
1974
|
+
body
|
|
1975
|
+
);
|
|
1976
|
+
return response.data;
|
|
1977
|
+
}
|
|
1943
1978
|
};
|
|
1944
1979
|
|
|
1945
1980
|
// src/modules/stock/priceTable.ts
|
|
@@ -2159,7 +2194,7 @@ var Repository53 = class {
|
|
|
2159
2194
|
}
|
|
2160
2195
|
printLabelToPdfUrl({ id }, { token }) {
|
|
2161
2196
|
const qs = new URLSearchParams();
|
|
2162
|
-
qs.set("token", token);
|
|
2197
|
+
if (token) qs.set("token", token);
|
|
2163
2198
|
return `${this.route}print_label_pdf/${id}?${qs.toString()}`;
|
|
2164
2199
|
}
|
|
2165
2200
|
printLabelToPdfBulk({
|
|
@@ -2167,7 +2202,7 @@ var Repository53 = class {
|
|
|
2167
2202
|
token
|
|
2168
2203
|
}) {
|
|
2169
2204
|
const qs = new URLSearchParams();
|
|
2170
|
-
qs.set("token", token);
|
|
2205
|
+
if (token) qs.set("token", token);
|
|
2171
2206
|
qs.set("ids", ids);
|
|
2172
2207
|
return `${this.route}print_label_pdf/bulk?${qs.toString()}`;
|
|
2173
2208
|
}
|
|
@@ -2346,15 +2381,11 @@ var Repository58 = class {
|
|
|
2346
2381
|
getQueryExecuteUrl({
|
|
2347
2382
|
query_id,
|
|
2348
2383
|
output,
|
|
2349
|
-
token,
|
|
2350
2384
|
...data
|
|
2351
2385
|
}) {
|
|
2352
2386
|
const qs = new URLSearchParams();
|
|
2353
2387
|
qs.set("query_id", query_id);
|
|
2354
2388
|
qs.set("output", output);
|
|
2355
|
-
if (token) {
|
|
2356
|
-
qs.set("token", token);
|
|
2357
|
-
}
|
|
2358
2389
|
Object.entries(data).forEach(([key, value]) => {
|
|
2359
2390
|
if (typeof value === "undefined") return;
|
|
2360
2391
|
if (value === null) return;
|
|
@@ -2381,7 +2412,9 @@ var Repository59 = class {
|
|
|
2381
2412
|
return response.data;
|
|
2382
2413
|
}
|
|
2383
2414
|
async from_master_checked() {
|
|
2384
|
-
const response = await this.api.post(
|
|
2415
|
+
const response = await this.api.post(
|
|
2416
|
+
`${this.route}from_master_checked`
|
|
2417
|
+
);
|
|
2385
2418
|
return response.data;
|
|
2386
2419
|
}
|
|
2387
2420
|
};
|
|
@@ -2505,14 +2538,12 @@ var Repository64 = class {
|
|
|
2505
2538
|
getStockCsvUrl({
|
|
2506
2539
|
date,
|
|
2507
2540
|
version,
|
|
2508
|
-
format
|
|
2509
|
-
token
|
|
2541
|
+
format
|
|
2510
2542
|
}) {
|
|
2511
2543
|
const qs = new URLSearchParams();
|
|
2512
2544
|
qs.set("date", date.toISOString());
|
|
2513
2545
|
qs.set("version", version);
|
|
2514
2546
|
qs.set("format", format);
|
|
2515
|
-
qs.set("token", token);
|
|
2516
2547
|
return `${this.route}csv?${qs.toString()}`;
|
|
2517
2548
|
}
|
|
2518
2549
|
};
|
|
@@ -2817,15 +2848,13 @@ var Repository71 = class {
|
|
|
2817
2848
|
owner_id,
|
|
2818
2849
|
start_date,
|
|
2819
2850
|
end_date,
|
|
2820
|
-
output
|
|
2821
|
-
token
|
|
2851
|
+
output
|
|
2822
2852
|
}) {
|
|
2823
2853
|
const qs = new URLSearchParams();
|
|
2824
2854
|
qs.set("owner_id", owner_id);
|
|
2825
2855
|
qs.set("output", output);
|
|
2826
2856
|
if (start_date) qs.set("start_date", start_date.toISOString());
|
|
2827
2857
|
if (end_date) qs.set("end_date", end_date.toISOString());
|
|
2828
|
-
qs.set("token", token);
|
|
2829
2858
|
return `${this.route}export?${qs.toString()}`;
|
|
2830
2859
|
}
|
|
2831
2860
|
};
|
|
@@ -2917,6 +2946,9 @@ var Repository72 = class {
|
|
|
2917
2946
|
if (data?.token) {
|
|
2918
2947
|
qs.set("token", data.token);
|
|
2919
2948
|
}
|
|
2949
|
+
if (data?.as) {
|
|
2950
|
+
qs.set("as", data.as);
|
|
2951
|
+
}
|
|
2920
2952
|
return `${this.route}document_pdf/${id}?${qs.toString()}`;
|
|
2921
2953
|
}
|
|
2922
2954
|
async documentThermalPrint({ id }, query) {
|
|
@@ -3072,12 +3104,12 @@ var Repository76 = class {
|
|
|
3072
3104
|
}
|
|
3073
3105
|
printLabelToPdfUrl({ document_line_ids }, { token }) {
|
|
3074
3106
|
const qs = new URLSearchParams();
|
|
3075
|
-
qs.set("token", token);
|
|
3107
|
+
if (token) qs.set("token", token);
|
|
3076
3108
|
return `${this.route}print_label_pdf/${document_line_ids}?${qs.toString()}`;
|
|
3077
3109
|
}
|
|
3078
3110
|
printGroupLabelToPdfUrl({ document_line_ids }, { token }) {
|
|
3079
3111
|
const qs = new URLSearchParams();
|
|
3080
|
-
qs.set("token", token);
|
|
3112
|
+
if (token) qs.set("token", token);
|
|
3081
3113
|
return `${this.route}print_group_label_pdf/${document_line_ids}?${qs.toString()}`;
|
|
3082
3114
|
}
|
|
3083
3115
|
};
|
|
@@ -3336,8 +3368,8 @@ var Repository85 = class {
|
|
|
3336
3368
|
});
|
|
3337
3369
|
return response.data;
|
|
3338
3370
|
}
|
|
3339
|
-
async findAllProviderProducts() {
|
|
3340
|
-
const response = await this.api.get(`${this.route}all_provider_products
|
|
3371
|
+
async findAllProviderProducts(params) {
|
|
3372
|
+
const response = await this.api.get(`${this.route}all_provider_products`, { params });
|
|
3341
3373
|
return response.data;
|
|
3342
3374
|
}
|
|
3343
3375
|
};
|
|
@@ -3416,7 +3448,7 @@ var Repository87 = class {
|
|
|
3416
3448
|
year
|
|
3417
3449
|
}) {
|
|
3418
3450
|
const qs = new URLSearchParams();
|
|
3419
|
-
qs.set("token", token);
|
|
3451
|
+
if (token) qs.set("token", token);
|
|
3420
3452
|
if (ids) {
|
|
3421
3453
|
qs.set("ids", ids);
|
|
3422
3454
|
return `${this.route}create_batch_pdf?${qs.toString()}`;
|
|
@@ -3521,15 +3553,10 @@ var Repository90 = class {
|
|
|
3521
3553
|
constructor({ route }) {
|
|
3522
3554
|
this.route = route;
|
|
3523
3555
|
}
|
|
3524
|
-
getUrl({
|
|
3525
|
-
date_start,
|
|
3526
|
-
date_end,
|
|
3527
|
-
token
|
|
3528
|
-
}) {
|
|
3556
|
+
getUrl({ date_start, date_end }) {
|
|
3529
3557
|
const qs = new URLSearchParams();
|
|
3530
3558
|
qs.set("date_start", date_start);
|
|
3531
3559
|
qs.set("date_end", date_end);
|
|
3532
|
-
qs.set("token", token);
|
|
3533
3560
|
return `${this.route}download?${qs.toString()}`;
|
|
3534
3561
|
}
|
|
3535
3562
|
};
|
|
@@ -3622,7 +3649,7 @@ var Repository93 = class {
|
|
|
3622
3649
|
return response.data;
|
|
3623
3650
|
}
|
|
3624
3651
|
async update({ id }, body) {
|
|
3625
|
-
await this.api.
|
|
3652
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3626
3653
|
}
|
|
3627
3654
|
async deleteOne({
|
|
3628
3655
|
id
|
|
@@ -3643,13 +3670,6 @@ var Repository94 = class {
|
|
|
3643
3670
|
this.api = api;
|
|
3644
3671
|
this.route = route;
|
|
3645
3672
|
}
|
|
3646
|
-
async create(body) {
|
|
3647
|
-
const response = await this.api.post(
|
|
3648
|
-
`${this.route}`,
|
|
3649
|
-
body
|
|
3650
|
-
);
|
|
3651
|
-
return response.data;
|
|
3652
|
-
}
|
|
3653
3673
|
async find() {
|
|
3654
3674
|
const response = await this.api.get(`${this.route}`);
|
|
3655
3675
|
return response.data;
|
|
@@ -3672,12 +3692,7 @@ var Repository94 = class {
|
|
|
3672
3692
|
return response.data;
|
|
3673
3693
|
}
|
|
3674
3694
|
async update({ id }, body) {
|
|
3675
|
-
await this.api.
|
|
3676
|
-
}
|
|
3677
|
-
async deleteOne({
|
|
3678
|
-
id
|
|
3679
|
-
}) {
|
|
3680
|
-
await this.api.delete(`${this.route}${id}`);
|
|
3695
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3681
3696
|
}
|
|
3682
3697
|
};
|
|
3683
3698
|
|
|
@@ -3724,7 +3739,7 @@ var Repository95 = class {
|
|
|
3724
3739
|
return response.data;
|
|
3725
3740
|
}
|
|
3726
3741
|
async update({ id }, body) {
|
|
3727
|
-
await this.api.
|
|
3742
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3728
3743
|
}
|
|
3729
3744
|
async deleteOne({
|
|
3730
3745
|
id
|
|
@@ -4452,15 +4467,6 @@ var Repository115 = class {
|
|
|
4452
4467
|
});
|
|
4453
4468
|
return response.data;
|
|
4454
4469
|
}
|
|
4455
|
-
async findForBillOfLading(data) {
|
|
4456
|
-
const response = await this.api.get(
|
|
4457
|
-
`${this.route}`,
|
|
4458
|
-
{
|
|
4459
|
-
data
|
|
4460
|
-
}
|
|
4461
|
-
);
|
|
4462
|
-
return response.data;
|
|
4463
|
-
}
|
|
4464
4470
|
async findByEmail(data) {
|
|
4465
4471
|
const response = await this.api.get(`${this.route}by_email`, {
|
|
4466
4472
|
data
|
|
@@ -5187,6 +5193,7 @@ var Repository133 = class {
|
|
|
5187
5193
|
// src/modules/view/webSocket.ts
|
|
5188
5194
|
var CLOSE_AUTH_REJECTED = 4401;
|
|
5189
5195
|
var CLOSE_AUTH_UNAVAILABLE = 4503;
|
|
5196
|
+
var MAX_AUTH_RETRIES = 3;
|
|
5190
5197
|
var PING_INTERVAL_MS = 25e3;
|
|
5191
5198
|
var MAX_BACKOFF_MS = 3e4;
|
|
5192
5199
|
var BASE_BACKOFF_MS = 1e3;
|
|
@@ -5200,6 +5207,7 @@ var Service = class {
|
|
|
5200
5207
|
}
|
|
5201
5208
|
openSocket({
|
|
5202
5209
|
token,
|
|
5210
|
+
onAuthRejected,
|
|
5203
5211
|
channel,
|
|
5204
5212
|
onEvent,
|
|
5205
5213
|
onOpen,
|
|
@@ -5209,11 +5217,15 @@ var Service = class {
|
|
|
5209
5217
|
}) {
|
|
5210
5218
|
let ws = null;
|
|
5211
5219
|
let attempts = 0;
|
|
5220
|
+
let authRejections = 0;
|
|
5212
5221
|
let opensSoFar = 0;
|
|
5213
5222
|
let pingTimer = null;
|
|
5214
5223
|
let reconnectTimer = null;
|
|
5215
5224
|
let closedByCaller = false;
|
|
5216
|
-
const subprotocols =
|
|
5225
|
+
const subprotocols = () => {
|
|
5226
|
+
const current = typeof token === "function" ? token() : token;
|
|
5227
|
+
return channel ? [`bearer.${current}`, `channel.${channel}`] : [`bearer.${current}`];
|
|
5228
|
+
};
|
|
5217
5229
|
const stopPing = () => {
|
|
5218
5230
|
if (pingTimer !== null) {
|
|
5219
5231
|
window.clearInterval(pingTimer);
|
|
@@ -5244,7 +5256,7 @@ var Service = class {
|
|
|
5244
5256
|
const connect = () => {
|
|
5245
5257
|
if (closedByCaller) return;
|
|
5246
5258
|
try {
|
|
5247
|
-
ws = new WebSocket(this.route, subprotocols);
|
|
5259
|
+
ws = new WebSocket(this.route, subprotocols());
|
|
5248
5260
|
} catch (err) {
|
|
5249
5261
|
console.error("WebSocket constructor threw", err);
|
|
5250
5262
|
scheduleReconnect();
|
|
@@ -5252,6 +5264,7 @@ var Service = class {
|
|
|
5252
5264
|
}
|
|
5253
5265
|
ws.onopen = () => {
|
|
5254
5266
|
attempts = 0;
|
|
5267
|
+
authRejections = 0;
|
|
5255
5268
|
opensSoFar += 1;
|
|
5256
5269
|
startPing();
|
|
5257
5270
|
if (opensSoFar === 1) {
|
|
@@ -5288,6 +5301,13 @@ var Service = class {
|
|
|
5288
5301
|
ws = null;
|
|
5289
5302
|
onClose?.();
|
|
5290
5303
|
if (e.code === CLOSE_AUTH_REJECTED) {
|
|
5304
|
+
if (typeof token === "function" && authRejections < MAX_AUTH_RETRIES) {
|
|
5305
|
+
authRejections += 1;
|
|
5306
|
+
void Promise.resolve().then(() => onAuthRejected?.()).catch((err) => {
|
|
5307
|
+
console.warn("WebSocket onAuthRejected failed", err);
|
|
5308
|
+
}).finally(scheduleReconnect);
|
|
5309
|
+
return;
|
|
5310
|
+
}
|
|
5291
5311
|
console.error("WebSocket auth rejected by server, not reconnecting");
|
|
5292
5312
|
closedByCaller = true;
|
|
5293
5313
|
return;
|
package/dist/index.js
CHANGED
|
@@ -201,6 +201,22 @@ var ApiError = class _ApiError extends Error {
|
|
|
201
201
|
function isApiError(error) {
|
|
202
202
|
return error instanceof ApiError;
|
|
203
203
|
}
|
|
204
|
+
var MENSAGEM_POR_ESTADO = {
|
|
205
|
+
400: "Os dados enviados n\xE3o s\xE3o v\xE1lidos. Verifique-os e tente novamente.",
|
|
206
|
+
401: "A sess\xE3o terminou. Inicie sess\xE3o novamente.",
|
|
207
|
+
403: "N\xE3o tem permiss\xE3o para realizar esta opera\xE7\xE3o.",
|
|
208
|
+
404: "O que pediu n\xE3o foi encontrado. Atualize a p\xE1gina e tente novamente.",
|
|
209
|
+
409: "Esta opera\xE7\xE3o entra em conflito com dados j\xE1 existentes. Atualize a p\xE1gina e tente novamente.",
|
|
210
|
+
413: "O pedido \xE9 demasiado grande. Reduza a quantidade de informa\xE7\xE3o ou o tamanho do ficheiro.",
|
|
211
|
+
422: "Os dados enviados n\xE3o s\xE3o v\xE1lidos. Verifique-os e tente novamente.",
|
|
212
|
+
429: "Foram feitos demasiados pedidos seguidos. Aguarde um momento e tente novamente.",
|
|
213
|
+
502: "O servidor n\xE3o est\xE1 a responder neste momento. Tente novamente dentro de instantes.",
|
|
214
|
+
503: "O servidor n\xE3o est\xE1 dispon\xEDvel neste momento. Tente novamente dentro de instantes.",
|
|
215
|
+
504: "O servidor demorou demasiado a responder. Tente novamente dentro de instantes."
|
|
216
|
+
};
|
|
217
|
+
function messageForStatus(status) {
|
|
218
|
+
return MENSAGEM_POR_ESTADO[status] ?? (status >= 500 ? "O sistema teve um problema ao tratar o pedido. Tente novamente; se o problema continuar, contacte o suporte." : "N\xE3o foi poss\xEDvel concluir a opera\xE7\xE3o. Tente novamente.");
|
|
219
|
+
}
|
|
204
220
|
function extractServerMessage(data, fallback) {
|
|
205
221
|
if (typeof data === "string" && data.trim()) return data;
|
|
206
222
|
if (isRecord(data)) {
|
|
@@ -222,21 +238,24 @@ function parseApiError(error) {
|
|
|
222
238
|
const code = axiosError.code;
|
|
223
239
|
if (axiosError.response) {
|
|
224
240
|
const { status, data } = axiosError.response;
|
|
225
|
-
const message = extractServerMessage(
|
|
226
|
-
data,
|
|
227
|
-
`Request failed with status ${status}`
|
|
228
|
-
);
|
|
241
|
+
const message = extractServerMessage(data, messageForStatus(status));
|
|
229
242
|
return new ApiError(
|
|
230
243
|
{ kind: "response", message, status, code, method, url, data },
|
|
231
244
|
error
|
|
232
245
|
);
|
|
233
246
|
}
|
|
234
247
|
if (axiosError.request) {
|
|
235
|
-
const message = code === "ECONNABORTED" ?
|
|
248
|
+
const message = code === "ECONNABORTED" ? "O servidor demorou demasiado a responder. Tente novamente dentro de instantes." : "N\xE3o foi poss\xEDvel comunicar com o servidor. Verifique a liga\xE7\xE3o \xE0 internet e tente novamente.";
|
|
236
249
|
return new ApiError({ kind: "request", message, code, method, url }, error);
|
|
237
250
|
}
|
|
238
251
|
return new ApiError(
|
|
239
|
-
{
|
|
252
|
+
{
|
|
253
|
+
kind: "setup",
|
|
254
|
+
message: "N\xE3o foi poss\xEDvel enviar o pedido. Atualize a p\xE1gina e tente novamente.",
|
|
255
|
+
code,
|
|
256
|
+
method,
|
|
257
|
+
url
|
|
258
|
+
},
|
|
240
259
|
error
|
|
241
260
|
);
|
|
242
261
|
}
|
|
@@ -336,7 +355,8 @@ var Repository4 = class {
|
|
|
336
355
|
prison,
|
|
337
356
|
note,
|
|
338
357
|
availableStock,
|
|
339
|
-
token
|
|
358
|
+
token,
|
|
359
|
+
as
|
|
340
360
|
}) {
|
|
341
361
|
const qs = new URLSearchParams();
|
|
342
362
|
qs.set("ef_name", ef_name);
|
|
@@ -349,7 +369,8 @@ var Repository4 = class {
|
|
|
349
369
|
}
|
|
350
370
|
qs.set("prison", prison.toString());
|
|
351
371
|
qs.set("availableStock", availableStock.toString());
|
|
352
|
-
qs.set("token", token);
|
|
372
|
+
if (token) qs.set("token", token);
|
|
373
|
+
if (as) qs.set("as", as);
|
|
353
374
|
return `${this.route}print_label_pdf/${product_id}?${qs.toString()}`;
|
|
354
375
|
}
|
|
355
376
|
printBulkLabelToPdfUrl({
|
|
@@ -358,7 +379,8 @@ var Repository4 = class {
|
|
|
358
379
|
notOk,
|
|
359
380
|
clientOrders,
|
|
360
381
|
saved_em_picking_ids,
|
|
361
|
-
token
|
|
382
|
+
token,
|
|
383
|
+
as
|
|
362
384
|
}) {
|
|
363
385
|
const qs = new URLSearchParams();
|
|
364
386
|
qs.set("groupLabel", groupLabel.toString());
|
|
@@ -366,7 +388,8 @@ var Repository4 = class {
|
|
|
366
388
|
qs.set("notOk", notOk);
|
|
367
389
|
qs.set("clientOrders", clientOrders);
|
|
368
390
|
qs.set("saved_em_picking_ids", saved_em_picking_ids);
|
|
369
|
-
qs.set("token", token);
|
|
391
|
+
if (token) qs.set("token", token);
|
|
392
|
+
if (as) qs.set("as", as);
|
|
370
393
|
return `${this.route}print_bulk_label_pdf?${qs.toString()}`;
|
|
371
394
|
}
|
|
372
395
|
};
|
|
@@ -919,6 +942,13 @@ var Repository21 = class {
|
|
|
919
942
|
}
|
|
920
943
|
);
|
|
921
944
|
}
|
|
945
|
+
async setPublic(data) {
|
|
946
|
+
const response = await this.api.post(
|
|
947
|
+
`${this.route}public`,
|
|
948
|
+
data
|
|
949
|
+
);
|
|
950
|
+
return response.data;
|
|
951
|
+
}
|
|
922
952
|
};
|
|
923
953
|
|
|
924
954
|
// src/modules/integration/emailLog.ts
|
|
@@ -1233,13 +1263,6 @@ var Repository32 = class {
|
|
|
1233
1263
|
this.api = api;
|
|
1234
1264
|
this.route = route;
|
|
1235
1265
|
}
|
|
1236
|
-
async create(body) {
|
|
1237
|
-
const response = await this.api.post(
|
|
1238
|
-
`${this.route}`,
|
|
1239
|
-
body
|
|
1240
|
-
);
|
|
1241
|
-
return response.data;
|
|
1242
|
-
}
|
|
1243
1266
|
async findByKey(params) {
|
|
1244
1267
|
const response = await this.api.get(
|
|
1245
1268
|
`${this.route}by_key`,
|
|
@@ -1427,6 +1450,10 @@ var Repository36 = class {
|
|
|
1427
1450
|
);
|
|
1428
1451
|
return response.data;
|
|
1429
1452
|
}
|
|
1453
|
+
async findToday() {
|
|
1454
|
+
const response = await this.api.get(`${this.route}today`);
|
|
1455
|
+
return response.data;
|
|
1456
|
+
}
|
|
1430
1457
|
async findByOwner(params) {
|
|
1431
1458
|
const response = await this.api.get(
|
|
1432
1459
|
`${this.route}by_owner`,
|
|
@@ -1824,9 +1851,10 @@ var Repository47 = class {
|
|
|
1824
1851
|
const response = await this.api.get(`${this.route}auth`);
|
|
1825
1852
|
return response.data;
|
|
1826
1853
|
}
|
|
1827
|
-
async emails() {
|
|
1854
|
+
async emails(params) {
|
|
1828
1855
|
const response = await this.api.get(
|
|
1829
|
-
`${this.route}emails
|
|
1856
|
+
`${this.route}emails`,
|
|
1857
|
+
{ params }
|
|
1830
1858
|
);
|
|
1831
1859
|
return response.data;
|
|
1832
1860
|
}
|
|
@@ -1907,6 +1935,13 @@ var Repository50 = class {
|
|
|
1907
1935
|
);
|
|
1908
1936
|
return response.data;
|
|
1909
1937
|
}
|
|
1938
|
+
async cancelOrder(body) {
|
|
1939
|
+
const response = await this.api.post(
|
|
1940
|
+
`${this.route}orders/cancel`,
|
|
1941
|
+
body
|
|
1942
|
+
);
|
|
1943
|
+
return response.data;
|
|
1944
|
+
}
|
|
1910
1945
|
};
|
|
1911
1946
|
|
|
1912
1947
|
// src/modules/stock/priceTable.ts
|
|
@@ -2126,7 +2161,7 @@ var Repository53 = class {
|
|
|
2126
2161
|
}
|
|
2127
2162
|
printLabelToPdfUrl({ id }, { token }) {
|
|
2128
2163
|
const qs = new URLSearchParams();
|
|
2129
|
-
qs.set("token", token);
|
|
2164
|
+
if (token) qs.set("token", token);
|
|
2130
2165
|
return `${this.route}print_label_pdf/${id}?${qs.toString()}`;
|
|
2131
2166
|
}
|
|
2132
2167
|
printLabelToPdfBulk({
|
|
@@ -2134,7 +2169,7 @@ var Repository53 = class {
|
|
|
2134
2169
|
token
|
|
2135
2170
|
}) {
|
|
2136
2171
|
const qs = new URLSearchParams();
|
|
2137
|
-
qs.set("token", token);
|
|
2172
|
+
if (token) qs.set("token", token);
|
|
2138
2173
|
qs.set("ids", ids);
|
|
2139
2174
|
return `${this.route}print_label_pdf/bulk?${qs.toString()}`;
|
|
2140
2175
|
}
|
|
@@ -2313,15 +2348,11 @@ var Repository58 = class {
|
|
|
2313
2348
|
getQueryExecuteUrl({
|
|
2314
2349
|
query_id,
|
|
2315
2350
|
output,
|
|
2316
|
-
token,
|
|
2317
2351
|
...data
|
|
2318
2352
|
}) {
|
|
2319
2353
|
const qs = new URLSearchParams();
|
|
2320
2354
|
qs.set("query_id", query_id);
|
|
2321
2355
|
qs.set("output", output);
|
|
2322
|
-
if (token) {
|
|
2323
|
-
qs.set("token", token);
|
|
2324
|
-
}
|
|
2325
2356
|
Object.entries(data).forEach(([key, value]) => {
|
|
2326
2357
|
if (typeof value === "undefined") return;
|
|
2327
2358
|
if (value === null) return;
|
|
@@ -2348,7 +2379,9 @@ var Repository59 = class {
|
|
|
2348
2379
|
return response.data;
|
|
2349
2380
|
}
|
|
2350
2381
|
async from_master_checked() {
|
|
2351
|
-
const response = await this.api.post(
|
|
2382
|
+
const response = await this.api.post(
|
|
2383
|
+
`${this.route}from_master_checked`
|
|
2384
|
+
);
|
|
2352
2385
|
return response.data;
|
|
2353
2386
|
}
|
|
2354
2387
|
};
|
|
@@ -2472,14 +2505,12 @@ var Repository64 = class {
|
|
|
2472
2505
|
getStockCsvUrl({
|
|
2473
2506
|
date,
|
|
2474
2507
|
version,
|
|
2475
|
-
format
|
|
2476
|
-
token
|
|
2508
|
+
format
|
|
2477
2509
|
}) {
|
|
2478
2510
|
const qs = new URLSearchParams();
|
|
2479
2511
|
qs.set("date", date.toISOString());
|
|
2480
2512
|
qs.set("version", version);
|
|
2481
2513
|
qs.set("format", format);
|
|
2482
|
-
qs.set("token", token);
|
|
2483
2514
|
return `${this.route}csv?${qs.toString()}`;
|
|
2484
2515
|
}
|
|
2485
2516
|
};
|
|
@@ -2784,15 +2815,13 @@ var Repository71 = class {
|
|
|
2784
2815
|
owner_id,
|
|
2785
2816
|
start_date,
|
|
2786
2817
|
end_date,
|
|
2787
|
-
output
|
|
2788
|
-
token
|
|
2818
|
+
output
|
|
2789
2819
|
}) {
|
|
2790
2820
|
const qs = new URLSearchParams();
|
|
2791
2821
|
qs.set("owner_id", owner_id);
|
|
2792
2822
|
qs.set("output", output);
|
|
2793
2823
|
if (start_date) qs.set("start_date", start_date.toISOString());
|
|
2794
2824
|
if (end_date) qs.set("end_date", end_date.toISOString());
|
|
2795
|
-
qs.set("token", token);
|
|
2796
2825
|
return `${this.route}export?${qs.toString()}`;
|
|
2797
2826
|
}
|
|
2798
2827
|
};
|
|
@@ -2884,6 +2913,9 @@ var Repository72 = class {
|
|
|
2884
2913
|
if (data?.token) {
|
|
2885
2914
|
qs.set("token", data.token);
|
|
2886
2915
|
}
|
|
2916
|
+
if (data?.as) {
|
|
2917
|
+
qs.set("as", data.as);
|
|
2918
|
+
}
|
|
2887
2919
|
return `${this.route}document_pdf/${id}?${qs.toString()}`;
|
|
2888
2920
|
}
|
|
2889
2921
|
async documentThermalPrint({ id }, query) {
|
|
@@ -3039,12 +3071,12 @@ var Repository76 = class {
|
|
|
3039
3071
|
}
|
|
3040
3072
|
printLabelToPdfUrl({ document_line_ids }, { token }) {
|
|
3041
3073
|
const qs = new URLSearchParams();
|
|
3042
|
-
qs.set("token", token);
|
|
3074
|
+
if (token) qs.set("token", token);
|
|
3043
3075
|
return `${this.route}print_label_pdf/${document_line_ids}?${qs.toString()}`;
|
|
3044
3076
|
}
|
|
3045
3077
|
printGroupLabelToPdfUrl({ document_line_ids }, { token }) {
|
|
3046
3078
|
const qs = new URLSearchParams();
|
|
3047
|
-
qs.set("token", token);
|
|
3079
|
+
if (token) qs.set("token", token);
|
|
3048
3080
|
return `${this.route}print_group_label_pdf/${document_line_ids}?${qs.toString()}`;
|
|
3049
3081
|
}
|
|
3050
3082
|
};
|
|
@@ -3303,8 +3335,8 @@ var Repository85 = class {
|
|
|
3303
3335
|
});
|
|
3304
3336
|
return response.data;
|
|
3305
3337
|
}
|
|
3306
|
-
async findAllProviderProducts() {
|
|
3307
|
-
const response = await this.api.get(`${this.route}all_provider_products
|
|
3338
|
+
async findAllProviderProducts(params) {
|
|
3339
|
+
const response = await this.api.get(`${this.route}all_provider_products`, { params });
|
|
3308
3340
|
return response.data;
|
|
3309
3341
|
}
|
|
3310
3342
|
};
|
|
@@ -3383,7 +3415,7 @@ var Repository87 = class {
|
|
|
3383
3415
|
year
|
|
3384
3416
|
}) {
|
|
3385
3417
|
const qs = new URLSearchParams();
|
|
3386
|
-
qs.set("token", token);
|
|
3418
|
+
if (token) qs.set("token", token);
|
|
3387
3419
|
if (ids) {
|
|
3388
3420
|
qs.set("ids", ids);
|
|
3389
3421
|
return `${this.route}create_batch_pdf?${qs.toString()}`;
|
|
@@ -3488,15 +3520,10 @@ var Repository90 = class {
|
|
|
3488
3520
|
constructor({ route }) {
|
|
3489
3521
|
this.route = route;
|
|
3490
3522
|
}
|
|
3491
|
-
getUrl({
|
|
3492
|
-
date_start,
|
|
3493
|
-
date_end,
|
|
3494
|
-
token
|
|
3495
|
-
}) {
|
|
3523
|
+
getUrl({ date_start, date_end }) {
|
|
3496
3524
|
const qs = new URLSearchParams();
|
|
3497
3525
|
qs.set("date_start", date_start);
|
|
3498
3526
|
qs.set("date_end", date_end);
|
|
3499
|
-
qs.set("token", token);
|
|
3500
3527
|
return `${this.route}download?${qs.toString()}`;
|
|
3501
3528
|
}
|
|
3502
3529
|
};
|
|
@@ -3589,7 +3616,7 @@ var Repository93 = class {
|
|
|
3589
3616
|
return response.data;
|
|
3590
3617
|
}
|
|
3591
3618
|
async update({ id }, body) {
|
|
3592
|
-
await this.api.
|
|
3619
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3593
3620
|
}
|
|
3594
3621
|
async deleteOne({
|
|
3595
3622
|
id
|
|
@@ -3610,13 +3637,6 @@ var Repository94 = class {
|
|
|
3610
3637
|
this.api = api;
|
|
3611
3638
|
this.route = route;
|
|
3612
3639
|
}
|
|
3613
|
-
async create(body) {
|
|
3614
|
-
const response = await this.api.post(
|
|
3615
|
-
`${this.route}`,
|
|
3616
|
-
body
|
|
3617
|
-
);
|
|
3618
|
-
return response.data;
|
|
3619
|
-
}
|
|
3620
3640
|
async find() {
|
|
3621
3641
|
const response = await this.api.get(`${this.route}`);
|
|
3622
3642
|
return response.data;
|
|
@@ -3639,12 +3659,7 @@ var Repository94 = class {
|
|
|
3639
3659
|
return response.data;
|
|
3640
3660
|
}
|
|
3641
3661
|
async update({ id }, body) {
|
|
3642
|
-
await this.api.
|
|
3643
|
-
}
|
|
3644
|
-
async deleteOne({
|
|
3645
|
-
id
|
|
3646
|
-
}) {
|
|
3647
|
-
await this.api.delete(`${this.route}${id}`);
|
|
3662
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3648
3663
|
}
|
|
3649
3664
|
};
|
|
3650
3665
|
|
|
@@ -3691,7 +3706,7 @@ var Repository95 = class {
|
|
|
3691
3706
|
return response.data;
|
|
3692
3707
|
}
|
|
3693
3708
|
async update({ id }, body) {
|
|
3694
|
-
await this.api.
|
|
3709
|
+
await this.api.put(`${this.route}${id}`, body);
|
|
3695
3710
|
}
|
|
3696
3711
|
async deleteOne({
|
|
3697
3712
|
id
|
|
@@ -4419,15 +4434,6 @@ var Repository115 = class {
|
|
|
4419
4434
|
});
|
|
4420
4435
|
return response.data;
|
|
4421
4436
|
}
|
|
4422
|
-
async findForBillOfLading(data) {
|
|
4423
|
-
const response = await this.api.get(
|
|
4424
|
-
`${this.route}`,
|
|
4425
|
-
{
|
|
4426
|
-
data
|
|
4427
|
-
}
|
|
4428
|
-
);
|
|
4429
|
-
return response.data;
|
|
4430
|
-
}
|
|
4431
4437
|
async findByEmail(data) {
|
|
4432
4438
|
const response = await this.api.get(`${this.route}by_email`, {
|
|
4433
4439
|
data
|
|
@@ -5154,6 +5160,7 @@ var Repository133 = class {
|
|
|
5154
5160
|
// src/modules/view/webSocket.ts
|
|
5155
5161
|
var CLOSE_AUTH_REJECTED = 4401;
|
|
5156
5162
|
var CLOSE_AUTH_UNAVAILABLE = 4503;
|
|
5163
|
+
var MAX_AUTH_RETRIES = 3;
|
|
5157
5164
|
var PING_INTERVAL_MS = 25e3;
|
|
5158
5165
|
var MAX_BACKOFF_MS = 3e4;
|
|
5159
5166
|
var BASE_BACKOFF_MS = 1e3;
|
|
@@ -5167,6 +5174,7 @@ var Service = class {
|
|
|
5167
5174
|
}
|
|
5168
5175
|
openSocket({
|
|
5169
5176
|
token,
|
|
5177
|
+
onAuthRejected,
|
|
5170
5178
|
channel,
|
|
5171
5179
|
onEvent,
|
|
5172
5180
|
onOpen,
|
|
@@ -5176,11 +5184,15 @@ var Service = class {
|
|
|
5176
5184
|
}) {
|
|
5177
5185
|
let ws = null;
|
|
5178
5186
|
let attempts = 0;
|
|
5187
|
+
let authRejections = 0;
|
|
5179
5188
|
let opensSoFar = 0;
|
|
5180
5189
|
let pingTimer = null;
|
|
5181
5190
|
let reconnectTimer = null;
|
|
5182
5191
|
let closedByCaller = false;
|
|
5183
|
-
const subprotocols =
|
|
5192
|
+
const subprotocols = () => {
|
|
5193
|
+
const current = typeof token === "function" ? token() : token;
|
|
5194
|
+
return channel ? [`bearer.${current}`, `channel.${channel}`] : [`bearer.${current}`];
|
|
5195
|
+
};
|
|
5184
5196
|
const stopPing = () => {
|
|
5185
5197
|
if (pingTimer !== null) {
|
|
5186
5198
|
window.clearInterval(pingTimer);
|
|
@@ -5211,7 +5223,7 @@ var Service = class {
|
|
|
5211
5223
|
const connect = () => {
|
|
5212
5224
|
if (closedByCaller) return;
|
|
5213
5225
|
try {
|
|
5214
|
-
ws = new WebSocket(this.route, subprotocols);
|
|
5226
|
+
ws = new WebSocket(this.route, subprotocols());
|
|
5215
5227
|
} catch (err) {
|
|
5216
5228
|
console.error("WebSocket constructor threw", err);
|
|
5217
5229
|
scheduleReconnect();
|
|
@@ -5219,6 +5231,7 @@ var Service = class {
|
|
|
5219
5231
|
}
|
|
5220
5232
|
ws.onopen = () => {
|
|
5221
5233
|
attempts = 0;
|
|
5234
|
+
authRejections = 0;
|
|
5222
5235
|
opensSoFar += 1;
|
|
5223
5236
|
startPing();
|
|
5224
5237
|
if (opensSoFar === 1) {
|
|
@@ -5255,6 +5268,13 @@ var Service = class {
|
|
|
5255
5268
|
ws = null;
|
|
5256
5269
|
onClose?.();
|
|
5257
5270
|
if (e.code === CLOSE_AUTH_REJECTED) {
|
|
5271
|
+
if (typeof token === "function" && authRejections < MAX_AUTH_RETRIES) {
|
|
5272
|
+
authRejections += 1;
|
|
5273
|
+
void Promise.resolve().then(() => onAuthRejected?.()).catch((err) => {
|
|
5274
|
+
console.warn("WebSocket onAuthRejected failed", err);
|
|
5275
|
+
}).finally(scheduleReconnect);
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5258
5278
|
console.error("WebSocket auth rejected by server, not reconnecting");
|
|
5259
5279
|
closedByCaller = true;
|
|
5260
5280
|
return;
|
|
@@ -9,6 +9,6 @@ export default class Repository implements Nomalism.MaterialEntrance.IApi {
|
|
|
9
9
|
finalizarEntradaMaterial(data: Nomalism.MaterialEntrance.IFinalizarEntradaDeMaterialRequest): Promise<Nomalism.MaterialEntrance.IFinalizarEntradaDeMaterialResponse>;
|
|
10
10
|
undoEntradaMaterial(data: Nomalism.MaterialEntrance.IUndoEntradaDeMaterialRequest): Promise<void>;
|
|
11
11
|
findDoneById({ id, }: Nomalism.shared.IFindByIdRequest): Promise<Nomalism.MaterialEntrance.IFindDoneByIdResponse[]>;
|
|
12
|
-
printLabelToPdfUrl({ product_id }: Nomalism.MaterialEntrance.IPrintLabelParamsRequest, { quantity, ef_name, pc_document_number, prison, note, availableStock, token, }: Nomalism.MaterialEntrance.IPrintLabelQueryWithTokenRequest): string;
|
|
13
|
-
printBulkLabelToPdfUrl({ groupLabel, stockOrders, notOk, clientOrders, saved_em_picking_ids, token, }: Nomalism.MaterialEntrance.IPrintBulkLabelRequest): string;
|
|
12
|
+
printLabelToPdfUrl({ product_id }: Nomalism.MaterialEntrance.IPrintLabelParamsRequest, { quantity, ef_name, pc_document_number, prison, note, availableStock, token, as, }: Nomalism.MaterialEntrance.IPrintLabelQueryWithTokenRequest): string;
|
|
13
|
+
printBulkLabelToPdfUrl({ groupLabel, stockOrders, notOk, clientOrders, saved_em_picking_ids, token, as, }: Nomalism.MaterialEntrance.IPrintBulkLabelRequest): string;
|
|
14
14
|
}
|
|
@@ -8,4 +8,5 @@ export default class Repository implements Nomalism.Multimedia.IApi {
|
|
|
8
8
|
getUrl(multimediaId: string, { download }?: Nomalism.Multimedia.IFindByIdRequest): string;
|
|
9
9
|
create(multipartFormData: unknown, headers?: RawAxiosRequestHeaders): Promise<Nomalism.Multimedia.Entity>;
|
|
10
10
|
update(id: string, multipartFormData: unknown, headers?: RawAxiosRequestHeaders): Promise<void>;
|
|
11
|
+
setPublic(data: Nomalism.Multimedia.ISetPublicRequest): Promise<Nomalism.Multimedia.ISetPublicResponse>;
|
|
11
12
|
}
|
|
@@ -4,8 +4,7 @@ export default class Repository implements Nomalism.Settings.IRepository {
|
|
|
4
4
|
route: string;
|
|
5
5
|
private api;
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
find(): Promise<Nomalism.Settings.Entity[]>;
|
|
7
|
+
findByKey(params: Nomalism.Settings.IFindByKeyRequest): Promise<Nomalism.Settings.IFindResponse | null>;
|
|
8
|
+
update(body: Nomalism.Settings.IUpdateRequest): Promise<Nomalism.Settings.IFindResponse | null>;
|
|
9
|
+
find(): Promise<Nomalism.Settings.IFindResponse[]>;
|
|
11
10
|
}
|
|
@@ -8,5 +8,6 @@ export default class Repository implements Nomalism.SchedulePrintJob.IRepository
|
|
|
8
8
|
createMany(body: Nomalism.SchedulePrintJob.ICreateManySchedulePrintJobRequest): Promise<void>;
|
|
9
9
|
deleteOne(selector: Nomalism.shared.IFindByIdRequest): Promise<void>;
|
|
10
10
|
dispatchSchedulePrintJob(body: Nomalism.SchedulePrintJob.IDispatchSchedulePrintJobRequest): Promise<Nomalism.SchedulePrintJob.IDispatchSchedulePrintJobResponse>;
|
|
11
|
+
findToday(): Promise<Nomalism.SchedulePrintJob.IFindTodayItem[]>;
|
|
11
12
|
findByOwner(params: Nomalism.shared.IFindByOwnerIdRequest): Promise<Nomalism.SchedulePrintJob.Entity[]>;
|
|
12
13
|
}
|
|
@@ -5,5 +5,5 @@ export default class Repository implements Nomalism.Gmails.IRepository {
|
|
|
5
5
|
private api;
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
7
|
auth(): Promise<string>;
|
|
8
|
-
emails(): Promise<Nomalism.Gmails.
|
|
8
|
+
emails(params?: Nomalism.Gmails.IFindRequest): Promise<Nomalism.Gmails.IFindResponse>;
|
|
9
9
|
}
|
|
@@ -7,4 +7,5 @@ export default class Repository implements Nomalism.OnlineStore.IRepository {
|
|
|
7
7
|
findProducts(params: Nomalism.OnlineStore.IFindProductsRequest): Promise<Nomalism.OnlineStore.IFindProductsResponse>;
|
|
8
8
|
findStock(body: Nomalism.OnlineStore.IFindStockRequest): Promise<Nomalism.OnlineStore.IFindStockResponse[]>;
|
|
9
9
|
createOrder(body: Nomalism.OnlineStore.ICreateOrderRequest): Promise<Nomalism.OnlineStore.ICreateOrderResponse>;
|
|
10
|
+
cancelOrder(body: Nomalism.OnlineStore.ICancelOrderRequest): Promise<Nomalism.OnlineStore.ICancelOrderResponse>;
|
|
10
11
|
}
|
|
@@ -6,5 +6,5 @@ export default class Repository implements Nomalism.QueryList.IRepository {
|
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
7
|
find(): Promise<Nomalism.QueryList.IFindResponse[]>;
|
|
8
8
|
execute(params: Nomalism.QueryList.IExecuteRequest): Promise<Nomalism.QueryList.IExecuteResponse>;
|
|
9
|
-
getQueryExecuteUrl({ query_id, output,
|
|
9
|
+
getQueryExecuteUrl({ query_id, output, ...data }: Nomalism.QueryList.IExecuteRequest): string;
|
|
10
10
|
}
|
|
@@ -8,5 +8,5 @@ export default class Repository implements Nomalism.StockMovement.IRepository {
|
|
|
8
8
|
findByOwnerId(params: Nomalism.shared.IFindByOwnerIdRequest): Promise<Nomalism.StockMovement.IFindByOwnerIdResponse[]>;
|
|
9
9
|
exportCsv(params: Nomalism.StockMovement.IExportRequest): Promise<Nomalism.StockMovement.IExportCsvResponse[]>;
|
|
10
10
|
findMonthlyConsumption(params: Nomalism.shared.IFindByOwnerIdRequest): Promise<Nomalism.StockMovement.IFindMonthlyConsumptionResponse[]>;
|
|
11
|
-
getStockCsvUrl({ date, version, format,
|
|
11
|
+
getStockCsvUrl({ date, version, format, }: Nomalism.StockMovement.IExportRequest): string;
|
|
12
12
|
}
|
|
@@ -12,5 +12,5 @@ export default class Repository implements Nomalism.CurrentAccount.IRepository {
|
|
|
12
12
|
findClientUnpaidDebit(params: Nomalism.shared.IFindByOwnerIdRequest): Promise<Nomalism.CurrentAccount.IDocumentResponse[]>;
|
|
13
13
|
findAccountAdjustment(params: Nomalism.CurrentAccount.IAccountAdjustmentRequest): Promise<Nomalism.CurrentAccount.IAccountAdjustmentPreview>;
|
|
14
14
|
createAccountAdjustment(data: Nomalism.CurrentAccount.ICreateAccountAdjustmentRequest): Promise<Nomalism.CurrentAccount.ICreateAccountAdjustmentResponse>;
|
|
15
|
-
getExportCurrentAccountUrl({ owner_id, start_date, end_date, output,
|
|
15
|
+
getExportCurrentAccountUrl({ owner_id, start_date, end_date, output, }: Nomalism.CurrentAccount.IExportCurrentAccountRequest): string;
|
|
16
16
|
}
|
|
@@ -7,7 +7,7 @@ export default class Repository implements Nomalism.DocumentHeader.IRepository {
|
|
|
7
7
|
findOne(selector: Nomalism.shared.IFindByIdRequest): Promise<Nomalism.DocumentHeader.IFindOneBase | null>;
|
|
8
8
|
findStartVirtual(selector: Nomalism.shared.IFindByIdRequest): Promise<Nomalism.DocumentHeader.IStartDocumentHeaderVirtuals | null>;
|
|
9
9
|
findByBasicSearch(params: Nomalism.DocumentHeader.IBasicSearchRequest): Promise<Nomalism.shared.IPaginationResponse<Nomalism.DocumentHeader.IBasicSearchResponse>>;
|
|
10
|
-
findByType(params: Nomalism.DocumentHeader.IFindByTypeRequest): Promise<Nomalism.DocumentHeader.IFindByTypeResponse
|
|
10
|
+
findByType(params: Nomalism.DocumentHeader.IFindByTypeRequest): Promise<Nomalism.shared.IPaginationResponse<Nomalism.DocumentHeader.IFindByTypeResponse>>;
|
|
11
11
|
find(params: Nomalism.DocumentHeader.IFindRequest): Promise<Nomalism.DocumentHeader.IFindResponse[]>;
|
|
12
12
|
create(body: Nomalism.DocumentHeader.ICreateRequest): Promise<Nomalism.DocumentHeader.ICreateResponse>;
|
|
13
13
|
createFromHeader(body: Nomalism.DocumentHeader.ICreateFromHeaderRequest): Promise<void>;
|
|
@@ -5,5 +5,5 @@ export default class Repository implements Nomalism.OrderManagement.IRepository
|
|
|
5
5
|
private api;
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
7
|
findProviderProducts(params: Nomalism.OrderManagement.IFindProviderProductsRequest): Promise<Nomalism.OrderManagement.IFindProviderProductsResponse[]>;
|
|
8
|
-
findAllProviderProducts(): Promise<Nomalism.OrderManagement.IFindAllProviderProductsResponse[]>;
|
|
8
|
+
findAllProviderProducts(params: Nomalism.OrderManagement.IFindAllProviderProductsRequest): Promise<Nomalism.OrderManagement.IFindAllProviderProductsResponse[]>;
|
|
9
9
|
}
|
|
@@ -3,5 +3,5 @@ import { IModuleConstructor } from "../../main";
|
|
|
3
3
|
export default class Repository {
|
|
4
4
|
route: string;
|
|
5
5
|
constructor({ route }: IModuleConstructor);
|
|
6
|
-
getUrl({ date_start, date_end
|
|
6
|
+
getUrl({ date_start, date_end }: Nomalism.Saft.ISaftInvoiceRequest): string;
|
|
7
7
|
}
|
|
@@ -4,10 +4,8 @@ export default class Repository implements Nomalism.CLT.IRepository {
|
|
|
4
4
|
route: string;
|
|
5
5
|
private api;
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
|
-
create(body: Nomalism.CLT.ICreateRequest): Promise<Nomalism.CLT.Entity>;
|
|
8
7
|
find(): Promise<Nomalism.CLT.Entity[]>;
|
|
9
8
|
findMinified(params?: Nomalism.CLT.IFindMinifiedRequest): Promise<Nomalism.CLT.Entity[]>;
|
|
10
9
|
findById({ id, }: Nomalism.shared.IFindByIdNumberRequest): Promise<Nomalism.CLT.Entity | null>;
|
|
11
10
|
update({ id }: Nomalism.shared.IFindByIdNumberRequest, body: Nomalism.CLT.IUpdateRequest): Promise<void>;
|
|
12
|
-
deleteOne({ id, }: Nomalism.shared.IFindByIdNumberRequest): Promise<void>;
|
|
13
11
|
}
|
|
@@ -10,7 +10,6 @@ export default class Repository implements Nomalism.Persona.IRepository {
|
|
|
10
10
|
update(selector: Nomalism.shared.IFindByIdRequest, body: Nomalism.Persona.IUpdateRequest): Promise<Nomalism.Persona.IEntityExtended | null>;
|
|
11
11
|
deleteOne(params: Nomalism.Persona.IDeletePersonaRequest): Promise<Nomalism.Persona.IEntityExtended | null>;
|
|
12
12
|
findByBasic(params: Nomalism.Persona.IBasicSearchRequest): Promise<Nomalism.shared.IPaginationResponse<Nomalism.Persona.IBasicSearchResponse>>;
|
|
13
|
-
findForBillOfLading(data: Nomalism.Persona.IFindRequest): Promise<Nomalism.Persona.IFindResponse[]>;
|
|
14
13
|
findByEmail(data: Nomalism.Persona.IFindByEmailRequest): Promise<Nomalism.Persona.IFindByEmailResponse[]>;
|
|
15
14
|
findClientOrProvider(params: Nomalism.Persona.IFindClientOrProviderRequest): Promise<Nomalism.Persona.IFindClientOrProviderResponse[]>;
|
|
16
15
|
findForGmail(params: Nomalism.Persona.IFindForGmailRequest): Promise<Nomalism.Persona.IFindForGmailResponse | null>;
|
|
@@ -6,7 +6,7 @@ export default class Repository implements Nomalism.ReasonForExemption.IReposito
|
|
|
6
6
|
constructor({ api, route }: IModuleConstructor);
|
|
7
7
|
find(params: Nomalism.ReasonForExemption.IFindRequest): Promise<Nomalism.ReasonForExemption.IFindResponse[]>;
|
|
8
8
|
findPaginated(params: Nomalism.ReasonForExemption.IFindPaginatedRequest): Promise<Nomalism.shared.IPaginationResponse<Nomalism.ReasonForExemption.IFindResponse>>;
|
|
9
|
-
findMinified(params?: Nomalism.
|
|
9
|
+
findMinified(params?: Nomalism.ReasonForExemption.IFindMinifiedRequest): Promise<Nomalism.shared.IFindMinifiedResponse[]>;
|
|
10
10
|
create(body: Nomalism.ReasonForExemption.ICreateRequest): Promise<Nomalism.ReasonForExemption.Entity>;
|
|
11
11
|
update(selector: Nomalism.shared.IFindByIdRequest, body: Nomalism.ReasonForExemption.IUpdateRequest): Promise<Nomalism.ReasonForExemption.Entity | null>;
|
|
12
12
|
deleteOne(selector: Nomalism.shared.IFindByIdRequest): Promise<Nomalism.ReasonForExemption.Entity | null>;
|
|
@@ -3,5 +3,5 @@ import type { IModuleConstructor } from "../../main";
|
|
|
3
3
|
export default class Service implements Nomalism.WebSocket.IClient {
|
|
4
4
|
route: string;
|
|
5
5
|
constructor({ route }: IModuleConstructor);
|
|
6
|
-
openSocket<T extends Nomalism.WebSocket.IEvent>({ token, channel, onEvent, onOpen, onReconnect, onClose, onAuthUnverified, }: Nomalism.WebSocket.SocketOptions<T>): Nomalism.WebSocket.SocketHandle;
|
|
6
|
+
openSocket<T extends Nomalism.WebSocket.IEvent>({ token, onAuthRejected, channel, onEvent, onOpen, onReconnect, onClose, onAuthUnverified, }: Nomalism.WebSocket.SocketOptions<T>): Nomalism.WebSocket.SocketHandle;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomalism-com/api",
|
|
3
3
|
"description": "A nomalism API package for performing HTTP requests on API endpoints",
|
|
4
|
-
"version": "0.52.
|
|
4
|
+
"version": "0.52.1",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"prepare": "husky"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nomalism-com/types": "^0.52.
|
|
33
|
+
"@nomalism-com/types": "^0.52.1",
|
|
34
34
|
"axios": "^1.21.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@eslint/js": "^10.0.1",
|
|
38
|
-
"@swc/core": "^1.16.
|
|
39
|
-
"@types/node": "^26.6.
|
|
38
|
+
"@swc/core": "^1.16.22",
|
|
39
|
+
"@types/node": "^26.6.6",
|
|
40
40
|
"@typescript-eslint/eslint-plugin": "^8.62.0",
|
|
41
41
|
"@typescript-eslint/parser": "^8.62.0",
|
|
42
|
-
"eslint": "^10.
|
|
42
|
+
"eslint": "^10.14.0",
|
|
43
43
|
"eslint-config-prettier": "^10.1.8",
|
|
44
44
|
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
45
|
-
"globals": "^17.
|
|
45
|
+
"globals": "^17.14.0",
|
|
46
46
|
"husky": "^9.1.7",
|
|
47
47
|
"lint-staged": "^17.6.0",
|
|
48
48
|
"prettier": "^3.9.10",
|