@pageproof/sdk-pr 442.0.1665019955978 → 443.0.1652837272571
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/CHANGELOG.md +0 -42
- package/README.md +68 -60
- package/lib/api/Proofs.d.ts +21 -29
- package/lib/api/Proofs.js +1 -1
- package/lib/api/ProofsGroups.d.ts +1 -2
- package/lib/api/ProofsGroups.js +1 -1
- package/lib/api/admin/TeamFeatures.d.ts +0 -4
- package/lib/api/admin/TeamFeatures.js +1 -7
- package/lib/core/PageProof.d.ts +0 -35
- package/lib/core/PageProof.js +1 -1
- package/lib/models/File.d.ts +0 -6
- package/lib/models/File.js +1 -1
- package/lib/models/Proof.d.ts +2 -15
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofGroup.d.ts +0 -10
- package/lib/models/ProofGroup.js +1 -1
- package/lib/models/TeamProofFeatures.d.ts +0 -12
- package/lib/models/TeamProofFeatures.js +1 -1
- package/lib/models/User.d.ts +0 -6
- package/lib/models/User.js +1 -1
- package/lib/network/endpoints.json +2 -9
- package/lib/pageproof.js +1 -1
- package/lib/util/Scheduler.js +1 -1
- package/lib/worker-crypto-adapter.js +1 -1
- package/package.json +1 -1
- package/lib/adapters/WorkerThreadsCryptoAdapter.d.ts +0 -17
- package/lib/adapters/WorkerThreadsCryptoAdapter.js +0 -1
- package/lib/api/ChecklistTemplates.d.ts +0 -86
- package/lib/api/ChecklistTemplates.js +0 -1
- package/lib/api/ChecklistTemplatesEntities.d.ts +0 -30
- package/lib/api/ChecklistTemplatesEntities.js +0 -1
- package/lib/models/ProofChecklist.d.ts +0 -45
- package/lib/models/ProofChecklist.js +0 -1
- package/lib/util/AggregateError.d.ts +0 -2
- package/lib/util/AggregateError.js +0 -1
- package/lib/util/GraphQLError.d.ts +0 -6
- package/lib/util/GraphQLError.js +0 -1
- package/lib/util/gql.d.ts +0 -2
- package/lib/util/gql.js +0 -1
- package/lib/worker/WorkerThreadsWorker.d.ts +0 -1
- package/lib/worker/WorkerThreadsWorker.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,47 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.0.0-beta.299
|
|
4
|
-
|
|
5
|
-
Released on the 14th of September 2022.
|
|
6
|
-
|
|
7
|
-
- [[PP-2541](https://goto.pageproof.dev/PP-2541)] Added support for setting whether checklist templates are available. See [TeamProofFeatures.enableChecklists](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamProofFeatures.js~TeamProofFeatures.html#instance-member-enableChecklists) and [TeamFeatures.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-method-update).
|
|
8
|
-
|
|
9
|
-
## 2.0.0-beta.298
|
|
10
|
-
|
|
11
|
-
Released on the 25th of August 2022.
|
|
12
|
-
|
|
13
|
-
- [[PP-3723](https://goto.pageproof.dev/PP-3723)] Added a new crypto adapter for Node.js that makes use of `worker_threads`. See [WorkerThreadsCryptoAdapter](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/adapters/WorkerThreadsCryptoAdapter.js~WorkerThreadsCryptoAdapter.html).
|
|
14
|
-
|
|
15
|
-
## 2.0.0-beta.297
|
|
16
|
-
|
|
17
|
-
Released on the 17th of August 2022.
|
|
18
|
-
|
|
19
|
-
- [[PP-2627](https://goto.pageproof.dev/PP-2627)] Added support for `Approved with changes` decision. See [TeamProofFeatures.allowedDecisions](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamProofFeatures.js~TeamProofFeatures.html#instance-member-allowedDecisions) and [TeamFeatures.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-method-update).
|
|
20
|
-
|
|
21
|
-
## 2.0.0-beta.296
|
|
22
|
-
|
|
23
|
-
Released on the 16th of August 2022.
|
|
24
|
-
|
|
25
|
-
- [[PP-3583](https://goto.pageproof.dev/PP-3583)] Added support for managing checklists templates.
|
|
26
|
-
|
|
27
|
-
## 2.0.0-beta.295
|
|
28
|
-
|
|
29
|
-
Released on the 5th of August 2022.
|
|
30
|
-
|
|
31
|
-
- [[PP-2345](https://goto.pageproof.dev/PP-2345)] Added support for creating proofs with checklists.
|
|
32
|
-
|
|
33
|
-
## 2.0.0-beta.294
|
|
34
|
-
|
|
35
|
-
Released on the 26th of July 2022.
|
|
36
|
-
|
|
37
|
-
- [[PP-3452](https://goto.pageproof.dev/PP-3452)] Added support for accessing a file's import URL. See [File.importUrl](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/File.js~File.html#instance-member-importUrl).
|
|
38
|
-
|
|
39
|
-
## 2.0.0-beta.293
|
|
40
|
-
|
|
41
|
-
Released on the 31st of May 2022.
|
|
42
|
-
|
|
43
|
-
- [[PP-2820](https://goto.pageproof.dev/PP-2820)] Added support for collection folders. See [ProofsGroups.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-update) and [ProofGroup.folder](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/ProofGroup.js~ProofGroup.html#instance-member-folder).
|
|
44
|
-
|
|
45
3
|
## 2.0.0-beta.292
|
|
46
4
|
|
|
47
5
|
Released on the 9th of May 2022.
|
package/README.md
CHANGED
|
@@ -66,14 +66,14 @@ import XHRRequestAdapter from '@pageproof/sdk/lib/xhr-request-adapter';
|
|
|
66
66
|
// ...
|
|
67
67
|
|
|
68
68
|
new XHRRequestAdapter({
|
|
69
|
-
endpoint: 'https://api.pageproof.com',
|
|
70
69
|
applicationId: '3uQkbQXsinffvnNHPlplx4Uw1sVeWEab',
|
|
70
|
+
endpoint: 'https://managed-api.pageproof.com',
|
|
71
71
|
key: '104882dfa7c44330811612ea100dc7e6',
|
|
72
72
|
});
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
As you can see, the adapter takes an `endpoint` and a `key`. For 3rd party developers & integrating PageProof into your
|
|
76
|
-
own application, the endpoint is `https://api.pageproof.com`, and the key is your application's subscription
|
|
76
|
+
own application, the endpoint is `https://managed-api.pageproof.com`, and the key is your application's subscription
|
|
77
77
|
key. In production, however, it's best to make your key an environment variable to make it easier to change it later.
|
|
78
78
|
|
|
79
79
|
#### Example: Low powered devices
|
|
@@ -90,13 +90,11 @@ import XHRRequestAdapter from '@pageproof/sdk/lib/xhr-request-adapter';
|
|
|
90
90
|
import WorkerCryptoAdapter from '@pageproof/sdk/lib/worker-crypto-adapter';
|
|
91
91
|
|
|
92
92
|
const client = new PageProof({
|
|
93
|
-
options: {
|
|
94
|
-
endpoint: 'https://api.pageproof.com',
|
|
95
|
-
applicationId: '3uQkbQXsinffvnNHPlplx4Uw1sVeWEab',
|
|
96
|
-
subscriptionKey: '104882dfa7c44330811612ea100dc7e6',
|
|
97
|
-
},
|
|
98
93
|
adapters: [
|
|
99
|
-
new XHRRequestAdapter(
|
|
94
|
+
new XHRRequestAdapter({
|
|
95
|
+
endpoint: 'https://managed-api.pageproof.com',
|
|
96
|
+
key: '104882dfa7c44330811612ea100dc7e6',
|
|
97
|
+
}),
|
|
100
98
|
new WorkerCryptoAdapter({
|
|
101
99
|
url: 'https://example.com/dist/pageproof/sdk/lib',
|
|
102
100
|
limit: 1,
|
|
@@ -130,13 +128,12 @@ import XHRRequestAdapter from '@pageproof/sdk/lib/xhr-request-adapter';
|
|
|
130
128
|
import WorkerCryptoAdapter from '@pageproof/sdk/lib/worker-crypto-adapter';
|
|
131
129
|
|
|
132
130
|
const client = new PageProof({
|
|
133
|
-
options: {
|
|
134
|
-
endpoint: 'https://api.pageproof.com',
|
|
135
|
-
applicationId: '3uQkbQXsinffvnNHPlplx4Uw1sVeWEab',
|
|
136
|
-
subscriptionKey: '104882dfa7c44330811612ea100dc7e6',
|
|
137
|
-
},
|
|
138
131
|
adapters: [
|
|
139
|
-
new XHRRequestAdapter(
|
|
132
|
+
new XHRRequestAdapter({
|
|
133
|
+
applicationId: '3uQkbQXsinffvnNHPlplx4Uw1sVeWEab',
|
|
134
|
+
endpoint: 'https://managed-api.pageproof.com',
|
|
135
|
+
key: '104882dfa7c44330811612ea100dc7e6',
|
|
136
|
+
}),
|
|
140
137
|
new WorkerCryptoAdapter({
|
|
141
138
|
url: 'https://example.com/dist/@pageproof/sdk/lib',
|
|
142
139
|
limit: navigator.hardwareConcurrency || 2,
|
|
@@ -259,22 +256,21 @@ request, but if we get enough demand for your JavaScript environment, it will be
|
|
|
259
256
|
|
|
260
257
|
We have a number of adapters, some intended for use within browsers, and some for Node.js.
|
|
261
258
|
|
|
262
|
-
Name |
|
|
259
|
+
Name | Filename | Supported Environment | Supported
|
|
263
260
|
--- | --- | --- | ---
|
|
264
|
-
[
|
|
265
|
-
[NodeRequestAdapter](./class/src/adapters/NodeRequestAdapter.js~NodeRequestAdapter.html) |
|
|
266
|
-
[SyncCryptoAdapter](./class/src/adapters/SyncCryptoAdapter.js~SyncCryptoAdapter.html) |
|
|
267
|
-
[WorkerCryptoAdapter](./class/src/adapters/WorkerCryptoAdapter.js~WorkerCryptoAdapter.html) |
|
|
268
|
-
[XHRRequestAdapter](./class/src/adapters/XHRRequestAdapter.js~XHRRequestAdapter.html) |
|
|
269
|
-
[IndexedDBCacheAdapter](./class/src/adapters/IndexedDBCacheAdapter.js~IndexedDBCacheAdapter.html) |
|
|
270
|
-
[AngularEnhancementAdapter](./class/src/adapters/AngularEnhancementAdapter.js~AngularEnhancementAdapter.html) |
|
|
271
|
-
[ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) |
|
|
272
|
-
[ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) |
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
_\*\* The `ClusterCryptoAdapter` is not recommended. If you're already using the `ClusterCryptoAdapter`, we suggest swapping it out for `WorkerThreadsCryptoAdapter` as it uses less CPU, memory, and is 4x faster (on average) than `ClusterCryptoAdapter`. While it's still something we plan on supporting, it's not something we suggest using in new applications._
|
|
261
|
+
[ClusterCryptoAdapter](./class/src/adapters/ClusterCryptoAdapter.js~ClusterCryptoAdapter.html) | `@pageproof/sdk/lib/adapters/ClusterCryptoAdapter.js` | Node.js | Yes
|
|
262
|
+
[NodeRequestAdapter](./class/src/adapters/NodeRequestAdapter.js~NodeRequestAdapter.html) | `@pageproof/sdk/lib/adapters/NodeRequestAdapter.js` | Node.js | Yes
|
|
263
|
+
[SyncCryptoAdapter](./class/src/adapters/SyncCryptoAdapter.js~SyncCryptoAdapter.html) | `@pageproof/sdk/lib/adapters/SyncCryptoAdapter.js` | Any | No
|
|
264
|
+
[WorkerCryptoAdapter](./class/src/adapters/WorkerCryptoAdapter.js~WorkerCryptoAdapter.html) | `@pageproof/sdk/lib/worker-crypto-adapter.js` | Browser | Yes
|
|
265
|
+
[XHRRequestAdapter](./class/src/adapters/XHRRequestAdapter.js~XHRRequestAdapter.html) | `@pageproof/sdk/lib/xhr-request-adapter.js` | Browser | Yes
|
|
266
|
+
[IndexedDBCacheAdapter](./class/src/adapters/IndexedDBCacheAdapter.js~IndexedDBCacheAdapter.html) | `@pageproof/sdk/lib/indexeddb-cache-adapter.js` | Browser | Yes
|
|
267
|
+
[AngularEnhancementAdapter](./class/src/adapters/AngularEnhancementAdapter.js~AngularEnhancementAdapter.html) | `@pageproof/sdk/lib/angular-enhancement-adapter.js` | Browser | No (Experimental)
|
|
268
|
+
[ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) | `@pageproof/sdk/lib/protobuf-adapter.js` | Browser | No (Experimental)
|
|
269
|
+
[ProtobufAdapter](./class/src/adapters/ProtobufAdapter.js~ProtobufAdapter.html) | `@pageproof/sdk/lib/adapters/ProtobufAdapter.js` | Node.js | No (Experimental)
|
|
270
|
+
|
|
271
|
+
The `SyncCryptoAdapter` is the only one we do not support, as it is a blocking adapter. You should *not* use this in
|
|
272
|
+
production - it's only intended to be used within custom adapters you may write for a specific (officially unsupported)
|
|
273
|
+
JavaScript environment.
|
|
278
274
|
|
|
279
275
|
Also note, the browser adapters have a slightly different filename/path, this is because these files come pre-minified,
|
|
280
276
|
with UMD support (CommonJS, ES2015+ import/export, and `<script>`).
|
|
@@ -286,41 +282,41 @@ of our APIs are compartmentalized, to make it easier to find the API you're look
|
|
|
286
282
|
|
|
287
283
|
These are the different APIs we currently support through the SDK.
|
|
288
284
|
|
|
289
|
-
Name | Namespace | Description | Admin-only
|
|
290
|
-
--- | --- | --- | ---
|
|
291
|
-
[Accounts API](./class/src/api/Accounts.js~Accounts.html) | `accounts` | Used to create accounts, activate and login. |
|
|
292
|
-
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. |
|
|
293
|
-
[Accounts MFA API](./class/src/api/AccountsMFA.js~AccountsMFA.html) | `accounts.mfa` | Used to activate, de-activate and enable user mfa login. |
|
|
294
|
-
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. |
|
|
295
|
-
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. |
|
|
296
|
-
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups |
|
|
297
|
-
[Encryption API](./class/src/api/Encryption.js~Encryption.html) | `encryption` | Used for generic crypto operations. |
|
|
298
|
-
[Files API](./class/src/api/Files.js~Files.html) | `files` | Used to upload & manage files. |
|
|
299
|
-
[Preferences API](./class/src/api/Preferences.js~Preferences.html) | `preferences` | Manage your account preferences. |
|
|
300
|
-
[Profile API](./class/src/api/Profile.js~Profile.html) | `profile` | Manage your account details. |
|
|
301
|
-
[Proofs API](./class/src/api/Proofs.js~Proofs.html) | `proofs` | Used to create & manage proofs. |
|
|
302
|
-
[Proofs Groups API](./class/src/api/ProofsGroups.js~ProofsGroups.html) | `proofs.groups` | Used to manage groups of proofs. |
|
|
303
|
-
[Proofs Owners API](./class/src/api/ProofsOwners.js~ProofsOwners.html) | `proofs.owners` | Used to add & remove owners from proofs. |
|
|
304
|
-
[Proofs Versions API](./class/src/api/ProofsVersions.js~ProofsVersions.html) | `proofs.versions` | Used to manage proof versions. |
|
|
305
|
-
[Sessions API](./class/src/api/Sessions.js~Sessions.html) | `sessions` | Used to manage account sessions. |
|
|
306
|
-
[Users API](./class/src/api/Users.js~Users.html) | `users` | Used to invite and find users in the system. |
|
|
307
|
-
[Workflows API](./class/src/api/Workflows.js~Workflows.html) | `workflows` | Used to create & manage workflows and workflow templates. |
|
|
308
|
-
[Workflows Steps API](./class/src/api/WorkflowsSteps.js~WorkflowsSteps.html) | `workflows.steps` | Used to manage workflow steps in workflow templates. |
|
|
309
|
-
[Admin Team Users API](./class/src/api/admin/TeamUsers.js~TeamUsers.html) | `admin.team.users` | Administer users in a team or enterprise account. |
|
|
310
|
-
[Admin Team Dashboard API](./class/src/api/admin/TeamDashboard.js~TeamDashboard.html) | `admin.team.dashboard` | Used to load the authenticated user's team's dashboard & search for/filter proofs. |
|
|
311
|
-
[Admin Team Features API](./class/src/api/admin/TeamFeatures.js~TeamFeatures.html) | `admin.team.features` | Administer features in a team or enterprise account. |
|
|
312
|
-
[Proofs Editors API](./class/src/api/ProofsEditors.js~ProofsEditors.html) | `proofs.editors` | Used to add & remove editors from proofs. |
|
|
313
|
-
[Proofs Groups Owners API](./class/src/api/GroupsOwners.js~GroupsOwners.html) | `proofs.groups.owners` | Used to add owners to proofs in a group. |
|
|
314
|
-
[Proofs Groups Workflows API](./class/src/api/GroupsWorkflows.js~GroupsWorkflows.html) | `proofs.groups.workflows` | Used to add reviewers to proofs in a group. |
|
|
315
|
-
[Proofs Reminders API](./class/src/api/Reminders.js~Reminders.html) | `proofs.reminders` | Manage reminders on proof. |
|
|
316
|
-
[Proofs Audit API](./class/src/api/ProofsAudit.js~ProofsAudit.html) | `proofs.audit` | View audit reports/summary/timeline. |
|
|
317
|
-
[Proofs Custom Tools API](./class/src/api/ProofsCustomTools.js~ProofsCustomTools.html) | `proofs.customTools` | Validate, update and retrieve proof custom tools. |
|
|
318
|
-
[Admin Reports API](./class/src/api/Reports.js~Reports.html) | `admin.reports` | Request reports to be emailed to you. |
|
|
285
|
+
Name | Namespace | Description | Admin-only | Stability
|
|
286
|
+
--- | --- | --- | --- | ---
|
|
287
|
+
[Accounts API](./class/src/api/Accounts.js~Accounts.html) | `accounts` | Used to create accounts, activate and login. | No | Stable
|
|
288
|
+
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. | No | Experimental
|
|
289
|
+
[Accounts MFA API](./class/src/api/AccountsMFA.js~AccountsMFA.html) | `accounts.mfa` | Used to activate, de-activate and enable user mfa login. | No | experimental
|
|
290
|
+
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. | No | Stable
|
|
291
|
+
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. | No | Stable
|
|
292
|
+
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
|
|
293
|
+
[Encryption API](./class/src/api/Encryption.js~Encryption.html) | `encryption` | Used for generic crypto operations. | No | Experimental
|
|
294
|
+
[Files API](./class/src/api/Files.js~Files.html) | `files` | Used to upload & manage files. | No | Stable
|
|
295
|
+
[Preferences API](./class/src/api/Preferences.js~Preferences.html) | `preferences` | Manage your account preferences. | No | Experimental
|
|
296
|
+
[Profile API](./class/src/api/Profile.js~Profile.html) | `profile` | Manage your account details. | No | Experimental
|
|
297
|
+
[Proofs API](./class/src/api/Proofs.js~Proofs.html) | `proofs` | Used to create & manage proofs. | No | Stable
|
|
298
|
+
[Proofs Groups API](./class/src/api/ProofsGroups.js~ProofsGroups.html) | `proofs.groups` | Used to manage groups of proofs. | No | Experimental
|
|
299
|
+
[Proofs Owners API](./class/src/api/ProofsOwners.js~ProofsOwners.html) | `proofs.owners` | Used to add & remove owners from proofs. | No | Stable
|
|
300
|
+
[Proofs Versions API](./class/src/api/ProofsVersions.js~ProofsVersions.html) | `proofs.versions` | Used to manage proof versions. | No | Stable
|
|
301
|
+
[Sessions API](./class/src/api/Sessions.js~Sessions.html) | `sessions` | Used to manage account sessions. | No | Experimental
|
|
302
|
+
[Users API](./class/src/api/Users.js~Users.html) | `users` | Used to invite and find users in the system. | No | Stable
|
|
303
|
+
[Workflows API](./class/src/api/Workflows.js~Workflows.html) | `workflows` | Used to create & manage workflows and workflow templates. | No | Stable
|
|
304
|
+
[Workflows Steps API](./class/src/api/WorkflowsSteps.js~WorkflowsSteps.html) | `workflows.steps` | Used to manage workflow steps in workflow templates. | No | Experimental
|
|
305
|
+
[Admin Team Users API](./class/src/api/admin/TeamUsers.js~TeamUsers.html) | `admin.team.users` | Administer users in a team or enterprise account. | Yes | Experimental
|
|
306
|
+
[Admin Team Dashboard API](./class/src/api/admin/TeamDashboard.js~TeamDashboard.html) | `admin.team.dashboard` | Used to load the authenticated user's team's dashboard & search for/filter proofs. | Yes | Experimental
|
|
307
|
+
[Admin Team Features API](./class/src/api/admin/TeamFeatures.js~TeamFeatures.html) | `admin.team.features` | Administer features in a team or enterprise account. | Yes | Experimental
|
|
308
|
+
[Proofs Editors API](./class/src/api/ProofsEditors.js~ProofsEditors.html) | `proofs.editors` | Used to add & remove editors from proofs. | No | Experimental
|
|
309
|
+
[Proofs Groups Owners API](./class/src/api/GroupsOwners.js~GroupsOwners.html) | `proofs.groups.owners` | Used to add owners to proofs in a group. | No | Stable
|
|
310
|
+
[Proofs Groups Workflows API](./class/src/api/GroupsWorkflows.js~GroupsWorkflows.html) | `proofs.groups.workflows` | Used to add reviewers to proofs in a group. | No | Stable
|
|
311
|
+
[Proofs Reminders API](./class/src/api/Reminders.js~Reminders.html) | `proofs.reminders` | Manage reminders on proof. | No | Experimental
|
|
312
|
+
[Proofs Audit API](./class/src/api/ProofsAudit.js~ProofsAudit.html) | `proofs.audit` | View audit reports/summary/timeline. | No | Experimental
|
|
313
|
+
[Proofs Custom Tools API](./class/src/api/ProofsCustomTools.js~ProofsCustomTools.html) | `proofs.customTools` | Validate, update and retrieve proof custom tools. | No | Stable
|
|
314
|
+
[Admin Reports API](./class/src/api/Reports.js~Reports.html) | `admin.reports` | Request reports to be emailed to you. | Yes | Stable
|
|
319
315
|
|
|
320
316
|
The "admin-only" APIs are exposed through the
|
|
321
317
|
[PageProof.admin](./class/src/core/PageProof.js~PageProof.html#instance-method-admin) method. These APIs are different
|
|
322
318
|
because the SDK only allows access to this subset of APIs if the current user is an administrator of a team/enterprise
|
|
323
|
-
account.
|
|
319
|
+
account. Currently, all admin-only APIs are experimental.
|
|
324
320
|
|
|
325
321
|
To explain what the "namespace" is used for, take this example. You would like to find a user in PageProof with a
|
|
326
322
|
particular email. That would mean using the "Users API", which has a namespace of `users`. So that would look like this;
|
|
@@ -382,3 +378,15 @@ refreshes, we need to remind the client what the current session is.
|
|
|
382
378
|
Sharing the private keys with anybody, directly or even indirectly (over unencrypted traffic, for example), gives
|
|
383
379
|
anybody the ability to access & decrypt all proofs you have access to, including those you have been invited to.
|
|
384
380
|
|
|
381
|
+
### SDK development
|
|
382
|
+
Local development:
|
|
383
|
+
1. Node version <= 6
|
|
384
|
+
```sh
|
|
385
|
+
$ npm install
|
|
386
|
+
$ npm run dev
|
|
387
|
+
```
|
|
388
|
+
2. To test the SDK locally: switch to node version >=12, then
|
|
389
|
+
```sh
|
|
390
|
+
$ cd examples
|
|
391
|
+
$ node ./basic-node/index.js
|
|
392
|
+
```
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -177,33 +177,30 @@ declare class Proofs extends API {
|
|
|
177
177
|
*
|
|
178
178
|
* @see {@link Proofs.start}
|
|
179
179
|
*
|
|
180
|
-
* @param {{ name: string, tags?: string[], dueDate?: Date | string, messageToReviewers?: string, workflow?: { id: string }, workflowTemplate?: { id: string },
|
|
180
|
+
* @param {{ name: string, tags?: string[], dueDate?: Date | string, messageToReviewers?: string, workflow?: { id: string }, workflowTemplate?: { id: string }, file?: { id: string }, group?: { id: string }, previousProof?: { id: string }, team?: { slug: string }, reference?: string, customTools?: any, integrationReferences: any[], reminders?: Reminder[], owners?: { email?: string, id?: string }[], emailSender?: { email?: string, id?: string }, canDownload?: boolean, isPublic?: boolean, start?: boolean }} options The options
|
|
181
181
|
*
|
|
182
182
|
* @param options.name The name of the proof
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @param
|
|
188
|
-
* @param
|
|
189
|
-
* @param
|
|
190
|
-
* @param
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
194
|
-
* @param
|
|
195
|
-
* @param
|
|
196
|
-
* @param
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @param
|
|
200
|
-
* @param
|
|
201
|
-
* @param [options.canDownload] Whether the file attached to the proof can be download
|
|
202
|
-
* @param [options.isPublic] Whether the proof is publicly accessible
|
|
203
|
-
* @param [options.start] Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
|
|
183
|
+
* @param options.tags The tags to add to the proof (defaults to no tags)
|
|
184
|
+
* @param options.dueDate The due date of the proof (defaults to 3 days in the future)
|
|
185
|
+
* @param options.messageToReviewers The message to reviewers
|
|
186
|
+
* @param options.workflow.id The workflow id to assign to the proof
|
|
187
|
+
* @param options.workflowTemplate.id The workflow template id to duplicate and assign to the proof
|
|
188
|
+
* @param options.file.id The file id to assign to the proof
|
|
189
|
+
* @param options.group.id The proof group id to add the proof to
|
|
190
|
+
* @param options.previousProof.id The proof id of the previous proof to attach this new version to
|
|
191
|
+
* @param options.team.slug The team slug (user-friendly identifier)
|
|
192
|
+
* @param options.reference The proof reference to add the proof to (to integration with other applications)
|
|
193
|
+
* @param options.customTools Any custom tools to expose on the proofing screen
|
|
194
|
+
* @param options.integrationReferences The integration references to attach to the proof
|
|
195
|
+
* @param options.reminders The proof reminders to add the proof to (to nudge users)
|
|
196
|
+
* @param options.owners The users to assign as owners for the proof (if omitted and a new version, the previous version's owners are inherited, otherwise, the user creating the proof is assigned as the only owner)
|
|
197
|
+
* @param options.emailSender The user to assign as the email sender for the proof invitations and reminders
|
|
198
|
+
* @param options.canDownload Whether the file attached to the proof can be download
|
|
199
|
+
* @param options.isPublic Whether the proof is publicly accessible
|
|
200
|
+
* @param options.start Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
|
|
204
201
|
* @returns {Promise<Proof>}
|
|
205
202
|
*/
|
|
206
|
-
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate,
|
|
203
|
+
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, emailSender, canDownload, isPublic, start, }: {
|
|
207
204
|
name: string;
|
|
208
205
|
tags?: string[];
|
|
209
206
|
dueDate?: string | Date;
|
|
@@ -214,11 +211,6 @@ declare class Proofs extends API {
|
|
|
214
211
|
workflowTemplate?: {
|
|
215
212
|
id: string;
|
|
216
213
|
};
|
|
217
|
-
checklist?: {
|
|
218
|
-
templateId?: string;
|
|
219
|
-
isRequiredForFinalApproval?: boolean;
|
|
220
|
-
shouldOpenOnProofLoad?: boolean;
|
|
221
|
-
};
|
|
222
214
|
file?: {
|
|
223
215
|
id: string;
|
|
224
216
|
};
|
|
@@ -233,7 +225,7 @@ declare class Proofs extends API {
|
|
|
233
225
|
};
|
|
234
226
|
reference?: string;
|
|
235
227
|
customTools?: any;
|
|
236
|
-
integrationReferences
|
|
228
|
+
integrationReferences: any[];
|
|
237
229
|
reminders?: any[];
|
|
238
230
|
owners?: {
|
|
239
231
|
email?: string;
|
package/lib/api/Proofs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,checklist=_ref.checklist,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,emailSender=_ref.emailSender,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,emailSender:emailSender,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),url=_videoCredentials$spl[0],bearerToken=_videoCredentials$spl[1];var manifestUrl=url.replace("http://","https://");manifestUrl+="/manifest";return{manifestUrl:manifestUrl,bearerToken:bearerToken}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,checklist=_concat$.checklist,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,emailSender=_concat$.emailSender,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,emailSender:emailSender,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
1
|
+
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,emailSender=_ref.emailSender,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,emailSender:emailSender,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),url=_videoCredentials$spl[0],bearerToken=_videoCredentials$spl[1];var manifestUrl=url.replace("http://","https://");manifestUrl+="/manifest";return{manifestUrl:manifestUrl,bearerToken:bearerToken}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,emailSender=_concat$.emailSender,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,emailSender:emailSender,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
@@ -49,10 +49,9 @@ declare class ProofsGroups extends API {
|
|
|
49
49
|
* @param {object} [option]
|
|
50
50
|
* @param {string} [options.name] The name of the group to update
|
|
51
51
|
* @param {string} [options.isOwnedByTeam] If group can be shared with team
|
|
52
|
-
* @param {{name: string}} [options.folder] The folder the group belongs to
|
|
53
52
|
* @returns {Promise<ProofGroup>}
|
|
54
53
|
*/
|
|
55
|
-
update(groupId: string, { name, isOwnedByTeam,
|
|
54
|
+
update(groupId: string, { name, isOwnedByTeam, }?: any): Promise<ProofGroup>;
|
|
56
55
|
/**
|
|
57
56
|
* Removes a proof from a group.
|
|
58
57
|
*
|
package/lib/api/ProofsGroups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name,isOwnedByTeam=_ref.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name,isOwnedByTeam=_ref2.isOwnedByTeam
|
|
1
|
+
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name,isOwnedByTeam=_ref.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name,isOwnedByTeam=_ref2.isOwnedByTeam;return this.client.request("proofs.groups.update",{groupId:groupId,name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.removeProof=function removeProof(proofId){return this.client.request("proofs.groups.remove-proof",{proofId:proofId})};ProofsGroups.prototype.addProof=function addProof(groupId,proofId){return this.client.request("proofs.groups.add-proof",{groupId:groupId,proofId:proofId})};ProofsGroups.prototype.delete=function _delete(groupId){return this.client.request("proofs.groups.delete",{groupId:groupId})};ProofsGroups.prototype.archive=function archive(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}if(args.every(function(arg){return typeof arg==="string"})){return this.client.request("proofs.groups.archive",{groupIds:args})}else{var defaultOptions={archiveProofs:false};var groupIdOrGroupIds=args[0],_args$=args[1],options=_args$===undefined?defaultOptions:_args$;var groupIds=[].concat(groupIdOrGroupIds);return this.client.request("proofs.groups.archive",_extends({groupIds:groupIds},options))}};ProofsGroups.prototype.reopen=function reopen(){for(var _len2=arguments.length,groupIds=Array(_len2),_key2=0;_key2<_len2;_key2++){groupIds[_key2]=arguments[_key2]}return this.client.request("proofs.groups.reopen",{groupIds:groupIds})};return ProofsGroups}(_API3.default);exports.default=ProofsGroups;
|
|
@@ -37,8 +37,6 @@ declare class TeamFeatures extends API {
|
|
|
37
37
|
* @param {boolean} options.proofs.publicProofs Whether the public proofs feature is enabled.
|
|
38
38
|
* @param {boolean} options.proofs.defaultIsPublic The default value for whether a proof is public on the proof setup page.
|
|
39
39
|
* @param {boolean} options.proofs.messageToOwners Whether reviewers can send a message to the proof owners.
|
|
40
|
-
* @param {Array<Decision>} options.proofs.allowedDecisions The array of proof decisions that allowed to the reviewer.
|
|
41
|
-
* @param {boolean} options.proofs.enableChecklists Whether the checklists feature is enabled.
|
|
42
40
|
* @returns {Promise}
|
|
43
41
|
*/
|
|
44
42
|
update({ emails, comments, proofs, }: {
|
|
@@ -60,8 +58,6 @@ declare class TeamFeatures extends API {
|
|
|
60
58
|
publicProofs: boolean;
|
|
61
59
|
defaultIsPublic: boolean;
|
|
62
60
|
messageToOwners: boolean;
|
|
63
|
-
allowedDecisions: Decision[];
|
|
64
|
-
enableChecklists: boolean;
|
|
65
61
|
};
|
|
66
62
|
}): Promise<any>;
|
|
67
63
|
/**
|
|
@@ -75,8 +75,6 @@ var TeamFeatures = function (_API) {
|
|
|
75
75
|
* @param {boolean} options.proofs.publicProofs Whether the public proofs feature is enabled.
|
|
76
76
|
* @param {boolean} options.proofs.defaultIsPublic The default value for whether a proof is public on the proof setup page.
|
|
77
77
|
* @param {boolean} options.proofs.messageToOwners Whether reviewers can send a message to the proof owners.
|
|
78
|
-
* @param {Array<Decision>} options.proofs.allowedDecisions The array of proof decisions that allowed to the reviewer.
|
|
79
|
-
* @param {boolean} options.proofs.enableChecklists Whether the checklists feature is enabled.
|
|
80
78
|
* @returns {Promise}
|
|
81
79
|
*/
|
|
82
80
|
|
|
@@ -99,8 +97,6 @@ var TeamFeatures = function (_API) {
|
|
|
99
97
|
var publicProofs = proofs && proofs.publicProofs;
|
|
100
98
|
var defaultProofIsPublic = proofs && proofs.defaultIsPublic;
|
|
101
99
|
var messageToOwners = proofs && proofs.messageToOwners;
|
|
102
|
-
var allowedDecisions = proofs && proofs.allowedDecisions;
|
|
103
|
-
var enableChecklists = proofs && proofs.enableChecklists;
|
|
104
100
|
return this.client.request('admin.team.features.update', {
|
|
105
101
|
displayComments: displayComments,
|
|
106
102
|
displayTeamName: displayTeamName,
|
|
@@ -114,9 +110,7 @@ var TeamFeatures = function (_API) {
|
|
|
114
110
|
proofReference: proofReference,
|
|
115
111
|
publicProofs: publicProofs,
|
|
116
112
|
defaultProofIsPublic: defaultProofIsPublic,
|
|
117
|
-
messageToOwners: messageToOwners
|
|
118
|
-
allowedDecisions: allowedDecisions,
|
|
119
|
-
enableChecklists: enableChecklists
|
|
113
|
+
messageToOwners: messageToOwners
|
|
120
114
|
});
|
|
121
115
|
};
|
|
122
116
|
|
package/lib/core/PageProof.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ declare class PageProof {
|
|
|
8
8
|
events: any;
|
|
9
9
|
/** @private */
|
|
10
10
|
options: any;
|
|
11
|
-
/** @private */
|
|
12
|
-
clientId: any;
|
|
13
11
|
/**
|
|
14
12
|
* The repository of registered adapters.
|
|
15
13
|
*
|
|
@@ -133,12 +131,6 @@ declare class PageProof {
|
|
|
133
131
|
* @type {FreeTrial}
|
|
134
132
|
*/
|
|
135
133
|
freeTrial: FreeTrial;
|
|
136
|
-
/**
|
|
137
|
-
* The Checklist Templates API.
|
|
138
|
-
*
|
|
139
|
-
* @type {ChecklistTemplates}
|
|
140
|
-
*/
|
|
141
|
-
checklistTemplates: ChecklistTemplates;
|
|
142
134
|
/**
|
|
143
135
|
* The current session.
|
|
144
136
|
*
|
|
@@ -225,32 +217,6 @@ declare class PageProof {
|
|
|
225
217
|
* @returns {Promise<Response>}
|
|
226
218
|
*/
|
|
227
219
|
request(name: string, params: any, options: any): Promise<Response>;
|
|
228
|
-
/**
|
|
229
|
-
* Executes an arbitrary GraphQL operation.
|
|
230
|
-
*
|
|
231
|
-
* @private
|
|
232
|
-
* @param {string} document The GraphQL document.
|
|
233
|
-
* @param {object} [variables] The values of any variables references within the GraphQL document.
|
|
234
|
-
* @param {object} [options] Additional options.
|
|
235
|
-
* @param {boolean} [options.throwOnError=true] Whether to throw an AggregateError if the operation fails.
|
|
236
|
-
* @param {boolean} [options.minifyDocument=true] Whether to minify the GraphQL document.
|
|
237
|
-
* @returns {Promise<{ data?: any; errors?: { message: string; locations?: { line: number; column: number }[]; path?: string[]; extensions?: any }[] }>}
|
|
238
|
-
*/
|
|
239
|
-
graphql(document: string, variables?: any, options?: {
|
|
240
|
-
throwOnError?: boolean;
|
|
241
|
-
minifyDocument?: boolean;
|
|
242
|
-
}): Promise<{
|
|
243
|
-
data?: any;
|
|
244
|
-
errors?: {
|
|
245
|
-
message: string;
|
|
246
|
-
locations?: {
|
|
247
|
-
line: number;
|
|
248
|
-
column: number;
|
|
249
|
-
}[];
|
|
250
|
-
path?: string[];
|
|
251
|
-
extensions?: any;
|
|
252
|
-
}[];
|
|
253
|
-
}>;
|
|
254
220
|
/**
|
|
255
221
|
* Returns the Admin API (experimental).
|
|
256
222
|
*
|
|
@@ -359,7 +325,6 @@ import Reports from "../api/Reports";
|
|
|
359
325
|
import Teams from "../api/Teams";
|
|
360
326
|
import Printing from "../api/Printing";
|
|
361
327
|
import FreeTrial from "../api/FreeTrial";
|
|
362
|
-
import ChecklistTemplates from "../api/ChecklistTemplates";
|
|
363
328
|
import Session from "../models/Session";
|
|
364
329
|
import Admin from "../api/admin/Admin";
|
|
365
330
|
import Response from "../network/Response";
|
package/lib/core/PageProof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Encryption=require("../api/Encryption");var _Encryption2=_interopRequireDefault(_Encryption);var _Live=require("../api/Live");var _Live2=_interopRequireDefault(_Live);var _Brian=require("../api/brian/Brian");var _Brian2=_interopRequireDefault(_Brian);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _constants=require("../util/constants");var _getTimezone=require("../util/getTimezone");var _getTimezone2=_interopRequireDefault(_getTimezone);var _AggregateError=require("../util/AggregateError");var _GraphQLError=require("../util/GraphQLError");var _Reports=require("../api/Reports");var _Reports2=_interopRequireDefault(_Reports);var _Teams=require("../api/Teams");var _Teams2=_interopRequireDefault(_Teams);var _Printing=require("../api/Printing");var _Printing2=_interopRequireDefault(_Printing);var _FreeTrial=require("../api/FreeTrial");var _FreeTrial2=_interopRequireDefault(_FreeTrial);var _KeyPairs=require("./KeyPairs");var _KeyPairs2=_interopRequireDefault(_KeyPairs);var _ChecklistTemplates=require("../api/ChecklistTemplates");var _ChecklistTemplates2=_interopRequireDefault(_ChecklistTemplates);var _version=require("../util/version");var _version2=_interopRequireDefault(_version);var _uuid=require("../util/uuid");var _uuid2=_interopRequireDefault(_uuid);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$options=_ref.options,options=_ref$options===undefined?{}:_ref$options,_ref$adapters=_ref.adapters,adapters=_ref$adapters===undefined?[]:_ref$adapters;_classCallCheck(this,PageProof);this.options=options;this.clientId=options.clientId||(0,_uuid2.default)();this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(adapters);this.cache=new _Cache2.default(this);this.keyPairs=new _KeyPairs2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.preferences=new _Preferences2.default(this);this.sessions=new _Sessions2.default(this);this.encryption=new _Encryption2.default(this);this.live=new _Live2.default(this);this.reports=new _Reports2.default(this);this.teams=new _Teams2.default(this);this.printing=new _Printing2.default(this);this.freeTrial=new _FreeTrial2.default(this);this.checklistTemplates=new _ChecklistTemplates2.default(this);this.__admin=new _Admin2.default(this);this._hijackAdmin();this._init();this._registerCoreHooks();this._enhance()}PageProof.prototype._init=function _init(){var requestAdapter=this.adapters.getRequestAdapter();if(!this.options.endpoint){this.options.endpoint=requestAdapter.options.endpoint}if(!this.options.applicationId){this.options.applicationId=requestAdapter.options.applicationId}if(!this.options.subscriptionKey){this.options.subscriptionKey=requestAdapter.options.key||this.options.key}if(this.options.subscriptionKey&&!this.options.applicationId){throw new Error("You must provide an applicationId.")}};PageProof.prototype._hijackAdmin=function _hijackAdmin(){var _this=this;var adminKeys=Object.getOwnPropertyNames(this.__admin);adminKeys.forEach(function(adminKey){return _this.admin[adminKey]=_this.__admin[adminKey]})};PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this2=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this2)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.rawRequest=function rawRequest(_ref2,options){var method=_ref2.method,url=_ref2.url,host=_ref2.host,path=_ref2.path,query=_ref2.query,body=_ref2.body,headers=_ref2.headers;var adapter=this.adapters.getRequestAdapter();if(url){host=url.origin;path=url.pathname;query=url.search}return adapter.send({host:host,method:method,path:path,query:query,body:body,headers:headers,credentials:false},options)};PageProof.prototype.getRequestLocalEncodedMetadata=function getRequestLocalEncodedMetadata(){return[(0,_getTimezone2.default)()].map(function(value){return value!==null&&value!==undefined?encodeURIComponent(value):"#"}).join(":")};PageProof.prototype.request=function request(name,params,options){var _this3=this;var request=new _Request2.default(this.options.endpoint,name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}if(this.options.applicationId){request.addHeader(_constants.DEVICE_ID_HEADER,this.options.applicationId)}if(this.options.subscriptionKey){request.addHeader(_constants.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey)}if(name==="graphql"){request.addHeader("apollographql-client-name",this.options.applicationId?this.options.applicationId+" (via @pageproof/sdk)":"@pageproof/sdk");request.addHeader("apollographql-client-version",_version2.default);if(this.clientId){request.addHeader("spider-client-id",this.clientId)}}var localEncodedMetadata=this.getRequestLocalEncodedMetadata();if(localEncodedMetadata){request.addHeader(_constants.LOCAL_ENCODED_METADATA_HEADER,localEncodedMetadata)}var meta={request:request};return start.then(function(){var data=request.build();return _this3.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this3.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this3.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this3.events.emit("experimental.request.retry",meta);return _this3.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this3.session?_this3.session.token:null;return _this3.events.emit("error.unauthorized",meta,true).then(function(){if(_this3.session&&_this3.session.token!==sessionToken){return _this3.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this3.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this3.events.emit("error.response",meta);var err=new Error(response.message+" ["+name+"]");err.response=response;err.request=request;return Promise.reject(err)}else{_this3.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this3.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.graphql=function graphql(document,variables){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{throwOnError:true,minifyDocument:true};var throwOnError=!options||options.throwOnError!==false;var minifyDocument=options.minifyDocument===true;var query=minifyDocument?document.replace(/\s+/g," ").replace(/ { /g,"{").replace(/ } /g,"}").trim():document;return this.request("graphql",{query:query,variables:variables}).then(function(response){var body=response.data;if(body.errors&&body.errors.length&&throwOnError){var err=new _AggregateError.AggregateError("One or more GraphQL errors occurred.",body.errors.map(function(error){return new _GraphQLError.GraphQLError(error.message,error.locations,error.path)}));throw err}return body})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(this.__admin)}return this._admin};PageProof.prototype.brian=function brian(){if(!this.session||this.session.userId!==_constants.BRIAN_USER_ID){return Promise.reject(new Error("You do not have permission to use this API."))}if(!this._brian){this._brian=Promise.resolve(new _Brian2.default(this))}return this._brian};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.protobuf=function protobuf(){return this.adapters.getProtobufAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
|
|
1
|
+
"use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Encryption=require("../api/Encryption");var _Encryption2=_interopRequireDefault(_Encryption);var _Live=require("../api/Live");var _Live2=_interopRequireDefault(_Live);var _Brian=require("../api/brian/Brian");var _Brian2=_interopRequireDefault(_Brian);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _constants=require("../util/constants");var _getTimezone=require("../util/getTimezone");var _getTimezone2=_interopRequireDefault(_getTimezone);var _Reports=require("../api/Reports");var _Reports2=_interopRequireDefault(_Reports);var _Teams=require("../api/Teams");var _Teams2=_interopRequireDefault(_Teams);var _Printing=require("../api/Printing");var _Printing2=_interopRequireDefault(_Printing);var _FreeTrial=require("../api/FreeTrial");var _FreeTrial2=_interopRequireDefault(_FreeTrial);var _KeyPairs=require("./KeyPairs");var _KeyPairs2=_interopRequireDefault(_KeyPairs);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$options=_ref.options,options=_ref$options===undefined?{}:_ref$options,_ref$adapters=_ref.adapters,adapters=_ref$adapters===undefined?[]:_ref$adapters;_classCallCheck(this,PageProof);this.options=options;this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(adapters);this.cache=new _Cache2.default(this);this.keyPairs=new _KeyPairs2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.preferences=new _Preferences2.default(this);this.sessions=new _Sessions2.default(this);this.encryption=new _Encryption2.default(this);this.live=new _Live2.default(this);this.reports=new _Reports2.default(this);this.teams=new _Teams2.default(this);this.printing=new _Printing2.default(this);this.freeTrial=new _FreeTrial2.default(this);this.__admin=new _Admin2.default(this);this._hijackAdmin();this._init();this._registerCoreHooks();this._enhance()}PageProof.prototype._init=function _init(){var requestAdapter=this.adapters.getRequestAdapter();if(!this.options.endpoint){this.options.endpoint=requestAdapter.options.endpoint}if(!this.options.applicationId){this.options.applicationId=requestAdapter.options.applicationId}if(!this.options.subscriptionKey){this.options.subscriptionKey=requestAdapter.options.key||this.options.key}if(this.options.subscriptionKey&&!this.options.applicationId){throw new Error("You must provide an applicationId.")}};PageProof.prototype._hijackAdmin=function _hijackAdmin(){var _this=this;var adminKeys=Object.getOwnPropertyNames(this.__admin);adminKeys.forEach(function(adminKey){return _this.admin[adminKey]=_this.__admin[adminKey]})};PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this2=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this2)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.rawRequest=function rawRequest(_ref2,options){var method=_ref2.method,url=_ref2.url,host=_ref2.host,path=_ref2.path,query=_ref2.query,body=_ref2.body,headers=_ref2.headers;var adapter=this.adapters.getRequestAdapter();if(url){host=url.origin;path=url.pathname;query=url.search}return adapter.send({host:host,method:method,path:path,query:query,body:body,headers:headers,credentials:false},options)};PageProof.prototype.getRequestLocalEncodedMetadata=function getRequestLocalEncodedMetadata(){return[(0,_getTimezone2.default)()].map(function(value){return value!==null&&value!==undefined?encodeURIComponent(value):"#"}).join(":")};PageProof.prototype.request=function request(name,params,options){var _this3=this;var request=new _Request2.default(this.options.endpoint,name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}if(this.options.applicationId){request.addHeader(_constants.DEVICE_ID_HEADER,this.options.applicationId)}if(this.options.subscriptionKey){request.addHeader(_constants.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey)}var localEncodedMetadata=this.getRequestLocalEncodedMetadata();if(localEncodedMetadata){request.addHeader(_constants.LOCAL_ENCODED_METADATA_HEADER,localEncodedMetadata)}var meta={request:request};return start.then(function(){var data=request.build();return _this3.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this3.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this3.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this3.events.emit("experimental.request.retry",meta);return _this3.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this3.session?_this3.session.token:null;return _this3.events.emit("error.unauthorized",meta,true).then(function(){if(_this3.session&&_this3.session.token!==sessionToken){return _this3.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this3.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this3.events.emit("error.response",meta);var err=new Error(response.message+" ["+name+"]");err.response=response;err.request=request;return Promise.reject(err)}else{_this3.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this3.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(this.__admin)}return this._admin};PageProof.prototype.brian=function brian(){if(!this.session||this.session.userId!==_constants.BRIAN_USER_ID){return Promise.reject(new Error("You do not have permission to use this API."))}if(!this._brian){this._brian=Promise.resolve(new _Brian2.default(this))}return this._brian};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.protobuf=function protobuf(){return this.adapters.getProtobufAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
|
package/lib/models/File.d.ts
CHANGED
|
@@ -69,12 +69,6 @@ declare class File {
|
|
|
69
69
|
* @type {object|null}
|
|
70
70
|
*/
|
|
71
71
|
adobeExportData: object | null;
|
|
72
|
-
/**
|
|
73
|
-
* If the file was created by importing from an external URL, this will be that URL.
|
|
74
|
-
*
|
|
75
|
-
* @type {string|null}
|
|
76
|
-
*/
|
|
77
|
-
importUrl: string | null;
|
|
78
72
|
/** @private */
|
|
79
73
|
fromFile(fileData: any): File;
|
|
80
74
|
/** @private */
|
package/lib/models/File.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var fileSchema={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function adobeExportData(data){var exportData=data.AdobeExportData;if(exportData&&exportData.length){try{return JSON.parse(exportData)}catch(err){}}return null},sourceMetadata:function sourceMetadata(data){var sourceMetadata=data.SourceMetadata;if(sourceMetadata&&sourceMetadata.length){try{return JSON.parse(sourceMetadata)}catch(err){}}return null}
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var fileSchema={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function adobeExportData(data){var exportData=data.AdobeExportData;if(exportData&&exportData.length){try{return JSON.parse(exportData)}catch(err){}}return null},sourceMetadata:function sourceMetadata(data){var sourceMetadata=data.SourceMetadata;if(sourceMetadata&&sourceMetadata.length){try{return JSON.parse(sourceMetadata)}catch(err){}}return null}};var commentAttachmentSchema={id:"FileId",name:"Name",blocks:"Chunks",assignedTo:"CommentId",assignedType:function assignedType(){return"attachment"},status:"Status",message:function message(){return""}};var File=function(){function File(){_classCallCheck(this,File)}File.prototype.fromFile=function fromFile(fileData){(0,_transform2.default)(this,fileSchema,fileData);return this};File.prototype.fromCommentAttachment=function fromCommentAttachment(commentAttachmentData){(0,_transform2.default)(this,commentAttachmentSchema,commentAttachmentData);return this};return File}();exports.default=File;
|