@prisma/dmmf 7.3.0-integration-prisma6-fix-cloudflare-engine.2 → 7.3.0-integration-engines-7-3-0-10-fix-fix-mapped-enum-issue-0b7e6564db7dc3dac7f9312aa84e9ed81d805521.1

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/convert.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import { DatamodelEnum, SchemaEnum } from './dmmf';
1
+ import { DatamodelEnum, DatamodelSchemaEnum, SchemaEnum } from './dmmf';
2
2
  export declare function datamodelEnumToSchemaEnum(datamodelEnum: DatamodelEnum): SchemaEnum;
3
+ export declare function datamodelSchemaEnumToSchemaEnum(datamodelSchemaEnum: DatamodelSchemaEnum): SchemaEnum;
package/dist/convert.js CHANGED
@@ -18,16 +18,30 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var convert_exports = {};
20
20
  __export(convert_exports, {
21
- datamodelEnumToSchemaEnum: () => datamodelEnumToSchemaEnum
21
+ datamodelEnumToSchemaEnum: () => datamodelEnumToSchemaEnum,
22
+ datamodelSchemaEnumToSchemaEnum: () => datamodelSchemaEnumToSchemaEnum
22
23
  });
23
24
  module.exports = __toCommonJS(convert_exports);
24
25
  function datamodelEnumToSchemaEnum(datamodelEnum) {
25
26
  return {
26
27
  name: datamodelEnum.name,
27
- values: datamodelEnum.values.map((v) => v.name)
28
+ data: datamodelEnum.values.map((v) => ({
29
+ key: v.name,
30
+ value: v.dbName ?? v.name
31
+ }))
32
+ };
33
+ }
34
+ function datamodelSchemaEnumToSchemaEnum(datamodelSchemaEnum) {
35
+ return {
36
+ name: datamodelSchemaEnum.name,
37
+ data: datamodelSchemaEnum.values.map((v) => ({
38
+ key: v,
39
+ value: v
40
+ }))
28
41
  };
29
42
  }
30
43
  // Annotate the CommonJS export names for ESM import in node:
31
44
  0 && (module.exports = {
32
- datamodelEnumToSchemaEnum
45
+ datamodelEnumToSchemaEnum,
46
+ datamodelSchemaEnumToSchemaEnum
33
47
  });
package/dist/convert.mjs CHANGED
@@ -1,9 +1,22 @@
1
1
  function datamodelEnumToSchemaEnum(datamodelEnum) {
2
2
  return {
3
3
  name: datamodelEnum.name,
4
- values: datamodelEnum.values.map((v) => v.name)
4
+ data: datamodelEnum.values.map((v) => ({
5
+ key: v.name,
6
+ value: v.dbName ?? v.name
7
+ }))
8
+ };
9
+ }
10
+ function datamodelSchemaEnumToSchemaEnum(datamodelSchemaEnum) {
11
+ return {
12
+ name: datamodelSchemaEnum.name,
13
+ data: datamodelSchemaEnum.values.map((v) => ({
14
+ key: v,
15
+ value: v
16
+ }))
5
17
  };
6
18
  }
7
19
  export {
8
- datamodelEnumToSchemaEnum
20
+ datamodelEnumToSchemaEnum,
21
+ datamodelSchemaEnumToSchemaEnum
9
22
  };
@@ -13,6 +13,19 @@ var import_convert = require("./convert");
13
13
  const dmmfEnum = (0, import_convert.datamodelEnumToSchemaEnum)(datamodelEnum);
14
14
  (0, import_vitest.expect)(dmmfEnum).toEqual({
15
15
  name: "Color",
16
- values: ["Red", "Green", "Blue"]
16
+ data: [
17
+ {
18
+ key: "Red",
19
+ value: "red"
20
+ },
21
+ {
22
+ key: "Green",
23
+ value: "Green"
24
+ },
25
+ {
26
+ key: "Blue",
27
+ value: "Blue"
28
+ }
29
+ ]
17
30
  });
18
31
  });
@@ -12,6 +12,19 @@ test("datamodelEnumToSchemaEnum", () => {
12
12
  const dmmfEnum = datamodelEnumToSchemaEnum(datamodelEnum);
13
13
  expect(dmmfEnum).toEqual({
14
14
  name: "Color",
15
- values: ["Red", "Green", "Blue"]
15
+ data: [
16
+ {
17
+ key: "Red",
18
+ value: "red"
19
+ },
20
+ {
21
+ key: "Green",
22
+ value: "Green"
23
+ },
24
+ {
25
+ key: "Blue",
26
+ value: "Blue"
27
+ }
28
+ ]
16
29
  });
17
30
  });
package/dist/dmmf.d.ts CHANGED
@@ -21,10 +21,17 @@ export type DatamodelEnum = ReadonlyDeep<{
21
21
  dbName?: string | null;
22
22
  documentation?: string;
23
23
  }>;
24
- export type SchemaEnum = ReadonlyDeep<{
24
+ export type DatamodelSchemaEnum = ReadonlyDeep<{
25
25
  name: string;
26
26
  values: string[];
27
27
  }>;
28
+ export type SchemaEnum = ReadonlyDeep<{
29
+ name: string;
30
+ data: {
31
+ key: string;
32
+ value: string;
33
+ }[];
34
+ }>;
28
35
  export type EnumValue = ReadonlyDeep<{
29
36
  name: string;
30
37
  dbName: string | null;
@@ -123,8 +130,8 @@ export type Schema = ReadonlyDeep<{
123
130
  prisma: OutputType[];
124
131
  };
125
132
  enumTypes: {
126
- model?: SchemaEnum[];
127
- prisma: SchemaEnum[];
133
+ model?: DatamodelSchemaEnum[];
134
+ prisma: DatamodelSchemaEnum[];
128
135
  };
129
136
  fieldRefTypes: {
130
137
  prisma?: FieldRefType[];
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './convert';
2
2
  export * from './dmmf';
3
+ export * from './util';
package/dist/index.js CHANGED
@@ -17,8 +17,10 @@ var index_exports = {};
17
17
  module.exports = __toCommonJS(index_exports);
18
18
  __reExport(index_exports, require("./convert"), module.exports);
19
19
  __reExport(index_exports, require("./dmmf"), module.exports);
20
+ __reExport(index_exports, require("./util"), module.exports);
20
21
  // Annotate the CommonJS export names for ESM import in node:
21
22
  0 && (module.exports = {
22
23
  ...require("./convert"),
23
- ...require("./dmmf")
24
+ ...require("./dmmf"),
25
+ ...require("./util")
24
26
  });
package/dist/index.mjs CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./convert";
2
2
  export * from "./dmmf";
3
+ export * from "./util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/dmmf",
3
- "version": "7.3.0-integration-prisma6-fix-cloudflare-engine.2",
3
+ "version": "7.3.0-integration-engines-7-3-0-10-fix-fix-mapped-enum-issue-0b7e6564db7dc3dac7f9312aa84e9ed81d805521.1",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",