Skip to content

Commit 01cc447

Browse files
committed
sqitch-parser base
1 parent a93a88b commit 01cc447

File tree

9 files changed

+211
-2
lines changed

9 files changed

+211
-2
lines changed

packages/pg-ast/src/asts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* This file was automatically generated by [email protected].1.
2+
* This file was automatically generated by [email protected].2.
33
* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44
* and run the pg-proto-parser generate command to regenerate this file.
55
*/

packages/pg-ast/src/wrapped.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* This file was automatically generated by [email protected].1.
2+
* This file was automatically generated by [email protected].2.
33
* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44
* and run the pg-proto-parser generate command to regenerate this file.
55
*/

packages/sqitch-parser/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# @launchql/sqitch-parser
2+
3+
<p align="center" width="100%">
4+
<img height="250" src="https://raw.githubusercontent.com/launchql/launchql/refs/heads/main/assets/outline-logo.svg" />
5+
</p>
6+
7+
<p align="center" width="100%">
8+
<a href="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml">
9+
<img height="20" src="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml/badge.svg" />
10+
</a>
11+
<a href="https://github.com/launchql/launchql/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
12+
<a href="https://www.npmjs.com/package/@launchql/sqitch-parser"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql?filename=packages%2Fsqitch-parser%2Fpackage.json"/></a>
13+
</p>
14+
15+
## Related LaunchQL Tooling
16+
17+
### 🧪 Testing
18+
19+
* [launchql/pgsql-test](https://github.com/launchql/launchql/tree/main/packages/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
20+
* [launchql/graphile-test](https://github.com/launchql/launchql/tree/main/packages/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
21+
* [launchql/pg-query-context](https://github.com/launchql/launchql/tree/main/packages/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
22+
23+
### 🧠 Parsing & AST
24+
25+
* [launchql/pgsql-parser](https://github.com/launchql/pgsql-parser): **🔄 SQL conversion engine** that interprets and converts PostgreSQL syntax.
26+
* [launchql/libpg-query-node](https://github.com/launchql/libpg-query-node): **🌉 Node.js bindings** for `libpg_query`, converting SQL into parse trees.
27+
* [launchql/pg-proto-parser](https://github.com/launchql/pg-proto-parser): **📦 Protobuf parser** for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
28+
* [@pgsql/enums](https://github.com/launchql/pgsql-parser/tree/main/packages/enums): **🏷️ TypeScript enums** for PostgreSQL AST for safe and ergonomic parsing logic.
29+
* [@pgsql/types](https://github.com/launchql/pgsql-parser/tree/main/packages/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
30+
* [@pgsql/utils](https://github.com/launchql/pgsql-parser/tree/main/packages/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
31+
* [launchql/pg-ast](https://github.com/launchql/launchql/tree/main/packages/pg-ast): **🔍 Low-level AST tools** and transformations for Postgres query structures.
32+
33+
### 🚀 API & Dev Tools
34+
35+
* [launchql/server](https://github.com/launchql/launchql/tree/main/packages/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
36+
* [launchql/explorer](https://github.com/launchql/launchql/tree/main/packages/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
37+
38+
### 🔁 Streaming & Uploads
39+
40+
* [launchql/s3-streamer](https://github.com/launchql/launchql/tree/main/packages/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
41+
* [launchql/etag-hash](https://github.com/launchql/launchql/tree/main/packages/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
42+
* [launchql/etag-stream](https://github.com/launchql/launchql/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
43+
* [launchql/uuid-hash](https://github.com/launchql/launchql/tree/main/packages/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
44+
* [launchql/uuid-stream](https://github.com/launchql/launchql/tree/main/packages/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
45+
* [launchql/upload-names](https://github.com/launchql/launchql/tree/main/packages/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
46+
47+
### 🧰 CLI & Codegen
48+
49+
* [@launchql/cli](https://github.com/launchql/launchql/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
50+
* [launchql/launchql-gen](https://github.com/launchql/launchql/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
51+
* [@launchql/query-builder](https://github.com/launchql/launchql/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
52+
* [@launchql/query](https://github.com/launchql/launchql/tree/main/packages/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
53+
54+
## Disclaimer
55+
56+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
57+
58+
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
59+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
module.exports = {
3+
preset: "ts-jest",
4+
testEnvironment: "node",
5+
transform: {
6+
"^.+\\.tsx?$": [
7+
"ts-jest",
8+
{
9+
babelConfig: false,
10+
tsconfig: "tsconfig.json",
11+
},
12+
],
13+
},
14+
transformIgnorePatterns: [`/node_modules/*`],
15+
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
16+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
17+
modulePathIgnorePatterns: ["dist/*"]
18+
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "@launchql/sqitch-parser",
3+
"version": "2.0.0",
4+
"author": "Dan Lynch <[email protected]>",
5+
"description": "LaunchQL Sqitch Parser",
6+
"main": "index.js",
7+
"module": "esm/index.js",
8+
"types": "index.d.ts",
9+
"homepage": "https://github.com/launchql/launchql",
10+
"license": "MIT",
11+
"publishConfig": {
12+
"access": "public",
13+
"directory": "dist"
14+
},
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/launchql/launchql"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/launchql/launchql/issues"
21+
},
22+
"scripts": {
23+
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
24+
"clean": "rimraf dist/**",
25+
"prepare": "npm run build",
26+
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
27+
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
28+
"lint": "eslint . --fix",
29+
"test": "jest",
30+
"test:watch": "jest --watch"
31+
},
32+
"keywords": [
33+
"database",
34+
"migration",
35+
"postgresql",
36+
"launchql",
37+
"schema",
38+
"sqitch"
39+
]
40+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export * from './class/launchql';
2+
export * from './deps';
3+
export * from './export-meta';
4+
export * from './export-migrations';
5+
export * from './extensions';
6+
export * from './modules';
7+
export * from './package';
8+
export * from './paths';
9+
export * from './resolve';
10+
export * from './projects/deploy-project';
11+
export * from './projects/revert-project';
12+
export * from './projects/verify-project';
13+
export * from './transform';
14+
export * from './utils';
15+
16+
// New exports for migration API
17+
export * from './migrate/migration';
18+
export { runSqitch } from './utils/sqitch-wrapper';
19+
export { deployModule } from './migrate/deploy-module';
20+
export { revertModule } from './migrate/revert-module';
21+
export { verifyModule } from './migrate/verify-module';
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { LaunchQLProject } from '../src';
2+
import fs from 'fs';
3+
import os from 'os';
4+
import path from 'path';
5+
6+
const { mkdtempSync, rmSync, cpSync } = fs;
7+
8+
export const FIXTURES_PATH = path.resolve(__dirname, '../../../__fixtures__');
9+
10+
export const getFixturePath = (...paths: string[]) =>
11+
path.join(FIXTURES_PATH, ...paths);
12+
13+
export const cleanText = (text: string): string =>
14+
text
15+
.split('\n')
16+
.map((line) => line.trim())
17+
.filter((line) => line.length > 0)
18+
.join('\n');
19+
20+
21+
export class TestFixture {
22+
readonly tempDir: string;
23+
readonly tempFixtureDir: string;
24+
readonly getFixturePath: (...paths: string[]) => string;
25+
readonly getModuleProject: (workspacePath: string[], moduleName: string) => LaunchQLProject;
26+
27+
constructor(...fixturePath: string[]) {
28+
const originalFixtureDir = getFixturePath(...fixturePath);
29+
this.tempDir = mkdtempSync(path.join(os.tmpdir(), 'launchql-test-'));
30+
this.tempFixtureDir = path.join(this.tempDir, ...fixturePath);
31+
32+
cpSync(originalFixtureDir, this.tempFixtureDir, { recursive: true });
33+
34+
this.getFixturePath = (...paths: string[]) =>
35+
path.join(this.tempFixtureDir, ...paths);
36+
37+
this.getModuleProject = (workspacePath: string[], moduleName: string): LaunchQLProject => {
38+
const workspace = new LaunchQLProject(this.getFixturePath(...workspacePath));
39+
const moduleMap = workspace.getModuleMap();
40+
const meta = moduleMap[moduleName];
41+
if (!meta) throw new Error(`Module ${moduleName} not found in workspace`);
42+
return new LaunchQLProject(this.getFixturePath(...workspacePath, meta.path));
43+
};
44+
}
45+
46+
fixturePath(...paths: string[]) {
47+
return path.join(this.tempFixtureDir, ...paths);
48+
}
49+
50+
cleanup() {
51+
rmSync(this.tempDir, { recursive: true, force: true });
52+
}
53+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist/esm",
5+
"module": "es2022",
6+
"rootDir": "src/",
7+
"declaration": false
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"rootDir": "src/"
6+
},
7+
"include": ["src/**/*.ts"],
8+
"exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"]
9+
}

0 commit comments

Comments
 (0)