@visulima/prisma-dmmf-transformer 2.0.35 → 2.0.37
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/CHANGELOG.md +17 -0
- package/LICENSE.md +3 -0
- package/dist/get-json-schema-model.d.cts +4 -0
- package/dist/get-json-schema-model.d.mts +4 -0
- package/dist/get-json-schema-model.d.ts +4 -0
- package/dist/get-json-schema-property.d.cts +4 -0
- package/dist/get-json-schema-property.d.mts +4 -0
- package/dist/get-json-schema-property.d.ts +4 -0
- package/dist/index.d.cts +3 -193
- package/dist/index.d.mts +3 -193
- package/dist/index.d.ts +3 -193
- package/dist/transform-dmmf.d.cts +5 -0
- package/dist/transform-dmmf.d.mts +5 -0
- package/dist/transform-dmmf.d.ts +5 -0
- package/dist/types.d.cts +20 -0
- package/dist/types.d.mts +20 -0
- package/dist/types.d.ts +20 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## @visulima/prisma-dmmf-transformer [2.0.37](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@2.0.36...@visulima/prisma-dmmf-transformer@2.0.37) (2025-11-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* bump packem, to fix minified version of the code ([2a36ceb](https://github.com/visulima/visulima/commit/2a36ceb09251b0ca1178701a26547a871ed717a7))
|
|
6
|
+
|
|
7
|
+
## @visulima/prisma-dmmf-transformer [2.0.36](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@2.0.35...@visulima/prisma-dmmf-transformer@2.0.36) (2025-11-12)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* Add jsr file to all packages for release ([#565](https://github.com/visulima/visulima/issues/565)) ([ec91652](https://github.com/visulima/visulima/commit/ec91652b4e4112adf14ba152c1239a7703ba425a))
|
|
16
|
+
* update license files and clean up TypeScript definitions ([fe668cc](https://github.com/visulima/visulima/commit/fe668cc26de23591d4df54a0954455ebbe31b22d))
|
|
17
|
+
|
|
1
18
|
## @visulima/prisma-dmmf-transformer [2.0.35](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@2.0.34...@visulima/prisma-dmmf-transformer@2.0.35) (2025-11-07)
|
|
2
19
|
|
|
3
20
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -26,11 +26,14 @@ SOFTWARE.
|
|
|
26
26
|
<!-- TYPE_DEPENDENCIES -->
|
|
27
27
|
|
|
28
28
|
# Licenses of bundled types
|
|
29
|
+
|
|
29
30
|
The published @visulima/prisma-dmmf-transformer artifact additionally contains code with the following licenses:
|
|
30
31
|
MIT
|
|
31
32
|
|
|
32
33
|
# Bundled types:
|
|
34
|
+
|
|
33
35
|
## @types/json-schema
|
|
36
|
+
|
|
34
37
|
License: MIT
|
|
35
38
|
By: Boris Cherny, Lucian Buzzo, Roland Groza, Jason Kwok
|
|
36
39
|
Repository: https://github.com/DefinitelyTyped/DefinitelyTyped.git
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { DefinitionMap, ModelMetaData, TransformOptions } from "./types.d.cts";
|
|
3
|
+
declare const getJSONSchemaModel: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (model: DMMF.Model) => DefinitionMap;
|
|
4
|
+
export = getJSONSchemaModel;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { DefinitionMap, ModelMetaData, TransformOptions } from "./types.d.mts";
|
|
3
|
+
declare const getJSONSchemaModel: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (model: DMMF.Model) => DefinitionMap;
|
|
4
|
+
export default getJSONSchemaModel;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { DefinitionMap, ModelMetaData, TransformOptions } from "./types.d.ts";
|
|
3
|
+
declare const getJSONSchemaModel: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (model: DMMF.Model) => DefinitionMap;
|
|
4
|
+
export = getJSONSchemaModel;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { ModelMetaData, PropertyMap, TransformOptions } from "./types.d.cts";
|
|
3
|
+
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
4
|
+
export = getJSONSchemaProperty;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { ModelMetaData, PropertyMap, TransformOptions } from "./types.d.mts";
|
|
3
|
+
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
4
|
+
export default getJSONSchemaProperty;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { ModelMetaData, PropertyMap, TransformOptions } from "./types.d.ts";
|
|
3
|
+
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
4
|
+
export = getJSONSchemaProperty;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,193 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// ==================================================================================================
|
|
5
|
-
// JSON Schema Draft 07
|
|
6
|
-
// ==================================================================================================
|
|
7
|
-
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
8
|
-
// --------------------------------------------------------------------------------------------------
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Primitive type
|
|
12
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
13
|
-
*/
|
|
14
|
-
type JSONSchema7TypeName =
|
|
15
|
-
| "string" //
|
|
16
|
-
| "number"
|
|
17
|
-
| "integer"
|
|
18
|
-
| "boolean"
|
|
19
|
-
| "object"
|
|
20
|
-
| "array"
|
|
21
|
-
| "null";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Primitive type
|
|
25
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
26
|
-
*/
|
|
27
|
-
type JSONSchema7Type =
|
|
28
|
-
| string //
|
|
29
|
-
| number
|
|
30
|
-
| boolean
|
|
31
|
-
| JSONSchema7Object
|
|
32
|
-
| JSONSchema7Array
|
|
33
|
-
| null;
|
|
34
|
-
|
|
35
|
-
// Workaround for infinite type recursion
|
|
36
|
-
interface JSONSchema7Object {
|
|
37
|
-
[key: string]: JSONSchema7Type;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Workaround for infinite type recursion
|
|
41
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
42
|
-
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Meta schema
|
|
46
|
-
*
|
|
47
|
-
* Recommended values:
|
|
48
|
-
* - 'http://json-schema.org/schema#'
|
|
49
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
50
|
-
* - 'http://json-schema.org/draft-07/schema#'
|
|
51
|
-
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
52
|
-
*
|
|
53
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
54
|
-
*/
|
|
55
|
-
type JSONSchema7Version = string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* JSON Schema v7
|
|
59
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
60
|
-
*/
|
|
61
|
-
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
62
|
-
interface JSONSchema7 {
|
|
63
|
-
$id?: string | undefined;
|
|
64
|
-
$ref?: string | undefined;
|
|
65
|
-
$schema?: JSONSchema7Version | undefined;
|
|
66
|
-
$comment?: string | undefined;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
70
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
71
|
-
*/
|
|
72
|
-
$defs?: {
|
|
73
|
-
[key: string]: JSONSchema7Definition;
|
|
74
|
-
} | undefined;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
78
|
-
*/
|
|
79
|
-
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
80
|
-
enum?: JSONSchema7Type[] | undefined;
|
|
81
|
-
const?: JSONSchema7Type | undefined;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
85
|
-
*/
|
|
86
|
-
multipleOf?: number | undefined;
|
|
87
|
-
maximum?: number | undefined;
|
|
88
|
-
exclusiveMaximum?: number | undefined;
|
|
89
|
-
minimum?: number | undefined;
|
|
90
|
-
exclusiveMinimum?: number | undefined;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
94
|
-
*/
|
|
95
|
-
maxLength?: number | undefined;
|
|
96
|
-
minLength?: number | undefined;
|
|
97
|
-
pattern?: string | undefined;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
101
|
-
*/
|
|
102
|
-
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
103
|
-
additionalItems?: JSONSchema7Definition | undefined;
|
|
104
|
-
maxItems?: number | undefined;
|
|
105
|
-
minItems?: number | undefined;
|
|
106
|
-
uniqueItems?: boolean | undefined;
|
|
107
|
-
contains?: JSONSchema7Definition | undefined;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
111
|
-
*/
|
|
112
|
-
maxProperties?: number | undefined;
|
|
113
|
-
minProperties?: number | undefined;
|
|
114
|
-
required?: string[] | undefined;
|
|
115
|
-
properties?: {
|
|
116
|
-
[key: string]: JSONSchema7Definition;
|
|
117
|
-
} | undefined;
|
|
118
|
-
patternProperties?: {
|
|
119
|
-
[key: string]: JSONSchema7Definition;
|
|
120
|
-
} | undefined;
|
|
121
|
-
additionalProperties?: JSONSchema7Definition | undefined;
|
|
122
|
-
dependencies?: {
|
|
123
|
-
[key: string]: JSONSchema7Definition | string[];
|
|
124
|
-
} | undefined;
|
|
125
|
-
propertyNames?: JSONSchema7Definition | undefined;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
129
|
-
*/
|
|
130
|
-
if?: JSONSchema7Definition | undefined;
|
|
131
|
-
then?: JSONSchema7Definition | undefined;
|
|
132
|
-
else?: JSONSchema7Definition | undefined;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
136
|
-
*/
|
|
137
|
-
allOf?: JSONSchema7Definition[] | undefined;
|
|
138
|
-
anyOf?: JSONSchema7Definition[] | undefined;
|
|
139
|
-
oneOf?: JSONSchema7Definition[] | undefined;
|
|
140
|
-
not?: JSONSchema7Definition | undefined;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
144
|
-
*/
|
|
145
|
-
format?: string | undefined;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
149
|
-
*/
|
|
150
|
-
contentMediaType?: string | undefined;
|
|
151
|
-
contentEncoding?: string | undefined;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
155
|
-
*/
|
|
156
|
-
definitions?: {
|
|
157
|
-
[key: string]: JSONSchema7Definition;
|
|
158
|
-
} | undefined;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
162
|
-
*/
|
|
163
|
-
title?: string | undefined;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
default?: JSONSchema7Type | undefined;
|
|
166
|
-
readOnly?: boolean | undefined;
|
|
167
|
-
writeOnly?: boolean | undefined;
|
|
168
|
-
examples?: JSONSchema7Type | undefined;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
interface PropertyMetaData {
|
|
172
|
-
hasDefaultValue: boolean;
|
|
173
|
-
isScalar: boolean;
|
|
174
|
-
required: boolean;
|
|
175
|
-
}
|
|
176
|
-
interface ModelMetaData {
|
|
177
|
-
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
178
|
-
}
|
|
179
|
-
type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
180
|
-
type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
181
|
-
interface TransformOptions {
|
|
182
|
-
includeRequiredFields?: "false" | "true";
|
|
183
|
-
keepRelationScalarFields?: "false" | "true";
|
|
184
|
-
persistOriginalType?: "false" | "true";
|
|
185
|
-
schemaId?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
189
|
-
|
|
190
|
-
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
191
|
-
|
|
192
|
-
export { getJSONSchemaProperty, transformDmmf as transformDMMF };
|
|
193
|
-
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions };
|
|
1
|
+
export { default as getJSONSchemaProperty } from "./get-json-schema-property.d.cts";
|
|
2
|
+
export { default as transformDMMF } from "./transform-dmmf.d.cts";
|
|
3
|
+
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions } from "./types.d.cts";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,193 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// ==================================================================================================
|
|
5
|
-
// JSON Schema Draft 07
|
|
6
|
-
// ==================================================================================================
|
|
7
|
-
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
8
|
-
// --------------------------------------------------------------------------------------------------
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Primitive type
|
|
12
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
13
|
-
*/
|
|
14
|
-
type JSONSchema7TypeName =
|
|
15
|
-
| "string" //
|
|
16
|
-
| "number"
|
|
17
|
-
| "integer"
|
|
18
|
-
| "boolean"
|
|
19
|
-
| "object"
|
|
20
|
-
| "array"
|
|
21
|
-
| "null";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Primitive type
|
|
25
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
26
|
-
*/
|
|
27
|
-
type JSONSchema7Type =
|
|
28
|
-
| string //
|
|
29
|
-
| number
|
|
30
|
-
| boolean
|
|
31
|
-
| JSONSchema7Object
|
|
32
|
-
| JSONSchema7Array
|
|
33
|
-
| null;
|
|
34
|
-
|
|
35
|
-
// Workaround for infinite type recursion
|
|
36
|
-
interface JSONSchema7Object {
|
|
37
|
-
[key: string]: JSONSchema7Type;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Workaround for infinite type recursion
|
|
41
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
42
|
-
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Meta schema
|
|
46
|
-
*
|
|
47
|
-
* Recommended values:
|
|
48
|
-
* - 'http://json-schema.org/schema#'
|
|
49
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
50
|
-
* - 'http://json-schema.org/draft-07/schema#'
|
|
51
|
-
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
52
|
-
*
|
|
53
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
54
|
-
*/
|
|
55
|
-
type JSONSchema7Version = string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* JSON Schema v7
|
|
59
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
60
|
-
*/
|
|
61
|
-
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
62
|
-
interface JSONSchema7 {
|
|
63
|
-
$id?: string | undefined;
|
|
64
|
-
$ref?: string | undefined;
|
|
65
|
-
$schema?: JSONSchema7Version | undefined;
|
|
66
|
-
$comment?: string | undefined;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
70
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
71
|
-
*/
|
|
72
|
-
$defs?: {
|
|
73
|
-
[key: string]: JSONSchema7Definition;
|
|
74
|
-
} | undefined;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
78
|
-
*/
|
|
79
|
-
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
80
|
-
enum?: JSONSchema7Type[] | undefined;
|
|
81
|
-
const?: JSONSchema7Type | undefined;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
85
|
-
*/
|
|
86
|
-
multipleOf?: number | undefined;
|
|
87
|
-
maximum?: number | undefined;
|
|
88
|
-
exclusiveMaximum?: number | undefined;
|
|
89
|
-
minimum?: number | undefined;
|
|
90
|
-
exclusiveMinimum?: number | undefined;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
94
|
-
*/
|
|
95
|
-
maxLength?: number | undefined;
|
|
96
|
-
minLength?: number | undefined;
|
|
97
|
-
pattern?: string | undefined;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
101
|
-
*/
|
|
102
|
-
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
103
|
-
additionalItems?: JSONSchema7Definition | undefined;
|
|
104
|
-
maxItems?: number | undefined;
|
|
105
|
-
minItems?: number | undefined;
|
|
106
|
-
uniqueItems?: boolean | undefined;
|
|
107
|
-
contains?: JSONSchema7Definition | undefined;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
111
|
-
*/
|
|
112
|
-
maxProperties?: number | undefined;
|
|
113
|
-
minProperties?: number | undefined;
|
|
114
|
-
required?: string[] | undefined;
|
|
115
|
-
properties?: {
|
|
116
|
-
[key: string]: JSONSchema7Definition;
|
|
117
|
-
} | undefined;
|
|
118
|
-
patternProperties?: {
|
|
119
|
-
[key: string]: JSONSchema7Definition;
|
|
120
|
-
} | undefined;
|
|
121
|
-
additionalProperties?: JSONSchema7Definition | undefined;
|
|
122
|
-
dependencies?: {
|
|
123
|
-
[key: string]: JSONSchema7Definition | string[];
|
|
124
|
-
} | undefined;
|
|
125
|
-
propertyNames?: JSONSchema7Definition | undefined;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
129
|
-
*/
|
|
130
|
-
if?: JSONSchema7Definition | undefined;
|
|
131
|
-
then?: JSONSchema7Definition | undefined;
|
|
132
|
-
else?: JSONSchema7Definition | undefined;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
136
|
-
*/
|
|
137
|
-
allOf?: JSONSchema7Definition[] | undefined;
|
|
138
|
-
anyOf?: JSONSchema7Definition[] | undefined;
|
|
139
|
-
oneOf?: JSONSchema7Definition[] | undefined;
|
|
140
|
-
not?: JSONSchema7Definition | undefined;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
144
|
-
*/
|
|
145
|
-
format?: string | undefined;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
149
|
-
*/
|
|
150
|
-
contentMediaType?: string | undefined;
|
|
151
|
-
contentEncoding?: string | undefined;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
155
|
-
*/
|
|
156
|
-
definitions?: {
|
|
157
|
-
[key: string]: JSONSchema7Definition;
|
|
158
|
-
} | undefined;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
162
|
-
*/
|
|
163
|
-
title?: string | undefined;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
default?: JSONSchema7Type | undefined;
|
|
166
|
-
readOnly?: boolean | undefined;
|
|
167
|
-
writeOnly?: boolean | undefined;
|
|
168
|
-
examples?: JSONSchema7Type | undefined;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
interface PropertyMetaData {
|
|
172
|
-
hasDefaultValue: boolean;
|
|
173
|
-
isScalar: boolean;
|
|
174
|
-
required: boolean;
|
|
175
|
-
}
|
|
176
|
-
interface ModelMetaData {
|
|
177
|
-
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
178
|
-
}
|
|
179
|
-
type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
180
|
-
type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
181
|
-
interface TransformOptions {
|
|
182
|
-
includeRequiredFields?: "false" | "true";
|
|
183
|
-
keepRelationScalarFields?: "false" | "true";
|
|
184
|
-
persistOriginalType?: "false" | "true";
|
|
185
|
-
schemaId?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
189
|
-
|
|
190
|
-
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
191
|
-
|
|
192
|
-
export { getJSONSchemaProperty, transformDmmf as transformDMMF };
|
|
193
|
-
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions };
|
|
1
|
+
export { default as getJSONSchemaProperty } from "./get-json-schema-property.d.mts";
|
|
2
|
+
export { default as transformDMMF } from "./transform-dmmf.d.mts";
|
|
3
|
+
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions } from "./types.d.mts";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,193 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// ==================================================================================================
|
|
5
|
-
// JSON Schema Draft 07
|
|
6
|
-
// ==================================================================================================
|
|
7
|
-
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
8
|
-
// --------------------------------------------------------------------------------------------------
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Primitive type
|
|
12
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
13
|
-
*/
|
|
14
|
-
type JSONSchema7TypeName =
|
|
15
|
-
| "string" //
|
|
16
|
-
| "number"
|
|
17
|
-
| "integer"
|
|
18
|
-
| "boolean"
|
|
19
|
-
| "object"
|
|
20
|
-
| "array"
|
|
21
|
-
| "null";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Primitive type
|
|
25
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
26
|
-
*/
|
|
27
|
-
type JSONSchema7Type =
|
|
28
|
-
| string //
|
|
29
|
-
| number
|
|
30
|
-
| boolean
|
|
31
|
-
| JSONSchema7Object
|
|
32
|
-
| JSONSchema7Array
|
|
33
|
-
| null;
|
|
34
|
-
|
|
35
|
-
// Workaround for infinite type recursion
|
|
36
|
-
interface JSONSchema7Object {
|
|
37
|
-
[key: string]: JSONSchema7Type;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Workaround for infinite type recursion
|
|
41
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
42
|
-
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Meta schema
|
|
46
|
-
*
|
|
47
|
-
* Recommended values:
|
|
48
|
-
* - 'http://json-schema.org/schema#'
|
|
49
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
50
|
-
* - 'http://json-schema.org/draft-07/schema#'
|
|
51
|
-
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
52
|
-
*
|
|
53
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
54
|
-
*/
|
|
55
|
-
type JSONSchema7Version = string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* JSON Schema v7
|
|
59
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
60
|
-
*/
|
|
61
|
-
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
62
|
-
interface JSONSchema7 {
|
|
63
|
-
$id?: string | undefined;
|
|
64
|
-
$ref?: string | undefined;
|
|
65
|
-
$schema?: JSONSchema7Version | undefined;
|
|
66
|
-
$comment?: string | undefined;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
70
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
71
|
-
*/
|
|
72
|
-
$defs?: {
|
|
73
|
-
[key: string]: JSONSchema7Definition;
|
|
74
|
-
} | undefined;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
78
|
-
*/
|
|
79
|
-
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
80
|
-
enum?: JSONSchema7Type[] | undefined;
|
|
81
|
-
const?: JSONSchema7Type | undefined;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
85
|
-
*/
|
|
86
|
-
multipleOf?: number | undefined;
|
|
87
|
-
maximum?: number | undefined;
|
|
88
|
-
exclusiveMaximum?: number | undefined;
|
|
89
|
-
minimum?: number | undefined;
|
|
90
|
-
exclusiveMinimum?: number | undefined;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
94
|
-
*/
|
|
95
|
-
maxLength?: number | undefined;
|
|
96
|
-
minLength?: number | undefined;
|
|
97
|
-
pattern?: string | undefined;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
101
|
-
*/
|
|
102
|
-
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
103
|
-
additionalItems?: JSONSchema7Definition | undefined;
|
|
104
|
-
maxItems?: number | undefined;
|
|
105
|
-
minItems?: number | undefined;
|
|
106
|
-
uniqueItems?: boolean | undefined;
|
|
107
|
-
contains?: JSONSchema7Definition | undefined;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
111
|
-
*/
|
|
112
|
-
maxProperties?: number | undefined;
|
|
113
|
-
minProperties?: number | undefined;
|
|
114
|
-
required?: string[] | undefined;
|
|
115
|
-
properties?: {
|
|
116
|
-
[key: string]: JSONSchema7Definition;
|
|
117
|
-
} | undefined;
|
|
118
|
-
patternProperties?: {
|
|
119
|
-
[key: string]: JSONSchema7Definition;
|
|
120
|
-
} | undefined;
|
|
121
|
-
additionalProperties?: JSONSchema7Definition | undefined;
|
|
122
|
-
dependencies?: {
|
|
123
|
-
[key: string]: JSONSchema7Definition | string[];
|
|
124
|
-
} | undefined;
|
|
125
|
-
propertyNames?: JSONSchema7Definition | undefined;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
129
|
-
*/
|
|
130
|
-
if?: JSONSchema7Definition | undefined;
|
|
131
|
-
then?: JSONSchema7Definition | undefined;
|
|
132
|
-
else?: JSONSchema7Definition | undefined;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
136
|
-
*/
|
|
137
|
-
allOf?: JSONSchema7Definition[] | undefined;
|
|
138
|
-
anyOf?: JSONSchema7Definition[] | undefined;
|
|
139
|
-
oneOf?: JSONSchema7Definition[] | undefined;
|
|
140
|
-
not?: JSONSchema7Definition | undefined;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
144
|
-
*/
|
|
145
|
-
format?: string | undefined;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
149
|
-
*/
|
|
150
|
-
contentMediaType?: string | undefined;
|
|
151
|
-
contentEncoding?: string | undefined;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
155
|
-
*/
|
|
156
|
-
definitions?: {
|
|
157
|
-
[key: string]: JSONSchema7Definition;
|
|
158
|
-
} | undefined;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
162
|
-
*/
|
|
163
|
-
title?: string | undefined;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
default?: JSONSchema7Type | undefined;
|
|
166
|
-
readOnly?: boolean | undefined;
|
|
167
|
-
writeOnly?: boolean | undefined;
|
|
168
|
-
examples?: JSONSchema7Type | undefined;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
interface PropertyMetaData {
|
|
172
|
-
hasDefaultValue: boolean;
|
|
173
|
-
isScalar: boolean;
|
|
174
|
-
required: boolean;
|
|
175
|
-
}
|
|
176
|
-
interface ModelMetaData {
|
|
177
|
-
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
178
|
-
}
|
|
179
|
-
type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
180
|
-
type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
181
|
-
interface TransformOptions {
|
|
182
|
-
includeRequiredFields?: "false" | "true";
|
|
183
|
-
keepRelationScalarFields?: "false" | "true";
|
|
184
|
-
persistOriginalType?: "false" | "true";
|
|
185
|
-
schemaId?: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
|
|
189
|
-
|
|
190
|
-
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
191
|
-
|
|
192
|
-
export { getJSONSchemaProperty, transformDmmf as transformDMMF };
|
|
193
|
-
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions };
|
|
1
|
+
export { default as getJSONSchemaProperty } from "./get-json-schema-property.d.ts";
|
|
2
|
+
export { default as transformDMMF } from "./transform-dmmf.d.ts";
|
|
3
|
+
export type { DefinitionMap, ModelMetaData, PropertyMap, PropertyMetaData, TransformOptions } from "./types.d.ts";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
import type { TransformOptions } from "./types.d.cts";
|
|
4
|
+
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
5
|
+
export = transformDmmf;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
import type { TransformOptions } from "./types.d.mts";
|
|
4
|
+
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
5
|
+
export default transformDmmf;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7 } from "json-schema";
|
|
3
|
+
import type { TransformOptions } from "./types.d.ts";
|
|
4
|
+
declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
|
|
5
|
+
export = transformDmmf;
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7Definition } from "json-schema";
|
|
3
|
+
import type { ReadonlyDeep } from "type-fest";
|
|
4
|
+
export type PrismaPrimitive = "BigInt" | "Boolean" | "Bytes" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "String";
|
|
5
|
+
export interface PropertyMetaData {
|
|
6
|
+
hasDefaultValue: boolean;
|
|
7
|
+
isScalar: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelMetaData {
|
|
11
|
+
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
12
|
+
}
|
|
13
|
+
export type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
14
|
+
export type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
15
|
+
export interface TransformOptions {
|
|
16
|
+
includeRequiredFields?: "false" | "true";
|
|
17
|
+
keepRelationScalarFields?: "false" | "true";
|
|
18
|
+
persistOriginalType?: "false" | "true";
|
|
19
|
+
schemaId?: string;
|
|
20
|
+
}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7Definition } from "json-schema";
|
|
3
|
+
import type { ReadonlyDeep } from "type-fest";
|
|
4
|
+
export type PrismaPrimitive = "BigInt" | "Boolean" | "Bytes" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "String";
|
|
5
|
+
export interface PropertyMetaData {
|
|
6
|
+
hasDefaultValue: boolean;
|
|
7
|
+
isScalar: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelMetaData {
|
|
11
|
+
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
12
|
+
}
|
|
13
|
+
export type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
14
|
+
export type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
15
|
+
export interface TransformOptions {
|
|
16
|
+
includeRequiredFields?: "false" | "true";
|
|
17
|
+
keepRelationScalarFields?: "false" | "true";
|
|
18
|
+
persistOriginalType?: "false" | "true";
|
|
19
|
+
schemaId?: string;
|
|
20
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DMMF } from "@prisma/generator-helper";
|
|
2
|
+
import type { JSONSchema7Definition } from "json-schema";
|
|
3
|
+
import type { ReadonlyDeep } from "type-fest";
|
|
4
|
+
export type PrismaPrimitive = "BigInt" | "Boolean" | "Bytes" | "DateTime" | "Decimal" | "Float" | "Int" | "Json" | "String";
|
|
5
|
+
export interface PropertyMetaData {
|
|
6
|
+
hasDefaultValue: boolean;
|
|
7
|
+
isScalar: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelMetaData {
|
|
11
|
+
enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
|
|
12
|
+
}
|
|
13
|
+
export type DefinitionMap = [name: string, definition: JSONSchema7Definition];
|
|
14
|
+
export type PropertyMap = [...DefinitionMap, PropertyMetaData];
|
|
15
|
+
export interface TransformOptions {
|
|
16
|
+
includeRequiredFields?: "false" | "true";
|
|
17
|
+
keepRelationScalarFields?: "false" | "true";
|
|
18
|
+
persistOriginalType?: "false" | "true";
|
|
19
|
+
schemaId?: string;
|
|
20
|
+
}
|