@assinafy/cli 1.0.2 → 2.0.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.
Files changed (69) hide show
  1. package/README.md +86 -38
  2. package/THIRD_PARTY_NOTICES.md +972 -0
  3. package/dist/api.cjs +1965 -0
  4. package/dist/api.cjs.map +1 -0
  5. package/dist/api.js +1909 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/cli.cjs +3018 -1560
  8. package/dist/types/api/client.d.ts +88 -0
  9. package/dist/types/api/client.d.ts.map +1 -0
  10. package/dist/types/api/errors.d.ts +28 -0
  11. package/dist/types/api/errors.d.ts.map +1 -0
  12. package/dist/types/api/index.d.ts +21 -0
  13. package/dist/types/api/index.d.ts.map +1 -0
  14. package/dist/types/api/resources/assignments.d.ts +39 -0
  15. package/dist/types/api/resources/assignments.d.ts.map +1 -0
  16. package/dist/types/api/resources/authentication.d.ts +55 -0
  17. package/dist/types/api/resources/authentication.d.ts.map +1 -0
  18. package/dist/types/api/resources/base.d.ts +35 -0
  19. package/dist/types/api/resources/base.d.ts.map +1 -0
  20. package/dist/types/api/resources/documents.d.ts +124 -0
  21. package/dist/types/api/resources/documents.d.ts.map +1 -0
  22. package/dist/types/api/resources/fields.d.ts +57 -0
  23. package/dist/types/api/resources/fields.d.ts.map +1 -0
  24. package/dist/types/api/resources/signer-documents.d.ts +72 -0
  25. package/dist/types/api/resources/signer-documents.d.ts.map +1 -0
  26. package/dist/types/api/resources/signers.d.ts +25 -0
  27. package/dist/types/api/resources/signers.d.ts.map +1 -0
  28. package/dist/types/api/resources/tags.d.ts +37 -0
  29. package/dist/types/api/resources/tags.d.ts.map +1 -0
  30. package/dist/types/api/resources/templates.d.ts +21 -0
  31. package/dist/types/api/resources/templates.d.ts.map +1 -0
  32. package/dist/types/api/resources/users.d.ts +14 -0
  33. package/dist/types/api/resources/users.d.ts.map +1 -0
  34. package/dist/types/api/resources/webhooks.d.ts +17 -0
  35. package/dist/types/api/resources/webhooks.d.ts.map +1 -0
  36. package/dist/types/api/resources/workspaces.d.ts +32 -0
  37. package/dist/types/api/resources/workspaces.d.ts.map +1 -0
  38. package/dist/types/api/support/webhook-verifier.d.ts +43 -0
  39. package/dist/types/api/support/webhook-verifier.d.ts.map +1 -0
  40. package/dist/types/api/types.d.ts +926 -0
  41. package/dist/types/api/types.d.ts.map +1 -0
  42. package/dist/types/api/utils.d.ts +34 -0
  43. package/dist/types/api/utils.d.ts.map +1 -0
  44. package/docs/README.md +9 -1
  45. package/docs/api-operations.json +718 -0
  46. package/docs/api-reference.md +7228 -0
  47. package/docs/assignments.md +21 -1
  48. package/docs/auth.md +28 -12
  49. package/docs/config.md +0 -1
  50. package/docs/docs.md +0 -1
  51. package/docs/documents.md +45 -6
  52. package/docs/fields.md +4 -2
  53. package/docs/login.md +0 -1
  54. package/docs/logout.md +0 -1
  55. package/docs/migration-v2.md +20 -0
  56. package/docs/releasing.md +42 -0
  57. package/docs/sdk-reference.md +344 -0
  58. package/docs/send.md +1 -2
  59. package/docs/signer.md +44 -19
  60. package/docs/signers.md +2 -3
  61. package/docs/tags.md +0 -1
  62. package/docs/templates.md +3 -3
  63. package/docs/users.md +85 -0
  64. package/docs/webhooks.md +1 -16
  65. package/docs/whoami.md +0 -1
  66. package/docs/workspaces.md +109 -10
  67. package/install.ps1 +117 -13
  68. package/install.sh +165 -30
  69. package/package.json +37 -16
