@liquidmetal-ai/raindrop 0.9.6 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -86
- package/bundle/{chunk-AWVSG5HH.js → chunk-2GD7Q3YS.js} +1 -1
- package/bundle/{chunk-FYMUM7KM.js → chunk-2QH4PO44.js} +1 -1
- package/bundle/{chunk-2KEFV5U5.js → chunk-3DZWEZ2R.js} +1 -1
- package/bundle/{chunk-B4MQISI4.js → chunk-45V47YNS.js} +4 -4
- package/bundle/{chunk-ILG4QJPW.js → chunk-4FXE4I6S.js} +2 -2
- package/bundle/{chunk-43UGYZQA.js → chunk-4RN4TIJI.js} +1 -1
- package/bundle/{chunk-OHP3SQGY.js → chunk-4U2CSHCN.js} +1 -1
- package/bundle/{chunk-T3VHOMDJ.js → chunk-4UUTGMDZ.js} +1 -1
- package/bundle/{chunk-Z2VVSBIX.js → chunk-4WNBHWJP.js} +4 -4
- package/bundle/{chunk-CEFC4JXX.js → chunk-5KMI72AS.js} +1 -1
- package/bundle/{chunk-GBFY2PMX.js → chunk-5REFCZTG.js} +2 -2
- package/bundle/chunk-6BCRCAR4.js +22452 -0
- package/bundle/{chunk-YWKX37S2.js → chunk-7GDFE7HE.js} +3 -1
- package/bundle/{chunk-4NTUYQ5R.js → chunk-AI5PKHR7.js} +1 -1
- package/bundle/chunk-D5MXH3QV.js +133 -0
- package/bundle/chunk-ETDAUGBG.js +74 -0
- package/bundle/chunk-GBUNP7OT.js +4539 -0
- package/bundle/chunk-GRUPCK5H.js +384 -0
- package/bundle/chunk-JENN4EVA.js +75 -0
- package/bundle/chunk-JZYHHRGL.js +292 -0
- package/bundle/chunk-LJKAU7FY.js +4486 -0
- package/bundle/{chunk-E7J2LWQ5.js → chunk-MJZG4ABT.js} +1 -1
- package/bundle/chunk-MZZHXHB4.js +805 -0
- package/bundle/{chunk-B6JLI47W.js → chunk-ORUMKXQZ.js} +2 -2
- package/bundle/chunk-PMHLHYMI.js +231 -0
- package/bundle/chunk-QRJUX37T.js +48 -0
- package/bundle/chunk-QTCJ6YYG.js +147 -0
- package/bundle/chunk-RAPSKVRO.js +12148 -0
- package/bundle/chunk-U7NHRBYD.js +502 -0
- package/bundle/chunk-WDR5M2SS.js +238746 -0
- package/bundle/{chunk-SPBJ5BNI.js → chunk-YXJU5KSB.js} +1 -1
- package/bundle/chunk-ZQIPU6IX.js +44 -0
- package/bundle/commands/annotation/get.js +3 -3
- package/bundle/commands/annotation/list.js +3 -3
- package/bundle/commands/annotation/put.js +3 -3
- package/bundle/commands/auth/list.js +2 -2
- package/bundle/commands/auth/login.js +3 -3
- package/bundle/commands/auth/logout.js +2 -2
- package/bundle/commands/auth/select.js +3 -3
- package/bundle/commands/bucket/create-credential.js +2 -2
- package/bundle/commands/bucket/delete-credential.js +2 -2
- package/bundle/commands/bucket/get-credential.js +2 -2
- package/bundle/commands/bucket/list-credentials.js +2 -2
- package/bundle/commands/build/branch.js +9 -9
- package/bundle/commands/build/checkout.js +6 -6
- package/bundle/commands/build/clone.js +7 -7
- package/bundle/commands/build/delete.js +6 -6
- package/bundle/commands/build/deploy.js +9 -9
- package/bundle/commands/build/env/get.js +2 -2
- package/bundle/commands/build/env/set.js +2 -2
- package/bundle/commands/build/find.js +4 -4
- package/bundle/commands/build/generate.js +3 -3
- package/bundle/commands/build/init-workspace.js +3 -3
- package/bundle/commands/build/init.js +3 -3
- package/bundle/commands/build/list.js +5 -5
- package/bundle/commands/build/sandbox.js +7 -7
- package/bundle/commands/build/start.js +2 -2
- package/bundle/commands/build/status.js +5 -5
- package/bundle/commands/build/stop.js +2 -2
- package/bundle/commands/build/tools/check.js +2 -2
- package/bundle/commands/build/tools/fmt.js +2 -2
- package/bundle/commands/build/unsandbox.js +7 -7
- package/bundle/commands/build/upload.js +5 -5
- package/bundle/commands/build/validate.js +4 -4
- package/bundle/commands/build/workos/delete.js +4 -4
- package/bundle/commands/build/workos/env/attach.js +3 -3
- package/bundle/commands/build/workos/env/create.js +3 -3
- package/bundle/commands/build/workos/env/delete.js +3 -3
- package/bundle/commands/build/workos/env/detach.js +3 -3
- package/bundle/commands/build/workos/env/get.js +3 -3
- package/bundle/commands/build/workos/env/list.js +3 -3
- package/bundle/commands/build/workos/env/set.js +3 -3
- package/bundle/commands/build/workos/invite.js +3 -3
- package/bundle/commands/build/workos/setup.js +3 -3
- package/bundle/commands/build/workos/status.js +3 -3
- package/bundle/commands/dns/create.js +2 -2
- package/bundle/commands/dns/delete.js +4 -4
- package/bundle/commands/dns/get.js +4 -4
- package/bundle/commands/dns/list.js +3 -3
- package/bundle/commands/dns/records/create.js +2 -2
- package/bundle/commands/dns/records/delete.js +3 -3
- package/bundle/commands/dns/records/get.js +2 -2
- package/bundle/commands/dns/records/list.js +2 -2
- package/bundle/commands/dns/records/update.js +2 -2
- package/bundle/commands/logs/query.js +3 -3
- package/bundle/commands/logs/tail.js +3 -3
- package/bundle/commands/mcp/install-claude.js +2 -2
- package/bundle/commands/mcp/install-gemini.js +2 -2
- package/bundle/commands/mcp/install-goose.js +2 -2
- package/bundle/commands/mcp/status.js +2 -2
- package/bundle/commands/object/delete.js +2 -2
- package/bundle/commands/object/get.js +2 -2
- package/bundle/commands/object/list.js +73 -7
- package/bundle/commands/object/put.js +2 -2
- package/bundle/commands/query/chunk-search.js +3 -3
- package/bundle/commands/query/document.js +3 -3
- package/bundle/commands/query/events.js +2 -2
- package/bundle/commands/query/reindex.js +2 -2
- package/bundle/commands/query/search.js +3 -3
- package/bundle/commands/tail.js +2 -2
- package/bundle/index.js +1 -1
- package/dist/build.test.d.ts +2 -0
- package/dist/build.test.d.ts.map +1 -0
- package/dist/build.test.js +46 -0
- package/dist/codegen.test.d.ts +2 -0
- package/dist/codegen.test.d.ts.map +1 -0
- package/dist/codegen.test.js +223 -0
- package/dist/commands/logs/tail.test.d.ts +2 -0
- package/dist/commands/logs/tail.test.d.ts.map +1 -0
- package/dist/commands/logs/tail.test.js +366 -0
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +91 -4
- package/dist/config.test.d.ts +2 -0
- package/dist/config.test.d.ts.map +1 -0
- package/dist/config.test.js +27 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +56 -0
- package/oclif.manifest.json +2569 -2569
- package/package.json +3 -3
- package/templates/db/node_modules/.bin/prisma +2 -2
- package/templates/db/node_modules/.bin/prisma-kysely +2 -2
- package/templates/db/node_modules/.bin/tsc +3 -7
- package/templates/db/node_modules/.bin/tsserver +3 -7
- package/templates/db/node_modules/.bin/zx +2 -2
- package/templates/init/RAINDROP.md.hbs +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
4
4
|
import {
|
|
5
5
|
ListObjectsResponseSchema,
|
|
6
6
|
__toESM,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
require_lib,
|
|
9
9
|
timestampDate,
|
|
10
10
|
toJsonString
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/object/list.ts
|
|
14
14
|
init_cjs_shims();
|
|
@@ -188,27 +188,93 @@ List objects in my-bucket within my-app
|
|
|
188
188
|
console.log("No objects found in bucket");
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
+
const { client: searchAgent } = await this.searchAgentService();
|
|
192
|
+
const statusMap = /* @__PURE__ */ new Map();
|
|
193
|
+
try {
|
|
194
|
+
const bulkStatusResponse = await searchAgent.getDocumentStatusBulk({
|
|
195
|
+
userId,
|
|
196
|
+
organizationId,
|
|
197
|
+
bucketLocation,
|
|
198
|
+
objectIds: response.objects.map((obj) => obj.key)
|
|
199
|
+
});
|
|
200
|
+
for (const docStatus of bulkStatusResponse.documents) {
|
|
201
|
+
let indexingStatus = "unknown";
|
|
202
|
+
if (docStatus.status === "not_found") {
|
|
203
|
+
indexingStatus = "not started";
|
|
204
|
+
} else if (docStatus.status === "completed") {
|
|
205
|
+
indexingStatus = "completed";
|
|
206
|
+
} else if (docStatus.status === "failed") {
|
|
207
|
+
const errorMsg = docStatus.errors.length > 0 ? ` (${docStatus.errors[0]})` : "";
|
|
208
|
+
indexingStatus = `failed${errorMsg}`;
|
|
209
|
+
} else if (docStatus.status === "partial") {
|
|
210
|
+
const errorMsg = docStatus.errors.length > 0 ? ` (${docStatus.errors[0]})` : "";
|
|
211
|
+
indexingStatus = `partial${errorMsg}`;
|
|
212
|
+
} else if (docStatus.status === "ingesting") {
|
|
213
|
+
const chunks = docStatus.ingest?.totalChunksCreated || 0;
|
|
214
|
+
indexingStatus = `ingesting (${chunks} chunks)`;
|
|
215
|
+
} else if (docStatus.status === "processing") {
|
|
216
|
+
const stages = [
|
|
217
|
+
{ name: "embedding", info: docStatus.embedding },
|
|
218
|
+
{ name: "vector index", info: docStatus.vectorIndex },
|
|
219
|
+
{ name: "pii", info: docStatus.pii },
|
|
220
|
+
{ name: "relationships", info: docStatus.relationships }
|
|
221
|
+
];
|
|
222
|
+
const activeStage = stages.find((s) => s.info && s.info.itemsRemaining > 0);
|
|
223
|
+
if (activeStage && activeStage.info) {
|
|
224
|
+
const progress = activeStage.info.totalExpected - activeStage.info.itemsRemaining;
|
|
225
|
+
const total = activeStage.info.totalExpected;
|
|
226
|
+
indexingStatus = `processing ${activeStage.name} (${progress}/${total})`;
|
|
227
|
+
} else {
|
|
228
|
+
const hasInitializedStages = stages.some((s) => s.info && s.info.totalExpected > 0);
|
|
229
|
+
if (!hasInitializedStages) {
|
|
230
|
+
const chunks = docStatus.ingest?.totalChunksCreated || 0;
|
|
231
|
+
const queued = docStatus.ingest?.chunksQueued || 0;
|
|
232
|
+
indexingStatus = `processing (${chunks} chunks created, ${queued} queued)`;
|
|
233
|
+
} else {
|
|
234
|
+
indexingStatus = "processing";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
indexingStatus = docStatus.status;
|
|
239
|
+
}
|
|
240
|
+
statusMap.set(docStatus.objectId, indexingStatus);
|
|
241
|
+
}
|
|
242
|
+
} catch (error) {
|
|
243
|
+
console.error("Failed to fetch bulk status:", error);
|
|
244
|
+
}
|
|
245
|
+
const objectsWithStatus = response.objects.map((obj) => ({
|
|
246
|
+
...obj,
|
|
247
|
+
indexingStatus: statusMap.get(obj.key) || "unknown"
|
|
248
|
+
}));
|
|
191
249
|
switch (this.flags.output) {
|
|
192
|
-
case "json":
|
|
193
|
-
|
|
250
|
+
case "json": {
|
|
251
|
+
const jsonResponse = JSON.parse(toJsonString(ListObjectsResponseSchema, response));
|
|
252
|
+
jsonResponse.objects = objectsWithStatus.map((obj, index) => ({
|
|
253
|
+
...jsonResponse.objects[index],
|
|
254
|
+
indexingStatus: obj.indexingStatus
|
|
255
|
+
}));
|
|
256
|
+
console.log(JSON.stringify(jsonResponse, null, 2));
|
|
194
257
|
break;
|
|
258
|
+
}
|
|
195
259
|
case "table":
|
|
196
260
|
console.table(
|
|
197
|
-
|
|
261
|
+
objectsWithStatus.map((obj) => ({
|
|
198
262
|
key: obj.key,
|
|
199
263
|
size: obj.size,
|
|
200
264
|
contentType: obj.contentType,
|
|
201
|
-
lastModified: obj.lastModified ? timestampDate(obj.lastModified).toUTCString() : "N/A"
|
|
265
|
+
lastModified: obj.lastModified ? timestampDate(obj.lastModified).toUTCString() : "N/A",
|
|
266
|
+
indexing: obj.indexingStatus
|
|
202
267
|
}))
|
|
203
268
|
);
|
|
204
269
|
break;
|
|
205
270
|
default:
|
|
206
|
-
for (const obj of
|
|
271
|
+
for (const obj of objectsWithStatus) {
|
|
207
272
|
const lastModified = obj.lastModified ? timestampDate(obj.lastModified).toUTCString() : "N/A";
|
|
208
273
|
console.log(`Key: ${obj.key}`);
|
|
209
274
|
console.log(` Size: ${obj.size} bytes`);
|
|
210
275
|
console.log(` Content-Type: ${obj.contentType || "N/A"}`);
|
|
211
276
|
console.log(` Last Modified: ${lastModified}`);
|
|
277
|
+
console.log(` Indexing: ${obj.indexingStatus}`);
|
|
212
278
|
console.log("---");
|
|
213
279
|
}
|
|
214
280
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
4
4
|
import {
|
|
5
5
|
PutObjectResponseSchema,
|
|
6
6
|
__toESM,
|
|
7
7
|
init_cjs_shims,
|
|
8
8
|
require_lib,
|
|
9
9
|
toJsonString
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/object/put.ts
|
|
13
13
|
init_cjs_shims();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ulid
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JENN4EVA.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
7
7
|
import {
|
|
8
8
|
RagSearchResponseSchema,
|
|
9
9
|
__toESM,
|
|
10
10
|
init_cjs_shims,
|
|
11
11
|
require_lib,
|
|
12
12
|
toJsonString
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/query/chunk-search.ts
|
|
16
16
|
init_cjs_shims();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ulid
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JENN4EVA.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
7
7
|
import {
|
|
8
8
|
DocumentChatResponseSchema,
|
|
9
9
|
__toESM,
|
|
10
10
|
init_cjs_shims,
|
|
11
11
|
require_lib,
|
|
12
12
|
toJsonString
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/query/document.ts
|
|
16
16
|
init_cjs_shims();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
4
4
|
import {
|
|
5
5
|
__toESM,
|
|
6
6
|
init_cjs_shims,
|
|
7
7
|
require_lib,
|
|
8
8
|
valueOf
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/query/events.ts
|
|
12
12
|
init_cjs_shims();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
4
4
|
import {
|
|
5
5
|
__toESM,
|
|
6
6
|
init_cjs_shims,
|
|
7
7
|
require_lib
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/query/reindex.ts
|
|
11
11
|
init_cjs_shims();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ulid
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JENN4EVA.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4U2CSHCN.js";
|
|
7
7
|
import {
|
|
8
8
|
__toESM,
|
|
9
9
|
init_cjs_shims,
|
|
10
10
|
require_lib
|
|
11
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-WDR5M2SS.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/query/search.ts
|
|
14
14
|
init_cjs_shims();
|
package/bundle/commands/tail.js
CHANGED
package/bundle/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.test.d.ts","sourceRoot":"","sources":["../src/build.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
// import * as fs from 'node:fs/promises';
|
|
3
|
+
// import * as os from 'node:os';
|
|
4
|
+
// import * as path from 'node:path';
|
|
5
|
+
// import build from './build.js';
|
|
6
|
+
test('dummy', () => {
|
|
7
|
+
expect(true).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
// TODO [bosgood] Days have been spent on this test, and it's still not working in CI
|
|
10
|
+
// Moving on for the moment.
|
|
11
|
+
// const ENTRY_POINT = `
|
|
12
|
+
// console.log('Hello, world!');
|
|
13
|
+
// `;
|
|
14
|
+
// const TSCONFIG = `
|
|
15
|
+
// {
|
|
16
|
+
// "compilerOptions": {
|
|
17
|
+
// "target": "ESNext",
|
|
18
|
+
// "module": "ESNext",
|
|
19
|
+
// "moduleResolution": "Node",
|
|
20
|
+
// "esModuleInterop": true,
|
|
21
|
+
// "skipLibCheck": true,
|
|
22
|
+
// "forceConsistentCasingInFileNames": true,
|
|
23
|
+
// "strict": true,
|
|
24
|
+
// "isolatedModules": true,
|
|
25
|
+
// "allowSyntheticDefaultImports": true,
|
|
26
|
+
// "resolveJsonModule": true,
|
|
27
|
+
// "jsx": "react-jsx",
|
|
28
|
+
// "outDir": "dist"
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// `;
|
|
32
|
+
// test('build', async () => {
|
|
33
|
+
// const root = await fs.mkdtemp(path.join(os.tmpdir(), 'build-test'));
|
|
34
|
+
// const srcDir = path.join(root, 'src');
|
|
35
|
+
// await fs.mkdir(srcDir);
|
|
36
|
+
// const tsconfig = path.join(root, 'tsconfig.json');
|
|
37
|
+
// const entryPoint = path.join(root, 'src', 'index.ts');
|
|
38
|
+
// await fs.writeFile(entryPoint, ENTRY_POINT);
|
|
39
|
+
// await fs.writeFile(tsconfig, TSCONFIG);
|
|
40
|
+
// await build({
|
|
41
|
+
// root,
|
|
42
|
+
// entryPoints: [entryPoint],
|
|
43
|
+
// outdir: path.join(root, 'dist'),
|
|
44
|
+
// });
|
|
45
|
+
// expect(await fs.readdir(path.join(root, 'dist'))).toContain('index.js');
|
|
46
|
+
// });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen.test.d.ts","sourceRoot":"","sources":["../src/codegen.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { mustManifestFromString } from '@liquidmetal-ai/drizzle/appify/index';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { expect, test } from 'vitest';
|
|
6
|
+
import { codegenPlan, gatherEnvForHandler, kebabCaseToCamelCase, kebabCaseToConstantCase, kebabCaseToUpperCamelCase, renderTemplatesFromDirectory, shouldWriteTemplate, trimTemplateSuffix, } from './codegen.js';
|
|
7
|
+
test('trims handlebars suffix', async () => {
|
|
8
|
+
expect(trimTemplateSuffix('index.ts.hbs')).toEqual('index.ts');
|
|
9
|
+
});
|
|
10
|
+
test('codegens from blank app', async () => {
|
|
11
|
+
const apps = await mustManifestFromString(`
|
|
12
|
+
application "ingest" {}
|
|
13
|
+
`);
|
|
14
|
+
const plan = codegenPlan(apps);
|
|
15
|
+
expect(Object.keys(plan)).toHaveLength(1);
|
|
16
|
+
expect(plan[0]?.templateName).toMatch('templates/init');
|
|
17
|
+
expect(plan[0]?.outPath).toEqual('');
|
|
18
|
+
});
|
|
19
|
+
test('codegens from app with observer', async () => {
|
|
20
|
+
const apps = await mustManifestFromString(`
|
|
21
|
+
application "ingest" {
|
|
22
|
+
bucket "bucket" {}
|
|
23
|
+
|
|
24
|
+
observer "process" {
|
|
25
|
+
source {
|
|
26
|
+
bucket = "bucket"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`);
|
|
31
|
+
const plan = codegenPlan(apps);
|
|
32
|
+
expect(Object.keys(plan)).toHaveLength(2);
|
|
33
|
+
expect(plan[1]?.templateName).toMatch('templates/handlers/bucket-event-notification');
|
|
34
|
+
expect(plan[1]?.outPath).toEqual('src/process');
|
|
35
|
+
});
|
|
36
|
+
test('codegens from app with service', async () => {
|
|
37
|
+
const apps = await mustManifestFromString(`
|
|
38
|
+
application "ingest" {
|
|
39
|
+
bucket "bucket" {}
|
|
40
|
+
|
|
41
|
+
service "ingester" {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
const plan = codegenPlan(apps);
|
|
46
|
+
expect(Object.keys(plan)).toHaveLength(2);
|
|
47
|
+
expect(plan[1]?.templateName).toMatch('templates/handlers/http-service');
|
|
48
|
+
expect(plan[1]?.outPath).toEqual('src/ingester');
|
|
49
|
+
});
|
|
50
|
+
test('codegens from app with durable object', async () => {
|
|
51
|
+
const apps = await mustManifestFromString(`
|
|
52
|
+
application "ingest" {
|
|
53
|
+
actor "ingest-object" {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`);
|
|
57
|
+
const plan = codegenPlan(apps);
|
|
58
|
+
expect(Object.keys(plan)).toHaveLength(2);
|
|
59
|
+
expect(plan[1]?.templateName).toMatch('templates/handlers/actor');
|
|
60
|
+
expect(plan[1]?.outPath).toEqual('src/ingest-object');
|
|
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
|
+
});
|
|
83
|
+
test('only codegens scaffolding when enabled', () => {
|
|
84
|
+
expect(shouldWriteTemplate({
|
|
85
|
+
renderScaffoldingCode: true,
|
|
86
|
+
}, 'src/handlers/something/__index.ts')).toBe(true);
|
|
87
|
+
expect(shouldWriteTemplate({
|
|
88
|
+
renderScaffoldingCode: false,
|
|
89
|
+
}, 'src/handlers/something/__index.ts')).toBe(false);
|
|
90
|
+
});
|
|
91
|
+
test('only codegens user modifiable code when enabled', () => {
|
|
92
|
+
expect(shouldWriteTemplate({
|
|
93
|
+
renderUserModifiableCode: true,
|
|
94
|
+
}, 'src/handlers/something/index.ts')).toBe(true);
|
|
95
|
+
expect(shouldWriteTemplate({
|
|
96
|
+
renderUserModifiableCode: false,
|
|
97
|
+
}, 'src/handlers/something/index.ts')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
test('only codegens non-user modifiable code when enabled', () => {
|
|
100
|
+
expect(shouldWriteTemplate({
|
|
101
|
+
renderNonUserModifiableCode: true,
|
|
102
|
+
}, 'src/handlers/something/env.gen.d.ts')).toBe(true);
|
|
103
|
+
expect(shouldWriteTemplate({
|
|
104
|
+
renderNonUserModifiableCode: false,
|
|
105
|
+
}, 'src/handlers/something/env.gen.d.ts')).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
test('codegens template files', async () => {
|
|
108
|
+
const templatePath = path.join(__dirname, '..', 'templates', 'init');
|
|
109
|
+
const outPath = await fs.mkdtemp(path.join(os.tmpdir(), 'codegen-test'));
|
|
110
|
+
await renderTemplatesFromDirectory({
|
|
111
|
+
templatePath,
|
|
112
|
+
outPath,
|
|
113
|
+
context: {
|
|
114
|
+
toolName: 'raindrop',
|
|
115
|
+
applicationName: 'test-app',
|
|
116
|
+
raindropFrameworkVersion: '0.4.9',
|
|
117
|
+
},
|
|
118
|
+
opts: {
|
|
119
|
+
renderScaffoldingCode: true,
|
|
120
|
+
renderUserModifiableCode: true,
|
|
121
|
+
renderNonUserModifiableCode: true,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
// Verify nested directory structure is preserved
|
|
125
|
+
const authFilePath = path.join(outPath, 'src', '_app', 'auth.ts');
|
|
126
|
+
const authFileExists = await fs.access(authFilePath).then(() => true, () => false);
|
|
127
|
+
expect(authFileExists).toBe(true);
|
|
128
|
+
// Verify the file content was copied correctly
|
|
129
|
+
const authFileContent = await fs.readFile(authFilePath, 'utf-8');
|
|
130
|
+
expect(authFileContent).toContain('verifyIssuer');
|
|
131
|
+
expect(authFileContent).toContain('requireAuthenticated');
|
|
132
|
+
});
|
|
133
|
+
test('kebabCaseToConstantCase', () => {
|
|
134
|
+
expect(kebabCaseToConstantCase('my-variable')).toEqual('MY_VARIABLE');
|
|
135
|
+
});
|
|
136
|
+
test('kebabCaseToCamelCase', () => {
|
|
137
|
+
expect(kebabCaseToCamelCase('my-variable')).toEqual('myVariable');
|
|
138
|
+
});
|
|
139
|
+
test('kebabCaseToUpperCamelCase', () => {
|
|
140
|
+
expect(kebabCaseToUpperCamelCase('my-variable')).toEqual('MyVariable');
|
|
141
|
+
});
|
|
142
|
+
test('generates SmartMemory type bindings', async () => {
|
|
143
|
+
const apps = await mustManifestFromString(`
|
|
144
|
+
application "test-app" {
|
|
145
|
+
smartmemory "user-memory" {}
|
|
146
|
+
|
|
147
|
+
service "test-service" {}
|
|
148
|
+
}
|
|
149
|
+
`);
|
|
150
|
+
const app = apps[0];
|
|
151
|
+
const service = app.service[0];
|
|
152
|
+
const generated = gatherEnvForHandler(service, app);
|
|
153
|
+
// Should include SmartMemory import
|
|
154
|
+
expect(generated).toMatch(/import\s+{[^}]*SmartMemory[^}]*}\s+from\s+'@liquidmetal-ai\/raindrop-framework'/);
|
|
155
|
+
// Should include SmartMemory type binding with constant case naming
|
|
156
|
+
expect(generated).toMatch(/USER_MEMORY:\s*SmartMemory/);
|
|
157
|
+
});
|
|
158
|
+
test('generates SmartBucket type bindings', async () => {
|
|
159
|
+
const apps = await mustManifestFromString(`
|
|
160
|
+
application "test-app" {
|
|
161
|
+
smartbucket "data-bucket" {}
|
|
162
|
+
|
|
163
|
+
service "test-service" {}
|
|
164
|
+
}
|
|
165
|
+
`);
|
|
166
|
+
const app = apps[0];
|
|
167
|
+
const service = app.service[0];
|
|
168
|
+
const generated = gatherEnvForHandler(service, app);
|
|
169
|
+
// Should include SmartBucket import
|
|
170
|
+
expect(generated).toMatch(/import\s+{[^}]*SmartBucket[^}]*}\s+from\s+'@liquidmetal-ai\/raindrop-framework'/);
|
|
171
|
+
// Should include SmartBucket type binding with constant case naming
|
|
172
|
+
expect(generated).toMatch(/DATA_BUCKET:\s*SmartBucket/);
|
|
173
|
+
});
|
|
174
|
+
test('always includes mem KvCache binding', async () => {
|
|
175
|
+
const apps = await mustManifestFromString(`
|
|
176
|
+
application "test-app" {
|
|
177
|
+
service "test-service" {}
|
|
178
|
+
}
|
|
179
|
+
`);
|
|
180
|
+
const app = apps[0];
|
|
181
|
+
const service = app.service[0];
|
|
182
|
+
const generated = gatherEnvForHandler(service, app);
|
|
183
|
+
// Should include KvCache import
|
|
184
|
+
expect(generated).toMatch(/import\s+{[^}]*KvCache[^}]*}\s+from\s+'@liquidmetal-ai\/raindrop-framework'/);
|
|
185
|
+
// Should include mem type binding
|
|
186
|
+
expect(generated).toMatch(/mem:\s*KvCache/);
|
|
187
|
+
});
|
|
188
|
+
test('includes auth env vars for protected service', async () => {
|
|
189
|
+
const apps = await mustManifestFromString(`
|
|
190
|
+
application "test-app" {
|
|
191
|
+
service "protected-service" {
|
|
192
|
+
visibility = "protected"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`);
|
|
196
|
+
const app = apps[0];
|
|
197
|
+
const service = app.service[0];
|
|
198
|
+
const generated = gatherEnvForHandler(service, app);
|
|
199
|
+
// Should include core auth bindings and WorkOS provider bindings for protected services
|
|
200
|
+
expect(generated).toMatch(/LM_AUTH_ALLOWED_ORIGINS:\s*string/);
|
|
201
|
+
expect(generated).toMatch(/LM_AUTH_ALLOWED_ISSUERS:\s*string/);
|
|
202
|
+
expect(generated).toMatch(/LM_PROVIDER_WORKOS_ORG_ID\?:\s*string/);
|
|
203
|
+
expect(generated).toMatch(/LM_PROVIDER_WORKOS_CLIENT_ID\?:\s*string/);
|
|
204
|
+
expect(generated).toMatch(/LM_PROVIDER_WORKOS_API_KEY\?:\s*string/);
|
|
205
|
+
});
|
|
206
|
+
test('does not include auth env vars for public service', async () => {
|
|
207
|
+
const apps = await mustManifestFromString(`
|
|
208
|
+
application "test-app" {
|
|
209
|
+
service "public-service" {
|
|
210
|
+
visibility = "public"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`);
|
|
214
|
+
const app = apps[0];
|
|
215
|
+
const service = app.service[0];
|
|
216
|
+
const generated = gatherEnvForHandler(service, app);
|
|
217
|
+
// Should NOT include auth env vars for non-protected services
|
|
218
|
+
expect(generated).not.toMatch(/LM_AUTH_ALLOWED_ORIGINS/);
|
|
219
|
+
expect(generated).not.toMatch(/LM_AUTH_ALLOWED_ISSUERS/);
|
|
220
|
+
expect(generated).not.toMatch(/LM_PROVIDER_WORKOS_ORG_ID/);
|
|
221
|
+
expect(generated).not.toMatch(/LM_PROVIDER_WORKOS_CLIENT_ID/);
|
|
222
|
+
expect(generated).not.toMatch(/LM_PROVIDER_WORKOS_API_KEY/);
|
|
223
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.test.d.ts","sourceRoot":"","sources":["../../../src/commands/logs/tail.test.ts"],"names":[],"mappings":""}
|