@feathersjs/feathers 5.0.0-pre.1 → 5.0.0-pre.15
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 +182 -0
- package/LICENSE +1 -1
- package/lib/application.d.ts +19 -8
- package/lib/application.js +80 -78
- package/lib/application.js.map +1 -1
- package/lib/declarations.d.ts +207 -106
- package/lib/dependencies.d.ts +4 -0
- package/lib/dependencies.js +18 -0
- package/lib/dependencies.js.map +1 -0
- package/lib/events.d.ts +4 -4
- package/lib/events.js +16 -69
- package/lib/events.js.map +1 -1
- package/lib/hooks/index.d.ts +13 -2
- package/lib/hooks/index.js +84 -146
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/regular.d.ts +12 -0
- package/lib/hooks/regular.js +169 -0
- package/lib/hooks/regular.js.map +1 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +9 -12
- package/lib/index.js.map +1 -1
- package/lib/service.d.ts +21 -0
- package/lib/service.js +68 -0
- package/lib/service.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +12 -13
- package/readme.md +1 -77
- package/src/application.ts +115 -105
- package/src/declarations.ts +274 -121
- package/src/dependencies.ts +5 -0
- package/src/events.ts +18 -75
- package/src/hooks/index.ts +95 -150
- package/src/hooks/regular.ts +207 -0
- package/src/index.ts +10 -17
- package/src/service.ts +91 -0
- package/src/version.ts +1 -1
- package/lib/hooks/base.d.ts +0 -3
- package/lib/hooks/base.js +0 -29
- package/lib/hooks/base.js.map +0 -1
- package/lib/hooks/commons.d.ts +0 -20
- package/lib/hooks/commons.js +0 -298
- package/lib/hooks/commons.js.map +0 -1
- package/src/hooks/base.ts +0 -32
- package/src/hooks/commons.ts +0 -336
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,188 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **core:** add `context.http` and move `statusCode` there ([#2496](https://github.com/feathersjs/feathers/issues/2496)) ([b701bf7](https://github.com/feathersjs/feathers/commit/b701bf77fb83048aa1dffa492b3d77dd53f7b72b))
|
|
17
|
+
* **core:** Improve legacy hooks integration ([08c8b40](https://github.com/feathersjs/feathers/commit/08c8b40999bf3889c61a4d4fad97a2c4f78bafc9))
|
|
18
|
+
* **transport-commons:** Ability to register routes with custom params ([#2482](https://github.com/feathersjs/feathers/issues/2482)) ([497990a](https://github.com/feathersjs/feathers/commit/497990ae4a980e5a52a1f0f932db12cd0e6e254a))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* **core:** Allow to return a new hook context in basic hooks ([#2462](https://github.com/feathersjs/feathers/issues/2462)) ([422b6fc](https://github.com/feathersjs/feathers/commit/422b6fc11cf9e42f4234f0823a0b06a4df50982d))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
|
|
60
|
+
|
|
61
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
|
|
68
|
+
|
|
69
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
|
|
76
|
+
|
|
77
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Bug Fixes
|
|
87
|
+
|
|
88
|
+
* **core:** Clean up readme ([eb3b4f2](https://github.com/feathersjs/feathers/commit/eb3b4f248c0816c92a2300cceed18a6f2518508a))
|
|
89
|
+
* **core:** Set version back to development ([b328767](https://github.com/feathersjs/feathers/commit/b3287676cd773e164fd646ba4cffbf81983a9157))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
|
|
96
|
+
|
|
97
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
* **core:** Add list of protected methods that can not be used for custom methods ([#2390](https://github.com/feathersjs/feathers/issues/2390)) ([6584a21](https://github.com/feathersjs/feathers/commit/6584a216e5a7d5f2a45822be6bfcb91c35cc2252))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Bug Fixes
|
|
118
|
+
|
|
119
|
+
* **typescript:** Move Paginated type back for better compatibility ([#2350](https://github.com/feathersjs/feathers/issues/2350)) ([2917d05](https://github.com/feathersjs/feathers/commit/2917d05fffb4716d3c4cdaa5ac6a1aee0972e8a6))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Features
|
|
134
|
+
|
|
135
|
+
* **deno:** Feathers core build for Deno ([#2299](https://github.com/feathersjs/feathers/issues/2299)) ([dece8fb](https://github.com/feathersjs/feathers/commit/dece8fbc0e7601f1505ce8bbb1e4e69cc26e8f98))
|
|
136
|
+
* **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @feathersjs/feathers
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# [5.0.0-beta.1](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2021-04-03)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Bug Fixes
|
|
154
|
+
|
|
155
|
+
* **dependencies:** Fix transport-commons dependency and update other dependencies ([#2284](https://github.com/feathersjs/feathers/issues/2284)) ([05b03b2](https://github.com/feathersjs/feathers/commit/05b03b27b40604d956047e3021d8053c3a137616))
|
|
156
|
+
* **feathers:** Always enable hooks on default service methods ([#2275](https://github.com/feathersjs/feathers/issues/2275)) ([827cc9b](https://github.com/feathersjs/feathers/commit/827cc9b752eecdaf63605d7dffd86f531b7e4af3))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# [5.0.0-beta.0](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.1...v5.0.0-beta.0) (2021-03-28)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Bug Fixes
|
|
166
|
+
|
|
167
|
+
* Resolve some type problems ([#2260](https://github.com/feathersjs/feathers/issues/2260)) ([a3d75fa](https://github.com/feathersjs/feathers/commit/a3d75fa29490e8a19412a12bc993ee7bb573068f))
|
|
168
|
+
* Update Grant usage and other dependencies ([#2264](https://github.com/feathersjs/feathers/issues/2264)) ([7b0f8fa](https://github.com/feathersjs/feathers/commit/7b0f8fad252419ed0ad0bf259cdf3104d322ab60))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### Features
|
|
172
|
+
|
|
173
|
+
* **core:** Public custom service methods ([#2270](https://github.com/feathersjs/feathers/issues/2270)) ([e65abfb](https://github.com/feathersjs/feathers/commit/e65abfb5388df6c19a11c565cf1076a29f32668d))
|
|
174
|
+
* Application service types default to any ([#1566](https://github.com/feathersjs/feathers/issues/1566)) ([d93ba9a](https://github.com/feathersjs/feathers/commit/d93ba9a17edd20d3397bb00f4f6e82e804e42ed6))
|
|
175
|
+
* Feathers v5 core refactoring and features ([#2255](https://github.com/feathersjs/feathers/issues/2255)) ([2dafb7c](https://github.com/feathersjs/feathers/commit/2dafb7ce14ba57406aeec13d10ca45b1e709bee9))
|
|
176
|
+
* **core:** Remove Uberproto ([#2178](https://github.com/feathersjs/feathers/issues/2178)) ([ddf8821](https://github.com/feathersjs/feathers/commit/ddf8821f53317e6a378657f7d66acb03a037ee47))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### BREAKING CHANGES
|
|
180
|
+
|
|
181
|
+
* **core:** Services no longer extend Uberproto objects and
|
|
182
|
+
`service.mixin()` is no longer available.
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
6
188
|
# [5.0.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.5.11...v5.0.0-pre.1) (2020-12-17)
|
|
7
189
|
|
|
8
190
|
|
package/LICENSE
CHANGED
package/lib/application.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from './dependencies';
|
|
3
|
+
import { FeathersApplication, ServiceMixin, Service, ServiceOptions, ServiceInterface, Application, HookOptions, FeathersService, HookMap } from './declarations';
|
|
4
|
+
export declare class Feathers<Services, Settings> extends EventEmitter implements FeathersApplication<Services, Settings> {
|
|
5
|
+
services: Services;
|
|
6
|
+
settings: Settings;
|
|
7
|
+
mixins: ServiceMixin<Application<Services, Settings>>[];
|
|
8
|
+
version: string;
|
|
3
9
|
_isSetup: boolean;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
appHooks: HookMap<Application<Services, Settings>, any>;
|
|
11
|
+
private regularHooks;
|
|
12
|
+
constructor();
|
|
13
|
+
get<L extends keyof Settings & string>(name: L): Settings[L];
|
|
14
|
+
set<L extends keyof Settings & string>(name: L, value: Settings[L]): this;
|
|
15
|
+
configure(callback: (this: this, app: this) => void): this;
|
|
16
|
+
defaultService(location: string): ServiceInterface;
|
|
17
|
+
service<L extends keyof Services & string>(location: L): FeathersService<this, keyof any extends keyof Services ? Service : Services[L]>;
|
|
18
|
+
use<L extends keyof Services & string>(path: L, service: keyof any extends keyof Services ? ServiceInterface | Application : Services[L], options?: ServiceOptions): this;
|
|
19
|
+
hooks(hookMap: HookOptions<this, any>): any;
|
|
20
|
+
setup(): Promise<this>;
|
|
8
21
|
}
|
|
9
|
-
declare const _default: BaseApplication & AppExtensions;
|
|
10
|
-
export default _default;
|
package/lib/application.js
CHANGED
|
@@ -3,111 +3,113 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const commons_1 = require("@feathersjs/commons");
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
const uberproto_1 = __importDefault(require("uberproto"));
|
|
10
|
-
const events_1 = __importDefault(require("./events"));
|
|
11
|
-
const hooks_1 = __importDefault(require("./hooks"));
|
|
6
|
+
exports.Feathers = void 0;
|
|
12
7
|
const version_1 = __importDefault(require("./version"));
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
},
|
|
8
|
+
const dependencies_1 = require("./dependencies");
|
|
9
|
+
const events_1 = require("./events");
|
|
10
|
+
const index_1 = require("./hooks/index");
|
|
11
|
+
const service_1 = require("./service");
|
|
12
|
+
const regular_1 = require("./hooks/regular");
|
|
13
|
+
const debug = (0, dependencies_1.createDebug)('@feathersjs/feathers');
|
|
14
|
+
class Feathers extends dependencies_1.EventEmitter {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.services = {};
|
|
18
|
+
this.settings = {};
|
|
19
|
+
this.mixins = [index_1.hookMixin, events_1.eventMixin];
|
|
20
|
+
this.version = version_1.default;
|
|
21
|
+
this._isSetup = false;
|
|
22
|
+
this.appHooks = {
|
|
23
|
+
[dependencies_1.HOOKS]: [events_1.eventHook]
|
|
24
|
+
};
|
|
25
|
+
this.regularHooks = (0, regular_1.enableRegularHooks)(this);
|
|
26
|
+
}
|
|
33
27
|
get(name) {
|
|
34
28
|
return this.settings[name];
|
|
35
|
-
}
|
|
29
|
+
}
|
|
36
30
|
set(name, value) {
|
|
37
31
|
this.settings[name] = value;
|
|
38
32
|
return this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this
|
|
42
|
-
return this;
|
|
43
|
-
},
|
|
44
|
-
disabled(name) {
|
|
45
|
-
return !this.settings[name];
|
|
46
|
-
},
|
|
47
|
-
enable(name) {
|
|
48
|
-
this.settings[name] = true;
|
|
49
|
-
return this;
|
|
50
|
-
},
|
|
51
|
-
enabled(name) {
|
|
52
|
-
return !!this.settings[name];
|
|
53
|
-
},
|
|
54
|
-
configure(fn) {
|
|
55
|
-
fn.call(this, this);
|
|
33
|
+
}
|
|
34
|
+
configure(callback) {
|
|
35
|
+
callback.call(this, this);
|
|
56
36
|
return this;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
37
|
+
}
|
|
38
|
+
defaultService(location) {
|
|
39
|
+
throw new Error(`Can not find service '${location}'`);
|
|
40
|
+
}
|
|
41
|
+
service(location) {
|
|
42
|
+
const path = ((0, dependencies_1.stripSlashes)(location) || '/');
|
|
43
|
+
const current = this.services[path];
|
|
44
|
+
if (typeof current === 'undefined') {
|
|
45
|
+
this.use(path, this.defaultService(path));
|
|
46
|
+
return this.service(path);
|
|
64
47
|
}
|
|
65
48
|
return current;
|
|
66
|
-
}
|
|
67
|
-
use(path, service, options
|
|
49
|
+
}
|
|
50
|
+
use(path, service, options) {
|
|
68
51
|
if (typeof path !== 'string') {
|
|
69
52
|
throw new Error(`'${path}' is not a valid service path.`);
|
|
70
53
|
}
|
|
71
|
-
const location =
|
|
72
|
-
const
|
|
73
|
-
const
|
|
54
|
+
const location = ((0, dependencies_1.stripSlashes)(path) || '/');
|
|
55
|
+
const subApp = service;
|
|
56
|
+
const isSubApp = typeof subApp.service === 'function' && subApp.services;
|
|
74
57
|
if (isSubApp) {
|
|
75
|
-
const subApp = service;
|
|
76
58
|
Object.keys(subApp.services).forEach(subPath => this.use(`${location}/${subPath}`, subApp.service(subPath)));
|
|
77
59
|
return this;
|
|
78
60
|
}
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
const protoService = (0, service_1.wrapService)(location, service, options);
|
|
62
|
+
const serviceOptions = (0, service_1.getServiceOptions)(service, options);
|
|
63
|
+
for (const name of service_1.protectedMethods) {
|
|
64
|
+
if (serviceOptions.methods.includes(name)) {
|
|
65
|
+
throw new Error(`'${name}' on service '${location}' is not allowed as a custom method name`);
|
|
66
|
+
}
|
|
81
67
|
}
|
|
82
|
-
// If the service is already Uberproto'd use it directly
|
|
83
|
-
const protoService = Proto.isPrototypeOf(service) ? service : Proto.extend(service);
|
|
84
68
|
debug(`Registering new service at \`${location}\``);
|
|
85
69
|
// Add all the mixins
|
|
86
|
-
this.mixins.forEach(fn => fn.call(this, protoService, location,
|
|
87
|
-
|
|
88
|
-
protoService._setup(this, location);
|
|
89
|
-
}
|
|
90
|
-
// Run the provider functions to register the service
|
|
91
|
-
this.providers.forEach(provider => provider.call(this, protoService, location, options));
|
|
92
|
-
// If we ran setup already, set this service up explicitly
|
|
70
|
+
this.mixins.forEach(fn => fn.call(this, protoService, location, serviceOptions));
|
|
71
|
+
// If we ran setup already, set this service up explicitly, this will not `await`
|
|
93
72
|
if (this._isSetup && typeof protoService.setup === 'function') {
|
|
94
73
|
debug(`Setting up service for \`${location}\``);
|
|
95
74
|
protoService.setup(this, location);
|
|
96
75
|
}
|
|
97
76
|
this.services[location] = protoService;
|
|
98
77
|
return this;
|
|
99
|
-
}
|
|
78
|
+
}
|
|
79
|
+
hooks(hookMap) {
|
|
80
|
+
const regularMap = hookMap;
|
|
81
|
+
if (regularMap.before || regularMap.after || regularMap.error) {
|
|
82
|
+
return this.regularHooks(regularMap);
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(hookMap)) {
|
|
85
|
+
this.appHooks[dependencies_1.HOOKS].push(...hookMap);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const methodHookMap = hookMap;
|
|
89
|
+
Object.keys(methodHookMap).forEach(key => {
|
|
90
|
+
const methodHooks = this.appHooks[key] || [];
|
|
91
|
+
this.appHooks[key] = methodHooks.concat(methodHookMap[key]);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
100
96
|
setup() {
|
|
97
|
+
let promise = Promise.resolve();
|
|
101
98
|
// Setup each service (pass the app so that they can look up other services etc.)
|
|
102
|
-
Object.keys(this.services)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
for (const path of Object.keys(this.services)) {
|
|
100
|
+
promise = promise.then(() => {
|
|
101
|
+
const service = this.service(path);
|
|
102
|
+
if (typeof service.setup === 'function') {
|
|
103
|
+
debug(`Setting up service for \`${path}\``);
|
|
104
|
+
return service.setup(this, path);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return promise.then(() => {
|
|
109
|
+
this._isSetup = true;
|
|
110
|
+
return this;
|
|
108
111
|
});
|
|
109
|
-
this._isSetup = true;
|
|
110
|
-
return this;
|
|
111
112
|
}
|
|
112
|
-
}
|
|
113
|
+
}
|
|
114
|
+
exports.Feathers = Feathers;
|
|
113
115
|
//# sourceMappingURL=application.js.map
|
package/lib/application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAChC,iDAEwB;AACxB,qCAAiD;AACjD,yCAA0C;AAC1C,uCAA6E;AAa7E,6CAAqD;AAErD,MAAM,KAAK,GAAG,IAAA,0BAAW,EAAC,sBAAsB,CAAC,CAAC;AAElD,MAAa,QAA6B,SAAQ,2BAAY;IAY5D;QACE,KAAK,EAAE,CAAC;QAZV,aAAQ,GAAc,EAAe,CAAC;QACt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