@xata.io/pgroll
Advanced tools
Comparing version 0.0.0-alpha.v4eac8da506bb45e05668cd42b8d57e7385182a96 to 0.0.0-alpha.v4ec3c938b4b871d271ae0c96f047698189cca738
# @xata.io/pgroll | ||
## 0.0.0-alpha.v4eac8da506bb45e05668cd42b8d57e7385182a96 | ||
## 0.0.0-alpha.v4ec3c938b4b871d271ae0c96f047698189cca738 | ||
@@ -9,2 +9,18 @@ ### Patch Changes | ||
## 0.7.0 | ||
### Minor Changes | ||
- [#1619](https://github.com/xataio/client-ts/pull/1619) [`b990afb`](https://github.com/xataio/client-ts/commit/b990afb5ac1a86684a9dcc0952322f11b971eebe) Thanks [@SferaDev](https://github.com/SferaDev)! - [Breaking] Remove `column` from `drop_constraint` | ||
### Patch Changes | ||
- [#1612](https://github.com/xataio/client-ts/pull/1612) [`798b45a`](https://github.com/xataio/client-ts/commit/798b45ad8fc74af591f1c1d163a9f28d0bfc5c6d) Thanks [@xata-bot](https://github.com/xata-bot)! - Update pgroll spec | ||
## 0.6.0 | ||
### Minor Changes | ||
- [#1478](https://github.com/xataio/client-ts/pull/1478) [`81a06ca`](https://github.com/xataio/client-ts/commit/81a06ca98f4b46bad8e32bf284cc63ada1ab0dc3) Thanks [@SferaDev](https://github.com/SferaDev)! - Update pgroll package to version 0.6.0 | ||
## 0.5.0 | ||
@@ -11,0 +27,0 @@ |
{ | ||
"name": "@xata.io/pgroll", | ||
"version": "0.0.0-alpha.v4eac8da506bb45e05668cd42b8d57e7385182a96", | ||
"version": "0.0.0-alpha.v4ec3c938b4b871d271ae0c96f047698189cca738", | ||
"description": "Migration tool for PostgreSQL", | ||
@@ -28,8 +28,8 @@ "type": "module", | ||
"dependencies": { | ||
"zod": "^3.22.4", | ||
"zod-to-json-schema": "^3.22.4" | ||
"zod": "^3.24.1", | ||
"zod-to-json-schema": "^3.24.1" | ||
}, | ||
"devDependencies": { | ||
"ts-morph": "^21.0.1", | ||
"tsx": "^4.7.1" | ||
"ts-morph": "^24.0.0", | ||
"tsx": "^4.19.2" | ||
}, | ||
@@ -36,0 +36,0 @@ "scripts": { |
@@ -7,4 +7,6 @@ import fs from 'fs/promises'; | ||
type DefintionType = 'string' | 'boolean' | 'number' | 'null'; | ||
type Definition = | ||
| { type: 'string' | 'boolean' | 'number'; description?: string } | ||
| { type: DefintionType | DefintionType[]; description?: string } | ||
| { $ref: string; description?: string } | ||
@@ -22,6 +24,8 @@ | { | ||
const DefinitionTypeSchema = z.enum(['string', 'boolean', 'number', 'null']); | ||
const DefinitionSchema: z.ZodSchema<Definition> = z.lazy(() => | ||
z.union([ | ||
z.object({ | ||
type: z.enum(['string', 'boolean', 'number']), | ||
type: z.union([DefinitionTypeSchema, z.array(DefinitionTypeSchema)]), | ||
description: z.string().optional() | ||
@@ -88,15 +92,13 @@ }), | ||
if (definition.type === 'string') { | ||
return 'z.string()'; | ||
} | ||
const types = typeof definition.type === 'string' ? [definition.type] : definition.type; | ||
const zodTypes = types.map((type) => { | ||
if (type === 'string') return 'z.string()'; | ||
if (type === 'boolean') return 'z.boolean()'; | ||
if (type === 'number') return 'z.number()'; | ||
if (type === 'null') return 'z.null()'; | ||
throw new Error(`Unknown type: ${type}`); | ||
}); | ||
if (definition.type === 'boolean') { | ||
return 'z.boolean()'; | ||
} | ||
if (definition.type === 'number') { | ||
return 'z.number()'; | ||
} | ||
throw new Error(`Unknown type: ${definition.type}`); | ||
if (zodTypes.length === 1) return zodTypes[0]; | ||
return `z.union([${zodTypes.join(', ')}])`; | ||
} | ||
@@ -103,0 +105,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
264788
5441
Updatedzod@^3.24.1
Updatedzod-to-json-schema@^3.24.1