postgresdk 0.18.29 → 0.18.30
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 +7 -5
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2712,7 +2712,7 @@ function emitIncludeResolver(graph, useJsExtensions) {
|
|
|
2712
2712
|
const edges = graph[table] || {};
|
|
2713
2713
|
const edgeEntries = Object.entries(edges);
|
|
2714
2714
|
if (edgeEntries.length === 0) {
|
|
2715
|
-
out += `export type ${Type}WithIncludes<
|
|
2715
|
+
out += `export type ${Type}WithIncludes<_TInclude extends ${Type}IncludeSpec> = Select${Type};
|
|
2716
2716
|
|
|
2717
2717
|
`;
|
|
2718
2718
|
continue;
|
|
@@ -3343,15 +3343,19 @@ function emitClient(table, graph, opts, model) {
|
|
|
3343
3343
|
skipJunctionTables: opts.skipJunctionTables ?? true
|
|
3344
3344
|
}, allTables);
|
|
3345
3345
|
const importedTypes = new Set;
|
|
3346
|
+
const usedIncludeSpecTypes = new Set([table.name]);
|
|
3346
3347
|
importedTypes.add(table.name);
|
|
3347
3348
|
for (const method of includeMethods) {
|
|
3348
3349
|
for (const target of method.targets) {
|
|
3349
3350
|
importedTypes.add(target);
|
|
3350
3351
|
}
|
|
3352
|
+
const pattern = analyzeIncludeSpec(method.includeSpec);
|
|
3353
|
+
if (pattern.type === "nested" && method.targets[0]) {
|
|
3354
|
+
usedIncludeSpecTypes.add(method.targets[0]);
|
|
3355
|
+
}
|
|
3351
3356
|
}
|
|
3352
3357
|
const typeImports = `import type { Insert${Type}, Update${Type}, Select${Type} } from "./types/${table.name}${ext}";`;
|
|
3353
|
-
const
|
|
3354
|
-
const includeSpecImport = `import type { ${includeSpecTypes.map((t) => `${pascal(t)}IncludeSpec`).join(", ")} } from "./include-spec${ext}";`;
|
|
3358
|
+
const includeSpecImport = `import type { ${Array.from(usedIncludeSpecTypes).map((t) => `${pascal(t)}IncludeSpec`).join(", ")} } from "./include-spec${ext}";`;
|
|
3355
3359
|
const includeResolverImport = `import type { ${Type}WithIncludes } from "./include-resolver${ext}";`;
|
|
3356
3360
|
const otherTableImports = [];
|
|
3357
3361
|
for (const target of Array.from(importedTypes)) {
|
|
@@ -5566,8 +5570,6 @@ function emitCoreOperations() {
|
|
|
5566
5570
|
* These functions handle the actual database logic and can be used by any framework adapter.
|
|
5567
5571
|
*/
|
|
5568
5572
|
|
|
5569
|
-
import type { z } from "zod";
|
|
5570
|
-
|
|
5571
5573
|
export interface DatabaseClient {
|
|
5572
5574
|
query: (text: string, params?: any[]) => Promise<{ rows: any[] }>;
|
|
5573
5575
|
}
|
package/dist/index.js
CHANGED
|
@@ -1733,7 +1733,7 @@ function emitIncludeResolver(graph, useJsExtensions) {
|
|
|
1733
1733
|
const edges = graph[table] || {};
|
|
1734
1734
|
const edgeEntries = Object.entries(edges);
|
|
1735
1735
|
if (edgeEntries.length === 0) {
|
|
1736
|
-
out += `export type ${Type}WithIncludes<
|
|
1736
|
+
out += `export type ${Type}WithIncludes<_TInclude extends ${Type}IncludeSpec> = Select${Type};
|
|
1737
1737
|
|
|
1738
1738
|
`;
|
|
1739
1739
|
continue;
|
|
@@ -2364,15 +2364,19 @@ function emitClient(table, graph, opts, model) {
|
|
|
2364
2364
|
skipJunctionTables: opts.skipJunctionTables ?? true
|
|
2365
2365
|
}, allTables);
|
|
2366
2366
|
const importedTypes = new Set;
|
|
2367
|
+
const usedIncludeSpecTypes = new Set([table.name]);
|
|
2367
2368
|
importedTypes.add(table.name);
|
|
2368
2369
|
for (const method of includeMethods) {
|
|
2369
2370
|
for (const target of method.targets) {
|
|
2370
2371
|
importedTypes.add(target);
|
|
2371
2372
|
}
|
|
2373
|
+
const pattern = analyzeIncludeSpec(method.includeSpec);
|
|
2374
|
+
if (pattern.type === "nested" && method.targets[0]) {
|
|
2375
|
+
usedIncludeSpecTypes.add(method.targets[0]);
|
|
2376
|
+
}
|
|
2372
2377
|
}
|
|
2373
2378
|
const typeImports = `import type { Insert${Type}, Update${Type}, Select${Type} } from "./types/${table.name}${ext}";`;
|
|
2374
|
-
const
|
|
2375
|
-
const includeSpecImport = `import type { ${includeSpecTypes.map((t) => `${pascal(t)}IncludeSpec`).join(", ")} } from "./include-spec${ext}";`;
|
|
2379
|
+
const includeSpecImport = `import type { ${Array.from(usedIncludeSpecTypes).map((t) => `${pascal(t)}IncludeSpec`).join(", ")} } from "./include-spec${ext}";`;
|
|
2376
2380
|
const includeResolverImport = `import type { ${Type}WithIncludes } from "./include-resolver${ext}";`;
|
|
2377
2381
|
const otherTableImports = [];
|
|
2378
2382
|
for (const target of Array.from(importedTypes)) {
|
|
@@ -4587,8 +4591,6 @@ function emitCoreOperations() {
|
|
|
4587
4591
|
* These functions handle the actual database logic and can be used by any framework adapter.
|
|
4588
4592
|
*/
|
|
4589
4593
|
|
|
4590
|
-
import type { z } from "zod";
|
|
4591
|
-
|
|
4592
4594
|
export interface DatabaseClient {
|
|
4593
4595
|
query: (text: string, params?: any[]) => Promise<{ rows: any[] }>;
|
|
4594
4596
|
}
|