postgresdk 0.18.10 → 0.18.11

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 CHANGED
@@ -2119,7 +2119,7 @@ var exports_cli_init = {};
2119
2119
  __export(exports_cli_init, {
2120
2120
  initCommand: () => initCommand
2121
2121
  });
2122
- import { existsSync as existsSync3, writeFileSync, readFileSync, copyFileSync } from "fs";
2122
+ import { existsSync as existsSync3, writeFileSync, readFileSync as readFileSync2, copyFileSync } from "fs";
2123
2123
  import { resolve } from "path";
2124
2124
  import prompts from "prompts";
2125
2125
  async function initCommand(args) {
@@ -2137,7 +2137,7 @@ async function initCommand(args) {
2137
2137
  }
2138
2138
  console.log(`⚠️ Found existing postgresdk.config.ts
2139
2139
  `);
2140
- const existingContent = readFileSync(configPath, "utf-8");
2140
+ const existingContent = readFileSync2(configPath, "utf-8");
2141
2141
  const existingFields = extractConfigFields(existingContent);
2142
2142
  console.log("\uD83D\uDCCB Existing configuration detected:");
2143
2143
  existingFields.forEach((field) => {
@@ -2529,7 +2529,7 @@ __export(exports_cli_pull, {
2529
2529
  pullCommand: () => pullCommand
2530
2530
  });
2531
2531
  import { writeFile as writeFile2, mkdir as mkdir2, readFile as readFile2 } from "fs/promises";
2532
- import { join as join2, dirname as dirname2, resolve as resolve2 } from "path";
2532
+ import { join as join2, dirname as dirname3, resolve as resolve2 } from "path";
2533
2533
  import { existsSync as existsSync4 } from "fs";
2534
2534
  import { pathToFileURL as pathToFileURL2 } from "url";
2535
2535
  async function pullCommand(args) {
@@ -2616,7 +2616,7 @@ Options:`);
2616
2616
  const changedFiles = [];
2617
2617
  for (const [path, content] of Object.entries(sdk.files)) {
2618
2618
  const fullPath = join2(config.output, path);
2619
- await mkdir2(dirname2(fullPath), { recursive: true });
2619
+ await mkdir2(dirname3(fullPath), { recursive: true });
2620
2620
  let shouldWrite = true;
2621
2621
  if (existsSync4(fullPath)) {
2622
2622
  const existing = await readFile2(fullPath, "utf-8");
@@ -2662,9 +2662,9 @@ var init_cli_pull = () => {};
2662
2662
 
2663
2663
  // src/index.ts
2664
2664
  var import_config = __toESM(require_config(), 1);
2665
- import { join, relative } from "node:path";
2666
- import { pathToFileURL } from "node:url";
2667
- import { existsSync as existsSync2 } from "node:fs";
2665
+ import { join, relative, dirname as dirname2 } from "node:path";
2666
+ import { pathToFileURL, fileURLToPath } from "node:url";
2667
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
2668
2668
 
2669
2669
  // src/introspect.ts
2670
2670
  import { Client } from "pg";
@@ -2935,9 +2935,10 @@ function emitIncludeResolver(graph, useJsExtensions) {
2935
2935
  Select${Type} & {
2936
2936
  [K in keyof TInclude as TInclude[K] extends false | undefined ? never : K]:`;
2937
2937
  for (let i = 0;i < edgeEntries.length; i++) {
2938
- const [relKey, edge] = edgeEntries[i];
2939
- if (!relKey || !edge)
2938
+ const entry = edgeEntries[i];
2939
+ if (!entry)
2940
2940
  continue;
2941
+ const [relKey, edge] = entry;
2941
2942
  const targetType = pascal(edge.target);
2942
2943
  const isLast = i === edgeEntries.length - 1;
2943
2944
  out += `
@@ -5647,7 +5648,7 @@ export * from "./include-spec${ext}";
5647
5648
  }
5648
5649
 
5649
5650
  // src/emit-sdk-bundle.ts
5650
- function emitSdkBundle(clientFiles, clientDir) {
5651
+ function emitSdkBundle(clientFiles, clientDir, version) {
5651
5652
  const files = {};
5652
5653
  for (const file of clientFiles) {
5653
5654
  const normalizedClientDir = clientDir.replace(/\\/g, "/");
@@ -5657,7 +5658,6 @@ function emitSdkBundle(clientFiles, clientDir) {
5657
5658
  files[relativePath] = file.content;
5658
5659
  }
5659
5660
  }
5660
- const version = `1.0.0`;
5661
5661
  return `/**
5662
5662
  * AUTO-GENERATED FILE - DO NOT EDIT
5663
5663
  *
@@ -7131,6 +7131,9 @@ function generateTestCases(table, sampleData, updateData, hasForeignKeys = false
7131
7131
  // src/index.ts
7132
7132
  init_emit_sdk_contract();
7133
7133
  init_utils();
7134
+ var __filename2 = fileURLToPath(import.meta.url);
7135
+ var __dirname2 = dirname2(__filename2);
7136
+ var { version: CLI_VERSION } = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
7134
7137
  async function generate(configPath) {
7135
7138
  if (!existsSync2(configPath)) {
7136
7139
  throw new Error(`Config file not found: ${configPath}
@@ -7143,6 +7146,7 @@ async function generate(configPath) {
7143
7146
  const rawCfg = module.default || module;
7144
7147
  const normalizedAuth = normalizeAuthConfig(rawCfg.auth);
7145
7148
  const cfg = { ...rawCfg, auth: normalizedAuth };
7149
+ console.log(`\uD83D\uDCE6 postgresdk v${CLI_VERSION}`);
7146
7150
  console.log("\uD83D\uDD0D Introspecting database...");
7147
7151
  const model = await introspect(cfg.connectionString, cfg.schema || "public");
7148
7152
  console.log("\uD83D\uDD17 Building relationship graph...");
@@ -7284,7 +7288,7 @@ async function generate(configPath) {
7284
7288
  });
7285
7289
  files.push({
7286
7290
  path: join(serverDir, "sdk-bundle.ts"),
7287
- content: emitSdkBundle(clientFiles, clientDir)
7291
+ content: emitSdkBundle(clientFiles, clientDir, CLI_VERSION)
7288
7292
  });
7289
7293
  if (generateTests) {
7290
7294
  console.log("\uD83E\uDDEA Generating tests...");
@@ -7360,12 +7364,12 @@ async function generate(configPath) {
7360
7364
  // src/cli.ts
7361
7365
  var import_config2 = __toESM(require_config(), 1);
7362
7366
  import { resolve as resolve3 } from "node:path";
7363
- import { readFileSync as readFileSync2 } from "node:fs";
7364
- import { fileURLToPath } from "node:url";
7365
- import { dirname as dirname3, join as join3 } from "node:path";
7366
- var __filename2 = fileURLToPath(import.meta.url);
7367
- var __dirname2 = dirname3(__filename2);
7368
- var packageJson = JSON.parse(readFileSync2(join3(__dirname2, "../package.json"), "utf-8"));
7367
+ import { readFileSync as readFileSync3 } from "node:fs";
7368
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
7369
+ import { dirname as dirname4, join as join3 } from "node:path";
7370
+ var __filename3 = fileURLToPath2(import.meta.url);
7371
+ var __dirname3 = dirname4(__filename3);
7372
+ var packageJson = JSON.parse(readFileSync3(join3(__dirname3, "../package.json"), "utf-8"));
7369
7373
  var VERSION = packageJson.version;
7370
7374
  var args = process.argv.slice(2);
7371
7375
  var command = args[0];
@@ -5,4 +5,4 @@
5
5
  export declare function emitSdkBundle(clientFiles: {
6
6
  path: string;
7
7
  content: string;
8
- }[], clientDir: string): string;
8
+ }[], clientDir: string, version: string): string;
package/dist/index.js CHANGED
@@ -1701,9 +1701,9 @@ var init_emit_sdk_contract = __esm(() => {
1701
1701
 
1702
1702
  // src/index.ts
1703
1703
  var import_config = __toESM(require_config(), 1);
1704
- import { join, relative } from "node:path";
1705
- import { pathToFileURL } from "node:url";
1706
- import { existsSync as existsSync2 } from "node:fs";
1704
+ import { join, relative, dirname as dirname2 } from "node:path";
1705
+ import { pathToFileURL, fileURLToPath } from "node:url";
1706
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
1707
1707
 
1708
1708
  // src/introspect.ts
1709
1709
  import { Client } from "pg";
@@ -1974,9 +1974,10 @@ function emitIncludeResolver(graph, useJsExtensions) {
1974
1974
  Select${Type} & {
1975
1975
  [K in keyof TInclude as TInclude[K] extends false | undefined ? never : K]:`;
1976
1976
  for (let i = 0;i < edgeEntries.length; i++) {
1977
- const [relKey, edge] = edgeEntries[i];
1978
- if (!relKey || !edge)
1977
+ const entry = edgeEntries[i];
1978
+ if (!entry)
1979
1979
  continue;
1980
+ const [relKey, edge] = entry;
1980
1981
  const targetType = pascal(edge.target);
1981
1982
  const isLast = i === edgeEntries.length - 1;
1982
1983
  out += `
@@ -4686,7 +4687,7 @@ export * from "./include-spec${ext}";
4686
4687
  }
4687
4688
 
4688
4689
  // src/emit-sdk-bundle.ts
4689
- function emitSdkBundle(clientFiles, clientDir) {
4690
+ function emitSdkBundle(clientFiles, clientDir, version) {
4690
4691
  const files = {};
4691
4692
  for (const file of clientFiles) {
4692
4693
  const normalizedClientDir = clientDir.replace(/\\/g, "/");
@@ -4696,7 +4697,6 @@ function emitSdkBundle(clientFiles, clientDir) {
4696
4697
  files[relativePath] = file.content;
4697
4698
  }
4698
4699
  }
4699
- const version = `1.0.0`;
4700
4700
  return `/**
4701
4701
  * AUTO-GENERATED FILE - DO NOT EDIT
4702
4702
  *
@@ -6170,6 +6170,9 @@ function generateTestCases(table, sampleData, updateData, hasForeignKeys = false
6170
6170
  // src/index.ts
6171
6171
  init_emit_sdk_contract();
6172
6172
  init_utils();
6173
+ var __filename2 = fileURLToPath(import.meta.url);
6174
+ var __dirname2 = dirname2(__filename2);
6175
+ var { version: CLI_VERSION } = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
6173
6176
  async function generate(configPath) {
6174
6177
  if (!existsSync2(configPath)) {
6175
6178
  throw new Error(`Config file not found: ${configPath}
@@ -6182,6 +6185,7 @@ async function generate(configPath) {
6182
6185
  const rawCfg = module.default || module;
6183
6186
  const normalizedAuth = normalizeAuthConfig(rawCfg.auth);
6184
6187
  const cfg = { ...rawCfg, auth: normalizedAuth };
6188
+ console.log(`\uD83D\uDCE6 postgresdk v${CLI_VERSION}`);
6185
6189
  console.log("\uD83D\uDD0D Introspecting database...");
6186
6190
  const model = await introspect(cfg.connectionString, cfg.schema || "public");
6187
6191
  console.log("\uD83D\uDD17 Building relationship graph...");
@@ -6323,7 +6327,7 @@ async function generate(configPath) {
6323
6327
  });
6324
6328
  files.push({
6325
6329
  path: join(serverDir, "sdk-bundle.ts"),
6326
- content: emitSdkBundle(clientFiles, clientDir)
6330
+ content: emitSdkBundle(clientFiles, clientDir, CLI_VERSION)
6327
6331
  });
6328
6332
  if (generateTests) {
6329
6333
  console.log("\uD83E\uDDEA Generating tests...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresdk",
3
- "version": "0.18.10",
3
+ "version": "0.18.11",
4
4
  "description": "Generate a typed server/client SDK from a Postgres schema (includes, Zod, Hono).",
5
5
  "type": "module",
6
6
  "bin": {