@metarisc/metarisc-js 0.0.1-alpha.30 → 0.0.1-alpha.31
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/lib/api/DossiersAPI.js +9 -12
- package/lib/api/EvenementsAPI.js +6 -9
- package/lib/api/FeedAPI.js +2 -5
- package/lib/api/MoiAPI.js +2 -5
- package/lib/api/NotificationsAPI.js +5 -8
- package/lib/api/OrganisationsAPI.js +3 -6
- package/lib/api/PEIAPI.js +6 -9
- package/lib/api/PingAPI.js +2 -5
- package/lib/api/SupportAPI.js +4 -7
- package/lib/api/UtilisateursAPI.js +5 -8
- package/lib/client.d.ts +2 -1
- package/lib/client.js +19 -6
- package/lib/core.d.ts +2 -1
- package/lib/core.js +3 -0
- package/lib/error/SessionExpiredError.d.ts +3 -0
- package/lib/error/SessionExpiredError.js +11 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +9 -4
- package/package.json +2 -1
- package/src/api/DossiersAPI.ts +1 -1
- package/src/api/EvenementsAPI.ts +1 -1
- package/src/api/FeedAPI.ts +1 -1
- package/src/api/MoiAPI.ts +1 -1
- package/src/api/NotificationsAPI.ts +1 -1
- package/src/api/OrganisationsAPI.ts +1 -1
- package/src/api/PEIAPI.ts +1 -1
- package/src/api/PingAPI.ts +1 -1
- package/src/api/SupportAPI.ts +1 -1
- package/src/api/UtilisateursAPI.ts +1 -1
- package/src/client.ts +24 -12
- package/src/core.ts +5 -1
- package/src/error/SessionExpiredError.ts +8 -0
- package/src/index.ts +2 -0
- package/src/utils.ts +9 -4
package/lib/api/DossiersAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DossiersAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class DossiersAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'dossier_id': dossierId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'GET',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -33,7 +30,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
33
30
|
const pathVariable = { 'dossier_id': dossierId, 'workflow_id': workflowId };
|
|
34
31
|
return this.request({
|
|
35
32
|
method: 'GET',
|
|
36
|
-
endpoint: utils_1.
|
|
33
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}/workflows/{workflow_id}'),
|
|
37
34
|
headers: {},
|
|
38
35
|
params: {},
|
|
39
36
|
body: {}
|
|
@@ -49,7 +46,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
49
46
|
const pathVariable = { 'dossier_id': dossierId };
|
|
50
47
|
return this.collect({
|
|
51
48
|
method: 'GET',
|
|
52
|
-
endpoint: utils_1.
|
|
49
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}/tags'),
|
|
53
50
|
headers: {},
|
|
54
51
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
55
52
|
body: {}
|
|
@@ -66,7 +63,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
66
63
|
const pathVariable = { 'dossier_id': dossierId, 'workflow_id': workflowId };
|
|
67
64
|
return this.collect({
|
|
68
65
|
method: 'GET',
|
|
69
|
-
endpoint: utils_1.
|
|
66
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}/workflows/{workflow_id}/documents'),
|
|
70
67
|
headers: {},
|
|
71
68
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
72
69
|
body: {}
|
|
@@ -82,7 +79,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
82
79
|
const pathVariable = { 'dossier_id': dossierId };
|
|
83
80
|
return this.collect({
|
|
84
81
|
method: 'GET',
|
|
85
|
-
endpoint: utils_1.
|
|
82
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}/workflows'),
|
|
86
83
|
headers: {},
|
|
87
84
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
88
85
|
body: {}
|
|
@@ -97,7 +94,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
97
94
|
const pathVariable = {};
|
|
98
95
|
return this.collect({
|
|
99
96
|
method: 'GET',
|
|
100
|
-
endpoint: utils_1.
|
|
97
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers'),
|
|
101
98
|
headers: {},
|
|
102
99
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
103
100
|
body: {}
|
|
@@ -112,7 +109,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
112
109
|
const pathVariable = { 'dossier_id': dossierId };
|
|
113
110
|
return this.request({
|
|
114
111
|
method: 'PATCH',
|
|
115
|
-
endpoint: utils_1.
|
|
112
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers/{dossier_id}'),
|
|
116
113
|
headers: {},
|
|
117
114
|
params: {},
|
|
118
115
|
body: { 'id': dossier?.id, 'type': dossier?.type, 'description': dossier?.description, 'date_de_creation': dossier?.date_de_creation, 'createur': dossier?.createur, 'application_utilisee': dossier?.application_utilisee, 'statut': dossier?.statut }
|
|
@@ -126,7 +123,7 @@ class DossiersAPI extends core_1.Core {
|
|
|
126
123
|
const pathVariable = {};
|
|
127
124
|
return this.request({
|
|
128
125
|
method: 'POST',
|
|
129
|
-
endpoint: utils_1.
|
|
126
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/dossiers'),
|
|
130
127
|
headers: {},
|
|
131
128
|
params: {},
|
|
132
129
|
body: { 'titre': postDossierRequest?.titre, 'description': postDossierRequest?.description, 'workflows': postDossierRequest?.workflows }
|
package/lib/api/EvenementsAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.EvenementsAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class EvenementsAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class EvenementsAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'evenement_id': evenementId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'DELETE',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/evenements/{evenement_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -33,7 +30,7 @@ class EvenementsAPI extends core_1.Core {
|
|
|
33
30
|
const pathVariable = { 'evenement_id': evenementId };
|
|
34
31
|
return this.request({
|
|
35
32
|
method: 'GET',
|
|
36
|
-
endpoint: utils_1.
|
|
33
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/evenements/{evenement_id}'),
|
|
37
34
|
headers: {},
|
|
38
35
|
params: {},
|
|
39
36
|
body: { 'id': evenement?.id, 'title': evenement?.title, 'type': evenement?.type, 'description': evenement?.description, 'date_debut': evenement?.date_debut, 'date_fin': evenement?.date_fin }
|
|
@@ -49,7 +46,7 @@ class EvenementsAPI extends core_1.Core {
|
|
|
49
46
|
const pathVariable = { 'evenement_id': evenementId };
|
|
50
47
|
return this.collect({
|
|
51
48
|
method: 'GET',
|
|
52
|
-
endpoint: utils_1.
|
|
49
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/evenements/{evenement_id}/utilisateurs'),
|
|
53
50
|
headers: {},
|
|
54
51
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
55
52
|
body: {}
|
|
@@ -66,7 +63,7 @@ class EvenementsAPI extends core_1.Core {
|
|
|
66
63
|
const pathVariable = {};
|
|
67
64
|
return this.collect({
|
|
68
65
|
method: 'GET',
|
|
69
|
-
endpoint: utils_1.
|
|
66
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/evenements'),
|
|
70
67
|
headers: {},
|
|
71
68
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString(), 'type': type, 'period': period },
|
|
72
69
|
body: {}
|
|
@@ -80,7 +77,7 @@ class EvenementsAPI extends core_1.Core {
|
|
|
80
77
|
const pathVariable = {};
|
|
81
78
|
return this.request({
|
|
82
79
|
method: 'POST',
|
|
83
|
-
endpoint: utils_1.
|
|
80
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/evenements'),
|
|
84
81
|
headers: {},
|
|
85
82
|
params: {},
|
|
86
83
|
body: { 'title': postEvenementRequest?.title, 'type': postEvenementRequest?.type, 'description': postEvenementRequest?.description, 'date_debut': postEvenementRequest?.date_debut, 'date_fin': postEvenementRequest?.date_fin }
|
package/lib/api/FeedAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.FeedAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class FeedAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -17,7 +14,7 @@ class FeedAPI extends core_1.Core {
|
|
|
17
14
|
const pathVariable = {};
|
|
18
15
|
return this.collect({
|
|
19
16
|
method: 'GET',
|
|
20
|
-
endpoint: utils_1.
|
|
17
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/feed'),
|
|
21
18
|
headers: {},
|
|
22
19
|
params: {},
|
|
23
20
|
body: {}
|
package/lib/api/MoiAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.MoiAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class MoiAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -17,7 +14,7 @@ class MoiAPI extends core_1.Core {
|
|
|
17
14
|
const pathVariable = {};
|
|
18
15
|
return this.request({
|
|
19
16
|
method: 'GET',
|
|
20
|
-
endpoint: utils_1.
|
|
17
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/@moi'),
|
|
21
18
|
headers: {},
|
|
22
19
|
params: {},
|
|
23
20
|
body: {}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.NotificationsAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class NotificationsAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class NotificationsAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'notification_id': notificationId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'DELETE',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/notifications/{notification_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -32,7 +29,7 @@ class NotificationsAPI extends core_1.Core {
|
|
|
32
29
|
const pathVariable = { 'notification_id': notificationId };
|
|
33
30
|
return this.request({
|
|
34
31
|
method: 'GET',
|
|
35
|
-
endpoint: utils_1.
|
|
32
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/notifications/{notification_id}'),
|
|
36
33
|
headers: {},
|
|
37
34
|
params: {},
|
|
38
35
|
body: {}
|
|
@@ -47,7 +44,7 @@ class NotificationsAPI extends core_1.Core {
|
|
|
47
44
|
const pathVariable = {};
|
|
48
45
|
return this.collect({
|
|
49
46
|
method: 'GET',
|
|
50
|
-
endpoint: utils_1.
|
|
47
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/notifications'),
|
|
51
48
|
headers: {},
|
|
52
49
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
53
50
|
body: {}
|
|
@@ -61,7 +58,7 @@ class NotificationsAPI extends core_1.Core {
|
|
|
61
58
|
const pathVariable = {};
|
|
62
59
|
return this.request({
|
|
63
60
|
method: 'POST',
|
|
64
|
-
endpoint: utils_1.
|
|
61
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/notifications'),
|
|
65
62
|
headers: {},
|
|
66
63
|
params: {},
|
|
67
64
|
body: { 'title': postNotificationRequest?.title, 'message': postNotificationRequest?.message, 'contexte': postNotificationRequest?.contexte, 'utilisateur_id': postNotificationRequest?.utilisateur_id }
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.OrganisationsAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class OrganisationsAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class OrganisationsAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'org_id': orgId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'GET',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/organisations/{org_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -33,7 +30,7 @@ class OrganisationsAPI extends core_1.Core {
|
|
|
33
30
|
const pathVariable = {};
|
|
34
31
|
return this.collect({
|
|
35
32
|
method: 'GET',
|
|
36
|
-
endpoint: utils_1.
|
|
33
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/organisations'),
|
|
37
34
|
headers: {},
|
|
38
35
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
39
36
|
body: {}
|
package/lib/api/PEIAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PEIAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class PEIAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class PEIAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'pei_id': peiId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'GET',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/pei/{pei_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -33,7 +30,7 @@ class PEIAPI extends core_1.Core {
|
|
|
33
30
|
const pathVariable = {};
|
|
34
31
|
return this.collect({
|
|
35
32
|
method: 'GET',
|
|
36
|
-
endpoint: utils_1.
|
|
33
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/pei'),
|
|
37
34
|
headers: {},
|
|
38
35
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
39
36
|
body: {}
|
|
@@ -49,7 +46,7 @@ class PEIAPI extends core_1.Core {
|
|
|
49
46
|
const pathVariable = { 'pei_id': peiId };
|
|
50
47
|
return this.collect({
|
|
51
48
|
method: 'GET',
|
|
52
|
-
endpoint: utils_1.
|
|
49
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/pei/{pei_id}/contacts'),
|
|
53
50
|
headers: {},
|
|
54
51
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
55
52
|
body: {}
|
|
@@ -65,7 +62,7 @@ class PEIAPI extends core_1.Core {
|
|
|
65
62
|
const pathVariable = { 'pei_id': peiId };
|
|
66
63
|
return this.collect({
|
|
67
64
|
method: 'GET',
|
|
68
|
-
endpoint: utils_1.
|
|
65
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/pei/{pei_id}/historique'),
|
|
69
66
|
headers: {},
|
|
70
67
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
71
68
|
body: {}
|
|
@@ -81,7 +78,7 @@ class PEIAPI extends core_1.Core {
|
|
|
81
78
|
const pathVariable = { 'pei_id': peiId };
|
|
82
79
|
return this.collect({
|
|
83
80
|
method: 'GET',
|
|
84
|
-
endpoint: utils_1.
|
|
81
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/pei/{pei_id}/pieces_jointes'),
|
|
85
82
|
headers: {},
|
|
86
83
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
87
84
|
body: {}
|
package/lib/api/PingAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PingAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class PingAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -17,7 +14,7 @@ class PingAPI extends core_1.Core {
|
|
|
17
14
|
const pathVariable = {};
|
|
18
15
|
return this.request({
|
|
19
16
|
method: 'GET',
|
|
20
|
-
endpoint: utils_1.
|
|
17
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/ping'),
|
|
21
18
|
headers: {},
|
|
22
19
|
params: {},
|
|
23
20
|
body: {}
|
package/lib/api/SupportAPI.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.SupportAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class SupportAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class SupportAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'ticket_id': ticketId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'GET',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/support/{ticket_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -33,7 +30,7 @@ class SupportAPI extends core_1.Core {
|
|
|
33
30
|
const pathVariable = {};
|
|
34
31
|
return this.collect({
|
|
35
32
|
method: 'GET',
|
|
36
|
-
endpoint: utils_1.
|
|
33
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/support/'),
|
|
37
34
|
headers: {},
|
|
38
35
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
39
36
|
body: {}
|
|
@@ -47,7 +44,7 @@ class SupportAPI extends core_1.Core {
|
|
|
47
44
|
const pathVariable = {};
|
|
48
45
|
return this.request({
|
|
49
46
|
method: 'POST',
|
|
50
|
-
endpoint: utils_1.
|
|
47
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/support/'),
|
|
51
48
|
headers: {},
|
|
52
49
|
params: {},
|
|
53
50
|
body: { 'subject': postTicketRequest?.subject, 'description': postTicketRequest?.description }
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.UtilisateursAPI = void 0;
|
|
7
4
|
const core_1 = require("../core");
|
|
8
|
-
const utils_1 =
|
|
5
|
+
const utils_1 = require("../utils");
|
|
9
6
|
class UtilisateursAPI extends core_1.Core {
|
|
10
7
|
constructor(config, client) {
|
|
11
8
|
super(config, client);
|
|
@@ -18,7 +15,7 @@ class UtilisateursAPI extends core_1.Core {
|
|
|
18
15
|
const pathVariable = { 'utilisateur_id': utilisateurId };
|
|
19
16
|
return this.request({
|
|
20
17
|
method: 'GET',
|
|
21
|
-
endpoint: utils_1.
|
|
18
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/utilisateurs/{utilisateur_id}'),
|
|
22
19
|
headers: {},
|
|
23
20
|
params: {},
|
|
24
21
|
body: {}
|
|
@@ -31,7 +28,7 @@ class UtilisateursAPI extends core_1.Core {
|
|
|
31
28
|
const pathVariable = {};
|
|
32
29
|
return this.request({
|
|
33
30
|
method: 'GET',
|
|
34
|
-
endpoint: utils_1.
|
|
31
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/utilisateurs/@moi'),
|
|
35
32
|
headers: {},
|
|
36
33
|
params: {},
|
|
37
34
|
body: {}
|
|
@@ -46,7 +43,7 @@ class UtilisateursAPI extends core_1.Core {
|
|
|
46
43
|
const pathVariable = {};
|
|
47
44
|
return this.collect({
|
|
48
45
|
method: 'GET',
|
|
49
|
-
endpoint: utils_1.
|
|
46
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/utilisateurs/@moi/emails'),
|
|
50
47
|
headers: {},
|
|
51
48
|
params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
|
|
52
49
|
body: {}
|
|
@@ -60,7 +57,7 @@ class UtilisateursAPI extends core_1.Core {
|
|
|
60
57
|
const pathVariable = { 'utilisateur_id': utilisateurId };
|
|
61
58
|
return this.collect({
|
|
62
59
|
method: 'GET',
|
|
63
|
-
endpoint: utils_1.
|
|
60
|
+
endpoint: utils_1.Utils.constructPath(pathVariable, '/utilisateurs/{utilisateur_id}/emails'),
|
|
64
61
|
headers: {},
|
|
65
62
|
params: {},
|
|
66
63
|
body: {}
|
package/lib/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosResponse } from "axios";
|
|
2
2
|
import { MetariscConfig, OAuth2Options } from "./core";
|
|
3
|
-
import { GrantResponse } from "./auth/oauth2";
|
|
3
|
+
import { GrantResponse, RefreshResponse } from "./auth/oauth2";
|
|
4
4
|
interface RequestConfig {
|
|
5
5
|
body?: any;
|
|
6
6
|
headers?: {
|
|
@@ -23,6 +23,7 @@ export declare class Client {
|
|
|
23
23
|
private refresh_token?;
|
|
24
24
|
constructor(config: MetariscConfig);
|
|
25
25
|
authenticate(auth_method: AuthMethod, options: OAuth2Options): Promise<GrantResponse>;
|
|
26
|
+
refreshToken(): Promise<RefreshResponse>;
|
|
26
27
|
/**
|
|
27
28
|
* Lance une requête (authentifiée si possible) sur l'API Metarisc.
|
|
28
29
|
*/
|
package/lib/client.js
CHANGED
|
@@ -8,7 +8,8 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
8
8
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
9
9
|
const oauth2_1 = require("./auth/oauth2");
|
|
10
10
|
const axios_cache_interceptor_1 = require("axios-cache-interceptor");
|
|
11
|
-
const utils_1 =
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const SessionExpiredError_1 = require("./error/SessionExpiredError");
|
|
12
13
|
var AuthMethod;
|
|
13
14
|
(function (AuthMethod) {
|
|
14
15
|
AuthMethod[AuthMethod["CLIENT_CREDENTIALS"] = 0] = "CLIENT_CREDENTIALS";
|
|
@@ -50,14 +51,12 @@ class Client {
|
|
|
50
51
|
this.axios.interceptors.request.use(async (config) => {
|
|
51
52
|
// Si l'access_token a expiré on demande un échange avec le refresh token obtenu précedemment
|
|
52
53
|
// Si le refresh ne fonctionne pas, on ne fait rien
|
|
53
|
-
if (this.getAccessToken() !== undefined &&
|
|
54
|
+
if (this.getAccessToken() !== undefined && utils_1.Utils.tokenExpired(this.getAccessToken())) {
|
|
54
55
|
try {
|
|
55
|
-
|
|
56
|
-
this.setAccessToken(result.token_type + ' ' + result.access_token);
|
|
57
|
-
this.setRefreshToken(result.refresh_token);
|
|
56
|
+
await this.refreshToken();
|
|
58
57
|
}
|
|
59
58
|
catch (e) {
|
|
60
|
-
|
|
59
|
+
throw new SessionExpiredError_1.SessionExpiredError('La session utilisateur a expirée');
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
return config;
|
|
@@ -79,6 +78,20 @@ class Client {
|
|
|
79
78
|
throw new Error("auth_method inconnue");
|
|
80
79
|
}
|
|
81
80
|
}
|
|
81
|
+
async refreshToken() {
|
|
82
|
+
if (this.refresh_token === undefined) {
|
|
83
|
+
throw new Error('Impossible de refresh sans refresh token');
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const refreshResponse = await this.oauth2.refreshToken(this.refresh_token);
|
|
87
|
+
this.setAccessToken(refreshResponse.token_type + " " + refreshResponse.access_token);
|
|
88
|
+
this.setRefreshToken(refreshResponse.refresh_token);
|
|
89
|
+
return refreshResponse;
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
throw new Error('Erreur pendant la tentative de refresh du token: ' + e.message);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
82
95
|
/**
|
|
83
96
|
* Lance une requête (authentifiée si possible) sur l'API Metarisc.
|
|
84
97
|
*/
|
package/lib/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosResponse } from "axios";
|
|
2
2
|
import { AuthMethod, Client } from "./client";
|
|
3
3
|
import { Collection } from "./collection";
|
|
4
|
-
import { GrantResponse } from "./auth/oauth2";
|
|
4
|
+
import { GrantResponse, RefreshResponse } from "./auth/oauth2";
|
|
5
5
|
interface RequestConfig {
|
|
6
6
|
body?: any;
|
|
7
7
|
headers?: {
|
|
@@ -33,6 +33,7 @@ export declare class Core {
|
|
|
33
33
|
request<T>(config: RequestConfig): Promise<AxiosResponse<T>>;
|
|
34
34
|
collect<T>(config: RequestConfig): Collection<T>;
|
|
35
35
|
authenticate(auth_method: AuthMethod, options: OAuth2Options): Promise<GrantResponse>;
|
|
36
|
+
refreshToken(): Promise<RefreshResponse>;
|
|
36
37
|
setAccessToken(access_token: string): void;
|
|
37
38
|
setRefreshToken(refresh_token: string): void;
|
|
38
39
|
}
|
package/lib/core.js
CHANGED
|
@@ -21,6 +21,9 @@ class Core {
|
|
|
21
21
|
async authenticate(auth_method, options) {
|
|
22
22
|
return await this.client.authenticate(auth_method, options);
|
|
23
23
|
}
|
|
24
|
+
refreshToken() {
|
|
25
|
+
return this.client.refreshToken();
|
|
26
|
+
}
|
|
24
27
|
setAccessToken(access_token) {
|
|
25
28
|
this.client.setAccessToken(access_token);
|
|
26
29
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionExpiredError = void 0;
|
|
4
|
+
class SessionExpiredError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
// Set the prototype for instance of
|
|
8
|
+
Object.setPrototypeOf(this, SessionExpiredError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SessionExpiredError = SessionExpiredError;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Metarisc } from "./metarisc";
|
|
2
2
|
export { OAuth2 } from "./auth/oauth2";
|
|
3
|
+
export { SessionExpiredError } from "./error/SessionExpiredError";
|
|
3
4
|
export { Core } from "./core";
|
|
4
5
|
export { Collection, PaginationData, PaginationResults } from "./collection";
|
|
5
6
|
export { AuthMethod, Client } from "./client";
|
|
7
|
+
export { Utils } from "./utils";
|
|
6
8
|
export { Tus } from "./tus";
|
|
7
9
|
export { DossiersAPI } from './api/DossiersAPI';
|
|
8
10
|
export { EvenementsAPI } from './api/EvenementsAPI';
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UtilisateursAPI = exports.SupportAPI = exports.PingAPI = exports.PEIAPI = exports.OrganisationsAPI = exports.NotificationsAPI = exports.MoiAPI = exports.FeedAPI = exports.EvenementsAPI = exports.DossiersAPI = exports.Tus = exports.Client = exports.AuthMethod = exports.Collection = exports.Core = exports.OAuth2 = exports.Metarisc = void 0;
|
|
3
|
+
exports.UtilisateursAPI = exports.SupportAPI = exports.PingAPI = exports.PEIAPI = exports.OrganisationsAPI = exports.NotificationsAPI = exports.MoiAPI = exports.FeedAPI = exports.EvenementsAPI = exports.DossiersAPI = exports.Tus = exports.Utils = exports.Client = exports.AuthMethod = exports.Collection = exports.Core = exports.SessionExpiredError = exports.OAuth2 = exports.Metarisc = void 0;
|
|
4
4
|
var metarisc_1 = require("./metarisc");
|
|
5
5
|
Object.defineProperty(exports, "Metarisc", { enumerable: true, get: function () { return metarisc_1.Metarisc; } });
|
|
6
6
|
var oauth2_1 = require("./auth/oauth2");
|
|
7
7
|
Object.defineProperty(exports, "OAuth2", { enumerable: true, get: function () { return oauth2_1.OAuth2; } });
|
|
8
|
+
var SessionExpiredError_1 = require("./error/SessionExpiredError");
|
|
9
|
+
Object.defineProperty(exports, "SessionExpiredError", { enumerable: true, get: function () { return SessionExpiredError_1.SessionExpiredError; } });
|
|
8
10
|
var core_1 = require("./core");
|
|
9
11
|
Object.defineProperty(exports, "Core", { enumerable: true, get: function () { return core_1.Core; } });
|
|
10
12
|
var collection_1 = require("./collection");
|
|
@@ -12,6 +14,8 @@ Object.defineProperty(exports, "Collection", { enumerable: true, get: function (
|
|
|
12
14
|
var client_1 = require("./client");
|
|
13
15
|
Object.defineProperty(exports, "AuthMethod", { enumerable: true, get: function () { return client_1.AuthMethod; } });
|
|
14
16
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
17
|
+
var utils_1 = require("./utils");
|
|
18
|
+
Object.defineProperty(exports, "Utils", { enumerable: true, get: function () { return utils_1.Utils; } });
|
|
15
19
|
var tus_1 = require("./tus");
|
|
16
20
|
Object.defineProperty(exports, "Tus", { enumerable: true, get: function () { return tus_1.Tus; } });
|
|
17
21
|
var DossiersAPI_1 = require("./api/DossiersAPI");
|
package/lib/utils.d.ts
CHANGED
package/lib/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utils = void 0;
|
|
4
|
+
const jwt_decode_1 = require("jwt-decode");
|
|
3
5
|
class Utils {
|
|
4
6
|
/**
|
|
5
7
|
* Build URL with query params templates
|
|
@@ -19,12 +21,15 @@ class Utils {
|
|
|
19
21
|
}
|
|
20
22
|
static tokenExpired(token) {
|
|
21
23
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
+
const decoded_token = (0, jwt_decode_1.jwtDecode)(token);
|
|
25
|
+
if (Date.now() >= decoded_token.exp * 1000) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
catch (e) {
|
|
26
|
-
return
|
|
30
|
+
return true;
|
|
27
31
|
}
|
|
32
|
+
return false;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
exports.
|
|
35
|
+
exports.Utils = Utils;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@metarisc/metarisc-js",
|
|
3
3
|
"main": "lib/index.js",
|
|
4
4
|
"types": "lib/index.d.ts",
|
|
5
|
-
"version": "0.0.1-alpha.
|
|
5
|
+
"version": "0.0.1-alpha.31",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint . --ext .ts --fix",
|
|
8
8
|
"compile": "tsc",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"axios-cache-interceptor": "^1.3.2",
|
|
23
23
|
"axios-oauth-client": "^2.0.4",
|
|
24
24
|
"axios-retry": "^3.5.0",
|
|
25
|
+
"jwt-decode": "^4.0.0",
|
|
25
26
|
"tus-js-client": "^3.1.1"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/src/api/DossiersAPI.ts
CHANGED
package/src/api/EvenementsAPI.ts
CHANGED
package/src/api/FeedAPI.ts
CHANGED
package/src/api/MoiAPI.ts
CHANGED
package/src/api/PEIAPI.ts
CHANGED
package/src/api/PingAPI.ts
CHANGED
package/src/api/SupportAPI.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -5,9 +5,10 @@ import axios, {
|
|
|
5
5
|
} from "axios";
|
|
6
6
|
import axiosRetry from "axios-retry";
|
|
7
7
|
import { MetariscConfig, OAuth2Options } from "./core";
|
|
8
|
-
import { GrantResponse, OAuth2 } from "./auth/oauth2";
|
|
8
|
+
import { GrantResponse, OAuth2, RefreshResponse } from "./auth/oauth2";
|
|
9
9
|
import { setupCache } from "axios-cache-interceptor";
|
|
10
|
-
import Utils from "./utils";
|
|
10
|
+
import { Utils } from "./utils";
|
|
11
|
+
import { SessionExpiredError } from "./error/SessionExpiredError";
|
|
11
12
|
|
|
12
13
|
interface RequestConfig {
|
|
13
14
|
body?: any;
|
|
@@ -70,14 +71,12 @@ export class Client {
|
|
|
70
71
|
this.axios.interceptors.request.use(async (config) => {
|
|
71
72
|
// Si l'access_token a expiré on demande un échange avec le refresh token obtenu précedemment
|
|
72
73
|
// Si le refresh ne fonctionne pas, on ne fait rien
|
|
73
|
-
if (this.getAccessToken() !== undefined &&
|
|
74
|
+
if (this.getAccessToken() !== undefined && Utils.tokenExpired(this.getAccessToken())) {
|
|
74
75
|
try {
|
|
75
|
-
|
|
76
|
-
this.setAccessToken(result.token_type + ' ' + result.access_token);
|
|
77
|
-
this.setRefreshToken(result.refresh_token);
|
|
76
|
+
await this.refreshToken();
|
|
78
77
|
}
|
|
79
78
|
catch(e) {
|
|
80
|
-
|
|
79
|
+
throw new SessionExpiredError('La session utilisateur a expirée')
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
return config;
|
|
@@ -88,20 +87,33 @@ export class Client {
|
|
|
88
87
|
auth_method: AuthMethod,
|
|
89
88
|
options: OAuth2Options
|
|
90
89
|
): Promise<GrantResponse> {
|
|
91
|
-
if(auth_method === AuthMethod.AUTHORIZATION_CODE) {
|
|
90
|
+
if (auth_method === AuthMethod.AUTHORIZATION_CODE) {
|
|
92
91
|
const response = await this.oauth2.getAuthorizationCode(options);
|
|
93
92
|
this.setAccessToken(response.token_type + " " + response.access_token);
|
|
94
93
|
this.setRefreshToken(response.refresh_token);
|
|
95
94
|
return response;
|
|
96
|
-
}
|
|
97
|
-
else if(auth_method === AuthMethod.CLIENT_CREDENTIALS) {
|
|
95
|
+
} else if (auth_method === AuthMethod.CLIENT_CREDENTIALS) {
|
|
98
96
|
const response = await this.oauth2.getClientCredentials(options);
|
|
99
97
|
this.setAccessToken(response.token_type + " " + response.access_token);
|
|
100
98
|
return response;
|
|
99
|
+
} else {
|
|
100
|
+
throw new Error("auth_method inconnue");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async refreshToken(): Promise<RefreshResponse> {
|
|
105
|
+
if (this.refresh_token === undefined) {
|
|
106
|
+
throw new Error('Impossible de refresh sans refresh token');
|
|
101
107
|
}
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
try {
|
|
109
|
+
const refreshResponse = await this.oauth2.refreshToken(this.refresh_token);
|
|
110
|
+
this.setAccessToken(refreshResponse.token_type + " " + refreshResponse.access_token);
|
|
111
|
+
this.setRefreshToken(refreshResponse.refresh_token);
|
|
112
|
+
return refreshResponse;
|
|
113
|
+
} catch (e) {
|
|
114
|
+
throw new Error('Erreur pendant la tentative de refresh du token: ' + e.message);
|
|
104
115
|
}
|
|
116
|
+
|
|
105
117
|
}
|
|
106
118
|
|
|
107
119
|
/**
|
package/src/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosResponse } from "axios";
|
|
2
2
|
import { AuthMethod, Client } from "./client";
|
|
3
3
|
import { Collection } from "./collection";
|
|
4
|
-
import { GrantResponse } from "./auth/oauth2";
|
|
4
|
+
import { GrantResponse, RefreshResponse } from "./auth/oauth2";
|
|
5
5
|
|
|
6
6
|
interface RequestConfig {
|
|
7
7
|
body?: any;
|
|
@@ -54,6 +54,10 @@ export class Core {
|
|
|
54
54
|
return await this.client.authenticate(auth_method, options);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
refreshToken(): Promise<RefreshResponse> {
|
|
58
|
+
return this.client.refreshToken();
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
setAccessToken(access_token: string): void {
|
|
58
62
|
this.client.setAccessToken(access_token);
|
|
59
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { Metarisc } from "./metarisc";
|
|
2
2
|
export { OAuth2 } from "./auth/oauth2";
|
|
3
|
+
export { SessionExpiredError } from "./error/SessionExpiredError";
|
|
3
4
|
export { Core } from "./core";
|
|
4
5
|
export { Collection, PaginationData, PaginationResults } from "./collection";
|
|
5
6
|
export { AuthMethod, Client } from "./client";
|
|
7
|
+
export { Utils } from "./utils";
|
|
6
8
|
export { Tus } from "./tus";
|
|
7
9
|
|
|
8
10
|
export { DossiersAPI } from './api/DossiersAPI';
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { jwtDecode } from 'jwt-decode';
|
|
2
|
+
|
|
3
|
+
export class Utils {
|
|
2
4
|
/**
|
|
3
5
|
* Build URL with query params templates
|
|
4
6
|
*/
|
|
@@ -21,10 +23,13 @@ export default class Utils {
|
|
|
21
23
|
|
|
22
24
|
static tokenExpired(token: string): boolean {
|
|
23
25
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
+
const decoded_token = jwtDecode(token);
|
|
27
|
+
if (Date.now() >= decoded_token.exp * 1000) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
26
30
|
} catch (e) {
|
|
27
|
-
return
|
|
31
|
+
return true;
|
|
28
32
|
}
|
|
33
|
+
return false;
|
|
29
34
|
}
|
|
30
35
|
}
|