@visulima/prisma-dmmf-transformer 3.0.0-alpha.14 → 3.0.0-alpha.16

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 CHANGED
@@ -1,3 +1,27 @@
1
+ ## @visulima/prisma-dmmf-transformer [3.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@3.0.0-alpha.15...@visulima/prisma-dmmf-transformer@3.0.0-alpha.16) (2026-06-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **prisma-dmmf-transformer:** fix enum-list/optional-enum schema and add options ([0e7900a](https://github.com/visulima/visulima/commit/0e7900ab236128cd0f208cd5caad1770b88bd2ef))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * apply safe prettier and eslint formatting ([05120af](https://github.com/visulima/visulima/commit/05120af8c898d18c495575680f01134681e29b65))
10
+
11
+ ### Code Refactoring
12
+
13
+ * **prisma-dmmf-transformer:** reformat source and docs for prettier ([36136fd](https://github.com/visulima/visulima/commit/36136fd7edc4be9a1cb7d6c374ec8e42192a5b88))
14
+
15
+ ## @visulima/prisma-dmmf-transformer [3.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@3.0.0-alpha.14...@visulima/prisma-dmmf-transformer@3.0.0-alpha.15) (2026-06-04)
16
+
17
+ ### Bug Fixes
18
+
19
+ * **prisma-dmmf-transformer:** 3 bug fixes ([8ef0156](https://github.com/visulima/visulima/commit/8ef0156f998df24bbf8a84385e92eb0a158b328b))
20
+
21
+ ### Tests
22
+
23
+ * **prisma-dmmf-transformer:** cover per-field json schema property edge branches ([58d4277](https://github.com/visulima/visulima/commit/58d4277b8f65cae64203ca569f1d4fb5990a2221))
24
+
1
25
  ## @visulima/prisma-dmmf-transformer [3.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/prisma-dmmf-transformer@3.0.0-alpha.13...@visulima/prisma-dmmf-transformer@3.0.0-alpha.14) (2026-05-27)
2
26
 
3
27
  ### Bug Fixes
package/README.md CHANGED
@@ -50,25 +50,63 @@ pnpm add @visulima/prisma-dmmf-transformer
50
50
 
51
51
  ## Usage
52
52
 
53
+ `transformDMMF` takes a Prisma DMMF document. Get one with `@prisma/internals` (the
54
+ supported, public way across Prisma 3–6):
55
+
53
56
  ```ts
54
- import { transformDMMF, getJSONSchemaProperty } from "@visulima/prisma-dmmf-transformer";
57
+ import { getDMMF } from "@prisma/internals";
58
+ import { transformDMMF } from "@visulima/prisma-dmmf-transformer";
59
+
60
+ const datamodel = `
61
+ model User {
62
+ id Int @id @default(autoincrement())
63
+ email String @unique
64
+ }
65
+ `;
66
+
67
+ const dmmf = await getDMMF({ datamodel });
68
+ const schema = transformDMMF(dmmf);
69
+
70
+ console.log(schema);
71
+ ```
72
+
73
+ You can also pass a DMMF you already have at runtime — e.g. `Prisma.dmmf` from a
74
+ generated client:
55
75
 
56
- const generator = async (prismaClient) => {
57
- const dmmf = await prismaClient._getDmmf();
58
- const schema = transformDMMF(dmmf);
76
+ ```ts
77
+ import { Prisma } from "@prisma/client";
78
+ import { transformDMMF } from "@visulima/prisma-dmmf-transformer";
59
79
 
60
- console.log(schema);
61
- };
80
+ const schema = transformDMMF(Prisma.dmmf);
62
81
  ```
63
82
 
64
- The generator currently supports a few options as a second argument:
83
+ ### Per-field helper
84
+
85
+ `getJSONSchemaProperty` is exported for callers that want the JSON Schema fragment for a single
86
+ DMMF field instead of a whole document. It is curried and returns a `[name, definition, metadata]`
87
+ tuple:
88
+
89
+ ```ts
90
+ import { getJSONSchemaProperty } from "@visulima/prisma-dmmf-transformer";
91
+
92
+ const [name, definition] = getJSONSchemaProperty({ enums: [] }, {})(field);
93
+ ```
65
94
 
66
- | Key | Default Value | Description |
67
- | ------------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
68
- | keepRelationScalarFields | "false" | By default, the JSON Schema that’s generated will output only objects for related model records. If set to "true", this will cause the generator to also output foreign key fields for related records |
69
- | schemaId | undefined | Add an id to the generated schema. All references will include the schema id |
70
- | includeRequiredFields | "false" | If this flag is `"true"` all required scalar prisma fields that do not have a default value, will be added to the `required` properties field for that schema definition. |
71
- | persistOriginalType | "false" | If this flag is `"true"` the original type will be outputed under the property key "originalType" |
95
+ ### Options
96
+
97
+ `transformDMMF` accepts an options object as a second argument. Boolean flags accept either a real
98
+ `boolean` or the string literals `"true"` / `"false"` (the latter for compatibility with Prisma
99
+ generator configuration, which only delivers strings):
100
+
101
+ | Key | Default Value | Description |
102
+ | ------------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
+ | keepRelationScalarFields | `false` | By default the generated schema outputs only objects for related model records. When enabled, foreign-key scalar fields for related records are kept as well. |
104
+ | schemaId | `undefined` | Adds an `$id` to the generated schema. All `$ref`s are prefixed with the schema id. |
105
+ | includeRequiredFields | `false` | When enabled, all required scalar Prisma fields without a default value are added to the `required` array of their schema definition. |
106
+ | persistOriginalType | `false` | When enabled, the original Prisma type is emitted under the property key `originalType`. |
107
+ | bigIntType | `"integer"` | Maps `BigInt` fields to a JSON Schema type. Set to `"string"` to emit `type: "string"` (the common practice for values larger than 2^53; also fixes string defaults self-validating). |
108
+ | nullableMode | `"json-schema"` | `"json-schema"` expresses nullability via type unions / `anyOf`. `"openapi"` emits a single `type` plus `nullable: true` for OpenAPI 3.0 compatibility. |
109
+ | enrichNativeTypes | `false` | When enabled, derives extra constraints from Prisma attributes: `@db.VarChar(n)` → `maxLength`, `@default(uuid())` → `format: "uuid"`, `@default(cuid())` → `pattern`, `Bytes` → `contentEncoding: "base64"`. |
72
110
 
73
111
  ## Examples
74
112
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./packem_shared/getJSONSchemaProperty-DRt6R_Y4.cjs"),r=require("./packem_shared/transformDMMF-BoTh23q9.cjs");exports.getJSONSchemaProperty=e;exports.transformDMMF=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./packem_shared/get-json-schema-property-BSId0ccp.cjs"),r=require("./packem_shared/transformDMMF-DB3EDNMh.cjs");exports.getJSONSchemaProperty=e.O;exports.transformDMMF=r;
package/dist/index.d.cts CHANGED
@@ -1,22 +1,116 @@
1
1
  import { DMMF } from '@prisma/generator-helper';
2
2
  import { JSONSchema7Definition, JSONSchema7 } from 'json-schema';
3
3
  import { ReadonlyDeep } from 'type-fest';
4
+ /**
5
+ * A boolean-like option value.
6
+ *
7
+ * Prisma generator configuration only ever delivers option values as strings ("true" / "false"),
8
+ * so the historic API accepted those literal strings. Programmatic callers naturally reach for real
9
+ * booleans, so both forms are accepted and normalized internally.
10
+ */
11
+ type BooleanLike = "false" | "true" | boolean;
12
+ /**
13
+ * How nullability should be expressed in the generated schema.
14
+ *
15
+ * "json-schema" (default) uses JSON Schema draft-07 semantics: optional scalars become a type union
16
+ * (["string", "null"]) and optional relations become { anyOf: [..., { type: "null" }] }. "openapi"
17
+ * uses OpenAPI 3.0 semantics: a single type plus nullable: true (OpenAPI 3.0 rejects type arrays and
18
+ * { type: "null" }).
19
+ */
20
+ type NullableMode = "json-schema" | "openapi";
4
21
  interface PropertyMetaData {
5
22
  hasDefaultValue: boolean;
6
23
  isScalar: boolean;
7
24
  required: boolean;
8
25
  }
9
26
  interface ModelMetaData {
27
+ /**
28
+ * Pre-built lookup of enum name to its member names.
29
+ *
30
+ * Optional and internal: the document transformer populates this once per document so per-field
31
+ * enum resolution is O(1) instead of an O(enums) linear scan. When absent (e.g. when the
32
+ * per-field helper is used standalone) the transformer falls back to scanning `enums`.
33
+ */
34
+ enumNameToValues?: ReadonlyMap<string, string[]>;
10
35
  enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
11
36
  }
12
37
  type DefinitionMap = [name: string, definition: JSONSchema7Definition];
13
38
  type PropertyMap = [...DefinitionMap, PropertyMetaData];
14
39
  interface TransformOptions {
15
- includeRequiredFields?: "false" | "true";
16
- keepRelationScalarFields?: "false" | "true";
17
- persistOriginalType?: "false" | "true";
40
+ /**
41
+ * Map Prisma `BigInt` fields to a JSON Schema type.
42
+ *
43
+ * Prisma's DMMF delivers `BigInt` defaults as strings, so the default "integer" mapping can emit
44
+ * a string default under an integer type which fails self-validation. Set to "string" to emit
45
+ * `type: "string"` for BigInt fields, the common JSON practice for values larger than 2^53.
46
+ * @default "integer"
47
+ */
48
+ bigIntType?: "integer" | "string";
49
+ /**
50
+ * Enrich scalar properties from Prisma native-type and default attributes.
51
+ *
52
+ * When enabled: `@db.VarChar(255)` / `@db.Char(n)` add `maxLength`, `@default(uuid())` adds
53
+ * `format: "uuid"`, `@default(cuid())` adds a `pattern`, and `Bytes` fields add
54
+ * `contentEncoding: "base64"`.
55
+ * @default false
56
+ */
57
+ enrichNativeTypes?: BooleanLike;
58
+ /**
59
+ * If truthy, all required scalar Prisma fields without a default value are added to the
60
+ * `required` array of their schema definition.
61
+ * @default false
62
+ */
63
+ includeRequiredFields?: BooleanLike;
64
+ /**
65
+ * If truthy, foreign-key scalar fields for related records are kept in the output (they are
66
+ * stripped by default).
67
+ * @default false
68
+ */
69
+ keepRelationScalarFields?: BooleanLike;
70
+ /**
71
+ * Controls how nullability is expressed. See `NullableMode`.
72
+ * @default "json-schema"
73
+ */
74
+ nullableMode?: NullableMode;
75
+ /**
76
+ * If truthy, the original Prisma type is emitted under the `originalType` property key.
77
+ * @default false
78
+ */
79
+ persistOriginalType?: BooleanLike;
80
+ /**
81
+ * Adds an `$id` to the generated schema. All `$ref`s are prefixed with it.
82
+ */
18
83
  schemaId?: string;
19
84
  }
85
+ /**
86
+ * Build a JSON Schema property for a single Prisma DMMF field.
87
+ *
88
+ * Curried: `getJSONSchemaProperty(modelMetaData, transformOptions)(field)` returns a
89
+ * `[name, definition, metadata]` tuple where `definition` is the JSON Schema fragment for the
90
+ * field and `metadata` carries `required` / `isScalar` / `hasDefaultValue` flags used by the
91
+ * model-level transformer to assemble `required` arrays.
92
+ * @example
93
+ * ```ts
94
+ * import { getJSONSchemaProperty } from "@visulima/prisma-dmmf-transformer";
95
+ *
96
+ * const [name, definition] = getJSONSchemaProperty({ enums: [] }, {})(field);
97
+ * ```
98
+ */
20
99
  declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
100
+ /**
101
+ * Transform a Prisma DMMF document into a JSON Schema (draft-07) document.
102
+ *
103
+ * Each Prisma model and composite type becomes an entry under `definitions`, and each model gets a
104
+ * top-level `properties` entry referencing its definition. Behaviour is controlled via
105
+ * {@link TransformOptions}.
106
+ * @example
107
+ * ```ts
108
+ * import { getDMMF } from "@prisma/internals";
109
+ * import { transformDMMF } from "@visulima/prisma-dmmf-transformer";
110
+ *
111
+ * const dmmf = await getDMMF({ datamodel });
112
+ * const schema = transformDMMF(dmmf, { includeRequiredFields: true });
113
+ * ```
114
+ */
21
115
  declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
22
- export { type DefinitionMap, type ModelMetaData, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
116
+ export { type BooleanLike, type DefinitionMap, type ModelMetaData, type NullableMode, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
package/dist/index.d.mts CHANGED
@@ -1,22 +1,116 @@
1
1
  import { DMMF } from '@prisma/generator-helper';
2
2
  import { JSONSchema7Definition, JSONSchema7 } from 'json-schema';
3
3
  import { ReadonlyDeep } from 'type-fest';
4
+ /**
5
+ * A boolean-like option value.
6
+ *
7
+ * Prisma generator configuration only ever delivers option values as strings ("true" / "false"),
8
+ * so the historic API accepted those literal strings. Programmatic callers naturally reach for real
9
+ * booleans, so both forms are accepted and normalized internally.
10
+ */
11
+ type BooleanLike = "false" | "true" | boolean;
12
+ /**
13
+ * How nullability should be expressed in the generated schema.
14
+ *
15
+ * "json-schema" (default) uses JSON Schema draft-07 semantics: optional scalars become a type union
16
+ * (["string", "null"]) and optional relations become { anyOf: [..., { type: "null" }] }. "openapi"
17
+ * uses OpenAPI 3.0 semantics: a single type plus nullable: true (OpenAPI 3.0 rejects type arrays and
18
+ * { type: "null" }).
19
+ */
20
+ type NullableMode = "json-schema" | "openapi";
4
21
  interface PropertyMetaData {
5
22
  hasDefaultValue: boolean;
6
23
  isScalar: boolean;
7
24
  required: boolean;
8
25
  }
9
26
  interface ModelMetaData {
27
+ /**
28
+ * Pre-built lookup of enum name to its member names.
29
+ *
30
+ * Optional and internal: the document transformer populates this once per document so per-field
31
+ * enum resolution is O(1) instead of an O(enums) linear scan. When absent (e.g. when the
32
+ * per-field helper is used standalone) the transformer falls back to scanning `enums`.
33
+ */
34
+ enumNameToValues?: ReadonlyMap<string, string[]>;
10
35
  enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
11
36
  }
12
37
  type DefinitionMap = [name: string, definition: JSONSchema7Definition];
13
38
  type PropertyMap = [...DefinitionMap, PropertyMetaData];
14
39
  interface TransformOptions {
15
- includeRequiredFields?: "false" | "true";
16
- keepRelationScalarFields?: "false" | "true";
17
- persistOriginalType?: "false" | "true";
40
+ /**
41
+ * Map Prisma `BigInt` fields to a JSON Schema type.
42
+ *
43
+ * Prisma's DMMF delivers `BigInt` defaults as strings, so the default "integer" mapping can emit
44
+ * a string default under an integer type which fails self-validation. Set to "string" to emit
45
+ * `type: "string"` for BigInt fields, the common JSON practice for values larger than 2^53.
46
+ * @default "integer"
47
+ */
48
+ bigIntType?: "integer" | "string";
49
+ /**
50
+ * Enrich scalar properties from Prisma native-type and default attributes.
51
+ *
52
+ * When enabled: `@db.VarChar(255)` / `@db.Char(n)` add `maxLength`, `@default(uuid())` adds
53
+ * `format: "uuid"`, `@default(cuid())` adds a `pattern`, and `Bytes` fields add
54
+ * `contentEncoding: "base64"`.
55
+ * @default false
56
+ */
57
+ enrichNativeTypes?: BooleanLike;
58
+ /**
59
+ * If truthy, all required scalar Prisma fields without a default value are added to the
60
+ * `required` array of their schema definition.
61
+ * @default false
62
+ */
63
+ includeRequiredFields?: BooleanLike;
64
+ /**
65
+ * If truthy, foreign-key scalar fields for related records are kept in the output (they are
66
+ * stripped by default).
67
+ * @default false
68
+ */
69
+ keepRelationScalarFields?: BooleanLike;
70
+ /**
71
+ * Controls how nullability is expressed. See `NullableMode`.
72
+ * @default "json-schema"
73
+ */
74
+ nullableMode?: NullableMode;
75
+ /**
76
+ * If truthy, the original Prisma type is emitted under the `originalType` property key.
77
+ * @default false
78
+ */
79
+ persistOriginalType?: BooleanLike;
80
+ /**
81
+ * Adds an `$id` to the generated schema. All `$ref`s are prefixed with it.
82
+ */
18
83
  schemaId?: string;
19
84
  }
85
+ /**
86
+ * Build a JSON Schema property for a single Prisma DMMF field.
87
+ *
88
+ * Curried: `getJSONSchemaProperty(modelMetaData, transformOptions)(field)` returns a
89
+ * `[name, definition, metadata]` tuple where `definition` is the JSON Schema fragment for the
90
+ * field and `metadata` carries `required` / `isScalar` / `hasDefaultValue` flags used by the
91
+ * model-level transformer to assemble `required` arrays.
92
+ * @example
93
+ * ```ts
94
+ * import { getJSONSchemaProperty } from "@visulima/prisma-dmmf-transformer";
95
+ *
96
+ * const [name, definition] = getJSONSchemaProperty({ enums: [] }, {})(field);
97
+ * ```
98
+ */
20
99
  declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
100
+ /**
101
+ * Transform a Prisma DMMF document into a JSON Schema (draft-07) document.
102
+ *
103
+ * Each Prisma model and composite type becomes an entry under `definitions`, and each model gets a
104
+ * top-level `properties` entry referencing its definition. Behaviour is controlled via
105
+ * {@link TransformOptions}.
106
+ * @example
107
+ * ```ts
108
+ * import { getDMMF } from "@prisma/internals";
109
+ * import { transformDMMF } from "@visulima/prisma-dmmf-transformer";
110
+ *
111
+ * const dmmf = await getDMMF({ datamodel });
112
+ * const schema = transformDMMF(dmmf, { includeRequiredFields: true });
113
+ * ```
114
+ */
21
115
  declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
22
- export { type DefinitionMap, type ModelMetaData, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
116
+ export { type BooleanLike, type DefinitionMap, type ModelMetaData, type NullableMode, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,116 @@
1
1
  import { DMMF } from '@prisma/generator-helper';
2
2
  import { JSONSchema7Definition, JSONSchema7 } from 'json-schema';
3
3
  import { ReadonlyDeep } from 'type-fest';
4
+ /**
5
+ * A boolean-like option value.
6
+ *
7
+ * Prisma generator configuration only ever delivers option values as strings ("true" / "false"),
8
+ * so the historic API accepted those literal strings. Programmatic callers naturally reach for real
9
+ * booleans, so both forms are accepted and normalized internally.
10
+ */
11
+ type BooleanLike = "false" | "true" | boolean;
12
+ /**
13
+ * How nullability should be expressed in the generated schema.
14
+ *
15
+ * "json-schema" (default) uses JSON Schema draft-07 semantics: optional scalars become a type union
16
+ * (["string", "null"]) and optional relations become { anyOf: [..., { type: "null" }] }. "openapi"
17
+ * uses OpenAPI 3.0 semantics: a single type plus nullable: true (OpenAPI 3.0 rejects type arrays and
18
+ * { type: "null" }).
19
+ */
20
+ type NullableMode = "json-schema" | "openapi";
4
21
  interface PropertyMetaData {
5
22
  hasDefaultValue: boolean;
6
23
  isScalar: boolean;
7
24
  required: boolean;
8
25
  }
9
26
  interface ModelMetaData {
27
+ /**
28
+ * Pre-built lookup of enum name to its member names.
29
+ *
30
+ * Optional and internal: the document transformer populates this once per document so per-field
31
+ * enum resolution is O(1) instead of an O(enums) linear scan. When absent (e.g. when the
32
+ * per-field helper is used standalone) the transformer falls back to scanning `enums`.
33
+ */
34
+ enumNameToValues?: ReadonlyMap<string, string[]>;
10
35
  enums: ReadonlyDeep<DMMF.DatamodelEnum[]>;
11
36
  }
12
37
  type DefinitionMap = [name: string, definition: JSONSchema7Definition];
13
38
  type PropertyMap = [...DefinitionMap, PropertyMetaData];
14
39
  interface TransformOptions {
15
- includeRequiredFields?: "false" | "true";
16
- keepRelationScalarFields?: "false" | "true";
17
- persistOriginalType?: "false" | "true";
40
+ /**
41
+ * Map Prisma `BigInt` fields to a JSON Schema type.
42
+ *
43
+ * Prisma's DMMF delivers `BigInt` defaults as strings, so the default "integer" mapping can emit
44
+ * a string default under an integer type which fails self-validation. Set to "string" to emit
45
+ * `type: "string"` for BigInt fields, the common JSON practice for values larger than 2^53.
46
+ * @default "integer"
47
+ */
48
+ bigIntType?: "integer" | "string";
49
+ /**
50
+ * Enrich scalar properties from Prisma native-type and default attributes.
51
+ *
52
+ * When enabled: `@db.VarChar(255)` / `@db.Char(n)` add `maxLength`, `@default(uuid())` adds
53
+ * `format: "uuid"`, `@default(cuid())` adds a `pattern`, and `Bytes` fields add
54
+ * `contentEncoding: "base64"`.
55
+ * @default false
56
+ */
57
+ enrichNativeTypes?: BooleanLike;
58
+ /**
59
+ * If truthy, all required scalar Prisma fields without a default value are added to the
60
+ * `required` array of their schema definition.
61
+ * @default false
62
+ */
63
+ includeRequiredFields?: BooleanLike;
64
+ /**
65
+ * If truthy, foreign-key scalar fields for related records are kept in the output (they are
66
+ * stripped by default).
67
+ * @default false
68
+ */
69
+ keepRelationScalarFields?: BooleanLike;
70
+ /**
71
+ * Controls how nullability is expressed. See `NullableMode`.
72
+ * @default "json-schema"
73
+ */
74
+ nullableMode?: NullableMode;
75
+ /**
76
+ * If truthy, the original Prisma type is emitted under the `originalType` property key.
77
+ * @default false
78
+ */
79
+ persistOriginalType?: BooleanLike;
80
+ /**
81
+ * Adds an `$id` to the generated schema. All `$ref`s are prefixed with it.
82
+ */
18
83
  schemaId?: string;
19
84
  }
85
+ /**
86
+ * Build a JSON Schema property for a single Prisma DMMF field.
87
+ *
88
+ * Curried: `getJSONSchemaProperty(modelMetaData, transformOptions)(field)` returns a
89
+ * `[name, definition, metadata]` tuple where `definition` is the JSON Schema fragment for the
90
+ * field and `metadata` carries `required` / `isScalar` / `hasDefaultValue` flags used by the
91
+ * model-level transformer to assemble `required` arrays.
92
+ * @example
93
+ * ```ts
94
+ * import { getJSONSchemaProperty } from "@visulima/prisma-dmmf-transformer";
95
+ *
96
+ * const [name, definition] = getJSONSchemaProperty({ enums: [] }, {})(field);
97
+ * ```
98
+ */
20
99
  declare const getJSONSchemaProperty: (modelMetaData: ModelMetaData, transformOptions: TransformOptions) => (field: DMMF.Field) => PropertyMap;
100
+ /**
101
+ * Transform a Prisma DMMF document into a JSON Schema (draft-07) document.
102
+ *
103
+ * Each Prisma model and composite type becomes an entry under `definitions`, and each model gets a
104
+ * top-level `properties` entry referencing its definition. Behaviour is controlled via
105
+ * {@link TransformOptions}.
106
+ * @example
107
+ * ```ts
108
+ * import { getDMMF } from "@prisma/internals";
109
+ * import { transformDMMF } from "@visulima/prisma-dmmf-transformer";
110
+ *
111
+ * const dmmf = await getDMMF({ datamodel });
112
+ * const schema = transformDMMF(dmmf, { includeRequiredFields: true });
113
+ * ```
114
+ */
21
115
  declare const transformDmmf: (dmmf: DMMF.Document, transformOptions?: TransformOptions) => JSONSchema7;
22
- export { type DefinitionMap, type ModelMetaData, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
116
+ export { type BooleanLike, type DefinitionMap, type ModelMetaData, type NullableMode, type PropertyMap, type PropertyMetaData, type TransformOptions, getJSONSchemaProperty, transformDmmf as transformDMMF };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{default as t}from"./packem_shared/getJSONSchemaProperty-BJUSxFNN.mjs";import{default as o}from"./packem_shared/transformDMMF-CT3SBFTd.mjs";export{t as getJSONSchemaProperty,o as transformDMMF};
1
+ import{O as o}from"./packem_shared/get-json-schema-property-DAfdAxpZ.mjs";import{default as a}from"./packem_shared/transformDMMF-zkeo70oD.mjs";export{o as getJSONSchemaProperty,a as transformDMMF};
@@ -0,0 +1 @@
1
+ "use strict";const l=e=>e===!0||e==="true",o=e=>e!=null,p=(e,n)=>{switch(e){case"BigInt":return n.bigIntType==="string"?"string":"integer";case"Boolean":return"boolean";case"Bytes":case"DateTime":case"String":return"string";case"Decimal":case"Float":return"number";case"Int":return"integer";case"Json":return["number","string","boolean","object","array","null"];default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e)}`)}},f=(e,n)=>{const{isList:i,kind:t,type:r}=e;return t==="scalar"&&!i?p(r,n):i?"array":t==="enum"?"string":"object"},g=(e,n)=>{const{isList:i,isRequired:t}=e,r=f(e,n);return t||i||n.nullableMode==="openapi"?r:Array.isArray(r)?[...new Set(["null",...r])]:[r,"null"]},b=e=>{const n=e.default;if(e.hasDefaultValue){if(e.kind==="enum")return typeof n=="string"?n:void 0;if(e.kind==="scalar")switch(e.type){case"BigInt":case"DateTime":case"String":return typeof n=="string"?n:void 0;case"Boolean":return typeof n=="boolean"?n:void 0;case"Bytes":case"Json":return;case"Decimal":case"Float":case"Int":return typeof n=="number"?n:void 0;default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e.type)}`)}}},h=e=>{if(e==="DateTime")return"date-time"},m=(e,n)=>{const{persistOriginalType:i,schemaId:t}=n,r=e.isRequired||e.isList,s=`#/definitions/${e.type}`,a={$ref:t?`${t}${s}`:s};return r?a:n.nullableMode==="openapi"?{...a,nullable:!0,...l(i)&&{originalType:e.type}}:{anyOf:[a,{type:"null"}],...l(i)&&{originalType:e.type}}},T=(e,n,i)=>{if(!(e.kind==="scalar"&&!e.isList))return e.kind==="enum"?e.isList&&i?{enum:i,type:"string"}:void 0:e.kind==="scalar"&&e.isList?{type:p(e.type,n)}:m(e,n)},k=e=>e.kind!=="scalar"&&!e.isList&&e.kind!=="enum",L=(e,n)=>{if(e.enumNameToValues)return e.enumNameToValues.get(n.type);const i=e.enums.find(({name:t})=>t===n.type);if(i)return i.values.map(t=>t.name)},v=e=>e.documentation,D=e=>{const n={};if(e.kind!=="scalar")return n;e.type==="Bytes"&&(n.contentEncoding="base64");const i=e.nativeType;if(i){const[r,s]=i;if((r==="VarChar"||r==="Char")&&s.length>0){const a=Number.parseInt(s[0],10);Number.isFinite(a)&&(n.maxLength=a)}}const t=e.default;if(e.type==="String"&&typeof t=="object"&&"name"in t){const r=t.name;r==="uuid"?n.format="uuid":r==="cuid"&&(n.pattern="^c[a-z0-9]{24,}$")}return n},N=(e,n,i)=>{const t=g(i,n),r=h(i.type),s=L(e,i),a=T(i,n,s),c=b(i),d=v(i);let u=i.kind==="enum"&&!i.isList?s:void 0;u&&!i.isRequired&&!i.isList&&n.nullableMode!=="openapi"&&(u=[...u,null]);const y=l(n.enrichNativeTypes)?D(i):{};return{type:t,...l(n.persistOriginalType)&&{originalType:i.type},...o(c)&&{default:c},...o(r)&&{format:r},...o(a)&&{items:a},...o(u)&&{enum:u},...n.nullableMode==="openapi"&&!i.isRequired&&!i.isList&&{nullable:!0},...y,...o(d)&&{description:d}}},S=(e,n)=>i=>{const t={hasDefaultValue:i.hasDefaultValue,isScalar:i.kind==="scalar"||i.kind==="enum",required:i.isRequired},r=k(i)?m(i,n):N(e,n,i);return[i.name,r,t]};exports.O=S;exports.o=l;
@@ -0,0 +1 @@
1
+ const l=e=>e===!0||e==="true",o=e=>e!=null,p=(e,n)=>{switch(e){case"BigInt":return n.bigIntType==="string"?"string":"integer";case"Boolean":return"boolean";case"Bytes":case"DateTime":case"String":return"string";case"Decimal":case"Float":return"number";case"Int":return"integer";case"Json":return["number","string","boolean","object","array","null"];default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e)}`)}},f=(e,n)=>{const{isList:i,kind:t,type:r}=e;return t==="scalar"&&!i?p(r,n):i?"array":t==="enum"?"string":"object"},g=(e,n)=>{const{isList:i,isRequired:t}=e,r=f(e,n);return t||i||n.nullableMode==="openapi"?r:Array.isArray(r)?[...new Set(["null",...r])]:[r,"null"]},b=e=>{const n=e.default;if(e.hasDefaultValue){if(e.kind==="enum")return typeof n=="string"?n:void 0;if(e.kind==="scalar")switch(e.type){case"BigInt":case"DateTime":case"String":return typeof n=="string"?n:void 0;case"Boolean":return typeof n=="boolean"?n:void 0;case"Bytes":case"Json":return;case"Decimal":case"Float":case"Int":return typeof n=="number"?n:void 0;default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e.type)}`)}}},h=e=>{if(e==="DateTime")return"date-time"},m=(e,n)=>{const{persistOriginalType:i,schemaId:t}=n,r=e.isRequired||e.isList,s=`#/definitions/${e.type}`,a={$ref:t?`${t}${s}`:s};return r?a:n.nullableMode==="openapi"?{...a,nullable:!0,...l(i)&&{originalType:e.type}}:{anyOf:[a,{type:"null"}],...l(i)&&{originalType:e.type}}},T=(e,n,i)=>{if(!(e.kind==="scalar"&&!e.isList))return e.kind==="enum"?e.isList&&i?{enum:i,type:"string"}:void 0:e.kind==="scalar"&&e.isList?{type:p(e.type,n)}:m(e,n)},k=e=>e.kind!=="scalar"&&!e.isList&&e.kind!=="enum",L=(e,n)=>{if(e.enumNameToValues)return e.enumNameToValues.get(n.type);const i=e.enums.find(({name:t})=>t===n.type);if(i)return i.values.map(t=>t.name)},v=e=>e.documentation,D=e=>{const n={};if(e.kind!=="scalar")return n;e.type==="Bytes"&&(n.contentEncoding="base64");const i=e.nativeType;if(i){const[r,s]=i;if((r==="VarChar"||r==="Char")&&s.length>0){const a=Number.parseInt(s[0],10);Number.isFinite(a)&&(n.maxLength=a)}}const t=e.default;if(e.type==="String"&&typeof t=="object"&&"name"in t){const r=t.name;r==="uuid"?n.format="uuid":r==="cuid"&&(n.pattern="^c[a-z0-9]{24,}$")}return n},N=(e,n,i)=>{const t=g(i,n),r=h(i.type),s=L(e,i),a=T(i,n,s),c=b(i),d=v(i);let u=i.kind==="enum"&&!i.isList?s:void 0;u&&!i.isRequired&&!i.isList&&n.nullableMode!=="openapi"&&(u=[...u,null]);const y=l(n.enrichNativeTypes)?D(i):{};return{type:t,...l(n.persistOriginalType)&&{originalType:i.type},...o(c)&&{default:c},...o(r)&&{format:r},...o(a)&&{items:a},...o(u)&&{enum:u},...n.nullableMode==="openapi"&&!i.isRequired&&!i.isList&&{nullable:!0},...y,...o(d)&&{description:d}}},S=(e,n)=>i=>{const t={hasDefaultValue:i.hasDefaultValue,isScalar:i.kind==="scalar"||i.kind==="enum",required:i.isRequired},r=k(i)?m(i,n):N(e,n,i);return[i.name,r,t]};export{S as O,l as o};
@@ -0,0 +1 @@
1
+ import{O as f}from"./get-json-schema-property-DAfdAxpZ.mjs";export{f as default};
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./get-json-schema-property-BSId0ccp.cjs");module.exports=e.O;
@@ -0,0 +1 @@
1
+ "use strict";const p=require("./get-json-schema-property-BSId0ccp.cjs"),j=s=>new Set(s.fields.flatMap(e=>e.relationFromFields??[])),u=(s,e)=>a=>{const r=a.fields.map(p.O(s,e)),m=r.map(([t,o])=>[t,o]),d=j(a),c=m.filter(t=>!d.has(t[0])),n={properties:Object.fromEntries(p.o(e.keepRelationScalarFields)?m:c),type:"object"};return p.o(e.includeRequiredFields)&&(n.required=r.reduce((t,[o,,i])=>(i.required&&i.isScalar&&!i.hasDefaultValue&&t.push(o),t),[])),[a.name,n]},S=s=>s.slice(0,1).toLowerCase()+s.slice(1),b=({schemaId:s})=>e=>{const a=`#/definitions/${e.name}`;return[S(e.name),{$ref:s?`${s}${a}`:a}]},O=(s,e={})=>{const{enums:a,models:r,types:m=[]}=s.datamodel,d={$schema:"http://json-schema.org/draft-07/schema#",definitions:{},type:"object"},{schemaId:c}=e,n={enumNameToValues:new Map(a.map(l=>[l.name,l.values.map($=>$.name)])),enums:a},t=r.map(u(n,e)),o=m.map(u(n,e)),i=r.map(b(e)),f=Object.fromEntries([...t,...o]),h=Object.fromEntries(i);return{...c?{$id:c}:void 0,...d,definitions:f,properties:h}};module.exports=O;
@@ -0,0 +1 @@
1
+ import{O as j,o as l}from"./get-json-schema-property-DAfdAxpZ.mjs";const b=s=>new Set(s.fields.flatMap(e=>e.relationFromFields??[])),u=(s,e)=>a=>{const t=a.fields.map(j(s,e)),i=t.map(([n,o])=>[n,o]),c=b(a),d=i.filter(n=>!c.has(n[0])),r={properties:Object.fromEntries(l(e.keepRelationScalarFields)?i:d),type:"object"};return l(e.includeRequiredFields)&&(r.required=t.reduce((n,[o,,m])=>(m.required&&m.isScalar&&!m.hasDefaultValue&&n.push(o),n),[])),[a.name,r]},F=s=>s.slice(0,1).toLowerCase()+s.slice(1),M=({schemaId:s})=>e=>{const a=`#/definitions/${e.name}`;return[F(e.name),{$ref:s?`${s}${a}`:a}]},S=(s,e={})=>{const{enums:a,models:t,types:i=[]}=s.datamodel,c={$schema:"http://json-schema.org/draft-07/schema#",definitions:{},type:"object"},{schemaId:d}=e,r={enumNameToValues:new Map(a.map(p=>[p.name,p.values.map($=>$.name)])),enums:a},n=t.map(u(r,e)),o=i.map(u(r,e)),m=t.map(M(e)),f=Object.fromEntries([...n,...o]),h=Object.fromEntries(m);return{...d?{$id:d}:void 0,...c,definitions:f,properties:h}};export{S as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/prisma-dmmf-transformer",
3
- "version": "3.0.0-alpha.14",
3
+ "version": "3.0.0-alpha.16",
4
4
  "description": "A generator for Prisma to generate a valid JSON Schema v7.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var c=(e,t)=>f(e,"name",{value:t,configurable:!0});import{createRequire as g}from"node:module";const h=g(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=c(e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return h(e)},"__cjs_getBuiltinModule"),b=S("node:assert");var D=Object.defineProperty,s=c((e,t)=>D(e,"name",{value:t,configurable:!0}),"a");const u=s(e=>e!=null,"isDefined"),m=s(e=>{switch(e){case"BigInt":case"Int":return"integer";case"Boolean":return"boolean";case"Bytes":case"DateTime":case"String":return"string";case"Decimal":case"Float":return"number";case"Json":return["number","string","boolean","object","array","null"];default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e)}`)}},"getJSONSchemaScalar"),T=s(e=>{const{isList:t,isRequired:r,kind:n,type:a}=e;let i="object";return n==="scalar"&&!t?i=m(a):t?i="array":n==="enum"&&(i="string"),r||t?i:Array.isArray(i)?[...new Set(["null",...i])]:[i,"null"]},"getJSONSchemaType"),_=s(e=>{const t=e.default;if(e.hasDefaultValue){if(e.kind==="enum")return typeof t=="string"?t:void 0;if(e.kind==="scalar")switch(e.type){case"BigInt":case"DateTime":case"String":return typeof t=="string"?t:void 0;case"Boolean":return typeof t=="boolean"?t:void 0;case"Bytes":case"Json":return;case"Decimal":case"Float":case"Int":return typeof t=="number"?t:void 0;default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e.type)}`)}}},"getDefaultValue"),v=s(e=>{if(e==="DateTime")return"date-time"},"getFormatByDMMFType"),y=s((e,{persistOriginalType:t,schemaId:r})=>{const n=e.isRequired||e.isList;b.equal(typeof e.type,"string");const a=`#/definitions/${e.type}`,i={$ref:r?`${r}${a}`:a};return n?i:{anyOf:[i,{type:"null"}],...t&&{originalType:e.type}}},"getJSONSchemaForPropertyReference"),B=s((e,t)=>{if(!(e.kind==="scalar"&&!e.isList||e.kind==="enum"))return e.kind==="scalar"&&e.isList?{type:m(e.type)}:y(e,t)},"getItemsByDMMFType"),O=s(e=>e.kind!=="scalar"&&!e.isList&&e.kind!=="enum","isSingleReference"),k=s(e=>t=>{const r=e.enums.find(({name:n})=>n===t.type);if(r)return r.values.map(n=>n.name)},"getEnumListByDMMFType"),M=s(e=>e.documentation,"getDescription"),j=s((e,t,r)=>{const n=T(r),a=v(r.type),i=B(r,t),l=k(e)(r),d=_(r),p=M(r);return{type:n,...t.persistOriginalType&&{originalType:r.type},...u(d)&&{default:d},...u(a)&&{format:a},...u(i)&&{items:i},...u(l)&&{enum:l},...u(p)&&{description:p}}},"getPropertyDefinition"),J=s((e,t)=>r=>{const n={hasDefaultValue:r.hasDefaultValue,isScalar:r.kind==="scalar"||r.kind==="enum",required:r.isRequired},a=O(r)?y(r,t):j(e,t,r);return[r.name,a,n]},"getJSONSchemaProperty");export{J as default};
@@ -1 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var u=(e,t)=>p(e,"name",{value:t,configurable:!0});const f=require("node:assert"),g=u(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),D=g(f);var S=Object.defineProperty,a=u((e,t)=>S(e,"name",{value:t,configurable:!0}),"a");const o=a(e=>e!=null,"isDefined"),d=a(e=>{switch(e){case"BigInt":case"Int":return"integer";case"Boolean":return"boolean";case"Bytes":case"DateTime":case"String":return"string";case"Decimal":case"Float":return"number";case"Json":return["number","string","boolean","object","array","null"];default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e)}`)}},"getJSONSchemaScalar"),h=a(e=>{const{isList:t,isRequired:r,kind:n,type:s}=e;let i="object";return n==="scalar"&&!t?i=d(s):t?i="array":n==="enum"&&(i="string"),r||t?i:Array.isArray(i)?[...new Set(["null",...i])]:[i,"null"]},"getJSONSchemaType"),b=a(e=>{const t=e.default;if(e.hasDefaultValue){if(e.kind==="enum")return typeof t=="string"?t:void 0;if(e.kind==="scalar")switch(e.type){case"BigInt":case"DateTime":case"String":return typeof t=="string"?t:void 0;case"Boolean":return typeof t=="boolean"?t:void 0;case"Bytes":case"Json":return;case"Decimal":case"Float":case"Int":return typeof t=="number"?t:void 0;default:throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e.type)}`)}}},"getDefaultValue"),O=a(e=>{if(e==="DateTime")return"date-time"},"getFormatByDMMFType"),m=a((e,{persistOriginalType:t,schemaId:r})=>{const n=e.isRequired||e.isList;D.equal(typeof e.type,"string");const s=`#/definitions/${e.type}`,i={$ref:r?`${r}${s}`:s};return n?i:{anyOf:[i,{type:"null"}],...t&&{originalType:e.type}}},"getJSONSchemaForPropertyReference"),T=a((e,t)=>{if(!(e.kind==="scalar"&&!e.isList||e.kind==="enum"))return e.kind==="scalar"&&e.isList?{type:d(e.type)}:m(e,t)},"getItemsByDMMFType"),k=a(e=>e.kind!=="scalar"&&!e.isList&&e.kind!=="enum","isSingleReference"),B=a(e=>t=>{const r=e.enums.find(({name:n})=>n===t.type);if(r)return r.values.map(n=>n.name)},"getEnumListByDMMFType"),v=a(e=>e.documentation,"getDescription"),F=a((e,t,r)=>{const n=h(r),s=O(r.type),i=T(r,t),c=B(e)(r),l=b(r),y=v(r);return{type:n,...t.persistOriginalType&&{originalType:r.type},...o(l)&&{default:l},...o(s)&&{format:s},...o(i)&&{items:i},...o(c)&&{enum:c},...o(y)&&{description:y}}},"getPropertyDefinition"),J=a((e,t)=>r=>{const n={hasDefaultValue:r.hasDefaultValue,isScalar:r.kind==="scalar"||r.kind==="enum",required:r.isRequired},s=k(r)?m(r,t):F(e,t,r);return[r.name,s,n]},"getJSONSchemaProperty");module.exports=J;
@@ -1 +0,0 @@
1
- "use strict";var b=Object.defineProperty;var d=(r,e)=>b(r,"name",{value:e,configurable:!0});const j=require("./getJSONSchemaProperty-DRt6R_Y4.cjs");var S=Object.defineProperty,f=d((r,e)=>S(r,"name",{value:e,configurable:!0}),"n");const g=f(r=>r.fields.flatMap(e=>e.relationFromFields??[]),"getRelationScalarFields"),p=f((r,e)=>t=>{const s=t.fields.map(j(r,e)),o=s.map(([a,i])=>[a,i]),l=g(t),c=o.filter(a=>!l.includes(a[0])),m={properties:Object.fromEntries(e.keepRelationScalarFields==="true"?o:c),type:"object"};return e.includeRequiredFields&&(m.required=s.reduce((a,[i,,n])=>(n.required&&n.isScalar&&!n.hasDefaultValue&&a.push(i),a),[])),[t.name,m]},"getJSONSchemaModel");var v=Object.defineProperty,u=d((r,e)=>v(r,"name",{value:e,configurable:!0}),"o");const y=u(r=>r.slice(0,1).toLowerCase()+r.slice(1),"toCamelCase"),O=u(({schemaId:r})=>e=>{const t=`#/definitions/${e.name}`;return[y(e.name),{$ref:r?`${r}${t}`:t}]},"getPropertyDefinition"),$=u((r,e={})=>{const{enums:t,models:s,types:o}=r.datamodel,l={$schema:"http://json-schema.org/draft-07/schema#",definitions:{},type:"object"},{schemaId:c}=e,m=s.map(p({enums:t},e)),a=o.map(p({enums:t},e)),i=s.map(O(e)),n=Object.fromEntries([...m,...a]),h=Object.fromEntries(i);return{...c?{$id:c}:void 0,...l,definitions:n,properties:h}},"transformDmmf");module.exports=$;
@@ -1 +0,0 @@
1
- var b=Object.defineProperty;var d=(r,e)=>b(r,"name",{value:e,configurable:!0});import j from"./getJSONSchemaProperty-BJUSxFNN.mjs";var v=Object.defineProperty,p=d((r,e)=>v(r,"name",{value:e,configurable:!0}),"n");const O=p(r=>r.fields.flatMap(e=>e.relationFromFields??[]),"getRelationScalarFields"),u=p((r,e)=>t=>{const i=t.fields.map(j(r,e)),o=i.map(([a,s])=>[a,s]),c=O(t),m=o.filter(a=>!c.includes(a[0])),l={properties:Object.fromEntries(e.keepRelationScalarFields==="true"?o:m),type:"object"};return e.includeRequiredFields&&(l.required=i.reduce((a,[s,,n])=>(n.required&&n.isScalar&&!n.hasDefaultValue&&a.push(s),a),[])),[t.name,l]},"getJSONSchemaModel");var g=Object.defineProperty,f=d((r,e)=>g(r,"name",{value:e,configurable:!0}),"o");const y=f(r=>r.slice(0,1).toLowerCase()+r.slice(1),"toCamelCase"),S=f(({schemaId:r})=>e=>{const t=`#/definitions/${e.name}`;return[y(e.name),{$ref:r?`${r}${t}`:t}]},"getPropertyDefinition"),D=f((r,e={})=>{const{enums:t,models:i,types:o}=r.datamodel,c={$schema:"http://json-schema.org/draft-07/schema#",definitions:{},type:"object"},{schemaId:m}=e,l=i.map(u({enums:t},e)),a=o.map(u({enums:t},e)),s=i.map(S(e)),n=Object.fromEntries([...l,...a]),h=Object.fromEntries(s);return{...m?{$id:m}:void 0,...c,definitions:n,properties:h}},"transformDmmf");export{D as default};