express-zod-api 11.1.1-beta1 → 11.2.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Version 11
4
4
 
5
+ ### v11.2.0
6
+
7
+ - `winston` version is 3.10.0.
8
+ - `triple-beam` version is 1.4.1.
9
+ - Rearranged exports in `package.json`.
10
+
5
11
  ### v11.1.1
6
12
 
7
13
  - Technical update, no new features.
@@ -758,7 +764,7 @@ const endpoint = endpointsFactory.build({
758
764
  })
759
765
  .refine(
760
766
  (inputs) => Object.keys(inputs).length >= 1,
761
- "Please provide at least one property"
767
+ "Please provide at least one property",
762
768
  ),
763
769
  // ...
764
770
  });
@@ -1070,7 +1076,7 @@ import { defaultEndpointsFactory } from "express-zod-api";
1070
1076
  import cors from "cors";
1071
1077
 
1072
1078
  const myFactory = defaultEndpointsFactory.addExpressMiddleware(
1073
- cors({ credentials: true })
1079
+ cors({ credentials: true }),
1074
1080
  );
1075
1081
  ```
1076
1082
 
@@ -1362,7 +1368,7 @@ import cors from "cors";
1362
1368
  import { auth } from "express-oauth2-jwt-bearer";
1363
1369
 
1364
1370
  const simpleUsage = defaultEndpointsFactory.addExpressMiddleware(
1365
- cors({ credentials: true })
1371
+ cors({ credentials: true }),
1366
1372
  );
1367
1373
 
1368
1374
  const advancedUsage = defaultEndpointsFactory.use(auth(), {
@@ -1686,7 +1692,7 @@ const getUserEndpoint = endpointsFactory.build({
1686
1692
  id: z.string().transform((value) => parseInt(value, 10)),
1687
1693
  // other inputs (in query):
1688
1694
  withExtendedInformation: z.boolean().optional(),
1689
- })
1695
+ }),
1690
1696
  ).example({
1691
1697
  id: "12",
1692
1698
  withExtendedInformation: true,
@@ -1758,7 +1764,7 @@ const exampleEndpoint = defaultEndpointsFactory.build({
1758
1764
  z.object({
1759
1765
  id: z.number().int().nonnegative(),
1760
1766
  name: z.string().nonempty(),
1761
- })
1767
+ }),
1762
1768
  ).example({
1763
1769
  id: 12,
1764
1770
  name: "John Doe",
@@ -1767,7 +1773,7 @@ const exampleEndpoint = defaultEndpointsFactory.build({
1767
1773
  z.object({
1768
1774
  name: z.string(),
1769
1775
  timestamp: z.number().int().nonnegative(),
1770
- })
1776
+ }),
1771
1777
  ).example({
1772
1778
  name: "John Doe",
1773
1779
  timestamp: 1235698995125,
@@ -1872,7 +1878,7 @@ const config = createConfig({
1872
1878
  // example
1873
1879
  z.record(
1874
1880
  z.enum(["option1", "option2"]), // keys
1875
- z.boolean() // values
1881
+ z.boolean(), // values
1876
1882
  );
1877
1883
  ```
1878
1884
 
@@ -2117,7 +2123,7 @@ const fileStreamingEndpointsFactoryBefore = new EndpointsFactory(
2117
2123
  createResultHandler({
2118
2124
  getPositiveResponse: () => createApiResponse(z.string(), "image/*"),
2119
2125
  // ...,
2120
- })
2126
+ }),
2121
2127
  );
2122
2128
 
2123
2129
  // after
@@ -2125,7 +2131,7 @@ const fileStreamingEndpointsFactoryAfter = new EndpointsFactory(
2125
2131
  createResultHandler({
2126
2132
  getPositiveResponse: () => createApiResponse(z.file().binary(), "image/*"),
2127
2133
  // ...,
2128
- })
2134
+ }),
2129
2135
  );
2130
2136
  ```
2131
2137
 
@@ -2284,13 +2290,13 @@ const myResultHandlerV2 = createResultHandler({
2284
2290
  // ...,
2285
2291
  someProperty: markOutput(output),
2286
2292
  }),
2287
- ["mime/type1", "mime/type2"] // optional, default: application/json
2293
+ ["mime/type1", "mime/type2"], // optional, default: application/json
2288
2294
  ),
2289
2295
  getNegativeResponse: () =>
2290
2296
  createApiResponse(
2291
2297
  z.object({
2292
2298
  /* ... */
2293
- })
2299
+ }),
2294
2300
  ),
2295
2301
  handler: ({ error, input, output, request, response, logger }) => {
2296
2302
  /* ... */
@@ -2399,7 +2405,7 @@ const middleware = createMiddleware({
2399
2405
  .or(
2400
2406
  z.object({
2401
2407
  two: z.number(),
2402
- })
2408
+ }),
2403
2409
  ),
2404
2410
  middleware: async ({ input }) => ({
2405
2411
  input, // => type: { one: string } | { two: number }
package/README.md CHANGED
@@ -342,7 +342,7 @@ const nicknameConstraintMiddleware = createMiddleware({
342
342
  .min(1)
343
343
  .refine(
344
344
  (nick) => !/^\d.*$/.test(nick),
345
- "Nickname cannot start with a digit"
345
+ "Nickname cannot start with a digit",
346
346
  ),
347
347
  }),
348
348
  // ...,
@@ -361,7 +361,7 @@ const endpoint = endpointsFactory.build({
361
361
  })
362
362
  .refine(
363
363
  (inputs) => Object.keys(inputs).length >= 1,
364
- "Please provide at least one property"
364
+ "Please provide at least one property",
365
365
  ),
366
366
  // ...,
367
367
  });
@@ -571,13 +571,13 @@ const fileStreamingEndpointsFactory = new EndpointsFactory(
571
571
  }
572
572
  if ("filename" in output) {
573
573
  fs.createReadStream(output.filename).pipe(
574
- response.type(output.filename)
574
+ response.type(output.filename),
575
575
  );
576
576
  } else {
577
577
  response.status(400).send("Filename is missing");
578
578
  }
579
579
  },
580
- })
580
+ }),
581
581
  );
582
582
  ```
