hereya-cli 0.35.0 → 0.36.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 +69 -25
- 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/oclif.manifest.json +64 -1
- 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.36.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)
|
|
@@ -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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.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.36.0/src/commands/env/set/index.ts)_
|
|
264
308
|
|
|
265
309
|
## `hereya help [COMMAND]`
|
|
266
310
|
|
|
@@ -306,7 +350,7 @@ 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.36.0/src/commands/init/index.ts)_
|
|
310
354
|
|
|
311
355
|
## `hereya login URL`
|
|
312
356
|
|
|
@@ -328,7 +372,7 @@ EXAMPLES
|
|
|
328
372
|
$ hereya login http://localhost:5173
|
|
329
373
|
```
|
|
330
374
|
|
|
331
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
375
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/login/index.ts)_
|
|
332
376
|
|
|
333
377
|
## `hereya logout`
|
|
334
378
|
|
|
@@ -345,7 +389,7 @@ EXAMPLES
|
|
|
345
389
|
$ hereya logout
|
|
346
390
|
```
|
|
347
391
|
|
|
348
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
392
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/logout/index.ts)_
|
|
349
393
|
|
|
350
394
|
## `hereya remove PACKAGE`
|
|
351
395
|
|
|
@@ -372,7 +416,7 @@ EXAMPLES
|
|
|
372
416
|
$ hereya remove cloudy/docker_postgres
|
|
373
417
|
```
|
|
374
418
|
|
|
375
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
419
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/remove/index.ts)_
|
|
376
420
|
|
|
377
421
|
## `hereya run CMD`
|
|
378
422
|
|
|
@@ -398,7 +442,7 @@ EXAMPLES
|
|
|
398
442
|
$ hereya run -w uat -- node index.js
|
|
399
443
|
```
|
|
400
444
|
|
|
401
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
445
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/run/index.ts)_
|
|
402
446
|
|
|
403
447
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
404
448
|
|
|
@@ -423,7 +467,7 @@ EXAMPLES
|
|
|
423
467
|
$ hereya unbootstrap local
|
|
424
468
|
```
|
|
425
469
|
|
|
426
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
470
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/unbootstrap/index.ts)_
|
|
427
471
|
|
|
428
472
|
## `hereya undeploy`
|
|
429
473
|
|
|
@@ -448,7 +492,7 @@ EXAMPLES
|
|
|
448
492
|
$ hereya undeploy
|
|
449
493
|
```
|
|
450
494
|
|
|
451
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
495
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/undeploy/index.ts)_
|
|
452
496
|
|
|
453
497
|
## `hereya up`
|
|
454
498
|
|
|
@@ -475,7 +519,7 @@ EXAMPLES
|
|
|
475
519
|
$ hereya up
|
|
476
520
|
```
|
|
477
521
|
|
|
478
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
522
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/up/index.ts)_
|
|
479
523
|
|
|
480
524
|
## `hereya workspace create NAME`
|
|
481
525
|
|
|
@@ -498,7 +542,7 @@ EXAMPLES
|
|
|
498
542
|
$ hereya workspace create dev
|
|
499
543
|
```
|
|
500
544
|
|
|
501
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
545
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/create/index.ts)_
|
|
502
546
|
|
|
503
547
|
## `hereya workspace delete NAME`
|
|
504
548
|
|
|
@@ -518,7 +562,7 @@ EXAMPLES
|
|
|
518
562
|
$ hereya workspace delete dev
|
|
519
563
|
```
|
|
520
564
|
|
|
521
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
565
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/delete/index.ts)_
|
|
522
566
|
|
|
523
567
|
## `hereya workspace env [NAME]`
|
|
524
568
|
|
|
@@ -544,7 +588,7 @@ EXAMPLES
|
|
|
544
588
|
$ hereya workspace env myEnv -w dev
|
|
545
589
|
```
|
|
546
590
|
|
|
547
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
591
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/env/index.ts)_
|
|
548
592
|
|
|
549
593
|
## `hereya workspace env set`
|
|
550
594
|
|
|
@@ -568,7 +612,7 @@ EXAMPLES
|
|
|
568
612
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
569
613
|
```
|
|
570
614
|
|
|
571
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
615
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/env/set/index.ts)_
|
|
572
616
|
|
|
573
617
|
## `hereya workspace env unset`
|
|
574
618
|
|
|
@@ -589,7 +633,7 @@ EXAMPLES
|
|
|
589
633
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
590
634
|
```
|
|
591
635
|
|
|
592
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
636
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/env/unset/index.ts)_
|
|
593
637
|
|
|
594
638
|
## `hereya workspace install PACKAGE`
|
|
595
639
|
|
|
@@ -616,7 +660,7 @@ EXAMPLES
|
|
|
616
660
|
$ hereya workspace install hereya/aws-cognito
|
|
617
661
|
```
|
|
618
662
|
|
|
619
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
663
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/install/index.ts)_
|
|
620
664
|
|
|
621
665
|
## `hereya workspace list`
|
|
622
666
|
|
|
@@ -633,7 +677,7 @@ EXAMPLES
|
|
|
633
677
|
$ hereya workspace list
|
|
634
678
|
```
|
|
635
679
|
|
|
636
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
680
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/list/index.ts)_
|
|
637
681
|
|
|
638
682
|
## `hereya workspace uninstall PACKAGE`
|
|
639
683
|
|
|
@@ -660,5 +704,5 @@ EXAMPLES
|
|
|
660
704
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
661
705
|
```
|
|
662
706
|
|
|
663
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
707
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.36.0/src/commands/workspace/uninstall/index.ts)_
|
|
664
708
|
<!-- 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
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -613,6 +613,38 @@
|
|
|
613
613
|
"index.js"
|
|
614
614
|
]
|
|
615
615
|
},
|
|
616
|
+
"config:export-backend": {
|
|
617
|
+
"aliases": [],
|
|
618
|
+
"args": {
|
|
619
|
+
"file": {
|
|
620
|
+
"description": "Path to save the export file. Defaults to cloud-backend.json in current directory",
|
|
621
|
+
"name": "file",
|
|
622
|
+
"required": false
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
"description": "Export the cloud backend configuration to a file",
|
|
626
|
+
"examples": [
|
|
627
|
+
"<%= config.bin %> <%= command.id %>",
|
|
628
|
+
"<%= config.bin %> <%= command.id %> ./path/to/export.json"
|
|
629
|
+
],
|
|
630
|
+
"flags": {},
|
|
631
|
+
"hasDynamicHelp": false,
|
|
632
|
+
"hiddenAliases": [],
|
|
633
|
+
"id": "config:export-backend",
|
|
634
|
+
"pluginAlias": "hereya-cli",
|
|
635
|
+
"pluginName": "hereya-cli",
|
|
636
|
+
"pluginType": "core",
|
|
637
|
+
"strict": true,
|
|
638
|
+
"enableJsonFlag": false,
|
|
639
|
+
"isESM": true,
|
|
640
|
+
"relativePath": [
|
|
641
|
+
"dist",
|
|
642
|
+
"commands",
|
|
643
|
+
"config",
|
|
644
|
+
"export-backend",
|
|
645
|
+
"index.js"
|
|
646
|
+
]
|
|
647
|
+
},
|
|
616
648
|
"config:get-backend": {
|
|
617
649
|
"aliases": [],
|
|
618
650
|
"args": {},
|
|
@@ -638,6 +670,37 @@
|
|
|
638
670
|
"index.js"
|
|
639
671
|
]
|
|
640
672
|
},
|
|
673
|
+
"config:import-backend": {
|
|
674
|
+
"aliases": [],
|
|
675
|
+
"args": {
|
|
676
|
+
"file": {
|
|
677
|
+
"description": "Path to the file containing the backend configuration to import",
|
|
678
|
+
"name": "file",
|
|
679
|
+
"required": true
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
"description": "Import a backend configuration from a file",
|
|
683
|
+
"examples": [
|
|
684
|
+
"<%= config.bin %> <%= command.id %> ./path/to/cloud-backend.json"
|
|
685
|
+
],
|
|
686
|
+
"flags": {},
|
|
687
|
+
"hasDynamicHelp": false,
|
|
688
|
+
"hiddenAliases": [],
|
|
689
|
+
"id": "config:import-backend",
|
|
690
|
+
"pluginAlias": "hereya-cli",
|
|
691
|
+
"pluginName": "hereya-cli",
|
|
692
|
+
"pluginType": "core",
|
|
693
|
+
"strict": true,
|
|
694
|
+
"enableJsonFlag": false,
|
|
695
|
+
"isESM": true,
|
|
696
|
+
"relativePath": [
|
|
697
|
+
"dist",
|
|
698
|
+
"commands",
|
|
699
|
+
"config",
|
|
700
|
+
"import-backend",
|
|
701
|
+
"index.js"
|
|
702
|
+
]
|
|
703
|
+
},
|
|
641
704
|
"config:use-backend": {
|
|
642
705
|
"aliases": [],
|
|
643
706
|
"args": {
|
|
@@ -1118,5 +1181,5 @@
|
|
|
1118
1181
|
]
|
|
1119
1182
|
}
|
|
1120
1183
|
},
|
|
1121
|
-
"version": "0.
|
|
1184
|
+
"version": "0.36.0"
|
|
1122
1185
|
}
|