@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
|
@@ -237954,6 +237954,7 @@ var QueryResourcesResponse_Resource_ResourceType;
|
|
|
237954
237954
|
QueryResourcesResponse_Resource_ResourceType2[QueryResourcesResponse_Resource_ResourceType2["SMART_SQL"] = 16] = "SMART_SQL";
|
|
237955
237955
|
})(QueryResourcesResponse_Resource_ResourceType || (QueryResourcesResponse_Resource_ResourceType = {}));
|
|
237956
237956
|
var ReleaseRequest_LockSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_catalog, 15, 0);
|
|
237957
|
+
var StatusResponseSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_catalog, 26);
|
|
237957
237958
|
var QueryModulesResponseSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_catalog, 28);
|
|
237958
237959
|
var QueryModulesResponse_ModuleType;
|
|
237959
237960
|
(function(QueryModulesResponse_ModuleType2) {
|
|
@@ -238040,7 +238041,7 @@ var RaindropStateSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_
|
|
|
238040
238041
|
|
|
238041
238042
|
// ../drizzle/dist/liquidmetal/v1alpha1/riverjack_pb.js
|
|
238042
238043
|
init_cjs_shims();
|
|
238043
|
-
var file_liquidmetal_v1alpha1_riverjack = /* @__PURE__ */ fileDesc("
|
|
238044
|
+
var file_liquidmetal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RvMw", [file_google_protobuf_timestamp]);
|
|
238044
238045
|
var StreamLogsRequestSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_riverjack, 0);
|
|
238045
238046
|
var QueryLogsRequestSchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_riverjack, 1);
|
|
238046
238047
|
var TimeQuerySchema = /* @__PURE__ */ messageDesc(file_liquidmetal_v1alpha1_riverjack, 2);
|
|
@@ -238672,6 +238673,7 @@ export {
|
|
|
238672
238673
|
ApplicationsResponseSchema,
|
|
238673
238674
|
QueryResourcesResponseSchema,
|
|
238674
238675
|
ReleaseRequest_LockSchema,
|
|
238676
|
+
StatusResponseSchema,
|
|
238675
238677
|
QueryModulesResponseSchema,
|
|
238676
238678
|
GetKillswitchStatusResponse_State,
|
|
238677
238679
|
UnitState,
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_cjs_shims,
|
|
3
|
+
timestampMs
|
|
4
|
+
} from "./chunk-7GDFE7HE.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
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
source_default
|
|
3
|
+
} from "./chunk-2GD7Q3YS.js";
|
|
4
|
+
import {
|
|
5
|
+
GetKillswitchStatusResponse_State,
|
|
6
|
+
init_cjs_shims,
|
|
7
|
+
timestampDate
|
|
8
|
+
} from "./chunk-WDR5M2SS.js";
|
|
9
|
+
|
|
10
|
+
// src/killswitch-utils.ts
|
|
11
|
+
init_cjs_shims();
|
|
12
|
+
async function getKillswitchStatus(command) {
|
|
13
|
+
try {
|
|
14
|
+
const { client: catalogService, userId, organizationId } = await command.catalogService();
|
|
15
|
+
const response = await catalogService.getKillswitchStatus({
|
|
16
|
+
userId,
|
|
17
|
+
organizationId
|
|
18
|
+
});
|
|
19
|
+
const killswitchResponse = response;
|
|
20
|
+
return {
|
|
21
|
+
status: {
|
|
22
|
+
isActive: killswitchResponse.state === GetKillswitchStatusResponse_State.ACTIVE,
|
|
23
|
+
reason: killswitchResponse.reason || void 0,
|
|
24
|
+
updatedAt: killswitchResponse.at ? timestampDate(killswitchResponse.at) : void 0
|
|
25
|
+
},
|
|
26
|
+
organizationId
|
|
27
|
+
};
|
|
28
|
+
} catch (_error) {
|
|
29
|
+
command.log("[DEBUG] Could not fetch killswitch status: Service unavailable");
|
|
30
|
+
return {
|
|
31
|
+
status: {
|
|
32
|
+
isActive: false
|
|
33
|
+
},
|
|
34
|
+
organizationId: "unknown"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function displayKillswitchWarning(killswitchStatus, command, organizationId) {
|
|
39
|
+
if (!killswitchStatus.isActive) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const warningLines = [
|
|
43
|
+
"",
|
|
44
|
+
source_default.yellow.bold("\u26A0\uFE0F NOTICE"),
|
|
45
|
+
source_default.yellow(`Organization ${organizationId} is in a partially disabled state.`)
|
|
46
|
+
];
|
|
47
|
+
if (killswitchStatus.reason) {
|
|
48
|
+
warningLines.push(source_default.yellow(`Reason: ${killswitchStatus.reason}`));
|
|
49
|
+
}
|
|
50
|
+
if (killswitchStatus.updatedAt) {
|
|
51
|
+
const formattedDate = killswitchStatus.updatedAt.toLocaleString("en-US", {
|
|
52
|
+
weekday: "short",
|
|
53
|
+
month: "short",
|
|
54
|
+
day: "numeric",
|
|
55
|
+
hour: "numeric",
|
|
56
|
+
minute: "numeric",
|
|
57
|
+
second: "numeric",
|
|
58
|
+
hour12: false,
|
|
59
|
+
timeZoneName: "short"
|
|
60
|
+
});
|
|
61
|
+
warningLines.push(source_default.dim(`Updated: ${formattedDate}`));
|
|
62
|
+
}
|
|
63
|
+
warningLines.push("");
|
|
64
|
+
command.log(warningLines.join("\n"));
|
|
65
|
+
}
|
|
66
|
+
async function checkAndDisplayKillswitchStatus(command) {
|
|
67
|
+
const { status: killswitchStatus, organizationId } = await getKillswitchStatus(command);
|
|
68
|
+
displayKillswitchWarning(killswitchStatus, command, organizationId);
|
|
69
|
+
return killswitchStatus;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
checkAndDisplayKillswitchStatus
|
|
74
|
+
};
|