@expressive/sql 0.4.4 → 0.6.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 +54 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +9 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +80 -0
- package/dist/cli.js.map +1 -0
- package/dist/columns/Bool.d.ts +37 -0
- package/dist/columns/Bool.js +28 -0
- package/dist/columns/Bool.js.map +1 -0
- package/dist/columns/Num.d.ts +59 -0
- package/dist/columns/Num.js +42 -0
- package/dist/columns/Num.js.map +1 -0
- package/dist/columns/One.d.ts +25 -0
- package/dist/columns/One.js +15 -0
- package/dist/columns/One.js.map +1 -0
- package/dist/columns/Str.d.ts +36 -0
- package/dist/columns/Str.js +21 -0
- package/dist/columns/Str.js.map +1 -0
- package/dist/columns/Time.d.ts +52 -0
- package/dist/columns/Time.js +45 -0
- package/dist/columns/Time.js.map +1 -0
- package/dist/connection/Connection.d.ts +61 -0
- package/dist/connection/Connection.js +104 -0
- package/dist/connection/Connection.js.map +1 -0
- package/dist/connection/Generator.d.ts +68 -0
- package/dist/connection/Generator.js +242 -0
- package/dist/connection/Generator.js.map +1 -0
- package/dist/datatypes.d.ts +102 -0
- package/dist/datatypes.js +47 -0
- package/dist/datatypes.js.map +1 -0
- package/dist/dispatch.d.ts +6 -0
- package/dist/dispatch.js +44 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/index.d.ts +12 -692
- package/dist/index.js +13 -1092
- package/dist/sqlite/SQLiteConnection.d.ts +83 -0
- package/dist/sqlite/SQLiteConnection.js +395 -0
- package/dist/sqlite/SQLiteConnection.js.map +1 -0
- package/dist/sqlite/SQLiteGenerator.d.ts +15 -0
- package/dist/sqlite/SQLiteGenerator.js +54 -0
- package/dist/sqlite/SQLiteGenerator.js.map +1 -0
- package/dist/sqlite/engine.d.ts +47 -0
- package/dist/sqlite/engine.js +104 -0
- package/dist/sqlite/engine.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +8 -0
- package/dist/utils.js.map +1 -0
- package/package.json +64 -11
- package/skills/expressive-sql/SKILL.md +136 -0
- package/dist/index.d.mts +0 -692
- package/dist/index.mjs +0 -1052
package/dist/dispatch.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
|
|
5
|
+
//#region src/dispatch.ts
|
|
6
|
+
function scopes(cwd) {
|
|
7
|
+
const found = [];
|
|
8
|
+
for (let dir = cwd;; dir = dirname(dir)) {
|
|
9
|
+
const scope = join(dir, "node_modules", "@expressive");
|
|
10
|
+
if (existsSync(scope)) found.push(scope);
|
|
11
|
+
if (dirname(dir) == dir) return found;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function manifest(dir) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).expressive;
|
|
17
|
+
} catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function commands(cwd) {
|
|
22
|
+
const found = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const scope of scopes(cwd)) for (const name of readdirSync(scope)) {
|
|
24
|
+
const bin = manifest(join(scope, name))?.bin;
|
|
25
|
+
if (bin && !found.has(name)) found.set(name, join(scope, name, bin));
|
|
26
|
+
}
|
|
27
|
+
return found;
|
|
28
|
+
}
|
|
29
|
+
async function dispatch(args, cwd, out) {
|
|
30
|
+
const [name, ...rest] = args;
|
|
31
|
+
const available = commands(cwd);
|
|
32
|
+
const bin = name && available.get(name);
|
|
33
|
+
if (!bin) {
|
|
34
|
+
const list = Array.from(available.keys()).join(", ") || "none installed";
|
|
35
|
+
out.error(`${name ? `No expressive command "${name}".` : "Usage: expressive <command> ..."} Available: ${list}.`);
|
|
36
|
+
return 2;
|
|
37
|
+
}
|
|
38
|
+
const { default: run } = await import(pathToFileURL(bin).href);
|
|
39
|
+
return run(rest, out);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
export { dispatch };
|
|
44
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","names":[],"sources":["../src/dispatch.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\ntype Output = Pick<Console, \"log\" | \"error\">;\n\ntype Command = (args: string[], out: Output) => Promise<number>;\n\nfunction scopes(cwd: string){\n const found: string[] = [];\n\n for (let dir = cwd; ; dir = dirname(dir)) {\n const scope = join(dir, \"node_modules\", \"@expressive\");\n\n if (existsSync(scope))\n found.push(scope);\n\n if (dirname(dir) == dir)\n return found;\n }\n}\n\nfunction manifest(dir: string): { bin?: string } | undefined {\n try {\n return JSON.parse(readFileSync(join(dir, \"package.json\"), \"utf8\")).expressive;\n }\n catch {\n return;\n }\n}\n\nfunction commands(cwd: string){\n const found = new Map<string, string>();\n\n for (const scope of scopes(cwd))\n for (const name of readdirSync(scope)) {\n const bin = manifest(join(scope, name))?.bin;\n\n if (bin && !found.has(name))\n found.set(name, join(scope, name, bin));\n }\n\n return found;\n}\n\nexport async function dispatch(args: string[], cwd: string, out: Output): Promise<number> {\n const [name, ...rest] = args;\n const available = commands(cwd);\n const bin = name && available.get(name);\n\n if (!bin) {\n const list = Array.from(available.keys()).join(\", \") || \"none installed\";\n\n out.error(`${name ? `No expressive command \"${name}\".` : \"Usage: expressive <command> ...\"} Available: ${list}.`);\n return 2;\n }\n\n const { default: run } = await import(pathToFileURL(bin).href) as { default: Command };\n\n return run(rest, out);\n}\n"],"mappings":";;;;;AAQA,SAAS,OAAO,KAAY;CAC1B,MAAM,QAAkB,EAAE;AAE1B,MAAK,IAAI,MAAM,MAAO,MAAM,QAAQ,IAAI,EAAE;EACxC,MAAM,QAAQ,KAAK,KAAK,gBAAgB,cAAc;AAEtD,MAAI,WAAW,MAAM,CACnB,OAAM,KAAK,MAAM;AAEnB,MAAI,QAAQ,IAAI,IAAI,IAClB,QAAO;;;AAIb,SAAS,SAAS,KAA2C;AAC3D,KAAI;AACF,SAAO,KAAK,MAAM,aAAa,KAAK,KAAK,eAAe,EAAE,OAAO,CAAC,CAAC;SAE/D;AACJ;;;AAIJ,SAAS,SAAS,KAAY;CAC5B,MAAM,wBAAQ,IAAI,KAAqB;AAEvC,MAAK,MAAM,SAAS,OAAO,IAAI,CAC7B,MAAK,MAAM,QAAQ,YAAY,MAAM,EAAE;EACrC,MAAM,MAAM,SAAS,KAAK,OAAO,KAAK,CAAC,EAAE;AAEzC,MAAI,OAAO,CAAC,MAAM,IAAI,KAAK,CACzB,OAAM,IAAI,MAAM,KAAK,OAAO,MAAM,IAAI,CAAC;;AAG7C,QAAO;;AAGT,eAAsB,SAAS,MAAgB,KAAa,KAA8B;CACxF,MAAM,CAAC,MAAM,GAAG,QAAQ;CACxB,MAAM,YAAY,SAAS,IAAI;CAC/B,MAAM,MAAM,QAAQ,UAAU,IAAI,KAAK;AAEvC,KAAI,CAAC,KAAK;EACR,MAAM,OAAO,MAAM,KAAK,UAAU,MAAM,CAAC,CAAC,KAAK,KAAK,IAAI;AAExD,MAAI,MAAM,GAAG,OAAO,0BAA0B,KAAK,MAAM,kCAAkC,cAAc,KAAK,GAAG;AACjH,SAAO;;CAGT,MAAM,EAAE,SAAS,QAAQ,MAAM,OAAO,cAAc,IAAI,CAAC;AAEzD,QAAO,IAAI,MAAM,IAAI"}
|