From 75b3a6be2a532d63cfd68c7d0b1c6c4e5d4203a8 Mon Sep 17 00:00:00 2001 From: Chris Cates Date: Sun, 25 Jun 2023 18:13:13 -0400 Subject: [PATCH] v2.0.2 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- dist/src/generators/prisma.js | 2 +- dist/src/generators/prisma.js.map | 2 +- dist/src/printer.js | 2 +- dist/src/templates/api.template | 1 + src/generators/prisma.ts | 2 +- src/printer.ts | 2 +- src/templates/api.template | 1 + 9 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fdef95..b807927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # 🛠️ CHANGELOG +## v2.0.2 + +- Ensure API routes have `application/json` header + +- Fix `printer prisma` `?` error + ## v2.0.1 - Fix injectable formatting issues diff --git a/README.md b/README.md index e1dcd16..320a002 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Automation Tooling for Next, Redux and Prisma ![license](https://img.shields.io/badge/license-AGPLv3-blue.svg) -![version](https://img.shields.io/badge/version-2.0.0-blue.svg) +![version](https://img.shields.io/badge/version-2.0.2-blue.svg) [![CircleCI](https://circleci.com/gh/PrinterFramework/CLI.svg?style=svg)](https://circleci.com/gh/PrinterFramework/CLI) [![codecov](https://codecov.io/gh/PrinterFramework/CLI/branch/master/graph/badge.svg)](https://codecov.io/gh/PrinterFramework/CLI) diff --git a/dist/src/generators/prisma.js b/dist/src/generators/prisma.js index 3112a5f..5ce7f53 100755 --- a/dist/src/generators/prisma.js +++ b/dist/src/generators/prisma.js @@ -97,7 +97,7 @@ function formatModel(models) { try { for (var models_1 = __values(models), models_1_1 = models_1.next(); !models_1_1.done; models_1_1 = models_1.next()) { var model = models_1_1.value; - var type = model.type.toUpperCase().trim(); + var type = model.type.toUpperCase().trim().replaceAll('?', ''); var tm = type.replaceAll('[]', ''); var imported = false; var newType = 'any'; diff --git a/dist/src/generators/prisma.js.map b/dist/src/generators/prisma.js.map index 6168400..2a54864 100755 --- a/dist/src/generators/prisma.js.map +++ b/dist/src/generators/prisma.js.map @@ -1 +1 @@ -{"version":3,"file":"prisma.js","sourceRoot":"","sources":["../../../src/generators/prisma.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA2B;AAC3B,yCAAwC;AACxC,sCAAoC;AAcpC,IAAM,WAAW,GAAG;IAClB;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;KAChF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;KAC/C;IACD;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC;KAC3C;CACe,CAAA;AAElB,SAAS,WAAW,CAAE,MAAmB;;IACvC,IAAM,eAAe,GAAG,EAAiB,CAAA;IACzC,IAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAvB,CAAuB,CAAC,CAAA;;QAE3D,KAAoB,IAAA,WAAA,SAAA,MAAM,CAAA,8BAAA,kDAAE;YAAvB,IAAM,KAAK,mBAAA;YACd,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;YAC5C,IAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YACpC,IAAI,QAAQ,GAAG,KAAK,CAAA;YACpB,IAAI,OAAO,GAAG,KAAK,CAAA;;gBAEnB,KAAwB,IAAA,+BAAA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AM,GAAG,IAAI,CAAA;wBACxH,UAAU,GAAG,EAAE,CAAA;;4BAEnB,KAAmB,2BAAA,SAAA,OAAO,CAAA,CAAA,qFAAE;gCAAjB,IAAI;gCACb,UAAU,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;6BAC1D;;;;;;;;;wBAED,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,GAAG,UAAU,CAAC,CAAA;wBAC/D,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;wBAC/C,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAG,IAAI,SAAM,CAAC,CAAA;wBAEtE,IAAA,SAAG,EAAC,6CAAiC,IAAI,SAAM,CAAC,KAAK,CAAC,CAAA;wBACtD,IAAA,kBAAK,EAAC,QAAQ,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAA;qBAChC;iBACF;;;;;;;;;;;;CACF;AArDD,kDAqDC"} \ No newline at end of file diff --git a/dist/src/printer.js b/dist/src/printer.js index dd6cbf9..cc016b7 100755 --- a/dist/src/printer.js +++ b/dist/src/printer.js @@ -56,7 +56,7 @@ var prisma_1 = require("./generators/prisma"); var superagent_1 = require("./generators/superagent"); exports.Printer = new commander_1.Command('🖨️ Printer'); exports.Printer - .version('2.0.1') + .version('2.0.2') .description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.') .option('-a, --no-action', 'do not inject actions', false) .option('-s, --no-state', 'do not inject state', false); diff --git a/dist/src/templates/api.template b/dist/src/templates/api.template index 0a83588..68bec5a 100755 --- a/dist/src/templates/api.template +++ b/dist/src/templates/api.template @@ -5,6 +5,7 @@ export async function GET(req: NextRequest) { const res = new NextResponse() const session = await getSession(req, res) const { searchParams } = new URL(req.url) + res.headers.set('Content-Type', 'application/json') try { return createResponse( diff --git a/src/generators/prisma.ts b/src/generators/prisma.ts index af187b0..7e2b71b 100644 --- a/src/generators/prisma.ts +++ b/src/generators/prisma.ts @@ -34,7 +34,7 @@ function formatModel (models: ModelType[]): ModelType[] { const names = models.map((item) => item.name.toUpperCase()) for (const model of models) { - const type = model.type.toUpperCase().trim() + const type = model.type.toUpperCase().trim().replaceAll('?', '') const tm = type.replaceAll('[]', '') let imported = false let newType = 'any' diff --git a/src/printer.ts b/src/printer.ts index 7080213..0ee2515 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -17,7 +17,7 @@ import { SuperagentTypes, injectSupergent } from './generators/superagent' export const Printer = new Command('🖨️ Printer') Printer - .version('2.0.1') + .version('2.0.2') .description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.') .option('-a, --no-action', 'do not inject actions', false) .option('-s, --no-state', 'do not inject state', false) diff --git a/src/templates/api.template b/src/templates/api.template index 0a83588..68bec5a 100644 --- a/src/templates/api.template +++ b/src/templates/api.template @@ -5,6 +5,7 @@ export async function GET(req: NextRequest) { const res = new NextResponse() const session = await getSession(req, res) const { searchParams } = new URL(req.url) + res.headers.set('Content-Type', 'application/json') try { return createResponse(