@keq-request/exception 5.0.0-alpha.20 → 5.0.0-alpha.22

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
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0-alpha.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [df114d1]
8
+ - keq@5.0.0-alpha.22
9
+
10
+ ## 5.0.0-alpha.21
11
+
12
+ ### Patch Changes
13
+
14
+ - b36df33: ValidateStatusCode plugin generate wrong code
15
+ - Updated dependencies [90311b3]
16
+ - keq@5.0.0-alpha.21
17
+
3
18
  ## 5.0.0-alpha.20
4
19
 
5
20
  ### Patch Changes
@@ -24,7 +24,7 @@ __export(index_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(index_exports);
26
26
 
27
- // plugins/validate-response.ts
27
+ // plugins/validate-status-code.ts
28
28
  var import_cli = require("@keq-request/cli");
29
29
  var ValidateStatusCodePlugin = class _ValidateStatusCodePlugin {
30
30
  constructor(options = {}) {
@@ -69,16 +69,16 @@ var ValidateStatusCodePlugin = class _ValidateStatusCodePlugin {
69
69
  });
70
70
  });
71
71
  compiler.hooks.afterCompileKeqRequest.tap(_ValidateStatusCodePlugin.name, (artifact) => {
72
- artifact.addDependence("@keq-request/exception", ["validateResponse"]);
72
+ artifact.addDependence("@keq-request/exception", ["validateStatusCode"]);
73
73
  if (!this.options.modules) {
74
- artifact.anchor.prepend("file:end", "request.use(validateResponse())\n");
74
+ artifact.anchor.prepend("file:end", "request.use(validateStatusCode())\n");
75
75
  } else {
76
76
  artifact.anchor.prepend(
77
77
  "file:end",
78
78
  [
79
79
  "request",
80
80
  " .useRouter()",
81
- ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateResponse())`),
81
+ ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateStatusCode())`),
82
82
  ""
83
83
  ].join("\n")
84
84
  );
@@ -1,4 +1,4 @@
1
- // plugins/validate-response.ts
1
+ // plugins/validate-status-code.ts
2
2
  import { ApiDocumentV3_1 } from "@keq-request/cli";
3
3
  var ValidateStatusCodePlugin = class _ValidateStatusCodePlugin {
4
4
  constructor(options = {}) {
@@ -43,16 +43,16 @@ var ValidateStatusCodePlugin = class _ValidateStatusCodePlugin {
43
43
  });
44
44
  });
45
45
  compiler.hooks.afterCompileKeqRequest.tap(_ValidateStatusCodePlugin.name, (artifact) => {
46
- artifact.addDependence("@keq-request/exception", ["validateResponse"]);
46
+ artifact.addDependence("@keq-request/exception", ["validateStatusCode"]);
47
47
  if (!this.options.modules) {
48
- artifact.anchor.prepend("file:end", "request.use(validateResponse())\n");
48
+ artifact.anchor.prepend("file:end", "request.use(validateStatusCode())\n");
49
49
  } else {
50
50
  artifact.anchor.prepend(
51
51
  "file:end",
52
52
  [
53
53
  "request",
54
54
  " .useRouter()",
55
- ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateResponse())`),
55
+ ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateStatusCode())`),
56
56
  ""
57
57
  ].join("\n")
58
58
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keq-request/exception",
3
- "version": "5.0.0-alpha.20",
3
+ "version": "5.0.0-alpha.22",
4
4
  "description": "Request exception for keq",
5
5
  "keywords": [
6
6
  "keq",
@@ -39,14 +39,14 @@
39
39
  "devDependencies": {
40
40
  "@scalar/openapi-types": "^0.5.2",
41
41
  "@types/node": "^20.19.25",
42
- "@keq-request/cli": "5.0.0-alpha.20",
43
- "keq": "5.0.0-alpha.20"
42
+ "@keq-request/cli": "5.0.0-alpha.22",
43
+ "keq": "5.0.0-alpha.22"
44
44
  },
45
45
  "peerDependencies": {
46
- "keq": "^5.0.0-alpha.20"
46
+ "keq": "^5.0.0-alpha.22"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@keq-request/cli": "5.0.0-alpha.20"
49
+ "@keq-request/cli": "5.0.0-alpha.22"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup",
package/plugins/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './validate-response.js'
1
+ export * from './validate-status-code.js'
@@ -63,19 +63,19 @@ export class ValidateStatusCodePlugin implements Plugin {
63
63
  })
64
64
  })
65
65
 
66
- // inject validateResponse middleware into generated code
66
+ // inject validateStatusCode middleware into generated code
67
67
  compiler.hooks.afterCompileKeqRequest.tap(ValidateStatusCodePlugin.name, (artifact: Artifact) => {
68
- artifact.addDependence('@keq-request/exception', ['validateResponse'])
68
+ artifact.addDependence('@keq-request/exception', ['validateStatusCode'])
69
69
 
70
70
  if (!this.options.modules) {
71
- artifact.anchor.prepend('file:end', 'request.use(validateResponse())\n')
71
+ artifact.anchor.prepend('file:end', 'request.use(validateStatusCode())\n')
72
72
  } else {
73
73
  artifact.anchor.prepend(
74
74
  'file:end',
75
75
  [
76
76
  'request',
77
77
  ' .useRouter()',
78
- ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateResponse())`),
78
+ ...this.options.modules.map((moduleName) => ` .module(${JSON.stringify(moduleName)}, validateStatusCode())`),
79
79
  '',
80
80
  ].join('\n'),
81
81
  )