@liquidmetal-ai/raindrop 0.2.5 → 0.2.7
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 +50 -48
- package/dist/base-command.d.ts +13 -5
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +35 -1
- package/dist/codegen.js +2 -2
- package/dist/codegen.test.js +1 -1
- package/dist/commands/build/branch.d.ts +6 -3
- package/dist/commands/build/branch.d.ts.map +1 -1
- package/dist/commands/build/branch.js +19 -123
- package/dist/commands/build/checkout.d.ts +4 -1
- package/dist/commands/build/checkout.d.ts.map +1 -1
- package/dist/commands/build/checkout.js +1 -17
- package/dist/commands/build/delete.d.ts +4 -1
- package/dist/commands/build/delete.d.ts.map +1 -1
- package/dist/commands/build/delete.js +1 -17
- package/dist/commands/build/deploy.d.ts +8 -3
- package/dist/commands/build/deploy.d.ts.map +1 -1
- package/dist/commands/build/deploy.js +34 -128
- package/dist/commands/build/env/get.d.ts +5 -2
- package/dist/commands/build/env/get.d.ts.map +1 -1
- package/dist/commands/build/env/get.js +1 -17
- package/dist/commands/build/env/set.d.ts +4 -1
- package/dist/commands/build/env/set.d.ts.map +1 -1
- package/dist/commands/build/env/set.js +1 -17
- package/dist/commands/build/find.d.ts +4 -1
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +2 -25
- package/dist/commands/build/list.d.ts +4 -0
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +10 -18
- package/dist/commands/build/sandbox.d.ts +5 -2
- package/dist/commands/build/sandbox.d.ts.map +1 -1
- package/dist/commands/build/sandbox.js +1 -14
- package/dist/commands/build/start.d.ts +4 -1
- package/dist/commands/build/start.d.ts.map +1 -1
- package/dist/commands/build/start.js +1 -17
- package/dist/commands/build/status.d.ts +7 -2
- package/dist/commands/build/status.d.ts.map +1 -1
- package/dist/commands/build/status.js +64 -30
- package/dist/commands/build/stop.d.ts +4 -1
- package/dist/commands/build/stop.d.ts.map +1 -1
- package/dist/commands/build/stop.js +2 -18
- package/dist/commands/build/unsandbox.d.ts +5 -2
- package/dist/commands/build/unsandbox.d.ts.map +1 -1
- package/dist/commands/build/unsandbox.js +2 -15
- package/dist/commands/build/upload.d.ts +4 -1
- package/dist/commands/build/upload.d.ts.map +1 -1
- package/dist/commands/build/upload.js +1 -17
- package/dist/commands/object/delete.d.ts +4 -0
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +1 -10
- package/dist/commands/object/get.d.ts +4 -0
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +1 -10
- package/dist/commands/object/list.d.ts +4 -0
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +2 -11
- package/dist/commands/object/put.d.ts +4 -0
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +1 -10
- package/dist/commands/query/chunk-search.d.ts +4 -0
- package/dist/commands/query/chunk-search.d.ts.map +1 -1
- package/dist/commands/query/chunk-search.js +1 -10
- package/dist/commands/query/register-retriever.d.ts +7 -2
- package/dist/commands/query/register-retriever.d.ts.map +1 -1
- package/dist/commands/query/register-retriever.js +6 -10
- package/dist/commands/query/search.d.ts +4 -0
- package/dist/commands/query/search.d.ts.map +1 -1
- package/dist/commands/query/search.js +1 -10
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/deploy.d.ts +17 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +164 -0
- package/dist/index.d.ts +12 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -40
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +3035 -738
- package/package.json +4 -2
- package/templates/handlers/{r2-event-notification → bucket-event-notification}/index.ts.hbs +5 -1
- package/templates/handlers/queue-consumer/index.ts.hbs +1 -1
- package/templates/init/package.json.hbs +1 -1
- /package/templates/handlers/{r2-event-notification → bucket-event-notification}/index.test.ts +0 -0
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
|
-
import { archive } from '@liquidmetal-ai/drizzle/codestore';
|
|
3
|
-
import { BundleArchiveType, ReleaseRequest_Lock } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
4
|
-
import { FileSystemBundle } from '@liquidmetal-ai/drizzle/unsafe/codestore';
|
|
5
1
|
import { Args, Flags } from '@oclif/core';
|
|
6
|
-
import fs from 'node:fs/promises';
|
|
7
|
-
import * as path from 'node:path';
|
|
8
2
|
import { BaseCommand } from '../../base-command.js';
|
|
9
|
-
import {
|
|
3
|
+
import { deploy } from '../../deploy.js';
|
|
10
4
|
export default class Branch extends BaseCommand {
|
|
11
5
|
static args = {
|
|
12
6
|
branch: Args.string({ description: 'branch name', required: true }),
|
|
13
7
|
};
|
|
14
|
-
static description = '
|
|
8
|
+
static description = 'branch a Raindrop application';
|
|
15
9
|
static examples = [
|
|
16
10
|
`<%= config.bin %> <%= command.id %> .
|
|
17
|
-
|
|
11
|
+
Branch a Raindrop application.
|
|
18
12
|
`,
|
|
19
13
|
];
|
|
20
14
|
static flags = {
|
|
15
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
21
16
|
root: Flags.string({ char: 'r', description: 'root directory', required: false, default: process.cwd() }),
|
|
22
17
|
manifest: Flags.string({
|
|
23
18
|
char: 'm',
|
|
@@ -25,23 +20,11 @@ Created new branch 1234
|
|
|
25
20
|
required: false,
|
|
26
21
|
default: 'raindrop.manifest',
|
|
27
22
|
}),
|
|
28
|
-
config: Flags.string({
|
|
29
|
-
char: 'c',
|
|
30
|
-
description: 'config file',
|
|
31
|
-
required: false,
|
|
32
|
-
hidden: true,
|
|
33
|
-
default: '.raindrop/config.json',
|
|
34
|
-
}),
|
|
35
23
|
output: Flags.string({ char: 'o', description: 'output directory', required: false, default: 'dist' }),
|
|
36
24
|
versionId: Flags.string({
|
|
37
25
|
char: 'p',
|
|
38
26
|
aliases: ['version'],
|
|
39
|
-
description: '
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
start: Flags.boolean({
|
|
43
|
-
description: 'Start the application',
|
|
44
|
-
default: false,
|
|
27
|
+
description: 'branch from this version',
|
|
45
28
|
required: false,
|
|
46
29
|
}),
|
|
47
30
|
impersonate: Flags.string({
|
|
@@ -50,15 +33,10 @@ Created new branch 1234
|
|
|
50
33
|
required: false,
|
|
51
34
|
hidden: true,
|
|
52
35
|
}),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
raindropCatalogService: Flags.string({
|
|
59
|
-
env: 'RAINDROP_CATALOG_SERVICE',
|
|
60
|
-
description: 'URL of the catalog service',
|
|
61
|
-
hidden: true,
|
|
36
|
+
start: Flags.boolean({
|
|
37
|
+
description: 'start the application after deploying',
|
|
38
|
+
default: false,
|
|
39
|
+
required: false,
|
|
62
40
|
}),
|
|
63
41
|
show: Flags.boolean({ description: 'show the current branch', required: false }),
|
|
64
42
|
};
|
|
@@ -69,99 +47,17 @@ Created new branch 1234
|
|
|
69
47
|
this.log(`Current versionId: ${config.versionId}`);
|
|
70
48
|
return;
|
|
71
49
|
}
|
|
72
|
-
// Build then deploy
|
|
73
|
-
const manifestPath = path.isAbsolute(this.flags.manifest)
|
|
74
|
-
? this.flags.manifest
|
|
75
|
-
: path.join(this.flags.root, this.flags.manifest);
|
|
76
|
-
// Do this first to check for errors.
|
|
77
|
-
const apps = await this.loadManifest();
|
|
78
|
-
// We should really just work with a single app at the moment.
|
|
79
|
-
if (apps[0] === undefined) {
|
|
80
|
-
this.error('There are no applications in the manifest');
|
|
81
|
-
}
|
|
82
|
-
const app = apps[0];
|
|
83
|
-
const manifestContents = await fs.readFile(manifestPath, 'utf8');
|
|
84
|
-
const buildDir = path.isAbsolute(this.flags.output)
|
|
85
|
-
? this.flags.output
|
|
86
|
-
: path.join(this.flags.root, this.flags.output);
|
|
87
|
-
// It's weird that it takes an array of apps.
|
|
88
|
-
await buildHandlers(this, apps, buildDir, this.flags.root);
|
|
89
50
|
const versionId = this.flags.versionId || config.versionId;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
branch: this.args.branch,
|
|
101
|
-
amend: false,
|
|
102
|
-
metadata: {
|
|
103
|
-
runtimeVersion,
|
|
104
|
-
},
|
|
105
|
-
manifest: manifestContents,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
});
|
|
109
|
-
if (deployResp.applications[0] === undefined) {
|
|
110
|
-
this.error('Failed to deploy application');
|
|
111
|
-
}
|
|
112
|
-
// If we deployed, we have to actually retrieve the
|
|
113
|
-
// currentVersionId from the response.
|
|
114
|
-
const currentVersionId = deployResp.applications[0].currentVersionId;
|
|
115
|
-
// And save it asap.
|
|
116
|
-
config.versionId = currentVersionId;
|
|
117
|
-
await this.saveConfig(config);
|
|
118
|
-
// Upload bundle to this version's store.
|
|
119
|
-
for (const handler of app.handlers()) {
|
|
120
|
-
const bundle = new FileSystemBundle(path.join(buildDir, valueOf(handler.name)));
|
|
121
|
-
await catalogService.uploadBundle({
|
|
122
|
-
userId,
|
|
123
|
-
organizationId,
|
|
124
|
-
applicationName: valueOf(app.name),
|
|
125
|
-
applicationVersionId: currentVersionId,
|
|
126
|
-
archiveType: BundleArchiveType.ZIP,
|
|
127
|
-
bundleName: valueOf(handler.name),
|
|
128
|
-
archive: Buffer.from(await archive(bundle)),
|
|
129
|
-
});
|
|
130
|
-
this.log(`Uploaded bundle "${valueOf(handler.name)}"`);
|
|
131
|
-
}
|
|
132
|
-
// Upload DB bundle if it exists.
|
|
133
|
-
const dbDir = path.join(this.flags.root, 'db');
|
|
134
|
-
let dbExists = false;
|
|
135
|
-
try {
|
|
136
|
-
const stat = await fs.lstat(dbDir);
|
|
137
|
-
dbExists = stat.isDirectory();
|
|
138
|
-
}
|
|
139
|
-
catch (_e) {
|
|
140
|
-
// Nothing to do
|
|
141
|
-
}
|
|
142
|
-
if (dbExists) {
|
|
143
|
-
const dbBundle = new FileSystemBundle(path.join(this.flags.root, 'db'));
|
|
144
|
-
await catalogService.uploadBundle({
|
|
145
|
-
userId,
|
|
146
|
-
organizationId,
|
|
147
|
-
applicationName: valueOf(app.name),
|
|
148
|
-
applicationVersionId: currentVersionId,
|
|
149
|
-
archiveType: BundleArchiveType.ZIP,
|
|
150
|
-
bundleName: 'db',
|
|
151
|
-
archive: Buffer.from(await archive(dbBundle)),
|
|
152
|
-
});
|
|
153
|
-
this.log(`Uploaded bundle "db"`);
|
|
154
|
-
}
|
|
155
|
-
// Release locks.
|
|
156
|
-
await catalogService.release({
|
|
157
|
-
userId,
|
|
158
|
-
organizationId,
|
|
159
|
-
locks: deployResp.applications.map((a) => new ReleaseRequest_Lock({
|
|
160
|
-
applicationName: a.applicationName,
|
|
161
|
-
currentVersionId: a.currentVersionId,
|
|
162
|
-
lock: a.lock,
|
|
163
|
-
})),
|
|
51
|
+
await deploy({
|
|
52
|
+
command: this,
|
|
53
|
+
root: this.flags.root,
|
|
54
|
+
manifest: this.flags.manifest,
|
|
55
|
+
output: this.flags.output,
|
|
56
|
+
previousVersionId: versionId,
|
|
57
|
+
branch: this.args.branch,
|
|
58
|
+
amend: false,
|
|
59
|
+
start: this.flags.start,
|
|
60
|
+
impersonate: this.flags.impersonate,
|
|
164
61
|
});
|
|
165
|
-
// TODO [ian] Call watch and subscribe to events.
|
|
166
62
|
}
|
|
167
63
|
}
|
|
@@ -6,10 +6,13 @@ export default class Branch extends BaseCommand<typeof Branch> {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
16
|
};
|
|
14
17
|
run(): Promise<void>;
|
|
15
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../src/commands/build/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAAsD;IAExE,MAAM,CAAC,QAAQ,WAOb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../src/commands/build/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAAsD;IAExE,MAAM,CAAC,QAAQ,WAOb;IAEF,MAAM,CAAC,KAAK;;;;;;;;MAGV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+B3B"}
|
|
@@ -14,24 +14,8 @@ Switched to version: 01jux6z20m4gbhn5kaa4mcm2jr
|
|
|
14
14
|
`,
|
|
15
15
|
];
|
|
16
16
|
static flags = {
|
|
17
|
-
|
|
18
|
-
char: 'c',
|
|
19
|
-
description: 'config file',
|
|
20
|
-
required: false,
|
|
21
|
-
hidden: true,
|
|
22
|
-
default: '.raindrop/config.json',
|
|
23
|
-
}),
|
|
17
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
24
18
|
output: Flags.string({ char: 'o', description: 'output format', required: false, default: 'text' }),
|
|
25
|
-
rainbowAuthService: Flags.string({
|
|
26
|
-
default: 'https://liquidmetal.run/api/connect',
|
|
27
|
-
hidden: true,
|
|
28
|
-
env: 'LIQUIDMETAL_RAINBOW_AUTH_SERVICE',
|
|
29
|
-
}),
|
|
30
|
-
raindropCatalogService: Flags.string({
|
|
31
|
-
env: 'RAINDROP_CATALOG_SERVICE',
|
|
32
|
-
description: 'URL of the catalog service',
|
|
33
|
-
hidden: true,
|
|
34
|
-
}),
|
|
35
19
|
};
|
|
36
20
|
async run() {
|
|
37
21
|
if (['text', 'json'].indexOf(this.flags.output) === -1) {
|
|
@@ -8,13 +8,16 @@ export default class Delete extends BaseCommand<typeof Delete> {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
root: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
12
|
version: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
13
|
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
14
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
21
|
};
|
|
19
22
|
run(): Promise<void>;
|
|
20
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/build/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAAkC;IAEpD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/build/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAAkC;IAEpD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;MAiCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsD3B"}
|
|
@@ -13,6 +13,7 @@ Deleted (application) at version (version)
|
|
|
13
13
|
`,
|
|
14
14
|
];
|
|
15
15
|
static flags = {
|
|
16
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
16
17
|
root: Flags.string({ char: 'r', description: 'root directory', required: false, default: process.cwd() }),
|
|
17
18
|
manifest: Flags.string({
|
|
18
19
|
char: 'm',
|
|
@@ -20,13 +21,6 @@ Deleted (application) at version (version)
|
|
|
20
21
|
required: false,
|
|
21
22
|
default: 'raindrop.manifest',
|
|
22
23
|
}),
|
|
23
|
-
config: Flags.string({
|
|
24
|
-
char: 'c',
|
|
25
|
-
description: 'config file',
|
|
26
|
-
required: false,
|
|
27
|
-
hidden: true,
|
|
28
|
-
default: '.raindrop/config.json',
|
|
29
|
-
}),
|
|
30
24
|
output: Flags.string({
|
|
31
25
|
char: 'o',
|
|
32
26
|
description: 'output format',
|
|
@@ -51,16 +45,6 @@ Deleted (application) at version (version)
|
|
|
51
45
|
required: false,
|
|
52
46
|
hidden: true,
|
|
53
47
|
}),
|
|
54
|
-
rainbowAuthService: Flags.string({
|
|
55
|
-
default: 'https://liquidmetal.run/api/connect',
|
|
56
|
-
hidden: true,
|
|
57
|
-
env: 'LIQUIDMETAL_RAINBOW_AUTH_SERVICE',
|
|
58
|
-
}),
|
|
59
|
-
raindropCatalogService: Flags.string({
|
|
60
|
-
env: 'RAINDROP_CATALOG_SERVICE',
|
|
61
|
-
description: 'URL of the catalog service',
|
|
62
|
-
hidden: true,
|
|
63
|
-
}),
|
|
64
48
|
};
|
|
65
49
|
async run() {
|
|
66
50
|
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
@@ -6,14 +6,19 @@ export default class Deploy extends BaseCommand<typeof Deploy> {
|
|
|
6
6
|
static flags: {
|
|
7
7
|
root: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
10
|
versionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
12
|
start: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
resume: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
lock: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
15
|
amend: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
22
|
};
|
|
18
23
|
run(): Promise<void>;
|
|
19
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/build/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/build/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmC;IAErD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;MAsCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+B3B"}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
|
-
import { archive } from '@liquidmetal-ai/drizzle/codestore';
|
|
3
|
-
import { BundleArchiveType, ReleaseRequest_Lock } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
4
|
-
import { FileSystemBundle } from '@liquidmetal-ai/drizzle/unsafe/codestore';
|
|
5
1
|
import { Flags } from '@oclif/core';
|
|
6
|
-
import fs from 'node:fs/promises';
|
|
7
|
-
import * as path from 'node:path';
|
|
8
2
|
import { BaseCommand } from '../../base-command.js';
|
|
9
|
-
import {
|
|
3
|
+
import { deploy } from '../../deploy.js';
|
|
10
4
|
export default class Deploy extends BaseCommand {
|
|
11
5
|
static args = {};
|
|
12
6
|
static description = 'deploy a Raindrop application';
|
|
13
7
|
static examples = [
|
|
14
8
|
`<%= config.bin %> <%= command.id %> .
|
|
15
|
-
Deploy a Raindrop application.
|
|
9
|
+
Deploy a Raindrop application version.
|
|
16
10
|
`,
|
|
17
11
|
];
|
|
18
12
|
static flags = {
|
|
13
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
19
14
|
root: Flags.string({ char: 'r', description: 'root directory', required: false, default: process.cwd() }),
|
|
20
15
|
manifest: Flags.string({
|
|
21
16
|
char: 'm',
|
|
@@ -23,13 +18,6 @@ Deploy a Raindrop application.
|
|
|
23
18
|
required: false,
|
|
24
19
|
default: 'raindrop.manifest',
|
|
25
20
|
}),
|
|
26
|
-
config: Flags.string({
|
|
27
|
-
char: 'c',
|
|
28
|
-
description: 'config file',
|
|
29
|
-
required: false,
|
|
30
|
-
hidden: true,
|
|
31
|
-
default: '.raindrop/config.json',
|
|
32
|
-
}),
|
|
33
21
|
output: Flags.string({ char: 'o', description: 'output directory', required: false, default: 'dist' }),
|
|
34
22
|
versionId: Flags.string({
|
|
35
23
|
char: 'v',
|
|
@@ -43,131 +31,49 @@ Deploy a Raindrop application.
|
|
|
43
31
|
required: false,
|
|
44
32
|
hidden: true,
|
|
45
33
|
}),
|
|
46
|
-
rainbowAuthService: Flags.string({
|
|
47
|
-
default: 'https://liquidmetal.run/api/connect',
|
|
48
|
-
hidden: true,
|
|
49
|
-
env: 'LIQUIDMETAL_RAINBOW_AUTH_SERVICE',
|
|
50
|
-
}),
|
|
51
|
-
raindropCatalogService: Flags.string({
|
|
52
|
-
env: 'RAINDROP_CATALOG_SERVICE',
|
|
53
|
-
description: 'URL of the catalog service',
|
|
54
|
-
hidden: true,
|
|
55
|
-
}),
|
|
56
34
|
start: Flags.boolean({
|
|
57
35
|
char: 's',
|
|
58
36
|
description: 'start the application after deploying',
|
|
59
37
|
required: false,
|
|
60
38
|
default: false,
|
|
61
39
|
}),
|
|
40
|
+
resume: Flags.boolean({
|
|
41
|
+
description: 'resume a deployment',
|
|
42
|
+
required: false,
|
|
43
|
+
default: false,
|
|
44
|
+
}),
|
|
45
|
+
lock: Flags.string({
|
|
46
|
+
description: 'override lock ID to resume deployment',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
62
49
|
amend: Flags.boolean({ char: 'a', description: 'amend an existing application', required: false, default: false }),
|
|
63
50
|
};
|
|
64
51
|
async run() {
|
|
65
|
-
// Build then deploy
|
|
66
|
-
const manifestPath = path.isAbsolute(this.flags.manifest)
|
|
67
|
-
? this.flags.manifest
|
|
68
|
-
: path.join(this.flags.root, this.flags.manifest);
|
|
69
|
-
// Do this first to check for errors.
|
|
70
|
-
const apps = await this.loadManifest();
|
|
71
|
-
// We should really just work with a single app at the moment.
|
|
72
|
-
if (apps[0] === undefined) {
|
|
73
|
-
this.error('There are no applications in the manifest');
|
|
74
|
-
}
|
|
75
|
-
const app = apps[0];
|
|
76
|
-
const manifestContents = await fs.readFile(manifestPath, 'utf8');
|
|
77
|
-
const buildDir = path.isAbsolute(this.flags.output)
|
|
78
|
-
? this.flags.output
|
|
79
|
-
: path.join(this.flags.root, this.flags.output);
|
|
80
|
-
// It's weird that it takes an array of apps.
|
|
81
|
-
await buildHandlers(this, apps, buildDir, this.flags.root);
|
|
82
52
|
const config = await this.loadConfig();
|
|
83
53
|
const versionId = this.flags.versionId ?? config.versionId;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
application: valueOf(app.name),
|
|
93
|
-
currentVersionId: this.flags.amend ? versionId : undefined,
|
|
94
|
-
previousVersionId: this.flags.amend ? undefined : versionId,
|
|
95
|
-
amend: this.flags.amend,
|
|
96
|
-
metadata: {
|
|
97
|
-
runtimeVersion,
|
|
98
|
-
},
|
|
99
|
-
manifest: manifestContents,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
});
|
|
103
|
-
if (deployResp.applications[0] === undefined) {
|
|
104
|
-
this.error('Failed to deploy application');
|
|
105
|
-
}
|
|
106
|
-
// If we deployed, we have to actually retrieve the
|
|
107
|
-
// currentVersionId from the response.
|
|
108
|
-
const currentVersionId = deployResp.applications[0].currentVersionId;
|
|
109
|
-
// And save it asap.
|
|
110
|
-
config.versionId = currentVersionId;
|
|
111
|
-
await this.saveConfig(config);
|
|
112
|
-
// Upload bundle to this version's store.
|
|
113
|
-
for (const handler of app.handlers()) {
|
|
114
|
-
const bundle = new FileSystemBundle(path.join(buildDir, valueOf(handler.name)));
|
|
115
|
-
await catalogService.uploadBundle({
|
|
116
|
-
userId,
|
|
117
|
-
organizationId,
|
|
118
|
-
applicationName: valueOf(app.name),
|
|
119
|
-
applicationVersionId: currentVersionId,
|
|
120
|
-
archiveType: BundleArchiveType.ZIP,
|
|
121
|
-
bundleName: valueOf(handler.name),
|
|
122
|
-
archive: Buffer.from(await archive(bundle)),
|
|
123
|
-
});
|
|
124
|
-
this.log(`Uploaded bundle "${valueOf(handler.name)}"`);
|
|
125
|
-
}
|
|
126
|
-
// Upload DB bundle if it exists.
|
|
127
|
-
const dbDir = path.join(this.flags.root, 'db');
|
|
128
|
-
let dbExists = false;
|
|
129
|
-
try {
|
|
130
|
-
const stat = await fs.lstat(dbDir);
|
|
131
|
-
dbExists = stat.isDirectory();
|
|
132
|
-
}
|
|
133
|
-
catch (_e) {
|
|
134
|
-
// Nothing to do
|
|
135
|
-
}
|
|
136
|
-
if (dbExists) {
|
|
137
|
-
const dbBundle = new FileSystemBundle(path.join(this.flags.root, 'db'));
|
|
138
|
-
await catalogService.uploadBundle({
|
|
139
|
-
userId,
|
|
140
|
-
organizationId,
|
|
141
|
-
applicationName: valueOf(app.name),
|
|
142
|
-
applicationVersionId: currentVersionId,
|
|
143
|
-
archiveType: BundleArchiveType.ZIP,
|
|
144
|
-
bundleName: 'db',
|
|
145
|
-
archive: Buffer.from(await archive(dbBundle)),
|
|
146
|
-
});
|
|
147
|
-
this.log(`Uploaded bundle "db"`);
|
|
148
|
-
}
|
|
149
|
-
// Set to start?
|
|
150
|
-
if (this.flags.start) {
|
|
151
|
-
await catalogService.setActive({
|
|
152
|
-
userId,
|
|
153
|
-
organizationId,
|
|
154
|
-
applications: deployResp.applications.map((a) => ({
|
|
155
|
-
applicationName: a.applicationName,
|
|
156
|
-
currentVersionId: a.currentVersionId,
|
|
157
|
-
isActive: this.flags.start,
|
|
158
|
-
})),
|
|
159
|
-
});
|
|
54
|
+
const unlock = this.flags.resume ? this.flags.lock ?? config.lock : undefined;
|
|
55
|
+
if (this.flags.resume) {
|
|
56
|
+
if (versionId === undefined) {
|
|
57
|
+
this.error(`Cannot resume deployment without a versionId. Please specify a versionId or run without --resume to start a new deployment.`);
|
|
58
|
+
}
|
|
59
|
+
if (unlock === undefined) {
|
|
60
|
+
this.error(`Cannot resume deployment without a lock. Please specify --lock or run without --resume to start a new deployment.`);
|
|
61
|
+
}
|
|
160
62
|
}
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
63
|
+
// Resuming is _always_ amending
|
|
64
|
+
const amend = this.flags.resume || this.flags.amend;
|
|
65
|
+
await deploy({
|
|
66
|
+
command: this,
|
|
67
|
+
root: this.flags.root,
|
|
68
|
+
manifest: this.flags.manifest,
|
|
69
|
+
output: this.flags.output,
|
|
70
|
+
versionId,
|
|
71
|
+
currentVersionId: amend ? versionId : undefined,
|
|
72
|
+
previousVersionId: amend ? undefined : versionId,
|
|
73
|
+
amend,
|
|
74
|
+
lock: unlock,
|
|
75
|
+
start: this.flags.start,
|
|
76
|
+
impersonate: this.flags.impersonate,
|
|
170
77
|
});
|
|
171
|
-
// TODO [ian] Call watch and subscribe to events.
|
|
172
78
|
}
|
|
173
79
|
}
|
|
@@ -7,13 +7,16 @@ export default class Get extends BaseCommand<typeof Get> {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
10
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
11
|
versionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
12
|
application: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
13
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
14
|
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
20
|
};
|
|
18
21
|
run(): Promise<void>;
|
|
19
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/env/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAA2B;IAE7C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/env/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,MAAM,CAAC,IAAI;;MAET;IAEF,MAAM,CAAC,WAAW,SAA2B;IAE7C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MA0BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2D3B"}
|
|
@@ -12,17 +12,8 @@ sets an env var/secret.
|
|
|
12
12
|
`,
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
15
16
|
output: Flags.string({ char: 'o', description: 'output format', default: 'table' }),
|
|
16
|
-
rainbowAuthService: Flags.string({
|
|
17
|
-
default: 'https://liquidmetal.run/api/connect',
|
|
18
|
-
hidden: true,
|
|
19
|
-
env: 'LIQUIDMETAL_RAINBOW_AUTH_SERVICE',
|
|
20
|
-
}),
|
|
21
|
-
raindropCatalogService: Flags.string({
|
|
22
|
-
env: 'RAINDROP_CATALOG_SERVICE',
|
|
23
|
-
description: 'URL of the catalog service',
|
|
24
|
-
hidden: true,
|
|
25
|
-
}),
|
|
26
17
|
manifest: Flags.string({
|
|
27
18
|
char: 'm',
|
|
28
19
|
description: 'project manifest',
|
|
@@ -46,13 +37,6 @@ sets an env var/secret.
|
|
|
46
37
|
required: false,
|
|
47
38
|
hidden: true,
|
|
48
39
|
}),
|
|
49
|
-
config: Flags.string({
|
|
50
|
-
char: 'c',
|
|
51
|
-
description: 'config file',
|
|
52
|
-
required: false,
|
|
53
|
-
hidden: true,
|
|
54
|
-
default: '.raindrop/config.json',
|
|
55
|
-
}),
|
|
56
40
|
};
|
|
57
41
|
async run() {
|
|
58
42
|
const apps = await this.loadManifest();
|
|
@@ -9,13 +9,16 @@ export default class Set extends BaseCommand<typeof Set> {
|
|
|
9
9
|
static flags: {
|
|
10
10
|
root: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
12
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
13
|
versionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
14
|
application: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
15
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
18
|
raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
22
|
};
|
|
20
23
|
run(): Promise<void>;
|
|
21
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/env/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,MAAM,CAAC,IAAI;;;MAGT;IAEF,MAAM,CAAC,WAAW,SAA2B;IAE7C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/env/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,MAAM,CAAC,IAAI;;;MAGT;IAEF,MAAM,CAAC,WAAW,SAA2B;IAE7C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;MA2BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsE3B"}
|