-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
379 lines (379 loc) · 11.8 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
/**
* Chainable expressive URL Builder for mongoose-bread
* @class
*/
export default class BreadUrlBuilder {
/**
* Used as $order argument for {@link sort} method
* @memberof BreadUrlBuilder
* @type {symbol}
* @static
*/
static ASC: symbol;
/**
* Used as $order argument for {@link sort} method
* @memberof BreadUrlBuilder
* @type {symbol}
* @static
*/
static DESC: symbol;
/**
* Set protocol to https://
* Used as argument for {@link protocol} method
* @memberof BreadUrlBuilder
* @type {symbol}
* @static
*/
static HTTPS: symbol;
/**
* Enforce protocol to http://
* Used as argument for {@link protocol} method
* @memberof BreadUrlBuilder
* @type {symbol}
* @static
*/
static FORCE_HTTP: symbol;
/**
* Creates an instance of BreadUrlBuilder.
* @constructor
* @param {string} $baseUrl - sets the shortest URL to be generated
*/
constructor($baseUrl: string);
/**
* BreadUrlBuilder defaults the URL protocol to https:// unless enforced by BreadUrlBuilder.FORCE_HTTP
* @param {symbol} $protocol - Must be a value of BreadUrlBuilder.{@link FORCE_HTTP} or BreadUrlBuilder.{@link HTTPS}
* @returns {BreadUrlBuilder}
*/
protocol($protocol: symbol): BreadUrlBuilder;
/**
* Set the port number of the URL
* @param {number} $port - Port to be set
* @returns {BreadUrlBuilder}
*/
port($port: number): BreadUrlBuilder;
/**
* Adds endpoint as fallback value for resets
* @param {string} $endpoint - will be appended to baseUrl
* @returns {BreadUrlBuilder}
*/
endpoint($endpoint: string): BreadUrlBuilder;
/**
* Set the URL fragment
* @param {string} $hash - new fragment value
* @returns {BreadUrlBuilder}
*/
hash($hash: string): BreadUrlBuilder;
/**
* Reset the URL to baseUrl or baseUrl + endpoint and append $path
* @param {string} $path - new first path segment
* @returns {BreadUrlBuilder}
*/
setPath($path: string): BreadUrlBuilder;
/**
* Append provided $path as URL segment
* @param {string|number} $path - path segment to append
* @returns {BreadUrlBuilder}
*/
addPath($path: string | number): BreadUrlBuilder;
/**
* Append provided $path as URL segment
* @param {string|number} $path - path segment to append
* @returns {BreadUrlBuilder}
*/
addToPath($path: string | number): BreadUrlBuilder;
/**
* Add URL query parameter as key value pair
* @param {string} $parameter - GET query key
* @param {string|number} $value - GET query value
* @returns {BreadUrlBuilder}
*/
addParameter($parameter: string, $value: string | number): BreadUrlBuilder;
/**
* Shorthand for addParameter("lean", $lean)
* @param {boolean} $lean
* @returns {BreadUrlBuilder}
*/
lean($lean?: boolean): BreadUrlBuilder;
/**
* Shorthand for addParameter("leanWithId", $leanWithid)
* @param {boolean} $leanWithId
* @returns {BreadUrlBuilder}
*/
leanWithId($leanWithId?: boolean): BreadUrlBuilder;
/**
* Shorthand for addParameter("leanWithout_id", $leanWithout_id)
* @param {boolean} $leanWithout_id
* @returns {BreadUrlBuilder}
*/
leanWithout_id($leanWithout_id?: boolean): BreadUrlBuilder;
/**
* Shorthand for addParameter("search", $search)
* @param {string} $search - search term to query the resultset
* @returns {BreadUrlBuilder}
*/
search($search: string): BreadUrlBuilder;
/**
* Shorthand for addParameter("limit", $limit)
* @param {number|string} $limit - max size of resultset
* @returns {BreadUrlBuilder}
*/
limit($limit: number | string): BreadUrlBuilder;
/**
* Shorthand for addParameter("page", $page)
* @param {number|string} $page - select page in paginated resultset
* @returns {BreadUrlBuilder}
*/
page($page: number | string): BreadUrlBuilder;
/**
* Shorthand for addParameter("sort", $sort)
* @param {string} $sort - add field to sort resultset by
* @param {symbol} $order - Must be a value of BreadUrlBuilder.{@link ASC} or BreadUrlBuilder.{@link DESC}
* @returns {BreadUrlBuilder}
*/
addSort($sort: string, $order: symbol): BreadUrlBuilder;
/**
* Shorthand for addParameter("sort", $sort)
* @param {string} $sort - add field to sort resultset by
* @param {symbol} $order - Must be a value of BreadUrlBuilder.{@link ASC} or BreadUrlBuilder.{@link DESC}
* @returns {BreadUrlBuilder}
*/
addToSort($sort: string, $order: symbol): BreadUrlBuilder;
/**
* Resets sort query parameter and replaces it with field name to sort by
* @param {string} $sort - set field to sort resultset by
* @param {symbol} $order - Must be a value of BreadUrlBuilder.{@link ASC} or BreadUrlBuilder.{@link DESC}
* @returns {BreadUrlBuilder}
*/
sort($sort: string, $order: symbol): BreadUrlBuilder;
/**
* Limit the fields of the resultset to provided $fields
* @param {Array<string>|string} $fields - space separated string will be parsed to Array<string>
* @returns {BreadUrlBuilder}
*/
select($fields?: Array<string> | string): BreadUrlBuilder;
/**
* Remove the provided $fields from the resultset
* @param {Array<string>|string} $fields - space separated string will be parsed to Array<string>
* @returns {BreadUrlBuilder}
*/
exclude($fields?: Array<string> | string): BreadUrlBuilder;
/**
* Shorthand for addParameter("projection", JSON.stringify($projection))
* @param {Object} $projection - mongoose projection object
* @returns {BreadUrlBuilder}
*/
projection($projection: any): BreadUrlBuilder;
/**
* Shorthand for addParameter("query", JSON.stringify($query))
* @param {Object} $query - mongoose query object
* @returns {BreadUrlBuilder}
*/
query($query: any): BreadUrlBuilder;
/**
* Shorthand for addParameter("populate", JSON.stringify($populate))
* @param {Object} $populate - mongoose populate object
* @returns {BreadUrlBuilder}
*/
populate($populate: any): BreadUrlBuilder;
/**
* Adds key for compare query parameter
* @example url.with('price').greaterThan(500)
* @param {string} $key
* @returns {BreadUrlBuilder}
*/
with($key: string): BreadUrlBuilder;
/**
* Removes key from comparison query parameters
* @example url.without('price')
* @param {string} $key
* @returns {BreadUrlBuilder}
*/
without($key: string): BreadUrlBuilder;
/**
* Adds comparison value for preceding with()
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
greaterThan($value: string | number): BreadUrlBuilder;
/**
* Adds comparison value for preceding with()
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
lessThan($value: string | number): BreadUrlBuilder;
/**
* Adds comparison value for preceding with()
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
greaterThanEqual($value: string | number): BreadUrlBuilder;
/**
* Adds comparison value for preceding with()
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
lessThanEqual($value: string | number): BreadUrlBuilder;
/**
* Adds comparison value for preceding with()
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
equalTo($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
gt($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
lt($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
eq($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
ne($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
gte($value: string | number): BreadUrlBuilder;
/**
* @param {string|number} $value
* @returns {BreadUrlBuilder}
*/
lte($value: string | number): BreadUrlBuilder;
/**
* Getter for expressive chaining
* @example url.with('visitors').to.be.equalTo('attending')
* @returns {BreadUrlBuilder}
*/
get to(): BreadUrlBuilder;
/**
* Getter for expressive chaining
* @example url.with('visitors').to.be.equalTo('attending')
* @returns {BreadUrlBuilder}
*/
get be(): BreadUrlBuilder;
/**
* Getter for expressive chaining
* @example url.with('price').greaterThanEqual(500).and.lessThan(100)
* @returns {BreadUrlBuilder}
*/
get and(): BreadUrlBuilder;
/**
* Getter for expressive chaining
* @example url.with('price').greaterThanEqual(500).but.lessThan(100)
* @returns {BreadUrlBuilder}
*/
get but(): BreadUrlBuilder;
/**
* Invert the next comparison
* @example url.with('visitors').not.equalTo('attending')
* @returns {BreadUrlBuilder}
*/
get not(): BreadUrlBuilder;
/**
* Clears endpoint paths parameters and fragment
* @returns {BreadUrlBuilder}
*/
resetToBaseUrl(): BreadUrlBuilder;
/**
* Clears paths parameters and fragment
* @returns {BreadUrlBuilder}
*/
resetToEndpoint(): BreadUrlBuilder;
/**
* Clears paths and search parameter
* @returns {BreadUrlBuilder}
*/
clearPath(): BreadUrlBuilder;
/**
* Clears parameters
* @returns {BreadUrlBuilder}
*/
clearParameter(): BreadUrlBuilder;
/**
* Clears fragment
* @returns {BreadUrlBuilder}
*/
clearHash(): BreadUrlBuilder;
/**
* Access to currently set parameter stored for $key
* @param {string} $key - key to read
* @returns {string|number|undefined}
*/
getParameter($key: string): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getLean(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getLeanWithId(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getLeanWithout_id(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getSearch(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getLimit(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getPage(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getSort(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getSelect(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getProjection(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getQuery(): string | number | undefined;
/**
* @returns {string|number|undefined}
*/
getPopulate(): string | number | undefined;
/**
* Gets the configured URL as URL Object
* @returns {URL}
*/
getURL(): URL;
/**
* Gets the configured URL as URL Object
* @returns {URL}
*/
get(): URL;
/**
* Gets the configured URL as string
* @returns {string}
*/
toUrlString(): string;
/**
* Gets the configured URL as string - will be called if used by template strings or json conversion
* @example `${url}` == url.toString()
* @returns {string}
*/
toString(): string;
#private;
}