@midwayjs/core 3.14.12 → 3.15.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.
@@ -375,11 +375,5 @@ __decorate([
375
375
  __metadata("design:paramtypes", []),
376
376
  __metadata("design:returntype", Promise)
377
377
  ], BaseFramework.prototype, "init", null);
378
- __decorate([
379
- (0, decorator_1.Destroy)(),
380
- __metadata("design:type", Function),
381
- __metadata("design:paramtypes", []),
382
- __metadata("design:returntype", Promise)
383
- ], BaseFramework.prototype, "stop", null);
384
378
  exports.BaseFramework = BaseFramework;
385
379
  //# sourceMappingURL=baseFramework.js.map
@@ -14,7 +14,7 @@ export declare abstract class ServiceFactory<T> implements IServiceFactory<T> {
14
14
  createInstance(config: any, clientName?: any): Promise<T | undefined>;
15
15
  abstract getName(): string;
16
16
  protected abstract createClient(config: any, clientName: any): Promise<T | void> | (T | void);
17
- protected destroyClient(client: T): Promise<void>;
17
+ protected destroyClient(client: T, clientName?: string): Promise<void>;
18
18
  stop(): Promise<void>;
19
19
  getDefaultClientName(): string;
20
20
  getClients(): Map<string, T>;
@@ -55,10 +55,10 @@ class ServiceFactory {
55
55
  return client;
56
56
  }
57
57
  }
58
- async destroyClient(client) { }
58
+ async destroyClient(client, clientName) { }
59
59
  async stop() {
60
- for (const value of this.clients.values()) {
61
- await this.destroyClient(value);
60
+ for (const [name, value] of this.clients.entries()) {
61
+ await this.destroyClient(value, name);
62
62
  }
63
63
  }
64
64
  getDefaultClientName() {
@@ -19,18 +19,16 @@ var RouteParamTypes;
19
19
  RouteParamTypes["CUSTOM"] = "custom";
20
20
  })(RouteParamTypes = exports.RouteParamTypes || (exports.RouteParamTypes = {}));
21
21
  const createParamMapping = function (type) {
22
- return (propertyOrPipes, pipes) => {
22
+ return (propertyOrPipes, options = {}) => {
23
23
  let propertyData = propertyOrPipes;
24
- if (Array.isArray(propertyOrPipes) && pipes === undefined) {
25
- pipes = propertyOrPipes;
24
+ if (Array.isArray(propertyOrPipes) && options.pipes === undefined) {
25
+ options.pipes = propertyOrPipes;
26
26
  propertyData = undefined;
27
27
  }
28
28
  return (0, __1.createCustomParamDecorator)(__1.WEB_ROUTER_PARAM_KEY, {
29
29
  type,
30
30
  propertyData,
31
- }, {
32
- pipes,
33
- });
31
+ }, options);
34
32
  };
35
33
  };
36
34
  const createRequestParamDecorator = function (transform, pipesOrOptions) {
@@ -40,29 +38,29 @@ const createRequestParamDecorator = function (transform, pipesOrOptions) {
40
38
  pipes: pipesOrOptions,
41
39
  };
42
40
  }
43
- return createParamMapping(RouteParamTypes.CUSTOM)(transform, pipesOrOptions.pipes);
41
+ return createParamMapping(RouteParamTypes.CUSTOM)(transform, pipesOrOptions);
44
42
  };
45
43
  exports.createRequestParamDecorator = createRequestParamDecorator;
46
- const Session = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.SESSION)(propertyOrPipes, pipes);
44
+ const Session = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.SESSION)(propertyOrPipes, { pipes });
47
45
  exports.Session = Session;
48
- const Body = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.BODY)(propertyOrPipes, pipes);
46
+ const Body = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.BODY)(propertyOrPipes, { pipes });
49
47
  exports.Body = Body;
50
- const Query = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.QUERY)(propertyOrPipes, pipes);
48
+ const Query = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.QUERY)(propertyOrPipes, { pipes });
51
49
  exports.Query = Query;
52
- const Param = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.PARAM)(propertyOrPipes, pipes);
50
+ const Param = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.PARAM)(propertyOrPipes, { pipes });
53
51
  exports.Param = Param;
54
- const Headers = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.HEADERS)(propertyOrPipes, pipes);
52
+ const Headers = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.HEADERS)(propertyOrPipes, { pipes });
55
53
  exports.Headers = Headers;
56
- const File = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FILESTREAM)(propertyOrPipes, pipes);
54
+ const File = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FILESTREAM)(propertyOrPipes, { pipes });
57
55
  exports.File = File;
58
- const Files = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FILESSTREAM)(propertyOrPipes, pipes);
56
+ const Files = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FILESSTREAM)(propertyOrPipes, { pipes });
59
57
  exports.Files = Files;
60
- const RequestPath = (pipes) => createParamMapping(RouteParamTypes.REQUEST_PATH)(undefined, pipes);
58
+ const RequestPath = (pipes) => createParamMapping(RouteParamTypes.REQUEST_PATH)(undefined, { pipes });
61
59
  exports.RequestPath = RequestPath;
62
- const RequestIP = (pipes) => createParamMapping(RouteParamTypes.REQUEST_IP)(undefined, pipes);
60
+ const RequestIP = (pipes) => createParamMapping(RouteParamTypes.REQUEST_IP)(undefined, { pipes });
63
61
  exports.RequestIP = RequestIP;
64
- const Queries = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.QUERIES)(propertyOrPipes, pipes);
62
+ const Queries = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.QUERIES)(propertyOrPipes, { pipes });
65
63
  exports.Queries = Queries;
66
- const Fields = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FIELDS)(propertyOrPipes, pipes);
64
+ const Fields = (propertyOrPipes, pipes) => createParamMapping(RouteParamTypes.FIELDS)(propertyOrPipes, { pipes });
67
65
  exports.Fields = Fields;
68
66
  //# sourceMappingURL=paramMapping.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/core",
3
- "version": "3.14.12",
3
+ "version": "3.15.0",
4
4
  "description": "midway core",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "engines": {
43
43
  "node": ">=12"
44
44
  },
45
- "gitHead": "e6b0c2d35c4fb8dc05fe17fbc546a09a0b6c0486"
45
+ "gitHead": "be0a091f940aa60965d9fabfbdcbf0fe2830e9c4"
46
46
  }