@toa.io/extensions.exposition 1.0.0-alpha.54 → 1.0.0-alpha.55

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.
@@ -177,6 +177,10 @@ Constant values can be declared using the shortcut:
177
177
  limit: 10
178
178
  ```
179
179
 
180
+ ```http
181
+ GET /dummies/?omit=100&limit=10
182
+ ```
183
+
180
184
  ## Sort
181
185
 
182
186
  The `sort` query property defines the result order of Observations within an `objects` scope
@@ -213,6 +217,8 @@ GET /dummies/?sort=timestamp:asc
213
217
 
214
218
  ## Selectors
215
219
 
220
+ ![Not implemented](https://img.shields.io/badge/Not_implemented-red)
221
+
216
222
  The `selectors` query property contains a list of Entity properties allowed for a client to use in
217
223
  the `criteria` and `sort` query parameters.
218
224
  If no value is provided, then no selectors are allowed.
@@ -229,6 +235,21 @@ A list of Entity properties to be included in the Observation result.
229
235
  projection: [id, title, timestamp]
230
236
  ```
231
237
 
238
+ ## Parameters
239
+
240
+ By default, the only query parameters allowed are described above. Arbitrary query parameters
241
+ can be allowed by specifying them in the `parameters` property.
242
+
243
+ ```yaml
244
+ parameters: [foo, bar]
245
+ ```
246
+
247
+ These parameters are embedded in the operation call input, which must be an object.
248
+
249
+ ```http
250
+ GET /dummies/?foo=0&bar=baz
251
+ ```
252
+
232
253
  ## Optimistic concurrency control
233
254
 
234
255
  If an operation returns an object with `_version` property,
@@ -87,6 +87,7 @@ Feature: Basic authentication
87
87
  """
88
88
  200 OK
89
89
  """
90
+
90
91
  # username is taken
91
92
  When the following request is received:
92
93
  """
@@ -102,6 +103,7 @@ Feature: Basic authentication
102
103
  """
103
104
  409 Conflict
104
105
  """
106
+
105
107
  # credentials already exists
106
108
  When the following request is received:
107
109
  """
@@ -50,7 +50,6 @@ Feature: IO restrictions
50
50
  """
51
51
  GET /pots/4c4759e6f9c74da989d64511df42d6f4/ HTTP/1.1
52
52
  host: nex.toa.io
53
- accept: application/yaml
54
53
  """
55
54
  Then the following reply is sent:
56
55
  """
@@ -259,3 +259,27 @@ Feature: Queries
259
259
  volume: 100
260
260
  temperature: 80
261
261
  """
262
+
263
+ Scenario: Query parameters
264
+ Given the `echo` is running with the following manifest:
265
+ """yaml
266
+ exposition:
267
+ /:
268
+ GET:
269
+ io:output: true
270
+ query:
271
+ parameters: [name]
272
+ endpoint: compute
273
+ """
274
+ When the following request is received:
275
+ """
276
+ GET /echo/?name=John HTTP/1.1
277
+ host: nex.toa.io
278
+ accept: text/plain
279
+ """
280
+ Then the following reply is sent:
281
+ """
282
+ 200 OK
283
+
284
+ Hello John
285
+ """
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.exposition",
3
- "version": "1.0.0-alpha.54",
3
+ "version": "1.0.0-alpha.55",
4
4
  "description": "Toa Exposition",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -17,9 +17,9 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@toa.io/core": "1.0.0-alpha.54",
21
- "@toa.io/generic": "1.0.0-alpha.54",
22
- "@toa.io/schemas": "1.0.0-alpha.54",
20
+ "@toa.io/core": "1.0.0-alpha.55",
21
+ "@toa.io/generic": "1.0.0-alpha.55",
22
+ "@toa.io/schemas": "1.0.0-alpha.55",
23
23
  "bcryptjs": "2.4.3",
24
24
  "error-value": "0.3.0",
25
25
  "js-yaml": "4.1.0",
@@ -44,11 +44,11 @@
44
44
  "features:security": "cucumber-js --tags @security"
45
45
  },
46
46
  "devDependencies": {
47
- "@toa.io/agent": "1.0.0-alpha.54",
48
- "@toa.io/extensions.storages": "1.0.0-alpha.54",
47
+ "@toa.io/agent": "1.0.0-alpha.55",
48
+ "@toa.io/extensions.storages": "1.0.0-alpha.55",
49
49
  "@types/bcryptjs": "2.4.3",
50
50
  "@types/cors": "2.8.13",
51
51
  "@types/negotiator": "0.6.1"
52
52
  },
