hereya-cli 0.35.0 → 0.37.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/README.md +75 -29
- package/dist/backend/cloud/cloud-backend.d.ts +3 -1
- package/dist/backend/cloud/cloud-backend.js +45 -0
- package/dist/backend/common.d.ts +18 -0
- package/dist/backend/file.d.ts +3 -1
- package/dist/backend/file.js +12 -0
- package/dist/backend/index.d.ts +1 -0
- package/dist/backend/index.js +4 -0
- package/dist/commands/config/export-backend/index.d.ts +9 -0
- package/dist/commands/config/export-backend/index.js +28 -0
- package/dist/commands/config/import-backend/index.d.ts +9 -0
- package/dist/commands/config/import-backend/index.js +25 -0
- package/dist/commands/login/index.js +6 -1
- package/oclif.manifest.json +67 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g hereya-cli
|
|
|
20
20
|
$ hereya COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ hereya (--version)
|
|
23
|
-
hereya-cli/0.
|
|
23
|
+
hereya-cli/0.37.0 linux-x64 node-v22.15.0
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -31,7 +31,9 @@ USAGE
|
|
|
31
31
|
<!-- commands -->
|
|
32
32
|
* [`hereya add PACKAGE`](#hereya-add-package)
|
|
33
33
|
* [`hereya bootstrap INFRASTRUCTURETYPE`](#hereya-bootstrap-infrastructuretype)
|
|
34
|
+
* [`hereya config export-backend [FILE]`](#hereya-config-export-backend-file)
|
|
34
35
|
* [`hereya config get-backend`](#hereya-config-get-backend)
|
|
36
|
+
* [`hereya config import-backend FILE`](#hereya-config-import-backend-file)
|
|
35
37
|
* [`hereya config use-backend TYPE`](#hereya-config-use-backend-type)
|
|
36
38
|
* [`hereya deploy`](#hereya-deploy)
|
|
37
39
|
* [`hereya down`](#hereya-down)
|
|
@@ -39,7 +41,7 @@ USAGE
|
|
|
39
41
|
* [`hereya env set [NAME]`](#hereya-env-set-name)
|
|
40
42
|
* [`hereya help [COMMAND]`](#hereya-help-command)
|
|
41
43
|
* [`hereya init PROJECT`](#hereya-init-project)
|
|
42
|
-
* [`hereya login URL`](#hereya-login-url)
|
|
44
|
+
* [`hereya login [URL]`](#hereya-login-url)
|
|
43
45
|
* [`hereya logout`](#hereya-logout)
|
|
44
46
|
* [`hereya remove PACKAGE`](#hereya-remove-package)
|
|
45
47
|
* [`hereya run CMD`](#hereya-run-cmd)
|
|
@@ -86,7 +88,7 @@ EXAMPLES
|
|
|
86
88
|
$ hereya add cloudy/docker_postgres
|
|
87
89
|
```
|
|
88
90
|
|
|
89
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
91
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/add/index.ts)_
|
|
90
92
|
|
|
91
93
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
92
94
|
|
|
@@ -111,7 +113,29 @@ EXAMPLES
|
|
|
111
113
|
$ hereya bootstrap local
|
|
112
114
|
```
|
|
113
115
|
|
|
114
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
116
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/bootstrap/index.ts)_
|
|
117
|
+
|
|
118
|
+
## `hereya config export-backend [FILE]`
|
|
119
|
+
|
|
120
|
+
Export the cloud backend configuration to a file
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
USAGE
|
|
124
|
+
$ hereya config export-backend [FILE]
|
|
125
|
+
|
|
126
|
+
ARGUMENTS
|
|
127
|
+
FILE Path to save the export file. Defaults to cloud-backend.json in current directory
|
|
128
|
+
|
|
129
|
+
DESCRIPTION
|
|
130
|
+
Export the cloud backend configuration to a file
|
|
131
|
+
|
|
132
|
+
EXAMPLES
|
|
133
|
+
$ hereya config export-backend
|
|
134
|
+
|
|
135
|
+
$ hereya config export-backend ./path/to/export.json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/config/export-backend/index.ts)_
|
|
115
139
|
|
|
116
140
|
## `hereya config get-backend`
|
|
117
141
|
|
|
@@ -128,7 +152,27 @@ EXAMPLES
|
|
|
128
152
|
$ hereya config get-backend
|
|
129
153
|
```
|
|
130
154
|
|
|
131
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
155
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/config/get-backend/index.ts)_
|
|
156
|
+
|
|
157
|
+
## `hereya config import-backend FILE`
|
|
158
|
+
|
|
159
|
+
Import a backend configuration from a file
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
USAGE
|
|
163
|
+
$ hereya config import-backend FILE
|
|
164
|
+
|
|
165
|
+
ARGUMENTS
|
|
166
|
+
FILE Path to the file containing the backend configuration to import
|
|
167
|
+
|
|
168
|
+
DESCRIPTION
|
|
169
|
+
Import a backend configuration from a file
|
|
170
|
+
|
|
171
|
+
EXAMPLES
|
|
172
|
+
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/config/import-backend/index.ts)_
|
|
132
176
|
|
|
133
177
|
## `hereya config use-backend TYPE`
|
|
134
178
|
|
|
@@ -150,7 +194,7 @@ EXAMPLES
|
|
|
150
194
|
$ hereya config use-backend local
|
|
151
195
|
```
|
|
152
196
|
|
|
153
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
197
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/config/use-backend/index.ts)_
|
|
154
198
|
|
|
155
199
|
## `hereya deploy`
|
|
156
200
|
|
|
@@ -175,7 +219,7 @@ EXAMPLES
|
|
|
175
219
|
$ hereya deploy
|
|
176
220
|
```
|
|
177
221
|
|
|
178
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
222
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/deploy/index.ts)_
|
|
179
223
|
|
|
180
224
|
## `hereya down`
|
|
181
225
|
|
|
@@ -202,7 +246,7 @@ EXAMPLES
|
|
|
202
246
|
$ hereya down
|
|
203
247
|
```
|
|
204
248
|
|
|
205
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
249
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/down/index.ts)_
|
|
206
250
|
|
|
207
251
|
## `hereya env [NAME]`
|
|
208
252
|
|
|
@@ -233,7 +277,7 @@ EXAMPLES
|
|
|
233
277
|
$ hereya env -w dev -l
|
|
234
278
|
```
|
|
235
279
|
|
|
236
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
280
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/env/index.ts)_
|
|
237
281
|
|
|
238
282
|
## `hereya env set [NAME]`
|
|
239
283
|
|
|
@@ -260,7 +304,7 @@ EXAMPLES
|
|
|
260
304
|
$ hereya env set FOO -v bar -w dev
|
|
261
305
|
```
|
|
262
306
|
|
|
263
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
307
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/env/set/index.ts)_
|
|
264
308
|
|
|
265
309
|
## `hereya help [COMMAND]`
|
|
266
310
|
|
|
@@ -306,29 +350,31 @@ EXAMPLES
|
|
|
306
350
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
307
351
|
```
|
|
308
352
|
|
|
309
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
353
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/init/index.ts)_
|
|
310
354
|
|
|
311
|
-
## `hereya login URL`
|
|
355
|
+
## `hereya login [URL]`
|
|
312
356
|
|
|
313
357
|
Login to the Hereya Cloud backend
|
|
314
358
|
|
|
315
359
|
```
|
|
316
360
|
USAGE
|
|
317
|
-
$ hereya login URL
|
|
361
|
+
$ hereya login [URL]
|
|
318
362
|
|
|
319
363
|
ARGUMENTS
|
|
320
|
-
URL URL of the Hereya Cloud backend
|
|
364
|
+
URL [default: https://cloud.hereya.dev] URL of the Hereya Cloud backend
|
|
321
365
|
|
|
322
366
|
DESCRIPTION
|
|
323
367
|
Login to the Hereya Cloud backend
|
|
324
368
|
|
|
325
369
|
EXAMPLES
|
|
370
|
+
$ hereya login
|
|
371
|
+
|
|
326
372
|
$ hereya login https://cloud.hereya.dev
|
|
327
373
|
|
|
328
374
|
$ hereya login http://localhost:5173
|
|
329
375
|
```
|
|
330
376
|
|
|
331
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
377
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/login/index.ts)_
|
|
332
378
|
|
|
333
379
|
## `hereya logout`
|
|
334
380
|
|
|
@@ -345,7 +391,7 @@ EXAMPLES
|
|
|
345
391
|
$ hereya logout
|
|
346
392
|
```
|
|
347
393
|
|
|
348
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
394
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/logout/index.ts)_
|
|
349
395
|
|
|
350
396
|
## `hereya remove PACKAGE`
|
|
351
397
|
|
|
@@ -372,7 +418,7 @@ EXAMPLES
|
|
|
372
418
|
$ hereya remove cloudy/docker_postgres
|
|
373
419
|
```
|
|
374
420
|
|
|
375
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
421
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/remove/index.ts)_
|
|
376
422
|
|
|
377
423
|
## `hereya run CMD`
|
|
378
424
|
|
|
@@ -398,7 +444,7 @@ EXAMPLES
|
|
|
398
444
|
$ hereya run -w uat -- node index.js
|
|
399
445
|
```
|
|
400
446
|
|
|
401
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
447
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/run/index.ts)_
|
|
402
448
|
|
|
403
449
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
404
450
|
|
|
@@ -423,7 +469,7 @@ EXAMPLES
|
|
|
423
469
|
$ hereya unbootstrap local
|
|
424
470
|
```
|
|
425
471
|
|
|
426
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
472
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/unbootstrap/index.ts)_
|
|
427
473
|
|
|
428
474
|
## `hereya undeploy`
|
|
429
475
|
|
|
@@ -448,7 +494,7 @@ EXAMPLES
|
|
|
448
494
|
$ hereya undeploy
|
|
449
495
|
```
|
|
450
496
|
|
|
451
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
497
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/undeploy/index.ts)_
|
|
452
498
|
|
|
453
499
|
## `hereya up`
|
|
454
500
|
|
|
@@ -475,7 +521,7 @@ EXAMPLES
|
|
|
475
521
|
$ hereya up
|
|
476
522
|
```
|
|
477
523
|
|
|
478
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
524
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/up/index.ts)_
|
|
479
525
|
|
|
480
526
|
## `hereya workspace create NAME`
|
|
481
527
|
|
|
@@ -498,7 +544,7 @@ EXAMPLES
|
|
|
498
544
|
$ hereya workspace create dev
|
|
499
545
|
```
|
|
500
546
|
|
|
501
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
547
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/create/index.ts)_
|
|
502
548
|
|
|
503
549
|
## `hereya workspace delete NAME`
|
|
504
550
|
|
|
@@ -518,7 +564,7 @@ EXAMPLES
|
|
|
518
564
|
$ hereya workspace delete dev
|
|
519
565
|
```
|
|
520
566
|
|
|
521
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
567
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/delete/index.ts)_
|
|
522
568
|
|
|
523
569
|
## `hereya workspace env [NAME]`
|
|
524
570
|
|
|
@@ -544,7 +590,7 @@ EXAMPLES
|
|
|
544
590
|
$ hereya workspace env myEnv -w dev
|
|
545
591
|
```
|
|
546
592
|
|
|
547
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
593
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/env/index.ts)_
|
|
548
594
|
|
|
549
595
|
## `hereya workspace env set`
|
|
550
596
|
|
|
@@ -568,7 +614,7 @@ EXAMPLES
|
|
|
568
614
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
569
615
|
```
|
|
570
616
|
|
|
571
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
617
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/env/set/index.ts)_
|
|
572
618
|
|
|
573
619
|
## `hereya workspace env unset`
|
|
574
620
|
|
|
@@ -589,7 +635,7 @@ EXAMPLES
|
|
|
589
635
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
590
636
|
```
|
|
591
637
|
|
|
592
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
638
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/env/unset/index.ts)_
|
|
593
639
|
|
|
594
640
|
## `hereya workspace install PACKAGE`
|
|
595
641
|
|
|
@@ -616,7 +662,7 @@ EXAMPLES
|
|
|
616
662
|
$ hereya workspace install hereya/aws-cognito
|
|
617
663
|
```
|
|
618
664
|
|
|
619
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
665
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/install/index.ts)_
|
|
620
666
|
|
|
621
667
|
## `hereya workspace list`
|
|
622
668
|
|
|
@@ -633,7 +679,7 @@ EXAMPLES
|
|
|
633
679
|
$ hereya workspace list
|
|
634
680
|
```
|
|
635
681
|
|
|
636
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
682
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/list/index.ts)_
|
|
637
683
|
|
|
638
684
|
## `hereya workspace uninstall PACKAGE`
|
|
639
685
|
|
|
@@ -660,5 +706,5 @@ EXAMPLES
|
|
|
660
706
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
661
707
|
```
|
|
662
708
|
|
|
663
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
709
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.37.0/src/commands/workspace/uninstall/index.ts)_
|
|
664
710
|
<!-- commandsstop -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from '../common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from '../common.js';
|
|
3
3
|
interface CloudBackendConfig {
|
|
4
4
|
accessToken: string;
|
|
5
5
|
clientId: string;
|
|
@@ -12,10 +12,12 @@ export declare class CloudBackend implements Backend {
|
|
|
12
12
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
13
13
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
14
14
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
15
|
+
exportBackend(): Promise<ExportBackendOutput>;
|
|
15
16
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
|
16
17
|
getState(input: GetStateInput): Promise<GetStateOutput>;
|
|
17
18
|
getWorkspace(name: string): Promise<GetWorkspaceOutput>;
|
|
18
19
|
getWorkspaceEnv(input: GetWorkspaceEnvInput): Promise<GetWorkspaceEnvOutput>;
|
|
20
|
+
importBackend(input: ImportBackendInput): Promise<ImportBackendOutput>;
|
|
19
21
|
init(input: InitProjectInput): Promise<InitProjectOutput>;
|
|
20
22
|
listWorkspaces(): Promise<string[]>;
|
|
21
23
|
removePackageFromWorkspace(input: RemovePackageFromWorkspaceInput): Promise<RemovePackageFromWorkspaceOutput>;
|
|
@@ -76,6 +76,31 @@ export class CloudBackend {
|
|
|
76
76
|
success: true,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
async exportBackend() {
|
|
80
|
+
const response = await fetch(`${this.config.url}/api/export`, {
|
|
81
|
+
headers: {
|
|
82
|
+
'Authorization': `Bearer ${this.config.accessToken}`,
|
|
83
|
+
},
|
|
84
|
+
method: 'GET',
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
return {
|
|
88
|
+
reason: JSON.stringify(await response.json()),
|
|
89
|
+
success: false,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const result = await response.json();
|
|
93
|
+
if (!result.success) {
|
|
94
|
+
return {
|
|
95
|
+
reason: JSON.stringify(result),
|
|
96
|
+
success: false,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
data: JSON.stringify(result.data),
|
|
101
|
+
success: true,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
79
104
|
async getProvisioningId(input) {
|
|
80
105
|
const formData = new FormData();
|
|
81
106
|
formData.append('packageCanonicalName', input.packageCanonicalName);
|
|
@@ -185,6 +210,26 @@ export class CloudBackend {
|
|
|
185
210
|
success: true,
|
|
186
211
|
};
|
|
187
212
|
}
|
|
213
|
+
async importBackend(input) {
|
|
214
|
+
const formData = new FormData();
|
|
215
|
+
formData.append('data', input.data);
|
|
216
|
+
const response = await fetch(`${this.config.url}/api/import`, {
|
|
217
|
+
body: formData,
|
|
218
|
+
headers: {
|
|
219
|
+
'Authorization': `Bearer ${this.config.accessToken}`,
|
|
220
|
+
},
|
|
221
|
+
method: 'POST',
|
|
222
|
+
});
|
|
223
|
+
if (!response.ok) {
|
|
224
|
+
return {
|
|
225
|
+
reason: JSON.stringify(await response.json()),
|
|
226
|
+
success: false,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
188
233
|
async init(input) {
|
|
189
234
|
const formData = new FormData();
|
|
190
235
|
formData.append('name', input.project);
|
package/dist/backend/common.d.ts
CHANGED
|
@@ -5,10 +5,12 @@ export interface Backend {
|
|
|
5
5
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
6
6
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
7
7
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
8
|
+
exportBackend(): Promise<ExportBackendOutput>;
|
|
8
9
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
|
9
10
|
getState(input: GetStateInput): Promise<GetStateOutput>;
|
|
10
11
|
getWorkspace(workspace: string): Promise<GetWorkspaceOutput>;
|
|
11
12
|
getWorkspaceEnv(input: GetWorkspaceEnvInput): Promise<GetWorkspaceEnvOutput>;
|
|
13
|
+
importBackend(input: ImportBackendInput): Promise<ImportBackendOutput>;
|
|
12
14
|
init(options: InitProjectInput): Promise<InitProjectOutput>;
|
|
13
15
|
listWorkspaces(): Promise<string[]>;
|
|
14
16
|
removePackageFromWorkspace(input: RemovePackageFromWorkspaceInput): Promise<RemovePackageFromWorkspaceOutput>;
|
|
@@ -100,6 +102,13 @@ export type CreateWorkspaceOutput = {
|
|
|
100
102
|
reason: string;
|
|
101
103
|
success: false;
|
|
102
104
|
};
|
|
105
|
+
export type ExportBackendOutput = {
|
|
106
|
+
data: string;
|
|
107
|
+
success: true;
|
|
108
|
+
} | {
|
|
109
|
+
reason: string;
|
|
110
|
+
success: false;
|
|
111
|
+
};
|
|
103
112
|
export type GetWorkspaceEnvInput = {
|
|
104
113
|
project?: string;
|
|
105
114
|
workspace: string;
|
|
@@ -158,6 +167,15 @@ export type GetProvisioningIdOutput = {
|
|
|
158
167
|
reason: string;
|
|
159
168
|
success: false;
|
|
160
169
|
};
|
|
170
|
+
export type ImportBackendInput = {
|
|
171
|
+
data: string;
|
|
172
|
+
};
|
|
173
|
+
export type ImportBackendOutput = {
|
|
174
|
+
reason: string;
|
|
175
|
+
success: false;
|
|
176
|
+
} | {
|
|
177
|
+
success: true;
|
|
178
|
+
};
|
|
161
179
|
export type SetEnvVarInput = {
|
|
162
180
|
infrastructure: InfrastructureType;
|
|
163
181
|
name: string;
|
package/dist/backend/file.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from './common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput } from './common.js';
|
|
3
3
|
import { FileStorage } from './file-storage/common.js';
|
|
4
4
|
export declare class FileBackend implements Backend {
|
|
5
5
|
private readonly fileStorage;
|
|
@@ -7,10 +7,12 @@ export declare class FileBackend implements Backend {
|
|
|
7
7
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
8
8
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
9
9
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
10
|
+
exportBackend(): Promise<ExportBackendOutput>;
|
|
10
11
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
|
11
12
|
getState(input: GetStateInput): Promise<GetStateOutput>;
|
|
12
13
|
getWorkspace(workspace: string): Promise<GetWorkspaceOutput>;
|
|
13
14
|
getWorkspaceEnv(input: GetWorkspaceEnvInput): Promise<GetWorkspaceEnvOutput>;
|
|
15
|
+
importBackend(_: ImportBackendInput): Promise<ImportBackendOutput>;
|
|
14
16
|
init(options: InitProjectInput): Promise<InitProjectOutput>;
|
|
15
17
|
listWorkspaces(): Promise<string[]>;
|
|
16
18
|
removePackageFromWorkspace(input: RemovePackageFromWorkspaceInput): Promise<RemovePackageFromWorkspaceOutput>;
|
package/dist/backend/file.js
CHANGED
|
@@ -154,6 +154,12 @@ export class FileBackend {
|
|
|
154
154
|
success: false,
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
+
async exportBackend() {
|
|
158
|
+
return {
|
|
159
|
+
reason: 'This backend does not support exporting',
|
|
160
|
+
success: false,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
157
163
|
async getProvisioningId(input) {
|
|
158
164
|
const idPaths = [`provisioning/${input.logicalId}.yaml`, `provisioning/${input.logicalId}.yml`];
|
|
159
165
|
const newId = `p-${randomUUID()}`;
|
|
@@ -285,6 +291,12 @@ export class FileBackend {
|
|
|
285
291
|
success: true,
|
|
286
292
|
};
|
|
287
293
|
}
|
|
294
|
+
async importBackend(_) {
|
|
295
|
+
return {
|
|
296
|
+
reason: 'This backend does not support importing',
|
|
297
|
+
success: false,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
288
300
|
async init(options) {
|
|
289
301
|
return {
|
|
290
302
|
project: {
|
package/dist/backend/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Backend } from './common.js';
|
|
2
2
|
export declare function getBackend(type?: BackendType): Promise<Backend>;
|
|
3
|
+
export declare function clearBackend(): void;
|
|
3
4
|
export declare function setBackendType(type: BackendType): void;
|
|
4
5
|
export declare enum BackendType {
|
|
5
6
|
Cloud = "cloud",
|
package/dist/backend/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ConfigExportBackend extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
file: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { getBackend } from '../../../backend/index.js';
|
|
5
|
+
export default class ConfigExportBackend extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
file: Args.string({
|
|
8
|
+
description: 'Path to save the export file. Defaults to cloud-backend.json in current directory',
|
|
9
|
+
required: false,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Export the cloud backend configuration to a file';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %>',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> ./path/to/export.json',
|
|
16
|
+
];
|
|
17
|
+
async run() {
|
|
18
|
+
const { args } = await this.parse(ConfigExportBackend);
|
|
19
|
+
const backend = await getBackend();
|
|
20
|
+
const result = await backend.exportBackend();
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
this.error(`Failed to export backend: ${result.reason}`);
|
|
23
|
+
}
|
|
24
|
+
const filePath = args.file ?? join(process.cwd(), 'cloud-backend.json');
|
|
25
|
+
await writeFile(filePath, result.data);
|
|
26
|
+
this.log(`Backend configuration exported to ${filePath}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ConfigImportBackend extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
file: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { getBackend } from '../../../backend/index.js';
|
|
4
|
+
export default class ConfigImportBackend extends Command {
|
|
5
|
+
static args = {
|
|
6
|
+
file: Args.string({
|
|
7
|
+
description: 'Path to the file containing the backend configuration to import',
|
|
8
|
+
required: true,
|
|
9
|
+
}),
|
|
10
|
+
};
|
|
11
|
+
static description = 'Import a backend configuration from a file';
|
|
12
|
+
static examples = [
|
|
13
|
+
'<%= config.bin %> <%= command.id %> ./path/to/cloud-backend.json',
|
|
14
|
+
];
|
|
15
|
+
async run() {
|
|
16
|
+
const { args } = await this.parse(ConfigImportBackend);
|
|
17
|
+
const backend = await getBackend();
|
|
18
|
+
const fileContent = await readFile(args.file, 'utf8');
|
|
19
|
+
const result = await backend.importBackend({ data: fileContent });
|
|
20
|
+
if (!result.success) {
|
|
21
|
+
this.error(`Failed to import backend: ${result.reason}`);
|
|
22
|
+
}
|
|
23
|
+
this.log('Backend configuration imported successfully');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -3,10 +3,15 @@ import { loginToCloudBackend } from '../../backend/cloud/login.js';
|
|
|
3
3
|
import { saveCloudCredentials } from '../../backend/config.js';
|
|
4
4
|
export default class Login extends Command {
|
|
5
5
|
static args = {
|
|
6
|
-
url: Args.string({
|
|
6
|
+
url: Args.string({
|
|
7
|
+
default: 'https://cloud.hereya.dev',
|
|
8
|
+
description: 'URL of the Hereya Cloud backend',
|
|
9
|
+
required: false,
|
|
10
|
+
}),
|
|
7
11
|
};
|
|
8
12
|
static description = 'Login to the Hereya Cloud backend';
|
|
9
13
|
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %>',
|
|
10
15
|
'<%= config.bin %> <%= command.id %> https://cloud.hereya.dev',
|
|
11
16
|
'<%= config.bin %> <%= command.id %> http://localhost:5173',
|
|
12
17
|
];
|
package/oclif.manifest.json
CHANGED
|
@@ -317,13 +317,15 @@
|
|
|
317
317
|
"aliases": [],
|
|
318
318
|
"args": {
|
|
319
319
|
"url": {
|
|
320
|
+
"default": "https://cloud.hereya.dev",
|
|
320
321
|
"description": "URL of the Hereya Cloud backend",
|
|
321
322
|
"name": "url",
|
|
322
|
-
"required":
|
|
323
|
+
"required": false
|
|
323
324
|
}
|
|
324
325
|
},
|
|
325
326
|
"description": "Login to the Hereya Cloud backend",
|
|
326
327
|
"examples": [
|
|
328
|
+
"<%= config.bin %> <%= command.id %>",
|
|
327
329
|
"<%= config.bin %> <%= command.id %> https://cloud.hereya.dev",
|
|
328
330
|
"<%= config.bin %> <%= command.id %> http://localhost:5173"
|
|
329
331
|
],
|
|
@@ -613,6 +615,38 @@
|
|
|
613
615
|
"index.js"
|
|
614
616
|
]
|
|
615
617
|
},
|
|
618
|
+
"config:export-backend": {
|
|
619
|
+
"aliases": [],
|
|
620
|
+
"args": {
|
|
621
|
+
"file": {
|
|
622
|
+
"description": "Path to save the export file. Defaults to cloud-backend.json in current directory",
|
|
623
|
+
"name": "file",
|
|
624
|
+
"required": false
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
"description": "Export the cloud backend configuration to a file",
|
|
628
|
+
"examples": [
|
|
629
|
+
"<%= config.bin %> <%= command.id %>",
|
|
630
|
+
"<%= config.bin %> <%= command.id %> ./path/to/export.json"
|
|
631
|
+
],
|
|
632
|
+
"flags": {},
|
|
633
|
+
"hasDynamicHelp": false,
|
|
634
|
+
"hiddenAliases": [],
|
|
635
|
+
"id": "config:export-backend",
|
|
636
|
+
"pluginAlias": "hereya-cli",
|
|
637
|
+
"pluginName": "hereya-cli",
|
|
638
|
+
"pluginType": "core",
|
|
639
|
+
"strict": true,
|
|
640
|
+
"enableJsonFlag": false,
|
|
641
|
+
"isESM": true,
|
|
642
|
+
"relativePath": [
|
|
643
|
+
"dist",
|
|
644
|
+
"commands",
|
|
645
|
+
"config",
|
|
646
|
+
"export-backend",
|
|
647
|
+
"index.js"
|
|
648
|
+
]
|
|
649
|
+
},
|
|
616
650
|
"config:get-backend": {
|
|
617
651
|
"aliases": [],
|
|
618
652
|
"args": {},
|
|
@@ -638,6 +672,37 @@
|
|
|
638
672
|
"index.js"
|
|
639
673
|
]
|
|
640
674
|
},
|
|
675
|
+
"config:import-backend": {
|
|
676
|
+
"aliases": [],
|
|
677
|
+
"args": {
|
|
678
|
+
"file": {
|
|
679
|
+
"description": "Path to the file containing the backend configuration to import",
|
|
680
|
+
"name": "file",
|
|
681
|
+
"required": true
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
"description": "Import a backend configuration from a file",
|
|
685
|
+
"examples": [
|
|
686
|
+
"<%= config.bin %> <%= command.id %> ./path/to/cloud-backend.json"
|
|
687
|
+
],
|
|
688
|
+
"flags": {},
|
|
689
|
+
"hasDynamicHelp": false,
|
|
690
|
+
"hiddenAliases": [],
|
|
691
|
+
"id": "config:import-backend",
|
|
692
|
+
"pluginAlias": "hereya-cli",
|
|
693
|
+
"pluginName": "hereya-cli",
|
|
694
|
+
"pluginType": "core",
|
|
695
|
+
"strict": true,
|
|
696
|
+
"enableJsonFlag": false,
|
|
697
|
+
"isESM": true,
|
|
698
|
+
"relativePath": [
|
|
699
|
+
"dist",
|
|
700
|
+
"commands",
|
|
701
|
+
"config",
|
|
702
|
+
"import-backend",
|
|
703
|
+
"index.js"
|
|
704
|
+
]
|
|
705
|
+
},
|
|
641
706
|
"config:use-backend": {
|
|
642
707
|
"aliases": [],
|
|
643
708
|
"args": {
|
|
@@ -1118,5 +1183,5 @@
|
|
|
1118
1183
|
]
|
|
1119
1184
|
}
|
|
1120
1185
|
},
|
|
1121
|
-
"version": "0.
|
|
1186
|
+
"version": "0.37.0"
|
|
1122
1187
|
}
|