postgresdk 0.16.1 → 0.16.2

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
@@ -2940,9 +2940,14 @@ export interface PaginatedResponse<T> {
2940
2940
 
2941
2941
  // src/emit-routes-hono.ts
2942
2942
  init_utils();
2943
+ function isVectorType(pgType) {
2944
+ const t = pgType.toLowerCase();
2945
+ return t === "vector" || t === "halfvec" || t === "sparsevec" || t === "bit";
2946
+ }
2943
2947
  function emitHonoRoutes(table, _graph, opts) {
2944
2948
  const fileTableName = table.name;
2945
2949
  const Type = pascal(table.name);
2950
+ const hasVectorColumns = table.columns.some((c) => isVectorType(c.pgType));
2946
2951
  const rawPk = table.pk;
2947
2952
  const pkCols = Array.isArray(rawPk) ? rawPk : rawPk ? [rawPk] : [];
2948
2953
  const safePkCols = pkCols.length ? pkCols : ["id"];
@@ -2978,13 +2983,13 @@ const listSchema = z.object({
2978
2983
  limit: z.number().int().positive().max(1000).optional(),
2979
2984
  offset: z.number().int().min(0).optional(),
2980
2985
  orderBy: z.union([columnEnum, z.array(columnEnum)]).optional(),
2981
- order: z.union([z.enum(["asc", "desc"]), z.array(z.enum(["asc", "desc"]))]).optional(),
2986
+ order: z.union([z.enum(["asc", "desc"]), z.array(z.enum(["asc", "desc"]))]).optional(),${hasVectorColumns ? `
2982
2987
  vector: z.object({
2983
2988
  field: z.string(),
2984
2989
  query: z.array(z.number()),
2985
2990
  metric: z.enum(["cosine", "l2", "inner"]).optional(),
2986
2991
  maxDistance: z.number().optional()
2987
- }).optional()
2992
+ }).optional()` : ""}
2988
2993
  });
2989
2994
 
2990
2995
  /**
@@ -3166,14 +3171,20 @@ ${hasAuth ? `
3166
3171
  // src/emit-client.ts
3167
3172
  init_utils();
3168
3173
  init_emit_include_methods();
3169
- function isVectorType(pgType) {
3174
+ function isVectorType2(pgType) {
3170
3175
  const t = pgType.toLowerCase();
3171
3176
  return t === "vector" || t === "halfvec" || t === "sparsevec" || t === "bit";
3172
3177
  }
3173
3178
  function emitClient(table, graph, opts, model) {
3174
3179
  const Type = pascal(table.name);
3175
3180
  const ext = opts.useJsExtensions ? ".js" : "";
3176
- const hasVectorColumns = table.columns.some((c) => isVectorType(c.pgType));
3181
+ const hasVectorColumns = table.columns.some((c) => isVectorType2(c.pgType));
3182
+ if (process.env.SDK_DEBUG) {
3183
+ const vectorCols = table.columns.filter((c) => isVectorType2(c.pgType));
3184
+ if (vectorCols.length > 0) {
3185
+ console.log(`[DEBUG] Table ${table.name}: Found ${vectorCols.length} vector columns:`, vectorCols.map((c) => `${c.name} (${c.pgType})`));
3186
+ }
3187
+ }
3177
3188
  const pkCols = Array.isArray(table.pk) ? table.pk : table.pk ? [table.pk] : [];
3178
3189
  const safePk = pkCols.length ? pkCols : ["id"];
3179
3190
  const hasCompositePk = safePk.length > 1;
package/dist/index.js CHANGED
@@ -2111,9 +2111,14 @@ export interface PaginatedResponse<T> {
2111
2111
 
2112
2112
  // src/emit-routes-hono.ts
2113
2113
  init_utils();
2114
+ function isVectorType(pgType) {
2115
+ const t = pgType.toLowerCase();
2116
+ return t === "vector" || t === "halfvec" || t === "sparsevec" || t === "bit";
2117
+ }
2114
2118
  function emitHonoRoutes(table, _graph, opts) {
2115
2119
  const fileTableName = table.name;
2116
2120
  const Type = pascal(table.name);
2121
+ const hasVectorColumns = table.columns.some((c) => isVectorType(c.pgType));
2117
2122
  const rawPk = table.pk;
2118
2123
  const pkCols = Array.isArray(rawPk) ? rawPk : rawPk ? [rawPk] : [];
2119
2124
  const safePkCols = pkCols.length ? pkCols : ["id"];
@@ -2149,13 +2154,13 @@ const listSchema = z.object({
2149
2154
  limit: z.number().int().positive().max(1000).optional(),
2150
2155
  offset: z.number().int().min(0).optional(),
2151
2156
  orderBy: z.union([columnEnum, z.array(columnEnum)]).optional(),
2152
- order: z.union([z.enum(["asc", "desc"]), z.array(z.enum(["asc", "desc"]))]).optional(),
2157
+ order: z.union([z.enum(["asc", "desc"]), z.array(z.enum(["asc", "desc"]))]).optional(),${hasVectorColumns ? `
2153
2158
  vector: z.object({
2154
2159
  field: z.string(),
2155
2160
  query: z.array(z.number()),
2156
2161
  metric: z.enum(["cosine", "l2", "inner"]).optional(),
2157
2162
  maxDistance: z.number().optional()
2158
- }).optional()
2163
+ }).optional()` : ""}
2159
2164
  });
2160
2165
 
2161
2166
  /**
@@ -2337,14 +2342,20 @@ ${hasAuth ? `
2337
2342
  // src/emit-client.ts
2338
2343
  init_utils();
2339
2344
  init_emit_include_methods();
2340
- function isVectorType(pgType) {
2345
+ function isVectorType2(pgType) {
2341
2346
  const t = pgType.toLowerCase();
2342
2347
  return t === "vector" || t === "halfvec" || t === "sparsevec" || t === "bit";
2343
2348
  }
2344
2349
  function emitClient(table, graph, opts, model) {
2345
2350
  const Type = pascal(table.name);
2346
2351
  const ext = opts.useJsExtensions ? ".js" : "";
2347
- const hasVectorColumns = table.columns.some((c) => isVectorType(c.pgType));
2352
+ const hasVectorColumns = table.columns.some((c) => isVectorType2(c.pgType));
2353
+ if (process.env.SDK_DEBUG) {
2354
+ const vectorCols = table.columns.filter((c) => isVectorType2(c.pgType));
2355
+ if (vectorCols.length > 0) {
2356
+ console.log(`[DEBUG] Table ${table.name}: Found ${vectorCols.length} vector columns:`, vectorCols.map((c) => `${c.name} (${c.pgType})`));
2357
+ }
2358
+ }
2348
2359
  const pkCols = Array.isArray(table.pk) ? table.pk : table.pk ? [table.pk] : [];
2349
2360
  const safePk = pkCols.length ? pkCols : ["id"];
2350
2361
  const hasCompositePk = safePk.length > 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postgresdk",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "Generate a typed server/client SDK from a Postgres schema (includes, Zod, Hono).",
5
5
  "type": "module",
6
6
  "bin": {