counterfact 1.4.1 → 1.4.2

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.
Files changed (2) hide show
  1. package/dist/server/types.ts +16 -9
  2. package/package.json +20 -18
@@ -22,8 +22,10 @@ type COUNTERFACT_RESPONSE = typeof counterfactResponseObject;
22
22
 
23
23
  type MediaType = `${string}/${string}`;
24
24
 
25
- type OmitAll<T, K extends (keyof T)[]> = {
26
- [P in keyof T as P extends K[number] ? never : P]: T[P];
25
+ type OmitAll<T, K extends readonly string[]> = {
26
+ [P in keyof T as P extends `${string}${K[number]}${string}`
27
+ ? never
28
+ : P]: T[P];
27
29
  };
28
30
 
29
31
  type OmitValueWhenNever<Base> = Pick<
@@ -43,15 +45,18 @@ interface OpenApiResponses {
43
45
  [key: string]: OpenApiResponse;
44
46
  }
45
47
 
46
- type IfHasKey<SomeObject, Keys extends (keyof any)[], Yes, No> = Keys extends [
47
- infer FirstKey,
48
- ...infer RestKeys,
48
+ type IfHasKey<
49
+ SomeObject,
50
+ Keys extends readonly string[],
51
+ Yes,
52
+ No,
53
+ > = Keys extends [
54
+ infer FirstKey extends string,
55
+ ...infer RestKeys extends string[],
49
56
  ]
50
- ? FirstKey extends keyof SomeObject
57
+ ? keyof SomeObject extends `${string}${FirstKey}${string}`
51
58
  ? Yes
52
- : RestKeys extends (keyof any)[]
53
- ? IfHasKey<SomeObject, RestKeys, Yes, No>
54
- : No
59
+ : IfHasKey<SomeObject, RestKeys, Yes, No>
55
60
  : No;
56
61
 
57
62
  type SchemasOf<T extends { [key: string]: { schema: any } }> = {
@@ -279,4 +284,6 @@ export type {
279
284
  ResponseBuilderFactory,
280
285
  WideOperationArgument,
281
286
  WideResponseBuilder,
287
+ OmitAll,
288
+ IfHasKey,
282
289
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterfact",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "a library for building a fake REST API for testing",
5
5
  "type": "module",
6
6
  "main": "./dist/app.js",
@@ -31,6 +31,7 @@
31
31
  "test": "yarn node --experimental-vm-modules ./node_modules/jest-cli/bin/jest --testPathIgnorePatterns=black-box",
32
32
  "test:black-box": "rimraf dist && rimraf out && yarn build && yarn node --experimental-vm-modules ./node_modules/jest-cli/bin/jest black-box --forceExit --coverage=false",
33
33
  "test:mutants": "stryker run stryker.config.json",
34
+ "test:tsd": "tsd --typings ./dist/server/types.ts --files ./test/**/*.test-d.ts",
34
35
  "build": "tsc && copyfiles -f \"src/client/**\" dist/client && copyfiles -f \"src/server/types.ts\" dist/server && copyfiles -f \"src/server/*.cjs\" dist/server",
35
36
  "prepack": "yarn build",
36
37
  "release": "npx changeset publish",
@@ -44,40 +45,41 @@
44
45
  "postinstall": "patch-package"
45
46
  },
46
47
  "devDependencies": {
47
- "@changesets/cli": "2.29.4",
48
+ "@changesets/cli": "2.29.6",
48
49
  "@stryker-mutator/core": "9.0.1",
49
50
  "@stryker-mutator/jest-runner": "9.0.1",
50
51
  "@stryker-mutator/typescript-checker": "9.0.1",
51
- "@swc/core": "1.12.1",
52
- "@swc/jest": "0.2.38",
53
- "@testing-library/dom": "10.4.0",
52
+ "@swc/core": "1.13.3",
53
+ "@swc/jest": "0.2.39",
54
+ "@testing-library/dom": "10.4.1",
54
55
  "@types/jest": "30.0.0",
55
56
  "@types/js-yaml": "4.0.9",
56
57
  "@types/koa": "2.15.0",
57
58
  "@types/koa-bodyparser": "4.3.12",
58
59
  "@types/koa-proxy": "1.0.7",
59
60
  "@types/koa-static": "4.0.4",
60
- "@types/lodash": "4.17.17",
61
+ "@types/lodash": "4.17.20",
61
62
  "copyfiles": "2.4.1",
62
63
  "eslint": "9.28.0",
63
- "eslint-config-hardcore": "47.0.1",
64
+ "eslint-config-hardcore": "49.0.0",
64
65
  "eslint-formatter-github-annotations": "0.1.0",
65
- "eslint-import-resolver-typescript": "4.4.3",
66
+ "eslint-import-resolver-typescript": "4.4.4",
66
67
  "eslint-plugin-etc": "2.0.3",
67
68
  "eslint-plugin-file-progress": "3.0.2",
68
- "eslint-plugin-import": "2.31.0",
69
- "eslint-plugin-jest": "28.14.0",
69
+ "eslint-plugin-import": "2.32.0",
70
+ "eslint-plugin-jest": "29.0.1",
70
71
  "eslint-plugin-jest-dom": "5.5.0",
71
72
  "eslint-plugin-no-explicit-type-exports": "0.12.1",
72
- "eslint-plugin-prettier": "5.4.1",
73
+ "eslint-plugin-prettier": "5.5.4",
73
74
  "eslint-plugin-unused-imports": "4.1.4",
74
75
  "husky": "9.1.7",
75
- "jest": "30.0.0",
76
+ "jest": "30.0.5",
76
77
  "jest-retries": "1.0.1",
77
78
  "node-mocks-http": "1.17.2",
78
79
  "rimraf": "6.0.1",
79
80
  "stryker-cli": "1.0.2",
80
- "supertest": "7.1.1",
81
+ "supertest": "7.1.4",
82
+ "tsd": "^0.33.0",
81
83
  "using-temporary-files": "2.2.1"
82
84
  },
83
85
  "dependencies": {
@@ -89,24 +91,24 @@
89
91
  "commander": "14.0.0",
90
92
  "debug": "4.4.1",
91
93
  "fetch": "1.1.0",
92
- "fs-extra": "11.3.0",
94
+ "fs-extra": "11.3.1",
93
95
  "handlebars": "4.7.8",
94
96
  "http-terminator": "3.2.0",
95
97
  "js-yaml": "4.1.0",
96
98
  "json-schema-faker": "0.5.9",
97
99
  "jsonwebtoken": "9.0.2",
98
- "koa": "3.0.0",
100
+ "koa": "3.0.1",
99
101
  "koa-bodyparser": "4.4.1",
100
102
  "koa-proxies": "0.12.4",
101
103
  "koa2-swagger-ui": "5.11.0",
102
104
  "lodash": "4.17.21",
103
105
  "node-fetch": "3.3.2",
104
- "open": "10.1.2",
106
+ "open": "10.2.0",
105
107
  "patch-package": "8.0.0",
106
108
  "precinct": "12.2.0",
107
- "prettier": "3.5.3",
109
+ "prettier": "3.6.2",
108
110
  "recast": "0.23.11",
109
- "typescript": "5.8.3"
111
+ "typescript": "5.9.2"
110
112
  },
111
113
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
112
114
  }