@verdocs/js-sdk 1.2.0 → 1.3.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.
@@ -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
@@ -4,4 +4,4 @@ export interface IUpdateRecipientParams {
4
4
  new_full_name?: string;
5
5
  agreed?: boolean;
6
6
  }
7
- export declare const updateRecipientStatus: (documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams | undefined) => Promise<IRecipient>;
7
+ export declare const updateRecipientStatus: (documentId: string, roleName: string, action: TRecipientAction, params?: IUpdateRecipientParams) => Promise<IRecipient>;
package/HTTP/Transport.js CHANGED
@@ -5,13 +5,13 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import globalThis from './globalThis';
9
8
  import { VerdocsEndpoint } from './VerdocsEndpoint';
9
+ import globalThis from './globalThis';
10
10
  // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
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({ baseURL: 'https://api.verdocs.com/' });
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
- * A VerdocsEndpoint is a specific connection and authorization session for calling the Verdocs APIs. Where the global
3
- * Transport is generally used to simpliy standard-user operations, Endpoints can be used for isolated session tasks.
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: number | null;
29
+ private requestLoggerId;
26
30
  /**
27
- * Create a new Endpoint to call Verdocs services.
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({ baseURL, timeout }?: {
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
  *
@@ -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
- * A VerdocsEndpoint is a specific connection and authorization session for calling the Verdocs APIs. Where the global
3
- * Transport is generally used to simpliy standard-user operations, Endpoints can be used for isolated session tasks.
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 Endpoint to call Verdocs services.
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(_a) {
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.
@@ -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>;
@@ -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)
@@ -1,5 +1,10 @@
1
1
  import { ITemplate, ITemplatesSearchResult, ITemplatesSummary } from './Types';
2
- export declare const getTemplates: () => Promise<any[]>;
2
+ export interface IGetTemplatesParams {
3
+ is_starred?: boolean;
4
+ is_creator?: boolean;
5
+ is_organization?: boolean;
6
+ }
7
+ export declare const getTemplates: (params?: IGetTemplatesParams) => 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>;
@@ -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.0",
3
+ "version": "1.3.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": "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
+ "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,21 +45,22 @@
44
45
  "access": "public"
45
46
  },
46
47
  "dependencies": {
47
- "axios": "^0.25.0"
48
+ "axios": "^0.27.2"
48
49
  },
49
50
  "peerDependencies": {
50
- "typescript": "4.2.x || 4.3.x || 4.4.x || 4.5.x"
51
+ "typescript": "^4.7.3"
51
52
  },
52
53
  "devDependencies": {
53
- "@types/jest": "^27.0.2",
54
- "jest": "^27.3.1",
55
- "jest-mock-axios": "^4.4.1",
56
- "prettier": "^2.5.1",
57
- "ts-jest": "^27.0.7",
54
+ "@jest/globals": "^28.1.2",
55
+ "@types/jest": "^28.1.4",
56
+ "axios-mock-adapter": "^1.21.1",
57
+ "jest": "^28.1.2",
58
+ "prettier": "^2.7.1",
59
+ "ts-jest": "^28.0.5",
58
60
  "tslint": "^6.1.3",
59
61
  "tslint-config-prettier": "^1.18.0",
60
- "typedoc": "^0.22.10",
61
- "typedoc-plugin-markdown": "^3.11.9",
62
- "typescript": "^4.5.4"
62
+ "typedoc": "^0.23.5",
63
+ "typedoc-plugin-markdown": "^3.13.3",
64
+ "typescript": "^4.7.4"
63
65
  }
64
66
  }
@@ -20,6 +20,7 @@
20
20
  "out": "docs",
21
21
  "includeVersion": true,
22
22
  "gitRevision": "main",
23
- "hideGenerator": true
23
+ "hideGenerator": true,
24
+ "excludePrivate": true
24
25
  }
25
26
  }