@@ -11,6 +11,7 @@ Options:
11
11
  -h, --help display help for command
12
12
 
13
13
  Commands:
14
+ list [options] List assignments across the account
14
15
  create [options] <documentId> Create a signing assignment for a document
15
16
  estimate-cost [options] <documentId> Estimate the credit cost of an assignment
16
17
  reset-expiration [options] <documentId> <assignmentId> Update or clear an assignment expiration date
@@ -20,6 +21,20 @@ Commands:
20
21
  help [command] display help for command
21
22
  ```
22
23
 
24
+ ### `assinafy assignments list`
25
+
26
+ ```text
27
+ Usage: assinafy assignments list [options]
28
+
29
+ List assignments across the account
30
+
31
+ Options:
32
+ --page <n> Page number to fetch
33
+ --per-page <n> Items per page
34
+ --sort <field> Sort by created_at (prefix with - for descending)
35
+ -h, --help display help for command
36
+ ```
37
+
23
38
  ### `assinafy assignments create`
24
39
 
25
40
  ```text
@@ -39,6 +54,9 @@ Options:
39
54
  --expires-at <iso8601> Expiration timestamp
40
55
  --copy-receivers <csv> Comma-separated signer IDs to receive a copy of the
41
56
  document
57
+ --entries <json> JSON array of field placement entries, required for
58
+ --method collect (e.g.
59
+ '[{"page_id":"p1","fields":[{"signer_id":"s1","field_id":"f1"}]}]')
42
60
  -h, --help display help for command
43
61
  ```
44
62
 
@@ -55,6 +73,9 @@ Arguments:
55
73
  Options:
56
74
  --signer-ids <csv> Comma-separated signer IDs
57
75
  --signers <json> JSON array of signer refs
76
+ --method <method> virtual or collect (default: "virtual")
77
+ --entries <json> JSON array of field placement entries, required for
78
+ --method collect
58
79
  -h, --help display help for command
59
80
  ```
60
81
 
@@ -121,4 +142,3 @@ Arguments:
121
142
  Options:
122
143
  -h, --help display help for command
123
144
  ```
124
-
package/docs/auth.md CHANGED
@@ -15,14 +15,14 @@ Commands:
15
15
  token (no existing credentials required)
16
16
  social-login [options] Exchange a provider token for an Assinafy JWT
17
17
  (no existing credentials required)
18
+ link-social-login [options] Link a Google identity to the authenticated
19
+ user
18
20
  change-password [options] Change the authenticated user's password
19
- (requires --token or ASSINAFY_TOKEN)
20
21
  request-password-reset <email> Email a password-reset link to the user (no
21
22
  existing credentials required)
22
23
  reset-password [options] Complete a password reset with the emailed
23
24
  token (no existing credentials required)
24
25
  api-keys Manage the current user personal API key
25
- (requires --token or ASSINAFY_TOKEN)
26
26
  help [command] display help for command
27
27
  ```
28
28
 
@@ -38,7 +38,7 @@ Arguments:
38
38
  email Account email
39
39
 
40
40
  Options:
41
- --password <password> Password (prompted if omitted)
41
+ --password <password> Password (prompted if omitted) (env: ASSINAFY_PASSWORD)
42
42
  -h, --help display help for command
43
43
  ```
44
44
 
@@ -51,22 +51,36 @@ Exchange a provider token for an Assinafy JWT (no existing credentials required)
51
51
 
52
52
  Options:
53
53
  --provider <provider> OAuth provider (e.g. google)
54
- --provider-token <token> Provider token
54
+ --provider-token <token> Provider token (env: ASSINAFY_PROVIDER_TOKEN)
55
55
  --accept-terms Accept the platform terms
56
56
  -h, --help display help for command
57
57
  ```
58
58
 
59
+ ### `assinafy auth link-social-login`
60
+
61
+ ```text
62
+ Usage: assinafy auth link-social-login [options]
63
+
64
+ Link a Google identity to the authenticated user
65
+
66
+ Options:
67
+ --provider-token <token> Google identity token (env: ASSINAFY_PROVIDER_TOKEN)
68
+ -h, --help display help for command
69
+ ```
70
+
59
71
  ### `assinafy auth change-password`
