@verdocs/js-sdk 1.2.0 → 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 +13 -13
- package/HTTP/VerdocsEndpoint.js +12 -19
- package/Templates/Roles.d.ts +1 -1
- package/Templates/Roles.js +1 -1
- package/Templates/Templates.d.ts +6 -1
- package/Templates/Templates.js +2 -2
- package/package.json +3 -2
- 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,6 +1,7 @@
|
|
|
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.
|
|
@@ -16,26 +17,25 @@
|
|
|
16
17
|
* .setClientID('1234)
|
|
17
18
|
* .setTimeout(5000);
|
|
18
19
|
* ```
|
|
19
|
-
*
|
|
20
|
-
* @module
|
|
21
20
|
*/
|
|
22
|
-
import { AxiosInstance } from 'axios';
|
|
23
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
|
+
*/
|
|
24
28
|
api: AxiosInstance;
|
|
25
|
-
requestLoggerId
|
|
29
|
+
private requestLoggerId;
|
|
26
30
|
/**
|
|
27
|
-
* Create a new
|
|
31
|
+
* Create a new VerdocsEndpoint to call Verdocs platform services.
|
|
28
32
|
*
|
|
29
33
|
* ```typescript
|
|
30
34
|
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
31
|
-
*
|
|
32
|
-
* console.log('Current timeout', Transport.getEndpoint().defaults.timeout);
|
|
35
|
+
* const endpoint = new VerdocsEndpoint();
|
|
33
36
|
* ```
|
|
34
37
|
*/
|
|
35
|
-
constructor(
|
|
36
|
-
baseURL?: string;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
});
|
|
38
|
+
constructor();
|
|
39
39
|
/**
|
|
40
40
|
* Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
|
|
41
41
|
*
|
package/HTTP/VerdocsEndpoint.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.
|
|
@@ -16,32 +22,19 @@
|
|
|
16
22
|
* .setClientID('1234)
|
|
17
23
|
* .setTimeout(5000);
|
|
18
24
|
* ```
|
|
19
|
-
*
|
|
20
|
-
* @module
|
|
21
25
|
*/
|
|
22
|
-
import axios from 'axios';
|
|
23
|
-
var requestLogger = function (r) {
|
|
24
|
-
// tslint:disable-next-line
|
|
25
|
-
console.debug("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
|
|
26
|
-
return r;
|
|
27
|
-
};
|
|
28
26
|
var VerdocsEndpoint = /** @class */ (function () {
|
|
29
27
|
/**
|
|
30
|
-
* Create a new
|
|
28
|
+
* Create a new VerdocsEndpoint to call Verdocs platform services.
|
|
31
29
|
*
|
|
32
30
|
* ```typescript
|
|
33
31
|
* import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
|
|
34
|
-
*
|
|
35
|
-
* console.log('Current timeout', Transport.getEndpoint().defaults.timeout);
|
|
32
|
+
* const endpoint = new VerdocsEndpoint();
|
|
36
33
|
* ```
|
|
37
34
|
*/
|
|
38
|
-
function VerdocsEndpoint(
|
|
39
|
-
var _b = _a === void 0 ? {} : _a, baseURL = _b.baseURL, timeout = _b.timeout;
|
|
35
|
+
function VerdocsEndpoint() {
|
|
40
36
|
this.requestLoggerId = null;
|
|
41
|
-
this.api = axios.create({
|
|
42
|
-
baseURL: baseURL || 'https://api.verdocs.com',
|
|
43
|
-
timeout: timeout || 6000,
|
|
44
|
-
});
|
|
37
|
+
this.api = axios.create({ baseURL: 'https://api.verdocs.com', timeout: 3000 });
|
|
45
38
|
}
|
|
46
39
|
/**
|
|
47
40
|
* Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
|
package/Templates/Roles.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ITemplateField, IRole } from './Types';
|
|
2
1
|
/**
|
|
3
2
|
* A "role" is an individual participant in a signing flow, such as a signer or CC contact. Roles are identified by
|
|
4
3
|
* their names, which must be unique (e.g. 'Recipient 1'). Template fields are assigned to roles for signing operations,
|
|
@@ -6,6 +5,7 @@ import { ITemplateField, IRole } from './Types';
|
|
|
6
5
|
*
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
8
|
+
import { ITemplateField, IRole } from './Types';
|
|
9
9
|
export declare const createRole: (templateId: string, params: IRole) => Promise<IRole>;
|
|
10
10
|
export declare const getRoles: (templateId: string) => Promise<IRole[]>;
|
|
11
11
|
export declare const getRole: (templateId: string, roleName: string) => Promise<IRole>;
|
package/Templates/Roles.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getEndpoint } from '../HTTP/Transport';
|
|
2
1
|
/**
|
|
3
2
|
* A "role" is an individual participant in a signing flow, such as a signer or CC contact. Roles are identified by
|
|
4
3
|
* their names, which must be unique (e.g. 'Recipient 1'). Template fields are assigned to roles for signing operations,
|
|
@@ -6,6 +5,7 @@ import { getEndpoint } from '../HTTP/Transport';
|
|
|
6
5
|
*
|
|
7
6
|
* @module
|
|
8
7
|
*/
|
|
8
|
+
import { getEndpoint } from '../HTTP/Transport';
|
|
9
9
|
export var createRole = function (templateId, params) {
|
|
10
10
|
return getEndpoint()
|
|
11
11
|
.api.post("/templates/".concat(templateId, "/roles/"), params)
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdocs/js-sdk",
|
|
3
|
-
"version": "1.2.
|
|
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"
|