@authenty/authapi-types 1.0.14 → 1.0.16
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.d.ts +63 -65
- package/package.json +1 -1
- package/src/index.ts +41 -40
package/dist/index.d.ts
CHANGED
|
@@ -338,159 +338,157 @@ export declare namespace AuthApi {
|
|
|
338
338
|
};
|
|
339
339
|
namespace auth {
|
|
340
340
|
namespace login {
|
|
341
|
-
type POST =
|
|
341
|
+
type POST = {
|
|
342
342
|
user: objects.LocalUser;
|
|
343
343
|
msg?: string;
|
|
344
|
-
}
|
|
344
|
+
};
|
|
345
345
|
}
|
|
346
346
|
namespace logout {
|
|
347
|
-
type GET =
|
|
347
|
+
type GET = {};
|
|
348
348
|
}
|
|
349
349
|
namespace checkSession {
|
|
350
|
-
type GET =
|
|
350
|
+
type GET = {
|
|
351
351
|
user?: objects.LocalUser;
|
|
352
352
|
msg?: string;
|
|
353
|
-
}
|
|
353
|
+
};
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
namespace users {
|
|
357
|
-
type GET =
|
|
357
|
+
type GET = objects.LocalUser[];
|
|
358
358
|
}
|
|
359
359
|
namespace user {
|
|
360
|
-
type GET =
|
|
360
|
+
type GET = objects.LocalUser & {
|
|
361
361
|
Wallets?: objects.Wallet[];
|
|
362
362
|
PurchasesShares?: objects.PurchaseShare[];
|
|
363
|
-
}
|
|
364
|
-
type PUT =
|
|
363
|
+
};
|
|
364
|
+
type PUT = objects.LocalUser;
|
|
365
365
|
namespace updateConfig {
|
|
366
|
-
type PUT =
|
|
366
|
+
type PUT = {
|
|
367
367
|
msg?: string;
|
|
368
|
-
}
|
|
368
|
+
};
|
|
369
369
|
}
|
|
370
370
|
namespace updateAdmin {
|
|
371
|
-
type PUT =
|
|
371
|
+
type PUT = objects.LocalUser;
|
|
372
372
|
}
|
|
373
373
|
namespace license {
|
|
374
|
-
type PUT =
|
|
374
|
+
type PUT = {
|
|
375
375
|
availableLicenses: number;
|
|
376
376
|
heldLicenses: number;
|
|
377
377
|
usedLicenses: number;
|
|
378
378
|
msg?: string;
|
|
379
|
-
}
|
|
379
|
+
};
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
namespace purchase {
|
|
383
383
|
namespace create {
|
|
384
|
-
type POST =
|
|
384
|
+
type POST = {
|
|
385
385
|
msg?: string;
|
|
386
386
|
purchase: objects.Purchase;
|
|
387
387
|
url?: string;
|
|
388
|
-
}
|
|
388
|
+
};
|
|
389
389
|
}
|
|
390
390
|
namespace id {
|
|
391
391
|
namespace sync {
|
|
392
|
-
type POST =
|
|
392
|
+
type POST = objects.Purchase & {
|
|
393
393
|
msg?: string;
|
|
394
|
-
}
|
|
394
|
+
};
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
type PUT =
|
|
397
|
+
type PUT = objects.Purchase | {
|
|
398
398
|
msg?: string;
|
|
399
|
-
}
|
|
399
|
+
};
|
|
400
400
|
namespace cancel {
|
|
401
|
-
type PUT =
|
|
401
|
+
type PUT = objects.Purchase;
|
|
402
402
|
}
|
|
403
|
-
type DELETE =
|
|
403
|
+
type DELETE = {
|
|
404
404
|
msg?: string;
|
|
405
|
-
}
|
|
405
|
+
};
|
|
406
406
|
namespace getFromGateway {
|
|
407
|
-
type GET =
|
|
407
|
+
type GET = objects.PaymentSystem.PG_Purchase;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
namespace purchases {
|
|
411
|
-
type post_list =
|
|
411
|
+
type post_list = {
|
|
412
412
|
purchases: objects.Purchase[];
|
|
413
413
|
pagination: {
|
|
414
414
|
page: number;
|
|
415
415
|
pageSize: number;
|
|
416
416
|
count: number;
|
|
417
417
|
};
|
|
418
|
-
}
|
|
418
|
+
};
|
|
419
419
|
}
|
|
420
420
|
namespace product {
|
|
421
|
-
type GET =
|
|
422
|
-
type PUT =
|
|
421
|
+
type GET = objects.Product;
|
|
422
|
+
type PUT = objects.Product;
|
|
423
423
|
}
|
|
424
424
|
namespace products {
|
|
425
|
-
type GET =
|
|
425
|
+
type GET = objects.Product[];
|
|
426
426
|
}
|
|
427
427
|
namespace paymentMethod {
|
|
428
|
-
type POST =
|
|
429
|
-
type PUT =
|
|
430
|
-
type DELETE =
|
|
428
|
+
type POST = objects.PaymentMethod;
|
|
429
|
+
type PUT = objects.PaymentMethod;
|
|
430
|
+
type DELETE = {
|
|
431
431
|
msg?: string;
|
|
432
|
-
}
|
|
432
|
+
};
|
|
433
433
|
}
|
|
434
434
|
namespace logs {
|
|
435
|
-
type POST_SEARCH =
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
};
|
|
441
|
-
}>;
|
|
435
|
+
type POST_SEARCH = {
|
|
436
|
+
logs: objects.LogEntry[];
|
|
437
|
+
pagination: auxiliarTypes.PaginationInfo;
|
|
438
|
+
available: boolean;
|
|
439
|
+
};
|
|
442
440
|
namespace status {
|
|
443
|
-
type GET =
|
|
441
|
+
type GET = {
|
|
444
442
|
saveToFile: boolean;
|
|
445
443
|
logPretty: boolean;
|
|
446
444
|
fileExists: boolean;
|
|
447
445
|
filePath: string;
|
|
448
446
|
logLevel: string;
|
|
449
447
|
canListLogs: boolean;
|
|
450
|
-
}
|
|
448
|
+
};
|
|
451
449
|
}
|
|
452
450
|
}
|
|
453
451
|
namespace cronJobs {
|
|
454
452
|
namespace status {
|
|
455
|
-
type GET =
|
|
453
|
+
type GET = auxiliarTypes.CronjobsStatuses;
|
|
456
454
|
}
|
|
457
455
|
namespace run {
|
|
458
|
-
type POST =
|
|
456
|
+
type POST = {
|
|
459
457
|
msg: string;
|
|
460
|
-
}
|
|
458
|
+
};
|
|
461
459
|
}
|
|
462
460
|
}
|
|
463
461
|
namespace aux {
|
|
464
462
|
namespace countries {
|
|
465
|
-
type GET =
|
|
463
|
+
type GET = Array<{
|
|
466
464
|
id: number;
|
|
467
465
|
nome: string;
|
|
468
466
|
nome_pt: string;
|
|
469
|
-
}
|
|
467
|
+
}>;
|
|
470
468
|
}
|
|
471
469
|
namespace states {
|
|
472
|
-
type GET =
|
|
470
|
+
type GET = Array<{
|
|
473
471
|
id: number;
|
|
474
472
|
nome: string;
|
|
475
473
|
uf: string;
|
|
476
474
|
ibge: number;
|
|
477
475
|
pais?: number;
|
|
478
476
|
ddd?: string;
|
|
479
|
-
}
|
|
477
|
+
}>;
|
|
480
478
|
}
|
|
481
479
|
namespace cities {
|
|
482
|
-
type GET =
|
|
480
|
+
type GET = Array<{
|
|
483
481
|
id: number;
|
|
484
482
|
nome: string;
|
|
485
483
|
uf: number;
|
|
486
484
|
ibge: number;
|
|
487
|
-
}
|
|
485
|
+
}>;
|
|
488
486
|
}
|
|
489
487
|
}
|
|
490
488
|
namespace report {
|
|
491
|
-
type POST =
|
|
489
|
+
type POST = {
|
|
492
490
|
msg?: string;
|
|
493
|
-
}
|
|
491
|
+
};
|
|
494
492
|
}
|
|
495
493
|
}
|
|
496
494
|
/**
|
|
@@ -555,45 +553,45 @@ export declare namespace AuthApi {
|
|
|
555
553
|
/**
|
|
556
554
|
* Faz login na API
|
|
557
555
|
*/
|
|
558
|
-
login: (email: string, password: string) => Promise<responses.auth.login.POST
|
|
556
|
+
login: (email: string, password: string) => Promise<responses.ApiResponse<responses.auth.login.POST>>;
|
|
559
557
|
/**
|
|
560
558
|
* Faz logout da API
|
|
561
559
|
*/
|
|
562
|
-
logout: () => Promise<responses.auth.logout.GET
|
|
560
|
+
logout: () => Promise<responses.ApiResponse<responses.auth.logout.GET>>;
|
|
563
561
|
/**
|
|
564
562
|
* Verifica a sessão atual
|
|
565
563
|
*/
|
|
566
|
-
checkSession: () => Promise<responses.auth.checkSession.GET
|
|
564
|
+
checkSession: () => Promise<responses.ApiResponse<responses.auth.checkSession.GET>>;
|
|
567
565
|
};
|
|
568
566
|
checkHealth(): Promise<boolean>;
|
|
569
567
|
users: {
|
|
570
568
|
list: () => Promise<responses.ApiResponse<responses.users.GET>>;
|
|
571
569
|
get: (userId: number, includePurchases?: boolean) => Promise<responses.ApiResponse<responses.user.GET>>;
|
|
572
|
-
update: (userId: number, userData: Partial<objects.LocalUser>) => Promise<responses.ApiResponse<
|
|
570
|
+
update: (userId: number, userData: Partial<objects.LocalUser>) => Promise<responses.ApiResponse<objects.LocalUser>>;
|
|
573
571
|
updateConfig: (obj: {
|
|
574
572
|
id: number;
|
|
575
573
|
config_ihm_showRates?: boolean;
|
|
576
574
|
}) => Promise<responses.ApiResponse<responses.user.updateConfig.PUT>>;
|
|
577
|
-
updateAdmin: (userId: number, isAdmin: boolean) => Promise<responses.ApiResponse<
|
|
575
|
+
updateAdmin: (userId: number, isAdmin: boolean) => Promise<responses.ApiResponse<objects.LocalUser>>;
|
|
578
576
|
license: (userId: number) => Promise<responses.ApiResponse<responses.user.license.PUT>>;
|
|
579
577
|
};
|
|
580
578
|
purchases: {
|
|
581
579
|
new: (paymentMethodId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.create.POST>>;
|
|
582
580
|
sync: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<responses.purchase.id.sync.POST>>;
|
|
583
581
|
update: (userId: number, purchase: objects.Purchase) => Promise<responses.ApiResponse<responses.purchase.PUT>>;
|
|
584
|
-
cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<
|
|
582
|
+
cancel: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<objects.Purchase>>;
|
|
585
583
|
delete: (purchaseId: number, userId: number) => Promise<responses.ApiResponse<responses.purchase.DELETE>>;
|
|
586
584
|
list: (page?: number, pageSize?: number, userId?: number) => Promise<responses.ApiResponse<responses.purchases.post_list>>;
|
|
587
|
-
getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<
|
|
585
|
+
getFromGateway: (purchaseId: number, userId: number, async?: boolean) => Promise<responses.ApiResponse<objects.PaymentSystem.PG_Purchase>>;
|
|
588
586
|
};
|
|
589
587
|
products: {
|
|
590
588
|
list: () => Promise<responses.ApiResponse<responses.products.GET>>;
|
|
591
|
-
get: (productId: number) => Promise<responses.ApiResponse<
|
|
592
|
-
update: (productId: number, productData: any) => Promise<responses.ApiResponse<
|
|
589
|
+
get: (productId: number) => Promise<responses.ApiResponse<objects.Product>>;
|
|
590
|
+
update: (productId: number, productData: any) => Promise<responses.ApiResponse<objects.Product>>;
|
|
593
591
|
};
|
|
594
592
|
paymentMethods: {
|
|
595
|
-
create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<
|
|
596
|
-
update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<
|
|
593
|
+
create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
|
|
594
|
+
update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
|
|
597
595
|
delete: (id: number, paymentMethodId: number) => Promise<responses.ApiResponse<responses.paymentMethod.DELETE>>;
|
|
598
596
|
};
|
|
599
597
|
aux: {
|
|
@@ -611,7 +609,7 @@ export declare namespace AuthApi {
|
|
|
611
609
|
status: () => Promise<responses.ApiResponse<responses.logs.status.GET>>;
|
|
612
610
|
};
|
|
613
611
|
cronJobs: {
|
|
614
|
-
status: () => Promise<responses.ApiResponse<
|
|
612
|
+
status: () => Promise<responses.ApiResponse<auxiliarTypes.CronjobsStatuses>>;
|
|
615
613
|
run: (name: string) => Promise<responses.ApiResponse<responses.cronJobs.run.POST>>;
|
|
616
614
|
};
|
|
617
615
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -388,122 +388,122 @@ export namespace AuthApi {
|
|
|
388
388
|
|
|
389
389
|
export namespace auth {
|
|
390
390
|
export namespace login {
|
|
391
|
-
export type POST =
|
|
391
|
+
export type POST = { user: objects.LocalUser; msg?: string };
|
|
392
392
|
}
|
|
393
393
|
export namespace logout {
|
|
394
|
-
export type GET =
|
|
394
|
+
export type GET = {};
|
|
395
395
|
}
|
|
396
396
|
export namespace checkSession {
|
|
397
|
-
export type GET =
|
|
397
|
+
export type GET = { user?: objects.LocalUser; msg?: string };
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
export namespace users {
|
|
402
|
-
export type GET =
|
|
402
|
+
export type GET = objects.LocalUser[];
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
export namespace user {
|
|
406
|
-
export type GET =
|
|
407
|
-
export type PUT =
|
|
406
|
+
export type GET = objects.LocalUser & { Wallets?: objects.Wallet[]; PurchasesShares?: objects.PurchaseShare[] };
|
|
407
|
+
export type PUT = objects.LocalUser;
|
|
408
408
|
|
|
409
409
|
export namespace updateConfig {
|
|
410
|
-
export type PUT =
|
|
410
|
+
export type PUT = { msg?: string };
|
|
411
411
|
}
|
|
412
412
|
export namespace updateAdmin {
|
|
413
|
-
export type PUT =
|
|
413
|
+
export type PUT = objects.LocalUser;
|
|
414
414
|
}
|
|
415
415
|
export namespace license {
|
|
416
|
-
export type PUT =
|
|
416
|
+
export type PUT = { availableLicenses: number; heldLicenses: number; usedLicenses: number; msg?: string };
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
export namespace purchase {
|
|
421
421
|
export namespace create {
|
|
422
|
-
export type POST =
|
|
422
|
+
export type POST = { msg?: string; purchase: objects.Purchase; url?: string };
|
|
423
423
|
}
|
|
424
424
|
export namespace id {
|
|
425
425
|
export namespace sync {
|
|
426
|
-
export type POST =
|
|
426
|
+
export type POST = objects.Purchase & { msg?: string };
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
export type PUT =
|
|
429
|
+
export type PUT = objects.Purchase | { msg?: string };
|
|
430
430
|
export namespace cancel {
|
|
431
|
-
export type PUT =
|
|
431
|
+
export type PUT = objects.Purchase;
|
|
432
432
|
}
|
|
433
|
-
export type DELETE =
|
|
433
|
+
export type DELETE = { msg?: string };
|
|
434
434
|
export namespace getFromGateway {
|
|
435
|
-
export type GET =
|
|
435
|
+
export type GET = objects.PaymentSystem.PG_Purchase;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
export namespace purchases {
|
|
440
|
-
export type post_list =
|
|
440
|
+
export type post_list = {
|
|
441
441
|
purchases: objects.Purchase[];
|
|
442
442
|
pagination: {
|
|
443
443
|
page: number;
|
|
444
444
|
pageSize: number;
|
|
445
445
|
count: number;
|
|
446
446
|
};
|
|
447
|
-
}
|
|
447
|
+
};
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
export namespace product {
|
|
451
|
-
export type GET =
|
|
452
|
-
export type PUT =
|
|
451
|
+
export type GET = objects.Product;
|
|
452
|
+
export type PUT = objects.Product;
|
|
453
453
|
}
|
|
454
454
|
export namespace products {
|
|
455
455
|
|
|
456
|
-
export type GET =
|
|
456
|
+
export type GET = objects.Product[];
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
export namespace paymentMethod {
|
|
460
|
-
export type POST =
|
|
461
|
-
export type PUT =
|
|
462
|
-
export type DELETE =
|
|
460
|
+
export type POST = objects.PaymentMethod;
|
|
461
|
+
export type PUT = objects.PaymentMethod;
|
|
462
|
+
export type DELETE = { msg?: string };
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
export namespace logs {
|
|
466
466
|
|
|
467
|
-
export type POST_SEARCH =
|
|
467
|
+
export type POST_SEARCH = {
|
|
468
468
|
logs: objects.LogEntry[];
|
|
469
469
|
pagination: auxiliarTypes.PaginationInfo;
|
|
470
470
|
available: boolean;
|
|
471
|
-
}
|
|
471
|
+
};
|
|
472
472
|
export namespace status {
|
|
473
|
-
export type GET =
|
|
473
|
+
export type GET = {
|
|
474
474
|
saveToFile: boolean;
|
|
475
475
|
logPretty: boolean;
|
|
476
476
|
fileExists: boolean;
|
|
477
477
|
filePath: string;
|
|
478
478
|
logLevel: string;
|
|
479
479
|
canListLogs: boolean;
|
|
480
|
-
}
|
|
480
|
+
};
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
export namespace cronJobs {
|
|
485
485
|
export namespace status {
|
|
486
|
-
export type GET =
|
|
486
|
+
export type GET = auxiliarTypes.CronjobsStatuses;
|
|
487
487
|
}
|
|
488
488
|
export namespace run {
|
|
489
|
-
export type POST =
|
|
489
|
+
export type POST = { msg: string };
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
export namespace aux {
|
|
494
494
|
export namespace countries {
|
|
495
|
-
export type GET =
|
|
495
|
+
export type GET = Array<{ id: number; nome: string; nome_pt: string }>;
|
|
496
496
|
}
|
|
497
497
|
export namespace states {
|
|
498
|
-
export type GET =
|
|
498
|
+
export type GET = Array<{ id: number; nome: string; uf: string; ibge: number; pais?: number; ddd?: string }>;
|
|
499
499
|
}
|
|
500
500
|
export namespace cities {
|
|
501
|
-
export type GET =
|
|
501
|
+
export type GET = Array<{ id: number; nome: string; uf: number; ibge: number }>;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
export namespace report {
|
|
506
|
-
export type POST =
|
|
506
|
+
export type POST = { msg?: string };
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
@@ -621,7 +621,8 @@ export namespace AuthApi {
|
|
|
621
621
|
retryAttempts?: number;
|
|
622
622
|
retryDelay?: number;
|
|
623
623
|
}
|
|
624
|
-
)
|
|
624
|
+
) {
|
|
625
|
+
|
|
625
626
|
const result: responses.ApiResponse<T> = {
|
|
626
627
|
conex: true,
|
|
627
628
|
reqStat: 0,
|
|
@@ -739,15 +740,15 @@ export namespace AuthApi {
|
|
|
739
740
|
/**
|
|
740
741
|
* Faz login na API
|
|
741
742
|
*/
|
|
742
|
-
login: async (email: string, password: string)
|
|
743
|
-
return this.request<responses.auth.login.POST
|
|
743
|
+
login: async (email: string, password: string) => {
|
|
744
|
+
return this.request<responses.auth.login.POST>('POST', 'auth/login', { email, password });
|
|
744
745
|
},
|
|
745
746
|
|
|
746
747
|
/**
|
|
747
748
|
* Faz logout da API
|
|
748
749
|
*/
|
|
749
|
-
logout: async ()
|
|
750
|
-
const result = await this.request<responses.auth.logout.GET
|
|
750
|
+
logout: async () => {
|
|
751
|
+
const result = await this.request<responses.auth.logout.GET>('GET', 'auth/logout', {});
|
|
751
752
|
this.setToken('');
|
|
752
753
|
this.setPin1('');
|
|
753
754
|
return result;
|
|
@@ -756,7 +757,7 @@ export namespace AuthApi {
|
|
|
756
757
|
/**
|
|
757
758
|
* Verifica a sessão atual
|
|
758
759
|
*/
|
|
759
|
-
checkSession: async ()
|
|
760
|
+
checkSession: async () => {
|
|
760
761
|
if (!this.bearer) {
|
|
761
762
|
return {
|
|
762
763
|
conex: true,
|
|
@@ -766,7 +767,7 @@ export namespace AuthApi {
|
|
|
766
767
|
msg: 'Token not found'
|
|
767
768
|
};
|
|
768
769
|
}
|
|
769
|
-
return this.request<responses.auth.checkSession.GET
|
|
770
|
+
return this.request<responses.auth.checkSession.GET>('GET', 'auth', {}, { retryAttempts: 2, retryDelay: 1000 });
|
|
770
771
|
}
|
|
771
772
|
}
|
|
772
773
|
|