60
72
 
61
73
  ```text
62
74
  Usage: assinafy auth change-password [options]
63
75
 
64
- Change the authenticated user's password (requires --token or ASSINAFY_TOKEN)
76
+ Change the authenticated user's password
65
77
 
66
78
  Options:
67
79
  --email <email> Account email
68
- --password <password> Current password (prompted if omitted)
69
- --new-password <password> New password (prompted if omitted)
80
+ --password <password> Current password (prompted if omitted) (env:
81
+ ASSINAFY_PASSWORD)
82
+ --new-password <password> New password (prompted if omitted) (env:
83
+ ASSINAFY_NEW_PASSWORD)
70
84
  -h, --help display help for command
71
85
  ```
72
86
 
@@ -94,8 +108,10 @@ required)
94
108
 
95
109
  Options:
96
110
  --email <email> Account email
97
- --token <token> Reset token from the email
98
- --new-password <password> New password (prompted if omitted)
111
+ --reset-token <token> Reset token from the email (env:
112
+ ASSINAFY_RESET_TOKEN)
113
+ --new-password <password> New password (prompted if omitted) (env:
114
+ ASSINAFY_NEW_PASSWORD)
99
115
  -h, --help display help for command
100
116
  ```
101
117
 
@@ -104,7 +120,7 @@ Options:
104
120
  ```text
105
121
  Usage: assinafy auth api-keys [options] [command]
106
122
 
107
- Manage the current user personal API key (requires --token or ASSINAFY_TOKEN)
123
+ Manage the current user personal API key
108
124
 
109
125
  Options:
110
126
  -h, --help display help for command
@@ -124,7 +140,8 @@ Usage: assinafy auth api-keys create [options]
124
140
  Generate (and rotate) the current user API key
125
141
 
126
142
  Options:
127
- --password <password> Account password (prompted if omitted)
143
+ --password <password> Account password (prompted if omitted) (env:
144
+ ASSINAFY_PASSWORD)
128
145
  -h, --help display help for command
129
146
  ```
130
147
 
@@ -150,4 +167,3 @@ Options:
150
167
  -y, --yes Skip the confirmation prompt
151
168
  -h, --help display help for command
152
169
  ```
153
-
package/docs/config.md CHANGED
@@ -95,4 +95,3 @@ Print the config file path
95
95
  Options:
96
96
  -h, --help display help for command
97
97
  ```
98
-
package/docs/docs.md CHANGED
@@ -11,4 +11,3 @@ Options:
11
11
  --open Open the documentation in your default browser
12
12
  -h, --help display help for command
13
13
  ```
14
-
package/docs/documents.md CHANGED
@@ -13,7 +13,9 @@ Options:
13
13
  Commands:
14
14
  upload [options] <file> Upload a PDF to the workspace
15
15
  list [options] List workspace documents
16
+ search [options] [query] Lightweight document search (type-ahead)
16
17
  get <id> Show details for a document
18
+ rename <id> <name> Rename a document (only before the signature process starts)
17
19
  download [options] <id> Download a document artifact
18
20
  thumbnail [options] <id> Download the document thumbnail (JPEG)
19
21
  download-page [options] <id> <pageId> Download a single document page (JPEG)
@@ -64,8 +66,27 @@ Options:
64
66
  --tags <ids> Comma-separated tag IDs (AND semantics)
65
67
  --page <n> Page number to fetch
66
68
  --per-page <n> Items per page
67
- --search <query> Filter results by a search query
68
- --sort <field> Sort by field (prefix with - for descending)
69
+ --search <query> Filter by a search query
70
+ --sort <field> Sort by field
71
+ -h, --help display help for command
72
+ ```
73
+
74
+ ### `assinafy documents search`
75
+
76
+ ```text
77
+ Usage: assinafy documents search [options] [query]
78
+
79
+ Lightweight document search (type-ahead)
80
+
81
+ Arguments:
82
+ query Search text (alias for --search)
83
+
84
+ Options:
85
+ --status <status> Filter by document status
86
+ --page <n> Page number to fetch
87
+ --per-page <n> Items per page
88
+ --search <query> Filter by a search query
89
+ --sort <field> Sort by field
69
90
  -h, --help display help for command
