@adonisjs/http-server 5.7.3 → 5.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/build/adonis-typings/route.d.ts +22 -10
- package/build/src/Router/LookupStore.d.ts +48 -8
- package/build/src/Router/LookupStore.js +87 -24
- package/build/src/Router/index.d.ts +2 -14
- package/build/src/Router/index.js +6 -20
- package/build/src/helpers.d.ts +2 -0
- package/build/src/helpers.js +4 -2
- package/package.json +23 -23
|
@@ -116,20 +116,11 @@ declare module '@ioc:Adonis/Core/Route' {
|
|
|
116
116
|
domain?: string;
|
|
117
117
|
matchers: RouteMatchersNode;
|
|
118
118
|
};
|
|
119
|
-
/**
|
|
120
|
-
* Shape of the identifier node of the URL builder
|
|
121
|
-
*/
|
|
122
|
-
export type LookupStoreIdentifier = {
|
|
123
|
-
handler: RouteHandler;
|
|
124
|
-
methods: string[];
|
|
125
|
-
pattern: string;
|
|
126
|
-
name?: string;
|
|
127
|
-
};
|
|
128
119
|
/**
|
|
129
120
|
* Shape of the routes tree maintained by the UrlBuilder
|
|
130
121
|
*/
|
|
131
122
|
export type LookupStoreTree = {
|
|
132
|
-
[domain: string]:
|
|
123
|
+
[domain: string]: RouteJSON[];
|
|
133
124
|
};
|
|
134
125
|
/**
|
|
135
126
|
* Shape of the matched route for a pattern, method and domain. We set
|
|
@@ -350,6 +341,7 @@ declare module '@ioc:Adonis/Core/Route' {
|
|
|
350
341
|
qs?: Record<string, any>;
|
|
351
342
|
domain?: string;
|
|
352
343
|
prefixUrl?: string;
|
|
344
|
+
disableRouteLookup?: boolean;
|
|
353
345
|
} & Record<string, any>;
|
|
354
346
|
/**
|
|
355
347
|
* Options for making a signed url
|
|
@@ -489,6 +481,21 @@ declare module '@ioc:Adonis/Core/Route' {
|
|
|
489
481
|
* directly
|
|
490
482
|
*/
|
|
491
483
|
export interface LookupStoreContract {
|
|
484
|
+
/**
|
|
485
|
+
* Find a route by indentifier. Optionally one can find routes inside
|
|
486
|
+
* a given domain
|
|
487
|
+
*/
|
|
488
|
+
find(routeIdentifier: string, domainPattern?: string): RouteJSON | null;
|
|
489
|
+
/**
|
|
490
|
+
* Find a route by indentifier or fail. Optionally one can find routes inside
|
|
491
|
+
* a given domain
|
|
492
|
+
*/
|
|
493
|
+
findOrFail(routeIdentifier: string, domainPattern?: string): RouteJSON;
|
|
494
|
+
/**
|
|
495
|
+
* Find if a route for given identifier exists. Optionally one can find routes inside
|
|
496
|
+
* a given domain
|
|
497
|
+
*/
|
|
498
|
+
has(routeIdentifier: string, domainPattern?: string): boolean;
|
|
492
499
|
/**
|
|
493
500
|
* Get the builder instance for the main domain
|
|
494
501
|
*/
|
|
@@ -518,6 +525,11 @@ declare module '@ioc:Adonis/Core/Route' {
|
|
|
518
525
|
* Generate url for the given route
|
|
519
526
|
*/
|
|
520
527
|
make(identifier: string): string;
|
|
528
|
+
/**
|
|
529
|
+
* Disable route lookup and consider identifier
|
|
530
|
+
* as the route pattern
|
|
531
|
+
*/
|
|
532
|
+
disableRouteLookup(): this;
|
|
521
533
|
/**
|
|
522
534
|
* Generate signed url for the given route
|
|
523
535
|
*/
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import { RouteJSON, LookupStoreTree, UrlBuilderContract,
|
|
1
|
+
import { RouteJSON, LookupStoreTree, UrlBuilderContract, LookupStoreContract } from '@ioc:Adonis/Core/Route';
|
|
2
2
|
import { EncryptionContract } from '@ioc:Adonis/Core/Encryption';
|
|
3
|
+
/**
|
|
4
|
+
* A class to encapsulate finding routes
|
|
5
|
+
*/
|
|
6
|
+
declare class Routes {
|
|
7
|
+
private routes;
|
|
8
|
+
constructor(routes: RouteJSON[]);
|
|
9
|
+
/**
|
|
10
|
+
* Find a route by indentifier
|
|
11
|
+
*/
|
|
12
|
+
find(routeIdentifier: string): RouteJSON | null;
|
|
13
|
+
/**
|
|
14
|
+
* Find a route by indentifier or fail
|
|
15
|
+
*/
|
|
16
|
+
findOrFail(routeIdentifier: string): RouteJSON;
|
|
17
|
+
/**
|
|
18
|
+
* Find if a route exists
|
|
19
|
+
*/
|
|
20
|
+
has(routeIdentifier: string): boolean;
|
|
21
|
+
}
|
|
3
22
|
/**
|
|
4
23
|
* Url builder is responsible for building the URLs
|
|
5
24
|
*/
|
|
@@ -14,20 +33,20 @@ export declare class UrlBuilder implements UrlBuilderContract {
|
|
|
14
33
|
* A custom query string to append to the URL
|
|
15
34
|
*/
|
|
16
35
|
private queryString;
|
|
36
|
+
/**
|
|
37
|
+
* A boolean to know if the route should be looked
|
|
38
|
+
* up inside the route store or not
|
|
39
|
+
*/
|
|
40
|
+
private lookupRoute;
|
|
17
41
|
/**
|
|
18
42
|
* A baseUrl to prefix to the endpoint
|
|
19
43
|
*/
|
|
20
44
|
private baseUrl;
|
|
21
|
-
constructor(encryption: EncryptionContract, routes:
|
|
45
|
+
constructor(encryption: EncryptionContract, routes: Routes);
|
|
22
46
|
/**
|
|
23
47
|
* Processes the pattern against the params
|
|
24
48
|
*/
|
|
25
49
|
private processPattern;
|
|
26
|
-
/**
|
|
27
|
-
* Finds the route inside the list of registered routes and
|
|
28
|
-
* raises exception when unable to
|
|
29
|
-
*/
|
|
30
|
-
private findRouteOrFail;
|
|
31
50
|
/**
|
|
32
51
|
* Suffix the query string to the URL
|
|
33
52
|
*/
|
|
@@ -36,6 +55,11 @@ export declare class UrlBuilder implements UrlBuilderContract {
|
|
|
36
55
|
* Prefix a custom url to the final URI
|
|
37
56
|
*/
|
|
38
57
|
prefixUrl(url: string): this;
|
|
58
|
+
/**
|
|
59
|
+
* Disable route lookup. Calling this method considers
|
|
60
|
+
* the "identifier" as the route pattern
|
|
61
|
+
*/
|
|
62
|
+
disableRouteLookup(): this;
|
|
39
63
|
/**
|
|
40
64
|
* Append query string to the final URI
|
|
41
65
|
*/
|
|
@@ -60,7 +84,7 @@ export declare class UrlBuilder implements UrlBuilderContract {
|
|
|
60
84
|
* The look up store to make URLs for a given route by looking
|
|
61
85
|
* it by its name, route handler or the pattern directly.
|
|
62
86
|
*/
|
|
63
|
-
export declare class LookupStore {
|
|
87
|
+
export declare class LookupStore implements LookupStoreContract {
|
|
64
88
|
private encryption;
|
|
65
89
|
/**
|
|
66
90
|
* Shape of the registered routes. Optimized for lookups
|
|
@@ -79,4 +103,20 @@ export declare class LookupStore {
|
|
|
79
103
|
* Returns the route builder a given domain.
|
|
80
104
|
*/
|
|
81
105
|
builderForDomain(domainPattern: string): UrlBuilder;
|
|
106
|
+
/**
|
|
107
|
+
* Find a route by indentifier. Optionally one can find routes inside
|
|
108
|
+
* a given domain
|
|
109
|
+
*/
|
|
110
|
+
find(routeIdentifier: string, domainPattern?: string): RouteJSON | null;
|
|
111
|
+
/**
|
|
112
|
+
* Find a route by indentifier or fail. Optionally one can find routes inside
|
|
113
|
+
* a given domain
|
|
114
|
+
*/
|
|
115
|
+
findOrFail(routeIdentifier: string, domainPattern?: string): RouteJSON;
|
|
116
|
+
/**
|
|
117
|
+
* Find if a route for given identifier exists. Optionally one can find routes inside
|
|
118
|
+
* a given domain
|
|
119
|
+
*/
|
|
120
|
+
has(routeIdentifier: string, domainPattern?: string): boolean;
|
|
82
121
|
}
|
|
122
|
+
export {};
|
|
@@ -15,6 +15,38 @@ exports.LookupStore = exports.UrlBuilder = void 0;
|
|
|
15
15
|
const qs_1 = __importDefault(require("qs"));
|
|
16
16
|
const encodeurl_1 = __importDefault(require("encodeurl"));
|
|
17
17
|
const RouterException_1 = require("../Exceptions/RouterException");
|
|
18
|
+
/**
|
|
19
|
+
* A class to encapsulate finding routes
|
|
20
|
+
*/
|
|
21
|
+
class Routes {
|
|
22
|
+
constructor(routes) {
|
|
23
|
+
this.routes = routes;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Find a route by indentifier
|
|
27
|
+
*/
|
|
28
|
+
find(routeIdentifier) {
|
|
29
|
+
return (this.routes.find(({ name, pattern, handler }) => {
|
|
30
|
+
return (name === routeIdentifier || pattern === routeIdentifier || handler === routeIdentifier);
|
|
31
|
+
}) || null);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Find a route by indentifier or fail
|
|
35
|
+
*/
|
|
36
|
+
findOrFail(routeIdentifier) {
|
|
37
|
+
const route = this.find(routeIdentifier);
|
|
38
|
+
if (!route) {
|
|
39
|
+
throw RouterException_1.RouterException.cannotLookupRoute(routeIdentifier);
|
|
40
|
+
}
|
|
41
|
+
return route;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Find if a route exists
|
|
45
|
+
*/
|
|
46
|
+
has(routeIdentifier) {
|
|
47
|
+
return !!this.find(routeIdentifier);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
18
50
|
/**
|
|
19
51
|
* Url builder is responsible for building the URLs
|
|
20
52
|
*/
|
|
@@ -26,6 +58,11 @@ class UrlBuilder {
|
|
|
26
58
|
* A custom query string to append to the URL
|
|
27
59
|
*/
|
|
28
60
|
this.queryString = {};
|
|
61
|
+
/**
|
|
62
|
+
* A boolean to know if the route should be looked
|
|
63
|
+
* up inside the route store or not
|
|
64
|
+
*/
|
|
65
|
+
this.lookupRoute = true;
|
|
29
66
|
}
|
|
30
67
|
/**
|
|
31
68
|
* Processes the pattern against the params
|
|
@@ -75,19 +112,6 @@ class UrlBuilder {
|
|
|
75
112
|
}
|
|
76
113
|
return url.join('/');
|
|
77
114
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Finds the route inside the list of registered routes and
|
|
80
|
-
* raises exception when unable to
|
|
81
|
-
*/
|
|
82
|
-
findRouteOrFail(identifier) {
|
|
83
|
-
const route = this.routes.find(({ name, pattern, handler }) => {
|
|
84
|
-
return name === identifier || pattern === identifier || handler === identifier;
|
|
85
|
-
});
|
|
86
|
-
if (!route) {
|
|
87
|
-
throw RouterException_1.RouterException.cannotLookupRoute(identifier);
|
|
88
|
-
}
|
|
89
|
-
return route;
|
|
90
|
-
}
|
|
91
115
|
/**
|
|
92
116
|
* Suffix the query string to the URL
|
|
93
117
|
*/
|
|
@@ -105,6 +129,14 @@ class UrlBuilder {
|
|
|
105
129
|
this.baseUrl = url;
|
|
106
130
|
return this;
|
|
107
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Disable route lookup. Calling this method considers
|
|
134
|
+
* the "identifier" as the route pattern
|
|
135
|
+
*/
|
|
136
|
+
disableRouteLookup() {
|
|
137
|
+
this.lookupRoute = false;
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
108
140
|
/**
|
|
109
141
|
* Append query string to the final URI
|
|
110
142
|
*/
|
|
@@ -129,16 +161,28 @@ class UrlBuilder {
|
|
|
129
161
|
* Generate url for the given route identifier
|
|
130
162
|
*/
|
|
131
163
|
make(identifier) {
|
|
132
|
-
|
|
133
|
-
|
|
164
|
+
let url;
|
|
165
|
+
if (this.lookupRoute) {
|
|
166
|
+
const route = this.routes.findOrFail(identifier);
|
|
167
|
+
url = this.processPattern(route.pattern);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
url = this.processPattern(identifier);
|
|
171
|
+
}
|
|
134
172
|
return this.suffixQueryString(this.baseUrl ? `${this.baseUrl}${url}` : url);
|
|
135
173
|
}
|
|
136
174
|
/**
|
|
137
175
|
* Generate url for the given route identifier
|
|
138
176
|
*/
|
|
139
177
|
makeSigned(identifier, options) {
|
|
140
|
-
|
|
141
|
-
|
|
178
|
+
let url;
|
|
179
|
+
if (this.lookupRoute) {
|
|
180
|
+
const route = this.routes.findOrFail(identifier);
|
|
181
|
+
url = this.processPattern(route.pattern);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
url = this.processPattern(identifier);
|
|
185
|
+
}
|
|
142
186
|
/*
|
|
143
187
|
* Making the signature from the qualified url. We do not prefix the domain when
|
|
144
188
|
* making signature, since it just makes the signature big.
|
|
@@ -174,12 +218,7 @@ class LookupStore {
|
|
|
174
218
|
register(route) {
|
|
175
219
|
const domain = route.domain || 'root';
|
|
176
220
|
this.tree[domain] = this.tree[domain] || [];
|
|
177
|
-
this.tree[domain].push(
|
|
178
|
-
methods: route.methods,
|
|
179
|
-
name: route.name,
|
|
180
|
-
handler: route.handler,
|
|
181
|
-
pattern: route.pattern,
|
|
182
|
-
});
|
|
221
|
+
this.tree[domain].push(route);
|
|
183
222
|
}
|
|
184
223
|
/**
|
|
185
224
|
* Returns the route builder for the root domain
|
|
@@ -195,7 +234,31 @@ class LookupStore {
|
|
|
195
234
|
if (!domainRoutes && domainPattern !== 'root') {
|
|
196
235
|
throw RouterException_1.RouterException.cannotLookupDomain(domainPattern);
|
|
197
236
|
}
|
|
198
|
-
return new UrlBuilder(this.encryption, domainRoutes || []);
|
|
237
|
+
return new UrlBuilder(this.encryption, new Routes(domainRoutes || []));
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Find a route by indentifier. Optionally one can find routes inside
|
|
241
|
+
* a given domain
|
|
242
|
+
*/
|
|
243
|
+
find(routeIdentifier, domainPattern) {
|
|
244
|
+
const routes = this.tree[domainPattern || 'root'] || [];
|
|
245
|
+
return new Routes(routes || []).find(routeIdentifier);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Find a route by indentifier or fail. Optionally one can find routes inside
|
|
249
|
+
* a given domain
|
|
250
|
+
*/
|
|
251
|
+
findOrFail(routeIdentifier, domainPattern) {
|
|
252
|
+
const routes = this.tree[domainPattern || 'root'] || [];
|
|
253
|
+
return new Routes(routes || []).findOrFail(routeIdentifier);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Find if a route for given identifier exists. Optionally one can find routes inside
|
|
257
|
+
* a given domain
|
|
258
|
+
*/
|
|
259
|
+
has(routeIdentifier, domainPattern) {
|
|
260
|
+
const routes = this.tree[domainPattern || 'root'] || [];
|
|
261
|
+
return new Routes(routes || []).has(routeIdentifier);
|
|
199
262
|
}
|
|
200
263
|
}
|
|
201
264
|
exports.LookupStore = LookupStore;
|
|
@@ -14,6 +14,7 @@ import { RouteGroup } from './Group';
|
|
|
14
14
|
import { BriskRoute } from './BriskRoute';
|
|
15
15
|
import { RouteResource } from './Resource';
|
|
16
16
|
import { RouteMatchers } from './Matchers';
|
|
17
|
+
import { LookupStore } from './LookupStore';
|
|
17
18
|
/**
|
|
18
19
|
* Router class exposes unified API to create new routes, group them or
|
|
19
20
|
* create route resources.
|
|
@@ -27,8 +28,7 @@ import { RouteMatchers } from './Matchers';
|
|
|
27
28
|
* })
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
|
-
export declare class Router implements RouterContract {
|
|
31
|
-
private encryption;
|
|
31
|
+
export declare class Router extends LookupStore implements RouterContract {
|
|
32
32
|
private routeProcessor?;
|
|
33
33
|
/**
|
|
34
34
|
* Collection of routes, including route resource and route
|
|
@@ -52,10 +52,6 @@ export declare class Router implements RouterContract {
|
|
|
52
52
|
* Global matchers to test route params against regular expressions.
|
|
53
53
|
*/
|
|
54
54
|
private paramMatchers;
|
|
55
|
-
/**
|
|
56
|
-
* The lookup store instance
|
|
57
|
-
*/
|
|
58
|
-
private lookupStore;
|
|
59
55
|
/**
|
|
60
56
|
* Store with tokenized routes
|
|
61
57
|
*/
|
|
@@ -133,14 +129,6 @@ export declare class Router implements RouterContract {
|
|
|
133
129
|
* Find route for a given URL, method and optionally domain
|
|
134
130
|
*/
|
|
135
131
|
match(url: string, method: string, domain?: string): null | MatchedRoute;
|
|
136
|
-
/**
|
|
137
|
-
* Access to the URL builder
|
|
138
|
-
*/
|
|
139
|
-
builder(): import("./LookupStore").UrlBuilder;
|
|
140
|
-
/**
|
|
141
|
-
* Access to the URL builder for a specific domain
|
|
142
|
-
*/
|
|
143
|
-
builderForDomain(domainPattern: string): import("./LookupStore").UrlBuilder;
|
|
144
132
|
/**
|
|
145
133
|
* Makes url to a registered route by looking it up with the route pattern,
|
|
146
134
|
* name or the controller.method
|
|
@@ -33,9 +33,9 @@ const LookupStore_1 = require("./LookupStore");
|
|
|
33
33
|
* })
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
|
-
class Router {
|
|
36
|
+
class Router extends LookupStore_1.LookupStore {
|
|
37
37
|
constructor(encryption, routeProcessor) {
|
|
38
|
-
|
|
38
|
+
super(encryption);
|
|
39
39
|
this.routeProcessor = routeProcessor;
|
|
40
40
|
/**
|
|
41
41
|
* Collection of routes, including route resource and route
|
|
@@ -59,10 +59,6 @@ class Router {
|
|
|
59
59
|
* Global matchers to test route params against regular expressions.
|
|
60
60
|
*/
|
|
61
61
|
this.paramMatchers = {};
|
|
62
|
-
/**
|
|
63
|
-
* The lookup store instance
|
|
64
|
-
*/
|
|
65
|
-
this.lookupStore = new LookupStore_1.LookupStore(this.encryption);
|
|
66
62
|
/**
|
|
67
63
|
* Store with tokenized routes
|
|
68
64
|
*/
|
|
@@ -224,7 +220,7 @@ class Router {
|
|
|
224
220
|
* Returns a flat list of routes JSON
|
|
225
221
|
*/
|
|
226
222
|
toJSON() {
|
|
227
|
-
const lookupStoreRoutes = this.
|
|
223
|
+
const lookupStoreRoutes = this.tree;
|
|
228
224
|
const domains = Object.keys(lookupStoreRoutes);
|
|
229
225
|
return domains.reduce((result, domain) => {
|
|
230
226
|
result[domain] = lookupStoreRoutes[domain].map((route) => {
|
|
@@ -264,7 +260,7 @@ class Router {
|
|
|
264
260
|
/**
|
|
265
261
|
* Register the route with the lookup store
|
|
266
262
|
*/
|
|
267
|
-
this.
|
|
263
|
+
this.register(route);
|
|
268
264
|
this.store.add(route);
|
|
269
265
|
});
|
|
270
266
|
this.routes = [];
|
|
@@ -303,18 +299,6 @@ class Router {
|
|
|
303
299
|
}
|
|
304
300
|
return response;
|
|
305
301
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Access to the URL builder
|
|
308
|
-
*/
|
|
309
|
-
builder() {
|
|
310
|
-
return this.lookupStore.builder();
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Access to the URL builder for a specific domain
|
|
314
|
-
*/
|
|
315
|
-
builderForDomain(domainPattern) {
|
|
316
|
-
return this.lookupStore.builderForDomain(domainPattern);
|
|
317
|
-
}
|
|
318
302
|
/**
|
|
319
303
|
* Makes url to a registered route by looking it up with the route pattern,
|
|
320
304
|
* name or the controller.method
|
|
@@ -327,6 +311,7 @@ class Router {
|
|
|
327
311
|
normalizedOptions.params && builder.params(normalizedOptions.params);
|
|
328
312
|
normalizedOptions.qs && builder.qs(normalizedOptions.qs);
|
|
329
313
|
normalizedOptions.prefixUrl && builder.prefixUrl(normalizedOptions.prefixUrl);
|
|
314
|
+
normalizedOptions.disableRouteLookup && builder.disableRouteLookup();
|
|
330
315
|
return builder.make(routeIdentifier);
|
|
331
316
|
}
|
|
332
317
|
/**
|
|
@@ -341,6 +326,7 @@ class Router {
|
|
|
341
326
|
normalizedOptions.params && builder.params(normalizedOptions.params);
|
|
342
327
|
normalizedOptions.qs && builder.qs(normalizedOptions.qs);
|
|
343
328
|
normalizedOptions.prefixUrl && builder.prefixUrl(normalizedOptions.prefixUrl);
|
|
329
|
+
normalizedOptions.disableRouteLookup && builder.disableRouteLookup();
|
|
344
330
|
return builder.makeSigned(routeIdentifier, normalizedOptions);
|
|
345
331
|
}
|
|
346
332
|
}
|
package/build/src/helpers.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare function normalizeMakeUrlOptions(params?: any[] | MakeUrlOptions,
|
|
|
48
48
|
qs: any;
|
|
49
49
|
domain: string | undefined;
|
|
50
50
|
prefixUrl: string | undefined;
|
|
51
|
+
disableRouteLookup: boolean;
|
|
51
52
|
};
|
|
52
53
|
/**
|
|
53
54
|
* Normalizes the make signed url options by allowing params to appear on
|
|
@@ -60,6 +61,7 @@ export declare function normalizeMakeSignedUrlOptions(params?: any[] | MakeSigne
|
|
|
60
61
|
prefixUrl: string | undefined;
|
|
61
62
|
expiresIn: any;
|
|
62
63
|
purpose: any;
|
|
64
|
+
disableRouteLookup: boolean;
|
|
63
65
|
};
|
|
64
66
|
/**
|
|
65
67
|
* Wraps `fs.stat` to promise interface.
|
package/build/src/helpers.js
CHANGED
|
@@ -143,13 +143,14 @@ function normalizeMakeUrlOptions(params, options) {
|
|
|
143
143
|
const qs = options.qs || params['qs'];
|
|
144
144
|
const domain = options.domain;
|
|
145
145
|
const prefixUrl = options.prefixUrl;
|
|
146
|
+
const disableRouteLookup = options.disableRouteLookup || false;
|
|
146
147
|
/**
|
|
147
148
|
* Using legacy options
|
|
148
149
|
*/
|
|
149
150
|
onIntersect(params, ['prefixDomain', 'domainParams', 'qs', 'params'], () => {
|
|
150
151
|
process.emitWarning('DeprecationWarning', 'You are using legacy the API of the "Route.makeUrl". We recommend reading the docs and use the latest API');
|
|
151
152
|
});
|
|
152
|
-
return { params: normalizedParams, qs, domain, prefixUrl };
|
|
153
|
+
return { params: normalizedParams, qs, domain, prefixUrl, disableRouteLookup };
|
|
153
154
|
}
|
|
154
155
|
exports.normalizeMakeUrlOptions = normalizeMakeUrlOptions;
|
|
155
156
|
/**
|
|
@@ -168,13 +169,14 @@ function normalizeMakeSignedUrlOptions(params, options) {
|
|
|
168
169
|
const purpose = options.purpose || params['purpose'];
|
|
169
170
|
const domain = options.domain;
|
|
170
171
|
const prefixUrl = options.prefixUrl;
|
|
172
|
+
const disableRouteLookup = options.disableRouteLookup || false;
|
|
171
173
|
/**
|
|
172
174
|
* Using legacy options
|
|
173
175
|
*/
|
|
174
176
|
onIntersect(params, ['prefixDomain', 'domainParams', 'qs', 'params', 'purpose', 'expiresIn'], () => {
|
|
175
177
|
process.emitWarning('DeprecationWarning', 'You are using legacy the API of the "Route.makeSignedUrl". We recommend reading the docs and use the latest API');
|
|
176
178
|
});
|
|
177
|
-
return { params: normalizedParams, qs, domain, prefixUrl, expiresIn, purpose };
|
|
179
|
+
return { params: normalizedParams, qs, domain, prefixUrl, expiresIn, purpose, disableRouteLookup };
|
|
178
180
|
}
|
|
179
181
|
exports.normalizeMakeSignedUrlOptions = normalizeMakeSignedUrlOptions;
|
|
180
182
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/http-server",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "AdonisJS HTTP server with support packed with Routing and Cookies",
|
|
5
5
|
"main": "build/providers/HttpServerProvider.js",
|
|
6
6
|
"files": [
|
|
@@ -36,44 +36,44 @@
|
|
|
36
36
|
"author": "virk,adonisjs",
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@adonisjs/application": "^5.2.
|
|
40
|
-
"@adonisjs/encryption": "^4.0.
|
|
39
|
+
"@adonisjs/application": "^5.2.4",
|
|
40
|
+
"@adonisjs/encryption": "^4.0.8",
|
|
41
41
|
"@adonisjs/mrm-preset": "^5.0.3",
|
|
42
|
-
"@adonisjs/require-ts": "^2.0.
|
|
43
|
-
"@japa/assert": "^1.3.
|
|
44
|
-
"@japa/run-failed-tests": "^1.0.
|
|
45
|
-
"@japa/runner": "^2.0.
|
|
46
|
-
"@japa/spec-reporter": "^1.1.
|
|
47
|
-
"@poppinss/dev-utils": "^2.0.
|
|
48
|
-
"@types/cookie": "^0.
|
|
42
|
+
"@adonisjs/require-ts": "^2.0.11",
|
|
43
|
+
"@japa/assert": "^1.3.4",
|
|
44
|
+
"@japa/run-failed-tests": "^1.0.7",
|
|
45
|
+
"@japa/runner": "^2.0.7",
|
|
46
|
+
"@japa/spec-reporter": "^1.1.12",
|
|
47
|
+
"@poppinss/dev-utils": "^2.0.3",
|
|
48
|
+
"@types/cookie": "^0.5.1",
|
|
49
49
|
"@types/ms": "^0.7.31",
|
|
50
|
-
"@types/node": "^17.0.
|
|
50
|
+
"@types/node": "^17.0.31",
|
|
51
51
|
"@types/pluralize": "0.0.29",
|
|
52
52
|
"@types/proxy-addr": "^2.0.0",
|
|
53
53
|
"@types/qs": "^6.9.7",
|
|
54
54
|
"@types/supertest": "^2.0.12",
|
|
55
|
-
"autocannon": "^7.
|
|
55
|
+
"autocannon": "^7.9.0",
|
|
56
56
|
"commitizen": "^4.2.4",
|
|
57
57
|
"cross-env": "^7.0.3",
|
|
58
58
|
"cz-conventional-changelog": "^3.3.0",
|
|
59
59
|
"del-cli": "^4.0.1",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.15.0",
|
|
61
61
|
"eslint-config-prettier": "^8.5.0",
|
|
62
62
|
"eslint-plugin-adonis": "^2.1.0",
|
|
63
63
|
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
-
"fastify": "^3.
|
|
65
|
-
"github-label-sync": "^2.0
|
|
64
|
+
"fastify": "^3.29.0",
|
|
65
|
+
"github-label-sync": "^2.2.0",
|
|
66
66
|
"http-status-codes": "^2.2.0",
|
|
67
|
-
"husky": "^
|
|
67
|
+
"husky": "^8.0.0",
|
|
68
68
|
"middie": "^6.0.0",
|
|
69
69
|
"mrm": "^4.0.0",
|
|
70
70
|
"np": "^7.6.1",
|
|
71
71
|
"pem": "^1.14.6",
|
|
72
|
-
"prettier": "^2.6.
|
|
72
|
+
"prettier": "^2.6.2",
|
|
73
73
|
"reflect-metadata": "^0.1.13",
|
|
74
|
-
"supertest": "^6.2.
|
|
74
|
+
"supertest": "^6.2.3",
|
|
75
75
|
"ts-node": "^10.7.0",
|
|
76
|
-
"typescript": "^4.6.
|
|
76
|
+
"typescript": "^4.6.4"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@adonisjs/application": "^5.0.0",
|
|
@@ -98,17 +98,17 @@
|
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@poppinss/matchit": "^3.1.2",
|
|
101
|
-
"@poppinss/utils": "^4.0.
|
|
101
|
+
"@poppinss/utils": "^4.0.4",
|
|
102
102
|
"accepts": "^1.3.8",
|
|
103
|
-
"co-compose": "^7.0.
|
|
103
|
+
"co-compose": "^7.0.2",
|
|
104
104
|
"content-disposition": "^0.5.4",
|
|
105
|
-
"cookie": "^0.
|
|
105
|
+
"cookie": "^0.5.0",
|
|
106
106
|
"destroy": "^1.2.0",
|
|
107
107
|
"encodeurl": "^1.0.2",
|
|
108
108
|
"etag": "^1.8.1",
|
|
109
109
|
"fresh": "^0.5.2",
|
|
110
110
|
"haye": "^3.0.0",
|
|
111
|
-
"macroable": "^7.0.
|
|
111
|
+
"macroable": "^7.0.1",
|
|
112
112
|
"mime-types": "^2.1.35",
|
|
113
113
|
"ms": "^2.1.3",
|
|
114
114
|
"on-finished": "^2.4.1",
|