@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.
- package/README.md +86 -38
- package/THIRD_PARTY_NOTICES.md +972 -0
- package/dist/api.cjs +1965 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.js +1909 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.cjs +3018 -1560
- package/dist/types/api/client.d.ts +88 -0
- package/dist/types/api/client.d.ts.map +1 -0
- package/dist/types/api/errors.d.ts +28 -0
- package/dist/types/api/errors.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +21 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/resources/assignments.d.ts +39 -0
- package/dist/types/api/resources/assignments.d.ts.map +1 -0
- package/dist/types/api/resources/authentication.d.ts +55 -0
- package/dist/types/api/resources/authentication.d.ts.map +1 -0
- package/dist/types/api/resources/base.d.ts +35 -0
- package/dist/types/api/resources/base.d.ts.map +1 -0
- package/dist/types/api/resources/documents.d.ts +124 -0
- package/dist/types/api/resources/documents.d.ts.map +1 -0
- package/dist/types/api/resources/fields.d.ts +57 -0
- package/dist/types/api/resources/fields.d.ts.map +1 -0
- package/dist/types/api/resources/signer-documents.d.ts +72 -0
- package/dist/types/api/resources/signer-documents.d.ts.map +1 -0
- package/dist/types/api/resources/signers.d.ts +25 -0
- package/dist/types/api/resources/signers.d.ts.map +1 -0
- package/dist/types/api/resources/tags.d.ts +37 -0
- package/dist/types/api/resources/tags.d.ts.map +1 -0
- package/dist/types/api/resources/templates.d.ts +21 -0
- package/dist/types/api/resources/templates.d.ts.map +1 -0
- package/dist/types/api/resources/users.d.ts +14 -0
- package/dist/types/api/resources/users.d.ts.map +1 -0
- package/dist/types/api/resources/webhooks.d.ts +17 -0
- package/dist/types/api/resources/webhooks.d.ts.map +1 -0
- package/dist/types/api/resources/workspaces.d.ts +32 -0
- package/dist/types/api/resources/workspaces.d.ts.map +1 -0
- package/dist/types/api/support/webhook-verifier.d.ts +43 -0
- package/dist/types/api/support/webhook-verifier.d.ts.map +1 -0
- package/dist/types/api/types.d.ts +926 -0
- package/dist/types/api/types.d.ts.map +1 -0
- package/dist/types/api/utils.d.ts +34 -0
- package/dist/types/api/utils.d.ts.map +1 -0
- package/docs/README.md +9 -1
- package/docs/api-operations.json +718 -0
- package/docs/api-reference.md +7228 -0
- package/docs/assignments.md +21 -1
- package/docs/auth.md +28 -12
- package/docs/config.md +0 -1
- package/docs/docs.md +0 -1
- package/docs/documents.md +45 -6
- package/docs/fields.md +4 -2
- package/docs/login.md +0 -1
- package/docs/logout.md +0 -1
- package/docs/migration-v2.md +20 -0
- package/docs/releasing.md +42 -0
- package/docs/sdk-reference.md +344 -0
- package/docs/send.md +1 -2
- package/docs/signer.md +44 -19
- package/docs/signers.md +2 -3
- package/docs/tags.md +0 -1
- package/docs/templates.md +3 -3
- package/docs/users.md +85 -0
- package/docs/webhooks.md +1 -16
- package/docs/whoami.md +0 -1
- package/docs/workspaces.md +109 -10
- package/install.ps1 +117 -13
- package/install.sh +165 -30
- package/package.json +37 -16
package/docs/users.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# `assinafy users`
|
|
2
|
+
|
|
3
|
+
## `assinafy users`
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
Usage: assinafy users [options] [command]
|
|
7
|
+
|
|
8
|
+
Show the authenticated user and personal preferences
|
|
9
|
+
|
|
10
|
+
Options:
|
|
11
|
+
-h, --help display help for command
|
|
12
|
+
|
|
13
|
+
Commands:
|
|
14
|
+
self Show the authenticated user's profile
|
|
15
|
+
and accounts
|
|
16
|
+
stats [options] Show document KPIs across the user's
|
|
17
|
+
accounts
|
|
18
|
+
notification-preferences|preferences Manage owner-facing email notification
|
|
19
|
+
preferences
|
|
20
|
+
help [command] display help for command
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### `assinafy users self`
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
Usage: assinafy users self [options]
|
|
27
|
+
|
|
28
|
+
Show the authenticated user's profile and accounts
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
-h, --help display help for command
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `assinafy users stats`
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
Usage: assinafy users stats [options]
|
|
38
|
+
|
|
39
|
+
Show document KPIs across the user's accounts
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
--granularity <value> monthly or daily (default: "monthly")
|
|
43
|
+
--month <yyyy-mm> Month required for daily granularity
|
|
44
|
+
-h, --help display help for command
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `assinafy users notification-preferences`
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Usage: assinafy users notification-preferences|preferences [options] [command]
|
|
51
|
+
|
|
52
|
+
Manage owner-facing email notification preferences
|
|
53
|
+
|
|
54
|
+
Options:
|
|
55
|
+
-h, --help display help for command
|
|
56
|
+
|
|
57
|
+
Commands:
|
|
58
|
+
get Show all owner-facing email notification preferences
|
|
59
|
+
update [options] Merge one or more owner-facing email notification
|
|
60
|
+
preferences
|
|
61
|
+
help [command] display help for command
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### `assinafy users notification-preferences get`
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
Usage: assinafy users notification-preferences get [options]
|
|
68
|
+
|
|
69
|
+
Show all owner-facing email notification preferences
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
-h, --help display help for command
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### `assinafy users notification-preferences update`
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Usage: assinafy users notification-preferences update [options]
|
|
79
|
+
|
|
80
|
+
Merge one or more owner-facing email notification preferences
|
|
81
|
+
|
|
82
|
+
Options:
|
|
83
|
+
--set <json> JSON object mapping notification codes to booleans
|
|
84
|
+
-h, --help display help for command
|
|
85
|
+
```
|
package/docs/webhooks.md
CHANGED
|
@@ -13,7 +13,6 @@ Options:
|
|
|
13
13
|
Commands:
|
|
14
14
|
register [options] Register (or replace) the workspace webhook subscription
|
|
15
15
|
get Show the current webhook subscription
|
|
16
|
-
delete|rm [options] Delete the webhook subscription
|
|
17
16
|
inactivate Inactivate the webhook subscription without deleting it
|
|
18
17
|
event-types List supported webhook event types
|
|
19
18
|
dispatches [options] List webhook delivery history
|
|
@@ -47,18 +46,6 @@ Options:
|
|
|
47
46
|
-h, --help display help for command
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
### `assinafy webhooks delete`
|
|
51
|
-
|
|
52
|
-
```text
|
|
53
|
-
Usage: assinafy webhooks delete|rm [options]
|
|
54
|
-
|
|
55
|
-
Delete the webhook subscription
|
|
56
|
-
|
|
57
|
-
Options:
|
|
58
|
-
-y, --yes Skip the confirmation prompt
|
|
59
|
-
-h, --help display help for command
|
|
60
|
-
```
|
|
61
|
-
|
|
62
49
|
### `assinafy webhooks inactivate`
|
|
63
50
|
|
|
64
51
|
```text
|
|
@@ -95,8 +82,7 @@ Options:
|
|
|
95
82
|
--to <unix> End of time range (unix seconds)
|
|
96
83
|
--page <n> Page number to fetch
|
|
97
84
|
--per-page <n> Items per page
|
|
98
|
-
--
|
|
99
|
-
--sort <field> Sort by field (prefix with - for descending)
|
|
85
|
+
--sort <field> Sort by created_at (prefix with - for descending)
|
|
100
86
|
-h, --help display help for command
|
|
101
87
|
```
|
|
102
88
|
|
|
@@ -113,4 +99,3 @@ Arguments:
|
|
|
113
99
|
Options:
|
|
114
100
|
-h, --help display help for command
|
|
115
101
|
```
|
|
116
|
-
|
package/docs/whoami.md
CHANGED
package/docs/workspaces.md
CHANGED
|
@@ -14,6 +14,9 @@ Commands:
|
|
|
14
14
|
create [options] Create a workspace (account)
|
|
15
15
|
list List workspaces you can access
|
|
16
16
|
get <id> Show a workspace by ID
|
|
17
|
+
theme <id> Show public branding for a workspace
|
|
18
|
+
stats [options] <id> Show document KPIs for a workspace
|
|
19
|
+
logo Manage a workspace logo
|
|
17
20
|
update [options] <id> Update a workspace
|
|
18
21
|
delete|rm [options] <id> Delete a workspace
|
|
19
22
|
help [command] display help for command
|
|
@@ -27,10 +30,11 @@ Usage: assinafy workspaces create [options]
|
|
|
27
30
|
Create a workspace (account)
|
|
28
31
|
|
|
29
32
|
Options:
|
|
30
|
-
--name <name>
|
|
31
|
-
--
|
|
32
|
-
--
|
|
33
|
-
-
|
|
33
|
+
--name <name> Workspace name
|
|
34
|
+
--notification-sender <type> Notification sender: User or Account
|
|
35
|
+
--primary-color <hex> Primary brand color
|
|
36
|
+
--secondary-color <hex> Secondary brand color
|
|
37
|
+
-h, --help display help for command
|
|
34
38
|
```
|
|
35
39
|
|
|
36
40
|
### `assinafy workspaces list`
|
|
@@ -58,6 +62,100 @@ Options:
|
|
|
58
62
|
-h, --help display help for command
|
|
59
63
|
```
|
|
60
64
|
|
|
65
|
+
### `assinafy workspaces theme`
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
Usage: assinafy workspaces theme [options] <id>
|
|
69
|
+
|
|
70
|
+
Show public branding for a workspace
|
|
71
|
+
|
|
72
|
+
Arguments:
|
|
73
|
+
id Account/workspace ID
|
|
74
|
+
|
|
75
|
+
Options:
|
|
76
|
+
-h, --help display help for command
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `assinafy workspaces stats`
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
Usage: assinafy workspaces stats [options] <id>
|
|
83
|
+
|
|
84
|
+
Show document KPIs for a workspace
|
|
85
|
+
|
|
86
|
+
Arguments:
|
|
87
|
+
id Account/workspace ID
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
--granularity <value> monthly or daily (default: "monthly")
|
|
91
|
+
--month <yyyy-mm> Month required for daily granularity
|
|
92
|
+
-h, --help display help for command
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### `assinafy workspaces logo`
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
Usage: assinafy workspaces logo [options] [command]
|
|
99
|
+
|
|
100
|
+
Manage a workspace logo
|
|
101
|
+
|
|
102
|
+
Options:
|
|
103
|
+
-h, --help display help for command
|
|
104
|
+
|
|
105
|
+
Commands:
|
|
106
|
+
download [options] <id> Download the workspace logo
|
|
107
|
+
upload [options] <id> <file> Upload or replace the workspace logo
|
|
108
|
+
delete|rm [options] <id> Delete the workspace logo
|
|
109
|
+
help [command] display help for command
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### `assinafy workspaces logo download`
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
Usage: assinafy workspaces logo download [options] <id>
|
|
116
|
+
|
|
117
|
+
Download the workspace logo
|
|
118
|
+
|
|
119
|
+
Arguments:
|
|
120
|
+
id Account/workspace ID
|
|
121
|
+
|
|
122
|
+
Options:
|
|
123
|
+
-o, --output <path> Output file path
|
|
124
|
+
--force Overwrite the output file if it already exists
|
|
125
|
+
-h, --help display help for command
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `assinafy workspaces logo upload`
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Usage: assinafy workspaces logo upload [options] <id> <file>
|
|
132
|
+
|
|
133
|
+
Upload or replace the workspace logo
|
|
134
|
+
|
|
135
|
+
Arguments:
|
|
136
|
+
id Account/workspace ID
|
|
137
|
+
file Logo image path
|
|
138
|
+
|
|
139
|
+
Options:
|
|
140
|
+
--content-type <mime> Image MIME type (inferred from extension)
|
|
141
|
+
-h, --help display help for command
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### `assinafy workspaces logo delete`
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
Usage: assinafy workspaces logo delete|rm [options] <id>
|
|
148
|
+
|
|
149
|
+
Delete the workspace logo
|
|
150
|
+
|
|
151
|
+
Arguments:
|
|
152
|
+
id Account/workspace ID
|
|
153
|
+
|
|
154
|
+
Options:
|
|
155
|
+
-y, --yes Skip the confirmation prompt
|
|
156
|
+
-h, --help display help for command
|
|
157
|
+
```
|
|
158
|
+
|
|
61
159
|
### `assinafy workspaces update`
|
|
62
160
|
|
|
63
161
|
```text
|
|
@@ -66,13 +164,14 @@ Usage: assinafy workspaces update [options] <id>
|
|
|
66
164
|
Update a workspace
|
|
67
165
|
|
|
68
166
|
Arguments:
|
|
69
|
-
id
|
|
167
|
+
id Account/workspace ID
|
|
70
168
|
|
|
71
169
|
Options:
|
|
72
|
-
--name <name>
|
|
73
|
-
--
|
|
74
|
-
--
|
|
75
|
-
-
|
|
170
|
+
--name <name> New name
|
|
171
|
+
--notification-sender <type> Notification sender: User or Account
|
|
172
|
+
--primary-color <hex> Primary brand color (pass empty to clear)
|
|
173
|
+
--secondary-color <hex> Secondary brand color (pass empty to clear)
|
|
174
|
+
-h, --help display help for command
|
|
76
175
|
```
|
|
77
176
|
|
|
78
177
|
### `assinafy workspaces delete`
|
|
@@ -86,7 +185,7 @@ Arguments:
|
|
|
86
185
|
id Account/workspace ID
|
|
87
186
|
|
|
88
187
|
Options:
|
|
188
|
+
--force Cancel an active paid subscription automatically and delete anyway
|
|
89
189
|
-y, --yes Skip the confirmation prompt
|
|
90
190
|
-h, --help display help for command
|
|
91
191
|
```
|
|
92
|
-
|
package/install.ps1
CHANGED
|
@@ -40,12 +40,51 @@ function Add-UserPath([string]$Directory) {
|
|
|
40
40
|
$env:Path = "$Directory;$env:Path"
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function Test-ArchiveLayout([string]$Archive, [string]$Target) {
|
|
44
|
+
$entries = @(& tar -tzf $Archive)
|
|
45
|
+
if ($LASTEXITCODE -ne 0) {
|
|
46
|
+
Fail "Unable to read release archive"
|
|
47
|
+
}
|
|
48
|
+
$expectedExecutables = if ($Target.StartsWith("windows-")) {
|
|
49
|
+
@("assinafy.cmd", "assinafy.cjs")
|
|
50
|
+
} else {
|
|
51
|
+
@("assinafy")
|
|
52
|
+
}
|
|
53
|
+
$counts = @{}
|
|
54
|
+
foreach ($entry in $entries) {
|
|
55
|
+
if ([string]::IsNullOrEmpty($entry) -or $entry.StartsWith("/") -or
|
|
56
|
+
$entry.Contains("\") -or $entry -match '(^|/)\.\.(/|$)' -or
|
|
57
|
+
$entry -match '[\x00-\x1F\x7F]') {
|
|
58
|
+
Fail "Release archive contained an unsafe path"
|
|
59
|
+
}
|
|
60
|
+
$allowed = $expectedExecutables -ccontains $entry -or
|
|
61
|
+
$entry -cin @("VERSION", "README.md", "LICENSE", "THIRD_PARTY_NOTICES.md") -or
|
|
62
|
+
$entry -cmatch '^docs/[^/]+\.md$' -or $entry -ceq "docs/api-operations.json"
|
|
63
|
+
if (-not $allowed) {
|
|
64
|
+
Fail "Release archive contained an unexpected path: $entry"
|
|
65
|
+
}
|
|
66
|
+
$counts[$entry] = 1 + [int]($counts[$entry])
|
|
67
|
+
}
|
|
68
|
+
if ([int]($counts["VERSION"]) -ne 1) {
|
|
69
|
+
Fail "Release archive must contain exactly one VERSION file"
|
|
70
|
+
}
|
|
71
|
+
foreach ($expected in $expectedExecutables) {
|
|
72
|
+
if ([int]($counts[$expected]) -ne 1) {
|
|
73
|
+
Fail "Release archive must contain exactly one $expected file"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if ($MyInvocation.InvocationName -eq ".") {
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
43
82
|
Require-Command "node"
|
|
44
83
|
Require-Command "tar"
|
|
45
84
|
|
|
46
|
-
$
|
|
47
|
-
if ($
|
|
48
|
-
Fail "Node.js
|
|
85
|
+
$nodeSupported = & node -p "const [major, minor] = process.versions.node.split('.').map(Number); major > 22 || (major === 22 && minor >= 12)"
|
|
86
|
+
if ($nodeSupported -ne "true") {
|
|
87
|
+
Fail "Node.js 22.12+ is required. Found: $(& node --version)"
|
|
49
88
|
}
|
|
50
89
|
|
|
51
90
|
$archName = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
|
|
@@ -80,45 +119,110 @@ $baseUrl = "$($githubBase.TrimEnd('/'))/$repo"
|
|
|
80
119
|
$cleanVersion = $Version.TrimStart("v")
|
|
81
120
|
if ([string]::IsNullOrWhiteSpace($cleanVersion)) {
|
|
82
121
|
$url = "$baseUrl/releases/latest/download/assinafy-$target.tar.gz"
|
|
122
|
+
$sumsUrl = "$baseUrl/releases/latest/download/SHA256SUMS"
|
|
83
123
|
} elseif ($cleanVersion -match "^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$") {
|
|
84
124
|
$url = "$baseUrl/releases/download/v$cleanVersion/assinafy-$target.tar.gz"
|
|
125
|
+
$sumsUrl = "$baseUrl/releases/download/v$cleanVersion/SHA256SUMS"
|
|
85
126
|
} else {
|
|
86
127
|
Fail "Version must be a semantic version, for example v1.0.0"
|
|
87
128
|
}
|
|
88
129
|
|
|
89
130
|
$tmpDir = Join-Path ([IO.Path]::GetTempPath()) "assinafy-$([Guid]::NewGuid())"
|
|
90
131
|
$archive = Join-Path $tmpDir "assinafy.tar.gz"
|
|
132
|
+
$sumsFile = Join-Path $tmpDir "SHA256SUMS"
|
|
91
133
|
$extractDir = Join-Path $tmpDir "extract"
|
|
134
|
+
$cmdReplacement = $null
|
|
135
|
+
$cjsReplacement = $null
|
|
92
136
|
|
|
93
137
|
try {
|
|
94
|
-
New-Item -ItemType Directory -Path $
|
|
138
|
+
New-Item -ItemType Directory -Path $extractDir -Force | Out-Null
|
|
95
139
|
Info "Downloading Assinafy CLI for $target"
|
|
96
140
|
Invoke-WebRequest -Uri $url -OutFile $archive -UseBasicParsing
|
|
141
|
+
|
|
142
|
+
Info "Verifying checksum"
|
|
143
|
+
Invoke-WebRequest -Uri $sumsUrl -OutFile $sumsFile -UseBasicParsing
|
|
144
|
+
$archiveName = "assinafy-$target.tar.gz"
|
|
145
|
+
$expectedHashes = @(Get-Content $sumsFile | ForEach-Object {
|
|
146
|
+
$parts = $_.Trim() -split '\s+'
|
|
147
|
+
if ($parts.Count -eq 2 -and $parts[1] -ceq $archiveName) {
|
|
148
|
+
$parts[0]
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
if ($expectedHashes.Count -ne 1) {
|
|
152
|
+
Fail "SHA256SUMS did not contain an entry for $archiveName"
|
|
153
|
+
}
|
|
154
|
+
$expectedHash = $expectedHashes[0]
|
|
155
|
+
if ($expectedHash -notmatch '^[0-9A-Fa-f]{64}$') {
|
|
156
|
+
Fail "SHA256SUMS contained an invalid hash for $archiveName"
|
|
157
|
+
}
|
|
158
|
+
$expectedHash = $expectedHash.ToLowerInvariant()
|
|
159
|
+
$actualHash = (Get-FileHash -Path $archive -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
160
|
+
if ($actualHash -ne $expectedHash) {
|
|
161
|
+
Fail "Checksum mismatch for ${archiveName}: expected $expectedHash, got $actualHash"
|
|
162
|
+
}
|
|
163
|
+
Test-ArchiveLayout $archive $target
|
|
164
|
+
|
|
97
165
|
tar -xzf $archive -C $extractDir
|
|
166
|
+
$unsafeEntry = Get-ChildItem $extractDir -Recurse -Force | Where-Object {
|
|
167
|
+
($_.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0
|
|
168
|
+
} | Select-Object -First 1
|
|
169
|
+
if ($unsafeEntry) {
|
|
170
|
+
Fail "Release archive contained a link or special file"
|
|
171
|
+
}
|
|
98
172
|
|
|
99
173
|
$cmdSource = Join-Path $extractDir "assinafy.cmd"
|
|
100
174
|
$cjsSource = Join-Path $extractDir "assinafy.cjs"
|
|
101
175
|
if (-not (Test-Path $cmdSource) -or -not (Test-Path $cjsSource)) {
|
|
102
176
|
Fail "Release archive did not contain the Windows Assinafy executable"
|
|
103
177
|
}
|
|
178
|
+
$versionFile = Join-Path $extractDir "VERSION"
|
|
179
|
+
if (-not (Test-Path $versionFile)) {
|
|
180
|
+
Fail "Release archive did not contain VERSION"
|
|
181
|
+
}
|
|
182
|
+
$archiveVersion = (Get-Content $versionFile -Raw).Trim()
|
|
183
|
+
if ($archiveVersion -notmatch "^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$") {
|
|
184
|
+
Fail "Release archive contained an invalid VERSION"
|
|
185
|
+
}
|
|
186
|
+
if (-not [string]::IsNullOrWhiteSpace($cleanVersion) -and $archiveVersion -cne $cleanVersion) {
|
|
187
|
+
Fail "Release archive version $archiveVersion does not match requested version $cleanVersion"
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
$stagedVersion = (& $cmdSource --version | Out-String).Trim()
|
|
191
|
+
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($stagedVersion)) {
|
|
192
|
+
Fail "Installed executable did not run. Confirm Node.js 22.12+ is available on PATH."
|
|
193
|
+
}
|
|
194
|
+
if ($stagedVersion -cne "@assinafy/cli v$archiveVersion") {
|
|
195
|
+
Fail "Executable version does not match archive VERSION: $stagedVersion"
|
|
196
|
+
}
|
|
104
197
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
198
|
+
New-Item -ItemType Directory -Path $binDir -Force | Out-Null
|
|
199
|
+
$cmdReplacement = Join-Path $binDir ".assinafy-$([Guid]::NewGuid()).cmd"
|
|
200
|
+
$cjsReplacement = Join-Path $binDir ".assinafy-$([Guid]::NewGuid()).cjs"
|
|
201
|
+
Copy-Item $cmdSource $cmdReplacement
|
|
202
|
+
Copy-Item $cjsSource $cjsReplacement
|
|
203
|
+
Move-Item $cjsReplacement (Join-Path $binDir "assinafy.cjs") -Force
|
|
204
|
+
$cjsReplacement = $null
|
|
205
|
+
Move-Item $cmdReplacement $exe -Force
|
|
206
|
+
$cmdReplacement = $null
|
|
207
|
+
|
|
208
|
+
foreach ($file in @("README.md", "LICENSE", "THIRD_PARTY_NOTICES.md", "VERSION")) {
|
|
108
209
|
$source = Join-Path $extractDir $file
|
|
109
210
|
if (Test-Path $source) {
|
|
110
211
|
Copy-Item $source (Join-Path $installDir $file) -Force
|
|
111
212
|
}
|
|
112
213
|
}
|
|
113
214
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if ([string]::IsNullOrWhiteSpace($installedVersion)) {
|
|
117
|
-
Fail "Installed executable did not run. Confirm Node.js 18+ is available on PATH."
|
|
215
|
+
if ($env:ASSINAFY_NO_PATH_UPDATE -ne "1") {
|
|
216
|
+
Add-UserPath $binDir
|
|
118
217
|
}
|
|
119
|
-
|
|
120
|
-
Success "Installed $installedVersion to $exe"
|
|
218
|
+
Success "Installed $stagedVersion to $exe"
|
|
121
219
|
Write-Host "Open a new terminal if assinafy is not immediately available on PATH."
|
|
122
220
|
} finally {
|
|
221
|
+
if ($cmdReplacement) {
|
|
222
|
+
Remove-Item $cmdReplacement -Force -ErrorAction SilentlyContinue
|
|
223
|
+
}
|
|
224
|
+
if ($cjsReplacement) {
|
|
225
|
+
Remove-Item $cjsReplacement -Force -ErrorAction SilentlyContinue
|
|
226
|
+
}
|
|
123
227
|
Remove-Item $tmpDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
124
228
|
}
|