583
583
 
@@ -594,7 +594,7 @@ import cors from "cors";
594
594
  import { auth } from "express-oauth2-jwt-bearer";
595
595
 
596
596
  const simpleUsage = defaultEndpointsFactory.addExpressMiddleware(
597
- cors({ credentials: true })
597
+ cors({ credentials: true }),
598
598
  );
599
599
 
600
600
  const advancedUsage = defaultEndpointsFactory.use(auth(), {
@@ -818,7 +818,7 @@ writeFileSync(
818
818
  variant: "client", // <— optional, see also "types" for a DIY solution
819
819
  optionalPropStyle: { withQuestionMark: true, withUndefined: true }, // optional
820
820
  }).print(),
821
- "utf-8"
821
+ "utf-8",
822
822
  );
823
823
  ```
824
824
 
@@ -870,7 +870,7 @@ const exampleEndpoint = defaultEndpointsFactory.build({
870
870
  input: withMeta(
871
871
  z.object({
872
872
  id: z.number().describe("the ID of the user"),
873
- })
873
+ }),
874
874
  ).example({
875
875
  id: 123,
876
876
  }),
@@ -1 +1 @@
1
- {"type":"module","version":"11.1.1-beta1"}
1
+ {"type":"module","version":"11.2.0"}
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "express-zod-api",
3
- "version": "11.1.1-beta1",
3
+ "version": "11.2.0",
4
4
  "description": "A Typescript library to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
7
  "start": "ts-node example/index.ts",
8
- "build": "yarn build:compile && yarn build:dts && yarn build:tests && yarn build:swagger && yarn build:client && yarn build:license",
9
- "build:compile": "tsup",
10
- "build:dts": "mv dist/index.d.mts dist/esm/index.d.ts",
11
- "build:swagger": "ts-node example/generate-open-api-schema.ts > example/example.swagger.yaml",
12
- "build:client": "ts-node example/generate-client.ts > example/example.client.ts && yarn prettier example/example.client.ts --write",
13
- "build:license": "ts-node tools/license.ts > ./LICENSE",
8
+ "build": "yarn build:compile && yarn build:tests && yarn build:assets",
9
+ "build:compile": "tsup && mv dist/index.d.mts dist/esm/index.d.ts",
14
10
  "build:tests": "yarn build:intTest && yarn build:esmTest",
15
11
  "build:intTest": "ts-node tools/integration-test.ts && yarn install --cwd ./tests/integration && ts-node tools/int-test-package.ts",
16
12
  "build:esmTest": "ts-node tools/esm-test.ts && yarn install --cwd ./tests/esm && ts-node tools/esm-test-package.ts",
13
+ "build:assets": "yarn build:swagger && yarn build:client && yarn build:license",
14
+ "build:swagger": "ts-node example/generate-open-api-schema.ts > example/example.swagger.yaml",
15
+ "build:client": "ts-node example/generate-client.ts > example/example.client.ts && yarn prettier example/example.client.ts --write",
16
+ "build:license": "ts-node tools/license.ts > ./LICENSE",
17
17
  "test": "yarn test:types && yarn test:jest && yarn test:badge",
18
18
  "test:int": "jest ./tests/integration",
19
19
  "test:esm": "jest ./tests/esm",
@@ -34,12 +34,12 @@
34
34
  "exports": {
35
35
  ".": {
36
36
  "import": {
37
- "default": "./dist/esm/index.js",
38
- "types": "./dist/esm/index.d.ts"
37
+ "types": "./dist/esm/index.d.ts",
38
+ "default": "./dist/esm/index.js"
39
39
  },
40
40
  "require": {
41
- "default": "./dist/index.js",
42
- "types": "./dist/index.d.ts"
41
+ "types": "./dist/index.d.ts",
42
+ "default": "./dist/index.js"
43
43
  }
44
44
  }
45
45
  },
@@ -54,8 +54,8 @@
54
54
  "mime": "3.0.0",
55
55
  "openapi3-ts": "^4.1.2",
56
56
  "ramda": "0.29.0",
57
- "triple-beam": "1.3.0",
58
- "winston": "3.9.0"
57
+ "triple-beam": "1.4.1",
58
+ "winston": "3.10.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@types/express": "^4.17.13",
@@ -101,7 +101,7 @@
101
101
  "eslint-config-prettier": "^8.5.0",
102
102
  "eslint-plugin-import": "^2.26.0",
103
103
  "eslint-plugin-local-rules": "^1.3.2",
104
- "eslint-plugin-prettier": "^4.2.1",
104
+ "eslint-plugin-prettier": "^5.0.0",
105
105
  "express": "^4.18.2",
106
106
  "form-data": "^4.0.0",
107
107
  "has-ansi": "^4.0.1",
@@ -110,7 +110,7 @@
110
110
  "make-coverage-badge": "^1.2.0",
111
111
  "mockdate": "^3.0.5",
112
112
  "node-fetch": "^2.6.11",
113
- "prettier": "2.8.8",
113
+ "prettier": "3.0.0",
114
114
  "strip-ansi": "^6.0.1",
115
115
  "ts-node": "^10.9.1",
116
116
  "tsd": "^0.28.0",