@liquidmetal-ai/raindrop 0.13.0 → 0.15.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 +327 -89
- package/bundle/build-CBEGQPJT.js +62 -0
- package/bundle/{chunk-IEF2XC25.js → chunk-2PH3PHH3.js} +5 -3
- package/bundle/{chunk-4HZ22KOV.js → chunk-3CMR7ES5.js} +4 -4
- package/bundle/{chunk-JSBM2JYW.js → chunk-3EYKCHIK.js} +1 -1
- package/bundle/chunk-5XHDP4VK.js +1697 -0
- package/bundle/{chunk-TSQK4HH6.js → chunk-674GMSXY.js} +1 -1
- package/bundle/{chunk-PS3WZBDF.js → chunk-6L4V66WZ.js} +1105 -2728
- package/bundle/{chunk-5245CEUM.js → chunk-AGG7JZVH.js} +2 -2
- package/bundle/{chunk-3GFKUF5D.js → chunk-B3IY2XS6.js} +4 -2
- package/bundle/{chunk-WIDI65NO.js → chunk-CBAXTRCS.js} +1 -1
- package/bundle/{chunk-JLVDTXO2.js → chunk-DPV5HIG7.js} +4 -4
- package/bundle/{chunk-36GNZK4A.js → chunk-EVXLXWP7.js} +1 -1
- package/bundle/{chunk-4YVU5KEQ.js → chunk-HN3AAKRY.js} +4 -2
- package/bundle/{chunk-NVNEQXHN.js → chunk-IGLE4Y3B.js} +7 -5
- package/bundle/{chunk-FGSYWVBA.js → chunk-IQ6HFRA6.js} +1 -1
- package/bundle/{chunk-O3QZDJ75.js → chunk-JQONDSHY.js} +2 -2
- package/bundle/{chunk-W4IPOFZC.js → chunk-KADMFJLN.js} +8 -6
- package/bundle/chunk-KG5BLUGU.js +246 -0
- package/bundle/{chunk-V5LHJTYS.js → chunk-KLOYSTZY.js} +13 -2
- package/bundle/{chunk-ETC5VU7H.js → chunk-KXHVSLAI.js} +1 -1
- package/bundle/{chunk-Y4WFGNPM.js → chunk-L6FRQULN.js} +1 -1
- package/bundle/{chunk-3QCVYSRU.js → chunk-LT3BFQ4O.js} +1 -1
- package/bundle/{chunk-KQZJHBNG.js → chunk-MBLKVNI5.js} +1 -1
- package/bundle/{chunk-6AIUQUUM.js → chunk-MFMVJZW6.js} +71 -15
- package/bundle/{chunk-25T7MEKO.js → chunk-MJBLNWG3.js} +1 -1
- package/bundle/{chunk-MSJ33O5Y.js → chunk-NRCQIE3Z.js} +95 -115
- package/bundle/{chunk-XKKPPSPC.js → chunk-OCYTN4IH.js} +2 -2
- package/bundle/{chunk-2GAMWFJE.js → chunk-QEF5D4VE.js} +1 -1
- package/bundle/{chunk-4B3QYXBA.js → chunk-T7MQCLXF.js} +5 -3
- package/bundle/{chunk-LDFYPOXJ.js → chunk-TFQY5TSY.js} +1 -1
- package/bundle/{chunk-BWK4MC7Y.js → chunk-USZXZZAR.js} +8 -6
- package/bundle/{chunk-ER2RCPCY.js → chunk-V54KHS5B.js} +2 -2
- package/bundle/{chunk-YSKASURB.js → chunk-V6J23FL2.js} +1 -1
- package/bundle/{chunk-UHSTDJ7X.js → chunk-VN2QYX4C.js} +1 -1
- package/bundle/{chunk-Z4OWKG7J.js → chunk-VOT5MMEY.js} +1 -1
- package/bundle/{chunk-W6GU26WO.js → chunk-WG6BDFPZ.js} +1 -1
- package/bundle/{chunk-AK77X5GL.js → chunk-XX74I5RK.js} +4 -2
- package/bundle/{chunk-6BT265R3.js → chunk-YQCRWPNI.js} +1 -1
- 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/apikey.js +2 -2
- package/bundle/commands/auth/list.js +2 -2
- package/bundle/commands/auth/login.js +2 -2
- 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/actor/setup.js +124 -0
- package/bundle/commands/build/branch.js +10 -10
- package/bundle/commands/build/bucket-events/setup.js +146 -0
- package/bundle/commands/build/checkout.js +8 -8
- package/bundle/commands/build/clone.js +6 -6
- package/bundle/commands/build/delete.js +8 -8
- package/bundle/commands/build/deploy.js +10 -10
- package/bundle/commands/build/env/get.js +3 -3
- package/bundle/commands/build/env/list.js +2 -2
- package/bundle/commands/build/env/set.js +3 -3
- package/bundle/commands/build/env.js +2 -2
- package/bundle/commands/build/features.js +192 -0
- package/bundle/commands/build/find.js +4 -4
- package/bundle/commands/build/generate.js +52 -3
- package/bundle/commands/build/init-workspace.js +3 -3
- package/bundle/commands/build/init.js +15 -3
- package/bundle/commands/build/list.js +5 -5
- package/bundle/commands/build/queue/setup.js +133 -0
- package/bundle/commands/build/sandbox.js +6 -6
- package/bundle/commands/build/smartbucket/setup.js +165 -0
- package/bundle/commands/build/smartmemory/setup.js +171 -0
- package/bundle/commands/build/smartsql/setup.js +167 -0
- 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/stripe/dashboard.js +3 -3
- package/bundle/commands/build/stripe/onboard.js +3 -3
- package/bundle/commands/build/stripe/setup.js +3 -3
- package/bundle/commands/build/stripe/start.js +14 -14
- package/bundle/commands/build/stripe/status.js +3 -3
- package/bundle/commands/build/stripe/subscription/create.js +4 -4
- package/bundle/commands/build/stripe/subscription/get.js +4 -4
- package/bundle/commands/build/stripe/subscription/update.js +4 -4
- package/bundle/commands/build/tools/check.js +2 -2
- package/bundle/commands/build/tools/fmt.js +2 -2
- package/bundle/commands/build/unsandbox.js +6 -6
- package/bundle/commands/build/upload.js +5 -5
- package/bundle/commands/build/validate.js +85 -14
- package/bundle/commands/build/workos/delete.js +6 -6
- package/bundle/commands/build/workos/env/attach.js +3 -3
- package/bundle/commands/build/workos/env/attached.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/dev-login.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/jwt.js +172 -0
- 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 +6 -6
- package/bundle/commands/dns/get.js +6 -6
- 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/doctor.js +309 -0
- 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 +5 -37
- package/bundle/commands/object/get.js +5 -37
- package/bundle/commands/object/list.js +7 -39
- package/bundle/commands/object/put.js +5 -37
- package/bundle/commands/query/chunk-search.js +14 -46
- package/bundle/commands/query/document.js +17 -55
- package/bundle/commands/query/events.js +2 -2
- package/bundle/commands/query/reindex.js +2 -2
- package/bundle/commands/query/search.js +14 -46
- package/bundle/commands/tail.js +2 -2
- package/bundle/index.js +1 -1
- package/dist/commands/build/actor/setup.d.ts +22 -0
- package/dist/commands/build/actor/setup.d.ts.map +1 -0
- package/dist/commands/build/actor/setup.js +116 -0
- package/dist/commands/build/bucket-events/setup.d.ts +22 -0
- package/dist/commands/build/bucket-events/setup.d.ts.map +1 -0
- package/dist/commands/build/bucket-events/setup.js +134 -0
- package/dist/commands/build/features.d.ts +19 -0
- package/dist/commands/build/features.d.ts.map +1 -0
- package/dist/commands/build/features.js +97 -0
- package/dist/commands/build/generate.d.ts +2 -0
- package/dist/commands/build/generate.d.ts.map +1 -1
- package/dist/commands/build/generate.js +52 -0
- package/dist/commands/build/init.d.ts.map +1 -1
- package/dist/commands/build/init.js +10 -0
- package/dist/commands/build/queue/setup.d.ts +21 -0
- package/dist/commands/build/queue/setup.d.ts.map +1 -0
- package/dist/commands/build/queue/setup.js +120 -0
- package/dist/commands/build/smartbucket/setup.d.ts +23 -0
- package/dist/commands/build/smartbucket/setup.d.ts.map +1 -0
- package/dist/commands/build/smartbucket/setup.js +167 -0
- package/dist/commands/build/smartmemory/setup.d.ts +23 -0
- package/dist/commands/build/smartmemory/setup.d.ts.map +1 -0
- package/dist/commands/build/smartmemory/setup.js +172 -0
- package/dist/commands/build/smartsql/setup.d.ts +23 -0
- package/dist/commands/build/smartsql/setup.d.ts.map +1 -0
- package/dist/commands/build/smartsql/setup.js +169 -0
- package/dist/commands/build/validate.d.ts +2 -0
- package/dist/commands/build/validate.d.ts.map +1 -1
- package/dist/commands/build/validate.js +80 -8
- package/dist/commands/build/workos/jwt.d.ts +23 -0
- package/dist/commands/build/workos/jwt.d.ts.map +1 -0
- package/dist/commands/build/workos/jwt.js +172 -0
- package/dist/commands/doctor.d.ts +27 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +328 -0
- package/dist/commands/object/delete.d.ts +0 -2
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +3 -38
- package/dist/commands/object/get.d.ts +0 -2
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +3 -38
- package/dist/commands/object/list.d.ts +0 -2
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +5 -40
- package/dist/commands/object/put.d.ts +0 -2
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +3 -38
- package/dist/commands/query/chunk-search.d.ts +0 -2
- package/dist/commands/query/chunk-search.d.ts.map +1 -1
- package/dist/commands/query/chunk-search.js +12 -46
- package/dist/commands/query/document.d.ts +1 -3
- package/dist/commands/query/document.d.ts.map +1 -1
- package/dist/commands/query/document.js +16 -60
- package/dist/commands/query/search.d.ts +0 -2
- package/dist/commands/query/search.d.ts.map +1 -1
- package/dist/commands/query/search.js +12 -46
- package/dist/feature-catalog.d.ts +28 -0
- package/dist/feature-catalog.d.ts.map +1 -0
- package/dist/feature-catalog.js +104 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/oclif.manifest.json +4811 -3433
- package/package.json +3 -3
- package/templates/examples/smartbucket-minimal.ts.hbs +87 -0
- package/templates/examples/smartmemory-minimal.ts.hbs +82 -0
- package/templates/examples/smartsql-minimal.ts.hbs +69 -0
- package/templates/handlers/actor/index.test.ts.hbs +48 -85
- package/templates/handlers/actor/index.ts.hbs +16 -316
- package/templates/handlers/bucket-event-notification/index.ts.hbs +32 -235
- package/templates/handlers/bucket-event-observer.ts.hbs +79 -0
- package/templates/handlers/http-service/index.test.ts.hbs +3 -0
- package/templates/handlers/http-service/index.ts.hbs +43 -15
- package/templates/handlers/queue-consumer-setup.ts.hbs +45 -0
- package/templates/handlers/task/index.test.ts.hbs +30 -112
- package/templates/handlers/task/index.ts.hbs +19 -58
- package/templates/init/RAINDROP.md.hbs +97 -1
- package/templates/init/eslint.config.js +43 -0
- package/templates/init/package.json.hbs +4 -1
- package/templates/init/tsconfig.json +3 -3
- package/bundle/chunk-23UBI7BN.js +0 -48
- package/bundle/chunk-2QWMBNE3.js +0 -384
- package/bundle/chunk-45IYWQDC.js +0 -384
- package/bundle/chunk-5YUO23QU.js +0 -4585
- package/bundle/chunk-6MIGCNUO.js +0 -75
- package/bundle/chunk-7ZJWA6HP.js +0 -805
- package/bundle/chunk-AIYVX2M7.js +0 -44
- package/bundle/chunk-BB5TNIEM.js +0 -48
- package/bundle/chunk-BUR3HFKH.js +0 -488
- package/bundle/chunk-BYSBS7KT.js +0 -488
- package/bundle/chunk-CX3RWI62.js +0 -28658
- package/bundle/chunk-DLH7MI57.js +0 -305
- package/bundle/chunk-E3WJIYJZ.js +0 -12148
- package/bundle/chunk-EX7NOPRF.js +0 -12148
- package/bundle/chunk-F76JQS2J.js +0 -231
- package/bundle/chunk-FBOXMVKD.js +0 -28679
- package/bundle/chunk-FTPZ6SQW.js +0 -238909
- package/bundle/chunk-H3CFZ7ZH.js +0 -74
- package/bundle/chunk-HXOILVWA.js +0 -384
- package/bundle/chunk-IMP7O5AC.js +0 -22452
- package/bundle/chunk-IPYOAKRE.js +0 -231
- package/bundle/chunk-J7HN6XF2.js +0 -4461
- package/bundle/chunk-JOLOAALA.js +0 -231
- package/bundle/chunk-JZ2G4Q35.js +0 -4585
- package/bundle/chunk-KVAWPWF7.js +0 -231
- package/bundle/chunk-MEUAAIXV.js +0 -28657
- package/bundle/chunk-QBWFE57Z.js +0 -384
- package/bundle/chunk-SP3LOXPC.js +0 -46
- package/bundle/chunk-T7C564PR.js +0 -28678
- package/bundle/chunk-UFH545WJ.js +0 -22452
- package/bundle/chunk-UHVMPWM5.js +0 -315
- package/bundle/chunk-VB7ZTSZV.js +0 -1089
- package/bundle/chunk-VBIJDFMJ.js +0 -384
- package/bundle/chunk-VR7RLTE3.js +0 -231
- package/bundle/chunk-WFZUJLEC.js +0 -231
- package/bundle/chunk-YDGJTLVZ.js +0 -133
- package/bundle/chunk-YPNQ7UFK.js +0 -502
- package/bundle/chunk-YXFDRMSN.js +0 -384
- package/dist/lib/dns-utils.d.ts +0 -7
- package/dist/lib/dns-utils.d.ts.map +0 -1
- package/dist/lib/dns-utils.js +0 -44
package/bundle/chunk-WFZUJLEC.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FileSystemBundle,
|
|
3
|
-
archive
|
|
4
|
-
} from "./chunk-7ZJWA6HP.js";
|
|
5
|
-
import {
|
|
6
|
-
buildHandlers
|
|
7
|
-
} from "./chunk-XKKPPSPC.js";
|
|
8
|
-
import {
|
|
9
|
-
tmpdir
|
|
10
|
-
} from "./chunk-MEUAAIXV.js";
|
|
11
|
-
import {
|
|
12
|
-
BundleArchiveType,
|
|
13
|
-
Code,
|
|
14
|
-
ConnectError,
|
|
15
|
-
ReleaseRequest_LockSchema,
|
|
16
|
-
create,
|
|
17
|
-
init_cjs_shims,
|
|
18
|
-
listEnvVars,
|
|
19
|
-
valueOf
|
|
20
|
-
} from "./chunk-PS3WZBDF.js";
|
|
21
|
-
|
|
22
|
-
// src/deploy.ts
|
|
23
|
-
init_cjs_shims();
|
|
24
|
-
import fs from "node:fs/promises";
|
|
25
|
-
import * as path from "node:path";
|
|
26
|
-
async function deploy(options) {
|
|
27
|
-
const { command, root, manifest, output } = options;
|
|
28
|
-
const manifestPath = path.isAbsolute(manifest) ? manifest : path.join(root, manifest);
|
|
29
|
-
const buildDir = path.isAbsolute(output) ? output : path.join(root, output);
|
|
30
|
-
const apps = await command.loadManifest();
|
|
31
|
-
if (apps[0] === void 0) {
|
|
32
|
-
command.error("There are no applications in the manifest");
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
35
|
-
const app = apps[0];
|
|
36
|
-
const manifestContents = await fs.readFile(manifestPath, "utf8");
|
|
37
|
-
await buildHandlers(command, apps, buildDir, root);
|
|
38
|
-
const runtimeVersion = await command.raindropFrameworkVersion();
|
|
39
|
-
const { client: catalogService, userId, organizationId: defaultOrganizationId } = await command.catalogService();
|
|
40
|
-
const organizationId = options.impersonate ?? defaultOrganizationId;
|
|
41
|
-
let deployResp;
|
|
42
|
-
try {
|
|
43
|
-
deployResp = await catalogService.deploy({
|
|
44
|
-
userId,
|
|
45
|
-
organizationId,
|
|
46
|
-
applications: [
|
|
47
|
-
{
|
|
48
|
-
application: valueOf(app.name),
|
|
49
|
-
previousVersionId: options.previousVersionId,
|
|
50
|
-
currentVersionId: options.currentVersionId,
|
|
51
|
-
branch: options.branch,
|
|
52
|
-
amend: options.amend,
|
|
53
|
-
metadata: {
|
|
54
|
-
runtimeVersion
|
|
55
|
-
},
|
|
56
|
-
manifest: manifestContents,
|
|
57
|
-
lock: options.lock,
|
|
58
|
-
suite: ""
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
} catch (err) {
|
|
63
|
-
if (err instanceof ConnectError && err.code === Code.FailedPrecondition) {
|
|
64
|
-
command.error(
|
|
65
|
-
`Failed to ${options.amend ? "amend" : "deploy"} ${valueOf(app.name)}@${options.previousVersionId}=>${options.currentVersionId}: ${err.message}`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
if (deployResp.applications[0] === void 0) {
|
|
71
|
-
command.error("Failed to deploy application");
|
|
72
|
-
}
|
|
73
|
-
const currentVersionId = deployResp.applications[0].currentVersionId;
|
|
74
|
-
if (!currentVersionId) {
|
|
75
|
-
command.error("Failed to retrieve current version ID from deployment response.");
|
|
76
|
-
}
|
|
77
|
-
const lock = deployResp.applications[0].lock;
|
|
78
|
-
const config = await command.loadConfig();
|
|
79
|
-
config.versionId = currentVersionId;
|
|
80
|
-
config.lock = lock;
|
|
81
|
-
await command.saveConfig(config);
|
|
82
|
-
await checkEnvironmentVariables(command, app, catalogService, userId, organizationId, currentVersionId);
|
|
83
|
-
await uploadBundles(command, app, buildDir, catalogService, userId, organizationId, currentVersionId);
|
|
84
|
-
await uploadDbBundle(command, root, catalogService, userId, organizationId, app, currentVersionId);
|
|
85
|
-
if (options.start) {
|
|
86
|
-
await catalogService.setActive({
|
|
87
|
-
userId,
|
|
88
|
-
organizationId,
|
|
89
|
-
applications: deployResp.applications.map((a) => ({
|
|
90
|
-
applicationName: a.applicationName,
|
|
91
|
-
currentVersionId: a.currentVersionId,
|
|
92
|
-
isActive: options.start
|
|
93
|
-
}))
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
await catalogService.release({
|
|
97
|
-
userId,
|
|
98
|
-
organizationId,
|
|
99
|
-
locks: deployResp.applications.map(
|
|
100
|
-
(a) => create(ReleaseRequest_LockSchema, {
|
|
101
|
-
applicationName: a.applicationName,
|
|
102
|
-
currentVersionId: a.currentVersionId,
|
|
103
|
-
lock: a.lock
|
|
104
|
-
})
|
|
105
|
-
)
|
|
106
|
-
});
|
|
107
|
-
config.lock = void 0;
|
|
108
|
-
await command.saveConfig(config);
|
|
109
|
-
return currentVersionId;
|
|
110
|
-
}
|
|
111
|
-
async function checkEnvironmentVariables(command, app, catalogService, userId, organizationId, currentVersionId) {
|
|
112
|
-
const envVars = listEnvVars(app);
|
|
113
|
-
if (Object.keys(envVars).length > 0) {
|
|
114
|
-
const getEnvsResp = await catalogService.getEnvs({
|
|
115
|
-
userId,
|
|
116
|
-
organizationId,
|
|
117
|
-
envs: Object.keys(envVars).map((key) => ({
|
|
118
|
-
applicationName: valueOf(app.name),
|
|
119
|
-
currentVersionId,
|
|
120
|
-
key
|
|
121
|
-
}))
|
|
122
|
-
});
|
|
123
|
-
let unset = false;
|
|
124
|
-
const remoteEnvVars = Object.fromEntries(getEnvsResp.envs.map((env) => [env.key, env.value]));
|
|
125
|
-
for (const key of Object.keys(envVars)) {
|
|
126
|
-
const manifestDefault = envVars[key]?.default;
|
|
127
|
-
const remoteValue = remoteEnvVars[key];
|
|
128
|
-
if (remoteValue === void 0 && manifestDefault === void 0) {
|
|
129
|
-
if (!unset) {
|
|
130
|
-
command.warn(`The following environment variables were not set and are required for deployment:`);
|
|
131
|
-
}
|
|
132
|
-
unset = true;
|
|
133
|
-
command.warn(key);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (unset) {
|
|
137
|
-
command.error(
|
|
138
|
-
"Please set environment variables before deploying. You can resume using `raindrop build deploy --amend`"
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async function uploadBundles(command, app, buildDir, catalogService, userId, organizationId, currentVersionId) {
|
|
144
|
-
await Promise.all(
|
|
145
|
-
app.handlers().map(async (handler) => {
|
|
146
|
-
const bundle = new FileSystemBundle(path.join(buildDir, valueOf(handler.name)));
|
|
147
|
-
await catalogService.uploadBundle({
|
|
148
|
-
userId,
|
|
149
|
-
organizationId,
|
|
150
|
-
applicationName: valueOf(app.name),
|
|
151
|
-
applicationVersionId: currentVersionId,
|
|
152
|
-
archiveType: BundleArchiveType.ZIP,
|
|
153
|
-
bundleName: valueOf(handler.name),
|
|
154
|
-
archive: Buffer.from(await archive(bundle))
|
|
155
|
-
});
|
|
156
|
-
command.log(`Uploaded bundle "${valueOf(handler.name)}"`);
|
|
157
|
-
})
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
async function uploadDbBundle(command, root, catalogService, userId, organizationId, app, currentVersionId) {
|
|
161
|
-
const dbDir = path.join(root, "db");
|
|
162
|
-
let dbExists = false;
|
|
163
|
-
try {
|
|
164
|
-
const stat = await fs.lstat(dbDir);
|
|
165
|
-
dbExists = stat.isDirectory();
|
|
166
|
-
} catch (_e) {
|
|
167
|
-
}
|
|
168
|
-
if (dbExists) {
|
|
169
|
-
command.log(`Checking for SQL files in ${dbDir}`);
|
|
170
|
-
const files = await fs.readdir(dbDir, {
|
|
171
|
-
withFileTypes: true
|
|
172
|
-
});
|
|
173
|
-
const folders = files.filter((file) => file.isDirectory());
|
|
174
|
-
try {
|
|
175
|
-
const tempDir = tmpdir();
|
|
176
|
-
for (const folder of folders) {
|
|
177
|
-
const sqlFiles = (await fs.readdir(path.join(dbDir, folder.name))).filter((file) => file.endsWith(".sql"));
|
|
178
|
-
const tmpDbFolder = await fs.mkdir(path.join(tempDir, folder.name), { recursive: true });
|
|
179
|
-
for (const sqlFile of sqlFiles) {
|
|
180
|
-
await fs.copyFile(path.join(dbDir, folder.name, sqlFile), path.join(tmpDbFolder, sqlFile));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const dbBundle = new FileSystemBundle(tempDir);
|
|
184
|
-
await catalogService.uploadBundle({
|
|
185
|
-
userId,
|
|
186
|
-
organizationId,
|
|
187
|
-
applicationName: valueOf(app.name),
|
|
188
|
-
applicationVersionId: currentVersionId,
|
|
189
|
-
archiveType: BundleArchiveType.ZIP,
|
|
190
|
-
bundleName: "db",
|
|
191
|
-
archive: Buffer.from(await archive(dbBundle))
|
|
192
|
-
});
|
|
193
|
-
command.log(`Uploaded db bundle with SQL files`);
|
|
194
|
-
await fs.rm(tempDir, { recursive: true, force: true });
|
|
195
|
-
} catch (error) {
|
|
196
|
-
command.log(`Failed to upload db bundle: ${error}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
async function sandbox(options) {
|
|
201
|
-
const { command, versionId: versionIdRaw, impersonate, isSandboxed } = options;
|
|
202
|
-
const config = await command.loadConfig();
|
|
203
|
-
const { client: catalogService, userId, organizationId: defaultOrganizationId } = await command.catalogService();
|
|
204
|
-
const organizationId = impersonate ?? defaultOrganizationId;
|
|
205
|
-
const apps = await command.loadManifest();
|
|
206
|
-
const app = apps[0];
|
|
207
|
-
const versionId = versionIdRaw ?? config.versionId;
|
|
208
|
-
if (!app) {
|
|
209
|
-
throw new Error("No application found");
|
|
210
|
-
}
|
|
211
|
-
const applications = [
|
|
212
|
-
{
|
|
213
|
-
applicationName: valueOf(app.name),
|
|
214
|
-
currentVersionId: versionId,
|
|
215
|
-
isSandboxed
|
|
216
|
-
}
|
|
217
|
-
];
|
|
218
|
-
await catalogService.setSandbox({
|
|
219
|
-
userId,
|
|
220
|
-
organizationId,
|
|
221
|
-
applications
|
|
222
|
-
});
|
|
223
|
-
config.sandbox = isSandboxed;
|
|
224
|
-
await command.saveConfig(config);
|
|
225
|
-
return applications;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export {
|
|
229
|
-
deploy,
|
|
230
|
-
sandbox
|
|
231
|
-
};
|
package/bundle/chunk-YDGJTLVZ.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_cjs_shims,
|
|
3
|
-
timestampMs
|
|
4
|
-
} from "./chunk-PS3WZBDF.js";
|
|
5
|
-
|
|
6
|
-
// src/log-helpers.ts
|
|
7
|
-
init_cjs_shims();
|
|
8
|
-
function formatLogAttribute(key, value, displayValue) {
|
|
9
|
-
if (key === "http.status") {
|
|
10
|
-
const statusCode = parseInt(value);
|
|
11
|
-
const statusEmoji = statusCode >= 200 && statusCode < 300 ? "\u2705" : statusCode >= 400 ? "\u274C" : "\u26A0\uFE0F";
|
|
12
|
-
return `${key}: ${statusEmoji} ${value}`;
|
|
13
|
-
} else if (key === "http.method" || key === "http.url") {
|
|
14
|
-
return `${key}: ${value}`;
|
|
15
|
-
} else if (key === "query") {
|
|
16
|
-
return `\u{1F5C4}\uFE0F SQL Query: ${value}`;
|
|
17
|
-
} else if (key === "rows_read") {
|
|
18
|
-
return `\u{1F4CA} Rows Read: ${value}`;
|
|
19
|
-
} else if (key === "rows_written") {
|
|
20
|
-
return `\u270D\uFE0F Rows Written: ${value}`;
|
|
21
|
-
} else if (key === "db") {
|
|
22
|
-
return `\u{1F3E6} Database: ${value}`;
|
|
23
|
-
} else if (key === "error") {
|
|
24
|
-
if (value && value !== "undefined") {
|
|
25
|
-
return `\u274C Error: ${value}`;
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
} else if (key === "fields" || key === "meta") {
|
|
29
|
-
try {
|
|
30
|
-
const parsed = JSON.parse(displayValue);
|
|
31
|
-
if (key === "meta" && parsed) {
|
|
32
|
-
const metrics = [];
|
|
33
|
-
if (parsed.duration) metrics.push(`${parsed.duration}ms`);
|
|
34
|
-
if (parsed.rows_read) metrics.push(`${parsed.rows_read} rows read`);
|
|
35
|
-
if (parsed.rows_written && parsed.rows_written > 0) metrics.push(`${parsed.rows_written} rows written`);
|
|
36
|
-
if (parsed.served_by_region) metrics.push(`${parsed.served_by_region}`);
|
|
37
|
-
if (parsed.size_after) metrics.push(`DB: ${(parsed.size_after / 1024).toFixed(1)}KB`);
|
|
38
|
-
if (metrics.length > 0) {
|
|
39
|
-
return `\u{1F4CA} ${key}: ${metrics.join(", ")}`;
|
|
40
|
-
} else {
|
|
41
|
-
return `${key}: ${JSON.stringify(parsed, (_, v) => typeof v === "bigint" ? v.toString() : v)}`;
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
return `${key}: ${JSON.stringify(parsed, (_, v) => typeof v === "bigint" ? v.toString() : v)}`;
|
|
45
|
-
}
|
|
46
|
-
} catch {
|
|
47
|
-
return `${key}: ${displayValue}`;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
return `${key}: ${displayValue}`;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function displayEventAttributes(event, logger, indentLevel = " ") {
|
|
54
|
-
if (event.attributes && Object.keys(event.attributes).length > 0) {
|
|
55
|
-
Object.entries(event.attributes).forEach(([key, value]) => {
|
|
56
|
-
if (value !== void 0 && value !== null) {
|
|
57
|
-
let displayValue = value;
|
|
58
|
-
try {
|
|
59
|
-
const parsed = JSON.parse(value);
|
|
60
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
61
|
-
displayValue = JSON.stringify(parsed, (_, v) => {
|
|
62
|
-
if (typeof v === "bigint") {
|
|
63
|
-
return v.toString();
|
|
64
|
-
}
|
|
65
|
-
return v;
|
|
66
|
-
}, 2);
|
|
67
|
-
}
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
const formattedAttribute = formatLogAttribute(key, value, displayValue);
|
|
71
|
-
if (formattedAttribute) {
|
|
72
|
-
logger.log(`${indentLevel}${formattedAttribute}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function displayTraceGroupedEvents(events, logger) {
|
|
79
|
-
const eventsByTrace = /* @__PURE__ */ new Map();
|
|
80
|
-
events.forEach((event) => {
|
|
81
|
-
const traceId = event.trace?.eventId || "unknown";
|
|
82
|
-
if (!eventsByTrace.has(traceId)) {
|
|
83
|
-
eventsByTrace.set(traceId, []);
|
|
84
|
-
}
|
|
85
|
-
const traceEvents = eventsByTrace.get(traceId);
|
|
86
|
-
if (traceEvents) {
|
|
87
|
-
traceEvents.push(event);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
for (const [traceId, traceEvents] of eventsByTrace) {
|
|
91
|
-
if (traceEvents.length === 0) continue;
|
|
92
|
-
traceEvents.sort((a, b) => {
|
|
93
|
-
if (a.eventOrder !== void 0 && b.eventOrder !== void 0) {
|
|
94
|
-
return a.eventOrder - b.eventOrder;
|
|
95
|
-
}
|
|
96
|
-
const aTime = a.trace?.startTime ? timestampMs(a.trace.startTime) : 0;
|
|
97
|
-
const bTime = b.trace?.startTime ? timestampMs(b.trace.startTime) : 0;
|
|
98
|
-
return aTime - bTime;
|
|
99
|
-
});
|
|
100
|
-
const firstEvent = traceEvents[0];
|
|
101
|
-
const lastEvent = traceEvents[traceEvents.length - 1];
|
|
102
|
-
const startTime = firstEvent.trace?.startTime ? timestampMs(firstEvent.trace.startTime) : 0;
|
|
103
|
-
const endTime = lastEvent.trace?.endTime ? timestampMs(lastEvent.trace.endTime) : lastEvent.trace?.startTime ? timestampMs(lastEvent.trace.startTime) : 0;
|
|
104
|
-
const traceDuration = endTime > startTime ? ` (${endTime - startTime}ms total)` : "";
|
|
105
|
-
const timestamp = firstEvent.trace?.startTime ? new Date(timestampMs(firstEvent.trace.startTime)).toLocaleString() : "Unknown time";
|
|
106
|
-
logger.log(`[${timestamp}] \u{1F517} Trace: ${traceId}${traceDuration}`);
|
|
107
|
-
if (firstEvent.organization?.id || firstEvent.application?.name) {
|
|
108
|
-
const contextParts = [];
|
|
109
|
-
if (firstEvent.organization?.id) contextParts.push(`Org: ${firstEvent.organization.id}`);
|
|
110
|
-
if (firstEvent.application?.name) contextParts.push(`App: ${firstEvent.application.name}`);
|
|
111
|
-
if (firstEvent.application?.version?.id) contextParts.push(`v${firstEvent.application.version.id}`);
|
|
112
|
-
if (firstEvent.script?.name) contextParts.push(`Script: ${firstEvent.script.name}`);
|
|
113
|
-
logger.log(` ${contextParts.join(", ")}`);
|
|
114
|
-
}
|
|
115
|
-
traceEvents.forEach((event, index) => {
|
|
116
|
-
const eventName = event.name || "Event";
|
|
117
|
-
const status = event.status || "ok";
|
|
118
|
-
const statusEmoji = status === "error" ? "\u274C" : "\u2705";
|
|
119
|
-
let duration = "";
|
|
120
|
-
if (event.trace?.endTime && event.trace?.startTime) {
|
|
121
|
-
const durationMs = timestampMs(event.trace.endTime) - timestampMs(event.trace.startTime);
|
|
122
|
-
duration = ` (${durationMs}ms)`;
|
|
123
|
-
}
|
|
124
|
-
logger.log(` ${index + 1}. ${statusEmoji} ${eventName}${duration}`);
|
|
125
|
-
displayEventAttributes(event, logger, " ");
|
|
126
|
-
});
|
|
127
|
-
logger.log("");
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export {
|
|
132
|
-
displayTraceGroupedEvents
|
|
133
|
-
};
|