@powerhousedao/clint 6.2.3-dev.56 → 6.2.3-dev.57
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/dist/{build-skills-CZ9W1mzT.mjs → build-skills-C1Vr_kQh.mjs} +2 -2
- package/dist/{build-skills-CZ9W1mzT.mjs.map → build-skills-C1Vr_kQh.mjs.map} +1 -1
- package/dist/{dist-Bkncsczn.mjs → dist-CUltriBW.mjs} +3 -3
- package/dist/dist-CUltriBW.mjs.map +1 -0
- package/dist/{esm-QcrYJquX.mjs → esm-C1DOsF1a.mjs} +2 -2
- package/dist/{esm-QcrYJquX.mjs.map → esm-C1DOsF1a.mjs.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{reactor-BoCnlaAa.mjs → reactor-C9VIUX1H.mjs} +3 -3
- package/dist/{reactor-BoCnlaAa.mjs.map → reactor-C9VIUX1H.mjs.map} +1 -1
- package/dist/runners/mastra-runner.mjs +1 -1
- package/dist/{src-BlXB-Yec.mjs → src-DRDGtXYJ.mjs} +3 -3
- package/dist/{src-BlXB-Yec.mjs.map → src-DRDGtXYJ.mjs.map} +1 -1
- package/package.json +16 -10
- package/dist/dist-Bkncsczn.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as renderSkillTemplate } from "./src-
|
|
1
|
+
import { E as renderSkillTemplate } from "./src-DRDGtXYJ.mjs";
|
|
2
2
|
import { C as slugToTitle } from "./services-BvLvP5Qh.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -290,4 +290,4 @@ async function buildSkills(options) {
|
|
|
290
290
|
//#endregion
|
|
291
291
|
export { buildSkills };
|
|
292
292
|
|
|
293
|
-
//# sourceMappingURL=build-skills-
|
|
293
|
+
//# sourceMappingURL=build-skills-C1Vr_kQh.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-skills-CZ9W1mzT.mjs","names":[],"sources":["../src/dev/agent-profiles.ts","../src/dev/skill-builder.ts","../src/dev/skill-copier.ts","../src/dev/build-skills.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing file across multiple include directories.\n */\nfunction findInIncludes(\n includes: string[],\n subdir: string,\n filename: string,\n): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir, filename);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build agent profile instructions by rendering base+specialized template pairs.\n * Writes each profile as a Markdown file in {output}/agents/{ProfileName}.md.\n *\n * @returns Number of profiles built and any warnings.\n */\nexport function buildAgentProfiles(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const profiles = config.agentProfiles;\n if (profiles.length === 0) return { count: 0, warnings: [] };\n\n const profilesSubdir = config.subdirs?.profiles ?? \"agent-profiles\";\n\n log(\"\\n--- Building agent instructions ---\");\n\n const allWarnings: string[] = [];\n let count = 0;\n\n for (const profile of profiles) {\n // Check all section files exist before rendering\n const sectionPaths: string[] = [];\n let missing = false;\n for (const section of profile.sections) {\n const found = findInIncludes(config.include, profilesSubdir, section);\n if (!found) {\n log(` SKIP ${profile.name}: missing section ${section}`);\n missing = true;\n break;\n }\n sectionPaths.push(found);\n }\n if (missing) continue;\n\n const agentContext = { ...config.context, agentName: profile.name };\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n\n const renderedSections: string[] = [];\n for (let i = 0; i < profile.sections.length; i++) {\n const raw = fs.readFileSync(sectionPaths[i], \"utf-8\");\n const result = renderSkillTemplate(raw, agentContext, renderOpts);\n for (const w of result.warnings) {\n const msg = `${profile.name}/${profile.sections[i]}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n renderedSections.push(result.rendered.trim());\n }\n\n const combined = renderedSections.join(\"\\n\\n\") + \"\\n\";\n for (const out of config.output) {\n const agentsDir = path.join(out, \"agent-profiles\");\n fs.mkdirSync(agentsDir, { recursive: true });\n fs.writeFileSync(\n path.join(agentsDir, `${profile.name}.md`),\n combined,\n \"utf-8\",\n );\n }\n\n log(` OK ${profile.name} → ${profile.name}.md (${combined.length} chars)`);\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate, slugToTitle } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing directory across multiple include paths.\n */\nfunction findSubdir(includes: string[], subdir: string): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build SKILL.md files from Handlebars templates in skills-tpl/.\n * Each skill directory produces a SKILL.md + references/ folder.\n *\n * @returns Number of skills built and any warnings.\n */\nexport function buildSkillTemplates(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const skillsTplSubdir = config.subdirs?.skillsTpl ?? \"skills-tpl\";\n const skillsTplDir = findSubdir(config.include, skillsTplSubdir);\n\n log(\"\\n--- Building SKILL.md files (templates) ---\");\n\n if (!skillsTplDir) {\n log(\" No skills-tpl/ directory — skipping.\");\n return { count: 0, warnings: [] };\n }\n\n const skillDirs = fs\n .readdirSync(skillsTplDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n const allWarnings: string[] = [];\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n let count = 0;\n\n for (const skillName of skillDirs) {\n const skillDir = path.join(skillsTplDir, skillName);\n\n // Preamble\n const preamblePath = path.join(skillDir, \".preamble.md\");\n const preambleRaw = fs.existsSync(preamblePath)\n ? fs.readFileSync(preamblePath, \"utf-8\").trim()\n : \"\";\n let preamble = \"\";\n if (preambleRaw) {\n const r = renderSkillTemplate(preambleRaw, config.context, renderOpts);\n preamble = r.rendered;\n for (const w of r.warnings) {\n const msg = `${skillName}/.preamble.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n }\n\n // Scenario files (NN.name.md)\n const scenarioFiles = fs\n .readdirSync(skillDir)\n .filter((f) => /^\\d+\\..*\\.md$/.test(f))\n .sort();\n\n // Result file\n const resultPath = path.join(skillDir, \".result.md\");\n const hasResult = fs.existsSync(resultPath);\n\n if (!preamble && scenarioFiles.length === 0 && !hasResult) {\n log(` SKIP ${skillName}: no content files found`);\n continue;\n }\n\n // Render references into memory\n const files: Map<string, string> = new Map();\n const refLinks: string[] = [];\n\n for (const scenarioFile of scenarioFiles) {\n const content = fs\n .readFileSync(path.join(skillDir, scenarioFile), \"utf-8\")\n .trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/${scenarioFile}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(path.join(\"references\", scenarioFile), r.rendered + \"\\n\");\n const label = slugToTitle(\n scenarioFile.replace(/^\\d+\\./, \"\").replace(/\\.md$/, \"\"),\n );\n refLinks.push(\n `* **${label}** [references/${scenarioFile}](references/${scenarioFile})`,\n );\n }\n\n if (hasResult) {\n const content = fs.readFileSync(resultPath, \"utf-8\").trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.result.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\n path.join(\"references\", \"expected-outcome.md\"),\n r.rendered + \"\\n\",\n );\n refLinks.push(\n `* **Expected Outcome** [references/expected-outcome.md](references/expected-outcome.md)`,\n );\n }\n\n // Build SKILL.md\n const description =\n config.skillDescriptions[skillName] ?? `${slugToTitle(skillName)} tasks`;\n\n const frontmatter = [\n \"---\",\n `name: ${skillName}`,\n `description: \"${description}\"`,\n \"metadata:\",\n \" author: Powerhouse\",\n ' version: \"1.0.0\"',\n \"---\",\n ].join(\"\\n\");\n\n const sections = [preamble];\n if (refLinks.length > 0) {\n sections.push(\"## Specific tasks\\n\\n\" + refLinks.join(\"\\n\"));\n }\n\n const skillMd =\n frontmatter + \"\\n\\n\" + sections.filter(Boolean).join(\"\\n\\n\") + \"\\n\";\n files.set(\"SKILL.md\", skillMd);\n\n // Copy .cli-docs.md if present (render through Handlebars)\n const cliDocsPath = path.join(skillDir, \".cli-docs.md\");\n if (fs.existsSync(cliDocsPath)) {\n const cliDocsRaw = fs.readFileSync(cliDocsPath, \"utf-8\").trim();\n if (cliDocsRaw) {\n const r = renderSkillTemplate(cliDocsRaw, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.cli-docs.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\".cli-docs.md\", r.rendered + \"\\n\");\n }\n }\n\n // Write to all output directories\n for (const out of config.output) {\n const outputDir = path.join(out, \"skills\", skillName);\n for (const [relPath, content] of files) {\n const fullPath = path.join(outputDir, relPath);\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n }\n\n log(\n ` OK ${skillName} → SKILL.md + ${scenarioFiles.length + (hasResult ? 1 : 0)} references (${skillMd.length} chars)`,\n );\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Copy external skills from skills-ext/ to the output directory without processing.\n *\n * @returns Number of skills copied.\n */\nexport function copyExternalSkills(config: ResolvedBuildConfig): number {\n const log = config.logger;\n const skillsExtSubdir = config.subdirs?.skillsExt ?? \"skills-ext\";\n\n log(\"\\n--- Copying external skills ---\");\n\n // Search all include dirs for skills-ext/\n let found = false;\n let total = 0;\n\n for (const dir of config.include) {\n const skillsExtDir = path.join(dir, skillsExtSubdir);\n if (!fs.existsSync(skillsExtDir)) continue;\n found = true;\n\n const skillDirs = fs\n .readdirSync(skillsExtDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n for (const skillName of skillDirs) {\n const srcDir = path.join(skillsExtDir, skillName);\n for (const out of config.output) {\n fs.cpSync(srcDir, path.join(out, \"skills\", skillName), {\n recursive: true,\n });\n }\n log(` OK ${skillName} → copied as-is`);\n }\n\n total += skillDirs.length;\n }\n\n if (!found) {\n log(\" No skills-ext/ directory — skipping.\");\n }\n\n return total;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { buildAgentProfiles } from \"./agent-profiles.js\";\nimport { buildSkillTemplates } from \"./skill-builder.js\";\nimport { copyExternalSkills } from \"./skill-copier.js\";\nimport type { AgentProfile, ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Path-driven skill/profile compilation (ph-clint-dev's pipeline, decoupled\n * from the old BuildConfig.cli metadata coupling). Conventions:\n *\n * <skillsDir>/ include root (default: prompts/ then agents/)\n * agent-profiles/ profile section templates\n * skills-tpl/<skill>/ Handlebars skill templates → SKILL.md\n * skills-ext/<skill>/ external skills copied as-is\n * profiles.json optional [{ name, sections: [...] }]\n *\n * Output: <outDir> (default: dist/skills).\n */\nexport interface BuildSkillsOptions {\n rootDir: string;\n skillsDir?: string;\n agentsDir?: string;\n outDir?: string;\n context?: Record<string, unknown>;\n logger?: (msg: string) => void;\n}\n\nexport interface BuildSkillsResult {\n skills: number;\n profiles: number;\n copied: number;\n warnings: string[];\n outDir: string;\n}\n\nfunction firstExisting(\n rootDir: string,\n candidates: (string | undefined)[],\n): string[] {\n const dirs: string[] = [];\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(rootDir, candidate);\n if (fs.existsSync(abs)) dirs.push(abs);\n }\n return dirs;\n}\n\nfunction readProfilesManifest(include: string[]): AgentProfile[] {\n for (const dir of include) {\n const manifest = path.join(dir, \"profiles.json\");\n if (fs.existsSync(manifest)) {\n try {\n return JSON.parse(fs.readFileSync(manifest, \"utf8\")) as AgentProfile[];\n } catch {\n return [];\n }\n }\n }\n return [];\n}\n\nexport async function buildSkills(\n options: BuildSkillsOptions,\n): Promise<BuildSkillsResult> {\n const log = options.logger ?? console.log;\n const include = firstExisting(options.rootDir, [\n options.skillsDir,\n options.agentsDir,\n \"prompts\",\n \"agents\",\n ]);\n const outDir = path.resolve(options.rootDir, options.outDir ?? \"dist/skills\");\n\n if (include.length === 0) {\n log(\n \"No prompt template directories found (prompts/ or agents/) — nothing to build.\",\n );\n return { skills: 0, profiles: 0, copied: 0, warnings: [], outDir };\n }\n\n const resolved: ResolvedBuildConfig = {\n include,\n output: [outDir],\n context: { builtAt: new Date().toISOString(), ...options.context },\n agentProfiles: readProfilesManifest(include),\n skillDescriptions: {},\n clean: true,\n logger: log,\n };\n\n for (const dir of resolved.output) {\n if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true });\n }\n\n const profiles = buildAgentProfiles(resolved);\n const templates = buildSkillTemplates(resolved);\n const copied = copyExternalSkills(resolved);\n\n return {\n skills: templates.count,\n profiles: profiles.count,\n copied,\n warnings: [...profiles.warnings, ...templates.warnings],\n outDir,\n };\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,eACP,UACA,QACA,UACoB;CACpB,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,IAAI,KAAK,KAAK,KAAK,QAAQ,QAAQ;EACzC,IAAI,GAAG,WAAW,CAAC,GAAG,OAAO;CAC/B;AAEF;;;;;;;AAQA,SAAgB,mBAAmB,QAGjC;CACA,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,OAAO;CACxB,IAAI,SAAS,WAAW,GAAG,OAAO;EAAE,OAAO;EAAG,UAAU,CAAC;CAAE;CAE3D,MAAM,iBAAiB,OAAO,SAAS,YAAY;CAEnD,IAAI,uCAAuC;CAE3C,MAAM,cAAwB,CAAC;CAC/B,IAAI,QAAQ;CAEZ,KAAK,MAAM,WAAW,UAAU;EAE9B,MAAM,eAAyB,CAAC;EAChC,IAAI,UAAU;E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UAAU,aAAa;CAE5E,IAAI,QAAQ,WAAW,GAAG;EACxB,IACE,gFACF;EACA,OAAO;GAAE,QAAQ;GAAG,UAAU;GAAG,QAAQ;GAAG,UAAU,CAAC;GAAG;EAAO;CACnE;CAEA,MAAM,WAAgC;EACpC;EACA,QAAQ,CAAC,MAAM;EACf,SAAS;GAAE,0BAAS,IAAI,KAAK,EAAA,CAAE,YAAY;GAAG,GAAG,QAAQ;EAAQ;EACjE,eAAe,qBAAqB,OAAO;EAC3C,mBAAmB,CAAC;EACpB,OAAO;EACP,QAAQ;CACV;CAEA,KAAK,MAAM,OAAO,SAAS,QACzB,IAAI,GAAG,WAAW,GAAG,GAAG,GAAG,OAAO,KAAK,EAAE,WAAW,KAAK,CAAC;CAG5D,MAAM,WAAW,mBAAmB,QAAQ;CAC5C,MAAM,YAAY,oBAAoB,QAAQ;CAC9C,MAAM,SAAS,mBAAmB,QAAQ;CAE1C,OAAO;EACL,QAAQ,UAAU;EAClB,UAAU,SAAS;EACnB;EACA,UAAU,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,QAAQ;EACtD;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"build-skills-C1Vr_kQh.mjs","names":[],"sources":["../src/dev/agent-profiles.ts","../src/dev/skill-builder.ts","../src/dev/skill-copier.ts","../src/dev/build-skills.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing file across multiple include directories.\n */\nfunction findInIncludes(\n includes: string[],\n subdir: string,\n filename: string,\n): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir, filename);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build agent profile instructions by rendering base+specialized template pairs.\n * Writes each profile as a Markdown file in {output}/agents/{ProfileName}.md.\n *\n * @returns Number of profiles built and any warnings.\n */\nexport function buildAgentProfiles(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const profiles = config.agentProfiles;\n if (profiles.length === 0) return { count: 0, warnings: [] };\n\n const profilesSubdir = config.subdirs?.profiles ?? \"agent-profiles\";\n\n log(\"\\n--- Building agent instructions ---\");\n\n const allWarnings: string[] = [];\n let count = 0;\n\n for (const profile of profiles) {\n // Check all section files exist before rendering\n const sectionPaths: string[] = [];\n let missing = false;\n for (const section of profile.sections) {\n const found = findInIncludes(config.include, profilesSubdir, section);\n if (!found) {\n log(` SKIP ${profile.name}: missing section ${section}`);\n missing = true;\n break;\n }\n sectionPaths.push(found);\n }\n if (missing) continue;\n\n const agentContext = { ...config.context, agentName: profile.name };\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n\n const renderedSections: string[] = [];\n for (let i = 0; i < profile.sections.length; i++) {\n const raw = fs.readFileSync(sectionPaths[i], \"utf-8\");\n const result = renderSkillTemplate(raw, agentContext, renderOpts);\n for (const w of result.warnings) {\n const msg = `${profile.name}/${profile.sections[i]}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n renderedSections.push(result.rendered.trim());\n }\n\n const combined = renderedSections.join(\"\\n\\n\") + \"\\n\";\n for (const out of config.output) {\n const agentsDir = path.join(out, \"agent-profiles\");\n fs.mkdirSync(agentsDir, { recursive: true });\n fs.writeFileSync(\n path.join(agentsDir, `${profile.name}.md`),\n combined,\n \"utf-8\",\n );\n }\n\n log(` OK ${profile.name} → ${profile.name}.md (${combined.length} chars)`);\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate, slugToTitle } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing directory across multiple include paths.\n */\nfunction findSubdir(includes: string[], subdir: string): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build SKILL.md files from Handlebars templates in skills-tpl/.\n * Each skill directory produces a SKILL.md + references/ folder.\n *\n * @returns Number of skills built and any warnings.\n */\nexport function buildSkillTemplates(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const skillsTplSubdir = config.subdirs?.skillsTpl ?? \"skills-tpl\";\n const skillsTplDir = findSubdir(config.include, skillsTplSubdir);\n\n log(\"\\n--- Building SKILL.md files (templates) ---\");\n\n if (!skillsTplDir) {\n log(\" No skills-tpl/ directory — skipping.\");\n return { count: 0, warnings: [] };\n }\n\n const skillDirs = fs\n .readdirSync(skillsTplDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n const allWarnings: string[] = [];\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n let count = 0;\n\n for (const skillName of skillDirs) {\n const skillDir = path.join(skillsTplDir, skillName);\n\n // Preamble\n const preamblePath = path.join(skillDir, \".preamble.md\");\n const preambleRaw = fs.existsSync(preamblePath)\n ? fs.readFileSync(preamblePath, \"utf-8\").trim()\n : \"\";\n let preamble = \"\";\n if (preambleRaw) {\n const r = renderSkillTemplate(preambleRaw, config.context, renderOpts);\n preamble = r.rendered;\n for (const w of r.warnings) {\n const msg = `${skillName}/.preamble.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n }\n\n // Scenario files (NN.name.md)\n const scenarioFiles = fs\n .readdirSync(skillDir)\n .filter((f) => /^\\d+\\..*\\.md$/.test(f))\n .sort();\n\n // Result file\n const resultPath = path.join(skillDir, \".result.md\");\n const hasResult = fs.existsSync(resultPath);\n\n if (!preamble && scenarioFiles.length === 0 && !hasResult) {\n log(` SKIP ${skillName}: no content files found`);\n continue;\n }\n\n // Render references into memory\n const files: Map<string, string> = new Map();\n const refLinks: string[] = [];\n\n for (const scenarioFile of scenarioFiles) {\n const content = fs\n .readFileSync(path.join(skillDir, scenarioFile), \"utf-8\")\n .trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/${scenarioFile}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(path.join(\"references\", scenarioFile), r.rendered + \"\\n\");\n const label = slugToTitle(\n scenarioFile.replace(/^\\d+\\./, \"\").replace(/\\.md$/, \"\"),\n );\n refLinks.push(\n `* **${label}** [references/${scenarioFile}](references/${scenarioFile})`,\n );\n }\n\n if (hasResult) {\n const content = fs.readFileSync(resultPath, \"utf-8\").trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.result.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\n path.join(\"references\", \"expected-outcome.md\"),\n r.rendered + \"\\n\",\n );\n refLinks.push(\n `* **Expected Outcome** [references/expected-outcome.md](references/expected-outcome.md)`,\n );\n }\n\n // Build SKILL.md\n const description =\n config.skillDescriptions[skillName] ?? `${slugToTitle(skillName)} tasks`;\n\n const frontmatter = [\n \"---\",\n `name: ${skillName}`,\n `description: \"${description}\"`,\n \"metadata:\",\n \" author: Powerhouse\",\n ' version: \"1.0.0\"',\n \"---\",\n ].join(\"\\n\");\n\n const sections = [preamble];\n if (refLinks.length > 0) {\n sections.push(\"## Specific tasks\\n\\n\" + refLinks.join(\"\\n\"));\n }\n\n const skillMd =\n frontmatter + \"\\n\\n\" + sections.filter(Boolean).join(\"\\n\\n\") + \"\\n\";\n files.set(\"SKILL.md\", skillMd);\n\n // Copy .cli-docs.md if present (render through Handlebars)\n const cliDocsPath = path.join(skillDir, \".cli-docs.md\");\n if (fs.existsSync(cliDocsPath)) {\n const cliDocsRaw = fs.readFileSync(cliDocsPath, \"utf-8\").trim();\n if (cliDocsRaw) {\n const r = renderSkillTemplate(cliDocsRaw, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.cli-docs.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\".cli-docs.md\", r.rendered + \"\\n\");\n }\n }\n\n // Write to all output directories\n for (const out of config.output) {\n const outputDir = path.join(out, \"skills\", skillName);\n for (const [relPath, content] of files) {\n const fullPath = path.join(outputDir, relPath);\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n }\n\n log(\n ` OK ${skillName} → SKILL.md + ${scenarioFiles.length + (hasResult ? 1 : 0)} references (${skillMd.length} chars)`,\n );\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Copy external skills from skills-ext/ to the output directory without processing.\n *\n * @returns Number of skills copied.\n */\nexport function copyExternalSkills(config: ResolvedBuildConfig): number {\n const log = config.logger;\n const skillsExtSubdir = config.subdirs?.skillsExt ?? \"skills-ext\";\n\n log(\"\\n--- Copying external skills ---\");\n\n // Search all include dirs for skills-ext/\n let found = false;\n let total = 0;\n\n for (const dir of config.include) {\n const skillsExtDir = path.join(dir, skillsExtSubdir);\n if (!fs.existsSync(skillsExtDir)) continue;\n found = true;\n\n const skillDirs = fs\n .readdirSync(skillsExtDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n for (const skillName of skillDirs) {\n const srcDir = path.join(skillsExtDir, skillName);\n for (const out of config.output) {\n fs.cpSync(srcDir, path.join(out, \"skills\", skillName), {\n recursive: true,\n });\n }\n log(` OK ${skillName} → copied as-is`);\n }\n\n total += skillDirs.length;\n }\n\n if (!found) {\n log(\" No skills-ext/ directory — skipping.\");\n }\n\n return total;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { buildAgentProfiles } from \"./agent-profiles.js\";\nimport { buildSkillTemplates } from \"./skill-builder.js\";\nimport { copyExternalSkills } from \"./skill-copier.js\";\nimport type { AgentProfile, ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Path-driven skill/profile compilation (ph-clint-dev's pipeline, decoupled\n * from the old BuildConfig.cli metadata coupling). Conventions:\n *\n * <skillsDir>/ include root (default: prompts/ then agents/)\n * agent-profiles/ profile section templates\n * skills-tpl/<skill>/ Handlebars skill templates → SKILL.md\n * skills-ext/<skill>/ external skills copied as-is\n * profiles.json optional [{ name, sections: [...] }]\n *\n * Output: <outDir> (default: dist/skills).\n */\nexport interface BuildSkillsOptions {\n rootDir: string;\n skillsDir?: string;\n agentsDir?: string;\n outDir?: string;\n context?: Record<string, unknown>;\n logger?: (msg: string) => void;\n}\n\nexport interface BuildSkillsResult {\n skills: number;\n profiles: number;\n copied: number;\n warnings: string[];\n outDir: string;\n}\n\nfunction firstExisting(\n rootDir: string,\n candidates: (string | undefined)[],\n): string[] {\n const dirs: string[] = [];\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(rootDir, candidate);\n if (fs.existsSync(abs)) dirs.push(abs);\n }\n return dirs;\n}\n\nfunction readProfilesManifest(include: string[]): AgentProfile[] {\n for (const dir of include) {\n const manifest = path.join(dir, \"profiles.json\");\n if (fs.existsSync(manifest)) {\n try {\n return JSON.parse(fs.readFileSync(manifest, \"utf8\")) as AgentProfile[];\n } catch {\n return [];\n }\n }\n }\n return [];\n}\n\nexport async function buildSkills(\n options: BuildSkillsOptions,\n): Promise<BuildSkillsResult> {\n const log = options.logger ?? console.log;\n const include = firstExisting(options.rootDir, [\n options.skillsDir,\n options.agentsDir,\n \"prompts\",\n \"agents\",\n ]);\n const outDir = path.resolve(options.rootDir, options.outDir ?? \"dist/skills\");\n\n if (include.length === 0) {\n log(\n \"No prompt template directories found (prompts/ or agents/) — nothing to build.\",\n );\n return { skills: 0, profiles: 0, copied: 0, warnings: [], outDir };\n }\n\n const resolved: ResolvedBuildConfig = {\n include,\n output: [outDir],\n context: { builtAt: new Date().toISOString(), ...options.context },\n agentProfiles: readProfilesManifest(include),\n skillDescriptions: {},\n clean: true,\n logger: log,\n };\n\n for (const dir of resolved.output) {\n if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true });\n }\n\n const profiles = buildAgentProfiles(resolved);\n const templates = buildSkillTemplates(resolved);\n const copied = copyExternalSkills(resolved);\n\n return {\n skills: templates.count,\n profiles: profiles.count,\n copied,\n warnings: [...profiles.warnings, ...templates.warnings],\n outDir,\n };\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,eACP,UACA,QACA,UACoB;CACpB,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,IAAI,KAAK,KAAK,KAAK,QAAQ,QAAQ;EACzC,IAAI,GAAG,WAAW,CAAC,GAAG,OAAO;CAC/B;AAEF;;;;;;;AAQA,SAAgB,mBAAmB,QAGjC;CACA,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,OAAO;CACxB,IAAI,SAAS,WAAW,GAAG,OAAO;EAAE,OAAO;EAAG,UAAU,CAAC;CAAE;CAE3D,MAAM,iBAAiB,OAAO,SAAS,YAAY;CAEnD,IAAI,uCAAuC;CAE3C,MAAM,cAAwB,CAAC;CAC/B,IAAI,QAAQ;CAEZ,KAAK,MAAM,WAAW,UAAU;EAE9B,MAAM,eAAyB,CAAC;EAChC,IAAI,UAAU;EACd,KAAK,MAAM,WAAW,QAAQ,UAAU;GACtC,MAAM,QAAQ,eAAe,OAAO,SAAS,gBAAgB,OAAO;GACpE,IAAI,CAAC,OAAO;IACV,IAAI,UAAU,QAAQ,KAAK,oBAAoB,SAAS;IACxD,UAAU;IACV;GACF;GACA,aAAa,KAAK,KAAK;EACzB;EACA,IAAI,SAAS;EAEb,MAAM,eAAe;GAAE,GAAG,OAAO;GAAS,WAAW,QAAQ;EAAK;EAClE,MAAM,aAAa,OAAO,gBACtB,EAAE,SAAS,OAAO,cAAc,IAChC,KAAA;EAEJ,MAAM,mBAA6B,CAAC;EACpC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,SAAS,QAAQ,KAAK;GAChD,MAAM,MAAM,GAAG,aAAa,aAAa,IAAI,OAAO;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QAAQ;CAC5C,MAAM,YAAY,oBAAoB,QAAQ;CAC9C,MAAM,SAAS,mBAAmB,QAAQ;CAE1C,OAAO;EACL,QAAQ,UAAU;EAClB,UAAU,SAAS;EACnB;EACA,UAAU,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,QAAQ;EACtD;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as isDate, E as isString, S as isBoolean, T as isNumber, _ as AliasNode, a as NOOP_QUERY_EXECUTOR, b as freeze, c as InsertQueryNode, d as ValueNode, f as parseStringReference, g as isOperationNodeSource, h as OperatorNode, i as SetOperationNode, l as ParensNode, m as RawNode, n as CreateViewNode, o as createQueryId, p as logOnce, r as parseTable, s as WhenNode, u as parseValueExpression, v as CreateTableNode, w as isNull, x as isBigInt, y as IdentifierNode } from "./esm-
|
|
1
|
+
import { C as isDate, E as isString, S as isBoolean, T as isNumber, _ as AliasNode, a as NOOP_QUERY_EXECUTOR, b as freeze, c as InsertQueryNode, d as ValueNode, f as parseStringReference, g as isOperationNodeSource, h as OperatorNode, i as SetOperationNode, l as ParensNode, m as RawNode, n as CreateViewNode, o as createQueryId, p as logOnce, r as parseTable, s as WhenNode, u as parseValueExpression, v as CreateTableNode, w as isNull, x as isBigInt, y as IdentifierNode } from "./esm-C1DOsF1a.mjs";
|
|
2
2
|
//#region ../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/raw-builder/raw-builder.js
|
|
3
3
|
var RawBuilderImpl = class RawBuilderImpl {
|
|
4
4
|
#props;
|
|
@@ -1542,7 +1542,7 @@ var PostgresAdapter = class extends DialectAdapterBase {
|
|
|
1542
1542
|
async releaseMigrationLock(_db, _opt) {}
|
|
1543
1543
|
};
|
|
1544
1544
|
//#endregion
|
|
1545
|
-
//#region ../../node_modules/.pnpm/kysely-pglite-dialect@1.2.
|
|
1545
|
+
//#region ../../node_modules/.pnpm/kysely-pglite-dialect@1.2.0_@electric-sql+pglite@0.3.15_kysely@0.28.16/node_modules/kysely-pglite-dialect/dist/index.mjs
|
|
1546
1546
|
var PGliteConnection = class {
|
|
1547
1547
|
client;
|
|
1548
1548
|
constructor(client) {
|
|
@@ -1625,4 +1625,4 @@ var PGliteDriver = class {
|
|
|
1625
1625
|
//#endregion
|
|
1626
1626
|
export { PGliteDialect, DEFAULT_MIGRATION_TABLE as a, DefaultQueryCompiler as c, createRawBuilder as d, DEFAULT_MIGRATION_LOCK_TABLE as i, OperationNodeVisitor as l, PostgresIntrospector as n, DialectAdapterBase as o, PostgresQueryCompiler as r, CompiledQuery as s, PostgresAdapter as t, sql as u };
|
|
1627
1627
|
|
|
1628
|
-
//# sourceMappingURL=dist-
|
|
1628
|
+
//# sourceMappingURL=dist-CUltriBW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-CUltriBW.mjs","names":[],"sources":["../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/raw-builder/raw-builder.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/raw-builder/sql.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/operation-node/operation-node-visitor.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/query-compiler/compiled-query.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/migration/migrator.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/dialect/postgres/postgres-query-compiler.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.js","../../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.js","../../../node_modules/.pnpm/kysely-pglite-dialect@1.2.0_@electric-sql+pglite@0.3.15_kysely@0.28.16/node_modules/kysely-pglite-dialect/dist/index.mjs"],"sourcesContent":["/// <reference types=\"./raw-builder.d.ts\" />\nimport { AliasNode } from '../operation-node/alias-node.js';\nimport { freeze } from '../util/object-utils.js';\nimport { NOOP_QUERY_EXECUTOR } from '../query-executor/noop-query-executor.js';\nimport { IdentifierNode } from '../operation-node/identifier-node.js';\nimport { isOperationNodeSource } from '../operation-node/operation-node-source.js';\nclass RawBuilderImpl {\n #props;\n constructor(props) {\n this.#props = freeze(props);\n }\n get expressionType() {\n return undefined;\n }\n get isRawBuilder() {\n return true;\n }\n as(alias) {\n return new AliasedRawBuilderImpl(this, alias);\n }\n $castTo() {\n return new RawBuilderImpl({ ...this.#props });\n }\n $notNull() {\n return new RawBuilderImpl(this.#props);\n }\n withPlugin(plugin) {\n return new RawBuilderImpl({\n ...this.#props,\n plugins: this.#props.plugins !== undefined\n ? freeze([...this.#props.plugins, plugin])\n : freeze([plugin]),\n });\n }\n toOperationNode() {\n return this.#toOperationNode(this.#getExecutor());\n }\n compile(executorProvider) {\n return this.#compile(this.#getExecutor(executorProvider));\n }\n async execute(executorProvider) {\n const executor = this.#getExecutor(executorProvider);\n return executor.executeQuery(this.#compile(executor));\n }\n #getExecutor(executorProvider) {\n const executor = executorProvider !== undefined\n ? executorProvider.getExecutor()\n : NOOP_QUERY_EXECUTOR;\n return this.#props.plugins !== undefined\n ? executor.withPlugins(this.#props.plugins)\n : executor;\n }\n #toOperationNode(executor) {\n return executor.transformQuery(this.#props.rawNode, this.#props.queryId);\n }\n #compile(executor) {\n return executor.compileQuery(this.#toOperationNode(executor), this.#props.queryId);\n }\n}\nexport function createRawBuilder(props) {\n return new RawBuilderImpl(props);\n}\nclass AliasedRawBuilderImpl {\n #rawBuilder;\n #alias;\n constructor(rawBuilder, alias) {\n this.#rawBuilder = rawBuilder;\n this.#alias = alias;\n }\n get expression() {\n return this.#rawBuilder;\n }\n get alias() {\n return this.#alias;\n }\n get rawBuilder() {\n return this.#rawBuilder;\n }\n toOperationNode() {\n return AliasNode.create(this.#rawBuilder.toOperationNode(), isOperationNodeSource(this.#alias)\n ? this.#alias.toOperationNode()\n : IdentifierNode.create(this.#alias));\n }\n}\n","/// <reference types=\"./sql.d.ts\" />\nimport { IdentifierNode } from '../operation-node/identifier-node.js';\nimport { isOperationNodeSource } from '../operation-node/operation-node-source.js';\nimport { RawNode } from '../operation-node/raw-node.js';\nimport { ValueNode } from '../operation-node/value-node.js';\nimport { parseStringReference } from '../parser/reference-parser.js';\nimport { parseTable } from '../parser/table-parser.js';\nimport { parseValueExpression } from '../parser/value-parser.js';\nimport { createQueryId } from '../util/query-id.js';\nimport { createRawBuilder } from './raw-builder.js';\nexport const sql = Object.assign((sqlFragments, ...parameters) => {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.create(sqlFragments, parameters?.map(parseParameter) ?? []),\n });\n}, {\n ref(columnReference) {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithChild(parseStringReference(columnReference)),\n });\n },\n val(value) {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithChild(parseValueExpression(value)),\n });\n },\n value(value) {\n return this.val(value);\n },\n table(tableReference) {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithChild(parseTable(tableReference)),\n });\n },\n id(...ids) {\n const fragments = new Array(ids.length + 1).fill('.');\n fragments[0] = '';\n fragments[fragments.length - 1] = '';\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.create(fragments, ids.map(IdentifierNode.create)),\n });\n },\n lit(value) {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithChild(ValueNode.createImmediate(value)),\n });\n },\n literal(value) {\n return this.lit(value);\n },\n raw(sql) {\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithSql(sql),\n });\n },\n join(array, separator = sql `, `) {\n const nodes = new Array(Math.max(2 * array.length - 1, 0));\n const sep = separator.toOperationNode();\n for (let i = 0; i < array.length; ++i) {\n nodes[2 * i] = parseParameter(array[i]);\n if (i !== array.length - 1) {\n nodes[2 * i + 1] = sep;\n }\n }\n return createRawBuilder({\n queryId: createQueryId(),\n rawNode: RawNode.createWithChildren(nodes),\n });\n },\n});\nfunction parseParameter(param) {\n if (isOperationNodeSource(param)) {\n return param.toOperationNode();\n }\n return parseValueExpression(param);\n}\n","/// <reference types=\"./operation-node-visitor.d.ts\" />\nimport { freeze } from '../util/object-utils.js';\nexport class OperationNodeVisitor {\n nodeStack = [];\n get parentNode() {\n return this.nodeStack[this.nodeStack.length - 2];\n }\n #visitors = freeze({\n AliasNode: this.visitAlias.bind(this),\n ColumnNode: this.visitColumn.bind(this),\n IdentifierNode: this.visitIdentifier.bind(this),\n SchemableIdentifierNode: this.visitSchemableIdentifier.bind(this),\n RawNode: this.visitRaw.bind(this),\n ReferenceNode: this.visitReference.bind(this),\n SelectQueryNode: this.visitSelectQuery.bind(this),\n SelectionNode: this.visitSelection.bind(this),\n TableNode: this.visitTable.bind(this),\n FromNode: this.visitFrom.bind(this),\n SelectAllNode: this.visitSelectAll.bind(this),\n AndNode: this.visitAnd.bind(this),\n OrNode: this.visitOr.bind(this),\n ValueNode: this.visitValue.bind(this),\n ValueListNode: this.visitValueList.bind(this),\n PrimitiveValueListNode: this.visitPrimitiveValueList.bind(this),\n ParensNode: this.visitParens.bind(this),\n JoinNode: this.visitJoin.bind(this),\n OperatorNode: this.visitOperator.bind(this),\n WhereNode: this.visitWhere.bind(this),\n InsertQueryNode: this.visitInsertQuery.bind(this),\n DeleteQueryNode: this.visitDeleteQuery.bind(this),\n ReturningNode: this.visitReturning.bind(this),\n CreateTableNode: this.visitCreateTable.bind(this),\n AddColumnNode: this.visitAddColumn.bind(this),\n ColumnDefinitionNode: this.visitColumnDefinition.bind(this),\n DropTableNode: this.visitDropTable.bind(this),\n DataTypeNode: this.visitDataType.bind(this),\n OrderByNode: this.visitOrderBy.bind(this),\n OrderByItemNode: this.visitOrderByItem.bind(this),\n GroupByNode: this.visitGroupBy.bind(this),\n GroupByItemNode: this.visitGroupByItem.bind(this),\n UpdateQueryNode: this.visitUpdateQuery.bind(this),\n ColumnUpdateNode: this.visitColumnUpdate.bind(this),\n LimitNode: this.visitLimit.bind(this),\n OffsetNode: this.visitOffset.bind(this),\n OnConflictNode: this.visitOnConflict.bind(this),\n OnDuplicateKeyNode: this.visitOnDuplicateKey.bind(this),\n CreateIndexNode: this.visitCreateIndex.bind(this),\n DropIndexNode: this.visitDropIndex.bind(this),\n ListNode: this.visitList.bind(this),\n PrimaryKeyConstraintNode: this.visitPrimaryKeyConstraint.bind(this),\n UniqueConstraintNode: this.visitUniqueConstraint.bind(this),\n ReferencesNode: this.visitReferences.bind(this),\n CheckConstraintNode: this.visitCheckConstraint.bind(this),\n WithNode: this.visitWith.bind(this),\n CommonTableExpressionNode: this.visitCommonTableExpression.bind(this),\n CommonTableExpressionNameNode: this.visitCommonTableExpressionName.bind(this),\n HavingNode: this.visitHaving.bind(this),\n CreateSchemaNode: this.visitCreateSchema.bind(this),\n DropSchemaNode: this.visitDropSchema.bind(this),\n AlterTableNode: this.visitAlterTable.bind(this),\n DropColumnNode: this.visitDropColumn.bind(this),\n RenameColumnNode: this.visitRenameColumn.bind(this),\n AlterColumnNode: this.visitAlterColumn.bind(this),\n ModifyColumnNode: this.visitModifyColumn.bind(this),\n AddConstraintNode: this.visitAddConstraint.bind(this),\n DropConstraintNode: this.visitDropConstraint.bind(this),\n RenameConstraintNode: this.visitRenameConstraint.bind(this),\n ForeignKeyConstraintNode: this.visitForeignKeyConstraint.bind(this),\n CreateViewNode: this.visitCreateView.bind(this),\n RefreshMaterializedViewNode: this.visitRefreshMaterializedView.bind(this),\n DropViewNode: this.visitDropView.bind(this),\n GeneratedNode: this.visitGenerated.bind(this),\n DefaultValueNode: this.visitDefaultValue.bind(this),\n OnNode: this.visitOn.bind(this),\n ValuesNode: this.visitValues.bind(this),\n SelectModifierNode: this.visitSelectModifier.bind(this),\n CreateTypeNode: this.visitCreateType.bind(this),\n DropTypeNode: this.visitDropType.bind(this),\n ExplainNode: this.visitExplain.bind(this),\n DefaultInsertValueNode: this.visitDefaultInsertValue.bind(this),\n AggregateFunctionNode: this.visitAggregateFunction.bind(this),\n OverNode: this.visitOver.bind(this),\n PartitionByNode: this.visitPartitionBy.bind(this),\n PartitionByItemNode: this.visitPartitionByItem.bind(this),\n SetOperationNode: this.visitSetOperation.bind(this),\n BinaryOperationNode: this.visitBinaryOperation.bind(this),\n UnaryOperationNode: this.visitUnaryOperation.bind(this),\n UsingNode: this.visitUsing.bind(this),\n FunctionNode: this.visitFunction.bind(this),\n CaseNode: this.visitCase.bind(this),\n WhenNode: this.visitWhen.bind(this),\n JSONReferenceNode: this.visitJSONReference.bind(this),\n JSONPathNode: this.visitJSONPath.bind(this),\n JSONPathLegNode: this.visitJSONPathLeg.bind(this),\n JSONOperatorChainNode: this.visitJSONOperatorChain.bind(this),\n TupleNode: this.visitTuple.bind(this),\n MergeQueryNode: this.visitMergeQuery.bind(this),\n MatchedNode: this.visitMatched.bind(this),\n AddIndexNode: this.visitAddIndex.bind(this),\n CastNode: this.visitCast.bind(this),\n FetchNode: this.visitFetch.bind(this),\n TopNode: this.visitTop.bind(this),\n OutputNode: this.visitOutput.bind(this),\n OrActionNode: this.visitOrAction.bind(this),\n CollateNode: this.visitCollate.bind(this),\n });\n visitNode = (node) => {\n this.nodeStack.push(node);\n this.#visitors[node.kind](node);\n this.nodeStack.pop();\n };\n}\n","/// <reference types=\"./default-query-compiler.d.ts\" />\nimport { CreateTableNode } from '../operation-node/create-table-node.js';\nimport { InsertQueryNode } from '../operation-node/insert-query-node.js';\nimport { OperationNodeVisitor } from '../operation-node/operation-node-visitor.js';\nimport { OperatorNode } from '../operation-node/operator-node.js';\nimport { ParensNode } from '../operation-node/parens-node.js';\nimport { RawNode } from '../operation-node/raw-node.js';\nimport { freeze, isString, isNumber, isBoolean, isNull, isDate, isBigInt, } from '../util/object-utils.js';\nimport { CreateViewNode } from '../operation-node/create-view-node.js';\nimport { SetOperationNode } from '../operation-node/set-operation-node.js';\nimport { WhenNode } from '../operation-node/when-node.js';\nimport { logOnce } from '../util/log-once.js';\nconst LIT_WRAP_REGEX = /'/g;\nexport class DefaultQueryCompiler extends OperationNodeVisitor {\n #sql = '';\n #parameters = [];\n get numParameters() {\n return this.#parameters.length;\n }\n compileQuery(node, queryId) {\n this.#sql = '';\n this.#parameters = [];\n this.nodeStack.splice(0, this.nodeStack.length);\n this.visitNode(node);\n return freeze({\n query: node,\n queryId,\n sql: this.getSql(),\n parameters: [...this.#parameters],\n });\n }\n getSql() {\n return this.#sql;\n }\n visitSelectQuery(node) {\n const wrapInParens = this.parentNode !== undefined &&\n !ParensNode.is(this.parentNode) &&\n !InsertQueryNode.is(this.parentNode) &&\n !CreateTableNode.is(this.parentNode) &&\n !CreateViewNode.is(this.parentNode) &&\n !SetOperationNode.is(this.parentNode);\n if (this.parentNode === undefined && node.explain) {\n this.visitNode(node.explain);\n this.append(' ');\n }\n if (wrapInParens) {\n this.append('(');\n }\n if (node.with) {\n this.visitNode(node.with);\n this.append(' ');\n }\n this.append('select');\n if (node.distinctOn) {\n this.append(' ');\n this.compileDistinctOn(node.distinctOn);\n }\n if (node.frontModifiers?.length) {\n this.append(' ');\n this.compileList(node.frontModifiers, ' ');\n }\n if (node.top) {\n this.append(' ');\n this.visitNode(node.top);\n }\n if (node.selections) {\n this.append(' ');\n this.compileList(node.selections);\n }\n if (node.from) {\n this.append(' ');\n this.visitNode(node.from);\n }\n if (node.joins) {\n this.append(' ');\n this.compileList(node.joins, ' ');\n }\n if (node.where) {\n this.append(' ');\n this.visitNode(node.where);\n }\n if (node.groupBy) {\n this.append(' ');\n this.visitNode(node.groupBy);\n }\n if (node.having) {\n this.append(' ');\n this.visitNode(node.having);\n }\n if (node.setOperations) {\n this.append(' ');\n this.compileList(node.setOperations, ' ');\n }\n if (node.orderBy) {\n this.append(' ');\n this.visitNode(node.orderBy);\n }\n if (node.limit) {\n this.append(' ');\n this.visitNode(node.limit);\n }\n if (node.offset) {\n this.append(' ');\n this.visitNode(node.offset);\n }\n if (node.fetch) {\n this.append(' ');\n this.visitNode(node.fetch);\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(this.sortSelectModifiers([...node.endModifiers]), ' ');\n }\n if (wrapInParens) {\n this.append(')');\n }\n }\n visitFrom(node) {\n this.append('from ');\n this.compileList(node.froms);\n }\n visitSelection(node) {\n this.visitNode(node.selection);\n }\n visitColumn(node) {\n this.visitNode(node.column);\n }\n compileDistinctOn(expressions) {\n this.append('distinct on (');\n this.compileList(expressions);\n this.append(')');\n }\n compileList(nodes, separator = ', ') {\n const lastIndex = nodes.length - 1;\n for (let i = 0; i <= lastIndex; i++) {\n this.visitNode(nodes[i]);\n if (i < lastIndex) {\n this.append(separator);\n }\n }\n }\n visitWhere(node) {\n this.append('where ');\n this.visitNode(node.where);\n }\n visitHaving(node) {\n this.append('having ');\n this.visitNode(node.having);\n }\n visitInsertQuery(node) {\n const wrapInParens = this.parentNode !== undefined &&\n !ParensNode.is(this.parentNode) &&\n !RawNode.is(this.parentNode) &&\n !WhenNode.is(this.parentNode);\n if (this.parentNode === undefined && node.explain) {\n this.visitNode(node.explain);\n this.append(' ');\n }\n if (wrapInParens) {\n this.append('(');\n }\n if (node.with) {\n this.visitNode(node.with);\n this.append(' ');\n }\n this.append(node.replace ? 'replace' : 'insert');\n // TODO: remove in 0.29.\n if (node.ignore) {\n logOnce('`InsertQueryNode.ignore` is deprecated. Use `InsertQueryNode.orAction` instead.');\n this.append(' ignore');\n }\n if (node.orAction) {\n this.append(' ');\n this.visitNode(node.orAction);\n }\n if (node.top) {\n this.append(' ');\n this.visitNode(node.top);\n }\n if (node.into) {\n this.append(' into ');\n this.visitNode(node.into);\n }\n if (node.columns) {\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n }\n if (node.output) {\n this.append(' ');\n this.visitNode(node.output);\n }\n if (node.values) {\n this.append(' ');\n this.visitNode(node.values);\n }\n if (node.defaultValues) {\n this.append(' ');\n this.append('default values');\n }\n if (node.onConflict) {\n this.append(' ');\n this.visitNode(node.onConflict);\n }\n if (node.onDuplicateKey) {\n this.append(' ');\n this.visitNode(node.onDuplicateKey);\n }\n if (node.returning) {\n this.append(' ');\n this.visitNode(node.returning);\n }\n if (wrapInParens) {\n this.append(')');\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n }\n visitValues(node) {\n this.append('values ');\n this.compileList(node.values);\n }\n visitDeleteQuery(node) {\n const wrapInParens = this.parentNode !== undefined &&\n !ParensNode.is(this.parentNode) &&\n !RawNode.is(this.parentNode);\n if (this.parentNode === undefined && node.explain) {\n this.visitNode(node.explain);\n this.append(' ');\n }\n if (wrapInParens) {\n this.append('(');\n }\n if (node.with) {\n this.visitNode(node.with);\n this.append(' ');\n }\n this.append('delete ');\n if (node.top) {\n this.visitNode(node.top);\n this.append(' ');\n }\n this.visitNode(node.from);\n if (node.output) {\n this.append(' ');\n this.visitNode(node.output);\n }\n if (node.using) {\n this.append(' ');\n this.visitNode(node.using);\n }\n if (node.joins) {\n this.append(' ');\n this.compileList(node.joins, ' ');\n }\n if (node.where) {\n this.append(' ');\n this.visitNode(node.where);\n }\n if (node.orderBy) {\n this.append(' ');\n this.visitNode(node.orderBy);\n }\n if (node.limit) {\n this.append(' ');\n this.visitNode(node.limit);\n }\n if (node.returning) {\n this.append(' ');\n this.visitNode(node.returning);\n }\n if (wrapInParens) {\n this.append(')');\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n }\n visitReturning(node) {\n this.append('returning ');\n this.compileList(node.selections);\n }\n visitAlias(node) {\n this.visitNode(node.node);\n this.append(' as ');\n this.visitNode(node.alias);\n }\n visitReference(node) {\n if (node.table) {\n this.visitNode(node.table);\n this.append('.');\n }\n this.visitNode(node.column);\n }\n visitSelectAll(_) {\n this.append('*');\n }\n visitIdentifier(node) {\n this.append(this.getLeftIdentifierWrapper());\n this.compileUnwrappedIdentifier(node);\n this.append(this.getRightIdentifierWrapper());\n }\n compileUnwrappedIdentifier(node) {\n if (!isString(node.name)) {\n throw new Error('a non-string identifier was passed to compileUnwrappedIdentifier.');\n }\n this.append(this.sanitizeIdentifier(node.name));\n }\n visitAnd(node) {\n this.visitNode(node.left);\n this.append(' and ');\n this.visitNode(node.right);\n }\n visitOr(node) {\n this.visitNode(node.left);\n this.append(' or ');\n this.visitNode(node.right);\n }\n visitValue(node) {\n if (node.immediate) {\n this.appendImmediateValue(node.value);\n }\n else {\n this.appendValue(node.value);\n }\n }\n visitValueList(node) {\n this.append('(');\n this.compileList(node.values);\n this.append(')');\n }\n visitTuple(node) {\n this.append('(');\n this.compileList(node.values);\n this.append(')');\n }\n visitPrimitiveValueList(node) {\n this.append('(');\n const { values } = node;\n for (let i = 0; i < values.length; ++i) {\n this.appendValue(values[i]);\n if (i !== values.length - 1) {\n this.append(', ');\n }\n }\n this.append(')');\n }\n visitParens(node) {\n this.append('(');\n this.visitNode(node.node);\n this.append(')');\n }\n visitJoin(node) {\n this.append(JOIN_TYPE_SQL[node.joinType]);\n this.append(' ');\n this.visitNode(node.table);\n if (node.on) {\n this.append(' ');\n this.visitNode(node.on);\n }\n }\n visitOn(node) {\n this.append('on ');\n this.visitNode(node.on);\n }\n visitRaw(node) {\n const { sqlFragments, parameters: params } = node;\n for (let i = 0; i < sqlFragments.length; ++i) {\n this.append(sqlFragments[i]);\n if (params.length > i) {\n this.visitNode(params[i]);\n }\n }\n }\n visitOperator(node) {\n this.append(node.operator);\n }\n visitTable(node) {\n this.visitNode(node.table);\n }\n visitSchemableIdentifier(node) {\n if (node.schema) {\n this.visitNode(node.schema);\n this.append('.');\n }\n this.visitNode(node.identifier);\n }\n visitCreateTable(node) {\n this.append('create ');\n if (node.frontModifiers?.length) {\n this.compileList(node.frontModifiers, ' ');\n this.append(' ');\n }\n if (node.temporary) {\n this.append('temporary ');\n }\n this.append('table ');\n if (node.ifNotExists) {\n this.append('if not exists ');\n }\n this.visitNode(node.table);\n if (!node.selectQuery) {\n this.append(' (');\n this.compileList([...node.columns, ...(node.constraints ?? [])]);\n this.append(')');\n }\n if (node.onCommit) {\n this.append(' on commit ');\n this.append(node.onCommit);\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n if (node.selectQuery) {\n this.append(' as ');\n this.visitNode(node.selectQuery);\n }\n }\n visitColumnDefinition(node) {\n if (node.ifNotExists) {\n this.append('if not exists ');\n }\n this.visitNode(node.column);\n this.append(' ');\n this.visitNode(node.dataType);\n if (node.unsigned) {\n this.append(' unsigned');\n }\n if (node.frontModifiers && node.frontModifiers.length > 0) {\n this.append(' ');\n this.compileList(node.frontModifiers, ' ');\n }\n if (node.generated) {\n this.append(' ');\n this.visitNode(node.generated);\n }\n if (node.identity) {\n this.append(' identity');\n }\n if (node.defaultTo) {\n this.append(' ');\n this.visitNode(node.defaultTo);\n }\n if (node.notNull) {\n this.append(' not null');\n }\n if (node.unique) {\n this.append(' unique');\n }\n if (node.nullsNotDistinct) {\n this.append(' nulls not distinct');\n }\n if (node.primaryKey) {\n this.append(' primary key');\n }\n if (node.autoIncrement) {\n this.append(' ');\n this.append(this.getAutoIncrement());\n }\n if (node.references) {\n this.append(' ');\n this.visitNode(node.references);\n }\n if (node.check) {\n this.append(' ');\n this.visitNode(node.check);\n }\n if (node.endModifiers && node.endModifiers.length > 0) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n }\n getAutoIncrement() {\n return 'auto_increment';\n }\n visitReferences(node) {\n this.append('references ');\n this.visitNode(node.table);\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n if (node.onDelete) {\n this.append(' on delete ');\n this.append(node.onDelete);\n }\n if (node.onUpdate) {\n this.append(' on update ');\n this.append(node.onUpdate);\n }\n }\n visitDropTable(node) {\n this.append('drop table ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.table);\n if (node.cascade) {\n this.append(' cascade');\n }\n }\n visitDataType(node) {\n this.append(node.dataType);\n }\n visitOrderBy(node) {\n this.append('order by ');\n this.compileList(node.items);\n }\n visitOrderByItem(node) {\n this.visitNode(node.orderBy);\n if (node.collation) {\n this.append(' ');\n this.visitNode(node.collation);\n }\n if (node.direction) {\n this.append(' ');\n this.visitNode(node.direction);\n }\n if (node.nulls) {\n this.append(' nulls ');\n this.append(node.nulls);\n }\n }\n visitGroupBy(node) {\n this.append('group by ');\n this.compileList(node.items);\n }\n visitGroupByItem(node) {\n this.visitNode(node.groupBy);\n }\n visitUpdateQuery(node) {\n const wrapInParens = this.parentNode !== undefined &&\n !ParensNode.is(this.parentNode) &&\n !RawNode.is(this.parentNode) &&\n !WhenNode.is(this.parentNode);\n if (this.parentNode === undefined && node.explain) {\n this.visitNode(node.explain);\n this.append(' ');\n }\n if (wrapInParens) {\n this.append('(');\n }\n if (node.with) {\n this.visitNode(node.with);\n this.append(' ');\n }\n this.append('update ');\n if (node.top) {\n this.visitNode(node.top);\n this.append(' ');\n }\n if (node.table) {\n this.visitNode(node.table);\n this.append(' ');\n }\n this.append('set ');\n if (node.updates) {\n this.compileList(node.updates);\n }\n if (node.output) {\n this.append(' ');\n this.visitNode(node.output);\n }\n if (node.from) {\n this.append(' ');\n this.visitNode(node.from);\n }\n if (node.joins) {\n if (!node.from) {\n throw new Error(\"Joins in an update query are only supported as a part of a PostgreSQL 'update set from join' query. If you want to create a MySQL 'update join set' query, see https://kysely.dev/docs/examples/update/my-sql-joins\");\n }\n this.append(' ');\n this.compileList(node.joins, ' ');\n }\n if (node.where) {\n this.append(' ');\n this.visitNode(node.where);\n }\n if (node.returning) {\n this.append(' ');\n this.visitNode(node.returning);\n }\n if (node.orderBy) {\n this.append(' ');\n this.visitNode(node.orderBy);\n }\n if (node.limit) {\n this.append(' ');\n this.visitNode(node.limit);\n }\n if (wrapInParens) {\n this.append(')');\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n }\n visitColumnUpdate(node) {\n this.visitNode(node.column);\n this.append(' = ');\n this.visitNode(node.value);\n }\n visitLimit(node) {\n this.append('limit ');\n this.visitNode(node.limit);\n }\n visitOffset(node) {\n this.append('offset ');\n this.visitNode(node.offset);\n }\n visitOnConflict(node) {\n this.append('on conflict');\n if (node.columns) {\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n }\n else if (node.constraint) {\n this.append(' on constraint ');\n this.visitNode(node.constraint);\n }\n else if (node.indexExpression) {\n this.append(' (');\n this.visitNode(node.indexExpression);\n this.append(')');\n }\n if (node.indexWhere) {\n this.append(' ');\n this.visitNode(node.indexWhere);\n }\n if (node.doNothing === true) {\n this.append(' do nothing');\n }\n else if (node.updates) {\n this.append(' do update set ');\n this.compileList(node.updates);\n if (node.updateWhere) {\n this.append(' ');\n this.visitNode(node.updateWhere);\n }\n }\n }\n visitOnDuplicateKey(node) {\n this.append('on duplicate key update ');\n this.compileList(node.updates);\n }\n visitCreateIndex(node) {\n this.append('create ');\n if (node.unique) {\n this.append('unique ');\n }\n this.append('index ');\n if (node.ifNotExists) {\n this.append('if not exists ');\n }\n this.visitNode(node.name);\n if (node.table) {\n this.append(' on ');\n this.visitNode(node.table);\n }\n if (node.using) {\n this.append(' using ');\n this.visitNode(node.using);\n }\n if (node.columns) {\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n }\n if (node.nullsNotDistinct) {\n this.append(' nulls not distinct');\n }\n if (node.where) {\n this.append(' ');\n this.visitNode(node.where);\n }\n }\n visitDropIndex(node) {\n this.append('drop index ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.name);\n if (node.table) {\n this.append(' on ');\n this.visitNode(node.table);\n }\n if (node.cascade) {\n this.append(' cascade');\n }\n }\n visitCreateSchema(node) {\n this.append('create schema ');\n if (node.ifNotExists) {\n this.append('if not exists ');\n }\n this.visitNode(node.schema);\n }\n visitDropSchema(node) {\n this.append('drop schema ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.schema);\n if (node.cascade) {\n this.append(' cascade');\n }\n }\n visitPrimaryKeyConstraint(node) {\n if (node.name) {\n this.append('constraint ');\n this.visitNode(node.name);\n this.append(' ');\n }\n this.append('primary key (');\n this.compileList(node.columns);\n this.append(')');\n this.buildDeferrable(node);\n }\n buildDeferrable(node) {\n if (node.deferrable !== undefined) {\n if (node.deferrable) {\n this.append(' deferrable');\n }\n else {\n this.append(' not deferrable');\n }\n }\n if (node.initiallyDeferred !== undefined) {\n if (node.initiallyDeferred) {\n this.append(' initially deferred');\n }\n else {\n this.append(' initially immediate');\n }\n }\n }\n visitUniqueConstraint(node) {\n if (node.name) {\n this.append('constraint ');\n this.visitNode(node.name);\n this.append(' ');\n }\n this.append('unique');\n if (node.nullsNotDistinct) {\n this.append(' nulls not distinct');\n }\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n this.buildDeferrable(node);\n }\n visitCheckConstraint(node) {\n if (node.name) {\n this.append('constraint ');\n this.visitNode(node.name);\n this.append(' ');\n }\n this.append('check (');\n this.visitNode(node.expression);\n this.append(')');\n }\n visitForeignKeyConstraint(node) {\n if (node.name) {\n this.append('constraint ');\n this.visitNode(node.name);\n this.append(' ');\n }\n this.append('foreign key (');\n this.compileList(node.columns);\n this.append(') ');\n this.visitNode(node.references);\n if (node.onDelete) {\n this.append(' on delete ');\n this.append(node.onDelete);\n }\n if (node.onUpdate) {\n this.append(' on update ');\n this.append(node.onUpdate);\n }\n this.buildDeferrable(node);\n }\n visitList(node) {\n this.compileList(node.items);\n }\n visitWith(node) {\n this.append('with ');\n if (node.recursive) {\n this.append('recursive ');\n }\n this.compileList(node.expressions);\n }\n visitCommonTableExpression(node) {\n this.visitNode(node.name);\n this.append(' as ');\n if (isBoolean(node.materialized)) {\n if (!node.materialized) {\n this.append('not ');\n }\n this.append('materialized ');\n }\n this.visitNode(node.expression);\n }\n visitCommonTableExpressionName(node) {\n this.visitNode(node.table);\n if (node.columns) {\n this.append('(');\n this.compileList(node.columns);\n this.append(')');\n }\n }\n visitAlterTable(node) {\n this.append('alter table ');\n this.visitNode(node.table);\n this.append(' ');\n if (node.renameTo) {\n this.append('rename to ');\n this.visitNode(node.renameTo);\n }\n if (node.setSchema) {\n this.append('set schema ');\n this.visitNode(node.setSchema);\n }\n if (node.addConstraint) {\n this.visitNode(node.addConstraint);\n }\n if (node.dropConstraint) {\n this.visitNode(node.dropConstraint);\n }\n if (node.renameConstraint) {\n this.visitNode(node.renameConstraint);\n }\n if (node.columnAlterations) {\n this.compileColumnAlterations(node.columnAlterations);\n }\n if (node.addIndex) {\n this.visitNode(node.addIndex);\n }\n if (node.dropIndex) {\n this.visitNode(node.dropIndex);\n }\n }\n visitAddColumn(node) {\n this.append('add column ');\n this.visitNode(node.column);\n }\n visitRenameColumn(node) {\n this.append('rename column ');\n this.visitNode(node.column);\n this.append(' to ');\n this.visitNode(node.renameTo);\n }\n visitDropColumn(node) {\n this.append('drop column ');\n this.visitNode(node.column);\n }\n visitAlterColumn(node) {\n this.append('alter column ');\n this.visitNode(node.column);\n this.append(' ');\n if (node.dataType) {\n if (this.announcesNewColumnDataType()) {\n this.append('type ');\n }\n this.visitNode(node.dataType);\n if (node.dataTypeExpression) {\n this.append('using ');\n this.visitNode(node.dataTypeExpression);\n }\n }\n if (node.setDefault) {\n this.append('set default ');\n this.visitNode(node.setDefault);\n }\n if (node.dropDefault) {\n this.append('drop default');\n }\n if (node.setNotNull) {\n this.append('set not null');\n }\n if (node.dropNotNull) {\n this.append('drop not null');\n }\n }\n visitModifyColumn(node) {\n this.append('modify column ');\n this.visitNode(node.column);\n }\n visitAddConstraint(node) {\n this.append('add ');\n this.visitNode(node.constraint);\n }\n visitDropConstraint(node) {\n this.append('drop constraint ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.constraintName);\n if (node.modifier === 'cascade') {\n this.append(' cascade');\n }\n else if (node.modifier === 'restrict') {\n this.append(' restrict');\n }\n }\n visitRenameConstraint(node) {\n this.append('rename constraint ');\n this.visitNode(node.oldName);\n this.append(' to ');\n this.visitNode(node.newName);\n }\n visitSetOperation(node) {\n this.append(node.operator);\n this.append(' ');\n if (node.all) {\n this.append('all ');\n }\n this.visitNode(node.expression);\n }\n visitCreateView(node) {\n this.append('create ');\n if (node.orReplace) {\n this.append('or replace ');\n }\n if (node.materialized) {\n this.append('materialized ');\n }\n if (node.temporary) {\n this.append('temporary ');\n }\n this.append('view ');\n if (node.ifNotExists) {\n this.append('if not exists ');\n }\n this.visitNode(node.name);\n this.append(' ');\n if (node.columns) {\n this.append('(');\n this.compileList(node.columns);\n this.append(') ');\n }\n if (node.as) {\n this.append('as ');\n this.visitNode(node.as);\n }\n }\n visitRefreshMaterializedView(node) {\n this.append('refresh materialized view ');\n if (node.concurrently) {\n this.append('concurrently ');\n }\n this.visitNode(node.name);\n if (node.withNoData) {\n this.append(' with no data');\n }\n else {\n this.append(' with data');\n }\n }\n visitDropView(node) {\n this.append('drop ');\n if (node.materialized) {\n this.append('materialized ');\n }\n this.append('view ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.name);\n if (node.cascade) {\n this.append(' cascade');\n }\n }\n visitGenerated(node) {\n this.append('generated ');\n if (node.always) {\n this.append('always ');\n }\n if (node.byDefault) {\n this.append('by default ');\n }\n this.append('as ');\n if (node.identity) {\n this.append('identity');\n }\n if (node.expression) {\n this.append('(');\n this.visitNode(node.expression);\n this.append(')');\n }\n if (node.stored) {\n this.append(' stored');\n }\n }\n visitDefaultValue(node) {\n this.append('default ');\n this.visitNode(node.defaultValue);\n }\n visitSelectModifier(node) {\n if (node.rawModifier) {\n this.visitNode(node.rawModifier);\n }\n else {\n this.append(SELECT_MODIFIER_SQL[node.modifier]);\n }\n if (node.of) {\n this.append(' of ');\n this.compileList(node.of, ', ');\n }\n }\n visitCreateType(node) {\n this.append('create type ');\n this.visitNode(node.name);\n if (node.enum) {\n this.append(' as enum ');\n this.visitNode(node.enum);\n }\n }\n visitDropType(node) {\n this.append('drop type ');\n if (node.ifExists) {\n this.append('if exists ');\n }\n this.visitNode(node.name);\n }\n visitExplain(node) {\n this.append('explain');\n if (node.options || node.format) {\n this.append(' ');\n this.append(this.getLeftExplainOptionsWrapper());\n if (node.options) {\n this.visitNode(node.options);\n if (node.format) {\n this.append(this.getExplainOptionsDelimiter());\n }\n }\n if (node.format) {\n this.append('format');\n this.append(this.getExplainOptionAssignment());\n this.append(node.format);\n }\n this.append(this.getRightExplainOptionsWrapper());\n }\n }\n visitDefaultInsertValue(_) {\n this.append('default');\n }\n visitAggregateFunction(node) {\n this.append(node.func);\n this.append('(');\n if (node.distinct) {\n this.append('distinct ');\n }\n this.compileList(node.aggregated);\n if (node.orderBy) {\n this.append(' ');\n this.visitNode(node.orderBy);\n }\n this.append(')');\n if (node.withinGroup) {\n this.append(' within group (');\n this.visitNode(node.withinGroup);\n this.append(')');\n }\n if (node.filter) {\n this.append(' filter(');\n this.visitNode(node.filter);\n this.append(')');\n }\n if (node.over) {\n this.append(' ');\n this.visitNode(node.over);\n }\n }\n visitOver(node) {\n this.append('over(');\n if (node.partitionBy) {\n this.visitNode(node.partitionBy);\n if (node.orderBy) {\n this.append(' ');\n }\n }\n if (node.orderBy) {\n this.visitNode(node.orderBy);\n }\n this.append(')');\n }\n visitPartitionBy(node) {\n this.append('partition by ');\n this.compileList(node.items);\n }\n visitPartitionByItem(node) {\n this.visitNode(node.partitionBy);\n }\n visitBinaryOperation(node) {\n this.visitNode(node.leftOperand);\n this.append(' ');\n this.visitNode(node.operator);\n this.append(' ');\n this.visitNode(node.rightOperand);\n }\n visitUnaryOperation(node) {\n this.visitNode(node.operator);\n if (!this.isMinusOperator(node.operator)) {\n this.append(' ');\n }\n this.visitNode(node.operand);\n }\n isMinusOperator(node) {\n return OperatorNode.is(node) && node.operator === '-';\n }\n visitUsing(node) {\n this.append('using ');\n this.compileList(node.tables);\n }\n visitFunction(node) {\n this.append(node.func);\n this.append('(');\n this.compileList(node.arguments);\n this.append(')');\n }\n visitCase(node) {\n this.append('case');\n if (node.value) {\n this.append(' ');\n this.visitNode(node.value);\n }\n if (node.when) {\n this.append(' ');\n this.compileList(node.when, ' ');\n }\n if (node.else) {\n this.append(' else ');\n this.visitNode(node.else);\n }\n this.append(' end');\n if (node.isStatement) {\n this.append(' case');\n }\n }\n visitWhen(node) {\n this.append('when ');\n this.visitNode(node.condition);\n if (node.result) {\n this.append(' then ');\n this.visitNode(node.result);\n }\n }\n visitJSONReference(node) {\n this.visitNode(node.reference);\n this.visitNode(node.traversal);\n }\n visitJSONPath(node) {\n if (node.inOperator) {\n this.visitNode(node.inOperator);\n }\n this.append(\"'$\");\n for (const pathLeg of node.pathLegs) {\n this.visitNode(pathLeg);\n }\n this.append(\"'\");\n }\n visitJSONPathLeg(node) {\n const isArrayLocation = node.type === 'ArrayLocation';\n this.append(isArrayLocation ? '[' : '.');\n this.append(typeof node.value === 'string'\n ? this.sanitizeStringLiteral(node.value)\n : String(node.value));\n if (isArrayLocation) {\n this.append(']');\n }\n }\n visitJSONOperatorChain(node) {\n for (let i = 0, len = node.values.length; i < len; i++) {\n if (i === len - 1) {\n this.visitNode(node.operator);\n }\n else {\n this.append('->');\n }\n this.visitNode(node.values[i]);\n }\n }\n visitMergeQuery(node) {\n if (node.with) {\n this.visitNode(node.with);\n this.append(' ');\n }\n this.append('merge ');\n if (node.top) {\n this.visitNode(node.top);\n this.append(' ');\n }\n this.append('into ');\n this.visitNode(node.into);\n if (node.using) {\n this.append(' ');\n this.visitNode(node.using);\n }\n if (node.whens) {\n this.append(' ');\n this.compileList(node.whens, ' ');\n }\n if (node.returning) {\n this.append(' ');\n this.visitNode(node.returning);\n }\n if (node.output) {\n this.append(' ');\n this.visitNode(node.output);\n }\n if (node.endModifiers?.length) {\n this.append(' ');\n this.compileList(node.endModifiers, ' ');\n }\n }\n visitMatched(node) {\n if (node.not) {\n this.append('not ');\n }\n this.append('matched');\n if (node.bySource) {\n this.append(' by source');\n }\n }\n visitAddIndex(node) {\n this.append('add ');\n if (node.unique) {\n this.append('unique ');\n }\n this.append('index ');\n this.visitNode(node.name);\n if (node.columns) {\n this.append(' (');\n this.compileList(node.columns);\n this.append(')');\n }\n if (node.using) {\n this.append(' using ');\n this.visitNode(node.using);\n }\n }\n visitCast(node) {\n this.append('cast(');\n this.visitNode(node.expression);\n this.append(' as ');\n this.visitNode(node.dataType);\n this.append(')');\n }\n visitFetch(node) {\n this.append('fetch next ');\n this.visitNode(node.rowCount);\n this.append(` rows ${node.modifier}`);\n }\n visitOutput(node) {\n this.append('output ');\n this.compileList(node.selections);\n }\n visitTop(node) {\n this.append(`top(${node.expression})`);\n if (node.modifiers) {\n this.append(` ${node.modifiers}`);\n }\n }\n visitOrAction(node) {\n this.append(node.action);\n }\n visitCollate(node) {\n this.append('collate ');\n this.visitNode(node.collation);\n }\n append(str) {\n this.#sql += str;\n }\n appendValue(parameter) {\n this.addParameter(parameter);\n this.append(this.getCurrentParameterPlaceholder());\n }\n getLeftIdentifierWrapper() {\n return '\"';\n }\n getRightIdentifierWrapper() {\n return '\"';\n }\n getCurrentParameterPlaceholder() {\n return '$' + this.numParameters;\n }\n getLeftExplainOptionsWrapper() {\n return '(';\n }\n getExplainOptionAssignment() {\n return ' ';\n }\n getExplainOptionsDelimiter() {\n return ', ';\n }\n getRightExplainOptionsWrapper() {\n return ')';\n }\n sanitizeIdentifier(identifier) {\n const leftWrap = this.getLeftIdentifierWrapper();\n const rightWrap = this.getRightIdentifierWrapper();\n let sanitized = '';\n for (const c of identifier) {\n sanitized += c;\n if (c === leftWrap) {\n sanitized += leftWrap;\n }\n else if (c === rightWrap) {\n sanitized += rightWrap;\n }\n }\n return sanitized;\n }\n sanitizeStringLiteral(value) {\n return value.replace(LIT_WRAP_REGEX, \"''\");\n }\n addParameter(parameter) {\n this.#parameters.push(parameter);\n }\n appendImmediateValue(value) {\n if (isString(value)) {\n this.appendStringLiteral(value);\n }\n else if (isNumber(value) || isBoolean(value) || isBigInt(value)) {\n this.append(value.toString());\n }\n else if (isNull(value)) {\n this.append('null');\n }\n else if (isDate(value)) {\n this.appendImmediateValue(value.toISOString());\n }\n else {\n throw new Error(`invalid immediate value ${value}`);\n }\n }\n appendStringLiteral(value) {\n this.append(\"'\");\n this.append(this.sanitizeStringLiteral(value));\n this.append(\"'\");\n }\n sortSelectModifiers(arr) {\n arr.sort((left, right) => left.modifier && right.modifier\n ? SELECT_MODIFIER_PRIORITY[left.modifier] -\n SELECT_MODIFIER_PRIORITY[right.modifier]\n : 1);\n return freeze(arr);\n }\n compileColumnAlterations(columnAlterations) {\n this.compileList(columnAlterations);\n }\n /**\n * controls whether the dialect adds a \"type\" keyword before a column's new data\n * type in an ALTER TABLE statement.\n */\n announcesNewColumnDataType() {\n return true;\n }\n}\nconst SELECT_MODIFIER_SQL = freeze({\n ForKeyShare: 'for key share',\n ForNoKeyUpdate: 'for no key update',\n ForUpdate: 'for update',\n ForShare: 'for share',\n NoWait: 'nowait',\n SkipLocked: 'skip locked',\n Distinct: 'distinct',\n});\nconst SELECT_MODIFIER_PRIORITY = freeze({\n ForKeyShare: 1,\n ForNoKeyUpdate: 1,\n ForUpdate: 1,\n ForShare: 1,\n NoWait: 2,\n SkipLocked: 2,\n Distinct: 0,\n});\nconst JOIN_TYPE_SQL = freeze({\n InnerJoin: 'inner join',\n LeftJoin: 'left join',\n RightJoin: 'right join',\n FullJoin: 'full join',\n CrossJoin: 'cross join',\n LateralInnerJoin: 'inner join lateral',\n LateralLeftJoin: 'left join lateral',\n LateralCrossJoin: 'cross join lateral',\n OuterApply: 'outer apply',\n CrossApply: 'cross apply',\n Using: 'using',\n});\n","/// <reference types=\"./compiled-query.d.ts\" />\nimport { RawNode } from '../operation-node/raw-node.js';\nimport { freeze } from '../util/object-utils.js';\nimport { createQueryId } from '../util/query-id.js';\nexport const CompiledQuery = freeze({\n raw(sql, parameters = []) {\n return freeze({\n sql,\n query: RawNode.createWithSql(sql),\n parameters: freeze(parameters),\n queryId: createQueryId(),\n });\n },\n});\n","/// <reference types=\"./dialect-adapter-base.d.ts\" />\n/**\n * A basic implementation of `DialectAdapter` with sensible default values.\n * Third-party dialects can extend this instead of implementing the `DialectAdapter`\n * interface from scratch. That way all new settings will get default values when\n * they are added and there will be less breaking changes.\n */\nexport class DialectAdapterBase {\n get supportsCreateIfNotExists() {\n return true;\n }\n get supportsTransactionalDdl() {\n return false;\n }\n get supportsReturning() {\n return false;\n }\n get supportsOutput() {\n return false;\n }\n}\n","/// <reference types=\"./migrator.d.ts\" />\nimport { NoopPlugin } from '../plugin/noop-plugin.js';\nimport { WithSchemaPlugin } from '../plugin/with-schema/with-schema-plugin.js';\nimport { freeze, getLast, isObject } from '../util/object-utils.js';\nexport const DEFAULT_MIGRATION_TABLE = 'kysely_migration';\nexport const DEFAULT_MIGRATION_LOCK_TABLE = 'kysely_migration_lock';\nexport const DEFAULT_ALLOW_UNORDERED_MIGRATIONS = false;\nexport const MIGRATION_LOCK_ID = 'migration_lock';\nexport const NO_MIGRATIONS = freeze({ __noMigrations__: true });\n/**\n * A class for running migrations.\n *\n * ### Example\n *\n * This example uses the {@link FileMigrationProvider} that reads migrations\n * files from a single folder. You can easily implement your own\n * {@link MigrationProvider} if you want to provide migrations some\n * other way.\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import * as Sqlite from 'better-sqlite3'\n * import {\n * FileMigrationProvider,\n * Kysely,\n * Migrator,\n * SqliteDialect\n * } from 'kysely'\n *\n * const db = new Kysely<any>({\n * dialect: new SqliteDialect({\n * database: Sqlite(':memory:')\n * })\n * })\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * // Path to the folder that contains all your migrations.\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n * ```\n */\nexport class Migrator {\n #props;\n constructor(props) {\n this.#props = freeze(props);\n }\n /**\n * Returns a {@link MigrationInfo} object for each migration.\n *\n * The returned array is sorted by migration name.\n */\n async getMigrations() {\n const tableExists = await this.#doesTableExist(this.#migrationTable);\n const executedMigrations = tableExists\n ? await this.#props.db\n .withPlugin(this.#schemaPlugin)\n .selectFrom(this.#migrationTable)\n .select(['name', 'timestamp'])\n .$narrowType()\n .execute()\n : [];\n const migrations = await this.#resolveMigrations();\n return migrations.map(({ name, ...migration }) => {\n const executed = executedMigrations.find((it) => it.name === name);\n return {\n name,\n migration,\n executedAt: executed ? new Date(executed.timestamp) : undefined,\n };\n });\n }\n /**\n * Runs all migrations that have not yet been run.\n *\n * This method returns a {@link MigrationResultSet} instance and _never_ throws.\n * {@link MigrationResultSet.error} holds the error if something went wrong.\n * {@link MigrationResultSet.results} contains information about which migrations\n * were executed and which failed. See the examples below.\n *\n * This method goes through all possible migrations provided by the provider and runs the\n * ones whose names come alphabetically after the last migration that has been run. If the\n * list of executed migrations doesn't match the beginning of the list of possible migrations\n * an error is returned.\n *\n * ### Examples\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import * as Sqlite from 'better-sqlite3'\n * import { FileMigrationProvider, Migrator } from 'kysely'\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n *\n * const { error, results } = await migrator.migrateToLatest()\n *\n * results?.forEach((it) => {\n * if (it.status === 'Success') {\n * console.log(`migration \"${it.migrationName}\" was executed successfully`)\n * } else if (it.status === 'Error') {\n * console.error(`failed to execute migration \"${it.migrationName}\"`)\n * }\n * })\n *\n * if (error) {\n * console.error('failed to run `migrateToLatest`')\n * console.error(error)\n * }\n * ```\n */\n async migrateToLatest() {\n return this.#migrate(() => ({ direction: 'Up', step: Infinity }));\n }\n /**\n * Migrate up/down to a specific migration.\n *\n * This method returns a {@link MigrationResultSet} instance and _never_ throws.\n * {@link MigrationResultSet.error} holds the error if something went wrong.\n * {@link MigrationResultSet.results} contains information about which migrations\n * were executed and which failed.\n *\n * ### Examples\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import { FileMigrationProvider, Migrator } from 'kysely'\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * // Path to the folder that contains all your migrations.\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n *\n * await migrator.migrateTo('some_migration')\n * ```\n *\n * If you specify the name of the first migration, this method migrates\n * down to the first migration, but doesn't run the `down` method of\n * the first migration. In case you want to migrate all the way down,\n * you can use a special constant `NO_MIGRATIONS`:\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import { FileMigrationProvider, Migrator, NO_MIGRATIONS } from 'kysely'\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * // Path to the folder that contains all your migrations.\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n *\n * await migrator.migrateTo(NO_MIGRATIONS)\n * ```\n */\n async migrateTo(targetMigrationName) {\n return this.#migrate(({ migrations, executedMigrations, pendingMigrations, }) => {\n if (isObject(targetMigrationName) &&\n targetMigrationName.__noMigrations__ === true) {\n return { direction: 'Down', step: Infinity };\n }\n if (!migrations.find((m) => m.name === targetMigrationName)) {\n throw new Error(`migration \"${targetMigrationName}\" doesn't exist`);\n }\n const executedIndex = executedMigrations.indexOf(targetMigrationName);\n const pendingIndex = pendingMigrations.findIndex((m) => m.name === targetMigrationName);\n if (executedIndex !== -1) {\n return {\n direction: 'Down',\n step: executedMigrations.length - executedIndex - 1,\n };\n }\n else if (pendingIndex !== -1) {\n return { direction: 'Up', step: pendingIndex + 1 };\n }\n else {\n throw new Error(`migration \"${targetMigrationName}\" isn't executed or pending`);\n }\n });\n }\n /**\n * Migrate one step up.\n *\n * This method returns a {@link MigrationResultSet} instance and _never_ throws.\n * {@link MigrationResultSet.error} holds the error if something went wrong.\n * {@link MigrationResultSet.results} contains information about which migrations\n * were executed and which failed.\n *\n * ### Examples\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import { FileMigrationProvider, Migrator } from 'kysely'\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * // Path to the folder that contains all your migrations.\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n *\n * await migrator.migrateUp()\n * ```\n */\n async migrateUp() {\n return this.#migrate(() => ({ direction: 'Up', step: 1 }));\n }\n /**\n * Migrate one step down.\n *\n * This method returns a {@link MigrationResultSet} instance and _never_ throws.\n * {@link MigrationResultSet.error} holds the error if something went wrong.\n * {@link MigrationResultSet.results} contains information about which migrations\n * were executed and which failed.\n *\n * ### Examples\n *\n * ```ts\n * import { promises as fs } from 'node:fs'\n * import path from 'node:path'\n * import { FileMigrationProvider, Migrator } from 'kysely'\n *\n * const migrator = new Migrator({\n * db,\n * provider: new FileMigrationProvider({\n * fs,\n * // Path to the folder that contains all your migrations.\n * migrationFolder: 'some/path/to/migrations',\n * path,\n * })\n * })\n *\n * await migrator.migrateDown()\n * ```\n */\n async migrateDown() {\n return this.#migrate(() => ({ direction: 'Down', step: 1 }));\n }\n async #migrate(getMigrationDirectionAndStep) {\n try {\n await this.#ensureMigrationTableSchemaExists();\n await this.#ensureMigrationTableExists();\n await this.#ensureMigrationLockTableExists();\n await this.#ensureLockRowExists();\n return await this.#runMigrations(getMigrationDirectionAndStep);\n }\n catch (error) {\n if (error instanceof MigrationResultSetError) {\n return error.resultSet;\n }\n return { error };\n }\n }\n get #migrationTableSchema() {\n return this.#props.migrationTableSchema;\n }\n get #migrationTable() {\n return this.#props.migrationTableName ?? DEFAULT_MIGRATION_TABLE;\n }\n get #migrationLockTable() {\n return this.#props.migrationLockTableName ?? DEFAULT_MIGRATION_LOCK_TABLE;\n }\n get #allowUnorderedMigrations() {\n return (this.#props.allowUnorderedMigrations ?? DEFAULT_ALLOW_UNORDERED_MIGRATIONS);\n }\n get #schemaPlugin() {\n if (this.#migrationTableSchema) {\n return new WithSchemaPlugin(this.#migrationTableSchema);\n }\n return new NoopPlugin();\n }\n async #ensureMigrationTableSchemaExists() {\n if (!this.#migrationTableSchema) {\n // Use default schema. Nothing to do.\n return;\n }\n const schemaExists = await this.#doesSchemaExist();\n if (schemaExists) {\n return;\n }\n try {\n await this.#createIfNotExists(this.#props.db.schema.createSchema(this.#migrationTableSchema));\n }\n catch (error) {\n const schemaExists = await this.#doesSchemaExist();\n // At least on PostgreSQL, `if not exists` doesn't guarantee the `create schema`\n // query doesn't throw if the schema already exits. That's why we check if\n // the schema exist here and ignore the error if it does.\n if (!schemaExists) {\n throw error;\n }\n }\n }\n async #ensureMigrationTableExists() {\n const tableExists = await this.#doesTableExist(this.#migrationTable);\n if (tableExists) {\n return;\n }\n try {\n await this.#createIfNotExists(this.#props.db.schema\n .withPlugin(this.#schemaPlugin)\n .createTable(this.#migrationTable)\n .addColumn('name', 'varchar(255)', (col) => col.notNull().primaryKey())\n // The migration run time as ISO string. This is not a real date type as we\n // can't know which data type is supported by all future dialects.\n .addColumn('timestamp', 'varchar(255)', (col) => col.notNull()));\n }\n catch (error) {\n const tableExists = await this.#doesTableExist(this.#migrationTable);\n // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`\n // query doesn't throw if the table already exits. That's why we check if\n // the table exist here and ignore the error if it does.\n if (!tableExists) {\n throw error;\n }\n }\n }\n async #ensureMigrationLockTableExists() {\n const tableExists = await this.#doesTableExist(this.#migrationLockTable);\n if (tableExists) {\n return;\n }\n try {\n await this.#createIfNotExists(this.#props.db.schema\n .withPlugin(this.#schemaPlugin)\n .createTable(this.#migrationLockTable)\n .addColumn('id', 'varchar(255)', (col) => col.notNull().primaryKey())\n .addColumn('is_locked', 'integer', (col) => col.notNull().defaultTo(0)));\n }\n catch (error) {\n const tableExists = await this.#doesTableExist(this.#migrationLockTable);\n // At least on PostgreSQL, `if not exists` doesn't guarantee the `create table`\n // query doesn't throw if the table already exits. That's why we check if\n // the table exist here and ignore the error if it does.\n if (!tableExists) {\n throw error;\n }\n }\n }\n async #ensureLockRowExists() {\n const lockRowExists = await this.#doesLockRowExists();\n if (lockRowExists) {\n return;\n }\n try {\n await this.#props.db\n .withPlugin(this.#schemaPlugin)\n .insertInto(this.#migrationLockTable)\n .values({ id: MIGRATION_LOCK_ID, is_locked: 0 })\n .execute();\n }\n catch (error) {\n const lockRowExists = await this.#doesLockRowExists();\n if (!lockRowExists) {\n throw error;\n }\n }\n }\n async #doesSchemaExist() {\n const schemas = await this.#props.db.introspection.getSchemas();\n return schemas.some((it) => it.name === this.#migrationTableSchema);\n }\n async #doesTableExist(tableName) {\n const schema = this.#migrationTableSchema;\n const tables = await this.#props.db.introspection.getTables({\n withInternalKyselyTables: true,\n });\n return tables.some((it) => it.name === tableName && (!schema || it.schema === schema));\n }\n async #doesLockRowExists() {\n const lockRow = await this.#props.db\n .withPlugin(this.#schemaPlugin)\n .selectFrom(this.#migrationLockTable)\n .where('id', '=', MIGRATION_LOCK_ID)\n .select('id')\n .executeTakeFirst();\n return !!lockRow;\n }\n async #runMigrations(getMigrationDirectionAndStep) {\n const adapter = this.#props.db.getExecutor().adapter;\n const lockOptions = freeze({\n lockTable: this.#props.migrationLockTableName ?? DEFAULT_MIGRATION_LOCK_TABLE,\n lockRowId: MIGRATION_LOCK_ID,\n lockTableSchema: this.#props.migrationTableSchema,\n });\n const run = async (db) => {\n try {\n await adapter.acquireMigrationLock(db, lockOptions);\n const state = await this.#getState(db);\n if (state.migrations.length === 0) {\n return { results: [] };\n }\n const { direction, step } = getMigrationDirectionAndStep(state);\n if (step <= 0) {\n return { results: [] };\n }\n if (direction === 'Down') {\n return await this.#migrateDown(db, state, step);\n }\n else if (direction === 'Up') {\n return await this.#migrateUp(db, state, step);\n }\n return { results: [] };\n }\n finally {\n await adapter.releaseMigrationLock(db, lockOptions);\n }\n };\n if (adapter.supportsTransactionalDdl && !this.#props.disableTransactions) {\n return this.#props.db.transaction().execute(run);\n }\n else {\n return this.#props.db.connection().execute(run);\n }\n }\n async #getState(db) {\n const migrations = await this.#resolveMigrations();\n const executedMigrations = await this.#getExecutedMigrations(db);\n this.#ensureNoMissingMigrations(migrations, executedMigrations);\n if (!this.#allowUnorderedMigrations) {\n this.#ensureMigrationsInOrder(migrations, executedMigrations);\n }\n const pendingMigrations = this.#getPendingMigrations(migrations, executedMigrations);\n return freeze({\n migrations,\n executedMigrations,\n lastMigration: getLast(executedMigrations),\n pendingMigrations,\n });\n }\n #getPendingMigrations(migrations, executedMigrations) {\n return migrations.filter((migration) => {\n return !executedMigrations.includes(migration.name);\n });\n }\n async #resolveMigrations() {\n const allMigrations = await this.#props.provider.getMigrations();\n return Object.keys(allMigrations)\n .sort()\n .map((name) => ({\n ...allMigrations[name],\n name,\n }));\n }\n async #getExecutedMigrations(db) {\n const executedMigrations = await db\n .withPlugin(this.#schemaPlugin)\n .selectFrom(this.#migrationTable)\n .select(['name', 'timestamp'])\n .$narrowType()\n .execute();\n const nameComparator = this.#props.nameComparator || ((a, b) => a.localeCompare(b));\n return (executedMigrations\n // https://github.com/kysely-org/kysely/issues/843\n .sort((a, b) => {\n if (a.timestamp === b.timestamp) {\n return nameComparator(a.name, b.name);\n }\n return (new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());\n })\n .map((it) => it.name));\n }\n #ensureNoMissingMigrations(migrations, executedMigrations) {\n // Ensure all executed migrations exist in the `migrations` list.\n for (const executed of executedMigrations) {\n if (!migrations.some((it) => it.name === executed)) {\n throw new Error(`corrupted migrations: previously executed migration ${executed} is missing`);\n }\n }\n }\n #ensureMigrationsInOrder(migrations, executedMigrations) {\n // Ensure the executed migrations are the first ones in the migration list.\n for (let i = 0; i < executedMigrations.length; ++i) {\n if (migrations[i].name !== executedMigrations[i]) {\n throw new Error(`corrupted migrations: expected previously executed migration ${executedMigrations[i]} to be at index ${i} but ${migrations[i].name} was found in its place. New migrations must always have a name that comes alphabetically after the last executed migration.`);\n }\n }\n }\n async #migrateDown(db, state, step) {\n const migrationsToRollback = state.executedMigrations\n .slice()\n .reverse()\n .slice(0, step)\n .map((name) => {\n return state.migrations.find((it) => it.name === name);\n });\n const results = migrationsToRollback.map((migration) => {\n return {\n migrationName: migration.name,\n direction: 'Down',\n status: 'NotExecuted',\n };\n });\n for (let i = 0; i < results.length; ++i) {\n const migration = migrationsToRollback[i];\n try {\n if (migration.down) {\n await migration.down(db);\n await db\n .withPlugin(this.#schemaPlugin)\n .deleteFrom(this.#migrationTable)\n .where('name', '=', migration.name)\n .execute();\n results[i] = {\n migrationName: migration.name,\n direction: 'Down',\n status: 'Success',\n };\n }\n }\n catch (error) {\n results[i] = {\n migrationName: migration.name,\n direction: 'Down',\n status: 'Error',\n };\n throw new MigrationResultSetError({\n error,\n results,\n });\n }\n }\n return { results };\n }\n async #migrateUp(db, state, step) {\n const migrationsToRun = state.pendingMigrations.slice(0, step);\n const results = migrationsToRun.map((migration) => {\n return {\n migrationName: migration.name,\n direction: 'Up',\n status: 'NotExecuted',\n };\n });\n for (let i = 0; i < results.length; i++) {\n const migration = state.pendingMigrations[i];\n try {\n await migration.up(db);\n await db\n .withPlugin(this.#schemaPlugin)\n .insertInto(this.#migrationTable)\n .values({\n name: migration.name,\n timestamp: new Date().toISOString(),\n })\n .execute();\n results[i] = {\n migrationName: migration.name,\n direction: 'Up',\n status: 'Success',\n };\n }\n catch (error) {\n results[i] = {\n migrationName: migration.name,\n direction: 'Up',\n status: 'Error',\n };\n throw new MigrationResultSetError({\n error,\n results,\n });\n }\n }\n return { results };\n }\n async #createIfNotExists(qb) {\n if (this.#props.db.getExecutor().adapter.supportsCreateIfNotExists) {\n qb = qb.ifNotExists();\n }\n await qb.execute();\n }\n}\nclass MigrationResultSetError extends Error {\n #resultSet;\n constructor(result) {\n super();\n this.#resultSet = result;\n }\n get resultSet() {\n return this.#resultSet;\n }\n}\n","/// <reference types=\"./postgres-query-compiler.d.ts\" />\nimport { DefaultQueryCompiler } from '../../query-compiler/default-query-compiler.js';\nconst ID_WRAP_REGEX = /\"/g;\nexport class PostgresQueryCompiler extends DefaultQueryCompiler {\n sanitizeIdentifier(identifier) {\n return identifier.replace(ID_WRAP_REGEX, '\"\"');\n }\n}\n","/// <reference types=\"./postgres-introspector.d.ts\" />\nimport { DEFAULT_MIGRATION_LOCK_TABLE, DEFAULT_MIGRATION_TABLE, } from '../../migration/migrator.js';\nimport { freeze } from '../../util/object-utils.js';\nimport { sql } from '../../raw-builder/sql.js';\nexport class PostgresIntrospector {\n #db;\n constructor(db) {\n this.#db = db;\n }\n async getSchemas() {\n let rawSchemas = await this.#db\n .selectFrom('pg_catalog.pg_namespace')\n .select('nspname')\n .$castTo()\n .execute();\n return rawSchemas.map((it) => ({ name: it.nspname }));\n }\n async getTables(options = { withInternalKyselyTables: false }) {\n let query = this.#db\n // column\n .selectFrom('pg_catalog.pg_attribute as a')\n // table\n .innerJoin('pg_catalog.pg_class as c', 'a.attrelid', 'c.oid')\n // table schema\n .innerJoin('pg_catalog.pg_namespace as ns', 'c.relnamespace', 'ns.oid')\n // column data type\n .innerJoin('pg_catalog.pg_type as typ', 'a.atttypid', 'typ.oid')\n // column data type schema\n .innerJoin('pg_catalog.pg_namespace as dtns', 'typ.typnamespace', 'dtns.oid')\n .select([\n 'a.attname as column',\n 'a.attnotnull as not_null',\n 'a.atthasdef as has_default',\n 'c.relname as table',\n 'c.relkind as table_type',\n 'ns.nspname as schema',\n 'typ.typname as type',\n 'dtns.nspname as type_schema',\n sql `col_description(a.attrelid, a.attnum)`.as('column_description'),\n sql `pg_get_serial_sequence(quote_ident(ns.nspname) || '.' || quote_ident(c.relname), a.attname)`.as('auto_incrementing'),\n ])\n .where('c.relkind', 'in', [\n 'r' /*regular table*/,\n 'v' /*view*/,\n 'p' /*partitioned table*/,\n ])\n .where('ns.nspname', '!~', '^pg_')\n .where('ns.nspname', '!=', 'information_schema')\n // Filter out internal cockroachdb schema\n .where('ns.nspname', '!=', 'crdb_internal')\n // Only schemas where we are allowed access\n .where(sql `has_schema_privilege(ns.nspname, 'USAGE')`)\n // No system columns\n .where('a.attnum', '>=', 0)\n .where('a.attisdropped', '!=', true)\n .orderBy('ns.nspname')\n .orderBy('c.relname')\n .orderBy('a.attnum')\n .$castTo();\n if (!options.withInternalKyselyTables) {\n query = query\n .where('c.relname', '!=', DEFAULT_MIGRATION_TABLE)\n .where('c.relname', '!=', DEFAULT_MIGRATION_LOCK_TABLE);\n }\n const rawColumns = await query.execute();\n return this.#parseTableMetadata(rawColumns);\n }\n async getMetadata(options) {\n return {\n tables: await this.getTables(options),\n };\n }\n #parseTableMetadata(columns) {\n const tableDictionary = new Map();\n for (let i = 0, len = columns.length; i < len; i++) {\n const column = columns[i];\n const { schema, table } = column;\n const tableKey = `schema:${schema};table:${table}`;\n if (!tableDictionary.has(tableKey)) {\n tableDictionary.set(tableKey, freeze({\n columns: [],\n isView: column.table_type === 'v',\n name: table,\n schema,\n }));\n }\n tableDictionary.get(tableKey).columns.push(freeze({\n comment: column.column_description ?? undefined,\n dataType: column.type,\n dataTypeSchema: column.type_schema,\n hasDefaultValue: column.has_default,\n isAutoIncrementing: column.auto_incrementing !== null,\n isNullable: !column.not_null,\n name: column.column,\n }));\n }\n return Array.from(tableDictionary.values());\n }\n}\n","/// <reference types=\"./postgres-adapter.d.ts\" />\nimport { sql } from '../../raw-builder/sql.js';\nimport { DialectAdapterBase } from '../dialect-adapter-base.js';\n// Random id for our transaction lock.\nconst LOCK_ID = BigInt('3853314791062309107');\nexport class PostgresAdapter extends DialectAdapterBase {\n get supportsTransactionalDdl() {\n return true;\n }\n get supportsReturning() {\n return true;\n }\n async acquireMigrationLock(db, _opt) {\n // Acquire a transaction level advisory lock.\n await sql `select pg_advisory_xact_lock(${sql.lit(LOCK_ID)})`.execute(db);\n }\n async releaseMigrationLock(_db, _opt) {\n // Nothing to do here. `pg_advisory_xact_lock` is automatically released at the\n // end of the transaction and since `supportsTransactionalDdl` true, we know\n // the `db` instance passed to acquireMigrationLock is actually a transaction.\n }\n}\n","// src/dialect.ts\nimport {\n CompiledQuery,\n PostgresAdapter,\n PostgresIntrospector,\n PostgresQueryCompiler\n} from \"kysely\";\n\n// src/connection.ts\nvar PGliteConnection = class {\n client;\n constructor(client) {\n this.client = client;\n }\n async executeQuery(compiledQuery) {\n const result = await this.client.query(compiledQuery.sql, [\n ...compiledQuery.parameters\n ]);\n if (result.affectedRows) {\n const numAffectedRows = BigInt(result.affectedRows);\n return {\n numAffectedRows,\n rows: result.rows\n };\n }\n return {\n rows: result.rows\n };\n }\n async *streamQuery(compiledQuery, chunkSize) {\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error(\"chunkSize must be a positive integer\");\n }\n const result = await this.client.query(compiledQuery.sql, [\n ...compiledQuery.parameters\n ]);\n for (let i = 0; i < result.rows.length; i = i + chunkSize) {\n const chunk = result.rows.slice(i, i + chunkSize);\n yield { rows: chunk };\n }\n }\n};\n\n// src/dialect.ts\nvar PGliteDialect = class {\n constructor(pgLite) {\n this.pgLite = pgLite;\n }\n createAdapter() {\n return new PostgresAdapter();\n }\n createDriver() {\n return new PGliteDriver(this.pgLite);\n }\n createQueryCompiler() {\n return new PostgresQueryCompiler();\n }\n createIntrospector(db) {\n return new PostgresIntrospector(db);\n }\n};\nvar PGliteDriver = class {\n client;\n /**\n * Currently used connection.\n * If another acquireConnection() is called the request is queued till this connection has been released.\n */\n connection;\n queue = [];\n constructor(pgLite) {\n this.client = pgLite;\n }\n async init() {\n }\n // Serialize access to the connection, i.e. promise is only resolved when the last connection was released.\n async acquireConnection() {\n if (this.client === void 0) {\n throw new Error(\"PGLite not initialized\");\n }\n if (this.connection !== void 0) {\n return new Promise((resolve) => {\n this.queue.push(resolve);\n });\n }\n this.connection = new PGliteConnection(this.client);\n return this.connection;\n }\n async releaseConnection(connection) {\n if (connection !== this.connection) {\n throw new Error(\"Invalid connection\");\n }\n const removed = this.queue.splice(0, 1);\n const next = removed[0];\n if (next === void 0) {\n this.connection = void 0;\n return;\n }\n next(this.connection);\n }\n async beginTransaction(conn, settings) {\n if (settings.isolationLevel) {\n await conn.executeQuery(\n CompiledQuery.raw(\n `start transaction isolation level ${settings.isolationLevel}`\n )\n );\n } else {\n await conn.executeQuery(CompiledQuery.raw(\"begin\"));\n }\n }\n async commitTransaction(conn) {\n await conn.executeQuery(CompiledQuery.raw(\"commit\"));\n }\n async rollbackTransaction(conn) {\n await conn.executeQuery(CompiledQuery.raw(\"rollback\"));\n }\n async destroy() {\n this.client = void 0;\n }\n};\nexport {\n PGliteDialect\n};\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10],"mappings":";;AAMA,IAAM,iBAAN,MAAM,eAAe;CACjB;CACA,YAAY,OAAO;EACf,KAAK,SAAS,OAAO,KAAK;CAC9B;CACA,IAAI,iBAAiB,CAErB;CACA,IAAI,eAAe;EACf,OAAO;CACX;CACA,GAAG,OAAO;EACN,OAAO,IAAI,sBAAsB,MAAM,KAAK;CAChD;CACA,UAAU;EACN,OAAO,IAAI,eAAe,EAAE,GAAG,KAAK,OAAO,CAAC;CAChD;CACA,WAAW;EACP,OAAO,IAAI,eAAe,KAAK,MAAM;CACzC;CACA,WAAW,QAAQ;EACf,OAAO,IAAI,eAAe;GACtB,GAAG,KAAK;GACR,SAAS,KAAK,OAAO,YAAY,KAAA,IAC3B,OAAO,CAAC,GAAG,KAAK,OAAO,SAAS,MAAM,CAAC,IACvC,OAAO,CAAC,MAAM,CAAC;EACzB,CAAC;CACL;CACA,kBAAkB;EACd,OAAO,KAAK,iBAAiB,KAAK,aAAa,CAAC;CACpD;CACA,QAAQ,kBAAkB;EACtB,OAAO,KAAK,SAAS,KAAK,aAAa,gBAAgB,CAAC;CAC5D;CACA,MAAM,QAAQ,kBAAkB;EAC5B,MAAM,WAAW,KAAK,aAAa,gBAAgB;EACnD,OAAO,SAAS,aAAa,KAAK,SAAS,QAAQ,CAAC;CACxD;CACA,aAAa,kBAAkB;EAC3B,MAAM,WAAW,qBAAqB,KAAA,IAChC,iBAAiB,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AI,QAAQ,CAAC;CACrD;CACA,MAAM,oBAAoB,MAAM;EAC9B,MAAM,KAAK,aAAa,cAAc,IAAI,UAAU,CAAC;CACvD;CACA,MAAM,UAAU;EACd,KAAK,SAAS,KAAK;CACrB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import { a as DEFAULT_MIGRATION_TABLE, c as DefaultQueryCompiler, d as createRawBuilder, i as DEFAULT_MIGRATION_LOCK_TABLE, l as OperationNodeVisitor, n as PostgresIntrospector, o as DialectAdapterBase, r as PostgresQueryCompiler, s as CompiledQuery, t as PostgresAdapter, u as sql } from "./dist-
|
|
2
|
+
import { a as DEFAULT_MIGRATION_TABLE, c as DefaultQueryCompiler, d as createRawBuilder, i as DEFAULT_MIGRATION_LOCK_TABLE, l as OperationNodeVisitor, n as PostgresIntrospector, o as DialectAdapterBase, r as PostgresQueryCompiler, s as CompiledQuery, t as PostgresAdapter, u as sql } from "./dist-CUltriBW.mjs";
|
|
3
3
|
//#region ../../node_modules/.pnpm/kysely@0.28.16/node_modules/kysely/dist/esm/util/object-utils.js
|
|
4
4
|
function isUndefined(obj) {
|
|
5
5
|
return typeof obj === "undefined" || obj === void 0;
|
|
@@ -13137,4 +13137,4 @@ var esm_exports = /* @__PURE__ */ __exportAll({
|
|
|
13137
13137
|
//#endregion
|
|
13138
13138
|
export { isDate as C, isString as E, isBoolean as S, isNumber as T, AliasNode as _, NOOP_QUERY_EXECUTOR as a, freeze as b, InsertQueryNode as c, ValueNode as d, parseStringReference as f, isOperationNodeSource as g, OperatorNode as h, SetOperationNode as i, ParensNode as l, RawNode as m, CreateViewNode as n, createQueryId as o, logOnce as p, parseTable as r, WhenNode as s, esm_exports as t, parseValueExpression as u, CreateTableNode as v, isNull as w, isBigInt as x, IdentifierNode as y };
|
|
13139
13139
|
|
|
13140
|
-
//# sourceMappingURL=esm-
|
|
13140
|
+
//# sourceMappingURL=esm-C1DOsF1a.mjs.map
|