postgresdk 0.7.0 → 0.7.1

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.
Files changed (3) hide show
  1. package/dist/cli.js +12 -22
  2. package/dist/index.js +12 -22
  3. package/package.json +2 -1
package/dist/cli.js CHANGED
@@ -1685,9 +1685,6 @@ ${fields}
1685
1685
  });
1686
1686
 
1687
1687
  export const Update${Type}Schema = Insert${Type}Schema.partial();
1688
-
1689
- export type Insert${Type} = z.infer<typeof Insert${Type}Schema>;
1690
- export type Update${Type} = z.infer<typeof Update${Type}Schema>;
1691
1688
  `;
1692
1689
  }
1693
1690
 
@@ -1916,9 +1913,7 @@ function emitClientIndex(tables, useJsExtensions) {
1916
1913
  `;
1917
1914
  }
1918
1915
  out += `
1919
- // Re-export auth types for convenience
1920
- `;
1921
- out += `export type { AuthConfig as SDKAuth, AuthConfig, HeaderMap, AuthHeadersProvider } from "./base-client${ext}";
1916
+ export type { AuthConfig, HeaderMap, AuthHeadersProvider } from "./base-client${ext}";
1922
1917
 
1923
1918
  `;
1924
1919
  out += `/**
@@ -1946,23 +1941,18 @@ function emitClientIndex(tables, useJsExtensions) {
1946
1941
  `;
1947
1942
  out += `}
1948
1943
 
1949
- `;
1950
- out += `// Export individual table clients
1951
- `;
1952
- for (const t of tables) {
1953
- out += `export { ${pascal(t.name)}Client } from "./${t.name}${ext}";
1954
- `;
1955
- }
1956
- out += `
1957
- // Export base client for custom extensions
1958
1944
  `;
1959
1945
  out += `export { BaseClient } from "./base-client${ext}";
1946
+ `;
1947
+ out += `export * from "./include-spec${ext}";
1960
1948
  `;
1961
1949
  out += `
1962
- // Export include specifications
1950
+ // Zod schemas for form validation
1963
1951
  `;
1964
- out += `export * from "./include-spec${ext}";
1952
+ for (const t of tables) {
1953
+ out += `export { Insert${pascal(t.name)}Schema, Update${pascal(t.name)}Schema } from "./zod/${t.name}${ext}";
1965
1954
  `;
1955
+ }
1966
1956
  return out;
1967
1957
  }
1968
1958
 
@@ -3778,7 +3768,8 @@ async function generate(configPath) {
3778
3768
  join(serverDir, "zod"),
3779
3769
  join(serverDir, "routes"),
3780
3770
  clientDir,
3781
- join(clientDir, "types")
3771
+ join(clientDir, "types"),
3772
+ join(clientDir, "zod")
3782
3773
  ];
3783
3774
  if (generateTests) {
3784
3775
  dirs.push(testDir);
@@ -3812,10 +3803,9 @@ async function generate(configPath) {
3812
3803
  const typesSrc = emitTypes(table, { numericMode: "string" });
3813
3804
  files.push({ path: join(serverDir, "types", `${table.name}.ts`), content: typesSrc });
3814
3805
  files.push({ path: join(clientDir, "types", `${table.name}.ts`), content: typesSrc });
3815
- files.push({
3816
- path: join(serverDir, "zod", `${table.name}.ts`),
3817
- content: emitZod(table, { numericMode: "string" })
3818
- });
3806
+ const zodSrc = emitZod(table, { numericMode: "string" });
3807
+ files.push({ path: join(serverDir, "zod", `${table.name}.ts`), content: zodSrc });
3808
+ files.push({ path: join(clientDir, "zod", `${table.name}.ts`), content: zodSrc });
3819
3809
  let routeContent;
3820
3810
  if (serverFramework === "hono") {
3821
3811
  routeContent = emitHonoRoutes(table, graph, {
package/dist/index.js CHANGED
@@ -1422,9 +1422,6 @@ ${fields}
1422
1422
  });
1423
1423
 
1424
1424
  export const Update${Type}Schema = Insert${Type}Schema.partial();
1425
-
1426
- export type Insert${Type} = z.infer<typeof Insert${Type}Schema>;
1427
- export type Update${Type} = z.infer<typeof Update${Type}Schema>;
1428
1425
  `;
