@verdocs/js-sdk 1.1.15 → 1.2.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/.github/workflows/generate-docs.yml +41 -0
- package/HTTP/Transport.js +1 -1
- package/HTTP/VerdocsEndpoint.d.ts +43 -31
- package/HTTP/VerdocsEndpoint.js +47 -36
- package/Templates/Fields.d.ts +9 -0
- package/Templates/Fields.js +9 -0
- package/Templates/Pages.d.ts +12 -0
- package/Templates/Pages.js +12 -0
- package/Templates/Roles.d.ts +7 -0
- package/Templates/Roles.js +7 -0
- package/Templates/Templates.d.ts +6 -1
- package/Templates/Templates.js +2 -2
- package/Utils/Files.d.ts +12 -0
- package/Utils/Files.js +25 -0
- package/Utils/index.d.ts +1 -0
- package/Utils/index.js +1 -0
- package/package.json +4 -3
- package/tsconfig-typedoc.json +2 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Generate Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- "src/**"
|
|
9
|
+
- "README.md"
|
|
10
|
+
- "package.json"
|
|
11
|
+
- "tsconfig-typedoc.json"
|
|
12
|
+
- ".github/workflows/generate-docs.yml"
|
|
13
|
+
|
|
14
|
+
defaults:
|
|
15
|
+
run:
|
|
16
|
+
shell: bash
|
|
17
|
+
|
|
18
|
+
# We only want to run one job at a time in this group
|
|
19
|
+
concurrency:
|
|
20
|
+
group: api-sdk-docs
|
|
21
|
+
cancel-in-progress: true
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
deploy:
|
|
25
|
+
name: Deploy Docs
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout 🛎️
|
|
29
|
+
uses: actions/checkout@v2
|
|
30
|
+
|
|
31
|
+
- name: Install and Build 🔧
|
|
32
|
+
run: |
|
|
33
|
+
npm ci
|
|
34
|
+
npm run build
|
|
35
|
+
|
|
36
|
+
- name: Deploy 🚀
|
|
37
|
+
uses: JamesIves/github-pages-deploy-action@v4.2.3
|
|
38
|
+
with:
|
|
39
|
+
branch: gh-pages
|
|
40
|
+
folder: docs-html
|
|
41
|
+
clean: true
|
package/HTTP/Transport.js
CHANGED
|
@@ -11,7 +11,7 @@ import { VerdocsEndpoint } from './VerdocsEndpoint';
|
|
|
11
11
|
// Also see globalThis for comments about why we're doing this in the first place.
|
|
12
12
|
var ENDPOINT_KEY = Symbol.for('verdocs-api-endpoint');
|
|
13
13
|
if (!globalThis[ENDPOINT_KEY]) {
|
|
14
|
-
globalThis[ENDPOINT_KEY] = new VerdocsEndpoint(
|
|
14
|
+
globalThis[ENDPOINT_KEY] = new VerdocsEndpoint();
|
|
15
15
|
}
|
|
16
16
|
var globalEndpoint = globalThis[ENDPOINT_KEY];
|
|
17
17
|
var activeEndpoint = globalEndpoint;
|
|
@@ -1,94 +1,106 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
|
|
4
|
+
* Endpoints can be used for isolated session tasks.
|
|
4
5
|
* For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
|
|
5
6
|
* In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
|
|
6
7
|
* discarded once signing is complete.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
+
* Note that endpoint configuration functions return the instance, so they can be chained, e.g.
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
13
|
+
*
|
|
14
|
+
* const endpoint = new VerdocsEndpoint();
|
|
15
|
+
* endpoint
|
|
16
|
+
* .logRequests(true)
|
|
17
|
+
* .setClientID('1234)
|
|
18
|
+
* .setTimeout(5000);
|
|
19
|
+
* ```
|
|
9
20
|
*/
|
|
10
|
-
import { AxiosInstance } from 'axios';
|
|
11
21
|
export declare class VerdocsEndpoint {
|
|
22
|
+
/**
|
|
23
|
+
* Reference to the axios instance wrapped by this endpoint. This is exposed as a convenience to developers, but
|
|
24
|
+
* developers should generally use the convenience functions such as `setTimeout` to configure the connection.
|
|
25
|
+
* Although there are currently no plans to change from Axios to another XHR library, the less this property is
|
|
26
|
+
* directly accessed the easier future migrations will be.
|
|
27
|
+
*/
|
|
12
28
|
api: AxiosInstance;
|
|
13
|
-
requestLoggerId
|
|
29
|
+
private requestLoggerId;
|
|
14
30
|
/**
|
|
15
|
-
* Create a new
|
|
31
|
+
* Create a new VerdocsEndpoint to call Verdocs platform services.
|
|
16
32
|
*
|
|
17
33
|
* ```typescript
|
|
18
|
-
* import {
|
|
19
|
-
*
|
|
20
|
-
* console.log('Current timeout', Transport.getEndpoint().defaults.timeout);
|
|
34
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
35
|
+
* const endpoint = new VerdocsEndpoint();
|
|
21
36
|
* ```
|
|
22
37
|
*/
|
|
23
|
-
constructor(
|
|
24
|
-
baseURL?: string;
|
|
25
|
-
timeout?: number;
|
|
26
|
-
});
|
|
38
|
+
constructor();
|
|
27
39
|
/**
|
|
28
40
|
* Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
|
|
29
41
|
*
|
|
30
42
|
* ```typescript
|
|
31
|
-
* import {
|
|
43
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
32
44
|
*
|
|
33
|
-
* const endpoint = new
|
|
45
|
+
* const endpoint = new VerdocsEndpoint();
|
|
34
46
|
* endpoint.setTimeout(3000);
|
|
35
47
|
* ```
|
|
36
48
|
*/
|
|
37
|
-
setTimeout(timeout: number):
|
|
49
|
+
setTimeout(timeout: number): VerdocsEndpoint;
|
|
38
50
|
/**
|
|
39
51
|
* Set the Client ID for Verdocs API calls.
|
|
40
52
|
*
|
|
41
53
|
* ```typescript
|
|
42
|
-
* import {
|
|
54
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
43
55
|
*
|
|
44
|
-
* const endpoint = new
|
|
56
|
+
* const endpoint = new VerdocsEndpoint();
|
|
45
57
|
* endpoint.setClientID('1234);
|
|
46
58
|
* ```
|
|
47
59
|
*/
|
|
48
|
-
setClientID(clientID: string):
|
|
60
|
+
setClientID(clientID: string): VerdocsEndpoint;
|
|
49
61
|
/**
|
|
50
62
|
* Set the auth token that will be used for Verdocs API calls.
|
|
51
63
|
*
|
|
52
64
|
* ```typescript
|
|
53
|
-
* import {
|
|
65
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
54
66
|
*
|
|
55
|
-
* const endpoint = new
|
|
67
|
+
* const endpoint = new VerdocsEndpoint();
|
|
56
68
|
* endpoint.setAuthorization(accessToken);
|
|
57
69
|
* ```
|
|
58
70
|
*/
|
|
59
|
-
setAuthorization(accessToken: string | null):
|
|
71
|
+
setAuthorization(accessToken: string | null): VerdocsEndpoint;
|
|
60
72
|
/**
|
|
61
73
|
* Set the auth token used for signing sessions. Separating user from signing auth allows the same endpoint to be
|
|
62
74
|
* used for multiple operations, although it is recommended that a separate endpoint be created for each operation.
|
|
63
75
|
*
|
|
64
76
|
* ```typescript
|
|
65
|
-
* import {
|
|
77
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
66
78
|
*
|
|
67
|
-
* const endpoint = new
|
|
79
|
+
* const endpoint = new VerdocsEndpoint();
|
|
68
80
|
* endpoint.setSigningAuthorization(accessToken);
|
|
69
81
|
* ```
|
|
70
82
|
*/
|
|
71
|
-
setSigningAuthorization(accessToken: string | null):
|
|
83
|
+
setSigningAuthorization(accessToken: string | null): VerdocsEndpoint;
|
|
72
84
|
/**
|
|
73
85
|
* Set the base URL for API calls. May also be set via the constructor.
|
|
74
86
|
*
|
|
75
87
|
* ```typescript
|
|
76
|
-
* import {
|
|
88
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
77
89
|
*
|
|
78
|
-
* const endpoint = new
|
|
90
|
+
* const endpoint = new VerdocsEndpoint();
|
|
79
91
|
* endpoint.setBaseURL('https://api.verdocs.com');
|
|
80
92
|
* ```
|
|
81
93
|
*/
|
|
82
|
-
setBaseURL(url: string):
|
|
94
|
+
setBaseURL(url: string): VerdocsEndpoint;
|
|
83
95
|
/**
|
|
84
96
|
* Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
|
|
85
97
|
*
|
|
86
98
|
* ```typescript
|
|
87
|
-
* import {
|
|
99
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
88
100
|
*
|
|
89
|
-
* const endpoint = new
|
|
101
|
+
* const endpoint = new VerdocsEndpoint();
|
|
90
102
|
* endpoint.logRequests(true);
|
|
91
103
|
* ```
|
|
92
104
|
*/
|
|
93
|
-
logRequests(enable: boolean):
|
|
105
|
+
logRequests(enable: boolean): VerdocsEndpoint;
|
|
94
106
|
}
|
package/HTTP/VerdocsEndpoint.js
CHANGED
|
@@ -1,119 +1,129 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
var requestLogger = function (r) {
|
|
3
|
+
// tslint:disable-next-line
|
|
4
|
+
console.debug("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
|
|
5
|
+
return r;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
8
|
+
* VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
|
|
9
|
+
* Endpoints can be used for isolated session tasks.
|
|
4
10
|
* For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
|
|
5
11
|
* In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
|
|
6
12
|
* discarded once signing is complete.
|
|
7
13
|
*
|
|
8
|
-
*
|
|
14
|
+
* Note that endpoint configuration functions return the instance, so they can be chained, e.g.
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
18
|
+
*
|
|
19
|
+
* const endpoint = new VerdocsEndpoint();
|
|
20
|
+
* endpoint
|
|
21
|
+
* .logRequests(true)
|
|
22
|
+
* .setClientID('1234)
|
|
23
|
+
* .setTimeout(5000);
|
|
24
|
+
* ```
|
|
9
25
|
*/
|
|
10
|
-
import axios from 'axios';
|
|
11
|
-
var requestLogger = function (r) {
|
|
12
|
-
// tslint:disable-next-line
|
|
13
|
-
console.log("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
|
|
14
|
-
return r;
|
|
15
|
-
};
|
|
16
26
|
var VerdocsEndpoint = /** @class */ (function () {
|
|
17
27
|
/**
|
|
18
|
-
* Create a new
|
|
28
|
+
* Create a new VerdocsEndpoint to call Verdocs platform services.
|
|
19
29
|
*
|
|
20
30
|
* ```typescript
|
|
21
|
-
* import {
|
|
22
|
-
*
|
|
23
|
-
* console.log('Current timeout', Transport.getEndpoint().defaults.timeout);
|
|
31
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
32
|
+
* const endpoint = new VerdocsEndpoint();
|
|
24
33
|
* ```
|
|
25
34
|
*/
|
|
26
|
-
function VerdocsEndpoint(
|
|
27
|
-
var _b = _a === void 0 ? {} : _a, baseURL = _b.baseURL, timeout = _b.timeout;
|
|
35
|
+
function VerdocsEndpoint() {
|
|
28
36
|
this.requestLoggerId = null;
|
|
29
|
-
this.api = axios.create({
|
|
30
|
-
baseURL: baseURL || 'https://api.verdocs.com',
|
|
31
|
-
timeout: timeout || 6000,
|
|
32
|
-
});
|
|
37
|
+
this.api = axios.create({ baseURL: 'https://api.verdocs.com', timeout: 3000 });
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
|
|
36
41
|
*
|
|
37
42
|
* ```typescript
|
|
38
|
-
* import {
|
|
43
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
39
44
|
*
|
|
40
|
-
* const endpoint = new
|
|
45
|
+
* const endpoint = new VerdocsEndpoint();
|
|
41
46
|
* endpoint.setTimeout(3000);
|
|
42
47
|
* ```
|
|
43
48
|
*/
|
|
44
49
|
VerdocsEndpoint.prototype.setTimeout = function (timeout) {
|
|
45
50
|
this.api.defaults.timeout = timeout;
|
|
51
|
+
return this;
|
|
46
52
|
};
|
|
47
53
|
/**
|
|
48
54
|
* Set the Client ID for Verdocs API calls.
|
|
49
55
|
*
|
|
50
56
|
* ```typescript
|
|
51
|
-
* import {
|
|
57
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
52
58
|
*
|
|
53
|
-
* const endpoint = new
|
|
59
|
+
* const endpoint = new VerdocsEndpoint();
|
|
54
60
|
* endpoint.setClientID('1234);
|
|
55
61
|
* ```
|
|
56
62
|
*/
|
|
57
63
|
VerdocsEndpoint.prototype.setClientID = function (clientID) {
|
|
58
|
-
this.api.defaults.headers['X-Client-ID'] = clientID;
|
|
64
|
+
this.api.defaults.headers.common['X-Client-ID'] = clientID;
|
|
65
|
+
return this;
|
|
59
66
|
};
|
|
60
67
|
/**
|
|
61
68
|
* Set the auth token that will be used for Verdocs API calls.
|
|
62
69
|
*
|
|
63
70
|
* ```typescript
|
|
64
|
-
* import {
|
|
71
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
65
72
|
*
|
|
66
|
-
* const endpoint = new
|
|
73
|
+
* const endpoint = new VerdocsEndpoint();
|
|
67
74
|
* endpoint.setAuthorization(accessToken);
|
|
68
75
|
* ```
|
|
69
76
|
*/
|
|
70
77
|
VerdocsEndpoint.prototype.setAuthorization = function (accessToken) {
|
|
71
78
|
if (accessToken) {
|
|
72
|
-
this.api.defaults.headers.Authorization = "Bearer ".concat(accessToken);
|
|
79
|
+
this.api.defaults.headers.common.Authorization = "Bearer ".concat(accessToken);
|
|
73
80
|
}
|
|
74
81
|
else {
|
|
75
|
-
delete this.api.defaults.headers.Authorization;
|
|
82
|
+
delete this.api.defaults.headers.common.Authorization;
|
|
76
83
|
}
|
|
84
|
+
return this;
|
|
77
85
|
};
|
|
78
86
|
/**
|
|
79
87
|
* Set the auth token used for signing sessions. Separating user from signing auth allows the same endpoint to be
|
|
80
88
|
* used for multiple operations, although it is recommended that a separate endpoint be created for each operation.
|
|
81
89
|
*
|
|
82
90
|
* ```typescript
|
|
83
|
-
* import {
|
|
91
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
84
92
|
*
|
|
85
|
-
* const endpoint = new
|
|
93
|
+
* const endpoint = new VerdocsEndpoint();
|
|
86
94
|
* endpoint.setSigningAuthorization(accessToken);
|
|
87
95
|
* ```
|
|
88
96
|
*/
|
|
89
97
|
VerdocsEndpoint.prototype.setSigningAuthorization = function (accessToken) {
|
|
90
98
|
if (accessToken) {
|
|
91
|
-
this.api.defaults.headers.signer = "Bearer ".concat(accessToken);
|
|
99
|
+
this.api.defaults.headers.common.signer = "Bearer ".concat(accessToken);
|
|
92
100
|
}
|
|
93
101
|
else {
|
|
94
|
-
delete this.api.defaults.headers.signer;
|
|
102
|
+
delete this.api.defaults.headers.common.signer;
|
|
95
103
|
}
|
|
104
|
+
return this;
|
|
96
105
|
};
|
|
97
106
|
/**
|
|
98
107
|
* Set the base URL for API calls. May also be set via the constructor.
|
|
99
108
|
*
|
|
100
109
|
* ```typescript
|
|
101
|
-
* import {
|
|
110
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
102
111
|
*
|
|
103
|
-
* const endpoint = new
|
|
112
|
+
* const endpoint = new VerdocsEndpoint();
|
|
104
113
|
* endpoint.setBaseURL('https://api.verdocs.com');
|
|
105
114
|
* ```
|
|
106
115
|
*/
|
|
107
116
|
VerdocsEndpoint.prototype.setBaseURL = function (url) {
|
|
108
117
|
this.api.defaults.baseURL = url;
|
|
118
|
+
return this;
|
|
109
119
|
};
|
|
110
120
|
/**
|
|
111
121
|
* Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
|
|
112
122
|
*
|
|
113
123
|
* ```typescript
|
|
114
|
-
* import {
|
|
124
|
+
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
115
125
|
*
|
|
116
|
-
* const endpoint = new
|
|
126
|
+
* const endpoint = new VerdocsEndpoint();
|
|
117
127
|
* endpoint.logRequests(true);
|
|
118
128
|
* ```
|
|
119
129
|
*/
|
|
@@ -124,6 +134,7 @@ var VerdocsEndpoint = /** @class */ (function () {
|
|
|
124
134
|
else if (!enable && this.requestLoggerId !== null) {
|
|
125
135
|
this.api.interceptors.request.eject(this.requestLoggerId);
|
|
126
136
|
}
|
|
137
|
+
return this;
|
|
127
138
|
};
|
|
128
139
|
return VerdocsEndpoint;
|
|
129
140
|
}());
|
package/Templates/Fields.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { ITemplateField } from './Types';
|
|
2
|
+
/**
|
|
3
|
+
* Add a field to a template.
|
|
4
|
+
*/
|
|
2
5
|
export declare const createField: (templateId: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
6
|
+
/**
|
|
7
|
+
* Update a template field.
|
|
8
|
+
*/
|
|
3
9
|
export declare const editField: (templateId: string, fieldName: string, params: ITemplateField) => Promise<ITemplateField>;
|
|
10
|
+
/**
|
|
11
|
+
* REmove a field from a template.
|
|
12
|
+
*/
|
|
4
13
|
export declare const deleteField: (templateId: string, fieldName: string) => Promise<any>;
|
package/Templates/Fields.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
|
+
/**
|
|
3
|
+
* Add a field to a template.
|
|
4
|
+
*/
|
|
2
5
|
export var createField = function (templateId, params) {
|
|
3
6
|
return getEndpoint()
|
|
4
7
|
.api.post("/templates/".concat(templateId, "/pages/"), params)
|
|
5
8
|
.then(function (r) { return r.data; });
|
|
6
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Update a template field.
|
|
12
|
+
*/
|
|
7
13
|
export var editField = function (templateId, fieldName, params) {
|
|
8
14
|
return getEndpoint()
|
|
9
15
|
.api.put("/templates/".concat(templateId, "/pages/").concat(fieldName), params)
|
|
10
16
|
.then(function (r) { return r.data; });
|
|
11
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* REmove a field from a template.
|
|
20
|
+
*/
|
|
12
21
|
export var deleteField = function (templateId, fieldName) {
|
|
13
22
|
return getEndpoint()
|
|
14
23
|
.api.delete("/templates/".concat(templateId, "/pages/").concat(fieldName))
|
package/Templates/Pages.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { IPage } from './Types';
|
|
2
|
+
/**
|
|
3
|
+
* Add a page to a template
|
|
4
|
+
*/
|
|
2
5
|
export declare const createPage: (templateId: string, params: IPage) => Promise<IPage>;
|
|
6
|
+
/**
|
|
7
|
+
* Update a template page.
|
|
8
|
+
*/
|
|
3
9
|
export declare const editPage: (templateId: string, sequence: string) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Get a page from a template.
|
|
12
|
+
*/
|
|
4
13
|
export declare const getPage: (templateId: string, sequence: string) => Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Delete a page from a template
|
|
16
|
+
*/
|
|
5
17
|
export declare const deletePage: (templateId: string, sequence: string) => Promise<any>;
|
package/Templates/Pages.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
|
+
/**
|
|
3
|
+
* Add a page to a template
|
|
4
|
+
*/
|
|
2
5
|
export var createPage = function (templateId, params) {
|
|
3
6
|
return getEndpoint()
|
|
4
7
|
.api.post("/templates/".concat(templateId, "/pages/"), params)
|
|
5
8
|
.then(function (r) { return r.data; });
|
|
6
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Update a template page.
|
|
12
|
+
*/
|
|
7
13
|
export var editPage = function (templateId, sequence) {
|
|
8
14
|
return getEndpoint()
|
|
9
15
|
.api.put("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
10
16
|
.then(function (r) { return r.data; });
|
|
11
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Get a page from a template.
|
|
20
|
+
*/
|
|
12
21
|
export var getPage = function (templateId, sequence) {
|
|
13
22
|
return getEndpoint()
|
|
14
23
|
.api.get("/templates/".concat(templateId, "/pages/").concat(sequence))
|
|
15
24
|
.then(function (r) { return r.data; });
|
|
16
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Delete a page from a template
|
|
28
|
+
*/
|
|
17
29
|
export var deletePage = function (templateId, sequence) {
|
|
18
30
|
return getEndpoint()
|
|
19
31
|
.api.delete("/templates/".concat(templateId, "/pages/").concat(sequence))
|
package/Templates/Roles.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A "role" is an individual participant in a signing flow, such as a signer or CC contact. Roles are identified by
|
|
3
|
+
* their names, which must be unique (e.g. 'Recipient 1'). Template fields are assigned to roles for signing operations,
|
|
4
|
+
* so you may have 'Recipient 1 Signature 1' and so forth.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import { ITemplateField, IRole } from './Types';
|
|
2
9
|
export declare const createRole: (templateId: string, params: IRole) => Promise<IRole>;
|
|
3
10
|
export declare const getRoles: (templateId: string) => Promise<IRole[]>;
|
package/Templates/Roles.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A "role" is an individual participant in a signing flow, such as a signer or CC contact. Roles are identified by
|
|
3
|
+
* their names, which must be unique (e.g. 'Recipient 1'). Template fields are assigned to roles for signing operations,
|
|
4
|
+
* so you may have 'Recipient 1 Signature 1' and so forth.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import { getEndpoint } from '../HTTP/Transport';
|
|
2
9
|
export var createRole = function (templateId, params) {
|
|
3
10
|
return getEndpoint()
|
package/Templates/Templates.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ITemplate, ITemplatesSearchResult, ITemplatesSummary } from './Types';
|
|
2
|
-
export
|
|
2
|
+
export interface IGetTemplatesParams {
|
|
3
|
+
is_starred?: boolean;
|
|
4
|
+
is_creator?: boolean;
|
|
5
|
+
is_organization?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const getTemplates: (params?: IGetTemplatesParams | undefined) => Promise<any[]>;
|
|
3
8
|
export declare const getTemplate: (templateId: string) => Promise<any>;
|
|
4
9
|
export declare const createTemplate: (params: any) => Promise<ITemplate>;
|
|
5
10
|
export declare const editTemplate: (templateId: string, params: any) => Promise<ITemplate>;
|
package/Templates/Templates.js
CHANGED
|
@@ -35,9 +35,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { getEndpoint } from '../HTTP/Transport';
|
|
38
|
-
export var getTemplates = function () {
|
|
38
|
+
export var getTemplates = function (params) {
|
|
39
39
|
return getEndpoint()
|
|
40
|
-
.api.get('/templates/')
|
|
40
|
+
.api.get('/templates/', { params: params })
|
|
41
41
|
.then(function (r) { return r.data; });
|
|
42
42
|
};
|
|
43
43
|
export var getTemplate = function (templateId) {
|
package/Utils/Files.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface FileWithData {
|
|
2
|
+
lastModified: number;
|
|
3
|
+
size: number;
|
|
4
|
+
type: string;
|
|
5
|
+
name: string;
|
|
6
|
+
data: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
10
|
+
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
11
|
+
*/
|
|
12
|
+
export declare const fileToDataUrl: (file: File) => Promise<FileWithData>;
|
package/Utils/Files.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a File, extract the file's content as a base64 encoded data URL. The response will have a prefix that
|
|
3
|
+
* includes the MIME type of the file, e.g. "data:image/jpeg;base64,iVBORw0K......"
|
|
4
|
+
*/
|
|
5
|
+
export var fileToDataUrl = function (file) {
|
|
6
|
+
return new Promise(function (resolve, reject) {
|
|
7
|
+
var reader = new FileReader();
|
|
8
|
+
reader.onload = function () {
|
|
9
|
+
return resolve({
|
|
10
|
+
lastModified: file.lastModified,
|
|
11
|
+
size: file.size,
|
|
12
|
+
type: file.type,
|
|
13
|
+
name: file.name,
|
|
14
|
+
data: reader.result,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
reader.onerror = reject;
|
|
18
|
+
if (file) {
|
|
19
|
+
reader.readAsDataURL(file);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
reject(new Error('Invalid file'));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
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.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": "https://github.com/Verdocs/js-sdk",
|
|
6
6
|
"description": "Verdocs JS SDK",
|
|
@@ -29,13 +29,14 @@
|
|
|
29
29
|
"preversion": "npm run lint",
|
|
30
30
|
"version": "npm run format && git add -A src",
|
|
31
31
|
"postversion": "git push && git push --tags",
|
|
32
|
+
"postpublish": "npm run clean",
|
|
32
33
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jestconfig.json",
|
|
33
34
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
34
35
|
"lint": "tslint -p tsconfig.json",
|
|
35
36
|
"docs-md": "typedoc --tsconfig ./tsconfig-typedoc.json",
|
|
36
37
|
"docs-html": "typedoc --tsconfig ./tsconfig-typedoc.json --plugin none --out docs-html",
|
|
37
38
|
"Xdocs-html": "typedoc --tsconfig ./tsconfig-typedoc.json --plugin ./typedoc-theme.tsx --out docs-html",
|
|
38
|
-
"docs": "
|
|
39
|
+
"docs": "npm run docs-md && npm run docs-html",
|
|
39
40
|
"clear-docs": "aws --profile=verdocs cloudfront create-invalidation --distribution-id E29UFGU4KEH1GQ --paths \"/*\"",
|
|
40
41
|
"deploy-docs": "npm run docs && aws --profile=verdocs s3 sync --acl public-read --delete docs-html s3://verdocs-developers-js-sdk/ && yarn clear-docs",
|
|
41
42
|
"clean": "rm -rf Documents HTTP Organizations Search Templates Users Utils index.js index.d.ts docs docs-html"
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"access": "public"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"axios": "^0.
|
|
48
|
+
"axios": "^0.25.0"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"typescript": "4.2.x || 4.3.x || 4.4.x || 4.5.x"
|