@loopback/example-lb3-application 3.0.1
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/.prettierignore +2 -0
- package/.prettierrc +7 -0
- package/.vscode/settings.json +20 -0
- package/.vscode/tasks.json +29 -0
- package/CHANGELOG.md +626 -0
- package/LICENSE +25 -0
- package/README.md +560 -0
- package/dist/__tests__/acceptance/home-page.acceptance.d.ts +1 -0
- package/dist/__tests__/acceptance/home-page.acceptance.js +38 -0
- package/dist/__tests__/acceptance/home-page.acceptance.js.map +1 -0
- package/dist/__tests__/acceptance/lb3app.acceptance.d.ts +1 -0
- package/dist/__tests__/acceptance/lb3app.acceptance.js +200 -0
- package/dist/__tests__/acceptance/lb3app.acceptance.js.map +1 -0
- package/dist/__tests__/acceptance/test-helper.d.ts +11 -0
- package/dist/__tests__/acceptance/test-helper.js +33 -0
- package/dist/__tests__/acceptance/test-helper.js.map +1 -0
- package/dist/application.d.ts +187 -0
- package/dist/application.js +41 -0
- package/dist/application.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/migrate.js +25 -0
- package/dist/migrate.js.map +1 -0
- package/dist/openapi-spec.d.ts +1 -0
- package/dist/openapi-spec.js +28 -0
- package/dist/openapi-spec.js.map +1 -0
- package/dist/sequence.d.ts +3 -0
- package/dist/sequence.js +12 -0
- package/dist/sequence.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +58 -0
- package/dist/server.js.map +1 -0
- package/lb3app/common/models/coffee-shop.js +44 -0
- package/lb3app/common/models/coffee-shop.json +30 -0
- package/lb3app/server/boot/authentication.js +11 -0
- package/lb3app/server/boot/create-sample-models.js +28 -0
- package/lb3app/server/config.json +21 -0
- package/lb3app/server/datasources.json +6 -0
- package/lb3app/server/middleware.json +9 -0
- package/lb3app/server/model-config.json +39 -0
- package/lb3app/server/server.js +17 -0
- package/lb3app/test/acceptance.js +107 -0
- package/lb3app/test/authentication.js +135 -0
- package/lb3app/test/integration.js +75 -0
- package/package.json +78 -0
- package/public/index.html +74 -0
- package/public/lb3-index.html +5 -0
- package/src/__tests__/acceptance/home-page.acceptance.ts +44 -0
- package/src/__tests__/acceptance/lb3app.acceptance.ts +244 -0
- package/src/__tests__/acceptance/test-helper.ts +40 -0
- package/src/application.ts +44 -0
- package/src/index.ts +35 -0
- package/src/migrate.ts +25 -0
- package/src/openapi-spec.ts +28 -0
- package/src/sequence.ts +8 -0
- package/src/server.ts +71 -0
- package/tsconfig.json +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-lb3-application
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const test_helper_1 = require("./test-helper");
|
|
8
|
+
describe('HomePage', () => {
|
|
9
|
+
let app;
|
|
10
|
+
let client;
|
|
11
|
+
before('setupApplication', async () => {
|
|
12
|
+
({ app, client } = await test_helper_1.setupApplication());
|
|
13
|
+
});
|
|
14
|
+
after(async () => {
|
|
15
|
+
await app.stop();
|
|
16
|
+
});
|
|
17
|
+
it('exposes a default home page', async () => {
|
|
18
|
+
await client
|
|
19
|
+
.get('/')
|
|
20
|
+
.expect(200)
|
|
21
|
+
.expect('Content-Type', /text\/html/);
|
|
22
|
+
});
|
|
23
|
+
it('exposes self-hosted explorer', async () => {
|
|
24
|
+
await client
|
|
25
|
+
.get('/api/explorer/')
|
|
26
|
+
.expect(200)
|
|
27
|
+
.expect('Content-Type', /text\/html/)
|
|
28
|
+
.expect(/<title>LoopBack API Explorer/);
|
|
29
|
+
});
|
|
30
|
+
it('exposes LoopBack 3 home page', async () => {
|
|
31
|
+
await client
|
|
32
|
+
.get('/lb3-index.html')
|
|
33
|
+
.expect(200)
|
|
34
|
+
.expect('Content-Type', /text\/html/)
|
|
35
|
+
.expect(/<h1>LoopBack Rocks!/);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=home-page.acceptance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home-page.acceptance.js","sourceRoot":"","sources":["../../../src/__tests__/acceptance/home-page.acceptance.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;AAIhE,+CAA+C;AAE/C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,GAAkB,CAAC;IACvB,IAAI,MAAc,CAAC;IAEnB,MAAM,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QACpC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,MAAM,8BAAgB,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,MAAM;aACT,GAAG,CAAC,GAAG,CAAC;aACR,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,MAAM;aACT,GAAG,CAAC,gBAAgB,CAAC;aACrB,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC;aACpC,MAAM,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,MAAM;aACT,GAAG,CAAC,iBAAiB,CAAC;aACtB,MAAM,CAAC,GAAG,CAAC;aACX,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC;aACpC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019,2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-lb3-application
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const testlab_1 = require("@loopback/testlab");
|
|
9
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
10
|
+
const test_helper_1 = require("./test-helper");
|
|
11
|
+
const lb3App = require('../../../lb3app/server/server');
|
|
12
|
+
describe('CoffeeShopApplication', () => {
|
|
13
|
+
let app;
|
|
14
|
+
let client;
|
|
15
|
+
before('setupApplication', async () => {
|
|
16
|
+
({ app, client } = await test_helper_1.setupApplication());
|
|
17
|
+
});
|
|
18
|
+
after('closes application', async () => {
|
|
19
|
+
if (app)
|
|
20
|
+
await app.stop();
|
|
21
|
+
});
|
|
22
|
+
context('basic REST calls for LoopBack 3 application', () => {
|
|
23
|
+
it('creates and finds a CoffeeShop', async () => {
|
|
24
|
+
const coffeeShop = test_helper_1.givenCoffeeShop();
|
|
25
|
+
const response = await client
|
|
26
|
+
.post('/api/CoffeeShops')
|
|
27
|
+
.send(coffeeShop)
|
|
28
|
+
.expect(200);
|
|
29
|
+
testlab_1.expect(response.body).to.containDeep(lodash_1.default.pick(coffeeShop, ['name', 'city']));
|
|
30
|
+
const result = await client.get(`/api/CoffeeShops/${response.body.id}`);
|
|
31
|
+
testlab_1.expect(result.body).to.containDeep(lodash_1.default.pick(coffeeShop, ['name', 'city']));
|
|
32
|
+
});
|
|
33
|
+
it("gets the CoffeeShop's status", async () => {
|
|
34
|
+
const response = await client.get('/api/CoffeeShops/status').expect(200);
|
|
35
|
+
testlab_1.expect(response.body.status).to.be.equalOneOf('We are open for business.', 'Sorry, we are closed. Open daily from 6am to 8pm.');
|
|
36
|
+
});
|
|
37
|
+
it('gets external route in application', async () => {
|
|
38
|
+
await client.get('/ping').expect(200, 'pong');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
context('LoopBack 3 authentication', () => {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
let User;
|
|
44
|
+
before(() => {
|
|
45
|
+
User = lb3App.models.User;
|
|
46
|
+
});
|
|
47
|
+
it('creates a User and logs them in and out', async () => {
|
|
48
|
+
const user = await User.create({
|
|
49
|
+
email: 'created@email.com',
|
|
50
|
+
password: 'L00pBack!',
|
|
51
|
+
});
|
|
52
|
+
testlab_1.expect(user.email).to.eql('created@email.com');
|
|
53
|
+
const token = await User.login({
|
|
54
|
+
email: 'created@email.com',
|
|
55
|
+
password: 'L00pBack!',
|
|
56
|
+
});
|
|
57
|
+
testlab_1.expect(token).to.have.properties('ttl', 'userId', 'created', 'id');
|
|
58
|
+
testlab_1.expect(token.userId).to.eql(user.id);
|
|
59
|
+
await User.logout(token.id);
|
|
60
|
+
});
|
|
61
|
+
it('makes an authenticated request', async () => {
|
|
62
|
+
const token = await User.login({
|
|
63
|
+
email: 'created@email.com',
|
|
64
|
+
password: 'L00pBack!',
|
|
65
|
+
});
|
|
66
|
+
const response = await client
|
|
67
|
+
.get(`/api/CoffeeShops/greet?access_token=${token.id}`)
|
|
68
|
+
.expect(200);
|
|
69
|
+
testlab_1.expect(response.body.greeting).to.eql('Hello from this Coffee Shop');
|
|
70
|
+
});
|
|
71
|
+
it('rejects anonymous requests to protected endpoints', async () => {
|
|
72
|
+
await client.get('/api/CoffeeShops/greet').expect(401);
|
|
73
|
+
});
|
|
74
|
+
it("denies request made by another user's access token", async () => {
|
|
75
|
+
const users = await User.create([
|
|
76
|
+
{
|
|
77
|
+
email: 'original@email.com',
|
|
78
|
+
password: 'L00pBack!',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
email: 'other@email.com',
|
|
82
|
+
password: 'L00pBack!',
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
const token = await User.login({
|
|
86
|
+
email: users[0].email,
|
|
87
|
+
password: 'L00pBack!',
|
|
88
|
+
});
|
|
89
|
+
const otherToken = await User.login({
|
|
90
|
+
email: users[1].email,
|
|
91
|
+
password: 'L00pBack!',
|
|
92
|
+
});
|
|
93
|
+
const response = await client
|
|
94
|
+
.get(`/api/Users/${users[0].id}?access_token=${token.id}`)
|
|
95
|
+
.expect(200);
|
|
96
|
+
testlab_1.expect(response.body).to.containEql({
|
|
97
|
+
email: users[0].email,
|
|
98
|
+
id: users[0].id,
|
|
99
|
+
});
|
|
100
|
+
await client
|
|
101
|
+
.get(`/api/Users/${users[0].id}?access_token=${otherToken.id}`)
|
|
102
|
+
.expect(401);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
context('OpenAPI spec', () => {
|
|
106
|
+
let apiSpec;
|
|
107
|
+
before(async () => {
|
|
108
|
+
apiSpec = await app.lbApp.restServer.getApiSpec();
|
|
109
|
+
});
|
|
110
|
+
it('has the same properties in both the LB3 and LB4 specs', () => {
|
|
111
|
+
const lb4SpecProperties = Object.keys(apiSpec);
|
|
112
|
+
testlab_1.expect(lb4SpecProperties).to.eql([
|
|
113
|
+
'openapi',
|
|
114
|
+
'info',
|
|
115
|
+
'paths',
|
|
116
|
+
'servers',
|
|
117
|
+
'components',
|
|
118
|
+
'tags',
|
|
119
|
+
]);
|
|
120
|
+
});
|
|
121
|
+
it('uses OpenApi version 3', () => {
|
|
122
|
+
testlab_1.expect(apiSpec.openapi).to.eql('3.0.0');
|
|
123
|
+
});
|
|
124
|
+
it('transfers the tags from the LB3 spec to the LB4 spec', () => {
|
|
125
|
+
testlab_1.expect(apiSpec.tags).to.containDeep([
|
|
126
|
+
{ name: 'User', description: undefined, externalDocs: undefined },
|
|
127
|
+
{ name: 'CoffeeShop', description: undefined, externalDocs: undefined },
|
|
128
|
+
]);
|
|
129
|
+
});
|
|
130
|
+
it('transfers the components from the LB3 spec to the LB4 spec', () => {
|
|
131
|
+
const components = apiSpec.components;
|
|
132
|
+
testlab_1.expect(components).to.have.properties('requestBodies', 'schemas');
|
|
133
|
+
testlab_1.expect(components.requestBodies).to.containDeep({
|
|
134
|
+
CoffeeShop: {
|
|
135
|
+
content: {
|
|
136
|
+
'application/json': {
|
|
137
|
+
schema: { $ref: '#/components/schemas/CoffeeShop' },
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
description: 'Model instance data',
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
testlab_1.expect(components.schemas).to.containDeep({
|
|
144
|
+
CoffeeShop: {
|
|
145
|
+
description: undefined,
|
|
146
|
+
properties: {
|
|
147
|
+
name: { type: 'string' },
|
|
148
|
+
city: { type: 'string' },
|
|
149
|
+
id: { type: 'number', format: 'double' },
|
|
150
|
+
},
|
|
151
|
+
required: ['name'],
|
|
152
|
+
additionalProperties: false,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
it('appends the basePath and transfers the paths from the LB3 spec to the LB4 spec', () => {
|
|
157
|
+
const paths = Object.keys(apiSpec.paths);
|
|
158
|
+
testlab_1.expect(paths).to.have.length(32);
|
|
159
|
+
// some of the expected paths
|
|
160
|
+
testlab_1.expect(paths).to.containDeep([
|
|
161
|
+
'/Users/{id}/accessTokens/{fk}',
|
|
162
|
+
'/Users',
|
|
163
|
+
'/Users/{id}/exists',
|
|
164
|
+
'/Users/login',
|
|
165
|
+
'/CoffeeShops',
|
|
166
|
+
'/CoffeeShops/{id}',
|
|
167
|
+
'/CoffeeShops/greet',
|
|
168
|
+
]);
|
|
169
|
+
});
|
|
170
|
+
it("transfers the path's details", () => {
|
|
171
|
+
const CoffeeShopsEndpoint = apiSpec.paths['/CoffeeShops'];
|
|
172
|
+
testlab_1.expect(CoffeeShopsEndpoint).to.have.properties([
|
|
173
|
+
'post',
|
|
174
|
+
'patch',
|
|
175
|
+
'put',
|
|
176
|
+
'get',
|
|
177
|
+
]);
|
|
178
|
+
testlab_1.expect(CoffeeShopsEndpoint['post']).to.containDeep({
|
|
179
|
+
tags: ['CoffeeShop'],
|
|
180
|
+
summary: 'Create a new instance of the model and persist it into the data source.',
|
|
181
|
+
operationId: 'CoffeeShop.create',
|
|
182
|
+
requestBody: { $ref: '#/components/requestBodies/CoffeeShop' },
|
|
183
|
+
responses: {
|
|
184
|
+
'200': {
|
|
185
|
+
description: 'Request was successful',
|
|
186
|
+
content: {
|
|
187
|
+
'application/json': {
|
|
188
|
+
schema: {
|
|
189
|
+
$ref: '#/components/schemas/CoffeeShop',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
deprecated: false,
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
//# sourceMappingURL=lb3app.acceptance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lb3app.acceptance.js","sourceRoot":"","sources":["../../../src/__tests__/acceptance/lb3app.acceptance.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAGhE,+CAAiD;AACjD,4DAAuB;AAEvB,+CAAgE;AAEhE,MAAM,MAAM,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAExD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,GAAkB,CAAC;IACvB,IAAI,MAAc,CAAC;IAEnB,MAAM,CAAC,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AC,OAAO,CAAC,KAAK,CAAC,CAAC;YACzC,gBAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjC,6BAA6B;YAC7B,gBAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC;gBAC3B,+BAA+B;gBAC/B,QAAQ;gBACR,oBAAoB;gBACpB,cAAc;gBACd,cAAc;gBACd,mBAAmB;gBACnB,oBAAoB;aACrB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC1D,gBAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;gBAC7C,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,KAAK;aACN,CAAC,CAAC;YAEH,gBAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC;gBACjD,IAAI,EAAE,CAAC,YAAY,CAAC;gBACpB,OAAO,EACL,yEAAyE;gBAC3E,WAAW,EAAE,mBAAmB;gBAChC,WAAW,EAAE,EAAC,IAAI,EAAE,uCAAuC,EAAC;gBAC5D,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,WAAW,EAAE,wBAAwB;wBACrC,OAAO,EAAE;4BACP,kBAAkB,EAAE;gCAClB,MAAM,EAAE;oCACN,IAAI,EAAE,iCAAiC;iCACxC;6BACF;yBACF;qBACF;iBACF;gBACD,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Client } from '@loopback/testlab';
|
|
2
|
+
import { ExpressServer } from '../../server';
|
|
3
|
+
export declare function setupApplication(): Promise<AppWithClient>;
|
|
4
|
+
export interface AppWithClient {
|
|
5
|
+
app: ExpressServer;
|
|
6
|
+
client: Client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Generate a complete Coffee object for use with tests.
|
|
10
|
+
*/
|
|
11
|
+
export declare function givenCoffeeShop(): any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2019. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/example-lb3-application
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.givenCoffeeShop = exports.setupApplication = void 0;
|
|
8
|
+
const testlab_1 = require("@loopback/testlab");
|
|
9
|
+
const server_1 = require("../../server");
|
|
10
|
+
const lb3app = require('../../../lb3app/server/server');
|
|
11
|
+
async function setupApplication() {
|
|
12
|
+
const app = new server_1.ExpressServer({
|
|
13
|
+
rest: testlab_1.givenHttpServerConfig(),
|
|
14
|
+
});
|
|
15
|
+
await app.boot();
|
|
16
|
+
await app.start();
|
|
17
|
+
const client = testlab_1.supertest(app.url);
|
|
18
|
+
return { app, client };
|
|
19
|
+
}
|
|
20
|
+
exports.setupApplication = setupApplication;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a complete Coffee object for use with tests.
|
|
23
|
+
*/
|
|
24
|
+
function givenCoffeeShop() {
|
|
25
|
+
const CoffeeShop = lb3app.models.CoffeeShop;
|
|
26
|
+
const data = {
|
|
27
|
+
name: 'Coffee Shop',
|
|
28
|
+
city: 'Toronto',
|
|
29
|
+
};
|
|
30
|
+
return new CoffeeShop(data);
|
|
31
|
+
}
|
|
32
|
+
exports.givenCoffeeShop = givenCoffeeShop;
|
|
33
|
+
//# sourceMappingURL=test-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helper.js","sourceRoot":"","sources":["../../../src/__tests__/acceptance/test-helper.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,iDAAiD;AACjD,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAA2E;AAC3E,yCAA2C;AAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAEjD,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,IAAI,sBAAa,CAAC;QAC5B,IAAI,EAAE,+BAAqB,EAAE;KAC9B,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAElB,MAAM,MAAM,GAAG,mBAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAElC,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,CAAC;AACvB,CAAC;AAXD,4CAWC;AAOD;;GAEG;AACH,SAAgB,eAAe;IAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IAE5C,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,SAAS;KAChB,CAAC;IAEF,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AATD,0CASC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ApplicationConfig } from '@loopback/core';
|
|
2
|
+
import { RestApplication } from '@loopback/rest';
|
|
3
|
+
declare const CoffeeShopApplication_base: (new (...args: any[]) => {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
bootOptions?: import("@loopback/boot").BootOptions | undefined;
|
|
6
|
+
booted: boolean;
|
|
7
|
+
start(): Promise<void>;
|
|
8
|
+
boot(): Promise<void>;
|
|
9
|
+
booters(...booterCls: import("@loopback/core").Constructor<import("@loopback/boot").Booter>[]): import("@loopback/boot").Binding<any>[];
|
|
10
|
+
applicationBooter(subApp: import("@loopback/core").Application & import("@loopback/boot").Bootable, filter?: import("@loopback/core").BindingFilter | undefined): import("@loopback/boot").Binding<import("@loopback/boot").Booter>;
|
|
11
|
+
component<C extends import("@loopback/core").Component = import("@loopback/core").Component>(componentCtor: import("@loopback/core").Constructor<C>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined): import("@loopback/boot").Binding<C>;
|
|
12
|
+
mountComponentBooters(componentInstanceOrClass: import("@loopback/core").Constructor<unknown> | import("@loopback/boot").InstanceWithBooters): void;
|
|
13
|
+
readonly options: ApplicationConfig;
|
|
14
|
+
readonly state: string;
|
|
15
|
+
controller: <T_1>(controllerCtor: import("@loopback/core").ControllerClass<T_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_1>;
|
|
16
|
+
server: <T_2 extends import("@loopback/core").Server>(ctor: import("@loopback/core").Constructor<T_2>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_2>;
|
|
17
|
+
servers: <T_3 extends import("@loopback/core").Server>(ctors: import("@loopback/core").Constructor<T_3>[]) => import("@loopback/boot").Binding<any>[];
|
|
18
|
+
getServer: <T_4 extends import("@loopback/core").Server>(target: string | import("@loopback/core").Constructor<T_4>) => Promise<T_4>;
|
|
19
|
+
init: () => Promise<void>;
|
|
20
|
+
onInit: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
21
|
+
onStart: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
22
|
+
stop: () => Promise<void>;
|
|
23
|
+
onStop: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
24
|
+
setMetadata: (metadata: import("@loopback/core").ApplicationMetadata) => void;
|
|
25
|
+
lifeCycleObserver: <T_5 extends import("@loopback/core").LifeCycleObserver>(ctor: import("@loopback/core").Constructor<T_5>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_5>;
|
|
26
|
+
service: <S>(cls: import("@loopback/core").ServiceOrProviderClass<S>, nameOrOptions?: string | import("@loopback/core").ServiceOptions | undefined) => import("@loopback/boot").Binding<S>;
|
|
27
|
+
interceptor: (interceptor: import("@loopback/core").Interceptor | import("@loopback/core").Constructor<import("@loopback/core").Provider<import("@loopback/core").Interceptor>>, nameOrOptions?: string | import("@loopback/core").InterceptorBindingOptions | undefined) => import("@loopback/boot").Binding<import("@loopback/core").Interceptor>;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly subscriptionManager: import("@loopback/core").ContextSubscriptionManager;
|
|
30
|
+
scope: import("@loopback/core").BindingScope;
|
|
31
|
+
readonly parent: import("@loopback/core").Context | undefined;
|
|
32
|
+
emitEvent: <T_6 extends import("@loopback/core").ContextEvent>(type: string, event: T_6) => void;
|
|
33
|
+
emitError: (err: unknown) => void;
|
|
34
|
+
bind: <ValueType = any>(key: import("@loopback/core").BindingAddress<ValueType>) => import("@loopback/boot").Binding<ValueType>;
|
|
35
|
+
add: (binding: import("@loopback/boot").Binding<unknown>) => import("@loopback/core").Application;
|
|
36
|
+
configure: <ConfigValueType = any>(key?: import("@loopback/core").BindingAddress<unknown> | undefined) => import("@loopback/boot").Binding<ConfigValueType>;
|
|
37
|
+
getConfigAsValueOrPromise: <ConfigValueType_1>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => import("@loopback/core").ValueOrPromise<ConfigValueType_1 | undefined>;
|
|
38
|
+
getConfig: <ConfigValueType_2>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => Promise<ConfigValueType_2 | undefined>;
|
|
39
|
+
getConfigSync: <ConfigValueType_3>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => ConfigValueType_3 | undefined;
|
|
40
|
+
unbind: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
41
|
+
subscribe: (observer: import("@loopback/core").ContextEventObserver) => import("@loopback/core").Subscription;
|
|
42
|
+
unsubscribe: (observer: import("@loopback/core").ContextEventObserver) => boolean;
|
|
43
|
+
close: () => void;
|
|
44
|
+
isSubscribed: (observer: import("@loopback/core").ContextObserver) => boolean;
|
|
45
|
+
createView: <T_7 = unknown>(filter: import("@loopback/core").BindingFilter, comparator?: import("@loopback/core").BindingComparator | undefined) => import("@loopback/core").ContextView<T_7>;
|
|
46
|
+
contains: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
47
|
+
isBound: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
48
|
+
getOwnerContext: (keyOrBinding: import("@loopback/core").BindingAddress<unknown> | Readonly<import("@loopback/boot").Binding<unknown>>) => import("@loopback/core").Context | undefined;
|
|
49
|
+
getScopedContext: (scope: import("@loopback/core").BindingScope.APPLICATION | import("@loopback/core").BindingScope.SERVER | import("@loopback/core").BindingScope.REQUEST) => import("@loopback/core").Context | undefined;
|
|
50
|
+
getResolutionContext: (binding: Readonly<import("@loopback/boot").Binding<unknown>>) => import("@loopback/core").Context | undefined;
|
|
51
|
+
isVisibleTo: (ctx: import("@loopback/core").Context) => boolean;
|
|
52
|
+
find: <ValueType_1 = any>(pattern?: string | RegExp | import("@loopback/core").BindingFilter | undefined) => Readonly<import("@loopback/boot").Binding<ValueType_1>>[];
|
|
53
|
+
findByTag: <ValueType_2 = any>(tagFilter: RegExp | import("@loopback/core").BindingTag) => Readonly<import("@loopback/boot").Binding<ValueType_2>>[];
|
|
54
|
+
get: {
|
|
55
|
+
<ValueType_3>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_3>, session?: import("@loopback/core").ResolutionSession | undefined): Promise<ValueType_3>;
|
|
56
|
+
<ValueType_4>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_4>, options: import("@loopback/core").ResolutionOptions): Promise<ValueType_4 | undefined>;
|
|
57
|
+
};
|
|
58
|
+
getSync: {
|
|
59
|
+
<ValueType_5>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_5>, session?: import("@loopback/core").ResolutionSession | undefined): ValueType_5;
|
|
60
|
+
<ValueType_6>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_6>, options?: import("@loopback/core").ResolutionOptions | undefined): ValueType_6 | undefined;
|
|
61
|
+
};
|
|
62
|
+
getBinding: {
|
|
63
|
+
<ValueType_7 = any>(key: import("@loopback/core").BindingAddress<ValueType_7>): import("@loopback/boot").Binding<ValueType_7>;
|
|
64
|
+
<ValueType_8>(key: import("@loopback/core").BindingAddress<ValueType_8>, options?: {
|
|
65
|
+
optional?: boolean | undefined;
|
|
66
|
+
} | undefined): import("@loopback/boot").Binding<ValueType_8> | undefined;
|
|
67
|
+
};
|
|
68
|
+
findOrCreateBinding: <T_8>(key: import("@loopback/core").BindingAddress<T_8>, policy?: import("@loopback/core").BindingCreationPolicy | undefined) => import("@loopback/boot").Binding<T_8>;
|
|
69
|
+
getValueOrPromise: <ValueType_9>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_9>, optionsOrSession?: import("@loopback/core").ResolutionOptionsOrSession | undefined) => import("@loopback/core").ValueOrPromise<ValueType_9 | undefined>;
|
|
70
|
+
toJSON: () => import("@loopback/core").JSONObject;
|
|
71
|
+
inspect: (options?: import("@loopback/core").ContextInspectOptions | undefined) => import("@loopback/core").JSONObject;
|
|
72
|
+
on: {
|
|
73
|
+
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): import("@loopback/core").Application;
|
|
74
|
+
(event: string | symbol, listener: (...args: any[]) => void): import("@loopback/core").Application;
|
|
75
|
+
};
|
|
76
|
+
once: {
|
|
77
|
+
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): import("@loopback/core").Application;
|
|
78
|
+
(event: string | symbol, listener: (...args: any[]) => void): import("@loopback/core").Application;
|
|
79
|
+
};
|
|
80
|
+
addListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
81
|
+
removeListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
82
|
+
off: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
83
|
+
removeAllListeners: (event?: string | symbol | undefined) => import("@loopback/core").Application;
|
|
84
|
+
setMaxListeners: (n: number) => import("@loopback/core").Application;
|
|
85
|
+
getMaxListeners: () => number;
|
|
86
|
+
listeners: (event: string | symbol) => Function[];
|
|
87
|
+
rawListeners: (event: string | symbol) => Function[];
|
|
88
|
+
emit: (event: string | symbol, ...args: any[]) => boolean;
|
|
89
|
+
listenerCount: (type: string | symbol) => number;
|
|
90
|
+
prependListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
91
|
+
prependOnceListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
92
|
+
eventNames: () => (string | symbol)[];
|
|
93
|
+
}) & (new (...args: any[]) => {
|
|
94
|
+
repository<R extends import("@loopback/repository").Repository<any>>(repoClass: import("@loopback/repository").Class<R>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined): import("@loopback/boot").Binding<R>;
|
|
95
|
+
getRepository<R_1 extends import("@loopback/repository").Repository<any>>(repo: import("@loopback/repository").Class<R_1>): Promise<R_1>;
|
|
96
|
+
dataSource<D extends import("@loopback/repository").JugglerDataSource>(dataSource: D | import("@loopback/repository").Class<D>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined): import("@loopback/boot").Binding<D>;
|
|
97
|
+
model<M extends import("@loopback/repository").Class<unknown>>(modelClass: M): import("@loopback/boot").Binding<M>;
|
|
98
|
+
component<C_1 extends import("@loopback/core").Component = import("@loopback/core").Component>(componentCtor: import("@loopback/core").Constructor<C_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined): import("@loopback/boot").Binding<C_1>;
|
|
99
|
+
mountComponentRepositories(componentInstanceOrClass: import("@loopback/repository").RepositoryComponent | import("@loopback/repository").Class<unknown>): void;
|
|
100
|
+
mountComponentModels(component: import("@loopback/repository").RepositoryComponent): void;
|
|
101
|
+
migrateSchema(options?: import("@loopback/repository").SchemaMigrationOptions | undefined): Promise<void>;
|
|
102
|
+
readonly options: ApplicationConfig;
|
|
103
|
+
readonly state: string;
|
|
104
|
+
controller: <T_1_1>(controllerCtor: import("@loopback/core").ControllerClass<T_1_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_1_1>;
|
|
105
|
+
server: <T_2_1 extends import("@loopback/core").Server>(ctor: import("@loopback/core").Constructor<T_2_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_2_1>;
|
|
106
|
+
servers: <T_3_1 extends import("@loopback/core").Server>(ctors: import("@loopback/core").Constructor<T_3_1>[]) => import("@loopback/boot").Binding<any>[];
|
|
107
|
+
getServer: <T_4_1 extends import("@loopback/core").Server>(target: string | import("@loopback/core").Constructor<T_4_1>) => Promise<T_4_1>;
|
|
108
|
+
init: () => Promise<void>;
|
|
109
|
+
onInit: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
110
|
+
start: () => Promise<void>;
|
|
111
|
+
onStart: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
112
|
+
stop: () => Promise<void>;
|
|
113
|
+
onStop: (fn: () => import("@loopback/core").ValueOrPromise<void>) => import("@loopback/boot").Binding<import("@loopback/core").LifeCycleObserver>;
|
|
114
|
+
setMetadata: (metadata: import("@loopback/core").ApplicationMetadata) => void;
|
|
115
|
+
lifeCycleObserver: <T_5_1 extends import("@loopback/core").LifeCycleObserver>(ctor: import("@loopback/core").Constructor<T_5_1>, nameOrOptions?: string | import("@loopback/core").BindingFromClassOptions | undefined) => import("@loopback/boot").Binding<T_5_1>;
|
|
116
|
+
service: <S_1>(cls: import("@loopback/core").ServiceOrProviderClass<S_1>, nameOrOptions?: string | import("@loopback/core").ServiceOptions | undefined) => import("@loopback/boot").Binding<S_1>;
|
|
117
|
+
interceptor: (interceptor: import("@loopback/core").Interceptor | import("@loopback/core").Constructor<import("@loopback/core").Provider<import("@loopback/core").Interceptor>>, nameOrOptions?: string | import("@loopback/core").InterceptorBindingOptions | undefined) => import("@loopback/boot").Binding<import("@loopback/core").Interceptor>;
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly subscriptionManager: import("@loopback/core").ContextSubscriptionManager;
|
|
120
|
+
scope: import("@loopback/core").BindingScope;
|
|
121
|
+
readonly parent: import("@loopback/core").Context | undefined;
|
|
122
|
+
emitEvent: <T_6_1 extends import("@loopback/core").ContextEvent>(type: string, event: T_6_1) => void;
|
|
123
|
+
emitError: (err: unknown) => void;
|
|
124
|
+
bind: <ValueType_10 = any>(key: import("@loopback/core").BindingAddress<ValueType_10>) => import("@loopback/boot").Binding<ValueType_10>;
|
|
125
|
+
add: (binding: import("@loopback/boot").Binding<unknown>) => import("@loopback/core").Application;
|
|
126
|
+
configure: <ConfigValueType_4 = any>(key?: import("@loopback/core").BindingAddress<unknown> | undefined) => import("@loopback/boot").Binding<ConfigValueType_4>;
|
|
127
|
+
getConfigAsValueOrPromise: <ConfigValueType_1_1>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => import("@loopback/core").ValueOrPromise<ConfigValueType_1_1 | undefined>;
|
|
128
|
+
getConfig: <ConfigValueType_2_1>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => Promise<ConfigValueType_2_1 | undefined>;
|
|
129
|
+
getConfigSync: <ConfigValueType_3_1>(key: import("@loopback/core").BindingAddress<unknown>, propertyPath?: string | undefined, resolutionOptions?: import("@loopback/core").ResolutionOptions | undefined) => ConfigValueType_3_1 | undefined;
|
|
130
|
+
unbind: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
131
|
+
subscribe: (observer: import("@loopback/core").ContextEventObserver) => import("@loopback/core").Subscription;
|
|
132
|
+
unsubscribe: (observer: import("@loopback/core").ContextEventObserver) => boolean;
|
|
133
|
+
close: () => void;
|
|
134
|
+
isSubscribed: (observer: import("@loopback/core").ContextObserver) => boolean;
|
|
135
|
+
createView: <T_7_1 = unknown>(filter: import("@loopback/core").BindingFilter, comparator?: import("@loopback/core").BindingComparator | undefined) => import("@loopback/core").ContextView<T_7_1>;
|
|
136
|
+
contains: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
137
|
+
isBound: (key: import("@loopback/core").BindingAddress<unknown>) => boolean;
|
|
138
|
+
getOwnerContext: (keyOrBinding: import("@loopback/core").BindingAddress<unknown> | Readonly<import("@loopback/boot").Binding<unknown>>) => import("@loopback/core").Context | undefined;
|
|
139
|
+
getScopedContext: (scope: import("@loopback/core").BindingScope.APPLICATION | import("@loopback/core").BindingScope.SERVER | import("@loopback/core").BindingScope.REQUEST) => import("@loopback/core").Context | undefined;
|
|
140
|
+
getResolutionContext: (binding: Readonly<import("@loopback/boot").Binding<unknown>>) => import("@loopback/core").Context | undefined;
|
|
141
|
+
isVisibleTo: (ctx: import("@loopback/core").Context) => boolean;
|
|
142
|
+
find: <ValueType_1_1 = any>(pattern?: string | RegExp | import("@loopback/core").BindingFilter | undefined) => Readonly<import("@loopback/boot").Binding<ValueType_1_1>>[];
|
|
143
|
+
findByTag: <ValueType_2_1 = any>(tagFilter: RegExp | import("@loopback/core").BindingTag) => Readonly<import("@loopback/boot").Binding<ValueType_2_1>>[];
|
|
144
|
+
get: {
|
|
145
|
+
<ValueType_3_1>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_3_1>, session?: import("@loopback/core").ResolutionSession | undefined): Promise<ValueType_3_1>;
|
|
146
|
+
<ValueType_4_1>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_4_1>, options: import("@loopback/core").ResolutionOptions): Promise<ValueType_4_1 | undefined>;
|
|
147
|
+
};
|
|
148
|
+
getSync: {
|
|
149
|
+
<ValueType_5_1>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_5_1>, session?: import("@loopback/core").ResolutionSession | undefined): ValueType_5_1;
|
|
150
|
+
<ValueType_6_1>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_6_1>, options?: import("@loopback/core").ResolutionOptions | undefined): ValueType_6_1 | undefined;
|
|
151
|
+
};
|
|
152
|
+
getBinding: {
|
|
153
|
+
<ValueType_7_1 = any>(key: import("@loopback/core").BindingAddress<ValueType_7_1>): import("@loopback/boot").Binding<ValueType_7_1>;
|
|
154
|
+
<ValueType_8_1>(key: import("@loopback/core").BindingAddress<ValueType_8_1>, options?: {
|
|
155
|
+
optional?: boolean | undefined;
|
|
156
|
+
} | undefined): import("@loopback/boot").Binding<ValueType_8_1> | undefined;
|
|
157
|
+
};
|
|
158
|
+
findOrCreateBinding: <T_8_1>(key: import("@loopback/core").BindingAddress<T_8_1>, policy?: import("@loopback/core").BindingCreationPolicy | undefined) => import("@loopback/boot").Binding<T_8_1>;
|
|
159
|
+
getValueOrPromise: <ValueType_9_1>(keyWithPath: import("@loopback/core").BindingAddress<ValueType_9_1>, optionsOrSession?: import("@loopback/core").ResolutionOptionsOrSession | undefined) => import("@loopback/core").ValueOrPromise<ValueType_9_1 | undefined>;
|
|
160
|
+
toJSON: () => import("@loopback/core").JSONObject;
|
|
161
|
+
inspect: (options?: import("@loopback/core").ContextInspectOptions | undefined) => import("@loopback/core").JSONObject;
|
|
162
|
+
on: {
|
|
163
|
+
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): import("@loopback/core").Application;
|
|
164
|
+
(event: string | symbol, listener: (...args: any[]) => void): import("@loopback/core").Application;
|
|
165
|
+
};
|
|
166
|
+
once: {
|
|
167
|
+
(eventName: "bind" | "unbind", listener: import("@loopback/core").ContextEventListener): import("@loopback/core").Application;
|
|
168
|
+
(event: string | symbol, listener: (...args: any[]) => void): import("@loopback/core").Application;
|
|
169
|
+
};
|
|
170
|
+
addListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
171
|
+
removeListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
172
|
+
off: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
173
|
+
removeAllListeners: (event?: string | symbol | undefined) => import("@loopback/core").Application;
|
|
174
|
+
setMaxListeners: (n: number) => import("@loopback/core").Application;
|
|
175
|
+
getMaxListeners: () => number;
|
|
176
|
+
listeners: (event: string | symbol) => Function[];
|
|
177
|
+
rawListeners: (event: string | symbol) => Function[];
|
|
178
|
+
emit: (event: string | symbol, ...args: any[]) => boolean;
|
|
179
|
+
listenerCount: (type: string | symbol) => number;
|
|
180
|
+
prependListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
181
|
+
prependOnceListener: (event: string | symbol, listener: (...args: any[]) => void) => import("@loopback/core").Application;
|
|
182
|
+
eventNames: () => (string | symbol)[];
|
|
183
|
+
}) & typeof RestApplication;
|
|
184
|
+
export declare class CoffeeShopApplication extends CoffeeShopApplication_base {
|
|
185
|
+
constructor(options?: ApplicationConfig);
|
|
186
|
+
}
|
|
187
|
+
export {};
|