@liquidmetal-ai/raindrop 0.2.6 → 0.2.8
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 +76 -60
- package/dist/base-command.d.ts +14 -20
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +1 -17
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +6 -0
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/auth/login.js +2 -1
- package/dist/commands/build/branch.d.ts +1 -1
- package/dist/commands/build/branch.d.ts.map +1 -1
- package/dist/commands/build/branch.js +19 -107
- package/dist/commands/build/deploy.d.ts +2 -0
- package/dist/commands/build/deploy.d.ts.map +1 -1
- package/dist/commands/build/deploy.js +33 -111
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +4 -2
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +11 -6
- package/dist/commands/build/status.d.ts.map +1 -1
- 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 +175 -0
- package/dist/index.d.ts +14 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +964 -949
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IAC1D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAuF;IAEzG,MAAM,CAAC,KAAK;;MAMV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8D3B"}
|
|
@@ -4,6 +4,7 @@ import qrcode from 'qrcode-terminal';
|
|
|
4
4
|
import { spinner } from 'zx';
|
|
5
5
|
import { BaseCommand } from '../../base-command.js';
|
|
6
6
|
import { readState, replaceState } from '../../index.js';
|
|
7
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
7
8
|
function sleep(dur) {
|
|
8
9
|
const ms = dur.nanos / 1e6 + Number(dur.seconds * 1000n);
|
|
9
10
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -35,7 +36,7 @@ export default class Login extends BaseCommand {
|
|
|
35
36
|
let interval = initialInterval;
|
|
36
37
|
let done = false;
|
|
37
38
|
while (!done) {
|
|
38
|
-
if (new Date() > expiresAt
|
|
39
|
+
if (new Date() > timestampDate(expiresAt)) {
|
|
39
40
|
console.error('failed to authenticate in time');
|
|
40
41
|
this.exit(1);
|
|
41
42
|
}
|
|
@@ -10,8 +10,8 @@ export default class Branch extends BaseCommand<typeof Branch> {
|
|
|
10
10
|
manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
versionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
start: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
13
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
start: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
show: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
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>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/commands/build/branch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/commands/build/branch.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;;MAET;IAEF,MAAM,CAAC,WAAW,SAAmC;IAErD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MA4BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB3B"}
|
|
@@ -1,20 +1,14 @@
|
|
|
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 = {
|
|
@@ -30,12 +24,7 @@ Created new branch 1234
|
|
|
30
24
|
versionId: Flags.string({
|
|
31
25
|
char: 'p',
|
|
32
26
|
aliases: ['version'],
|
|
33
|
-
description: '
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
start: Flags.boolean({
|
|
37
|
-
description: 'Start the application',
|
|
38
|
-
default: false,
|
|
27
|
+
description: 'branch from this version',
|
|
39
28
|
required: false,
|
|
40
29
|
}),
|
|
41
30
|
impersonate: Flags.string({
|
|
@@ -44,6 +33,11 @@ Created new branch 1234
|
|
|
44
33
|
required: false,
|
|
45
34
|
hidden: true,
|
|
46
35
|
}),
|
|
36
|
+
start: Flags.boolean({
|
|
37
|
+
description: 'start the application after deploying',
|
|
38
|
+
default: false,
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
47
41
|
show: Flags.boolean({ description: 'show the current branch', required: false }),
|
|
48
42
|
};
|
|
49
43
|
async run() {
|
|
@@ -53,99 +47,17 @@ Created new branch 1234
|
|
|
53
47
|
this.log(`Current versionId: ${config.versionId}`);
|
|
54
48
|
return;
|
|
55
49
|
}
|
|
56
|
-
// Build then deploy
|
|
57
|
-
const manifestPath = path.isAbsolute(this.flags.manifest)
|
|
58
|
-
? this.flags.manifest
|
|
59
|
-
: path.join(this.flags.root, this.flags.manifest);
|
|
60
|
-
// Do this first to check for errors.
|
|
61
|
-
const apps = await this.loadManifest();
|
|
62
|
-
// We should really just work with a single app at the moment.
|
|
63
|
-
if (apps[0] === undefined) {
|
|
64
|
-
this.error('There are no applications in the manifest');
|
|
65
|
-
}
|
|
66
|
-
const app = apps[0];
|
|
67
|
-
const manifestContents = await fs.readFile(manifestPath, 'utf8');
|
|
68
|
-
const buildDir = path.isAbsolute(this.flags.output)
|
|
69
|
-
? this.flags.output
|
|
70
|
-
: path.join(this.flags.root, this.flags.output);
|
|
71
|
-
// It's weird that it takes an array of apps.
|
|
72
|
-
await buildHandlers(this, apps, buildDir, this.flags.root);
|
|
73
50
|
const versionId = this.flags.versionId || config.versionId;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
branch: this.args.branch,
|
|
85
|
-
amend: false,
|
|
86
|
-
metadata: {
|
|
87
|
-
runtimeVersion,
|
|
88
|
-
},
|
|
89
|
-
manifest: manifestContents,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
});
|
|
93
|
-
if (deployResp.applications[0] === undefined) {
|
|
94
|
-
this.error('Failed to deploy application');
|
|
95
|
-
}
|
|
96
|
-
// If we deployed, we have to actually retrieve the
|
|
97
|
-
// currentVersionId from the response.
|
|
98
|
-
const currentVersionId = deployResp.applications[0].currentVersionId;
|
|
99
|
-
// And save it asap.
|
|
100
|
-
config.versionId = currentVersionId;
|
|
101
|
-
await this.saveConfig(config);
|
|
102
|
-
// Upload bundle to this version's store.
|
|
103
|
-
for (const handler of app.handlers()) {
|
|
104
|
-
const bundle = new FileSystemBundle(path.join(buildDir, valueOf(handler.name)));
|
|
105
|
-
await catalogService.uploadBundle({
|
|
106
|
-
userId,
|
|
107
|
-
organizationId,
|
|
108
|
-
applicationName: valueOf(app.name),
|
|
109
|
-
applicationVersionId: currentVersionId,
|
|
110
|
-
archiveType: BundleArchiveType.ZIP,
|
|
111
|
-
bundleName: valueOf(handler.name),
|
|
112
|
-
archive: Buffer.from(await archive(bundle)),
|
|
113
|
-
});
|
|
114
|
-
this.log(`Uploaded bundle "${valueOf(handler.name)}"`);
|
|
115
|
-
}
|
|
116
|
-
// Upload DB bundle if it exists.
|
|
117
|
-
const dbDir = path.join(this.flags.root, 'db');
|
|
118
|
-
let dbExists = false;
|
|
119
|
-
try {
|
|
120
|
-
const stat = await fs.lstat(dbDir);
|
|
121
|
-
dbExists = stat.isDirectory();
|
|
122
|
-
}
|
|
123
|
-
catch (_e) {
|
|
124
|
-
// Nothing to do
|
|
125
|
-
}
|
|
126
|
-
if (dbExists) {
|
|
127
|
-
const dbBundle = new FileSystemBundle(path.join(this.flags.root, 'db'));
|
|
128
|
-
await catalogService.uploadBundle({
|
|
129
|
-
userId,
|
|
130
|
-
organizationId,
|
|
131
|
-
applicationName: valueOf(app.name),
|
|
132
|
-
applicationVersionId: currentVersionId,
|
|
133
|
-
archiveType: BundleArchiveType.ZIP,
|
|
134
|
-
bundleName: 'db',
|
|
135
|
-
archive: Buffer.from(await archive(dbBundle)),
|
|
136
|
-
});
|
|
137
|
-
this.log(`Uploaded bundle "db"`);
|
|
138
|
-
}
|
|
139
|
-
// Release locks.
|
|
140
|
-
await catalogService.release({
|
|
141
|
-
userId,
|
|
142
|
-
organizationId,
|
|
143
|
-
locks: deployResp.applications.map((a) => new ReleaseRequest_Lock({
|
|
144
|
-
applicationName: a.applicationName,
|
|
145
|
-
currentVersionId: a.currentVersionId,
|
|
146
|
-
lock: a.lock,
|
|
147
|
-
})),
|
|
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,
|
|
148
61
|
});
|
|
149
|
-
// TODO [ian] Call watch and subscribe to events.
|
|
150
62
|
}
|
|
151
63
|
}
|
|
@@ -10,6 +10,8 @@ export default class Deploy extends BaseCommand<typeof Deploy> {
|
|
|
10
10
|
versionId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
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>;
|
|
13
15
|
amend: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
16
|
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
17
|
rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -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,18 +1,12 @@
|
|
|
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 = {
|
|
@@ -43,115 +37,43 @@ Deploy a Raindrop application.
|
|
|
43
37
|
required: false,
|
|
44
38
|
default: false,
|
|
45
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
|
+
}),
|
|
46
49
|
amend: Flags.boolean({ char: 'a', description: 'amend an existing application', required: false, default: false }),
|
|
47
50
|
};
|
|
48
51
|
async run() {
|
|
49
|
-
// Build then deploy
|
|
50
|
-
const manifestPath = path.isAbsolute(this.flags.manifest)
|
|
51
|
-
? this.flags.manifest
|
|
52
|
-
: path.join(this.flags.root, this.flags.manifest);
|
|
53
|
-
// Do this first to check for errors.
|
|
54
|
-
const apps = await this.loadManifest();
|
|
55
|
-
// We should really just work with a single app at the moment.
|
|
56
|
-
if (apps[0] === undefined) {
|
|
57
|
-
this.error('There are no applications in the manifest');
|
|
58
|
-
}
|
|
59
|
-
const app = apps[0];
|
|
60
|
-
const manifestContents = await fs.readFile(manifestPath, 'utf8');
|
|
61
|
-
const buildDir = path.isAbsolute(this.flags.output)
|
|
62
|
-
? this.flags.output
|
|
63
|
-
: path.join(this.flags.root, this.flags.output);
|
|
64
|
-
// It's weird that it takes an array of apps.
|
|
65
|
-
await buildHandlers(this, apps, buildDir, this.flags.root);
|
|
66
52
|
const config = await this.loadConfig();
|
|
67
53
|
const versionId = this.flags.versionId ?? config.versionId;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
application: valueOf(app.name),
|
|
77
|
-
currentVersionId: this.flags.amend ? versionId : undefined,
|
|
78
|
-
previousVersionId: this.flags.amend ? undefined : versionId,
|
|
79
|
-
amend: this.flags.amend,
|
|
80
|
-
metadata: {
|
|
81
|
-
runtimeVersion,
|
|
82
|
-
},
|
|
83
|
-
manifest: manifestContents,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
});
|
|
87
|
-
if (deployResp.applications[0] === undefined) {
|
|
88
|
-
this.error('Failed to deploy application');
|
|
89
|
-
}
|
|
90
|
-
// If we deployed, we have to actually retrieve the
|
|
91
|
-
// currentVersionId from the response.
|
|
92
|
-
const currentVersionId = deployResp.applications[0].currentVersionId;
|
|
93
|
-
// And save it asap.
|
|
94
|
-
config.versionId = currentVersionId;
|
|
95
|
-
await this.saveConfig(config);
|
|
96
|
-
// Upload bundle to this version's store.
|
|
97
|
-
for (const handler of app.handlers()) {
|
|
98
|
-
const bundle = new FileSystemBundle(path.join(buildDir, valueOf(handler.name)));
|
|
99
|
-
await catalogService.uploadBundle({
|
|
100
|
-
userId,
|
|
101
|
-
organizationId,
|
|
102
|
-
applicationName: valueOf(app.name),
|
|
103
|
-
applicationVersionId: currentVersionId,
|
|
104
|
-
archiveType: BundleArchiveType.ZIP,
|
|
105
|
-
bundleName: valueOf(handler.name),
|
|
106
|
-
archive: Buffer.from(await archive(bundle)),
|
|
107
|
-
});
|
|
108
|
-
this.log(`Uploaded bundle "${valueOf(handler.name)}"`);
|
|
109
|
-
}
|
|
110
|
-
// Upload DB bundle if it exists.
|
|
111
|
-
const dbDir = path.join(this.flags.root, 'db');
|
|
112
|
-
let dbExists = false;
|
|
113
|
-
try {
|
|
114
|
-
const stat = await fs.lstat(dbDir);
|
|
115
|
-
dbExists = stat.isDirectory();
|
|
116
|
-
}
|
|
117
|
-
catch (_e) {
|
|
118
|
-
// Nothing to do
|
|
119
|
-
}
|
|
120
|
-
if (dbExists) {
|
|
121
|
-
const dbBundle = new FileSystemBundle(path.join(this.flags.root, 'db'));
|
|
122
|
-
await catalogService.uploadBundle({
|
|
123
|
-
userId,
|
|
124
|
-
organizationId,
|
|
125
|
-
applicationName: valueOf(app.name),
|
|
126
|
-
applicationVersionId: currentVersionId,
|
|
127
|
-
archiveType: BundleArchiveType.ZIP,
|
|
128
|
-
bundleName: 'db',
|
|
129
|
-
archive: Buffer.from(await archive(dbBundle)),
|
|
130
|
-
});
|
|
131
|
-
this.log(`Uploaded bundle "db"`);
|
|
132
|
-
}
|
|
133
|
-
// Set to start?
|
|
134
|
-
if (this.flags.start) {
|
|
135
|
-
await catalogService.setActive({
|
|
136
|
-
userId,
|
|
137
|
-
organizationId,
|
|
138
|
-
applications: deployResp.applications.map((a) => ({
|
|
139
|
-
applicationName: a.applicationName,
|
|
140
|
-
currentVersionId: a.currentVersionId,
|
|
141
|
-
isActive: this.flags.start,
|
|
142
|
-
})),
|
|
143
|
-
});
|
|
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
|
+
}
|
|
144
62
|
}
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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,
|
|
154
77
|
});
|
|
155
|
-
// TODO [ian] Call watch and subscribe to events.
|
|
156
78
|
}
|
|
157
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAgC;IAElD,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAsCV;IAEI,cAAc,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAgD5G,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAO3B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
1
2
|
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
|
+
import { EPOCH_TS } from '../../index.js';
|
|
4
6
|
export default class Find extends BaseCommand {
|
|
5
7
|
static args = {};
|
|
6
8
|
static description = 'find resources in Raindrop';
|
|
@@ -72,7 +74,7 @@ export default class Find extends BaseCommand {
|
|
|
72
74
|
console.table(resp.resources.reduce((acc, v) => {
|
|
73
75
|
acc[v.name] = {
|
|
74
76
|
...v,
|
|
75
|
-
attributes: JSON.stringify(v.attributes
|
|
77
|
+
attributes: JSON.stringify(v.attributes, null, 2),
|
|
76
78
|
};
|
|
77
79
|
return acc;
|
|
78
80
|
},
|
|
@@ -84,7 +86,7 @@ export default class Find extends BaseCommand {
|
|
|
84
86
|
}
|
|
85
87
|
else {
|
|
86
88
|
for (const r of resp.resources) {
|
|
87
|
-
console.log(`${r.name} ${r.resourceId} ${r.applicationName} ${r.applicationVersionId} ${r.type} ${r.createdAt
|
|
89
|
+
console.log(`${r.name} ${r.resourceId} ${r.applicationName} ${r.applicationVersionId} ${r.type} ${timestampDate(r.createdAt || EPOCH_TS).toISOString()} ${timestampDate(r.updatedAt || EPOCH_TS).toISOString()} ${JSON.stringify(r.attributes)}`);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAGtH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,gCAAgC,CAAC;IAC9C,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAqC;IAEvD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;MAsBV;IAEF,gBAAgB,CAAC,YAAY,EAAE,gCAAgC,EAAE;;;;IAkCjE,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,EAAE;IAqH5D,gBAAgB;IAyChB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { UnitState } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
2
|
+
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
2
3
|
import { Flags } from '@oclif/core';
|
|
3
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
|
+
import { EPOCH_TS } from '../../index.js';
|
|
4
6
|
export const statusString = {
|
|
5
7
|
[UnitState.UNSPECIFIED]: '<unknown>',
|
|
6
8
|
[UnitState.PENDING]: 'pending...',
|
|
@@ -109,8 +111,8 @@ List Raindrop catalog resources.
|
|
|
109
111
|
rootNodes.forEach((root) => flatten(root));
|
|
110
112
|
// Sort flattened nodes by timestamp (newest first)
|
|
111
113
|
flattenedNodes.sort((a, b) => {
|
|
112
|
-
const aTime = a.application.createdAt
|
|
113
|
-
const bTime = b.application.createdAt
|
|
114
|
+
const aTime = timestampDate(a.application.createdAt || EPOCH_TS).getTime() || 0;
|
|
115
|
+
const bTime = timestampDate(b.application.createdAt || EPOCH_TS).getTime() || 0;
|
|
114
116
|
return bTime - aTime;
|
|
115
117
|
});
|
|
116
118
|
// Generate graph lines
|
|
@@ -124,7 +126,8 @@ List Raindrop catalog resources.
|
|
|
124
126
|
const column = columnMap.get(node.versionId) || 0;
|
|
125
127
|
linesInUse.add(column);
|
|
126
128
|
// Format timestamp like git
|
|
127
|
-
const
|
|
129
|
+
const date = timestampDate(app.createdAt || EPOCH_TS);
|
|
130
|
+
const timestamp = date.toLocaleString('en-US', {
|
|
128
131
|
weekday: 'short',
|
|
129
132
|
month: 'short',
|
|
130
133
|
day: 'numeric',
|
|
@@ -187,8 +190,10 @@ List Raindrop catalog resources.
|
|
|
187
190
|
this.log(this.renderGitLogStyle(resp.applications));
|
|
188
191
|
}
|
|
189
192
|
else if (this.flags.output === 'table') {
|
|
190
|
-
console.table(resp.applications.reduce(
|
|
191
|
-
|
|
193
|
+
console.table(resp.applications.reduce(
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
195
|
+
(acc, a) => {
|
|
196
|
+
const dateStr = a.createdAt ? timestampDate(a.createdAt).toISOString() : '';
|
|
192
197
|
acc[dateStr] = {
|
|
193
198
|
...a,
|
|
194
199
|
status: statusString[a.state],
|
|
@@ -203,7 +208,7 @@ List Raindrop catalog resources.
|
|
|
203
208
|
}
|
|
204
209
|
else {
|
|
205
210
|
for (const a of resp.applications) {
|
|
206
|
-
console.log(`${a.createdAt
|
|
211
|
+
console.log(`${timestampDate(a.createdAt || EPOCH_TS).toISOString()} ${a.organizationId} ${a.versionId} ${a.name} (${a.isActive ? 'active' : 'inactive'})`);
|
|
207
212
|
}
|
|
208
213
|
}
|
|
209
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAIpG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAsCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AAIpG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CASzC,CAAC;AAEX,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC5D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAmD;IAErE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;;;MAsCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgE1B,iBAAiB,SAAK;IAEhB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA6BxD"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const ConfigSchema: z.ZodObject<{
|
|
3
3
|
versionId: z.ZodOptional<z.ZodString>;
|
|
4
|
+
lock: z.ZodOptional<z.ZodString>;
|
|
4
5
|
}, "strip", z.ZodTypeAny, {
|
|
5
6
|
versionId?: string | undefined;
|
|
7
|
+
lock?: string | undefined;
|
|
6
8
|
}, {
|
|
7
9
|
versionId?: string | undefined;
|
|
10
|
+
lock?: string | undefined;
|
|
8
11
|
}>;
|
|
9
12
|
export type Config = z.infer<typeof ConfigSchema>;
|
|
10
13
|
export declare const defaultConfig: Config;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,aAAa,EAAE,MAG3B,CAAC;AAKF,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpE;AAGD,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlF"}
|
package/dist/config.js
CHANGED
|
@@ -4,9 +4,11 @@ import { z } from 'zod';
|
|
|
4
4
|
import { ensureDirectory } from './index.js';
|
|
5
5
|
export const ConfigSchema = z.object({
|
|
6
6
|
versionId: z.string().optional(),
|
|
7
|
+
lock: z.string().optional(),
|
|
7
8
|
});
|
|
8
9
|
export const defaultConfig = {
|
|
9
10
|
versionId: undefined,
|
|
11
|
+
lock: undefined,
|
|
10
12
|
};
|
|
11
13
|
// loadConfig reads the configuration file at path and always returns
|
|
12
14
|
// an object that conforms to the ConfigSchema, even if it's empty. If
|
package/dist/deploy.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseCommand } from './base-command.js';
|
|
2
|
+
export interface DeployOptions<T extends typeof BaseCommand> {
|
|
3
|
+
command: BaseCommand<T>;
|
|
4
|
+
root: string;
|
|
5
|
+
manifest: string;
|
|
6
|
+
output: string;
|
|
7
|
+
versionId?: string;
|
|
8
|
+
currentVersionId?: string;
|
|
9
|
+
previousVersionId?: string;
|
|
10
|
+
branch?: string;
|
|
11
|
+
amend: boolean;
|
|
12
|
+
lock?: string;
|
|
13
|
+
start: boolean;
|
|
14
|
+
impersonate?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function deploy<T extends typeof BaseCommand>(options: DeployOptions<T>): Promise<string>;
|
|
17
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,OAAO,WAAW;IAEzD,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAGxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,MAAM,CAAC,CAAC,SAAS,OAAO,WAAW,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAoHrG"}
|