53
- "gitHead": "6be27bc53f3f8b31d0ce140140eeb40ef1de9a7f"
53
+ "gitHead": "39465f6af0009b07fd800c5b97244fadd6d3afe6"
54
54
  }
@@ -1,17 +1,11 @@
1
- _: true
2
1
  id?: string
3
2
  criteria?: string
4
3
  sort?: string
5
- omit:
4
+ omit?:
6
5
  $ref: range
7
- default:
8
- value: 0
9
- range: [0, 1000]
10
- limit:
6
+ limit?:
11
7
  $ref: range
12
- default:
13
- value: 10
14
- range: [1, 1000]
15
- required: [value]
16
8
  selectors?: [string]
17
9
  projection?: [string]
10
+ parameters?: [string]
11
+ _: true
@@ -117,9 +117,8 @@ export class Server extends Connector {
117
117
  response.statusCode = exception instanceof Exception ? exception.status : 500
118
118
 
119
119
  const message: OutgoingMessage = { status: response.statusCode }
120
- const verbose = exception instanceof ClientError || this.properties.debug
121
120
 
122
- if (verbose)
121
+ if (exception instanceof ClientError || this.properties.debug)
123
122
  message.body =
124
123
  exception instanceof Exception
125
124
  ? exception.body
package/source/Mapping.ts CHANGED
@@ -1,51 +1,74 @@
1
1
  import { type Parameter } from './RTD'
2
2
  import { Query } from './Query'
3
+ import type { QueryString } from './Query'
3
4
  import type * as http from './HTTP'
4
5
  import type * as syntax from './RTD/syntax'
5
6
  import type * as core from '@toa.io/core'
6
7
 
7
8
  export abstract class Mapping {
8
- public static create (query?: syntax.Query): Mapping {
9
- if (query === undefined || query === null)
10
- return new InputMapping()
9
+ protected readonly query: Query
11
10
 
11
+ public constructor (query: Query) {
12
+ this.query = query
13
+ }
14
+
15
+ public static create (query?: syntax.Query): Mapping {
12
16
  const q = new Query(query)
13
17
 
14
- return new QueryableMapping(q)
18
+ return queryable(query)
19
+ ? new QueryableMapping(q)
20
+ : new InputMapping(q)
21
+ }
22
+
23
+ protected assign (input: any, qs: QueryString): void {
24
+ if (qs.parameters !== null) {
25
+ if (typeof input !== 'object' || input === null)
26
+ throw new Error('Input must be an object to embed query parameters')
27
+
28
+ Object.assign(input, qs.parameters)
29
+ }
15
30
  }
16
31
 
17
- public abstract fit (input: any, qs: http.Query, parameters: Parameter[]): core.Request
32
+ public abstract fit (input: any, query: http.Query, parameters: Parameter[]): core.Request
18
33
  }
19
34
 
20
35
  class QueryableMapping extends Mapping {
21
- private readonly query: Query
36
+ public fit (input: any, query: http.Query, parameters: Parameter[]): core.Request {
37
+ const request: core.Request = {}
38
+ const qs = this.query.fit(query, parameters)
22
39
 
23
- public constructor (query: Query) {
24
- super()
40
+ if (input === undefined && qs.parameters !== null)
41
+ input = {}
25
42
 
26
- this.query = query
27
- }
43
+ this.assign(input, qs)
28
44
 
29
- public fit (input: any, qs: http.Query, parameters: Parameter[]): core.Request {
30
- const query = this.query.fit(qs, parameters)
45
+ if (input !== undefined)
46
+ request.input = input
31
47
 
32
- return {
33
- input,
34
- query
35
- }
48
+ if (qs.query !== null)
49
+ request.query = qs.query
50
+
51
+ return request
36
52
  }
37
53
  }
38
54
 
39
55
  class InputMapping extends Mapping {
40
- public fit (input: any, _: unknown, parameters: Parameter[]): core.Request {
56
+ public fit (input: any, query: http.Query, parameters: Parameter[]): core.Request {
41
57
  const request: core.Request = {}
58
+ const qs = this.query.fit(query, parameters)
42
59
 
43
- if (input === undefined && parameters.length > 0)
60
+ if (input === undefined && (parameters.length > 0 || qs.parameters !== null))
44
61
  input = {}
45
62
 
46
- if (typeof input === 'object' && input !== null)
63
+ if (parameters.length > 0) {
64
+ if (typeof input !== 'object' || input === null)
65
+ throw new Error('Input must be an object to embed route parameters')
66
+
47
67
  for (const parameter of parameters)
48
68
  input[parameter.name] = parameter.value
69
+ }
70
+
71
+ this.assign(input, qs)
49
72
 
50
73
  if (input !== undefined)
51
74
  request.input = input
@@ -53,3 +76,12 @@ class InputMapping extends Mapping {
53
76
  return request
54
77
  }
55
78
  }
79
+
80
+ export function queryable (query?: syntax.Query): boolean {
81
+ if (query === undefined || query === null)
82
+ return false
83
+
84
+ const keys = Object.keys(query)
85
+
86
+ return !(keys.length === 1 && keys[0] === 'parameters')
87
+ }
@@ -16,7 +16,7 @@ it('should combine request criteria', async () => {
16
16
  const instance = new Query(query)
17
17
  const result = instance.fit({ criteria: 'qux==4' }, parameters)
18
18
 
19
- expect(result.criteria).toStrictEqual('(bar==2;baz==3);(foo==1);(qux==4)')
19
+ expect(result.query!.criteria).toStrictEqual('(bar==2;baz==3);(foo==1);(qux==4)')
20
20
  })
21
21
 
22
22
  it('should set id parameter as query.id', async () => {
@@ -32,6 +32,6 @@ it('should set id parameter as query.id', async () => {
32
32
  const instance = new Query(query)
33
33
  const result = instance.fit({}, parameters)
34
34
 
35
- expect(result.criteria).toBeUndefined()
36
- expect(result.id).toStrictEqual(id)
35
+ expect(result.query!.criteria).toBeUndefined()
36
+ expect(result.query!.id).toStrictEqual(id)
37
37
  })
package/source/Query.ts CHANGED
@@ -1,6 +1,8 @@
1
+ import assert from 'node:assert'
1
2
  import * as http from './HTTP'
2
3
  import { type Parameter } from './RTD'
3
4
  import * as schemas from './schemas'
5
+ import { queryable } from './Mapping'
4
6
  import type * as syntax from './RTD/syntax'
5
7
  import type * as core from '@toa.io/core'
6
8
 
@@ -8,35 +10,77 @@ export class Query {
8
10
  private readonly query: syntax.Query
9
11
  private readonly closed: boolean = false
10
12
  private readonly prepend: ',' | ';' = ';'
13
+ private readonly queryable: boolean
11
14
 
12
- public constructor (query: syntax.Query) {
13
- if (query.criteria !== undefined) {
14
- if (query.criteria.endsWith(';'))
15
- query.criteria = query.criteria.slice(0, -1)
16
- else
17
- this.closed = true
15
+ public constructor (query: syntax.Query = {}) {
16
+ this.queryable = queryable(query)
17
+
18
+ if (this.queryable) {
19
+ query.omit ??= { value: 0, range: [0, 1000] }
20
+ query.limit ??= { value: 10, range: [1, 100] }
18
21
 
19
- if (query.criteria.startsWith(',') || query.criteria.startsWith(';')) {
20
- this.prepend = query.criteria[0] as ',' | ';'
22
+ if (query.criteria !== undefined) {
23
+ // eslint-disable-next-line max-depth
24
+ if (query.criteria.endsWith(';'))
25
+ query.criteria = query.criteria.slice(0, -1)
26
+ else
27
+ this.closed = true
21
28
 
22
- query.criteria = query.criteria.slice(1)
29
+ // eslint-disable-next-line max-depth
30
+ if (query.criteria.startsWith(',') || query.criteria.startsWith(';')) {
31
+ this.prepend = query.criteria[0] as ',' | ';'
32
+
33
+ query.criteria = query.criteria.slice(1)
34
+ }
23
35
  }
24
36
  }
25
37
 
26
38
  this.query = query
27
39
  }
28
40
 
29
- public fit (query: http.Query, parameters: Parameter[]): core.Query {
30
- const error = schemas.querystring.fit(query)
41
+ public fit (query: http.Query, parameters: Parameter[]): QueryString {
42
+ const qs = this.split(query)
43
+
44
+ if (qs.query !== null) {
45
+ const error = schemas.querystring.fit(qs.query)
46
+
47
+ if (error !== null)
48
+ throw new http.BadRequest('Query ' + error.message)
49
+
50
+ this.fitCriteria(qs.query, parameters)
51
+ this.fitRanges(qs.query)
52
+ this.fitSort(qs.query)
53
+ }
54
+
55
+ return {
56
+ query: qs.query as core.Query,
57
+ parameters: qs.parameters
58
+ }
59
+ }
60
+
61
+ private split (query: http.Query): {
62
+ query: http.Query | null
63
+ parameters: Record<string, string> | null
64
+ } {
65
+ let parameters: Record<string, string> | null = null
66
+
67
+ if (this.query?.parameters !== undefined)
68
+ for (const key in query)
69
+ // eslint-disable-next-line max-depth
70
+ if (this.query.parameters.includes(key)) {
71
+ parameters ??= {}
72
+ parameters[key] = query[key] as string
31
73
 
32
- if (error !== null)
33
- throw new http.BadRequest('Query ' + error.message)
74
+ delete query[key]
75
+ }
34
76
 
35
- this.fitCriteria(query, parameters)
36
- this.fitRanges(query)
37
- this.fitSort(query)
77
+ if (!this.queryable && Object.keys(query).length === 0)
78
+ query = null!
38
79
 
39
- return query as core.Query
80
+ return {
81
+ query,
82
+ parameters
83
+ }
40
84
  }
41
85
 
42
86
  private fitCriteria (query: http.Query, parameters: Parameter[]): void {
@@ -77,6 +121,9 @@ export class Query {
77
121
  private fitRanges (qs: http.Query): void {
78
122
  const query = qs as core.Query
79
123
 
124
+ assert.ok(this.query.limit !== undefined, 'Query limit must be defined')
125
+ assert.ok(this.query.omit !== undefined, 'Query limit range must be defined')
126
+
80
127
  if (qs.limit !== undefined)
81
128
  query.limit = fit(qs.limit, this.query.limit.range, 'limit')
82
129
  else
@@ -114,3 +161,8 @@ interface CriteriaGroup {
114
161
  criteria: string
115
162
  operator: ',' | ';'
116
163
  }
164
+
165
+ export interface QueryString {
166
+ query: core.Query | null
167
+ parameters: Record<string, string> | null
168
+ }
@@ -35,10 +35,10 @@ export class Node {
35
35
  public merge (node: Node): void {
36
36
  this.intermediate = node.intermediate
37
37
 
38
- if (!this.protected)
39
- this.replace(node)
40
- else
38
+ if (this.protected)
41
39
  this.append(node)
40
+ else
41
+ this.replace(node)
42
42
 
43
43
  this.sort()
44
44
  }
@@ -49,24 +49,20 @@ export class Node {
49
49
  this.routes = node.routes
50
50
  this.methods = node.methods
51
51
 
52
+ // race condition is really unlikely
52
53
  for (const method of methods)
53
54
  void method.close()
54
-
55
- // race condition is really unlikely
56
55
  }
57
56
 
58
57
  private append (node: Node): void {
59
58
  for (const route of node.routes)
60
- this.mergeRoute(route)
59
+ this.route(route)
61
60
 
62
61
  for (const [verb, method] of Object.entries(node.methods))
63
- if (verb in this.methods)
64
- console.warn(`Overriding of the protected method ${verb} is not permitted.`)
65
- else
66
- this.methods[verb] = method
62
+ this.methods[verb] = method
67
63
  }
68
64
 
69
- private mergeRoute (candidate: Route): void {
65
+ private route (candidate: Route): void {
70
66
  for (const route of this.routes)
71
67
  if (candidate.equals(route)) {
72
68
  route.merge(candidate)
@@ -35,10 +35,11 @@ export interface Query {
35
35
  id?: string
36
36
  criteria?: string
37
37
  sort?: string
38
- omit: Range
39
- limit: Range
38
+ omit?: Range
39
+ limit?: Range
40
40
  selectors?: string[]
41
41
  projection?: string[]
42
+ parameters?: string[]
42
43
  }
43
44
 
44
45
  export interface Range {
@@ -23,13 +23,13 @@ export class Input implements Directive {
23
23
  try {
24
24
  schemas.message.validate(body)
25
25
  } catch {
26
- throw new BadRequest('Invalid request body.')
26
+ throw new BadRequest('Invalid request body')
27
27
  }
28
28
 
29
29
  const property = this.violation(body)
30
30
 
31
31
  if (property !== undefined)
32
- throw new BadRequest(`Unexpected input: ${property}.`)
32
+ throw new BadRequest(`Unexpected input: ${property}`)
33
33
 
34
34
  return body
35
35
  }
@@ -22,7 +22,7 @@ function wrap (declaration: object, namespace: string, name: string): object {
22
22
  const path = (namespace === undefined || namespace === 'default' ? '' : '/' + namespace) +
23
23
  '/' + name
24
24
 
25
- return { [path]: { protected: true, ...declaration } }
25
+ return { [path]: declaration }
26
26
  }
27
27
 
28
28
  function specify (node: Node, manifest: Manifest): void {
@@ -115,8 +115,7 @@ class Server extends core_1.Connector {
115
115
  await adam(context.request);
116
116
  response.statusCode = exception instanceof exceptions_1.Exception ? exception.status : 500;
117
117
  const message = { status: response.statusCode };
118
- const verbose = exception instanceof exceptions_1.ClientError || this.properties.debug;
119
- if (verbose)
118
+ if (exception instanceof exceptions_1.ClientError || this.properties.debug)
120
119
  message.body =
121
120
  exception instanceof exceptions_1.Exception
122
121
  ? exception.body
@@ -1 +1 @@
1
- {"version":3,"file":"Server.js","sourceRoot":"","sources":["../../source/HTTP/Server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwB;AACxB,sDAAwB;AACxB,gDAAiC;AACjC,6CAAkC;AAClC,mDAAiD;AACjD,uCAAwC;AACxC,yCAAwD;AACxD,6CAAqD;AACrD,uCAAmC;AAGnC,MAAa,MAAO,SAAQ,gBAAS;IAClB,MAAM,GAAgB,IAAI,CAAC,YAAY,EAAE,CAAA;IACzC,UAAU,CAAY;IACtB,WAAW,CAAwB;IAC5C,OAAO,CAAa;IACpB,KAAK,GAAY,KAAK,CAAA;IACtB,SAAS,GAAW,CAAC,CAAA;IAE7B,YAAqB,UAAsB;QACzC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WA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CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA;YAE7E,MAAM,OAAO,GAAoB,EAAE,MAAM,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAA;YAEhE,IAAI,SAAS,YAAY,wBAAW,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK;gBAC3D,OAAO,CAAC,IAAI;oBACV,SAAS,YAAY,sBAAS;wBAC5B,CAAC,CAAC,SAAS,CAAC,IAAI;wBAChB,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,OAAO,CAAA;YAE5C,IAAA,gBAAK,EAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QACnC,CAAC,CAAA;IACH,CAAC;CACF;AAtHD,wBAsHC;AAED,8CAA8C;AAC9C,KAAK,UAAU,IAAI,CAAE,OAA6B;IAChD,MAAM,OAAO,GAAG,iBAAE,CAAC,iBAAiB,CAAC,iBAAE,CAAC,OAAO,CAAC,CAAA;IAEhD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAErB,MAAM,IAAA,kBAAI,EAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AAC5B,CAAC;AAEY,QAAA,IAAI,GAAG,IAAI,CAAA;AACX,QAAA,KAAK,GAAG,CAAC,CAAA,CAAC,UAAU;AAEjC,MAAM,QAAQ,GAAoC;IAChD,OAAO,EAAE,IAAI,GAAG,CAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC9E,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,YAAI;IACV,KAAK,EAAE,aAAK,GAAG,IAAI;CACpB,CAAA"}
@@ -1,8 +1,14 @@
1
1
  import { type Parameter } from './RTD';
2
+ import { Query } from './Query';
3
+ import type { QueryString } from './Query';
2
4
  import type * as http from './HTTP';
3
5
  import type * as syntax from './RTD/syntax';
4
6
  import type * as core from '@toa.io/core';
5
7
  export declare abstract class Mapping {
8
+ protected readonly query: Query;
9
+ constructor(query: Query);
6
10
  static create(query?: syntax.Query): Mapping;
7
- abstract fit(input: any, qs: http.Query, parameters: Parameter[]): core.Request;
11
+ protected assign(input: any, qs: QueryString): void;
12
+ abstract fit(input: any, query: http.Query, parameters: Parameter[]): core.Request;
8
13
  }
14
+ export declare function queryable(query?: syntax.Query): boolean;
@@ -1,41 +1,64 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mapping = void 0;
3
+ exports.queryable = exports.Mapping = void 0;
4
4
  const Query_1 = require("./Query");
5
5
  class Mapping {
6
+ query;
7
+ constructor(query) {
8
+ this.query = query;
9
+ }
6
10
  static create(query) {
7
- if (query === undefined || query === null)
8
- return new InputMapping();
9
11
  const q = new Query_1.Query(query);
10
- return new QueryableMapping(q);
12
+ return queryable(query)
13
+ ? new QueryableMapping(q)
14
+ : new InputMapping(q);
15
+ }
16
+ assign(input, qs) {
17
+ if (qs.parameters !== null) {
18
+ if (typeof input !== 'object' || input === null)
19
+ throw new Error('Input must be an object to embed query parameters');
20
+ Object.assign(input, qs.parameters);
21
+ }
11
22
  }
12
23
  }
13
24
  exports.Mapping = Mapping;
14
25
  class QueryableMapping extends Mapping {
15
- query;
16
- constructor(query) {
17
- super();
18
- this.query = query;
19
- }
20
- fit(input, qs, parameters) {
21
- const query = this.query.fit(qs, parameters);
22
- return {
23
- input,
24
- query
25
- };
26
+ fit(input, query, parameters) {
27
+ const request = {};
28
+ const qs = this.query.fit(query, parameters);
29
+ if (input === undefined && qs.parameters !== null)
30
+ input = {};
31
+ this.assign(input, qs);
32
+ if (input !== undefined)
33
+ request.input = input;
34
+ if (qs.query !== null)
35
+ request.query = qs.query;
36
+ return request;
26
37
  }
27
38
  }
28
39
  class InputMapping extends Mapping {
29
- fit(input, _, parameters) {
40
+ fit(input, query, parameters) {
30
41
  const request = {};
31
- if (input === undefined && parameters.length > 0)
42
+ const qs = this.query.fit(query, parameters);
43
+ if (input === undefined && (parameters.length > 0 || qs.parameters !== null))
32
44
  input = {};
33
- if (typeof input === 'object' && input !== null)
45
+ if (parameters.length > 0) {
46
+ if (typeof input !== 'object' || input === null)
47
+ throw new Error('Input must be an object to embed route parameters');
34
48
  for (const parameter of parameters)
35
49
  input[parameter.name] = parameter.value;
50
+ }
51
+ this.assign(input, qs);
36
52
  if (input !== undefined)
37
53
  request.input = input;
38
54
  return request;
39
55
  }
40
56
  }
57
+ function queryable(query) {
58
+ if (query === undefined || query === null)
59
+ return false;
60
+ const keys = Object.keys(query);
61
+ return !(keys.length === 1 && keys[0] === 'parameters');
62
+ }
63
+ exports.queryable = queryable;
41
64
  //# sourceMappingURL=Mapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../source/Mapping.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAK/B,MAAsB,OAAO;IACpB,MAAM,CAAC,MAAM,CAAE,KAAoB;QACxC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YACvC,OAAO,IAAI,YAAY,EAAE,CAAA;QAE3B,MAAM,CAAC,GAAG,IAAI,aAAK,CAAC,KAAK,CAAC,CAAA;QAE1B,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAA;IAChC,CAAC;CAGF;AAXD,0BAWC;AAED,MAAM,gBAAiB,SAAQ,OAAO;IACnB,KAAK,CAAO;IAE7B,YAAoB,KAAY;QAC9B,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,GAAG,CAAE,KAAU,EAAE,EAAc,EAAE,UAAuB;QAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAA;QAE5C,OAAO;YACL,KAAK;YACL,KAAK;SACN,CAAA;IACH,CAAC;CACF;AAED,MAAM,YAAa,S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CAAC,KAAK,CAAA;QAC3C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAEtB,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAEvB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAED,SAAgB,SAAS,CAAE,KAAoB;IAC7C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QACvC,OAAO,KAAK,CAAA;IAEd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE/B,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAA;AACzD,CAAC;AAPD,8BAOC"}
@@ -6,9 +6,15 @@ export declare class Query {
6
6
  private readonly query;
7
7
  private readonly closed;
8
8
  private readonly prepend;
9
- constructor(query: syntax.Query);
10
- fit(query: http.Query, parameters: Parameter[]): core.Query;
9
+ private readonly queryable;
10
+ constructor(query?: syntax.Query);
11
+ fit(query: http.Query, parameters: Parameter[]): QueryString;
12
+ private split;
11
13
  private fitCriteria;
12
14
  private fitRanges;
13
15
  private fitSort;
14
16
  }
17
+ export interface QueryString {
18
+ query: core.Query | null;
19
+ parameters: Record<string, string> | null;
20
+ }