@faasjs/http 2.8.0 → 2.9.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/dist/index.d.mts CHANGED
@@ -79,7 +79,9 @@ declare class Cookie<C extends Record<string, string> = any, S extends Record<st
79
79
  };
80
80
  }
81
81
 
82
+ /** @deprecated */
82
83
  type ValidatorRuleOptionsType = 'string' | 'number' | 'boolean' | 'object' | 'array';
84
+ /** @deprecated */
83
85
  type ValidatorRuleOptions = {
84
86
  type?: ValidatorRuleOptionsType;
85
87
  required?: boolean;
@@ -88,6 +90,7 @@ type ValidatorRuleOptions = {
88
90
  config?: Partial<ValidatorOptions>;
89
91
  regexp?: RegExp;
90
92
  };
93
+ /** @deprecated */
91
94
  type ValidatorOptions<Content = Record<string, any>> = {
92
95
  whitelist?: 'error' | 'ignore';
93
96
  rules: {
@@ -106,16 +109,19 @@ type Request<TParams extends Record<string, any> = any, TCookie extends Record<s
106
109
  cookie?: Cookie<TCookie, TSession>;
107
110
  session?: Session<TSession, TCookie>;
108
111
  };
112
+ /** @deprecated */
109
113
  type BeforeOption<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = (request: Request<TParams, TCookie, TSession>) => Promise<void | {
110
114
  statusCode?: number;
111
115
  message: string;
112
116
  }>;
117
+ /** @deprecated */
113
118
  type ValidatorConfig<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = {
114
119
  params?: ValidatorOptions<TParams>;
115
120
  cookie?: ValidatorOptions<TCookie>;
116
121
  session?: ValidatorOptions<TSession>;
117
122
  before?: BeforeOption;
118
123
  };
124
+ /** @deprecated */
119
125
  declare class Validator<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> {
120
126
  before?: BeforeOption<TParams, TCookie, TSession>;
121
127
  paramsConfig?: ValidatorOptions<TParams>;
@@ -161,6 +167,7 @@ type HttpConfig<TParams extends Record<string, any> = any, TCookie extends Recor
161
167
  functionName?: string;
162
168
  cookie?: CookieOptions;
163
169
  };
170
+ /** @deprecated */
164
171
  validator?: ValidatorConfig<TParams, TCookie, TSession>;
165
172
  };
166
173
  type Response = {
package/dist/index.d.ts CHANGED
@@ -79,7 +79,9 @@ declare class Cookie<C extends Record<string, string> = any, S extends Record<st
79
79
  };
80
80
  }
81
81
 
82
+ /** @deprecated */
82
83
  type ValidatorRuleOptionsType = 'string' | 'number' | 'boolean' | 'object' | 'array';
84
+ /** @deprecated */
83
85
  type ValidatorRuleOptions = {
84
86
  type?: ValidatorRuleOptionsType;
85
87
  required?: boolean;
@@ -88,6 +90,7 @@ type ValidatorRuleOptions = {
88
90
  config?: Partial<ValidatorOptions>;
89
91
  regexp?: RegExp;
90
92
  };
93
+ /** @deprecated */
91
94
  type ValidatorOptions<Content = Record<string, any>> = {
92
95
  whitelist?: 'error' | 'ignore';
93
96
  rules: {
@@ -106,16 +109,19 @@ type Request<TParams extends Record<string, any> = any, TCookie extends Record<s
106
109
  cookie?: Cookie<TCookie, TSession>;
107
110
  session?: Session<TSession, TCookie>;
108
111
  };
112
+ /** @deprecated */
109
113
  type BeforeOption<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = (request: Request<TParams, TCookie, TSession>) => Promise<void | {
110
114
  statusCode?: number;
111
115
  message: string;
112
116
  }>;
117
+ /** @deprecated */
113
118
  type ValidatorConfig<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> = {
114
119
  params?: ValidatorOptions<TParams>;
115
120
  cookie?: ValidatorOptions<TCookie>;
116
121
  session?: ValidatorOptions<TSession>;
117
122
  before?: BeforeOption;
118
123
  };
124
+ /** @deprecated */
119
125
  declare class Validator<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any> {
120
126
  before?: BeforeOption<TParams, TCookie, TSession>;
121
127
  paramsConfig?: ValidatorOptions<TParams>;
@@ -161,6 +167,7 @@ type HttpConfig<TParams extends Record<string, any> = any, TCookie extends Recor
161
167
  functionName?: string;
162
168
  cookie?: CookieOptions;
163
169
  };
170
+ /** @deprecated */
164
171
  validator?: ValidatorConfig<TParams, TCookie, TSession>;
165
172
  };
166
173
  type Response = {
package/dist/index.js CHANGED
@@ -383,7 +383,10 @@ var Http = class {
383
383
  this.name = Name;
384
384
  this.name = (config == null ? void 0 : config.name) || this.type;
385
385
  this.config = (config == null ? void 0 : config.config) || /* @__PURE__ */ Object.create(null);
386
- if (config == null ? void 0 : config.validator) this.validatorOptions = config.validator;
386
+ if (config == null ? void 0 : config.validator) {
387
+ console.warn("Validator will deprecated in the v3.");
388
+ this.validatorOptions = config.validator;
389
+ }
387
390
  }
388
391
  async onDeploy(data, next) {
389
392
  var _a;
package/dist/index.mjs CHANGED
@@ -381,7 +381,10 @@ var Http = class {
381
381
  this.name = Name;
382
382
  this.name = (config == null ? void 0 : config.name) || this.type;
383
383
  this.config = (config == null ? void 0 : config.config) || /* @__PURE__ */ Object.create(null);
384
- if (config == null ? void 0 : config.validator) this.validatorOptions = config.validator;
384
+ if (config == null ? void 0 : config.validator) {
385
+ console.warn("Validator will deprecated in the v3.");
386
+ this.validatorOptions = config.validator;
387
+ }
385
388
  }
386
389
  async onDeploy(data, next) {
387
390
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/http",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,12 +34,12 @@
34
34
  "dist"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@faasjs/func": "2.8.0",
38
- "@faasjs/logger": "2.8.0"
37
+ "@faasjs/func": "2.9.0",
38
+ "@faasjs/logger": "2.9.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@faasjs/func": "2.8.0",
42
- "@faasjs/logger": "2.8.0"
41
+ "@faasjs/func": "2.9.0",
42
+ "@faasjs/logger": "2.9.0"
43
43
  },
44
44
  "engines": {
45
45
  "npm": ">=9.0.0",