70
91
  ```
71
92
 
@@ -83,6 +104,21 @@ Options:
83
104
  -h, --help display help for command
84
105
  ```
85
106
 
107
+ ### `assinafy documents rename`
108
+
109
+ ```text
110
+ Usage: assinafy documents rename [options] <id> <name>
111
+
112
+ Rename a document (only before the signature process starts)
113
+
114
+ Arguments:
115
+ id Document ID
116
+ name New document name
117
+
118
+ Options:
119
+ -h, --help display help for command
120
+ ```
121
+
86
122
  ### `assinafy documents download`
87
123
 
88
124
  ```text
@@ -94,9 +130,10 @@ Arguments:
94
130
  id Document ID
95
131
 
96
132
  Options:
97
- --artifact <name> original | certificated | certificate-page | bundle
98
- (default: "certificated")
133
+ --artifact <name> original | certificated | certificate-page | pades |
134
+ bundle (default: "certificated")
99
135
  -o, --output <path> Output file path
136
+ --force Overwrite the output file if it already exists
100
137
  -h, --help display help for command
101
138
  ```
102
139
 
@@ -112,6 +149,7 @@ Arguments:
112
149
 
113
150
  Options:
114
151
  -o, --output <path> Output file path
152
+ --force Overwrite the output file if it already exists
115
153
  -h, --help display help for command
116
154
  ```
117
155
 
@@ -128,6 +166,7 @@ Arguments:
128
166
 
129
167
  Options:
130
168
  -o, --output <path> Output file path
169
+ --force Overwrite the output file if it already exists
131
170
  -h, --help display help for command
132
171
  ```
133
172
 
@@ -305,7 +344,8 @@ Arguments:
305
344
  id Document ID
306
345
 
307
346
  Options:
308
- --recipient <value> Email address or phone number
347
+ --email <email> Email using the current published API payload
348
+ --recipient <value> Email address or phone number (live legacy payload)
309
349
  --channel <channel> email or whatsapp (default: "email")
310
350
  -h, --help display help for command
311
351
  ```
@@ -339,4 +379,3 @@ Options:
339
379
  --interval <ms> Poll interval in milliseconds (default: "2000")
340
380
  -h, --help display help for command
341
381
  ```
342
-
package/docs/fields.md CHANGED
@@ -79,6 +79,7 @@ Options:
79
79
  --type <type> Field type
80
80
  --name <name> Field name
81
81
  --regex <regex> Validation regex
82
+ --clear-regex Remove the existing validation regex
82
83
  --required Mark as required
83
84
  --optional Mark as not required
84
85
  --active Activate the field
@@ -114,6 +115,7 @@ Arguments:
114
115
 
115
116
  Options:
116
117
  --signer-access-code <code> Signer access code (for signer-side validation)
118
+ (env: ASSINAFY_SIGNER_ACCESS_CODE)
117
119
  -h, --help display help for command
118
120
  ```
119
121
 
@@ -126,7 +128,8 @@ Validate multiple field values at once
126
128
 
127
129
  Options:
128
130
  --entries <json> JSON array of { field_id, value } entries
129
- --signer-access-code <code> Signer access code
131
+ --signer-access-code <code> Signer access code (env:
132
+ ASSINAFY_SIGNER_ACCESS_CODE)
130
133
  -h, --help display help for command
131
134
  ```
132
135
 
@@ -140,4 +143,3 @@ List the platform's supported field types
140
143
  Options:
141
144
  -h, --help display help for command
142
145
  ```
143
-
package/docs/login.md CHANGED
@@ -11,4 +11,3 @@ Store an API key and account ID in a profile (interactive). Reads the global
11
11
  Options:
12
12
  -h, --help display help for command
13
13
  ```
