@socketsecurity/lib 5.15.0 → 5.16.0
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 +10 -0
- package/README.md +2 -2
- package/dist/abort.d.ts +13 -0
- package/dist/agent.d.ts +81 -0
- package/dist/ansi.d.ts +13 -0
- package/dist/archives.d.ts +31 -0
- package/dist/argv/flags.d.ts +91 -0
- package/dist/argv/parse.d.ts +31 -0
- package/dist/bin.d.ts +54 -0
- package/dist/cacache.d.ts +38 -0
- package/dist/cache-with-ttl.d.ts +7 -0
- package/dist/colors.d.ts +12 -0
- package/dist/cover/formatters.d.ts +18 -0
- package/dist/debug.d.ts +6 -0
- package/dist/dlx/binary.d.ts +84 -0
- package/dist/dlx/cache.d.ts +6 -0
- package/dist/dlx/detect.d.ts +33 -0
- package/dist/dlx/dir.d.ts +34 -0
- package/dist/dlx/manifest.d.ts +16 -0
- package/dist/dlx/package.d.ts +43 -0
- package/dist/dlx/packages.d.ts +36 -0
- package/dist/dlx/paths.d.ts +20 -0
- package/dist/dlx/paths.js +1 -1
- package/dist/effects/pulse-frames.d.ts +6 -0
- package/dist/effects/text-shimmer.d.ts +9 -0
- package/dist/effects/ultra.d.ts +6 -0
- package/dist/env/ci.d.ts +14 -0
- package/dist/env/debug.d.ts +13 -0
- package/dist/env/github.d.ts +80 -0
- package/dist/env/helpers.d.ts +45 -0
- package/dist/env/home.d.ts +13 -0
- package/dist/env/locale.d.ts +30 -0
- package/dist/env/node-auth-token.d.ts +13 -0
- package/dist/env/node-env.d.ts +13 -0
- package/dist/env/npm.d.ts +50 -0
- package/dist/env/path.d.ts +13 -0
- package/dist/env/pre-commit.d.ts +14 -0
- package/dist/env/rewire.d.ts +38 -0
- package/dist/env/shell.d.ts +13 -0
- package/dist/env/socket-cli-shadow.d.ts +43 -0
- package/dist/env/socket-cli.d.ts +116 -0
- package/dist/env/socket.d.ts +153 -0
- package/dist/env/temp-dir.d.ts +30 -0
- package/dist/env/term.d.ts +13 -0
- package/dist/env/test.d.ts +32 -0
- package/dist/env/windows.d.ts +40 -0
- package/dist/env/xdg.d.ts +30 -0
- package/dist/env.d.ts +40 -0
- package/dist/external/npm-pack.js +202 -291
- package/dist/external/tar-fs.js +27 -7
- package/dist/fs.d.ts +13 -0
- package/dist/functions.d.ts +30 -0
- package/dist/globs.d.ts +27 -0
- package/dist/http-request.d.ts +16 -0
- package/dist/json/format.d.ts +18 -0
- package/dist/memoization.d.ts +5 -0
- package/dist/packages/edit.d.ts +28 -0
- package/dist/packages/exports.d.ts +40 -0
- package/dist/packages/licenses.d.ts +59 -0
- package/dist/packages/manifest.d.ts +18 -0
- package/dist/packages/normalize.d.ts +22 -0
- package/dist/packages/operations.d.ts +51 -0
- package/dist/packages/provenance.d.ts +11 -0
- package/dist/packages/specs.d.ts +30 -0
- package/dist/packages/validation.d.ts +18 -0
- package/dist/paths/normalize.d.ts +49 -5
- package/dist/paths/normalize.js +13 -0
- package/dist/paths/rewire.js +12 -3
- package/dist/regexps.d.ts +7 -0
- package/dist/releases/github.d.ts +63 -0
- package/dist/releases/socket-btm.d.ts +31 -0
- package/dist/sea.d.ts +15 -0
- package/dist/shadow.d.ts +7 -0
- package/dist/signal-exit.d.ts +27 -0
- package/dist/sorts.d.ts +33 -0
- package/dist/spawn.d.ts +9 -0
- package/dist/stdio/mask.d.ts +26 -0
- package/dist/streams.d.ts +28 -0
- package/dist/suppress-warnings.d.ts +7 -0
- package/dist/temporary-executor.d.ts +7 -0
- package/dist/url.d.ts +59 -0
- package/dist/versions.d.ts +119 -0
- package/dist/words.d.ts +20 -0
- package/package.json +7 -57
package/dist/env/socket-cli.d.ts
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
* Whether to accept all Socket CLI risks (alternative name).
|
|
3
3
|
*
|
|
4
4
|
* @returns Whether to accept all risks
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getSocketCliAcceptRisks } from '@socketsecurity/lib/env/socket-cli'
|
|
9
|
+
*
|
|
10
|
+
* if (getSocketCliAcceptRisks()) {
|
|
11
|
+
* console.log('All risks accepted')
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
5
14
|
*/
|
|
6
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
7
16
|
export declare function getSocketCliAcceptRisks(): boolean;
|
|
@@ -10,6 +19,14 @@ export declare function getSocketCliAcceptRisks(): boolean;
|
|
|
10
19
|
* Checks SOCKET_CLI_API_BASE_URL first, then falls back to legacy SOCKET_SECURITY_API_BASE_URL.
|
|
11
20
|
*
|
|
12
21
|
* @returns API base URL or undefined
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getSocketCliApiBaseUrl } from '@socketsecurity/lib/env/socket-cli'
|
|
26
|
+
*
|
|
27
|
+
* const baseUrl = getSocketCliApiBaseUrl()
|
|
28
|
+
* // e.g. 'https://api.socket.dev' or undefined
|
|
29
|
+
* ```
|
|
13
30
|
*/
|
|
14
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
15
32
|
export declare function getSocketCliApiBaseUrl(): string | undefined;
|
|
@@ -19,6 +36,14 @@ export declare function getSocketCliApiBaseUrl(): string | undefined;
|
|
|
19
36
|
* Follows the same precedence as v1.x: HTTPS_PROXY → https_proxy → HTTP_PROXY → http_proxy.
|
|
20
37
|
*
|
|
21
38
|
* @returns API proxy URL or undefined
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { getSocketCliApiProxy } from '@socketsecurity/lib/env/socket-cli'
|
|
43
|
+
*
|
|
44
|
+
* const proxy = getSocketCliApiProxy()
|
|
45
|
+
* // e.g. 'http://proxy.example.com:8080' or undefined
|
|
46
|
+
* ```
|
|
22
47
|
*/
|
|
23
48
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
49
|
export declare function getSocketCliApiProxy(): string | undefined;
|
|
@@ -26,6 +51,14 @@ export declare function getSocketCliApiProxy(): string | undefined;
|
|
|
26
51
|
* Timeout in milliseconds for Socket CLI API requests (alternative name).
|
|
27
52
|
*
|
|
28
53
|
* @returns API timeout in milliseconds
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { getSocketCliApiTimeout } from '@socketsecurity/lib/env/socket-cli'
|
|
58
|
+
*
|
|
59
|
+
* const timeout = getSocketCliApiTimeout()
|
|
60
|
+
* // e.g. 30000 or 0 if not set
|
|
61
|
+
* ```
|
|
29
62
|
*/
|
|
30
63
|
/*@__NO_SIDE_EFFECTS__*/
|
|
31
64
|
export declare function getSocketCliApiTimeout(): number;
|
|
@@ -35,6 +68,14 @@ export declare function getSocketCliApiTimeout(): number;
|
|
|
35
68
|
* Maintains full v1.x backward compatibility.
|
|
36
69
|
*
|
|
37
70
|
* @returns API token or undefined
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { getSocketCliApiToken } from '@socketsecurity/lib/env/socket-cli'
|
|
75
|
+
*
|
|
76
|
+
* const token = getSocketCliApiToken()
|
|
77
|
+
* // e.g. a Socket API token string or undefined
|
|
78
|
+
* ```
|
|
38
79
|
*/
|
|
39
80
|
/*@__NO_SIDE_EFFECTS__*/
|
|
40
81
|
export declare function getSocketCliApiToken(): string | undefined;
|
|
@@ -43,6 +84,14 @@ export declare function getSocketCliApiToken(): string | undefined;
|
|
|
43
84
|
* Set by bootstrap wrappers to pass dlx cache location to CLI.
|
|
44
85
|
*
|
|
45
86
|
* @returns Bootstrap cache directory or undefined
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import { getSocketCliBootstrapCacheDir } from '@socketsecurity/lib/env/socket-cli'
|
|
91
|
+
*
|
|
92
|
+
* const cacheDir = getSocketCliBootstrapCacheDir()
|
|
93
|
+
* // e.g. '/tmp/.socket-cli-cache' or undefined
|
|
94
|
+
* ```
|
|
46
95
|
*/
|
|
47
96
|
/*@__NO_SIDE_EFFECTS__*/
|
|
48
97
|
export declare function getSocketCliBootstrapCacheDir(): string | undefined;
|
|
@@ -51,6 +100,14 @@ export declare function getSocketCliBootstrapCacheDir(): string | undefined;
|
|
|
51
100
|
* Set by bootstrap wrappers (SEA/smol/npm) to pass package spec to CLI.
|
|
52
101
|
*
|
|
53
102
|
* @returns Bootstrap package spec or undefined
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* import { getSocketCliBootstrapSpec } from '@socketsecurity/lib/env/socket-cli'
|
|
107
|
+
*
|
|
108
|
+
* const spec = getSocketCliBootstrapSpec()
|
|
109
|
+
* // e.g. '@socketsecurity/cli@^2.0.11' or undefined
|
|
110
|
+
* ```
|
|
54
111
|
*/
|
|
55
112
|
/*@__NO_SIDE_EFFECTS__*/
|
|
56
113
|
export declare function getSocketCliBootstrapSpec(): string | undefined;
|
|
@@ -58,6 +115,14 @@ export declare function getSocketCliBootstrapSpec(): string | undefined;
|
|
|
58
115
|
* Socket CLI configuration file path (alternative name).
|
|
59
116
|
*
|
|
60
117
|
* @returns Config file path or undefined
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* import { getSocketCliConfig } from '@socketsecurity/lib/env/socket-cli'
|
|
122
|
+
*
|
|
123
|
+
* const config = getSocketCliConfig()
|
|
124
|
+
* // e.g. '/tmp/project/socket.yml' or undefined
|
|
125
|
+
* ```
|
|
61
126
|
*/
|
|
62
127
|
/*@__NO_SIDE_EFFECTS__*/
|
|
63
128
|
export declare function getSocketCliConfig(): string | undefined;
|
|
@@ -65,6 +130,14 @@ export declare function getSocketCliConfig(): string | undefined;
|
|
|
65
130
|
* Controls Socket CLI fix mode.
|
|
66
131
|
*
|
|
67
132
|
* @returns Fix mode value or undefined
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { getSocketCliFix } from '@socketsecurity/lib/env/socket-cli'
|
|
137
|
+
*
|
|
138
|
+
* const fix = getSocketCliFix()
|
|
139
|
+
* // e.g. 'true' or undefined
|
|
140
|
+
* ```
|
|
68
141
|
*/
|
|
69
142
|
/*@__NO_SIDE_EFFECTS__*/
|
|
70
143
|
export declare function getSocketCliFix(): string | undefined;
|
|
@@ -73,6 +146,14 @@ export declare function getSocketCliFix(): string | undefined;
|
|
|
73
146
|
* Checks SOCKET_CLI_GITHUB_TOKEN, SOCKET_SECURITY_GITHUB_PAT, then falls back to GITHUB_TOKEN.
|
|
74
147
|
*
|
|
75
148
|
* @returns GitHub token or undefined
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* import { getSocketCliGithubToken } from '@socketsecurity/lib/env/socket-cli'
|
|
153
|
+
*
|
|
154
|
+
* const token = getSocketCliGithubToken()
|
|
155
|
+
* // e.g. 'ghp_abc123...' or undefined
|
|
156
|
+
* ```
|
|
76
157
|
*/
|
|
77
158
|
/*@__NO_SIDE_EFFECTS__*/
|
|
78
159
|
export declare function getSocketCliGithubToken(): string | undefined;
|
|
@@ -80,6 +161,15 @@ export declare function getSocketCliGithubToken(): string | undefined;
|
|
|
80
161
|
* Whether to skip Socket CLI API token requirement (alternative name).
|
|
81
162
|
*
|
|
82
163
|
* @returns Whether to skip API token requirement
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* import { getSocketCliNoApiToken } from '@socketsecurity/lib/env/socket-cli'
|
|
168
|
+
*
|
|
169
|
+
* if (getSocketCliNoApiToken()) {
|
|
170
|
+
* console.log('API token requirement skipped')
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
83
173
|
*/
|
|
84
174
|
/*@__NO_SIDE_EFFECTS__*/
|
|
85
175
|
export declare function getSocketCliNoApiToken(): boolean;
|
|
@@ -87,6 +177,15 @@ export declare function getSocketCliNoApiToken(): boolean;
|
|
|
87
177
|
* Controls Socket CLI optimization mode.
|
|
88
178
|
*
|
|
89
179
|
* @returns Whether optimization mode is enabled
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* import { getSocketCliOptimize } from '@socketsecurity/lib/env/socket-cli'
|
|
184
|
+
*
|
|
185
|
+
* if (getSocketCliOptimize()) {
|
|
186
|
+
* console.log('Optimization mode enabled')
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
90
189
|
*/
|
|
91
190
|
/*@__NO_SIDE_EFFECTS__*/
|
|
92
191
|
export declare function getSocketCliOptimize(): boolean;
|
|
@@ -95,6 +194,14 @@ export declare function getSocketCliOptimize(): boolean;
|
|
|
95
194
|
* Checks SOCKET_CLI_ORG_SLUG first, then falls back to SOCKET_ORG_SLUG.
|
|
96
195
|
*
|
|
97
196
|
* @returns Organization slug or undefined
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* import { getSocketCliOrgSlug } from '@socketsecurity/lib/env/socket-cli'
|
|
201
|
+
*
|
|
202
|
+
* const slug = getSocketCliOrgSlug()
|
|
203
|
+
* // e.g. 'my-org' or undefined
|
|
204
|
+
* ```
|
|
98
205
|
*/
|
|
99
206
|
/*@__NO_SIDE_EFFECTS__*/
|
|
100
207
|
export declare function getSocketCliOrgSlug(): string | undefined;
|
|
@@ -102,6 +209,15 @@ export declare function getSocketCliOrgSlug(): string | undefined;
|
|
|
102
209
|
* Whether to view all Socket CLI risks (alternative name).
|
|
103
210
|
*
|
|
104
211
|
* @returns Whether to view all risks
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* import { getSocketCliViewAllRisks } from '@socketsecurity/lib/env/socket-cli'
|
|
216
|
+
*
|
|
217
|
+
* if (getSocketCliViewAllRisks()) {
|
|
218
|
+
* console.log('Viewing all risks')
|
|
219
|
+
* }
|
|
220
|
+
* ```
|
|
105
221
|
*/
|
|
106
222
|
/*@__NO_SIDE_EFFECTS__*/
|
|
107
223
|
export declare function getSocketCliViewAllRisks(): boolean;
|
package/dist/env/socket.d.ts
CHANGED
|
@@ -1,90 +1,243 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SOCKET_ACCEPT_RISKS environment variable getter.
|
|
3
3
|
* Whether to accept all Socket Security risks.
|
|
4
|
+
*
|
|
5
|
+
* @returns `true` if risks are accepted, `false` otherwise
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getSocketAcceptRisks } from '@socketsecurity/lib/env/socket'
|
|
10
|
+
*
|
|
11
|
+
* if (getSocketAcceptRisks()) {
|
|
12
|
+
* console.log('All risks accepted')
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
4
15
|
*/
|
|
5
16
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
17
|
export declare function getSocketAcceptRisks(): boolean;
|
|
7
18
|
/**
|
|
8
19
|
* SOCKET_API_BASE_URL environment variable getter.
|
|
9
20
|
* Socket Security API base URL.
|
|
21
|
+
*
|
|
22
|
+
* @returns The API base URL, or `undefined` if not set
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { getSocketApiBaseUrl } from '@socketsecurity/lib/env/socket'
|
|
27
|
+
*
|
|
28
|
+
* const baseUrl = getSocketApiBaseUrl()
|
|
29
|
+
* // e.g. 'https://api.socket.dev' or undefined
|
|
30
|
+
* ```
|
|
10
31
|
*/
|
|
11
32
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
33
|
export declare function getSocketApiBaseUrl(): string | undefined;
|
|
13
34
|
/**
|
|
14
35
|
* SOCKET_API_PROXY environment variable getter.
|
|
15
36
|
* Proxy URL for Socket Security API requests.
|
|
37
|
+
*
|
|
38
|
+
* @returns The API proxy URL, or `undefined` if not set
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { getSocketApiProxy } from '@socketsecurity/lib/env/socket'
|
|
43
|
+
*
|
|
44
|
+
* const proxy = getSocketApiProxy()
|
|
45
|
+
* // e.g. 'http://proxy.example.com:8080' or undefined
|
|
46
|
+
* ```
|
|
16
47
|
*/
|
|
17
48
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
49
|
export declare function getSocketApiProxy(): string | undefined;
|
|
19
50
|
/**
|
|
20
51
|
* SOCKET_API_TIMEOUT environment variable getter.
|
|
21
52
|
* Timeout in milliseconds for Socket Security API requests.
|
|
53
|
+
*
|
|
54
|
+
* @returns The timeout in milliseconds, or `0` if not set
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { getSocketApiTimeout } from '@socketsecurity/lib/env/socket'
|
|
59
|
+
*
|
|
60
|
+
* const timeout = getSocketApiTimeout()
|
|
61
|
+
* // e.g. 30000 or 0 if not set
|
|
62
|
+
* ```
|
|
22
63
|
*/
|
|
23
64
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
65
|
export declare function getSocketApiTimeout(): number;
|
|
25
66
|
/**
|
|
26
67
|
* SOCKET_API_TOKEN environment variable getter.
|
|
27
68
|
* Socket Security API authentication token.
|
|
69
|
+
*
|
|
70
|
+
* @returns The API token, or `undefined` if not set
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { getSocketApiToken } from '@socketsecurity/lib/env/socket'
|
|
75
|
+
*
|
|
76
|
+
* const token = getSocketApiToken()
|
|
77
|
+
* // e.g. a Socket API token string or undefined
|
|
78
|
+
* ```
|
|
28
79
|
*/
|
|
29
80
|
/*@__NO_SIDE_EFFECTS__*/
|
|
30
81
|
export declare function getSocketApiToken(): string | undefined;
|
|
31
82
|
/**
|
|
32
83
|
* SOCKET_CACACHE_DIR environment variable getter.
|
|
33
84
|
* Overrides the default Socket cacache directory location.
|
|
85
|
+
*
|
|
86
|
+
* @returns The cacache directory path, or `undefined` if not set
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import { getSocketCacacheDir } from '@socketsecurity/lib/env/socket'
|
|
91
|
+
*
|
|
92
|
+
* const dir = getSocketCacacheDir()
|
|
93
|
+
* // e.g. '/tmp/.socket-cache' or undefined
|
|
94
|
+
* ```
|
|
34
95
|
*/
|
|
35
96
|
/*@__NO_SIDE_EFFECTS__*/
|
|
36
97
|
export declare function getSocketCacacheDir(): string | undefined;
|
|
37
98
|
/**
|
|
38
99
|
* SOCKET_CONFIG environment variable getter.
|
|
39
100
|
* Socket Security configuration file path.
|
|
101
|
+
*
|
|
102
|
+
* @returns The config file path, or `undefined` if not set
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* import { getSocketConfig } from '@socketsecurity/lib/env/socket'
|
|
107
|
+
*
|
|
108
|
+
* const config = getSocketConfig()
|
|
109
|
+
* // e.g. '/tmp/project/socket.yml' or undefined
|
|
110
|
+
* ```
|
|
40
111
|
*/
|
|
41
112
|
/*@__NO_SIDE_EFFECTS__*/
|
|
42
113
|
export declare function getSocketConfig(): string | undefined;
|
|
43
114
|
/**
|
|
44
115
|
* SOCKET_DEBUG environment variable getter.
|
|
45
116
|
* Controls Socket-specific debug output.
|
|
117
|
+
*
|
|
118
|
+
* @returns The Socket debug filter, or `undefined` if not set
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* import { getSocketDebug } from '@socketsecurity/lib/env/socket'
|
|
123
|
+
*
|
|
124
|
+
* const debug = getSocketDebug()
|
|
125
|
+
* // e.g. '*' or 'api' or undefined
|
|
126
|
+
* ```
|
|
46
127
|
*/
|
|
47
128
|
/*@__NO_SIDE_EFFECTS__*/
|
|
48
129
|
export declare function getSocketDebug(): string | undefined;
|
|
49
130
|
/**
|
|
50
131
|
* SOCKET_DLX_DIR environment variable getter.
|
|
51
132
|
* Overrides the default Socket DLX directory location.
|
|
133
|
+
*
|
|
134
|
+
* @returns The DLX directory path, or `undefined` if not set
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* import { getSocketDlxDirEnv } from '@socketsecurity/lib/env/socket'
|
|
139
|
+
*
|
|
140
|
+
* const dlxDir = getSocketDlxDirEnv()
|
|
141
|
+
* // e.g. '/tmp/.socket-dlx' or undefined
|
|
142
|
+
* ```
|
|
52
143
|
*/
|
|
53
144
|
/*@__NO_SIDE_EFFECTS__*/
|
|
54
145
|
export declare function getSocketDlxDirEnv(): string | undefined;
|
|
55
146
|
/**
|
|
56
147
|
* SOCKET_HOME environment variable getter.
|
|
57
148
|
* Socket Security home directory path.
|
|
149
|
+
*
|
|
150
|
+
* @returns The Socket home directory, or `undefined` if not set
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* import { getSocketHome } from '@socketsecurity/lib/env/socket'
|
|
155
|
+
*
|
|
156
|
+
* const home = getSocketHome()
|
|
157
|
+
* // e.g. '/tmp/.socket' or undefined
|
|
158
|
+
* ```
|
|
58
159
|
*/
|
|
59
160
|
/*@__NO_SIDE_EFFECTS__*/
|
|
60
161
|
export declare function getSocketHome(): string | undefined;
|
|
61
162
|
/**
|
|
62
163
|
* SOCKET_NO_API_TOKEN environment variable getter.
|
|
63
164
|
* Whether to skip Socket Security API token requirement.
|
|
165
|
+
*
|
|
166
|
+
* @returns `true` if the API token requirement is skipped, `false` otherwise
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* import { getSocketNoApiToken } from '@socketsecurity/lib/env/socket'
|
|
171
|
+
*
|
|
172
|
+
* if (getSocketNoApiToken()) {
|
|
173
|
+
* console.log('API token requirement skipped')
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
64
176
|
*/
|
|
65
177
|
/*@__NO_SIDE_EFFECTS__*/
|
|
66
178
|
export declare function getSocketNoApiToken(): boolean;
|
|
67
179
|
/**
|
|
68
180
|
* SOCKET_NPM_REGISTRY environment variable getter.
|
|
69
181
|
* Socket NPM registry URL (alternative name).
|
|
182
|
+
*
|
|
183
|
+
* @returns The Socket NPM registry URL, or `undefined` if not set
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* import { getSocketNpmRegistry } from '@socketsecurity/lib/env/socket'
|
|
188
|
+
*
|
|
189
|
+
* const registry = getSocketNpmRegistry()
|
|
190
|
+
* // e.g. 'https://npm.socket.dev/' or undefined
|
|
191
|
+
* ```
|
|
70
192
|
*/
|
|
71
193
|
/*@__NO_SIDE_EFFECTS__*/
|
|
72
194
|
export declare function getSocketNpmRegistry(): string | undefined;
|
|
73
195
|
/**
|
|
74
196
|
* SOCKET_ORG_SLUG environment variable getter.
|
|
75
197
|
* Socket Security organization slug identifier.
|
|
198
|
+
*
|
|
199
|
+
* @returns The organization slug, or `undefined` if not set
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* import { getSocketOrgSlug } from '@socketsecurity/lib/env/socket'
|
|
204
|
+
*
|
|
205
|
+
* const slug = getSocketOrgSlug()
|
|
206
|
+
* // e.g. 'my-org' or undefined
|
|
207
|
+
* ```
|
|
76
208
|
*/
|
|
77
209
|
/*@__NO_SIDE_EFFECTS__*/
|
|
78
210
|
export declare function getSocketOrgSlug(): string | undefined;
|
|
79
211
|
/**
|
|
80
212
|
* SOCKET_REGISTRY_URL environment variable getter.
|
|
81
213
|
* Socket Registry URL for package installation.
|
|
214
|
+
*
|
|
215
|
+
* @returns The Socket registry URL, or `undefined` if not set
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* import { getSocketRegistryUrl } from '@socketsecurity/lib/env/socket'
|
|
220
|
+
*
|
|
221
|
+
* const registryUrl = getSocketRegistryUrl()
|
|
222
|
+
* // e.g. 'https://registry.socket.dev/' or undefined
|
|
223
|
+
* ```
|
|
82
224
|
*/
|
|
83
225
|
/*@__NO_SIDE_EFFECTS__*/
|
|
84
226
|
export declare function getSocketRegistryUrl(): string | undefined;
|
|
85
227
|
/**
|
|
86
228
|
* SOCKET_VIEW_ALL_RISKS environment variable getter.
|
|
87
229
|
* Whether to view all Socket Security risks.
|
|
230
|
+
*
|
|
231
|
+
* @returns `true` if viewing all risks, `false` otherwise
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* import { getSocketViewAllRisks } from '@socketsecurity/lib/env/socket'
|
|
236
|
+
*
|
|
237
|
+
* if (getSocketViewAllRisks()) {
|
|
238
|
+
* console.log('Viewing all risks')
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
88
241
|
*/
|
|
89
242
|
/*@__NO_SIDE_EFFECTS__*/
|
|
90
243
|
export declare function getSocketViewAllRisks(): boolean;
|
package/dist/env/temp-dir.d.ts
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TEMP environment variable.
|
|
3
3
|
* Windows temporary directory path.
|
|
4
|
+
*
|
|
5
|
+
* @returns The Windows temp directory path, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getTemp } from '@socketsecurity/lib/env/temp-dir'
|
|
10
|
+
*
|
|
11
|
+
* const temp = getTemp()
|
|
12
|
+
* // e.g. 'C:\\Windows\\Temp' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getTemp(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* TMP environment variable.
|
|
9
19
|
* Alternative temporary directory path.
|
|
20
|
+
*
|
|
21
|
+
* @returns The alternative temp directory path, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getTmp } from '@socketsecurity/lib/env/temp-dir'
|
|
26
|
+
*
|
|
27
|
+
* const tmp = getTmp()
|
|
28
|
+
* // e.g. '/tmp' or undefined
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getTmp(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* TMPDIR environment variable.
|
|
15
35
|
* Unix/macOS temporary directory path.
|
|
36
|
+
*
|
|
37
|
+
* @returns The Unix/macOS temp directory path, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getTmpdir } from '@socketsecurity/lib/env/temp-dir'
|
|
42
|
+
*
|
|
43
|
+
* const tmpdir = getTmpdir()
|
|
44
|
+
* // e.g. '/tmp' or undefined
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getTmpdir(): string | undefined;
|
package/dist/env/term.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value of the TERM environment variable.
|
|
3
|
+
*
|
|
4
|
+
* @returns The terminal type identifier, or `undefined` if not set
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { getTerm } from '@socketsecurity/lib/env/term'
|
|
9
|
+
*
|
|
10
|
+
* const term = getTerm()
|
|
11
|
+
* // e.g. 'xterm-256color' or undefined
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
/*@__NO_SIDE_EFFECTS__*/
|
|
2
15
|
export declare function getTerm(): string | undefined;
|
package/dist/env/test.d.ts
CHANGED
|
@@ -1,18 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JEST_WORKER_ID environment variable.
|
|
3
3
|
* Set when running tests with Jest.
|
|
4
|
+
*
|
|
5
|
+
* @returns The Jest worker ID string, or empty string if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getJestWorkerId } from '@socketsecurity/lib/env/test'
|
|
10
|
+
*
|
|
11
|
+
* const workerId = getJestWorkerId()
|
|
12
|
+
* // e.g. '1' when running in Jest, or ''
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getJestWorkerId(): string;
|
|
7
17
|
/**
|
|
8
18
|
* VITEST environment variable.
|
|
9
19
|
* Set when running tests with Vitest.
|
|
20
|
+
*
|
|
21
|
+
* @returns `true` if running in Vitest, `false` otherwise
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getVitest } from '@socketsecurity/lib/env/test'
|
|
26
|
+
*
|
|
27
|
+
* if (getVitest()) {
|
|
28
|
+
* console.log('Running in Vitest')
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
10
31
|
*/
|
|
11
32
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
33
|
export declare function getVitest(): boolean;
|
|
13
34
|
/**
|
|
14
35
|
* Check if code is running in a test environment.
|
|
15
36
|
* Checks NODE_ENV, VITEST, and JEST_WORKER_ID.
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if running in a test environment, `false` otherwise
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { isTest } from '@socketsecurity/lib/env/test'
|
|
43
|
+
*
|
|
44
|
+
* if (isTest()) {
|
|
45
|
+
* console.log('Running in test environment')
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
16
48
|
*/
|
|
17
49
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
50
|
export declare function isTest(): boolean;
|
package/dist/env/windows.d.ts
CHANGED
|
@@ -1,24 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* APPDATA environment variable.
|
|
3
3
|
* Points to the Application Data directory on Windows.
|
|
4
|
+
*
|
|
5
|
+
* @returns The Windows AppData roaming directory, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getAppdata } from '@socketsecurity/lib/env/windows'
|
|
10
|
+
*
|
|
11
|
+
* const appdata = getAppdata()
|
|
12
|
+
* // e.g. 'C:\\Users\\Public\\AppData\\Roaming' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getAppdata(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* COMSPEC environment variable.
|
|
9
19
|
* Points to the Windows command processor (typically cmd.exe).
|
|
20
|
+
*
|
|
21
|
+
* @returns The path to the command processor, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getComspec } from '@socketsecurity/lib/env/windows'
|
|
26
|
+
*
|
|
27
|
+
* const comspec = getComspec()
|
|
28
|
+
* // e.g. 'C:\\Windows\\system32\\cmd.exe' or undefined
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getComspec(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* LOCALAPPDATA environment variable.
|
|
15
35
|
* Points to the Local Application Data directory on Windows.
|
|
36
|
+
*
|
|
37
|
+
* @returns The Windows local AppData directory, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getLocalappdata } from '@socketsecurity/lib/env/windows'
|
|
42
|
+
*
|
|
43
|
+
* const localAppdata = getLocalappdata()
|
|
44
|
+
* // e.g. 'C:\\Users\\Public\\AppData\\Local' or undefined
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getLocalappdata(): string | undefined;
|
|
19
49
|
/**
|
|
20
50
|
* USERPROFILE environment variable.
|
|
21
51
|
* Windows user home directory path.
|
|
52
|
+
*
|
|
53
|
+
* @returns The Windows user profile directory, or `undefined` if not set
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { getUserprofile } from '@socketsecurity/lib/env/windows'
|
|
58
|
+
*
|
|
59
|
+
* const userprofile = getUserprofile()
|
|
60
|
+
* // e.g. 'C:\\Users\\Public' or undefined
|
|
61
|
+
* ```
|
|
22
62
|
*/
|
|
23
63
|
/*@__NO_SIDE_EFFECTS__*/
|
|
24
64
|
export declare function getUserprofile(): string | undefined;
|
package/dist/env/xdg.d.ts
CHANGED
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* XDG_CACHE_HOME environment variable.
|
|
3
3
|
* XDG Base Directory specification cache directory.
|
|
4
|
+
*
|
|
5
|
+
* @returns The XDG cache directory path, or `undefined` if not set
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { getXdgCacheHome } from '@socketsecurity/lib/env/xdg'
|
|
10
|
+
*
|
|
11
|
+
* const cacheDir = getXdgCacheHome()
|
|
12
|
+
* // e.g. '/tmp/.cache' or undefined
|
|
13
|
+
* ```
|
|
4
14
|
*/
|
|
5
15
|
/*@__NO_SIDE_EFFECTS__*/
|
|
6
16
|
export declare function getXdgCacheHome(): string | undefined;
|
|
7
17
|
/**
|
|
8
18
|
* XDG_CONFIG_HOME environment variable.
|
|
9
19
|
* XDG Base Directory specification config directory.
|
|
20
|
+
*
|
|
21
|
+
* @returns The XDG config directory path, or `undefined` if not set
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getXdgConfigHome } from '@socketsecurity/lib/env/xdg'
|
|
26
|
+
*
|
|
27
|
+
* const configDir = getXdgConfigHome()
|
|
28
|
+
* // e.g. '/tmp/.config' or undefined
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
/*@__NO_SIDE_EFFECTS__*/
|
|
12
32
|
export declare function getXdgConfigHome(): string | undefined;
|
|
13
33
|
/**
|
|
14
34
|
* XDG_DATA_HOME environment variable.
|
|
15
35
|
* Points to the user's data directory on Unix systems.
|
|
36
|
+
*
|
|
37
|
+
* @returns The XDG data directory path, or `undefined` if not set
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { getXdgDataHome } from '@socketsecurity/lib/env/xdg'
|
|
42
|
+
*
|
|
43
|
+
* const dataDir = getXdgDataHome()
|
|
44
|
+
* // e.g. '/tmp/.local/share' or undefined
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
/*@__NO_SIDE_EFFECTS__*/
|
|
18
48
|
export declare function getXdgDataHome(): string | undefined;
|