@verdocs/js-sdk 1.0.26 → 1.1.2
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/Documents/Documents.d.ts +14 -3
- package/Documents/Documents.js +27 -2
- package/Documents/Signatures.js +4 -4
- package/Documents/Stars.js +1 -1
- package/Documents/Types.d.ts +20 -0
- package/HTTP/Transport.d.ts +13 -39
- package/HTTP/Transport.js +18 -81
- package/HTTP/{Endpoint.d.ts → VerdocsEndpoint.d.ts} +8 -7
- package/HTTP/{Endpoint.js → VerdocsEndpoint.js} +21 -20
- package/HTTP/index.d.ts +1 -1
- package/HTTP/index.js +1 -1
- package/Organizations/ApiKeys.js +5 -5
- package/Organizations/Groups.js +7 -7
- package/Organizations/Invitations.js +7 -7
- package/Organizations/Members.js +5 -5
- package/Organizations/Organizations.js +6 -6
- package/Organizations/Webhooks.js +2 -2
- package/Organizations/Whitelabel.js +2 -2
- package/Search/Content.js +3 -3
- package/Templates/Documents.js +4 -4
- package/Templates/Fields.js +3 -3
- package/Templates/Pages.js +4 -4
- package/Templates/Reminders.js +4 -4
- package/Templates/Roles.js +7 -7
- package/Templates/Stars.js +2 -2
- package/Templates/Tags.js +6 -6
- package/Templates/Templates.js +6 -6
- package/Templates/Validators.js +2 -2
- package/Users/Auth.d.ts +3 -1
- package/Users/Auth.js +6 -6
- package/Users/Notifications.js +1 -1
- package/Users/Profiles.js +10 -10
- package/Utils/Token.d.ts +20 -0
- package/Utils/Token.js +67 -0
- package/Utils/index.d.ts +1 -0
- package/Utils/index.js +1 -0
- package/package.json +4 -2
|
@@ -6,31 +6,31 @@
|
|
|
6
6
|
import { getEndpoint } from '../HTTP/Transport';
|
|
7
7
|
export var getOrganizations = function () {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get('/organizations')
|
|
9
|
+
.api.get('/organizations')
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var createOrganization = function () {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.post('/organizations')
|
|
14
|
+
.api.post('/organizations')
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
|
17
17
|
export var validateOrganization = function () {
|
|
18
18
|
return getEndpoint()
|
|
19
|
-
.get('/organizations/is_valid')
|
|
19
|
+
.api.get('/organizations/is_valid')
|
|
20
20
|
.then(function (r) { return r.data; });
|
|
21
21
|
};
|
|
22
22
|
export var deleteOrganization = function (organizationId) {
|
|
23
23
|
return getEndpoint()
|
|
24
|
-
.delete("/organizations/".concat(organizationId))
|
|
24
|
+
.api.delete("/organizations/".concat(organizationId))
|
|
25
25
|
.then(function (r) { return r.data; });
|
|
26
26
|
};
|
|
27
27
|
export var getOrganization = function (organizationId) {
|
|
28
28
|
return getEndpoint()
|
|
29
|
-
.get("/organizations/".concat(organizationId))
|
|
29
|
+
.api.get("/organizations/".concat(organizationId))
|
|
30
30
|
.then(function (r) { return r.data; });
|
|
31
31
|
};
|
|
32
32
|
export var updateOrganization = function (organizationId, params) {
|
|
33
33
|
return getEndpoint()
|
|
34
|
-
.patch("/organizations/".concat(organizationId), params)
|
|
34
|
+
.api.patch("/organizations/".concat(organizationId), params)
|
|
35
35
|
.then(function (r) { return r.data; });
|
|
36
36
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var getWebhook = function (organizationId) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.get("/organizations/".concat(organizationId, "/webhook"))
|
|
4
|
+
.api.get("/organizations/".concat(organizationId, "/webhook"))
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var updateWebhook = function (organizationId, params) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.post("/organizations/".concat(organizationId, "/webhook"), params)
|
|
9
|
+
.api.post("/organizations/".concat(organizationId, "/webhook"), params)
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
@@ -20,7 +20,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
20
20
|
*/
|
|
21
21
|
export var setWhitelabel = function () {
|
|
22
22
|
return getEndpoint()
|
|
23
|
-
.post('/whitelabel')
|
|
23
|
+
.api.post('/whitelabel')
|
|
24
24
|
.then(function (r) { return r.data; });
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
@@ -34,6 +34,6 @@ export var setWhitelabel = function () {
|
|
|
34
34
|
*/
|
|
35
35
|
export var getWhitelabel = function () {
|
|
36
36
|
return getEndpoint()
|
|
37
|
-
.get('/whitelabel')
|
|
37
|
+
.api.get('/whitelabel')
|
|
38
38
|
.then(function (r) { return r.data; });
|
|
39
39
|
};
|
package/Search/Content.js
CHANGED
|
@@ -55,7 +55,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
55
55
|
export var getSearchHistory = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
56
|
return __generator(this, function (_a) {
|
|
57
57
|
return [2 /*return*/, getEndpoint()
|
|
58
|
-
.get('/search/history')
|
|
58
|
+
.api.get('/search/history')
|
|
59
59
|
.then(function (r) { return r.data; })];
|
|
60
60
|
});
|
|
61
61
|
}); };
|
|
@@ -71,7 +71,7 @@ export var getSearchHistory = function () { return __awaiter(void 0, void 0, voi
|
|
|
71
71
|
export var saveSearch = function (name, params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
72
|
return __generator(this, function (_a) {
|
|
73
73
|
return [2 /*return*/, getEndpoint()
|
|
74
|
-
.post('/search/saved', { name: name, params: params })
|
|
74
|
+
.api.post('/search/saved', { name: name, params: params })
|
|
75
75
|
.then(function (r) { return r.data; })];
|
|
76
76
|
});
|
|
77
77
|
}); };
|
|
@@ -87,7 +87,7 @@ export var saveSearch = function (name, params) { return __awaiter(void 0, void
|
|
|
87
87
|
export var searchContent = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
88
|
return __generator(this, function (_a) {
|
|
89
89
|
return [2 /*return*/, getEndpoint()
|
|
90
|
-
.post('/search/content', params)
|
|
90
|
+
.api.post('/search/content', params)
|
|
91
91
|
.then(function (r) { return r.data; })];
|
|
92
92
|
});
|
|
93
93
|
}); };
|
package/Templates/Documents.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
10
10
|
*/
|
|
11
11
|
export var getDocuments = function (templateId) {
|
|
12
12
|
return getEndpoint()
|
|
13
|
-
.get("/templates/".concat(templateId, "/documents/"))
|
|
13
|
+
.api.get("/templates/".concat(templateId, "/documents/"))
|
|
14
14
|
.then(function (r) { return r.data; });
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ export var getDocuments = function (templateId) {
|
|
|
24
24
|
*/
|
|
25
25
|
export var createDocument = function (templateId, params) {
|
|
26
26
|
return getEndpoint()
|
|
27
|
-
.post("/templates/".concat(templateId, "/documents/"), params)
|
|
27
|
+
.api.post("/templates/".concat(templateId, "/documents/"), params)
|
|
28
28
|
.then(function (r) { return r.data; });
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -38,7 +38,7 @@ export var createDocument = function (templateId, params) {
|
|
|
38
38
|
*/
|
|
39
39
|
export var getDocument = function (templateId, documentId) {
|
|
40
40
|
return getEndpoint()
|
|
41
|
-
.get("/templates/".concat(templateId, "/documents/").concat(documentId))
|
|
41
|
+
.api.get("/templates/".concat(templateId, "/documents/").concat(documentId))
|
|
42
42
|
.then(function (r) { return r.data; });
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
@@ -52,6 +52,6 @@ export var getDocument = function (templateId, documentId) {
|
|
|
52
52
|
*/
|
|
53
53
|
export var deleteDocument = function (templateId, documentId) {
|
|
54
54
|
return getEndpoint()
|
|
55
|
-
.delete("/templates/".concat(templateId, "/documents/").concat(documentId))
|
|
55
|
+
.api.delete("/templates/".concat(templateId, "/documents/").concat(documentId))
|
|
56
56
|
.then(function (r) { return r.data; });
|
|
57
57
|
};
|
package/Templates/Fields.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var createField = function (templateId, params) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.post("/templates/".concat(templateId, "/pages/"), params)
|
|
4
|
+
.api.post("/templates/".concat(templateId, "/pages/"), params)
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var editField = function (templateId, fieldName, params) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.put("/templates/".concat(templateId, "/pages/").concat(fieldName), params)
|
|
9
|
+
.api.put("/templates/".concat(templateId, "/pages/").concat(fieldName), params)
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var deleteField = function (templateId, fieldName) {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.delete("/templates/".concat(templateId, "/pages/").concat(fieldName))
|
|
14
|
+
.api.delete("/templates/".concat(templateId, "/pages/").concat(fieldName))
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
package/Templates/Pages.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var createPage = function (templateId, params) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.post("/templates/".concat(templateId, "/pages/"), params)
|
|
4
|
+
.api.post("/templates/".concat(templateId, "/pages/"), params)
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var editPage = function (templateId, sequence) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.put("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
9
|
+
.api.put("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var getPage = function (templateId, sequence) {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.get("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
14
|
+
.api.get("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
|
17
17
|
export var deletePage = function (templateId, sequence) {
|
|
18
18
|
return getEndpoint()
|
|
19
|
-
.delete("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
19
|
+
.api.delete("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
20
20
|
.then(function (r) { return r.data; });
|
|
21
21
|
};
|
package/Templates/Reminders.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var createReminder = function (templateId, params) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.post("/templates/".concat(templateId, "/reminder/"), params)
|
|
4
|
+
.api.post("/templates/".concat(templateId, "/reminder/"), params)
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var getReminder = function (templateId, reminderId) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
9
|
+
.api.get("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var editReminder = function (templateId, reminderId) {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.put("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
14
|
+
.api.put("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
|
17
17
|
export var deleteReminder = function (templateId, reminderId) {
|
|
18
18
|
return getEndpoint()
|
|
19
|
-
.delete("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
19
|
+
.api.delete("/templates/".concat(templateId, "/reminder/").concat(reminderId))
|
|
20
20
|
.then(function (r) { return r.data; });
|
|
21
21
|
};
|
package/Templates/Roles.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var createRole = function (templateId, params) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.post("/templates/".concat(templateId, "/roles/"), params)
|
|
4
|
+
.api.post("/templates/".concat(templateId, "/roles/"), params)
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var getRoles = function (templateId) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get("/templates/".concat(templateId, "/roles/"))
|
|
9
|
+
.api.get("/templates/".concat(templateId, "/roles/"))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var getRole = function (templateId, roleName) {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.get("/templates/".concat(templateId, "/roles/").concat(roleName))
|
|
14
|
+
.api.get("/templates/".concat(templateId, "/roles/").concat(roleName))
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
|
17
17
|
export var editRole = function (templateId, roleName, params) {
|
|
18
18
|
return getEndpoint()
|
|
19
|
-
.put("/templates/".concat(templateId, "/roles/").concat(roleName), params)
|
|
19
|
+
.api.put("/templates/".concat(templateId, "/roles/").concat(roleName), params)
|
|
20
20
|
.then(function (r) { return r.data; });
|
|
21
21
|
};
|
|
22
22
|
export var deleteRole = function (templateId, roleName) {
|
|
23
23
|
return getEndpoint()
|
|
24
|
-
.delete("/templates/".concat(templateId, "/roles/").concat(roleName))
|
|
24
|
+
.api.delete("/templates/".concat(templateId, "/roles/").concat(roleName))
|
|
25
25
|
.then(function (r) { return r.data; });
|
|
26
26
|
};
|
|
27
27
|
export var getRoleFields = function (templateId, roleName) {
|
|
28
28
|
return getEndpoint()
|
|
29
|
-
.get("/templates/".concat(templateId, "/roles/").concat(roleName, "/fields"))
|
|
29
|
+
.api.get("/templates/".concat(templateId, "/roles/").concat(roleName, "/fields"))
|
|
30
30
|
.then(function (r) { return r.data; });
|
|
31
31
|
};
|
|
32
32
|
export var deleteSequence = function (templateId) {
|
|
33
33
|
return getEndpoint()
|
|
34
|
-
.delete("/templates/".concat(templateId, "/roles/"))
|
|
34
|
+
.api.delete("/templates/".concat(templateId, "/roles/"))
|
|
35
35
|
.then(function (r) { return r.data; });
|
|
36
36
|
};
|
package/Templates/Stars.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var getStars = function (templateId) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.get("/templates/".concat(templateId, "/stars/"))
|
|
4
|
+
.api.get("/templates/".concat(templateId, "/stars/"))
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var toggleStar = function (templateId) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get("/templates/".concat(templateId, "/stars/toggle"))
|
|
9
|
+
.api.get("/templates/".concat(templateId, "/stars/toggle"))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
package/Templates/Tags.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var addTemplateTag = function (templateId, params) {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.post("/templates/".concat(templateId, "/tags/"), params)
|
|
4
|
+
.api.post("/templates/".concat(templateId, "/tags/"), params)
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var getTemplateTags = function (templateId) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get("/templates/".concat(templateId, "/tags/"))
|
|
9
|
+
.api.get("/templates/".concat(templateId, "/tags/"))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
|
12
12
|
export var deleteTemplateTag = function (templateId, tagName) {
|
|
13
13
|
return getEndpoint()
|
|
14
|
-
.post("/templates/".concat(templateId, "/tags/").concat(tagName))
|
|
14
|
+
.api.post("/templates/".concat(templateId, "/tags/").concat(tagName))
|
|
15
15
|
.then(function (r) { return r.data; });
|
|
16
16
|
};
|
|
17
17
|
export var createTag = function (params) {
|
|
18
18
|
return getEndpoint()
|
|
19
|
-
.post('/tags', params)
|
|
19
|
+
.api.post('/tags', params)
|
|
20
20
|
.then(function (r) { return r.data; });
|
|
21
21
|
};
|
|
22
22
|
export var getTag = function (tagName) {
|
|
23
23
|
return getEndpoint()
|
|
24
|
-
.get("/tags/".concat(tagName))
|
|
24
|
+
.api.get("/tags/".concat(tagName))
|
|
25
25
|
.then(function (r) { return r.data; });
|
|
26
26
|
};
|
|
27
27
|
export var getAllTags = function (params) {
|
|
28
28
|
return getEndpoint()
|
|
29
|
-
.get('/tags', params)
|
|
29
|
+
.api.get('/tags', params)
|
|
30
30
|
.then(function (r) { return r.data; });
|
|
31
31
|
};
|
package/Templates/Templates.js
CHANGED
|
@@ -37,22 +37,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
import { getEndpoint } from '../HTTP/Transport';
|
|
38
38
|
export var getTemplates = function () {
|
|
39
39
|
return getEndpoint()
|
|
40
|
-
.get('/templates/')
|
|
40
|
+
.api.get('/templates/')
|
|
41
41
|
.then(function (r) { return r.data; });
|
|
42
42
|
};
|
|
43
43
|
export var getTemplate = function (templateId) {
|
|
44
44
|
return getEndpoint()
|
|
45
|
-
.get("/templates/".concat(templateId))
|
|
45
|
+
.api.get("/templates/".concat(templateId))
|
|
46
46
|
.then(function (r) { return r.data; });
|
|
47
47
|
};
|
|
48
48
|
export var createTemplate = function (params) {
|
|
49
49
|
return getEndpoint()
|
|
50
|
-
.post('/templates/', params)
|
|
50
|
+
.api.post('/templates/', params)
|
|
51
51
|
.then(function (r) { return r.data; });
|
|
52
52
|
};
|
|
53
53
|
export var editTemplate = function (templateId, params) {
|
|
54
54
|
return getEndpoint()
|
|
55
|
-
.put("/templates/".concat(templateId), params)
|
|
55
|
+
.api.put("/templates/".concat(templateId), params)
|
|
56
56
|
.then(function (r) { return r.data; });
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
@@ -67,14 +67,14 @@ export var editTemplate = function (templateId, params) {
|
|
|
67
67
|
export var searchTemplates = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
68
|
return __generator(this, function (_a) {
|
|
69
69
|
return [2 /*return*/, getEndpoint()
|
|
70
|
-
.post('/templates/search', params)
|
|
70
|
+
.api.post('/templates/search', params)
|
|
71
71
|
.then(function (r) { return r.data; })];
|
|
72
72
|
});
|
|
73
73
|
}); };
|
|
74
74
|
export var getSummary = function (page) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
return [2 /*return*/, getEndpoint()
|
|
77
|
-
.post('/templates/summary', { page: page })
|
|
77
|
+
.api.post('/templates/summary', { page: page })
|
|
78
78
|
.then(function (r) { return r.data; })];
|
|
79
79
|
});
|
|
80
80
|
}); };
|
package/Templates/Validators.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
2
|
export var getValidators = function () {
|
|
3
3
|
return getEndpoint()
|
|
4
|
-
.get('/validators')
|
|
4
|
+
.api.get('/validators')
|
|
5
5
|
.then(function (r) { return r.data; });
|
|
6
6
|
};
|
|
7
7
|
export var getValidator = function (validatorName) {
|
|
8
8
|
return getEndpoint()
|
|
9
|
-
.get("/validators/".concat(validatorName))
|
|
9
|
+
.api.get("/validators/".concat(validatorName))
|
|
10
10
|
.then(function (r) { return r.data; });
|
|
11
11
|
};
|
package/Users/Auth.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { IAuthenticateAppRequest,
|
|
1
|
+
import { IAuthenticateAppRequest, IAuthenticateUserRequest, TokenValidationRequest, UpdateEmailRequest } from './Types';
|
|
2
|
+
import { IAuthenticateResponse, TokenValidationResponse, UpdateEmailResponse, UpdatePasswordResponse } from './Types';
|
|
3
|
+
import { UpdatePasswordRequest } from './Types';
|
|
2
4
|
/**
|
|
3
5
|
* Authenticate to Verdocs via user/password authentication
|
|
4
6
|
*
|
package/Users/Auth.js
CHANGED
|
@@ -12,7 +12,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
12
12
|
*/
|
|
13
13
|
export var authenticateUser = function (params) {
|
|
14
14
|
return getEndpoint()
|
|
15
|
-
.post('/authentication/login', params)
|
|
15
|
+
.api.post('/authentication/login', params)
|
|
16
16
|
.then(function (r) { return r.data; });
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
@@ -32,7 +32,7 @@ export var authenticateUser = function (params) {
|
|
|
32
32
|
*/
|
|
33
33
|
export var authenticateApp = function (params) {
|
|
34
34
|
return getEndpoint()
|
|
35
|
-
.post('/authentication/login_client', {}, { headers: params })
|
|
35
|
+
.api.post('/authentication/login_client', {}, { headers: params })
|
|
36
36
|
.then(function (r) { return r.data; });
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -51,7 +51,7 @@ export var authenticateApp = function (params) {
|
|
|
51
51
|
*/
|
|
52
52
|
export var validateToken = function (params) {
|
|
53
53
|
return getEndpoint()
|
|
54
|
-
.post('/token/isValid', params)
|
|
54
|
+
.api.post('/token/isValid', params)
|
|
55
55
|
.then(function (r) { return r.data; });
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
@@ -67,7 +67,7 @@ export var validateToken = function (params) {
|
|
|
67
67
|
*/
|
|
68
68
|
export var refreshTokens = function () {
|
|
69
69
|
return getEndpoint()
|
|
70
|
-
.get('/token')
|
|
70
|
+
.api.get('/token')
|
|
71
71
|
.then(function (r) { return r.data; });
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
@@ -84,7 +84,7 @@ export var refreshTokens = function () {
|
|
|
84
84
|
*/
|
|
85
85
|
export var updatePassword = function (params) {
|
|
86
86
|
return getEndpoint()
|
|
87
|
-
.put('/user/update_password', params)
|
|
87
|
+
.api.put('/user/update_password', params)
|
|
88
88
|
.then(function (r) { return r.data; });
|
|
89
89
|
};
|
|
90
90
|
/**
|
|
@@ -98,6 +98,6 @@ export var updatePassword = function (params) {
|
|
|
98
98
|
*/
|
|
99
99
|
export var updateEmail = function (params) {
|
|
100
100
|
return getEndpoint()
|
|
101
|
-
.put('/user/update_email', params)
|
|
101
|
+
.api.put('/user/update_email', params)
|
|
102
102
|
.then(function (r) { return r.data; });
|
|
103
103
|
};
|
package/Users/Notifications.js
CHANGED
|
@@ -38,7 +38,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
38
38
|
export var getNotifications = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
39
|
return __generator(this, function (_a) {
|
|
40
40
|
return [2 /*return*/, getEndpoint()
|
|
41
|
-
.get('/notifications')
|
|
41
|
+
.api.get('/notifications')
|
|
42
42
|
.then(function (r) { return r.data; })];
|
|
43
43
|
});
|
|
44
44
|
}); };
|
package/Users/Profiles.js
CHANGED
|
@@ -10,7 +10,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
10
10
|
*/
|
|
11
11
|
export var getProfiles = function () {
|
|
12
12
|
return getEndpoint()
|
|
13
|
-
.get('/profiles')
|
|
13
|
+
.api.get('/profiles')
|
|
14
14
|
.then(function (r) { return r.data; });
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ export var getProfiles = function () {
|
|
|
24
24
|
*/
|
|
25
25
|
export var getRoles = function () {
|
|
26
26
|
return getEndpoint()
|
|
27
|
-
.get('/roles')
|
|
27
|
+
.api.get('/roles')
|
|
28
28
|
.then(function (r) { return r.data; });
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -38,7 +38,7 @@ export var getRoles = function () {
|
|
|
38
38
|
*/
|
|
39
39
|
export var getPermissions = function () {
|
|
40
40
|
return getEndpoint()
|
|
41
|
-
.get('/permissions')
|
|
41
|
+
.api.get('/permissions')
|
|
42
42
|
.then(function (r) { return r.data; });
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
@@ -52,7 +52,7 @@ export var getPermissions = function () {
|
|
|
52
52
|
*/
|
|
53
53
|
export var createProfile = function (params) {
|
|
54
54
|
return getEndpoint()
|
|
55
|
-
.post('/profiles', params)
|
|
55
|
+
.api.post('/profiles', params)
|
|
56
56
|
.then(function (r) { return r.data; });
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
@@ -67,7 +67,7 @@ export var createProfile = function (params) {
|
|
|
67
67
|
*/
|
|
68
68
|
export var getProfile = function (profileId) {
|
|
69
69
|
return getEndpoint()
|
|
70
|
-
.get("/profiles/".concat(profileId))
|
|
70
|
+
.api.get("/profiles/".concat(profileId))
|
|
71
71
|
.then(function (r) { return r.data; });
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
@@ -81,7 +81,7 @@ export var getProfile = function (profileId) {
|
|
|
81
81
|
*/
|
|
82
82
|
export var getProfilePermissions = function (profileId) {
|
|
83
83
|
return getEndpoint()
|
|
84
|
-
.get("/profiles/".concat(profileId, "/permissions"))
|
|
84
|
+
.api.get("/profiles/".concat(profileId, "/permissions"))
|
|
85
85
|
.then(function (r) { return r.data; });
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
@@ -95,7 +95,7 @@ export var getProfilePermissions = function (profileId) {
|
|
|
95
95
|
*/
|
|
96
96
|
export var getProfileGroups = function (profileId) {
|
|
97
97
|
return getEndpoint()
|
|
98
|
-
.get("/profiles/".concat(profileId, "/groups"))
|
|
98
|
+
.api.get("/profiles/".concat(profileId, "/groups"))
|
|
99
99
|
.then(function (r) { return r.data; });
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
@@ -110,7 +110,7 @@ export var getProfileGroups = function (profileId) {
|
|
|
110
110
|
*/
|
|
111
111
|
export var switchProfile = function (profileId) {
|
|
112
112
|
return getEndpoint()
|
|
113
|
-
.post("/profiles/".concat(profileId, "/switch"))
|
|
113
|
+
.api.post("/profiles/".concat(profileId, "/switch"))
|
|
114
114
|
.then(function (r) { return r.data; });
|
|
115
115
|
};
|
|
116
116
|
/**
|
|
@@ -125,7 +125,7 @@ export var switchProfile = function (profileId) {
|
|
|
125
125
|
*/
|
|
126
126
|
export var updateProfile = function (profileId, params) {
|
|
127
127
|
return getEndpoint()
|
|
128
|
-
.put("/profiles/".concat(profileId), params)
|
|
128
|
+
.api.put("/profiles/".concat(profileId), params)
|
|
129
129
|
.then(function (r) { return r.data; });
|
|
130
130
|
};
|
|
131
131
|
/**
|
|
@@ -139,6 +139,6 @@ export var updateProfile = function (profileId, params) {
|
|
|
139
139
|
*/
|
|
140
140
|
export var deleteProfile = function (profileId) {
|
|
141
141
|
return getEndpoint()
|
|
142
|
-
.delete("/profiles/".concat(profileId))
|
|
142
|
+
.api.delete("/profiles/".concat(profileId))
|
|
143
143
|
.then(function (r) { return r.data; });
|
|
144
144
|
};
|
package/Utils/Token.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ISigningSession } from '../Documents/Types';
|
|
2
|
+
import { IActiveSession } from '../Users/Types';
|
|
3
|
+
/**
|
|
4
|
+
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
5
|
+
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
6
|
+
*/
|
|
7
|
+
export declare const AtoB: (str: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
10
|
+
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
11
|
+
*/
|
|
12
|
+
export declare const decodeTokenBody: (token: string) => any;
|
|
13
|
+
/**
|
|
14
|
+
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
15
|
+
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
16
|
+
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
17
|
+
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
18
|
+
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
19
|
+
*/
|
|
20
|
+
export declare const decodeAccessTokenBody: (token: string) => IActiveSession | ISigningSession | null;
|
package/Utils/Token.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* tslint:disable:no-bitwise */
|
|
2
|
+
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3
|
+
// Regular expression to check formal correctness of base64 encoded strings
|
|
4
|
+
var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
5
|
+
/**
|
|
6
|
+
* Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
|
|
7
|
+
* Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
|
|
8
|
+
*/
|
|
9
|
+
export var AtoB = function (str) {
|
|
10
|
+
// atob can work with strings with whitespaces, even inside the encoded part,
|
|
11
|
+
// but only \t, \n, \f, \r and ' ', which can be stripped.
|
|
12
|
+
str = String(str).replace(/[\t\n\f\r ]+/g, '');
|
|
13
|
+
if (!b64re.test(str))
|
|
14
|
+
throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
|
15
|
+
// Adding the padding if missing, for semplicity
|
|
16
|
+
str += '=='.slice(2 - (str.length & 3));
|
|
17
|
+
var bitmap;
|
|
18
|
+
var result = '';
|
|
19
|
+
var r1;
|
|
20
|
+
var r2;
|
|
21
|
+
var i = 0;
|
|
22
|
+
for (; i < str.length;) {
|
|
23
|
+
bitmap =
|
|
24
|
+
(b64.indexOf(str.charAt(i++)) << 18) |
|
|
25
|
+
(b64.indexOf(str.charAt(i++)) << 12) |
|
|
26
|
+
((r1 = b64.indexOf(str.charAt(i++))) << 6) |
|
|
27
|
+
(r2 = b64.indexOf(str.charAt(i++)));
|
|
28
|
+
result +=
|
|
29
|
+
r1 === 64
|
|
30
|
+
? String.fromCharCode((bitmap >> 16) & 255)
|
|
31
|
+
: r2 === 64
|
|
32
|
+
? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
|
|
33
|
+
: String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
|
|
39
|
+
* many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
|
|
40
|
+
*/
|
|
41
|
+
export var decodeTokenBody = function (token) { return JSON.parse(AtoB((token || '').split('.')[1] || '')); };
|
|
42
|
+
/**
|
|
43
|
+
* Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
|
|
44
|
+
* `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
|
|
45
|
+
* will be removed. Note that user and signing sessions have different access token formats. The calling
|
|
46
|
+
* application should distinguish between the two based on the context of the authenticated session, or by
|
|
47
|
+
* the presence of the `document_id` field, which will only be present for signing sessions.
|
|
48
|
+
*/
|
|
49
|
+
export var decodeAccessTokenBody = function (token) {
|
|
50
|
+
var decoded;
|
|
51
|
+
try {
|
|
52
|
+
decoded = decodeTokenBody(token);
|
|
53
|
+
if (decoded === null) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
Object.keys(decoded).forEach(function (key) {
|
|
61
|
+
if (typeof key === 'string' && key.startsWith('https://verdocs.com/')) {
|
|
62
|
+
decoded[key.replace('https://verdocs.com/', '')] = decoded[key];
|
|
63
|
+
delete decoded[key];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return decoded;
|
|
67
|
+
};
|
package/Utils/index.d.ts
CHANGED
package/Utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdocs/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": "https://github.com/Verdocs/js-sdk",
|
|
6
6
|
"description": "Verdocs JS SDK",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"docs-html": "typedoc --tsconfig ./tsconfig-typedoc.json --plugin none --out docs-html",
|
|
37
37
|
"Xdocs-html": "typedoc --tsconfig ./tsconfig-typedoc.json --plugin ./typedoc-theme.tsx --out docs-html",
|
|
38
38
|
"docs": "rm -rf ../partner-portal/site/static/js-sdk/* && npm run docs-md && npm run docs-html && cp -aR docs-html/* ../partner-portal/site/static/js-sdk/",
|
|
39
|
+
"clear-docs": "aws --profile=verdocs cloudfront create-invalidation --distribution-id E29UFGU4KEH1GQ --paths \"/*\"",
|
|
40
|
+
"deploy-docs": "npm run docs && aws --profile=verdocs s3 sync --acl public-read --delete docs-html s3://verdocs-developers-js-sdk/ && yarn clear-docs",
|
|
39
41
|
"clean": "rm -rf Documents HTTP Organizations Search Templates Users Utils index.js index.d.ts docs docs-html"
|
|
40
42
|
},
|
|
41
43
|
"publishConfig": {
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
"axios": "^0.21.1"
|
|
46
48
|
},
|
|
47
49
|
"peerDependencies": {
|
|
48
|
-
"typescript": "4.
|
|
50
|
+
"typescript": "4.2.x || 4.3.x || 4.4.x || 4.5.x"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@types/jest": "^27.0.2",
|