@danielfgray/pg-sourcerer 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -4
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +14 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/generate.d.ts +5 -9
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +27 -29
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +19 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +39 -9
- package/dist/init.js.map +1 -1
- package/dist/ir/extensions/queries.d.ts +264 -0
- package/dist/ir/extensions/queries.d.ts.map +1 -0
- package/dist/ir/extensions/queries.js +153 -0
- package/dist/ir/extensions/queries.js.map +1 -0
- package/dist/ir/extensions/schema-builder.d.ts +61 -0
- package/dist/ir/extensions/schema-builder.d.ts.map +1 -0
- package/dist/ir/extensions/schema-builder.js +5 -0
- package/dist/ir/extensions/schema-builder.js.map +1 -0
- package/dist/lib/conjure.d.ts +66 -0
- package/dist/lib/conjure.d.ts.map +1 -1
- package/dist/lib/conjure.js +127 -29
- package/dist/lib/conjure.js.map +1 -1
- package/dist/lib/hex.d.ts +10 -3
- package/dist/lib/hex.d.ts.map +1 -1
- package/dist/lib/hex.js +18 -8
- package/dist/lib/hex.js.map +1 -1
- package/dist/plugins/arktype.d.ts +27 -14
- package/dist/plugins/arktype.d.ts.map +1 -1
- package/dist/plugins/arktype.js +166 -130
- package/dist/plugins/arktype.js.map +1 -1
- package/dist/plugins/effect.d.ts +53 -0
- package/dist/plugins/effect.d.ts.map +1 -0
- package/dist/plugins/effect.js +1074 -0
- package/dist/plugins/effect.js.map +1 -0
- package/dist/plugins/http-elysia.d.ts +32 -0
- package/dist/plugins/http-elysia.d.ts.map +1 -0
- package/dist/plugins/http-elysia.js +613 -0
- package/dist/plugins/http-elysia.js.map +1 -0
- package/dist/plugins/http-express.d.ts +36 -0
- package/dist/plugins/http-express.d.ts.map +1 -0
- package/dist/plugins/http-express.js +388 -0
- package/dist/plugins/http-express.js.map +1 -0
- package/dist/plugins/http-hono.d.ts +36 -0
- package/dist/plugins/http-hono.d.ts.map +1 -0
- package/dist/plugins/http-hono.js +453 -0
- package/dist/plugins/http-hono.js.map +1 -0
- package/dist/plugins/http-orpc.d.ts +55 -0
- package/dist/plugins/http-orpc.d.ts.map +1 -0
- package/dist/plugins/http-orpc.js +370 -0
- package/dist/plugins/http-orpc.js.map +1 -0
- package/dist/plugins/http-trpc.d.ts +59 -0
- package/dist/plugins/http-trpc.d.ts.map +1 -0
- package/dist/plugins/http-trpc.js +392 -0
- package/dist/plugins/http-trpc.js.map +1 -0
- package/dist/plugins/kysely/queries.d.ts +92 -0
- package/dist/plugins/kysely/queries.d.ts.map +1 -0
- package/dist/plugins/kysely/queries.js +1169 -0
- package/dist/plugins/kysely/queries.js.map +1 -0
- package/dist/plugins/kysely/shared.d.ts +59 -0
- package/dist/plugins/kysely/shared.d.ts.map +1 -0
- package/dist/plugins/kysely/shared.js +247 -0
- package/dist/plugins/kysely/shared.js.map +1 -0
- package/dist/plugins/kysely/types.d.ts +22 -0
- package/dist/plugins/kysely/types.d.ts.map +1 -0
- package/dist/plugins/kysely/types.js +428 -0
- package/dist/plugins/kysely/types.js.map +1 -0
- package/dist/plugins/kysely.d.ts +72 -0
- package/dist/plugins/kysely.d.ts.map +1 -0
- package/dist/plugins/kysely.js +906 -0
- package/dist/plugins/kysely.js.map +1 -0
- package/dist/plugins/sql-queries.d.ts +55 -11
- package/dist/plugins/sql-queries.d.ts.map +1 -1
- package/dist/plugins/sql-queries.js +467 -218
- package/dist/plugins/sql-queries.js.map +1 -1
- package/dist/plugins/types.d.ts +20 -14
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +90 -112
- package/dist/plugins/types.js.map +1 -1
- package/dist/plugins/valibot.d.ts +45 -0
- package/dist/plugins/valibot.d.ts.map +1 -0
- package/dist/plugins/valibot.js +422 -0
- package/dist/plugins/valibot.js.map +1 -0
- package/dist/plugins/zod.d.ts +27 -14
- package/dist/plugins/zod.d.ts.map +1 -1
- package/dist/plugins/zod.js +231 -166
- package/dist/plugins/zod.js.map +1 -1
- package/dist/services/artifact-store.d.ts +11 -1
- package/dist/services/artifact-store.d.ts.map +1 -1
- package/dist/services/artifact-store.js +9 -0
- package/dist/services/artifact-store.js.map +1 -1
- package/dist/services/core-providers.d.ts +15 -0
- package/dist/services/core-providers.d.ts.map +1 -0
- package/dist/services/core-providers.js +23 -0
- package/dist/services/core-providers.js.map +1 -0
- package/dist/services/emissions.d.ts +14 -0
- package/dist/services/emissions.d.ts.map +1 -1
- package/dist/services/emissions.js +86 -47
- package/dist/services/emissions.js.map +1 -1
- package/dist/services/execution.d.ts +35 -0
- package/dist/services/execution.d.ts.map +1 -0
- package/dist/services/execution.js +86 -0
- package/dist/services/execution.js.map +1 -0
- package/dist/services/file-builder.d.ts +4 -0
- package/dist/services/file-builder.d.ts.map +1 -1
- package/dist/services/file-builder.js.map +1 -1
- package/dist/services/inflection.d.ts +2 -2
- package/dist/services/inflection.d.ts.map +1 -1
- package/dist/services/inflection.js +4 -4
- package/dist/services/inflection.js.map +1 -1
- package/dist/services/ir-builder.d.ts.map +1 -1
- package/dist/services/ir-builder.js +10 -3
- package/dist/services/ir-builder.js.map +1 -1
- package/dist/services/pg-types.d.ts +31 -0
- package/dist/services/pg-types.d.ts.map +1 -1
- package/dist/services/pg-types.js +24 -0
- package/dist/services/pg-types.js.map +1 -1
- package/dist/services/plugin-runner.d.ts +27 -37
- package/dist/services/plugin-runner.d.ts.map +1 -1
- package/dist/services/plugin-runner.js +73 -171
- package/dist/services/plugin-runner.js.map +1 -1
- package/dist/services/plugin.d.ts +349 -217
- package/dist/services/plugin.d.ts.map +1 -1
- package/dist/services/plugin.js +182 -130
- package/dist/services/plugin.js.map +1 -1
- package/dist/services/resolution.d.ts +38 -0
- package/dist/services/resolution.d.ts.map +1 -0
- package/dist/services/resolution.js +242 -0
- package/dist/services/resolution.js.map +1 -0
- package/dist/services/service-registry.d.ts +74 -0
- package/dist/services/service-registry.d.ts.map +1 -0
- package/dist/services/service-registry.js +61 -0
- package/dist/services/service-registry.js.map +1 -0
- package/dist/services/symbols.d.ts +59 -0
- package/dist/services/symbols.d.ts.map +1 -1
- package/dist/services/symbols.js +16 -0
- package/dist/services/symbols.js.map +1 -1
- package/dist/testing.d.ts +4 -25
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -23
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/plugins/effect-model.d.ts +0 -17
- package/dist/plugins/effect-model.d.ts.map +0 -1
- package/dist/plugins/effect-model.js +0 -409
- package/dist/plugins/effect-model.js.map +0 -1
- package/dist/plugins/kysely-queries.d.ts +0 -66
- package/dist/plugins/kysely-queries.d.ts.map +0 -1
- package/dist/plugins/kysely-queries.js +0 -951
- package/dist/plugins/kysely-queries.js.map +0 -1
- package/dist/plugins/kysely-types.d.ts +0 -35
- package/dist/plugins/kysely-types.d.ts.map +0 -1
- package/dist/plugins/kysely-types.js +0 -601
- package/dist/plugins/kysely-types.js.map +0 -1
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP tRPC Plugin - Generate tRPC routers from query plugins
|
|
3
|
+
*
|
|
4
|
+
* Consumes method symbols from sql-queries or kysely-queries via the symbol registry
|
|
5
|
+
* and generates type-safe tRPC routers with schema validation.
|
|
6
|
+
*/
|
|
7
|
+
import { Schema as S } from "effect";
|
|
8
|
+
import { definePlugin } from "../services/plugin.js";
|
|
9
|
+
import { conjure, cast } from "../lib/conjure.js";
|
|
10
|
+
import { inflect } from "../services/inflection.js";
|
|
11
|
+
import { SCHEMA_BUILDER_KIND, } from "../ir/extensions/schema-builder.js";
|
|
12
|
+
const { b } = conjure;
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Configuration
|
|
15
|
+
// ============================================================================
|
|
16
|
+
const HttpTrpcConfigSchema = S.Struct({
|
|
17
|
+
/** Output directory for generated router files. Default: "trpc" */
|
|
18
|
+
outputDir: S.optionalWith(S.String, { default: () => "trpc" }),
|
|
19
|
+
/**
|
|
20
|
+
* Header content to prepend to each generated file.
|
|
21
|
+
* MUST import `router` and a base procedure (e.g., `publicProcedure`).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* header: `import { router, publicProcedure } from "../trpc.js";`
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
header: S.String,
|
|
29
|
+
/**
|
|
30
|
+
* Name of the base procedure to use in generated code.
|
|
31
|
+
* Must match an import from your header.
|
|
32
|
+
* Default: "publicProcedure"
|
|
33
|
+
*/
|
|
34
|
+
baseProcedure: S.optionalWith(S.String, { default: () => "publicProcedure" }),
|
|
35
|
+
/** Name of the aggregated router export. Default: "appRouter" */
|
|
36
|
+
aggregatorName: S.optionalWith(S.String, { default: () => "appRouter" }),
|
|
37
|
+
});
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// String Helpers
|
|
40
|
+
// ============================================================================
|
|
41
|
+
/** Convert PascalCase/camelCase to kebab-case */
|
|
42
|
+
const toKebabCase = (str) => str
|
|
43
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2")
|
|
44
|
+
.replace(/_/g, "-")
|
|
45
|
+
.toLowerCase();
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Procedure Builders
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Map query method kind to tRPC procedure type.
|
|
51
|
+
*/
|
|
52
|
+
const kindToProcedureType = (kind) => {
|
|
53
|
+
switch (kind) {
|
|
54
|
+
case "read":
|
|
55
|
+
case "list":
|
|
56
|
+
case "lookup":
|
|
57
|
+
return "query";
|
|
58
|
+
case "create":
|
|
59
|
+
case "update":
|
|
60
|
+
case "delete":
|
|
61
|
+
case "function":
|
|
62
|
+
return "mutation";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Build the handler function body for a procedure.
|
|
67
|
+
* tRPC handlers receive { input, ctx } and return data directly.
|
|
68
|
+
*/
|
|
69
|
+
const buildProcedureBody = (method) => {
|
|
70
|
+
const queryFnName = method.name;
|
|
71
|
+
const callSig = method.callSignature ?? { style: "named" };
|
|
72
|
+
const statements = [];
|
|
73
|
+
// Build the function call arguments based on callSignature
|
|
74
|
+
const args = [];
|
|
75
|
+
if (callSig.style === "positional") {
|
|
76
|
+
// Positional: fn(a, b, c)
|
|
77
|
+
for (const param of method.params) {
|
|
78
|
+
args.push(b.memberExpression(b.identifier("input"), b.identifier(param.name)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// Named: fn({ a, b, c }) or fn(input) for body
|
|
83
|
+
const bodyParam = method.params.find((p) => p.source === "body");
|
|
84
|
+
if (bodyParam && callSig.bodyStyle === "spread") {
|
|
85
|
+
// Body fields spread directly: fn(input)
|
|
86
|
+
args.push(b.identifier("input"));
|
|
87
|
+
}
|
|
88
|
+
else if (bodyParam && callSig.bodyStyle === "property") {
|
|
89
|
+
// Body wrapped in property: fn({ id, data })
|
|
90
|
+
// Collect non-body params that need to be extracted from input
|
|
91
|
+
const nonBodyParams = method.params.filter((p) => p.source === "pk" || p.source === "fk" || p.source === "lookup" || p.source === "pagination");
|
|
92
|
+
if (nonBodyParams.length > 0) {
|
|
93
|
+
// Generate: const { id, ...data } = input;
|
|
94
|
+
const destructureProps = nonBodyParams.map((p) => b.property.from({ kind: "init", key: b.identifier(p.name), value: b.identifier(p.name), shorthand: true }));
|
|
95
|
+
const restId = b.identifier(bodyParam.name);
|
|
96
|
+
const restElem = b.restElement(restId);
|
|
97
|
+
const pattern = b.objectPattern([...destructureProps, restElem]);
|
|
98
|
+
const destructureDecl = b.variableDeclaration("const", [
|
|
99
|
+
b.variableDeclarator(pattern, b.identifier("input")),
|
|
100
|
+
]);
|
|
101
|
+
statements.push(destructureDecl);
|
|
102
|
+
// Build: { id, data } using the destructured variables
|
|
103
|
+
let objBuilder = conjure.obj();
|
|
104
|
+
for (const param of nonBodyParams) {
|
|
105
|
+
objBuilder = objBuilder.shorthand(param.name);
|
|
106
|
+
}
|
|
107
|
+
objBuilder = objBuilder.shorthand(bodyParam.name);
|
|
108
|
+
args.push(objBuilder.build());
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// No non-body params, just wrap input: fn({ data: input })
|
|
112
|
+
args.push(conjure.obj().prop(bodyParam.name, b.identifier("input")).build());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (method.params.length > 0) {
|
|
116
|
+
// Simple named params: fn(input) since input matches the shape
|
|
117
|
+
args.push(b.identifier("input"));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Build: return await queryFn(args)
|
|
121
|
+
const queryCall = b.callExpression(b.identifier(queryFnName), args.map(cast.toExpr));
|
|
122
|
+
const awaitExpr = b.awaitExpression(queryCall);
|
|
123
|
+
// For delete, return success object
|
|
124
|
+
if (method.kind === "delete") {
|
|
125
|
+
statements.push(b.expressionStatement(awaitExpr));
|
|
126
|
+
statements.push(b.returnStatement(conjure.obj().prop("success", b.booleanLiteral(true)).build()));
|
|
127
|
+
return statements;
|
|
128
|
+
}
|
|
129
|
+
statements.push(b.returnStatement(awaitExpr));
|
|
130
|
+
return statements;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Determine if a method needs body validation and which schema to use.
|
|
134
|
+
*/
|
|
135
|
+
const getBodySchemaImport = (method, entityName) => {
|
|
136
|
+
if (method.kind === "create") {
|
|
137
|
+
return { entity: entityName, shape: "insert", schemaName: `${entityName}Insert` };
|
|
138
|
+
}
|
|
139
|
+
if (method.kind === "update") {
|
|
140
|
+
return { entity: entityName, shape: "update", schemaName: `${entityName}Update` };
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Build the input schema expression for a procedure.
|
|
146
|
+
*/
|
|
147
|
+
const buildInputSchema = (method, entityName, requestSchema) => {
|
|
148
|
+
const bodySchema = getBodySchemaImport(method, entityName);
|
|
149
|
+
const nonBodyParams = method.params.filter((p) => p.source !== "body");
|
|
150
|
+
const callSig = method.callSignature ?? { style: "named" };
|
|
151
|
+
// For update with bodyStyle: "property", we need to merge PK params with body schema
|
|
152
|
+
if (bodySchema && nonBodyParams.length > 0 && callSig.bodyStyle === "property") {
|
|
153
|
+
// Build: z.object({ id: z.coerce.number() }).merge(PostUpdate)
|
|
154
|
+
let objBuilder = conjure.obj();
|
|
155
|
+
for (const p of nonBodyParams) {
|
|
156
|
+
objBuilder = objBuilder.prop(p.name, buildZodParamType(p));
|
|
157
|
+
}
|
|
158
|
+
const zodObject = b.callExpression(b.memberExpression(b.identifier("z"), b.identifier("object")), [cast.toExpr(objBuilder.build())]);
|
|
159
|
+
const mergedSchema = b.callExpression(b.memberExpression(zodObject, b.identifier("merge")), [b.identifier(bodySchema.schemaName)]);
|
|
160
|
+
return {
|
|
161
|
+
inputExpr: mergedSchema,
|
|
162
|
+
bodySchema,
|
|
163
|
+
schemaBuilderImport: { names: ["z"], from: "zod" },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
// Body params only use imported entity schemas
|
|
167
|
+
if (bodySchema) {
|
|
168
|
+
return {
|
|
169
|
+
inputExpr: b.identifier(bodySchema.schemaName),
|
|
170
|
+
bodySchema,
|
|
171
|
+
schemaBuilderImport: null,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
// Non-body params: use schema builder
|
|
175
|
+
if (nonBodyParams.length === 0) {
|
|
176
|
+
return { inputExpr: null, bodySchema: null, schemaBuilderImport: null };
|
|
177
|
+
}
|
|
178
|
+
const schemaResult = requestSchema(nonBodyParams);
|
|
179
|
+
if (schemaResult) {
|
|
180
|
+
return {
|
|
181
|
+
inputExpr: schemaResult.ast,
|
|
182
|
+
bodySchema: null,
|
|
183
|
+
schemaBuilderImport: schemaResult.importSpec,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// Fallback: build inline z.object (tRPC requires Zod)
|
|
187
|
+
let objBuilder = conjure.obj();
|
|
188
|
+
for (const param of nonBodyParams) {
|
|
189
|
+
const zodType = buildZodParamType(param);
|
|
190
|
+
objBuilder = objBuilder.prop(param.name, zodType);
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
inputExpr: b.callExpression(b.memberExpression(b.identifier("z"), b.identifier("object")), [cast.toExpr(objBuilder.build())]),
|
|
194
|
+
bodySchema: null,
|
|
195
|
+
schemaBuilderImport: { names: ["z"], from: "zod" },
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Build Zod type expression for a param (fallback when no schema-builder).
|
|
200
|
+
*/
|
|
201
|
+
const buildZodParamType = (param) => {
|
|
202
|
+
const baseType = param.type.toLowerCase();
|
|
203
|
+
let zodCall;
|
|
204
|
+
switch (baseType) {
|
|
205
|
+
case "number":
|
|
206
|
+
zodCall = b.callExpression(b.memberExpression(b.memberExpression(b.identifier("z"), b.identifier("coerce")), b.identifier("number")), []);
|
|
207
|
+
break;
|
|
208
|
+
case "boolean":
|
|
209
|
+
zodCall = b.callExpression(b.memberExpression(b.identifier("z"), b.identifier("boolean")), []);
|
|
210
|
+
break;
|
|
211
|
+
case "date":
|
|
212
|
+
zodCall = b.callExpression(b.memberExpression(b.memberExpression(b.identifier("z"), b.identifier("coerce")), b.identifier("date")), []);
|
|
213
|
+
break;
|
|
214
|
+
case "string":
|
|
215
|
+
default:
|
|
216
|
+
zodCall = b.callExpression(b.memberExpression(b.identifier("z"), b.identifier("string")), []);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
if (!param.required) {
|
|
220
|
+
zodCall = b.callExpression(b.memberExpression(cast.toExpr(zodCall), b.identifier("optional")), []);
|
|
221
|
+
}
|
|
222
|
+
return zodCall;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Build a single tRPC procedure.
|
|
226
|
+
*/
|
|
227
|
+
const buildProcedure = (method, entityName, baseProcedure, requestSchema) => {
|
|
228
|
+
const procedureType = kindToProcedureType(method.kind);
|
|
229
|
+
// Start with base procedure
|
|
230
|
+
let chainExpr = b.identifier(baseProcedure);
|
|
231
|
+
// Build input schema
|
|
232
|
+
const { inputExpr, bodySchema, schemaBuilderImport } = buildInputSchema(method, entityName, requestSchema);
|
|
233
|
+
// Add .input(schema) if there are params
|
|
234
|
+
if (inputExpr) {
|
|
235
|
+
chainExpr = b.callExpression(b.memberExpression(cast.toExpr(chainExpr), b.identifier("input")), [cast.toExpr(inputExpr)]);
|
|
236
|
+
}
|
|
237
|
+
// Build the handler: async ({ input }) => { ... }
|
|
238
|
+
const handlerParams = [];
|
|
239
|
+
if (method.params.length > 0) {
|
|
240
|
+
const inputProp = b.objectProperty(b.identifier("input"), b.identifier("input"));
|
|
241
|
+
inputProp.shorthand = true;
|
|
242
|
+
handlerParams.push(inputProp);
|
|
243
|
+
}
|
|
244
|
+
const handlerBody = buildProcedureBody(method);
|
|
245
|
+
const handler = b.arrowFunctionExpression([b.objectPattern(handlerParams)], b.blockStatement(handlerBody.map(cast.toStmt)));
|
|
246
|
+
handler.async = true;
|
|
247
|
+
// Add .query() or .mutation()
|
|
248
|
+
chainExpr = b.callExpression(b.memberExpression(cast.toExpr(chainExpr), b.identifier(procedureType)), [handler]);
|
|
249
|
+
return { procedureExpr: chainExpr, bodySchema, schemaBuilderImport };
|
|
250
|
+
};
|
|
251
|
+
// ============================================================================
|
|
252
|
+
// Plugin Definition
|
|
253
|
+
// ============================================================================
|
|
254
|
+
/**
|
|
255
|
+
* Create an http-trpc provider that generates tRPC routers.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* import { httpTrpc } from "pg-sourcerer"
|
|
260
|
+
*
|
|
261
|
+
* export default defineConfig({
|
|
262
|
+
* plugins: [
|
|
263
|
+
* zod(),
|
|
264
|
+
* sqlQueries(),
|
|
265
|
+
* httpTrpc({
|
|
266
|
+
* header: `import { router, publicProcedure } from "../trpc.js";`,
|
|
267
|
+
* }),
|
|
268
|
+
* ],
|
|
269
|
+
* })
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
export function httpTrpc(config) {
|
|
273
|
+
const parsed = S.decodeUnknownSync(HttpTrpcConfigSchema)(config);
|
|
274
|
+
return definePlugin({
|
|
275
|
+
name: "http-trpc",
|
|
276
|
+
kind: "http-routes",
|
|
277
|
+
singleton: true,
|
|
278
|
+
canProvide: () => true,
|
|
279
|
+
requires: () => [
|
|
280
|
+
{ kind: "queries", params: {} },
|
|
281
|
+
{ kind: "schemas", params: {} },
|
|
282
|
+
],
|
|
283
|
+
provide: (_params, _deps, ctx) => {
|
|
284
|
+
const { outputDir, baseProcedure, header, aggregatorName } = parsed;
|
|
285
|
+
// Get all entities with registered query methods
|
|
286
|
+
const entityNames = ctx.symbols.getEntitiesWithMethods();
|
|
287
|
+
if (entityNames.length === 0) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
// Track generated routers for aggregator
|
|
291
|
+
const generatedRouters = [];
|
|
292
|
+
// Create schema builder function
|
|
293
|
+
const requestSchema = (params) => {
|
|
294
|
+
if (params.length === 0)
|
|
295
|
+
return undefined;
|
|
296
|
+
try {
|
|
297
|
+
const request = { variant: "params", params };
|
|
298
|
+
return ctx.request(SCHEMA_BUILDER_KIND, request);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
// Generate router for each entity
|
|
305
|
+
for (const entityName of entityNames) {
|
|
306
|
+
const entityMethods = ctx.symbols.getEntityMethods(entityName);
|
|
307
|
+
if (!entityMethods || entityMethods.methods.length === 0)
|
|
308
|
+
continue;
|
|
309
|
+
const filePath = `${outputDir}/${inflect.uncapitalize(entityName)}.ts`;
|
|
310
|
+
const routerName = `${inflect.uncapitalize(entityName)}Router`;
|
|
311
|
+
const file = ctx.file(filePath);
|
|
312
|
+
// Header provides router and baseProcedure imports
|
|
313
|
+
file.header(header);
|
|
314
|
+
// Import query functions
|
|
315
|
+
const queryFunctionNames = entityMethods.methods.map((m) => m.name);
|
|
316
|
+
const queriesImportPath = `../${entityMethods.importPath.replace(/\.ts$/, ".js")}`;
|
|
317
|
+
file.import({
|
|
318
|
+
kind: "relative",
|
|
319
|
+
names: queryFunctionNames,
|
|
320
|
+
from: queriesImportPath,
|
|
321
|
+
});
|
|
322
|
+
// Build router object
|
|
323
|
+
let routerObjBuilder = conjure.obj();
|
|
324
|
+
const bodySchemaImports = [];
|
|
325
|
+
let schemaLibraryImport = null;
|
|
326
|
+
for (const method of entityMethods.methods) {
|
|
327
|
+
const { procedureExpr, bodySchema, schemaBuilderImport } = buildProcedure(method, entityName, baseProcedure, requestSchema);
|
|
328
|
+
if (bodySchema)
|
|
329
|
+
bodySchemaImports.push(bodySchema);
|
|
330
|
+
if (schemaBuilderImport)
|
|
331
|
+
schemaLibraryImport = schemaBuilderImport;
|
|
332
|
+
routerObjBuilder = routerObjBuilder.prop(method.name, procedureExpr);
|
|
333
|
+
}
|
|
334
|
+
// Import schema library if needed
|
|
335
|
+
if (schemaLibraryImport) {
|
|
336
|
+
if (schemaLibraryImport.names) {
|
|
337
|
+
file.import({
|
|
338
|
+
kind: "package",
|
|
339
|
+
names: [...schemaLibraryImport.names],
|
|
340
|
+
from: schemaLibraryImport.from,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
// Import body schemas
|
|
345
|
+
for (const schemaImport of bodySchemaImports) {
|
|
346
|
+
file.import({
|
|
347
|
+
kind: "symbol",
|
|
348
|
+
ref: {
|
|
349
|
+
capability: "schemas",
|
|
350
|
+
entity: schemaImport.entity,
|
|
351
|
+
shape: schemaImport.shape,
|
|
352
|
+
},
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// Build: export const userRouter = router({ ... })
|
|
356
|
+
const routerCall = b.callExpression(b.identifier("router"), [cast.toExpr(routerObjBuilder.build())]);
|
|
357
|
+
const exportStmt = conjure.export.const(routerName, routerCall);
|
|
358
|
+
file.ast(conjure.program(exportStmt)).emit();
|
|
359
|
+
generatedRouters.push({
|
|
360
|
+
fileName: `${inflect.uncapitalize(entityName)}.js`,
|
|
361
|
+
routerName,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
// Generate aggregator index.ts
|
|
365
|
+
if (generatedRouters.length > 0) {
|
|
366
|
+
const indexPath = `${outputDir}/index.ts`;
|
|
367
|
+
const indexFile = ctx.file(indexPath);
|
|
368
|
+
// Header provides router import
|
|
369
|
+
indexFile.header(header);
|
|
370
|
+
for (const route of generatedRouters) {
|
|
371
|
+
indexFile.import({
|
|
372
|
+
kind: "relative",
|
|
373
|
+
names: [route.routerName],
|
|
374
|
+
from: `./${route.fileName}`,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
// Build: export const appRouter = router({ user: userRouter, ... })
|
|
378
|
+
let routerObjBuilder = conjure.obj();
|
|
379
|
+
for (const route of generatedRouters) {
|
|
380
|
+
const key = route.routerName.replace(/Router$/, "");
|
|
381
|
+
routerObjBuilder = routerObjBuilder.prop(key, b.identifier(route.routerName));
|
|
382
|
+
}
|
|
383
|
+
const routerCall = b.callExpression(b.identifier("router"), [cast.toExpr(routerObjBuilder.build())]);
|
|
384
|
+
const exportStmt = conjure.export.const(aggregatorName, routerCall);
|
|
385
|
+
// Also export the type
|
|
386
|
+
const typeExport = b.exportNamedDeclaration(b.tsTypeAliasDeclaration(b.identifier("AppRouter"), b.tsTypeQuery(b.identifier(aggregatorName))));
|
|
387
|
+
indexFile.ast(conjure.program(exportStmt, typeExport)).emit();
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
//# sourceMappingURL=http-trpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-trpc.js","sourceRoot":"","sources":["../../src/plugins/http-trpc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,YAAY,EAAsB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EACL,mBAAmB,GAGpB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC;AAEtB,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,mEAAmE;IACnE,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;IAE9D;;;;;;;;OAQG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM;IAEhB;;;;OAIG;IACH,aAAa,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAE7E,iEAAiE;IACjE,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;CACzE,CAAC,CAAC;AAKH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,iDAAiD;A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C;oBACrC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;oBACpD,gBAAgB,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;gBAChF,CAAC;gBAED,MAAM,UAAU,GAAG,CAAC,CAAC,cAAc,CACjC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EACtB,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CACxC,CAAC;gBACF,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;gBAEpE,uBAAuB;gBACvB,MAAM,UAAU,GAAG,CAAC,CAAC,sBAAsB,CACzC,CAAC,CAAC,sBAAsB,CACtB,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,EACzB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAC5C,CACF,CAAC;gBAEF,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAChE,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { SimplePluginContext } from "../../services/plugin.js";
|
|
2
|
+
/**
|
|
3
|
+
* Function to generate export names for CRUD/lookup methods.
|
|
4
|
+
* @param entityName - PascalCase entity name (e.g., "User", "Post")
|
|
5
|
+
* @param methodName - PascalCase method name (e.g., "FindById", "Create")
|
|
6
|
+
* @returns The export name (e.g., "UserFindById", "userCreate", "findById")
|
|
7
|
+
*/
|
|
8
|
+
export type ExportNameFn = (entityName: string, methodName: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* User-facing config input with properly typed function options.
|
|
11
|
+
*/
|
|
12
|
+
export interface KyselyQueriesConfigInput {
|
|
13
|
+
readonly outputDir?: string;
|
|
14
|
+
readonly dbTypesPath?: string;
|
|
15
|
+
readonly executeQueries?: boolean;
|
|
16
|
+
readonly generateListMany?: boolean;
|
|
17
|
+
readonly generateFunctions?: boolean;
|
|
18
|
+
readonly functionsFile?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Custom export name function for CRUD/lookup methods.
|
|
21
|
+
* @default (_entityName, methodName) => camelCase(methodName)
|
|
22
|
+
* @example
|
|
23
|
+
* // PascalCase prefix: "UserFindById", "UserCreate"
|
|
24
|
+
* exportName: (entity, method) => entity + method
|
|
25
|
+
*
|
|
26
|
+
* // camelCase prefix: "userFindById", "userCreate"
|
|
27
|
+
* exportName: (entity, method) => entity.toLowerCase() + method
|
|
28
|
+
*/
|
|
29
|
+
readonly exportName?: ExportNameFn;
|
|
30
|
+
/**
|
|
31
|
+
* Export style for generated query functions.
|
|
32
|
+
* - "flat": Individual exports (e.g., `export const findById = ...`)
|
|
33
|
+
* - "namespace": Single object export (e.g., `export const User = { findById: ... }`)
|
|
34
|
+
* @default "flat"
|
|
35
|
+
*/
|
|
36
|
+
readonly exportStyle?: "flat" | "namespace";
|
|
37
|
+
/**
|
|
38
|
+
* Use explicit column lists instead of .selectAll().
|
|
39
|
+
* When true, generates .select(['col1', 'col2']) which excludes omitted fields at runtime.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
readonly explicitColumns?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to pass db as first parameter to each function.
|
|
45
|
+
* When true (default), functions take `db: Kysely<DB>` as first arg.
|
|
46
|
+
* When false, functions use a module-level `db` variable - use `header`
|
|
47
|
+
* to provide the import statement.
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
readonly dbAsParameter?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Header content to prepend to each generated file.
|
|
53
|
+
* Use this to provide imports when dbAsParameter is false.
|
|
54
|
+
* Example: `import { db } from "../db.js"`
|
|
55
|
+
*/
|
|
56
|
+
readonly header?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Default limit for listMany queries.
|
|
59
|
+
* @default 50
|
|
60
|
+
*/
|
|
61
|
+
readonly defaultLimit?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Configuration for Kysely queries generation (exported for unified plugin).
|
|
65
|
+
* All fields are required; the caller applies defaults.
|
|
66
|
+
*/
|
|
67
|
+
export interface KyselyQueriesConfig {
|
|
68
|
+
readonly outputDir: string;
|
|
69
|
+
readonly dbTypesPath: string;
|
|
70
|
+
readonly executeQueries: boolean;
|
|
71
|
+
readonly generateListMany: boolean;
|
|
72
|
+
readonly generateFunctions: boolean;
|
|
73
|
+
readonly functionsFile: string;
|
|
74
|
+
readonly exportName: ExportNameFn;
|
|
75
|
+
readonly exportStyle: "flat" | "namespace";
|
|
76
|
+
readonly explicitColumns: boolean;
|
|
77
|
+
readonly dbAsParameter: boolean;
|
|
78
|
+
readonly header?: string;
|
|
79
|
+
readonly defaultLimit: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Generate Kysely query functions from the IR.
|
|
83
|
+
*
|
|
84
|
+
* This is the core generation logic, extracted for use by both:
|
|
85
|
+
* - The standalone kyselyQueriesPlugin
|
|
86
|
+
* - The unified kyselyPlugin
|
|
87
|
+
*
|
|
88
|
+
* @param ctx - Plugin context for file emission and services
|
|
89
|
+
* @param config - Queries configuration (with defaults applied)
|
|
90
|
+
*/
|
|
91
|
+
export declare function generateKyselyQueries(ctx: SimplePluginContext, config?: Partial<KyselyQueriesConfig>): void;
|
|
92
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/plugins/kysely/queries.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,M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