create-fastify-flux 2.30.0 → 2.31.0

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.
@@ -17,26 +17,26 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@fastify/swagger": "8.3.1",
21
- "@fastify/swagger-ui": "1.6.0",
22
- "@prisma/client": "4.12.0",
23
- "fastify": "4.15.0",
20
+ "@fastify/swagger": "8.4.0",
21
+ "@fastify/swagger-ui": "1.8.1",
22
+ "@prisma/client": "4.14.1",
23
+ "fastify": "4.17.0",
24
24
  "fastify-flux": "workspace:*",
25
25
  "tsconfig-paths": "4.2.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@types/jest": "29.5.0",
29
- "@types/node": "18.15.11",
30
- "@typescript-eslint/eslint-plugin": "5.57.0",
31
- "@typescript-eslint/parser": "5.57.0",
32
- "axios": "1.3.4",
33
- "esbuild": "0.17.15",
34
- "eslint": "8.37.0",
28
+ "@types/jest": "29.5.1",
29
+ "@types/node": "18.16.14",
30
+ "@typescript-eslint/eslint-plugin": "5.59.6",
31
+ "@typescript-eslint/parser": "5.59.6",
32
+ "axios": "1.4.0",
33
+ "esbuild": "0.17.19",
34
+ "eslint": "8.41.0",
35
35
  "fastify-flux-cli": "workspace:*",
36
36
  "jest": "29.5.0",
37
37
  "pino-pretty": "10.0.0",
38
- "prisma": "4.12.0",
39
- "ts-jest": "29.0.5",
40
- "typescript": "5.0.3"
38
+ "prisma": "4.14.1",
39
+ "ts-jest": "29.1.0",
40
+ "typescript": "5.0.4"
41
41
  }
42
42
  }
@@ -1,4 +1,4 @@
1
- import { Controller, Delete, Get, Post, Status } from 'fastify-flux';
1
+ import { Controller, Delete, Get, Post, Put, Status } from 'fastify-flux';
2
2
  import { CreateTodo, ListTodoQuery, TodoResponse, UpdateTodo } from './Todo.schema';
3
3
  import { HttpException } from '~/helper/exceptions';
4
4
  import { PrismaClient } from '@prisma/client';
@@ -32,7 +32,7 @@ export class TodoController {
32
32
  return found;
33
33
  }
34
34
 
35
- @Post('/:id')
35
+ @Put('/:id')
36
36
  async update(id: number, body: UpdateTodo): Promise<TodoResponse> {
37
37
  const found = await prisma.todos.findUnique({ where: { id } });
38
38
 
@@ -86,10 +86,6 @@ export class HttpClient<SecurityDataType = unknown> {
86
86
  const requestParams = params;
87
87
  const responseFormat = (format && this.format) || void 0;
88
88
 
89
- if (!type) {
90
- type = ContentType.Json;
91
- }
92
-
93
89
  if (!body) {
94
90
  body = {};
95
91
  }
@@ -97,10 +93,6 @@ export class HttpClient<SecurityDataType = unknown> {
97
93
  try {
98
94
  const result: any = await this.instance.request({
99
95
  ...requestParams,
100
- headers: {
101
- ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
102
- ...(requestParams.headers || {}),
103
- } as any,
104
96
  params: query,
105
97
  responseType: responseFormat,
106
98
  data: body,
@@ -220,7 +212,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
220
212
  *
221
213
  * @tags todos
222
214
  * @name Update
223
- * @request POST:/todos/{id}
215
+ * @request PUT:/todos/{id}
224
216
  */
225
217
  update: (
226
218
  id: number,
@@ -245,7 +237,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
245
237
  any
246
238
  >({
247
239
  path: `/todos/${id}`,
248
- method: 'POST',
240
+ method: 'PUT',
249
241
  body: data,
250
242
  type: ContentType.Json,
251
243
  format: 'json',
@@ -8,6 +8,12 @@ test('create todo', async () => {
8
8
  await client.todos.create({ text: 'foobar', priority: 1 });
9
9
  });
10
10
 
11
+ test('update todo', async () => {
12
+ const result = await client.todos.create({ text: 'foobar', priority: 1 });
13
+ await client.todos.get(result.id);
14
+ await client.todos.update(result.id, { text: 'barfoo', priority: 2 });
15
+ });
16
+
11
17
  test('get todo', async () => {
12
18
  const result = await client.todos.create({ text: 'foobar', priority: 1 });
13
19
  await client.todos.get(result.id);
package/package.json CHANGED
@@ -9,18 +9,18 @@
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
11
  "chalk": "5.2.0",
12
- "commander": "10.0.0",
12
+ "commander": "10.0.1",
13
13
  "enquirer": "2.3.6",
14
14
  "fs-extra": "11.1.1",
15
15
  "source-map-support": "0.5.21"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/fs-extra": "11.0.1",
19
- "@types/jest": "29.5.0",
20
- "@types/node": "18.15.11",
19
+ "@types/jest": "29.5.1",
20
+ "@types/node": "18.16.14",
21
21
  "jest": "29.5.0",
22
- "ts-jest": "29.0.5",
23
- "typescript": "5.0.3"
22
+ "ts-jest": "29.1.0",
23
+ "typescript": "5.0.4"
24
24
  },
25
25
  "files": [
26
26
  "cli.js",
@@ -30,7 +30,7 @@
30
30
  "engines": {
31
31
  "node": ">=16"
32
32
  },
33
- "version": "2.30.0",
33
+ "version": "2.31.0",
34
34
  "scripts": {
35
35
  "clean": "rm -rf dist/",
36
36
  "test": "exit 0",