@liquidmetal-ai/raindrop 0.2.8 → 0.2.10
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 +1 -776
- package/dist/base-command.d.ts +2 -1
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +11 -1
- package/dist/build.js +1 -1
- package/dist/codegen.d.ts +9 -2
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +93 -16
- package/dist/codegen.test.js +21 -0
- package/dist/commands/auth/login.d.ts.map +1 -1
- package/dist/commands/build/branch.d.ts.map +1 -1
- package/dist/commands/build/branch.js +16 -1
- package/dist/commands/build/checkout.d.ts.map +1 -1
- package/dist/commands/build/checkout.js +4 -1
- package/dist/commands/build/delete.js +2 -2
- package/dist/commands/build/deploy.d.ts.map +1 -1
- package/dist/commands/build/deploy.js +9 -3
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +3 -1
- package/dist/commands/build/generate.d.ts.map +1 -1
- package/dist/commands/build/generate.js +1 -0
- package/dist/commands/build/init.js +1 -1
- package/dist/commands/build/list.d.ts.map +1 -1
- package/dist/commands/build/list.js +6 -4
- package/dist/commands/build/sandbox.d.ts.map +1 -1
- package/dist/commands/build/sandbox.js +8 -2
- package/dist/commands/build/start.d.ts.map +1 -1
- package/dist/commands/build/start.js +5 -2
- package/dist/commands/build/status.d.ts.map +1 -1
- package/dist/commands/build/status.js +5 -4
- package/dist/commands/build/stop.d.ts.map +1 -1
- package/dist/commands/build/stop.js +5 -2
- package/dist/commands/build/unsandbox.d.ts.map +1 -1
- package/dist/commands/build/unsandbox.js +8 -2
- package/dist/commands/build/validate.js +3 -3
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +8 -4
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +8 -6
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +14 -10
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +11 -7
- package/dist/commands/query/chunk-search.d.ts.map +1 -1
- package/dist/commands/query/chunk-search.js +11 -9
- package/dist/commands/query/register-retriever.d.ts.map +1 -1
- package/dist/commands/query/register-retriever.js +2 -7
- package/dist/commands/query/search.d.ts.map +1 -1
- package/dist/commands/query/search.js +15 -15
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.test.js +3 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/trace.d.ts +20 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +117 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +2 -4827
- package/package.json +1 -1
- package/templates/db/common/kysely-d1.ts +173 -0
- package/templates/db/db/README.md +32 -0
- package/templates/db/package.json +19 -0
- package/templates/db/prisma/schema.prisma.hbs +46 -0
- package/templates/db/scripts/create_migration.mts +78 -0
- package/templates/db/scripts/seed-sql.mts +32 -0
- package/templates/db/scripts/seed.ts.hbs +219 -0
- package/templates/init/package.json.hbs +1 -1
package/dist/base-command.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Client } from '@connectrpc/connect';
|
|
|
2
2
|
import { Application } from '@liquidmetal-ai/drizzle/appify/build';
|
|
3
3
|
import { CatalogService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
4
4
|
import { RainbowAuthService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/rainbow_auth_pb';
|
|
5
|
-
import { ObjectService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/
|
|
5
|
+
import { ObjectService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/object_pb';
|
|
6
6
|
import { SearchAgentService } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/search_agent_pb';
|
|
7
7
|
import { Command, Interfaces } from '@oclif/core';
|
|
8
8
|
import { Config } from './config.js';
|
|
@@ -52,5 +52,6 @@ export declare abstract class BaseCommand<T extends typeof Command> extends Comm
|
|
|
52
52
|
client: Client<typeof RainbowAuthService>;
|
|
53
53
|
}>;
|
|
54
54
|
raindropFrameworkVersion(): Promise<string>;
|
|
55
|
+
log(message?: string, ...args: any[]): void;
|
|
55
56
|
}
|
|
56
57
|
//# sourceMappingURL=base-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,wDAAwD,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8DAA8D,CAAC;AAElG,OAAO,EAAE,OAAO,EAAS,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,MAAM,EAA0B,MAAM,aAAa,CAAC;AAC7D,OAAO,EAML,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,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CAAC;QACf,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;cAac,kBAAkB,IAAI,OAAO,CAAC;QAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;QAC1C,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;cAYc,aAAa,IAAI,OAAO,CAAC;QACvC,MAAM,EAAE,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;QACrC,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;cAgBc,kBAAkB,IAAI,OAAO,CAAC;QAC5C,MAAM,EAAE,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;KAC3C,CAAC;IAMI,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC;IAWjD,GAAG,CAAC,OAAO,GAAE,MAAW,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAGhD"}
|
package/dist/base-command.js
CHANGED
|
@@ -144,10 +144,14 @@ export class BaseCommand extends Command {
|
|
|
144
144
|
}
|
|
145
145
|
async objectService() {
|
|
146
146
|
const { client: rainbowAuth } = await this.rainbowAuthService();
|
|
147
|
+
const identity = await this.catalogIdentity();
|
|
147
148
|
const result = await objectService({
|
|
148
149
|
rainbowAuth,
|
|
149
150
|
configDir: this.config.configDir,
|
|
150
|
-
identity:
|
|
151
|
+
identity: {
|
|
152
|
+
...identity,
|
|
153
|
+
baseUrl: `https://api-${this.flags.bucket}.${identity.organizationId}.lmapp.run`,
|
|
154
|
+
},
|
|
151
155
|
});
|
|
152
156
|
return result;
|
|
153
157
|
}
|
|
@@ -162,4 +166,10 @@ export class BaseCommand extends Command {
|
|
|
162
166
|
}
|
|
163
167
|
return version;
|
|
164
168
|
}
|
|
169
|
+
// log overrides the default oclif log method to use stderr, so that actual command output can be
|
|
170
|
+
// piped to other commands properly
|
|
171
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
172
|
+
log(message = '', ...args) {
|
|
173
|
+
this.logToStderr(message, ...args);
|
|
174
|
+
}
|
|
165
175
|
}
|
package/dist/build.js
CHANGED
|
@@ -33,7 +33,7 @@ export default async function build(options) {
|
|
|
33
33
|
}
|
|
34
34
|
const buildResult = await esbuild.build({
|
|
35
35
|
entryPoints: options.entryPoints,
|
|
36
|
-
external: ['crypto', '@liquidmetal-ai/raindrop-framework', './runtime.js'],
|
|
36
|
+
external: ['node:crypto', 'crypto', '@liquidmetal-ai/raindrop-framework', './runtime.js'],
|
|
37
37
|
alias: {
|
|
38
38
|
'@liquidmetal-ai/raindrop-framework': './runtime.js',
|
|
39
39
|
},
|
package/dist/codegen.d.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import { Actor, Application, Observer, Service } from '@liquidmetal-ai/drizzle/appify/build';
|
|
1
|
+
import { Actor, Application, Observer, Service, Task } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
2
|
export declare const TOOL_NAME = "raindrop build";
|
|
3
3
|
export declare const TEMPLATES_DIR: string;
|
|
4
4
|
export declare const TEMPLATE_INIT = "init";
|
|
5
5
|
export declare const GENERATED_EXTENSION = ".gen";
|
|
6
6
|
export declare const HANDLERS_DIR = "src";
|
|
7
|
+
export declare const COMMON_DIR = "common";
|
|
8
|
+
export declare const DB_DIR = "db";
|
|
9
|
+
export declare const PRISMA_DIR = "prisma";
|
|
10
|
+
export declare const DB_SCRIPT_DIR = "scripts";
|
|
7
11
|
export declare const RAINDROP_TYPES_FILENAME = "raindrop.gen.ts";
|
|
8
12
|
export declare function trimTemplateSuffix(filename: string): string;
|
|
9
13
|
type TemplateContext = Record<string, string | number>;
|
|
10
14
|
export declare function renderTemplateFromString(template: string, context: TemplateContext): string;
|
|
11
15
|
export declare function renderTemplateFromFile(templatePath: string, context: TemplateContext): Promise<string>;
|
|
12
16
|
export declare function renderTemplatesFromDirectory(templatePath: string, outPath: string, context: TemplateContext, opts: CodegenOptions): Promise<void>;
|
|
17
|
+
type TemplateType = 'scaffolding' | 'user-modifiable' | 'non-user-modifiable';
|
|
18
|
+
export declare function templateType(relPath: string): TemplateType;
|
|
13
19
|
export declare function shouldWriteTemplate(opts: CodegenOptions, relPath: string): boolean;
|
|
14
20
|
export type CodegenOptions = {
|
|
15
21
|
renderScaffoldingCode?: boolean;
|
|
16
22
|
renderUserModifiableCode?: boolean;
|
|
17
23
|
renderNonUserModifiableCode?: boolean;
|
|
18
24
|
overwrite?: boolean;
|
|
25
|
+
mergePackageJson?: boolean;
|
|
19
26
|
} | undefined;
|
|
20
27
|
export declare function renderCodegenPlan(plan: CodegenPlan, outPath: string | undefined, opts: CodegenOptions, context?: TemplateContext): Promise<void>;
|
|
21
28
|
export type CodegenPlan = {
|
|
@@ -24,7 +31,7 @@ export type CodegenPlan = {
|
|
|
24
31
|
context?: TemplateContext;
|
|
25
32
|
}[];
|
|
26
33
|
export declare function codegenPlan(apps: Application[]): CodegenPlan;
|
|
27
|
-
export declare function gatherEnvForHandler(handler: Actor | Service | Observer, app: Application): string;
|
|
34
|
+
export declare function gatherEnvForHandler(handler: Actor | Service | Observer | Task, app: Application): string;
|
|
28
35
|
export declare function fileExists(path: string): Promise<boolean>;
|
|
29
36
|
export type DirWalkCallback = (relPath: string) => void | Promise<void>;
|
|
30
37
|
export declare function dirWalk(dir: string, visitFn: DirWalkCallback): Promise<void>;
|
package/dist/codegen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAW,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAW,M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|
|
|
8
8
|
export const TEMPLATE_INIT = 'init';
|
|
9
9
|
export const GENERATED_EXTENSION = '.gen';
|
|
10
10
|
export const HANDLERS_DIR = 'src';
|
|
11
|
+
export const COMMON_DIR = 'common';
|
|
12
|
+
export const DB_DIR = 'db';
|
|
13
|
+
export const PRISMA_DIR = 'prisma';
|
|
14
|
+
export const DB_SCRIPT_DIR = 'scripts';
|
|
11
15
|
export const RAINDROP_TYPES_FILENAME = 'raindrop.gen.ts';
|
|
12
16
|
const TEMPLATE_BUCKET_EVENT_NOTIFICATION = path.join('handlers', 'bucket-event-notification');
|
|
13
17
|
const TEMPLATE_QUEUE_CONSUMER = path.join('handlers', 'queue-consumer');
|
|
14
18
|
const TEMPLATE_HTTP_SERVICE = path.join('handlers', 'http-service');
|
|
15
19
|
const TEMPLATE_ACTOR = path.join('handlers', 'actor');
|
|
16
20
|
const TEMPLATE_TASK = path.join('handlers', 'task');
|
|
21
|
+
const TEMPLATE_DB = 'db';
|
|
22
|
+
const TEMPLATE_DB_DB = path.join('db', 'db');
|
|
23
|
+
const TEMPLATE_DB_COMMON = path.join('db', 'common');
|
|
24
|
+
const TEMPLATE_DB_PRISMA = path.join('db', 'prisma');
|
|
25
|
+
const TEMPLATE_DB_SCRIPT = path.join('db', 'scripts');
|
|
17
26
|
const TEMPLATE_EXTENSION = '.hbs';
|
|
18
27
|
const SCAFFOLDING_PREFIX = '__';
|
|
28
|
+
const PACKAGE_JSON = 'package.json';
|
|
19
29
|
const HANDLEBARS_RENDER_OPTS = {
|
|
20
30
|
strict: true, // Fail on missing variables
|
|
21
31
|
noEscape: true, // Do not escape HTML
|
|
@@ -31,28 +41,66 @@ export async function renderTemplateFromFile(templatePath, context) {
|
|
|
31
41
|
const template = await fs.readFile(templatePath, 'utf-8');
|
|
32
42
|
return renderTemplateFromString(template, context);
|
|
33
43
|
}
|
|
44
|
+
// Handle special case for package.json - merge them rather than overwrite
|
|
45
|
+
async function handlePackageJson(templatePath, outputPath) {
|
|
46
|
+
// Read the template package.json and render it
|
|
47
|
+
const templateJson = JSON.parse(await fs.readFile(templatePath, 'utf-8'));
|
|
48
|
+
// Check if output package.json exists
|
|
49
|
+
const existingJson = JSON.parse(await fs.readFile(outputPath, 'utf-8'));
|
|
50
|
+
// Merge the existing package.json with the template one
|
|
51
|
+
const mergedJson = {
|
|
52
|
+
...existingJson,
|
|
53
|
+
dependencies: { ...existingJson.dependencies, ...templateJson.dependencies },
|
|
54
|
+
devDependencies: { ...existingJson.devDependencies, ...templateJson.devDependencies },
|
|
55
|
+
scripts: { ...existingJson.scripts, ...templateJson.scripts },
|
|
56
|
+
};
|
|
57
|
+
// Write the merged package.json
|
|
58
|
+
await fs.writeFile(outputPath, JSON.stringify(mergedJson, null, 2));
|
|
59
|
+
}
|
|
34
60
|
export async function renderTemplatesFromDirectory(templatePath, outPath, context, opts) {
|
|
35
61
|
const visit = async (relPath) => {
|
|
36
|
-
|
|
37
|
-
|
|
62
|
+
try {
|
|
63
|
+
if (!shouldWriteTemplate(opts, relPath)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
//NOTE: Sometimes we want to pass full files, this allows us to do that
|
|
67
|
+
// If the template is a directory, we need to join it with the relPath
|
|
68
|
+
// If the template is a file, we need to use the templatePath as the relPath
|
|
69
|
+
const fullTemplatePath = relPath ? path.join(templatePath, relPath) : templatePath;
|
|
70
|
+
relPath = relPath ? relPath : path.basename(templatePath);
|
|
71
|
+
const outputFilename = trimTemplateSuffix(relPath);
|
|
72
|
+
const outputFilePath = path.join(outPath, outputFilename);
|
|
73
|
+
// Special handling for package.json
|
|
74
|
+
if (!relPath.endsWith(TEMPLATE_EXTENSION) && outputFilename === PACKAGE_JSON && opts?.mergePackageJson) {
|
|
75
|
+
await handlePackageJson(fullTemplatePath, outputFilePath);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Create directory if needed
|
|
79
|
+
await fs.mkdir(path.dirname(outputFilePath), { recursive: true });
|
|
80
|
+
// Regular file handling
|
|
81
|
+
const rawContent = await fs.readFile(fullTemplatePath, 'utf-8');
|
|
82
|
+
// Templates are rendered, other files are copied
|
|
83
|
+
const content = relPath.endsWith(TEMPLATE_EXTENSION) ? renderTemplateFromString(rawContent, context) : rawContent;
|
|
84
|
+
const alreadyExists = await fileExists(outputFilePath);
|
|
85
|
+
if (alreadyExists && !opts?.overwrite) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await fs.writeFile(outputFilePath, content);
|
|
38
89
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const content = relPath.endsWith(TEMPLATE_EXTENSION)
|
|
42
|
-
? await renderTemplateFromFile(path.join(templatePath, relPath), context)
|
|
43
|
-
: rawContent;
|
|
44
|
-
const outputFilename = trimTemplateSuffix(relPath);
|
|
45
|
-
await fs.mkdir(path.join(outPath, path.dirname(outputFilename)), { recursive: true });
|
|
46
|
-
const outputFilePath = path.join(outPath, outputFilename);
|
|
47
|
-
const alreadyExists = await fileExists(outputFilePath);
|
|
48
|
-
if (alreadyExists && !opts?.overwrite) {
|
|
49
|
-
return;
|
|
90
|
+
catch (err) {
|
|
91
|
+
console.error(`Error processing file ${relPath}: ${err}`);
|
|
50
92
|
}
|
|
51
|
-
await fs.writeFile(outputFilePath, content);
|
|
52
93
|
};
|
|
94
|
+
//if its a file, just call the visit function
|
|
95
|
+
if (await fs.lstat(templatePath).then((stats) => stats.isFile())) {
|
|
96
|
+
//this works because we are using the templatePath as the template name
|
|
97
|
+
//and the visit function is called with the template name
|
|
98
|
+
await visit('');
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
53
101
|
return await dirWalk(templatePath, visit);
|
|
54
102
|
}
|
|
55
|
-
function templateType(relPath) {
|
|
103
|
+
export function templateType(relPath) {
|
|
56
104
|
if (path.basename(relPath).startsWith(SCAFFOLDING_PREFIX)) {
|
|
57
105
|
return 'scaffolding';
|
|
58
106
|
}
|
|
@@ -124,6 +172,32 @@ export function codegenPlan(apps) {
|
|
|
124
172
|
context: { taskClassName: kebabCaseToUpperCamelCase(valueOf(task.name)) },
|
|
125
173
|
});
|
|
126
174
|
}
|
|
175
|
+
for (const db of app.sqlDatabase) {
|
|
176
|
+
plan.push({
|
|
177
|
+
templateName: path.join(TEMPLATES_DIR, TEMPLATE_DB, 'package.json'),
|
|
178
|
+
outPath: path.join('./'),
|
|
179
|
+
});
|
|
180
|
+
plan.push({
|
|
181
|
+
templateName: path.join(TEMPLATES_DIR, TEMPLATE_DB_DB),
|
|
182
|
+
outPath: path.join(DB_DIR, valueOf(db.name)),
|
|
183
|
+
context: { dbName: kebabCaseToCamelCase(valueOf(db.name)) },
|
|
184
|
+
});
|
|
185
|
+
plan.push({
|
|
186
|
+
templateName: path.join(TEMPLATES_DIR, TEMPLATE_DB_COMMON),
|
|
187
|
+
outPath: path.join(HANDLERS_DIR, COMMON_DIR),
|
|
188
|
+
context: { dbName: kebabCaseToCamelCase(valueOf(db.name)) },
|
|
189
|
+
});
|
|
190
|
+
plan.push({
|
|
191
|
+
templateName: path.join(TEMPLATES_DIR, TEMPLATE_DB_PRISMA),
|
|
192
|
+
outPath: path.join(PRISMA_DIR, valueOf(db.name)),
|
|
193
|
+
context: { dbName: kebabCaseToCamelCase(valueOf(db.name)) },
|
|
194
|
+
});
|
|
195
|
+
plan.push({
|
|
196
|
+
templateName: path.join(TEMPLATES_DIR, TEMPLATE_DB_SCRIPT),
|
|
197
|
+
outPath: path.join(DB_SCRIPT_DIR),
|
|
198
|
+
context: { dbName: kebabCaseToCamelCase(valueOf(db.name)) },
|
|
199
|
+
});
|
|
200
|
+
}
|
|
127
201
|
}
|
|
128
202
|
return plan;
|
|
129
203
|
}
|
|
@@ -133,7 +207,7 @@ import { {{#each imports}}{{this}}, {{/each}} } from '@liquidmetal-ai/raindrop-f
|
|
|
133
207
|
export interface Env {
|
|
134
208
|
_raindrop: {
|
|
135
209
|
app: App;
|
|
136
|
-
}
|
|
210
|
+
};
|
|
137
211
|
{{#each resources}}
|
|
138
212
|
{{this.name}}: {{{this.type}}};
|
|
139
213
|
{{/each}}
|
|
@@ -200,6 +274,9 @@ export function gatherEnvForHandler(handler, app) {
|
|
|
200
274
|
for (const env of handler.env) {
|
|
201
275
|
bindings[kebabCaseToConstantCase(valueOf(env.name))] = 'string';
|
|
202
276
|
}
|
|
277
|
+
//
|
|
278
|
+
// (nothing to do for Tasks)
|
|
279
|
+
//
|
|
203
280
|
// Add AI binding.
|
|
204
281
|
bindings['AI'] = 'Ai';
|
|
205
282
|
types.add('Ai');
|
package/dist/codegen.test.js
CHANGED
|
@@ -59,6 +59,27 @@ test('codegens from app with durable object', async () => {
|
|
|
59
59
|
expect(plan[1]?.templateName).toMatch('templates/handlers/actor');
|
|
60
60
|
expect(plan[1]?.outPath).toEqual('src/ingest-object');
|
|
61
61
|
});
|
|
62
|
+
test('codegens from app with sql database', async () => {
|
|
63
|
+
const apps = await mustManifestFromString(`
|
|
64
|
+
application "ingest" {
|
|
65
|
+
sql_database "demosql" {}
|
|
66
|
+
}
|
|
67
|
+
`);
|
|
68
|
+
const plan = codegenPlan(apps);
|
|
69
|
+
expect(Object.keys(plan)).toHaveLength(6);
|
|
70
|
+
expect(plan[0]?.templateName).toMatch('templates/init');
|
|
71
|
+
expect(plan[0]?.outPath).toEqual('');
|
|
72
|
+
expect(plan[1]?.templateName).toMatch('templates/db/package.json');
|
|
73
|
+
expect(plan[1]?.outPath).toEqual('./');
|
|
74
|
+
expect(plan[2]?.templateName).toMatch('templates/db/db');
|
|
75
|
+
expect(plan[2]?.outPath).toEqual('db/demosql');
|
|
76
|
+
expect(plan[3]?.templateName).toMatch('templates/db/common');
|
|
77
|
+
expect(plan[3]?.outPath).toEqual('src/common');
|
|
78
|
+
expect(plan[4]?.templateName).toMatch('templates/db/prisma');
|
|
79
|
+
expect(plan[4]?.outPath).toEqual('prisma/demosql');
|
|
80
|
+
expect(plan[5]?.templateName).toMatch('templates/db/scripts');
|
|
81
|
+
expect(plan[5]?.outPath).toEqual('scripts');
|
|
82
|
+
});
|
|
62
83
|
test('only codegens scaffolding when enabled', () => {
|
|
63
84
|
expect(shouldWriteTemplate({
|
|
64
85
|
renderScaffoldingCode: true,
|
|
@@ -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;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;
|
|
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;CA+D3B"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;CAsC3B"}
|
|
@@ -42,9 +42,15 @@ Branch a Raindrop application.
|
|
|
42
42
|
};
|
|
43
43
|
async run() {
|
|
44
44
|
const config = await this.loadConfig();
|
|
45
|
+
if (config.lock) {
|
|
46
|
+
this.error('Operation not allowed: application is in a locked state');
|
|
47
|
+
}
|
|
48
|
+
if (config.sandbox) {
|
|
49
|
+
this.error('Branching is not allowed in sandbox mode');
|
|
50
|
+
}
|
|
45
51
|
// Allow the user to see the currently selected version
|
|
46
52
|
if (this.flags.show) {
|
|
47
|
-
|
|
53
|
+
console.log(`Current versionId: ${config.versionId}`);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
56
|
const versionId = this.flags.versionId || config.versionId;
|
|
@@ -59,5 +65,14 @@ Branch a Raindrop application.
|
|
|
59
65
|
start: this.flags.start,
|
|
60
66
|
impersonate: this.flags.impersonate,
|
|
61
67
|
});
|
|
68
|
+
//reload config file
|
|
69
|
+
const updatedConfig = await this.loadConfig();
|
|
70
|
+
if (!updatedConfig.versionId) {
|
|
71
|
+
this.error('VersionId is not set in the config file');
|
|
72
|
+
}
|
|
73
|
+
// Auto sandbox the new branch
|
|
74
|
+
this.log('Branching complete, sandboxing the new branch');
|
|
75
|
+
await this.config.runCommand('build:sandbox', [updatedConfig.versionId]);
|
|
76
|
+
this.log(`🔔 Branch is in Sandbox mode`);
|
|
62
77
|
}
|
|
63
78
|
}
|
|
@@ -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;;;;;;;;MAGV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
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;CAiC3B"}
|
|
@@ -18,10 +18,13 @@ Switched to version: 01jux6z20m4gbhn5kaa4mcm2jr
|
|
|
18
18
|
output: Flags.string({ char: 'o', description: 'output format', required: false, default: 'text' }),
|
|
19
19
|
};
|
|
20
20
|
async run() {
|
|
21
|
+
const config = await this.loadConfig();
|
|
22
|
+
if (config.lock) {
|
|
23
|
+
this.error('Operation not allowed: application is in a locked state');
|
|
24
|
+
}
|
|
21
25
|
if (['text', 'json'].indexOf(this.flags.output) === -1) {
|
|
22
26
|
this.error(`unsupported output format: ${this.flags.output}`, { exit: 1 });
|
|
23
27
|
}
|
|
24
|
-
const config = await this.loadConfig();
|
|
25
28
|
// No args: just show the current version
|
|
26
29
|
if (!this.args.version) {
|
|
27
30
|
if (this.flags.output === 'json') {
|
|
@@ -92,10 +92,10 @@ Deleted (application) at version (version)
|
|
|
92
92
|
throw e;
|
|
93
93
|
}
|
|
94
94
|
if (this.flags.all) {
|
|
95
|
-
|
|
95
|
+
console.log(`Deleted all versions of ${this.args.application}`);
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
|
|
98
|
+
console.log(`Deleted ${this.args.application} at version ${versionId}`);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;CA0C3B"}
|
|
@@ -51,7 +51,7 @@ Deploy a Raindrop application version.
|
|
|
51
51
|
async run() {
|
|
52
52
|
const config = await this.loadConfig();
|
|
53
53
|
const versionId = this.flags.versionId ?? config.versionId;
|
|
54
|
-
const unlock = this.flags.resume ? this.flags.lock ?? config.lock : undefined;
|
|
54
|
+
const unlock = this.flags.resume ? (this.flags.lock ?? config.lock) : undefined;
|
|
55
55
|
if (this.flags.resume) {
|
|
56
56
|
if (versionId === undefined) {
|
|
57
57
|
this.error(`Cannot resume deployment without a versionId. Please specify a versionId or run without --resume to start a new deployment.`);
|
|
@@ -60,8 +60,11 @@ Deploy a Raindrop application version.
|
|
|
60
60
|
this.error(`Cannot resume deployment without a lock. Please specify --lock or run without --resume to start a new deployment.`);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
// Resuming is _always_ amending
|
|
64
|
-
const amend = this.flags.resume || this.flags.amend;
|
|
63
|
+
// Resuming and Sandbox is _always_ amending
|
|
64
|
+
const amend = config.sandbox || this.flags.resume || this.flags.amend;
|
|
65
|
+
if (config.sandbox) {
|
|
66
|
+
this.log(`🔔 Branch is in Sandbox mode, running deploy in ammend mode`);
|
|
67
|
+
}
|
|
65
68
|
await deploy({
|
|
66
69
|
command: this,
|
|
67
70
|
root: this.flags.root,
|
|
@@ -75,5 +78,8 @@ Deploy a Raindrop application version.
|
|
|
75
78
|
start: this.flags.start,
|
|
76
79
|
impersonate: this.flags.impersonate,
|
|
77
80
|
});
|
|
81
|
+
if (!amend) {
|
|
82
|
+
this.log(`🔔 You deployed a full version, updates will require a full versioned deployment to work`);
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/build/find.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,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"}
|
|
@@ -3,6 +3,8 @@ import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
5
|
import { EPOCH_TS } from '../../index.js';
|
|
6
|
+
import { toJsonString } from '@bufbuild/protobuf';
|
|
7
|
+
import { QueryResourcesResponseSchema } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
6
8
|
export default class Find extends BaseCommand {
|
|
7
9
|
static args = {};
|
|
8
10
|
static description = 'find resources in Raindrop';
|
|
@@ -82,7 +84,7 @@ export default class Find extends BaseCommand {
|
|
|
82
84
|
{}), ['name', 'resourceId', 'applicationName', 'applicationVersionId', 'type', 'attributes']);
|
|
83
85
|
}
|
|
84
86
|
else if (flags.output === 'json') {
|
|
85
|
-
|
|
87
|
+
console.log(toJsonString(QueryResourcesResponseSchema, resp, { prettySpaces: 2 }));
|
|
86
88
|
}
|
|
87
89
|
else {
|
|
88
90
|
for (const r of resp.resources) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/build/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW,CAAC,OAAO,QAAQ,CAAC;IAChE,OAAgB,IAAI,KAAM;IAE1B,OAAgB,WAAW,SAAwD;IAEnF,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK;;;;;MAgBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/build/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AASpD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW,CAAC,OAAO,QAAQ,CAAC;IAChE,OAAgB,IAAI,KAAM;IAE1B,OAAgB,WAAW,SAAwD;IAEnF,OAAgB,QAAQ,WAA2C;IAEnE,OAAgB,KAAK;;;;;MAgBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+BlC"}
|
|
@@ -52,6 +52,6 @@ Initialize a project in the current directory.
|
|
|
52
52
|
catch (error) {
|
|
53
53
|
this.error(`Could not initialize project at ${this.args.path}: ${error}`, { exit: 1 });
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
console.log(`Initialized LiquidMetal.AI in ${this.args.path}`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/build/list.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAEhC,SAAS,EACV,MAAM,yDAAyD,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,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;IA0ChB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { UnitState } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
1
|
+
import { ApplicationsResponseSchema, UnitState, } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
2
2
|
import { timestampDate } from '@bufbuild/protobuf/wkt';
|
|
3
3
|
import { Flags } from '@oclif/core';
|
|
4
4
|
import { BaseCommand } from '../../base-command.js';
|
|
5
5
|
import { EPOCH_TS } from '../../index.js';
|
|
6
|
+
import { toJsonString } from '@bufbuild/protobuf';
|
|
6
7
|
export const statusString = {
|
|
7
8
|
[UnitState.UNSPECIFIED]: '<unknown>',
|
|
8
9
|
[UnitState.PENDING]: 'pending...',
|
|
@@ -197,18 +198,19 @@ List Raindrop catalog resources.
|
|
|
197
198
|
acc[dateStr] = {
|
|
198
199
|
...a,
|
|
199
200
|
status: statusString[a.state],
|
|
201
|
+
locked: a.lock ? 'locked' : '',
|
|
200
202
|
};
|
|
201
203
|
return acc;
|
|
202
204
|
},
|
|
203
205
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
204
|
-
{}), ['organizationId', 'name', 'versionId', 'branch', 'status', ...(this.flags.all ? ['deletedAt'] : [])]);
|
|
206
|
+
{}), ['organizationId', 'name', 'versionId', 'branch', 'status', 'locked', ...(this.flags.all ? ['deletedAt'] : [])]);
|
|
205
207
|
}
|
|
206
208
|
else if (this.flags.output === 'json') {
|
|
207
|
-
|
|
209
|
+
console.log(toJsonString(ApplicationsResponseSchema, resp, { prettySpaces: 2 }));
|
|
208
210
|
}
|
|
209
211
|
else {
|
|
210
212
|
for (const a of resp.applications) {
|
|
211
|
-
console.log(`${timestampDate(a.createdAt || EPOCH_TS).toISOString()} ${a.organizationId} ${a.versionId} ${a.name} (${a.isActive ? 'active' : 'inactive'})`);
|
|
213
|
+
console.log(`${timestampDate(a.createdAt || EPOCH_TS).toISOString()} ${a.organizationId} ${a.versionId} ${a.name} (${a.isActive ? 'active' : 'inactive'}, ${statusString[a.state]}, ${a.lock ? 'locked' : 'unlocked'})`);
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/commands/build/sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAW,CAAC,OAAO,OAAO,CAAC;IAC9D,MAAM,CAAC,IAAI;;MAET;IACF,MAAM,CAAC,WAAW,SAAyD;IAE3E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;MASV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/commands/build/sandbox.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,WAAW,CAAC,OAAO,OAAO,CAAC;IAC9D,MAAM,CAAC,IAAI;;MAET;IACF,MAAM,CAAC,WAAW,SAAyD;IAE3E,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;MASV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6B3B"}
|
|
@@ -21,9 +21,12 @@ export default class Sandbox extends BaseCommand {
|
|
|
21
21
|
manifest: Flags.string({ default: 'raindrop.manifest', description: 'project manifest' }),
|
|
22
22
|
};
|
|
23
23
|
async run() {
|
|
24
|
+
const config = await this.loadConfig();
|
|
25
|
+
if (config.lock) {
|
|
26
|
+
this.error('Operation not allowed: application is in a locked state');
|
|
27
|
+
}
|
|
24
28
|
const { client: catalogService, userId, organizationId: defaultOrganizationId } = await this.catalogService();
|
|
25
29
|
const organizationId = this.flags.impersonate ?? defaultOrganizationId;
|
|
26
|
-
const config = await this.loadConfig();
|
|
27
30
|
const apps = await this.loadManifest();
|
|
28
31
|
const app = apps[0];
|
|
29
32
|
const versionId = this.args.versionId ?? config.versionId;
|
|
@@ -41,6 +44,9 @@ export default class Sandbox extends BaseCommand {
|
|
|
41
44
|
},
|
|
42
45
|
],
|
|
43
46
|
});
|
|
44
|
-
|
|
47
|
+
// Mark application as sandboxed in config
|
|
48
|
+
config.sandbox = true;
|
|
49
|
+
await this.saveConfig(config);
|
|
50
|
+
console.log(`Set ${valueOf(app.name)}@${versionId} as sandboxed.`);
|
|
45
51
|
}
|
|
46
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/build/start.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IAC1D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAkC;IAEpD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MAyBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/build/start.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IAC1D,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAkC;IAEpD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MAyBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8B3B"}
|
|
@@ -36,9 +36,12 @@ Start a Raindrop application.
|
|
|
36
36
|
}),
|
|
37
37
|
};
|
|
38
38
|
async run() {
|
|
39
|
+
const config = await this.loadConfig();
|
|
40
|
+
if (config.lock) {
|
|
41
|
+
this.error('Operation not allowed: application is in a locked state');
|
|
42
|
+
}
|
|
39
43
|
const { client: catalogService, userId, organizationId: defaultOrganizationId } = await this.catalogService();
|
|
40
44
|
const organizationId = this.flags.impersonate ?? defaultOrganizationId;
|
|
41
|
-
const config = await this.loadConfig();
|
|
42
45
|
let applicationName = this.flags.application;
|
|
43
46
|
if (!applicationName) {
|
|
44
47
|
const apps = await this.loadManifest();
|
|
@@ -60,6 +63,6 @@ Start a Raindrop application.
|
|
|
60
63
|
},
|
|
61
64
|
],
|
|
62
65
|
});
|
|
63
|
-
|
|
66
|
+
console.log(`Set ${applicationName}@${currentVersionId} as active.`);
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/build/status.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EAEd,SAAS,EACV,MAAM,yDAAyD,CAAC;AAKjE,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"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
|
|
2
|
-
import { UnitState } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
2
|
+
import { StatusResponseSchema, UnitState, } from '@liquidmetal-ai/drizzle/liquidmetal/v1alpha1/catalog_pb';
|
|
3
3
|
import { Flags, ux } from '@oclif/core';
|
|
4
4
|
import Table from 'cli-table3';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
|
+
import { toJsonString } from '@bufbuild/protobuf';
|
|
6
7
|
import { BaseCommand } from '../../base-command.js';
|
|
7
8
|
export const statusString = {
|
|
8
9
|
[UnitState.UNSPECIFIED]: '<unknown>',
|
|
@@ -96,11 +97,11 @@ export default class Status extends BaseCommand {
|
|
|
96
97
|
head: ['Module', 'Status', 'URLs'],
|
|
97
98
|
});
|
|
98
99
|
table.push(...statusTable.map((row) => [row.module, row.status, row.urls]));
|
|
99
|
-
|
|
100
|
+
console.log(table.toString());
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
if (flags.output === 'json') {
|
|
103
|
-
|
|
104
|
+
console.log(toJsonString(StatusResponseSchema, applicationStatus, { prettySpaces: 2 }));
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
let watchStatus = applicationStatus;
|
|
@@ -142,7 +143,7 @@ export default class Status extends BaseCommand {
|
|
|
142
143
|
lines.push(`${padding}${module.name}: ${statusStateString(module.state)} ${module.urls.join(', ')}`);
|
|
143
144
|
}
|
|
144
145
|
for (const line of lines) {
|
|
145
|
-
|
|
146
|
+
console.log(line);
|
|
146
147
|
}
|
|
147
148
|
this.linesLastRendered = lines.length;
|
|
148
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../../src/commands/build/stop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAiC;IAEnD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MAyBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../../src/commands/build/stop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,KAAM;IAEjB,MAAM,CAAC,WAAW,SAAiC;IAEnD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MAyBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8B3B"}
|