@withone/cli 1.41.0 → 1.43.2
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 +73 -17
- package/dist/chunk-44CV5IMX.js +38 -0
- package/dist/chunk-5TT27ORC.js +1698 -0
- package/dist/chunk-7N5EJTYW.js +59 -0
- package/dist/chunk-AD4QM6R5.js +762 -0
- package/dist/chunk-AU2ZEEMS.js +477 -0
- package/dist/{chunk-A5AFLKCQ.js → chunk-EMAQVPRD.js} +9 -36
- package/dist/chunk-MRGKKO54.js +158 -0
- package/dist/embedding-O4XWBL6T.js +10 -0
- package/dist/{flow-runner-26LNPU4F.js → flow-runner-XSJ4US5S.js} +2 -1
- package/dist/index.js +3016 -1811
- package/dist/migrate-LHFWCO6M.js +16 -0
- package/dist/runtime-O3PX562N.js +13 -0
- package/dist/sql-JEBAPGJP.js +11 -0
- package/package.json +6 -2
- package/profiles/attio/attioCompanies.json +5 -3
- package/profiles/attio/attioPeople.json +5 -4
- package/skills/one/SKILL.md +83 -10
- package/skills/one/references/relay.md +15 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
error,
|
|
3
|
+
isAgentMode,
|
|
4
|
+
json,
|
|
5
|
+
requireMemoryInit
|
|
6
|
+
} from "./chunk-MRGKKO54.js";
|
|
7
|
+
import {
|
|
8
|
+
getBackend
|
|
9
|
+
} from "./chunk-5TT27ORC.js";
|
|
10
|
+
|
|
11
|
+
// src/commands/mem/sql.ts
|
|
12
|
+
async function memSqlCommand(sql) {
|
|
13
|
+
requireMemoryInit();
|
|
14
|
+
const backend = await getBackend();
|
|
15
|
+
if (!backend.capabilities().rawSql || !backend.raw) {
|
|
16
|
+
error(
|
|
17
|
+
"This memory backend does not support raw SQL (capabilities.rawSql = false). Use `mem list` / `mem search` / `mem find-by-source` for high-level queries."
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const result = await backend.raw(sql);
|
|
22
|
+
if (isAgentMode()) {
|
|
23
|
+
json({
|
|
24
|
+
columns: result.columns,
|
|
25
|
+
rows: result.rows,
|
|
26
|
+
rowCount: result.rowCount
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (result.rows.length === 0) {
|
|
31
|
+
console.log("(0 rows)");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
console.log(JSON.stringify(result.rows, null, 2));
|
|
35
|
+
console.log(`
|
|
36
|
+
${result.rowCount} row(s)`);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
error(err instanceof Error ? err.message : String(err));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function syncSqlCommand(platformModel, sql) {
|
|
42
|
+
const [platform, model] = platformModel.split("/");
|
|
43
|
+
if (!platform || !model) {
|
|
44
|
+
error(`Usage: one sync sql <platform>/<model> "<SELECT ...>". Example: one sync sql attio/attioPeople "SELECT data->>'id' FROM mem_records WHERE type = 'attio/attioPeople'"`);
|
|
45
|
+
}
|
|
46
|
+
const type = `${platform}/${model}`;
|
|
47
|
+
if (!isAgentMode() && !sql.includes(`'${type}'`) && !sql.includes(`"${type}"`)) {
|
|
48
|
+
process.stderr.write(
|
|
49
|
+
` note: this query does not filter to type = '${type}'. Results span all types. Add \`WHERE type = '${type}'\` to scope.
|
|
50
|
+
`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
await memSqlCommand(sql);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
memSqlCommand,
|
|
58
|
+
syncSqlCommand
|
|
59
|
+
};
|