@ai0x0/utils 0.0.18 → 0.0.20

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.
@@ -60,42 +60,30 @@ var listBodySchema = (schema) => import_zod.z.object({
60
60
  var createTableSchema = ({
61
61
  name,
62
62
  columns,
63
- refineSchema,
64
63
  extraConfig
65
64
  }) => {
65
+ const mergedColumns = { ...basicFields, ...columns };
66
66
  const table = (0, import_pg_core.pgTable)(
67
67
  name,
68
- {
69
- ...basicFields,
70
- ...columns
71
- },
68
+ mergedColumns,
72
69
  extraConfig
73
70
  );
74
- const selectSchema = (0, import_drizzle_zod.createSelectSchema)(
75
- table,
76
- refineSchema
71
+ const selectSchema = (0, import_drizzle_zod.createSelectSchema)(table);
72
+ const insertSchema = (0, import_drizzle_zod.createInsertSchema)((0, import_pg_core.pgTable)(name, columns));
73
+ const updateSchema = (0, import_drizzle_zod.createUpdateSchema)(
74
+ (0, import_pg_core.pgTable)(name, { id: (0, import_pg_core.uuid)("id"), ...columns })
75
+ ).extend({ id: import_zod.z.string() });
76
+ const querySchema = import_zod.z.object({ id: import_zod.z.string() });
77
+ const queryListWithSchema = queryListSchema(
78
+ import_zod.z.object({}).catchall(import_zod.z.unknown())
77
79
  );
78
- const insertTable = (0, import_pg_core.pgTable)(name, columns);
79
- const updateTable = (0, import_pg_core.pgTable)(name, {
80
- id: (0, import_pg_core.uuid)(),
81
- ...columns
82
- });
83
80
  return {
84
81
  table,
85
82
  selectSchema,
86
- insertSchema: (0, import_drizzle_zod.createInsertSchema)(
87
- insertTable,
88
- refineSchema
89
- ),
90
- updateSchema: (0, import_drizzle_zod.createUpdateSchema)(
91
- updateTable,
92
- {
93
- id: import_zod.z.string(),
94
- ...refineSchema
95
- }
96
- ),
97
- querySchema: selectSchema.pick({ id: true }),
98
- queryListSchema: queryListSchema(selectSchema.partial()),
83
+ insertSchema,
84
+ updateSchema,
85
+ querySchema,
86
+ queryListSchema: queryListWithSchema,
99
87
  queryListSelectSchema: selectSchema
100
88
  };
101
89
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai0x0/utils",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "AI0x0 utils",
5
5
  "keywords": [
6
6
  "ai0x0"