14
-
package/docs/logout.md CHANGED
@@ -10,4 +10,3 @@ Remove stored credentials from the active profile
10
10
  Options:
11
11
  -h, --help display help for command
12
12
  ```
13
-
@@ -0,0 +1,20 @@
1
+ # Migrating to version 2
2
+
3
+ Version 2 publishes the Node.js SDK at `@assinafy/cli/api` and requires Node.js
4
+ `>=22.12.0`.
5
+
6
+ - Credentialed clients now require HTTPS, reject redirects, and reject base URLs
7
+ containing a query or fragment. Set `allowInsecureHttp: true` only for isolated
8
+ local HTTP testing.
9
+ - Resource IDs, artifact names, sort fields, dates, mutually exclusive CLI
10
+ options, and signer-code authentication are validated before a request.
11
+ - Published `{ status, message }` bodies and delete `data: []` bodies are now
12
+ returned as `IStatusResponse` and `IEmptyResult` instead of being discarded.
13
+ - Phone-only signers in `uploadAndRequestSignatures` default to WhatsApp
14
+ verification and notification. Explicit signer controls still take precedence.
15
+ - Signer artifact downloads perform an identity preflight because older sandbox
16
+ deployments did not enforce the documented access code on the raw download route.
17
+
18
+ Legacy signer aliases (`phone`, `cpf`, and assignment `signer_ids`/`signerIds`),
19
+ both public `sendToken` request forms, and existing CLI functionality remain
20
+ available. See the [SDK reference](./sdk-reference.md) for exact method signatures.
@@ -0,0 +1,42 @@
1
+ # Release runbook
2
+
3
+ Releases originate from the source GitLab repository. Its push mirror must send
4
+ branches and `v*` tags to GitHub; GitHub Release objects are created by
5
+ `.github/workflows/release.yml`, not by the mirror.
6
+
7
+ ## One-time repository setup
8
+
9
+ - Create a protected GitHub environment named `release` for the publish job.
10
+ - Configure npm trusted publishing for this GitHub repository, workflow
11
+ `release.yml`, and environment `release`. No long-lived npm token is used.
12
+ - Allow the repository `GITHUB_TOKEN` to write GitHub Releases and Packages.
13
+ - Enable GitHub immutable releases so published tags and assets cannot be changed.
14
+ - Protect `v*` tags and require review on the `release` environment so arbitrary
15
+ commits cannot enter the privileged publish job.
16
+ - If policy requires authenticity independent of GitHub Release hosting, configure
17
+ an organization-approved signature or provenance attestation and publish its
18
+ verification procedure. `SHA256SUMS` alone verifies integrity within the same
19
+ release authority, not an independently trusted signer.
20
+
21
+ ## Publish
22
+
23
+ 1. Run `npm ci`, `npm run typecheck`, `npm run lint`, `npm test`, and
24
+ `npm run pack:release` on the release commit.
25
+ 2. Set `package.json` to the exact SemVer version and push the matching signed or
26
+ annotated `vX.Y.Z` tag from GitLab.
27
+ 3. Confirm the GitHub workflow verifies that exact tag/commit, uploads its checked
28
+ artifact, publishes both registries, and only then publishes the draft release.
29
+
30
+ Prerelease versions advance the `next` registry tag and are not marked as the
31
+ latest GitHub release. Stable versions advance `latest`. The workflow compares
32
+ SemVer precedence before moving either registry/GitHub pointer; an older backfill
33
+ is published under a version-specific `backfill-*` tag. A failed run is safe to
34
+ dispatch again with the same tag: existing packages/assets are verified or skipped,
35
+ and published GitHub Release assets are never overwritten.
36
+
37
+ Push one release tag at a time and let its workflow finish before pushing the next.
38
+ Same-tag push and recovery runs are serialized. Separate versions do not share a
39
+ GitHub concurrency group because that platform drops older pending runs; the publish
40
+ job instead fails before mutation if any other release workflow is active. Monotonic
41
+ SemVer promotion also prevents a later backfill from moving `latest`/`next` backwards.
42
+ Retry the refused tag afterward.