ninepm 0.0.1 → 0.24.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 +247 -5
- package/dist/cli-config.d.ts +5 -0
- package/dist/cli-config.js +17 -0
- package/dist/cli-types.d.ts +131 -0
- package/dist/cli-types.js +7 -0
- package/dist/deploy-description.d.ts +11 -0
- package/dist/deploy-description.js +31 -0
- package/dist/deploy-limits.d.ts +7 -0
- package/dist/deploy-limits.js +30 -0
- package/dist/index.d.ts +441 -0
- package/dist/index.js +2521 -0
- package/dist/manifest.d.ts +4 -0
- package/dist/manifest.js +134 -0
- package/package.json +35 -8
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import type { AccessGrant, AccessGrantType, AccessProviderKey, AppAccessSettings, AppAccessServiceToken, AppAccessToken, AppDatabase, AppRuntime, ContainerRegion, Deployment, ManagedFileObject, ManagedFileShare, ManagedFileUsage, Project } from "./cli-types.js";
|
|
3
|
+
export interface DeployOptions {
|
|
4
|
+
directory: string;
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
token: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
slug?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
environment?: string;
|
|
11
|
+
withDatabase?: boolean;
|
|
12
|
+
withAuth?: boolean;
|
|
13
|
+
databaseName?: string;
|
|
14
|
+
bindingName?: string;
|
|
15
|
+
runtime?: AppRuntime;
|
|
16
|
+
entry?: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
healthPath?: string;
|
|
19
|
+
region?: ContainerRegion;
|
|
20
|
+
alwaysOn?: boolean;
|
|
21
|
+
volumeGb?: number;
|
|
22
|
+
allowVolumeDestroy?: boolean;
|
|
23
|
+
allowNamespaceReset?: boolean;
|
|
24
|
+
cpus?: number;
|
|
25
|
+
memoryMb?: number;
|
|
26
|
+
bundleDir?: string;
|
|
27
|
+
noBuild?: boolean;
|
|
28
|
+
pollTimeoutMs?: number;
|
|
29
|
+
fetchFn?: FetchLike;
|
|
30
|
+
check?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface DeployResult {
|
|
33
|
+
project: Project;
|
|
34
|
+
deployment: Deployment;
|
|
35
|
+
database: AppDatabase | null;
|
|
36
|
+
uploaded: number;
|
|
37
|
+
url: string;
|
|
38
|
+
containerImageBytes?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ApiOptions {
|
|
41
|
+
apiUrl: string;
|
|
42
|
+
token: string;
|
|
43
|
+
fetchFn?: FetchLike;
|
|
44
|
+
}
|
|
45
|
+
export interface SiteAccessOptions extends ApiOptions {
|
|
46
|
+
site: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DeleteSiteOptions extends SiteAccessOptions {
|
|
49
|
+
confirmSlug: string;
|
|
50
|
+
}
|
|
51
|
+
export interface AccessState {
|
|
52
|
+
access: AppAccessSettings;
|
|
53
|
+
grants: AccessGrant[];
|
|
54
|
+
appAccessTokens: AppAccessToken[];
|
|
55
|
+
serviceTokens: AppAccessServiceToken[];
|
|
56
|
+
}
|
|
57
|
+
export interface FileCommandOptions extends ApiOptions {
|
|
58
|
+
project?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface FilePutOptions extends FileCommandOptions {
|
|
61
|
+
localPath: string;
|
|
62
|
+
remotePath?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface FileGetOptions extends FileCommandOptions {
|
|
65
|
+
fileId: string;
|
|
66
|
+
outputPath?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface FileDeleteOptions extends FileCommandOptions {
|
|
69
|
+
fileId: string;
|
|
70
|
+
}
|
|
71
|
+
export interface FileShareOptions extends FileCommandOptions {
|
|
72
|
+
fileId: string;
|
|
73
|
+
mode: "public" | "login_required";
|
|
74
|
+
expiresInSeconds: number;
|
|
75
|
+
}
|
|
76
|
+
export interface ManagedFileListResult {
|
|
77
|
+
files: ManagedFileObject[];
|
|
78
|
+
shares: ManagedFileShare[];
|
|
79
|
+
usage: ManagedFileUsage;
|
|
80
|
+
}
|
|
81
|
+
export interface ManagedFilePutResult {
|
|
82
|
+
file: ManagedFileObject;
|
|
83
|
+
usage: ManagedFileUsage;
|
|
84
|
+
}
|
|
85
|
+
export interface ManagedFileShareResult {
|
|
86
|
+
share: ManagedFileShare;
|
|
87
|
+
url: string;
|
|
88
|
+
}
|
|
89
|
+
export interface DeletedSiteResult {
|
|
90
|
+
projectId: string;
|
|
91
|
+
slug: string;
|
|
92
|
+
workers: number;
|
|
93
|
+
customDomains: number;
|
|
94
|
+
containerApplications?: number;
|
|
95
|
+
containerImages?: number;
|
|
96
|
+
accessApps: number;
|
|
97
|
+
serviceTokens: number;
|
|
98
|
+
databases: number;
|
|
99
|
+
files: number;
|
|
100
|
+
artifacts: boolean;
|
|
101
|
+
metadata: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface CreatedRuntimeToken {
|
|
104
|
+
token: string;
|
|
105
|
+
appAccessToken: AppAccessToken;
|
|
106
|
+
}
|
|
107
|
+
export interface CreatedServiceToken {
|
|
108
|
+
serviceToken: AppAccessServiceToken;
|
|
109
|
+
clientSecret: string;
|
|
110
|
+
}
|
|
111
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
112
|
+
export declare const CLI_VERSION = "0.24.1";
|
|
113
|
+
type CredentialBackend = "macos-keychain" | "windows-dpapi" | "linux-secret-service" | "file-plaintext" | "none";
|
|
114
|
+
export interface CredentialDiagnostics {
|
|
115
|
+
platform: NodeJS.Platform;
|
|
116
|
+
preferredBackend: CredentialBackend;
|
|
117
|
+
storedBackend: CredentialBackend;
|
|
118
|
+
secure: boolean;
|
|
119
|
+
stored: boolean;
|
|
120
|
+
metadataPath: string;
|
|
121
|
+
secretPath?: string;
|
|
122
|
+
plaintextPath: string;
|
|
123
|
+
legacyPlaintextPath: string;
|
|
124
|
+
fileFallbackAllowed: boolean;
|
|
125
|
+
nativeStoreDisabled: boolean;
|
|
126
|
+
warnings: string[];
|
|
127
|
+
}
|
|
128
|
+
export interface WhoamiResult {
|
|
129
|
+
user: {
|
|
130
|
+
email: string;
|
|
131
|
+
role?: string;
|
|
132
|
+
};
|
|
133
|
+
apiKey: {
|
|
134
|
+
prefix: string;
|
|
135
|
+
expiresAt: string | null;
|
|
136
|
+
};
|
|
137
|
+
account?: {
|
|
138
|
+
org?: string;
|
|
139
|
+
plan?: string;
|
|
140
|
+
sitesUsed?: number;
|
|
141
|
+
sitesQuota?: number;
|
|
142
|
+
storageUsedBytes?: number;
|
|
143
|
+
storageQuotaBytes?: number;
|
|
144
|
+
fileStorageUsedBytes?: number;
|
|
145
|
+
fileStorageQuotaBytes?: number;
|
|
146
|
+
tokenExpiresAt?: string | null;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export interface PublicWhoamiResult {
|
|
150
|
+
user: {
|
|
151
|
+
email: string;
|
|
152
|
+
role?: string;
|
|
153
|
+
};
|
|
154
|
+
account?: {
|
|
155
|
+
org?: string;
|
|
156
|
+
plan?: string;
|
|
157
|
+
sitesUsed?: number;
|
|
158
|
+
sitesQuota?: number;
|
|
159
|
+
storageUsedBytes?: number;
|
|
160
|
+
storageQuotaBytes?: number;
|
|
161
|
+
fileStorageUsedBytes?: number;
|
|
162
|
+
fileStorageQuotaBytes?: number;
|
|
163
|
+
credentialExpiresAt?: string | null;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export interface DeployCheckResult {
|
|
167
|
+
ok: boolean;
|
|
168
|
+
warnings: string[];
|
|
169
|
+
errors: string[];
|
|
170
|
+
files: number;
|
|
171
|
+
bytes: number;
|
|
172
|
+
}
|
|
173
|
+
export type DetectedFramework = "nextjs" | "astro" | "sveltekit" | "vite";
|
|
174
|
+
export declare function detectFramework(directory: string): DetectedFramework | null;
|
|
175
|
+
export declare const DEFAULT_OPEN_NEXT_CONFIG = "import { defineCloudflareConfig } from \"@opennextjs/cloudflare\";\nexport default defineCloudflareConfig();\n";
|
|
176
|
+
export declare function defaultNextWranglerConfig(appName: string): string;
|
|
177
|
+
export declare function isOpenNextInstalled(directory: string): boolean;
|
|
178
|
+
export declare class DeployError extends Error {
|
|
179
|
+
readonly slug: string | undefined;
|
|
180
|
+
constructor(message: string, slug: string | undefined);
|
|
181
|
+
}
|
|
182
|
+
export declare function deployDirectory(initialOptions: DeployOptions): Promise<DeployResult>;
|
|
183
|
+
export declare function checkDeployDirectory(options: DeployOptions): Promise<DeployCheckResult>;
|
|
184
|
+
export declare function whoami(options: ApiOptions): Promise<WhoamiResult>;
|
|
185
|
+
export declare function publicWhoamiResult(result: WhoamiResult): PublicWhoamiResult;
|
|
186
|
+
export declare function getSiteAccess(options: SiteAccessOptions): Promise<AccessState>;
|
|
187
|
+
export declare function setSiteAccessPublic(options: SiteAccessOptions): Promise<AccessState["access"]>;
|
|
188
|
+
export declare function setSiteAccessOtp(options: SiteAccessOptions): Promise<AccessState["access"]>;
|
|
189
|
+
export declare function setSiteAccessIdp(options: SiteAccessOptions & {
|
|
190
|
+
providers?: AccessProviderKey[];
|
|
191
|
+
}): Promise<AccessState["access"]>;
|
|
192
|
+
export declare function createAccessServiceToken(options: SiteAccessOptions & {
|
|
193
|
+
name?: string;
|
|
194
|
+
duration?: string;
|
|
195
|
+
}): Promise<CreatedServiceToken>;
|
|
196
|
+
export declare function revokeAccessServiceToken(options: SiteAccessOptions & {
|
|
197
|
+
tokenId: string;
|
|
198
|
+
}): Promise<AppAccessServiceToken>;
|
|
199
|
+
export declare function addAccessGrant(options: SiteAccessOptions & {
|
|
200
|
+
type: AccessGrantType;
|
|
201
|
+
value: string;
|
|
202
|
+
}): Promise<AccessGrant>;
|
|
203
|
+
export declare function revokeAccessGrant(options: SiteAccessOptions & {
|
|
204
|
+
type: AccessGrantType;
|
|
205
|
+
value: string;
|
|
206
|
+
}): Promise<AccessGrant>;
|
|
207
|
+
export declare function createRuntimeAccessToken(options: SiteAccessOptions & {
|
|
208
|
+
name?: string;
|
|
209
|
+
expiresAt?: string;
|
|
210
|
+
}): Promise<CreatedRuntimeToken>;
|
|
211
|
+
export declare function revokeRuntimeAccessToken(options: SiteAccessOptions & {
|
|
212
|
+
tokenId: string;
|
|
213
|
+
}): Promise<AppAccessToken>;
|
|
214
|
+
export interface LatestCliVersion {
|
|
215
|
+
version: string;
|
|
216
|
+
publishedAt?: string;
|
|
217
|
+
tarballSha256?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface CliVersionCheck {
|
|
220
|
+
current: string;
|
|
221
|
+
latest: LatestCliVersion;
|
|
222
|
+
comparison: "behind" | "ahead" | "current";
|
|
223
|
+
}
|
|
224
|
+
export declare function fetchLatestCliVersion(options: {
|
|
225
|
+
apiUrl: string;
|
|
226
|
+
fetchFn?: FetchLike;
|
|
227
|
+
timeoutMs?: number;
|
|
228
|
+
}): Promise<LatestCliVersion>;
|
|
229
|
+
export declare function compareCliVersions(current: string, latest: string): "behind" | "ahead" | "current";
|
|
230
|
+
export declare function checkCliVersion(options: {
|
|
231
|
+
apiUrl: string;
|
|
232
|
+
fetchFn?: FetchLike;
|
|
233
|
+
timeoutMs?: number;
|
|
234
|
+
}): Promise<CliVersionCheck>;
|
|
235
|
+
export interface ListSitesResult {
|
|
236
|
+
projects: Project[];
|
|
237
|
+
}
|
|
238
|
+
export declare function listSites(options: ApiOptions): Promise<ListSitesResult>;
|
|
239
|
+
export declare function deleteSite(options: DeleteSiteOptions): Promise<DeletedSiteResult>;
|
|
240
|
+
export declare function loginDevice(options: {
|
|
241
|
+
apiUrl: string;
|
|
242
|
+
fetchFn?: FetchLike;
|
|
243
|
+
machineName?: string;
|
|
244
|
+
allowFileCredentialStore?: boolean;
|
|
245
|
+
}): Promise<{
|
|
246
|
+
email?: string;
|
|
247
|
+
storage: string;
|
|
248
|
+
}>;
|
|
249
|
+
export declare function signupDevice(options: {
|
|
250
|
+
apiUrl: string;
|
|
251
|
+
fetchFn?: FetchLike;
|
|
252
|
+
machineName?: string;
|
|
253
|
+
allowFileCredentialStore?: boolean;
|
|
254
|
+
}): Promise<{
|
|
255
|
+
email?: string;
|
|
256
|
+
storage: string;
|
|
257
|
+
}>;
|
|
258
|
+
export declare function listManagedFiles(options: FileCommandOptions): Promise<ManagedFileListResult>;
|
|
259
|
+
export declare function putManagedFile(options: FilePutOptions): Promise<ManagedFilePutResult>;
|
|
260
|
+
export declare function getManagedFile(options: FileGetOptions): Promise<{
|
|
261
|
+
fileId: string;
|
|
262
|
+
bytes: Uint8Array;
|
|
263
|
+
contentType: string;
|
|
264
|
+
}>;
|
|
265
|
+
export declare function deleteManagedFile(options: FileDeleteOptions): Promise<ManagedFilePutResult>;
|
|
266
|
+
export declare function shareManagedFile(options: FileShareOptions): Promise<ManagedFileShareResult>;
|
|
267
|
+
type CliCommand = {
|
|
268
|
+
kind: "deploy";
|
|
269
|
+
options: DeployOptions;
|
|
270
|
+
} | {
|
|
271
|
+
kind: "version";
|
|
272
|
+
} | {
|
|
273
|
+
kind: "login";
|
|
274
|
+
apiUrl: string;
|
|
275
|
+
allowFileCredentialStore: boolean;
|
|
276
|
+
} | {
|
|
277
|
+
kind: "signup";
|
|
278
|
+
apiUrl: string;
|
|
279
|
+
allowFileCredentialStore: boolean;
|
|
280
|
+
} | {
|
|
281
|
+
kind: "logout";
|
|
282
|
+
} | {
|
|
283
|
+
kind: "doctor";
|
|
284
|
+
apiUrl: string;
|
|
285
|
+
json: boolean;
|
|
286
|
+
} | {
|
|
287
|
+
kind: "whoami";
|
|
288
|
+
apiUrl: string;
|
|
289
|
+
token: string;
|
|
290
|
+
json: boolean;
|
|
291
|
+
} | {
|
|
292
|
+
kind: "delete";
|
|
293
|
+
site: string;
|
|
294
|
+
confirmSlug: string;
|
|
295
|
+
apiUrl: string;
|
|
296
|
+
token: string;
|
|
297
|
+
} | {
|
|
298
|
+
kind: "apps";
|
|
299
|
+
apiUrl: string;
|
|
300
|
+
token: string;
|
|
301
|
+
json: boolean;
|
|
302
|
+
} | {
|
|
303
|
+
kind: "logs";
|
|
304
|
+
site: string;
|
|
305
|
+
apiUrl: string;
|
|
306
|
+
token: string;
|
|
307
|
+
json: boolean;
|
|
308
|
+
lines?: number;
|
|
309
|
+
} | {
|
|
310
|
+
kind: "latest";
|
|
311
|
+
apiUrl: string;
|
|
312
|
+
json: boolean;
|
|
313
|
+
} | {
|
|
314
|
+
kind: "support";
|
|
315
|
+
message: string;
|
|
316
|
+
subject?: string;
|
|
317
|
+
site?: string;
|
|
318
|
+
apiUrl: string;
|
|
319
|
+
token: string;
|
|
320
|
+
} | {
|
|
321
|
+
kind: "files";
|
|
322
|
+
action: {
|
|
323
|
+
kind: "list";
|
|
324
|
+
project?: string;
|
|
325
|
+
} | {
|
|
326
|
+
kind: "put";
|
|
327
|
+
localPath: string;
|
|
328
|
+
remotePath?: string;
|
|
329
|
+
project?: string;
|
|
330
|
+
} | {
|
|
331
|
+
kind: "get";
|
|
332
|
+
fileId: string;
|
|
333
|
+
outputPath?: string;
|
|
334
|
+
project?: string;
|
|
335
|
+
} | {
|
|
336
|
+
kind: "delete";
|
|
337
|
+
fileId: string;
|
|
338
|
+
project?: string;
|
|
339
|
+
} | {
|
|
340
|
+
kind: "share";
|
|
341
|
+
fileId: string;
|
|
342
|
+
project?: string;
|
|
343
|
+
mode: "public" | "login_required";
|
|
344
|
+
expiresInSeconds: number;
|
|
345
|
+
};
|
|
346
|
+
apiUrl: string;
|
|
347
|
+
token: string;
|
|
348
|
+
} | {
|
|
349
|
+
kind: "env";
|
|
350
|
+
action: {
|
|
351
|
+
kind: "set";
|
|
352
|
+
site: string;
|
|
353
|
+
entries: Array<{
|
|
354
|
+
name: string;
|
|
355
|
+
value: string;
|
|
356
|
+
kind: "secret" | "var";
|
|
357
|
+
}>;
|
|
358
|
+
} | {
|
|
359
|
+
kind: "ls";
|
|
360
|
+
site: string;
|
|
361
|
+
} | {
|
|
362
|
+
kind: "rm";
|
|
363
|
+
site: string;
|
|
364
|
+
name: string;
|
|
365
|
+
} | {
|
|
366
|
+
kind: "request";
|
|
367
|
+
site: string;
|
|
368
|
+
name: string;
|
|
369
|
+
varKind: "secret" | "var";
|
|
370
|
+
};
|
|
371
|
+
apiUrl: string;
|
|
372
|
+
token: string;
|
|
373
|
+
} | {
|
|
374
|
+
kind: "deployments";
|
|
375
|
+
action: {
|
|
376
|
+
kind: "ls";
|
|
377
|
+
site: string;
|
|
378
|
+
json: boolean;
|
|
379
|
+
} | {
|
|
380
|
+
kind: "rm";
|
|
381
|
+
deploymentId: string;
|
|
382
|
+
};
|
|
383
|
+
apiUrl: string;
|
|
384
|
+
token: string;
|
|
385
|
+
} | {
|
|
386
|
+
kind: "access";
|
|
387
|
+
action: {
|
|
388
|
+
kind: "show";
|
|
389
|
+
site: string;
|
|
390
|
+
} | {
|
|
391
|
+
kind: "public";
|
|
392
|
+
site: string;
|
|
393
|
+
} | {
|
|
394
|
+
kind: "otp";
|
|
395
|
+
site: string;
|
|
396
|
+
} | {
|
|
397
|
+
kind: "idp";
|
|
398
|
+
site: string;
|
|
399
|
+
providers?: AccessProviderKey[];
|
|
400
|
+
} | {
|
|
401
|
+
kind: "allow";
|
|
402
|
+
site: string;
|
|
403
|
+
grantType: AccessGrantType;
|
|
404
|
+
value: string;
|
|
405
|
+
} | {
|
|
406
|
+
kind: "revoke";
|
|
407
|
+
site: string;
|
|
408
|
+
grantType: AccessGrantType;
|
|
409
|
+
value: string;
|
|
410
|
+
} | {
|
|
411
|
+
kind: "service-create";
|
|
412
|
+
site: string;
|
|
413
|
+
name?: string;
|
|
414
|
+
duration?: string;
|
|
415
|
+
} | {
|
|
416
|
+
kind: "service-revoke";
|
|
417
|
+
site: string;
|
|
418
|
+
tokenId: string;
|
|
419
|
+
} | {
|
|
420
|
+
kind: "token-create";
|
|
421
|
+
site: string;
|
|
422
|
+
name?: string;
|
|
423
|
+
expiresAt?: string;
|
|
424
|
+
} | {
|
|
425
|
+
kind: "token-revoke";
|
|
426
|
+
site: string;
|
|
427
|
+
tokenId: string;
|
|
428
|
+
};
|
|
429
|
+
apiUrl: string;
|
|
430
|
+
token: string;
|
|
431
|
+
};
|
|
432
|
+
export declare function parseArgs(argv: string[]): CliCommand;
|
|
433
|
+
export declare function parseEnvFileEntries(content: string, kind: "secret" | "var"): Array<{
|
|
434
|
+
name: string;
|
|
435
|
+
value: string;
|
|
436
|
+
kind: "secret" | "var";
|
|
437
|
+
}>;
|
|
438
|
+
export declare function credentialDiagnostics(): CredentialDiagnostics;
|
|
439
|
+
export declare class UsageError extends Error {
|
|
440
|
+
}
|
|
441
|
+
export {};
|