@faasjs/http 0.0.2-beta.266 → 0.0.2-beta.273

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/lib/index.d.ts CHANGED
@@ -101,6 +101,4 @@ export declare class Http<TParams extends Record<string, any> = any, TCookie ext
101
101
  */
102
102
  setBody(body: string): Http<TParams, TCookie, TSession>;
103
103
  }
104
- export declare function useHttp<TParams extends {
105
- [key: string]: any;
106
- }, TCookie extends Record<string, string>, TSession extends Record<string, string>>(config?: HttpConfig<TParams, TCookie, TSession>): Http<TParams, TCookie, TSession> & UseifyPlugin;
104
+ export declare function useHttp<TParams extends Record<string, any> = any, TCookie extends Record<string, string> = any, TSession extends Record<string, string> = any>(config?: HttpConfig<TParams, TCookie, TSession>): Http<TParams, TCookie, TSession> & UseifyPlugin;
package/lib/index.es.js CHANGED
@@ -58,8 +58,8 @@ class Session {
58
58
  const cipher = createDecipheriv(this.config.cipherName, this.secret, parts[1]);
59
59
  const part = Buffer.from(cipher.update(parts[0])).toString('utf8');
60
60
  const final = cipher.final('utf8');
61
- const decryptor = [part, final].join('');
62
- return JSON.parse(decryptor);
61
+ const decrypt = [part, final].join('');
62
+ return JSON.parse(decrypt);
63
63
  }
64
64
  read(key) {
65
65
  return this.content[key];
@@ -339,22 +339,22 @@ class Http {
339
339
  var _a;
340
340
  await next();
341
341
  this.logger.debug('组装网关配置');
342
- this.logger.debug('%o', data);
342
+ this.logger.debug('%j', data);
343
343
  const config = data.config.plugins ?
344
344
  deepMerge(data.config.plugins[this.name || this.type], { config: this.config }) :
345
345
  { config: this.config };
346
346
  // 根据文件及文件夹名生成路径
347
347
  if (!config.config.path) {
348
- config.config.path = '=/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
349
- if (config.config.path === '=/index')
350
- config.config.path = '=/';
348
+ config.config.path = '/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
349
+ if (config.config.path === '/index')
350
+ config.config.path = '/';
351
351
  if (config.config.ignorePathPrefix) {
352
- config.config.path = config.config.path.replace(new RegExp('^=' + config.config.ignorePathPrefix), '=');
353
- if (config.config.path === '=')
354
- config.config.path = '=/';
352
+ config.config.path = config.config.path.replace(new RegExp('^' + config.config.ignorePathPrefix), '');
353
+ if (config.config.path === '')
354
+ config.config.path = '/';
355
355
  }
356
356
  }
357
- this.logger.debug('组装完成 %o', config);
357
+ this.logger.debug('组装完成 %j', config);
358
358
  // 引用服务商部署插件
359
359
  // eslint-disable-next-line @typescript-eslint/no-var-requires
360
360
  const Provider = require(config.provider.type).Provider;
@@ -428,7 +428,7 @@ class Http {
428
428
  catch (error) {
429
429
  data.response = error;
430
430
  }
431
- // update seesion
431
+ // update session
432
432
  this.session.update();
433
433
  // 处理 body
434
434
  if (data.response)
package/lib/index.js CHANGED
@@ -62,8 +62,8 @@ class Session {
62
62
  const cipher = crypto.createDecipheriv(this.config.cipherName, this.secret, parts[1]);
63
63
  const part = Buffer.from(cipher.update(parts[0])).toString('utf8');
64
64
  const final = cipher.final('utf8');
65
- const decryptor = [part, final].join('');
66
- return JSON.parse(decryptor);
65
+ const decrypt = [part, final].join('');
66
+ return JSON.parse(decrypt);
67
67
  }
68
68
  read(key) {
69
69
  return this.content[key];
@@ -343,22 +343,22 @@ class Http {
343
343
  var _a;
344
344
  await next();
345
345
  this.logger.debug('组装网关配置');
346
- this.logger.debug('%o', data);
346
+ this.logger.debug('%j', data);
347
347
  const config = data.config.plugins ?
348
348
  deep_merge.deepMerge(data.config.plugins[this.name || this.type], { config: this.config }) :
349
349
  { config: this.config };
350
350
  // 根据文件及文件夹名生成路径
351
351
  if (!config.config.path) {
352
- config.config.path = '=/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
353
- if (config.config.path === '=/index')
354
- config.config.path = '=/';
352
+ config.config.path = '/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
353
+ if (config.config.path === '/index')
354
+ config.config.path = '/';
355
355
  if (config.config.ignorePathPrefix) {
356
- config.config.path = config.config.path.replace(new RegExp('^=' + config.config.ignorePathPrefix), '=');
357
- if (config.config.path === '=')
358
- config.config.path = '=/';
356
+ config.config.path = config.config.path.replace(new RegExp('^' + config.config.ignorePathPrefix), '');
357
+ if (config.config.path === '')
358
+ config.config.path = '/';
359
359
  }
360
360
  }
361
- this.logger.debug('组装完成 %o', config);
361
+ this.logger.debug('组装完成 %j', config);
362
362
  // 引用服务商部署插件
363
363
  // eslint-disable-next-line @typescript-eslint/no-var-requires
364
364
  const Provider = require(config.provider.type).Provider;
@@ -432,7 +432,7 @@ class Http {
432
432
  catch (error) {
433
433
  data.response = error;
434
434
  }
435
- // update seesion
435
+ // update session
436
436
  this.session.update();
437
437
  // 处理 body
438
438
  if (data.response)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/http",
3
- "version": "0.0.2-beta.266",
3
+ "version": "0.0.2-beta.273",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -18,7 +18,7 @@
18
18
  "lib"
19
19
  ],
20
20
  "devDependencies": {
21
- "@faasjs/func": "^0.0.2-beta.266",
21
+ "@faasjs/func": "^0.0.2-beta.269",
22
22
  "@types/debug": "*",
23
23
  "@types/jest": "*",
24
24
  "@types/node": "*",
@@ -26,5 +26,5 @@
26
26
  "rollup-plugin-typescript2": "*",
27
27
  "typescript": "*"
28
28
  },
29
- "gitHead": "130df3f61ae3e69b3e2a3a484f557419a506ed0e"
29
+ "gitHead": "f7dc9d18202a0194a4cf2350b6fb97d1ca64c90e"
30
30
  }