1429
1426
  }
1430
1427
 
@@ -1653,9 +1650,7 @@ function emitClientIndex(tables, useJsExtensions) {
1653
1650
  `;
1654
1651
  }
1655
1652
  out += `
1656
- // Re-export auth types for convenience
1657
- `;
1658
- out += `export type { AuthConfig as SDKAuth, AuthConfig, HeaderMap, AuthHeadersProvider } from "./base-client${ext}";
1653
+ export type { AuthConfig, HeaderMap, AuthHeadersProvider } from "./base-client${ext}";
1659
1654
 
1660
1655
  `;
1661
1656
  out += `/**
@@ -1683,23 +1678,18 @@ function emitClientIndex(tables, useJsExtensions) {
1683
1678
  `;
1684
1679
  out += `}
1685
1680
 
1686
- `;
1687
- out += `// Export individual table clients
1688
- `;
1689
- for (const t of tables) {
1690
- out += `export { ${pascal(t.name)}Client } from "./${t.name}${ext}";
1691
- `;
1692
- }
1693
- out += `
1694
- // Export base client for custom extensions
1695
1681
  `;
1696
1682
  out += `export { BaseClient } from "./base-client${ext}";
1683
+ `;
1684
+ out += `export * from "./include-spec${ext}";
1697
1685
  `;
1698
1686
  out += `
1699
- // Export include specifications
1687
+ // Zod schemas for form validation
1700
1688
  `;
1701
- out += `export * from "./include-spec${ext}";
1689
+ for (const t of tables) {
1690
+ out += `export { Insert${pascal(t.name)}Schema, Update${pascal(t.name)}Schema } from "./zod/${t.name}${ext}";
1702
1691
  `;
1692
+ }
1703
1693
  return out;
1704
1694
  }
1705
1695
 
@@ -3515,7 +3505,8 @@ async function generate(configPath) {
3515
3505
  join(serverDir, "zod"),
3516
3506
  join(serverDir, "routes"),
3517
3507
  clientDir,
3518
- join(clientDir, "types")
3508
+ join(clientDir, "types"),
3509
+ join(clientDir, "zod")
3519
3510
  ];
3520
3511
  if (generateTests) {
3521
3512
  dirs.push(testDir);
@@ -3549,10 +3540,9 @@ async function generate(configPath) {
3549
3540
  const typesSrc = emitTypes(table, { numericMode: "string" });
3550
3541
  files.push({ path: join(serverDir, "types", `${table.name}.ts`), content: typesSrc });
3551
3542
  files.push({ path: join(clientDir, "types", `${table.name}.ts`), content: typesSrc });
3552
- files.push({
3553
- path: join(serverDir, "zod", `${table.name}.ts`),
3554
- content: emitZod(table, { numericMode: "string" })
3555
- });
3543
+ const zodSrc = emitZod(table, { numericMode: "string" });
3544
+ files.push({ path: join(serverDir, "zod", `${table.name}.ts`), content: zodSrc });
3545
+ files.push({ path: join(clientDir, "zod", `${table.name}.ts`), content: zodSrc });
3556
3546
  let routeContent;
3557
3547
  if (serverFramework === "hono") {
3558
3548
  routeContent = emitHonoRoutes(table, graph, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresdk",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Generate a typed server/client SDK from a Postgres schema (includes, Zod, Hono).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "zod": "^4.0.15"
43
43
  },
44
44
  "devDependencies": {
45
+ "@types/bun": "^1.2.20",
45
46
  "@types/node": "^20.0.0",
46
47
  "@types/pg": "^8.15.5",
47
48
  "drizzle-kit": "^0.31.4",