postgresdk 0.18.2 → 0.18.3

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/cache.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface CacheData {
14
14
  }
15
15
  /**
16
16
  * Compute a deterministic hash of the schema and config
17
+ * Includes postgresdk version to trigger regeneration on upgrades
17
18
  */
18
19
  export declare function computeSchemaHash(model: Model, config: Config): string;
19
20
  /**
package/dist/cli.js CHANGED
@@ -1689,10 +1689,11 @@ var init_emit_sdk_contract = __esm(() => {
1689
1689
  // src/cache.ts
1690
1690
  import { createHash } from "crypto";
1691
1691
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, appendFile } from "fs/promises";
1692
- import { existsSync } from "fs";
1692
+ import { existsSync, readFileSync } from "fs";
1693
1693
  import { join } from "path";
1694
1694
  function computeSchemaHash(model, config) {
1695
1695
  const payload = {
1696
+ version: POSTGRESDK_VERSION,
1696
1697
  schema: model.schema,
1697
1698
  tables: model.tables,
1698
1699
  enums: model.enums,
@@ -1780,7 +1781,11 @@ async function appendToHistory(entry, baseDir) {
1780
1781
  ${formattedEntry}`, "utf-8");
1781
1782
  }
1782
1783
  }
1783
- var init_cache = () => {};
1784
+ var __dirname = "/workspace/src", packageJson, POSTGRESDK_VERSION;
1785
+ var init_cache = __esm(() => {
1786
+ packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
1787
+ POSTGRESDK_VERSION = packageJson.version;
1788
+ });
1784
1789
 
1785
1790
  // src/cli-config-utils.ts
1786
1791
  function extractConfigFields(configContent) {
@@ -2201,7 +2206,7 @@ var exports_cli_init = {};
2201
2206
  __export(exports_cli_init, {
2202
2207
  initCommand: () => initCommand
2203
2208
  });
2204
- import { existsSync as existsSync3, writeFileSync, readFileSync, copyFileSync } from "fs";
2209
+ import { existsSync as existsSync3, writeFileSync, readFileSync as readFileSync2, copyFileSync } from "fs";
2205
2210
  import { resolve } from "path";
2206
2211
  import prompts from "prompts";
2207
2212
  async function initCommand(args) {
@@ -2219,7 +2224,7 @@ async function initCommand(args) {
2219
2224
  }
2220
2225
  console.log(`⚠️ Found existing postgresdk.config.ts
2221
2226
  `);
2222
- const existingContent = readFileSync(configPath, "utf-8");
2227
+ const existingContent = readFileSync2(configPath, "utf-8");
2223
2228
  const existingFields = extractConfigFields(existingContent);
2224
2229
  console.log("\uD83D\uDCCB Existing configuration detected:");
2225
2230
  existingFields.forEach((field) => {
@@ -7192,13 +7197,13 @@ async function generate(configPath) {
7192
7197
  // src/cli.ts
7193
7198
  var import_config2 = __toESM(require_config(), 1);
7194
7199
  import { resolve as resolve3 } from "node:path";
7195
- import { readFileSync as readFileSync2 } from "node:fs";
7200
+ import { readFileSync as readFileSync3 } from "node:fs";
7196
7201
  import { fileURLToPath } from "node:url";
7197
7202
  import { dirname as dirname4, join as join4 } from "node:path";
7198
7203
  var __filename2 = fileURLToPath(import.meta.url);
7199
7204
  var __dirname2 = dirname4(__filename2);
7200
- var packageJson = JSON.parse(readFileSync2(join4(__dirname2, "../package.json"), "utf-8"));
7201
- var VERSION = packageJson.version;
7205
+ var packageJson2 = JSON.parse(readFileSync3(join4(__dirname2, "../package.json"), "utf-8"));
7206
+ var VERSION = packageJson2.version;
7202
7207
  var args = process.argv.slice(2);
7203
7208
  var command = args[0];
7204
7209
  if (args.includes("--version") || args.includes("-v") || command === "version") {
package/dist/index.js CHANGED
@@ -1688,10 +1688,11 @@ var init_emit_sdk_contract = __esm(() => {
1688
1688
  // src/cache.ts
1689
1689
  import { createHash } from "crypto";
1690
1690
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, appendFile } from "fs/promises";
1691
- import { existsSync } from "fs";
1691
+ import { existsSync, readFileSync } from "fs";
1692
1692
  import { join } from "path";
1693
1693
  function computeSchemaHash(model, config) {
1694
1694
  const payload = {
1695
+ version: POSTGRESDK_VERSION,
1695
1696
  schema: model.schema,
1696
1697
  tables: model.tables,
1697
1698
  enums: model.enums,
@@ -1779,7 +1780,11 @@ async function appendToHistory(entry, baseDir) {
1779
1780
  ${formattedEntry}`, "utf-8");
1780
1781
  }
1781
1782
  }
1782
- var init_cache = () => {};
1783
+ var __dirname = "/workspace/src", packageJson, POSTGRESDK_VERSION;
1784
+ var init_cache = __esm(() => {
1785
+ packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
1786
+ POSTGRESDK_VERSION = packageJson.version;
1787
+ });
1783
1788
 
1784
1789
  // src/index.ts
1785
1790
  var import_config = __toESM(require_config(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresdk",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "description": "Generate a typed server/client SDK from a Postgres schema (includes, Zod, Hono).",
5
5
  "type": "module",
6
6
  "bin": {