prisma-swagger-autogen 1.0.3 → 1.0.4

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.
@@ -36,12 +36,7 @@ function loadDmmfFromProject(schemaPath) {
36
36
  }
37
37
  const datamodel = fs.readFileSync(resolvedSchemaPath, "utf8");
38
38
  const require2 = getRequire();
39
- let internals;
40
- try {
41
- internals = require2("@prisma/internals");
42
- } catch {
43
- throw new Error(`Unable to load @prisma/internals`);
44
- }
39
+ const internals = require2("@prisma/internals");
45
40
  if (typeof internals.getDMMF !== "function") {
46
41
  throw new Error(`@prisma/internals.getDMMF not available`);
47
42
  }
@@ -155,41 +150,6 @@ function buildSchemasFromPrismaDmmf(schemaPath) {
155
150
  schemas[putName] = putSchema;
156
151
  schemas[listName] = listResponseSchema(`#/components/schemas/${getName}`);
157
152
  }
158
- schemas["ExceptionResponse"] = {
159
- type: "object",
160
- properties: {
161
- detail: { type: "string" },
162
- errors: { type: "array", items: { type: "string" } },
163
- status: { type: "number" },
164
- title: { type: "string" },
165
- type: { type: "string" }
166
- },
167
- required: ["status", "title", "type"]
168
- };
169
- schemas["BadRequestResponse"] = {
170
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
171
- example: {
172
- status: 400,
173
- title: "The request was invalid",
174
- type: "https://tools.ietf.org/html/rfc7231#section-6.5.1"
175
- }
176
- };
177
- schemas["NotFoundResponse"] = {
178
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
179
- example: {
180
- status: 404,
181
- title: "The specified resource was not found",
182
- type: "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4"
183
- }
184
- };
185
- schemas["InternalErrorResponse"] = {
186
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
187
- example: {
188
- status: 500,
189
- title: "An error occurred while processing your request",
190
- type: "https://tools.ietf.org/html/rfc7231#section-6.6.1"
191
- }
192
- };
193
153
  return schemas;
194
154
  }
195
155
  function generateSwaggerConfigJs(schemas) {
package/dist/cli.cjs CHANGED
@@ -61,12 +61,7 @@ function loadDmmfFromProject(schemaPath) {
61
61
  }
62
62
  const datamodel = import_node_fs.default.readFileSync(resolvedSchemaPath, "utf8");
63
63
  const require2 = getRequire();
64
- let internals;
65
- try {
66
- internals = require2("@prisma/internals");
67
- } catch {
68
- throw new Error(`Unable to load @prisma/internals`);
69
- }
64
+ const internals = require2("@prisma/internals");
70
65
  if (typeof internals.getDMMF !== "function") {
71
66
  throw new Error(`@prisma/internals.getDMMF not available`);
72
67
  }
@@ -180,41 +175,6 @@ function buildSchemasFromPrismaDmmf(schemaPath) {
180
175
  schemas[putName] = putSchema;
181
176
  schemas[listName] = listResponseSchema(`#/components/schemas/${getName}`);
182
177
  }
183
- schemas["ExceptionResponse"] = {
184
- type: "object",
185
- properties: {
186
- detail: { type: "string" },
187
- errors: { type: "array", items: { type: "string" } },
188
- status: { type: "number" },
189
- title: { type: "string" },
190
- type: { type: "string" }
191
- },
192
- required: ["status", "title", "type"]
193
- };
194
- schemas["BadRequestResponse"] = {
195
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
196
- example: {
197
- status: 400,
198
- title: "The request was invalid",
199
- type: "https://tools.ietf.org/html/rfc7231#section-6.5.1"
200
- }
201
- };
202
- schemas["NotFoundResponse"] = {
203
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
204
- example: {
205
- status: 404,
206
- title: "The specified resource was not found",
207
- type: "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4"
208
- }
209
- };
210
- schemas["InternalErrorResponse"] = {
211
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
212
- example: {
213
- status: 500,
214
- title: "An error occurred while processing your request",
215
- type: "https://tools.ietf.org/html/rfc7231#section-6.6.1"
216
- }
217
- };
218
178
  return schemas;
219
179
  }
220
180
  function generateSwaggerConfigJs(schemas) {
@@ -254,7 +214,7 @@ async function run(args = []) {
254
214
  }
255
215
 
256
216
  // src/cli.ts
257
- run(process.argv.slice(2)).catch((e) => {
217
+ void run(process.argv.slice(2)).catch((e) => {
258
218
  console.error(e);
259
219
  process.exitCode = 1;
260
220
  });
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-6R6DHPOL.js";
3
+ } from "./chunk-NLFDSHIX.js";
4
4
 
5
5
  // src/cli.ts
6
- run(process.argv.slice(2)).catch((e) => {
6
+ void run(process.argv.slice(2)).catch((e) => {
7
7
  console.error(e);
8
8
  process.exitCode = 1;
9
9
  });
package/dist/index.cjs CHANGED
@@ -71,12 +71,7 @@ function loadDmmfFromProject(schemaPath) {
71
71
  }
72
72
  const datamodel = import_node_fs.default.readFileSync(resolvedSchemaPath, "utf8");
73
73
  const require2 = getRequire();
74
- let internals;
75
- try {
76
- internals = require2("@prisma/internals");
77
- } catch {
78
- throw new Error(`Unable to load @prisma/internals`);
79
- }
74
+ const internals = require2("@prisma/internals");
80
75
  if (typeof internals.getDMMF !== "function") {
81
76
  throw new Error(`@prisma/internals.getDMMF not available`);
82
77
  }
@@ -190,41 +185,6 @@ function buildSchemasFromPrismaDmmf(schemaPath) {
190
185
  schemas[putName] = putSchema;
191
186
  schemas[listName] = listResponseSchema(`#/components/schemas/${getName}`);
192
187
  }
193
- schemas["ExceptionResponse"] = {
194
- type: "object",
195
- properties: {
196
- detail: { type: "string" },
197
- errors: { type: "array", items: { type: "string" } },
198
- status: { type: "number" },
199
- title: { type: "string" },
200
- type: { type: "string" }
201
- },
202
- required: ["status", "title", "type"]
203
- };
204
- schemas["BadRequestResponse"] = {
205
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
206
- example: {
207
- status: 400,
208
- title: "The request was invalid",
209
- type: "https://tools.ietf.org/html/rfc7231#section-6.5.1"
210
- }
211
- };
212
- schemas["NotFoundResponse"] = {
213
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
214
- example: {
215
- status: 404,
216
- title: "The specified resource was not found",
217
- type: "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4"
218
- }
219
- };
220
- schemas["InternalErrorResponse"] = {
221
- allOf: [{ $ref: "#/components/schemas/ExceptionResponse" }],
222
- example: {
223
- status: 500,
224
- title: "An error occurred while processing your request",
225
- type: "https://tools.ietf.org/html/rfc7231#section-6.6.1"
226
- }
227
- };
228
188
  return schemas;
229
189
  }
230
190
  function generateSwaggerConfigJs(schemas) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-6R6DHPOL.js";
3
+ } from "./chunk-NLFDSHIX.js";
4
4
  export {
5
5
  run
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-swagger-autogen",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Generate swagger-autogen config + Prisma DMMF schemas and fix swagger-autogen output.",
5
5
  "license": "MIT",
6
6
  "author": "Joyce Marvin Rafflenbeul",
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "bin": {
34
- "prisma-swagger-autogen": "./dist/cli.js"
34
+ "prisma-swagger-autogen": "./dist/cli.cjs"
35
35
  },
36
36
  "files": [
37
37
  "dist",