@neaps/api 0.1.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.
@@ -0,0 +1,1560 @@
1
+ /// <reference types="node" />
2
+ import { SendOptions } from "send";
3
+ import { EventEmitter } from "events";
4
+ import * as http from "http";
5
+ import { ParsedQs } from "qs";
6
+ import { Options, Ranges, Result } from "range-parser";
7
+
8
+ //#region ../../node_modules/@types/express-serve-static-core/index.d.ts
9
+ declare global {
10
+ namespace Express {
11
+ // These open interfaces may be extended in an application-specific manner via declaration merging.
12
+ // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts)
13
+ interface Request {}
14
+ interface Response {}
15
+ interface Locals {}
16
+ interface Application {}
17
+ }
18
+ }
19
+ interface NextFunction {
20
+ (err?: any): void;
21
+ /**
22
+ * "Break-out" of a router by calling {next('router')};
23
+ * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
24
+ */
25
+ (deferToNext: "router"): void;
26
+ /**
27
+ * "Break-out" of a route by calling {next('route')};
28
+ * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}
29
+ */
30
+ (deferToNext: "route"): void;
31
+ }
32
+ interface ParamsDictionary {
33
+ [key: string | number]: string;
34
+ }
35
+ interface Locals extends Express.Locals {}
36
+ interface RequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> {
37
+ // tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2)
38
+ (req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>, res: Response<ResBody, LocalsObj>, next: NextFunction): void;
39
+ }
40
+ type ErrorRequestHandler<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> = (err: any, req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>, res: Response<ResBody, LocalsObj>, next: NextFunction) => void;
41
+ type PathParams = string | RegExp | Array<string | RegExp>;
42
+ type RequestHandlerParams<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> = RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj> | ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj> | Array<RequestHandler<P> | ErrorRequestHandler<P>>;
43
+ type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
44
+ type GetRouteParameter<S extends string> = RemoveTail<RemoveTail<RemoveTail<S, `/${string}`>, `-${string}`>, `.${string}`>; // prettier-ignore
45
+ type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary : Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters
46
+ : Route extends `${string}:${infer Rest}` ? (GetRouteParameter<Rest> extends never ? ParamsDictionary : GetRouteParameter<Rest> extends `${infer ParamName}?` ? { [P in ParamName]?: string } : { [P in GetRouteParameter<Rest>]: string }) & (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown) : {};
47
+ /* eslint-disable @definitelytyped/no-unnecessary-generics */
48
+ interface IRouterMatcher<T, Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any> {
49
+ <Route extends string, P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (it's used as the default type parameter for P)
50
+ path: Route, // (This generic is meant to be passed explicitly.)
51
+ ...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
52
+ <Path extends string, P = RouteParameters<Path>, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (it's used as the default type parameter for P)
53
+ path: Path, // (This generic is meant to be passed explicitly.)
54
+ ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
55
+ <P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(path: PathParams, // (This generic is meant to be passed explicitly.)
56
+ ...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
57
+ <P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(path: PathParams, // (This generic is meant to be passed explicitly.)
58
+ ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
59
+ (path: PathParams, subApplication: Application): T;
60
+ }
61
+ interface IRouterHandler<T, Route extends string = string> {
62
+ (...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
63
+ (...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
64
+ <P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (This generic is meant to be passed explicitly.)
65
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
66
+ ...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
67
+ <P = RouteParameters<Route>, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (This generic is meant to be passed explicitly.)
68
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
69
+ ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
70
+ <P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (This generic is meant to be passed explicitly.)
71
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
72
+ ...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
73
+ <P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>>(// (This generic is meant to be passed explicitly.)
74
+ // eslint-disable-next-line @definitelytyped/no-unnecessary-generics
75
+ ...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>): T;
76
+ }
77
+ /* eslint-enable @definitelytyped/no-unnecessary-generics */
78
+ interface IRouter extends RequestHandler {
79
+ /**
80
+ * Map the given param placeholder `name`(s) to the given callback(s).
81
+ *
82
+ * Parameter mapping is used to provide pre-conditions to routes
83
+ * which use normalized placeholders. For example a _:user_id_ parameter
84
+ * could automatically load a user's information from the database without
85
+ * any additional code,
86
+ *
87
+ * The callback uses the samesignature as middleware, the only differencing
88
+ * being that the value of the placeholder is passed, in this case the _id_
89
+ * of the user. Once the `next()` function is invoked, just like middleware
90
+ * it will continue on to execute the route, or subsequent parameter functions.
91
+ *
92
+ * app.param('user_id', function(req, res, next, id){
93
+ * User.find(id, function(err, user){
94
+ * if (err) {
95
+ * next(err);
96
+ * } else if (user) {
97
+ * req.user = user;
98
+ * next();
99
+ * } else {
100
+ * next(new Error('failed to load user'));
101
+ * }
102
+ * });
103
+ * });
104
+ */
105
+ param(name: string, handler: RequestParamHandler): this;
106
+ /**
107
+ * Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
108
+ *
109
+ * @deprecated since version 4.11
110
+ */
111
+ param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
112
+ /**
113
+ * Special-cased "all" method, applying the given route `path`,
114
+ * middleware, and callback to _every_ HTTP method.
115
+ */
116
+ all: IRouterMatcher<this, "all">;
117
+ get: IRouterMatcher<this, "get">;
118
+ post: IRouterMatcher<this, "post">;
119
+ put: IRouterMatcher<this, "put">;
120
+ delete: IRouterMatcher<this, "delete">;
121
+ patch: IRouterMatcher<this, "patch">;
122
+ options: IRouterMatcher<this, "options">;
123
+ head: IRouterMatcher<this, "head">;
124
+ checkout: IRouterMatcher<this>;
125
+ connect: IRouterMatcher<this>;
126
+ copy: IRouterMatcher<this>;
127
+ lock: IRouterMatcher<this>;
128
+ merge: IRouterMatcher<this>;
129
+ mkactivity: IRouterMatcher<this>;
130
+ mkcol: IRouterMatcher<this>;
131
+ move: IRouterMatcher<this>;
132
+ "m-search": IRouterMatcher<this>;
133
+ notify: IRouterMatcher<this>;
134
+ propfind: IRouterMatcher<this>;
135
+ proppatch: IRouterMatcher<this>;
136
+ purge: IRouterMatcher<this>;
137
+ report: IRouterMatcher<this>;
138
+ search: IRouterMatcher<this>;
139
+ subscribe: IRouterMatcher<this>;
140
+ trace: IRouterMatcher<this>;
141
+ unlock: IRouterMatcher<this>;
142
+ unsubscribe: IRouterMatcher<this>;
143
+ link: IRouterMatcher<this>;
144
+ unlink: IRouterMatcher<this>;
145
+ use: IRouterHandler<this> & IRouterMatcher<this>;
146
+ route<T extends string>(prefix: T): IRoute<T>;
147
+ route(prefix: PathParams): IRoute;
148
+ /**
149
+ * Stack of configured routes
150
+ */
151
+ stack: ILayer[];
152
+ }
153
+ interface ILayer {
154
+ route?: IRoute;
155
+ name: string | "<anonymous>";
156
+ params?: Record<string, any>;
157
+ keys: string[];
158
+ path?: string;
159
+ method: string;
160
+ regexp: RegExp;
161
+ handle: (req: Request, res: Response, next: NextFunction) => any;
162
+ }
163
+ interface IRoute<Route extends string = string> {
164
+ path: string;
165
+ stack: ILayer[];
166
+ all: IRouterHandler<this, Route>;
167
+ get: IRouterHandler<this, Route>;
168
+ post: IRouterHandler<this, Route>;
169
+ put: IRouterHandler<this, Route>;
170
+ delete: IRouterHandler<this, Route>;
171
+ patch: IRouterHandler<this, Route>;
172
+ options: IRouterHandler<this, Route>;
173
+ head: IRouterHandler<this, Route>;
174
+ checkout: IRouterHandler<this, Route>;
175
+ copy: IRouterHandler<this, Route>;
176
+ lock: IRouterHandler<this, Route>;
177
+ merge: IRouterHandler<this, Route>;
178
+ mkactivity: IRouterHandler<this, Route>;
179
+ mkcol: IRouterHandler<this, Route>;
180
+ move: IRouterHandler<this, Route>;
181
+ "m-search": IRouterHandler<this, Route>;
182
+ notify: IRouterHandler<this, Route>;
183
+ purge: IRouterHandler<this, Route>;
184
+ report: IRouterHandler<this, Route>;
185
+ search: IRouterHandler<this, Route>;
186
+ subscribe: IRouterHandler<this, Route>;
187
+ trace: IRouterHandler<this, Route>;
188
+ unlock: IRouterHandler<this, Route>;
189
+ unsubscribe: IRouterHandler<this, Route>;
190
+ }
191
+ interface Router extends IRouter {}
192
+ /**
193
+ * Options passed down into `res.cookie`
194
+ * @link https://expressjs.com/en/api.html#res.cookie
195
+ */
196
+ interface CookieOptions {
197
+ /** Convenient option for setting the expiry time relative to the current time in **milliseconds**. */
198
+ maxAge?: number | undefined;
199
+ /** Indicates if the cookie should be signed. */
200
+ signed?: boolean | undefined;
201
+ /** Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. */
202
+ expires?: Date | undefined;
203
+ /** Flags the cookie to be accessible only by the web server. */
204
+ httpOnly?: boolean | undefined;
205
+ /** Path for the cookie. Defaults to “/”. */
206
+ path?: string | undefined;
207
+ /** Domain name for the cookie. Defaults to the domain name of the app. */
208
+ domain?: string | undefined;
209
+ /** Marks the cookie to be used with HTTPS only. */
210
+ secure?: boolean | undefined;
211
+ /** A synchronous function used for cookie value encoding. Defaults to encodeURIComponent. */
212
+ encode?: ((val: string) => string) | undefined;
213
+ /**
214
+ * Value of the “SameSite” Set-Cookie attribute.
215
+ * @link https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1.
216
+ */
217
+ sameSite?: boolean | "lax" | "strict" | "none" | undefined;
218
+ /**
219
+ * Value of the “Priority” Set-Cookie attribute.
220
+ * @link https://datatracker.ietf.org/doc/html/draft-west-cookie-priority-00#section-4.3
221
+ */
222
+ priority?: "low" | "medium" | "high";
223
+ /** Marks the cookie to use partioned storage. */
224
+ partitioned?: boolean | undefined;
225
+ }
226
+ type Errback = (err: Error) => void;
227
+ interface Request<P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any>> extends http.IncomingMessage, Express.Request {
228
+ /**
229
+ * Return request header.
230
+ *
231
+ * The `Referrer` header field is special-cased,
232
+ * both `Referrer` and `Referer` are interchangeable.
233
+ *
234
+ * Examples:
235
+ *
236
+ * req.get('Content-Type');
237
+ * // => "text/plain"
238
+ *
239
+ * req.get('content-type');
240
+ * // => "text/plain"
241
+ *
242
+ * req.get('Something');
243
+ * // => undefined
244
+ *
245
+ * Aliased as `req.header()`.
246
+ */
247
+ get(name: "set-cookie"): string[] | undefined;
248
+ get(name: string): string | undefined;
249
+ header(name: "set-cookie"): string[] | undefined;
250
+ header(name: string): string | undefined;
251
+ /**
252
+ * Check if the given `type(s)` is acceptable, returning
253
+ * the best match when true, otherwise `undefined`, in which
254
+ * case you should respond with 406 "Not Acceptable".
255
+ *
256
+ * The `type` value may be a single mime type string
257
+ * such as "application/json", the extension name
258
+ * such as "json", a comma-delimted list such as "json, html, text/plain",
259
+ * or an array `["json", "html", "text/plain"]`. When a list
260
+ * or array is given the _best_ match, if any is returned.
261
+ *
262
+ * Examples:
263
+ *
264
+ * // Accept: text/html
265
+ * req.accepts('html');
266
+ * // => "html"
267
+ *
268
+ * // Accept: text/*, application/json
269
+ * req.accepts('html');
270
+ * // => "html"
271
+ * req.accepts('text/html');
272
+ * // => "text/html"
273
+ * req.accepts('json, text');
274
+ * // => "json"
275
+ * req.accepts('application/json');
276
+ * // => "application/json"
277
+ *
278
+ * // Accept: text/*, application/json
279
+ * req.accepts('image/png');
280
+ * req.accepts('png');
281
+ * // => false
282
+ *
283
+ * // Accept: text/*;q=.5, application/json
284
+ * req.accepts(['html', 'json']);
285
+ * req.accepts('html, json');
286
+ * // => "json"
287
+ */
288
+ accepts(): string[];
289
+ accepts(type: string): string | false;
290
+ accepts(type: string[]): string | false;
291
+ accepts(...type: string[]): string | false;
292
+ /**
293
+ * Returns the first accepted charset of the specified character sets,
294
+ * based on the request's Accept-Charset HTTP header field.
295
+ * If none of the specified charsets is accepted, returns false.
296
+ *
297
+ * For more information, or if you have issues or concerns, see accepts.
298
+ */
299
+ acceptsCharsets(): string[];
300
+ acceptsCharsets(charset: string): string | false;
301
+ acceptsCharsets(charset: string[]): string | false;
302
+ acceptsCharsets(...charset: string[]): string | false;
303
+ /**
304
+ * Returns the first accepted encoding of the specified encodings,
305
+ * based on the request's Accept-Encoding HTTP header field.
306
+ * If none of the specified encodings is accepted, returns false.
307
+ *
308
+ * For more information, or if you have issues or concerns, see accepts.
309
+ */
310
+ acceptsEncodings(): string[];
311
+ acceptsEncodings(encoding: string): string | false;
312
+ acceptsEncodings(encoding: string[]): string | false;
313
+ acceptsEncodings(...encoding: string[]): string | false;
314
+ /**
315
+ * Returns the first accepted language of the specified languages,
316
+ * based on the request's Accept-Language HTTP header field.
317
+ * If none of the specified languages is accepted, returns false.
318
+ *
319
+ * For more information, or if you have issues or concerns, see accepts.
320
+ */
321
+ acceptsLanguages(): string[];
322
+ acceptsLanguages(lang: string): string | false;
323
+ acceptsLanguages(lang: string[]): string | false;
324
+ acceptsLanguages(...lang: string[]): string | false;
325
+ /**
326
+ * Parse Range header field, capping to the given `size`.
327
+ *
328
+ * Unspecified ranges such as "0-" require knowledge of your resource length. In
329
+ * the case of a byte range this is of course the total number of bytes.
330
+ * If the Range header field is not given `undefined` is returned.
331
+ * If the Range header field is given, return value is a result of range-parser.
332
+ * See more ./types/range-parser/index.d.ts
333
+ *
334
+ * NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
335
+ * should respond with 4 users when available, not 3.
336
+ */
337
+ range(size: number, options?: Options): Ranges | Result | undefined;
338
+ /**
339
+ * Return an array of Accepted media types
340
+ * ordered from highest quality to lowest.
341
+ */
342
+ accepted: MediaType[];
343
+ /**
344
+ * @deprecated since 4.11 Use either req.params, req.body or req.query, as applicable.
345
+ *
346
+ * Return the value of param `name` when present or `defaultValue`.
347
+ *
348
+ * - Checks route placeholders, ex: _/user/:id_
349
+ * - Checks body params, ex: id=12, {"id":12}
350
+ * - Checks query string params, ex: ?id=12
351
+ *
352
+ * To utilize request bodies, `req.body`
353
+ * should be an object. This can be done by using
354
+ * the `connect.bodyParser()` middleware.
355
+ */
356
+ param(name: string, defaultValue?: any): string;
357
+ /**
358
+ * Check if the incoming request contains the "Content-Type"
359
+ * header field, and it contains the give mime `type`.
360
+ *
361
+ * Examples:
362
+ *
363
+ * // With Content-Type: text/html; charset=utf-8
364
+ * req.is('html');
365
+ * req.is('text/html');
366
+ * req.is('text/*');
367
+ * // => true
368
+ *
369
+ * // When Content-Type is application/json
370
+ * req.is('json');
371
+ * req.is('application/json');
372
+ * req.is('application/*');
373
+ * // => true
374
+ *
375
+ * req.is('html');
376
+ * // => false
377
+ */
378
+ is(type: string | string[]): string | false | null;
379
+ /**
380
+ * Return the protocol string "http" or "https"
381
+ * when requested with TLS. When the "trust proxy"
382
+ * setting is enabled the "X-Forwarded-Proto" header
383
+ * field will be trusted. If you're running behind
384
+ * a reverse proxy that supplies https for you this
385
+ * may be enabled.
386
+ */
387
+ readonly protocol: string;
388
+ /**
389
+ * Short-hand for:
390
+ *
391
+ * req.protocol == 'https'
392
+ */
393
+ readonly secure: boolean;
394
+ /**
395
+ * Return the remote address, or when
396
+ * "trust proxy" is `true` return
397
+ * the upstream addr.
398
+ *
399
+ * Value may be undefined if the `req.socket` is destroyed
400
+ * (for example, if the client disconnected).
401
+ */
402
+ readonly ip: string | undefined;
403
+ /**
404
+ * When "trust proxy" is `true`, parse
405
+ * the "X-Forwarded-For" ip address list.
406
+ *
407
+ * For example if the value were "client, proxy1, proxy2"
408
+ * you would receive the array `["client", "proxy1", "proxy2"]`
409
+ * where "proxy2" is the furthest down-stream.
410
+ */
411
+ readonly ips: string[];
412
+ /**
413
+ * Return subdomains as an array.
414
+ *
415
+ * Subdomains are the dot-separated parts of the host before the main domain of
416
+ * the app. By default, the domain of the app is assumed to be the last two
417
+ * parts of the host. This can be changed by setting "subdomain offset".
418
+ *
419
+ * For example, if the domain is "tobi.ferrets.example.com":
420
+ * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
421
+ * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
422
+ */
423
+ readonly subdomains: string[];
424
+ /**
425
+ * Short-hand for `url.parse(req.url).pathname`.
426
+ */
427
+ readonly path: string;
428
+ /**
429
+ * Parse the "Host" header field hostname.
430
+ */
431
+ readonly hostname: string;
432
+ /**
433
+ * @deprecated Use hostname instead.
434
+ */
435
+ readonly host: string;
436
+ /**
437
+ * Check if the request is fresh, aka
438
+ * Last-Modified and/or the ETag
439
+ * still match.
440
+ */
441
+ readonly fresh: boolean;
442
+ /**
443
+ * Check if the request is stale, aka
444
+ * "Last-Modified" and / or the "ETag" for the
445
+ * resource has changed.
446
+ */
447
+ readonly stale: boolean;
448
+ /**
449
+ * Check if the request was an _XMLHttpRequest_.
450
+ */
451
+ readonly xhr: boolean; // body: { username: string; password: string; remember: boolean; title: string; };
452
+ body: ReqBody; // cookies: { string; remember: boolean; };
453
+ cookies: any;
454
+ method: string;
455
+ params: P;
456
+ query: ReqQuery;
457
+ route: any;
458
+ signedCookies: any;
459
+ originalUrl: string;
460
+ url: string;
461
+ baseUrl: string;
462
+ app: Application;
463
+ /**
464
+ * After middleware.init executed, Request will contain res and next properties
465
+ * See: express/lib/middleware/init.js
466
+ */
467
+ res?: Response<ResBody, LocalsObj> | undefined;
468
+ next?: NextFunction | undefined;
469
+ }
470
+ interface MediaType {
471
+ value: string;
472
+ quality: number;
473
+ type: string;
474
+ subtype: string;
475
+ }
476
+ type Send<ResBody = any, T = Response<ResBody>> = (body?: ResBody) => T;
477
+ interface SendFileOptions extends SendOptions {
478
+ /** Object containing HTTP headers to serve with the file. */
479
+ headers?: Record<string, unknown>;
480
+ }
481
+ interface DownloadOptions extends SendOptions {
482
+ /** Object containing HTTP headers to serve with the file. The header `Content-Disposition` will be overridden by the filename argument. */
483
+ headers?: Record<string, unknown>;
484
+ }
485
+ interface Response<ResBody = any, LocalsObj extends Record<string, any> = Record<string, any>, StatusCode extends number = number> extends http.ServerResponse, Express.Response {
486
+ /**
487
+ * Set status `code`.
488
+ */
489
+ status(code: StatusCode): this;
490
+ /**
491
+ * Set the response HTTP status code to `statusCode` and send its string representation as the response body.
492
+ * @link http://expressjs.com/4x/api.html#res.sendStatus
493
+ *
494
+ * Examples:
495
+ *
496
+ * res.sendStatus(200); // equivalent to res.status(200).send('OK')
497
+ * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
498
+ * res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
499
+ * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
500
+ */
501
+ sendStatus(code: StatusCode): this;
502
+ /**
503
+ * Set Link header field with the given `links`.
504
+ *
505
+ * Examples:
506
+ *
507
+ * res.links({
508
+ * next: 'http://api.example.com/users?page=2',
509
+ * last: 'http://api.example.com/users?page=5'
510
+ * });
511
+ */
512
+ links(links: any): this;
513
+ /**
514
+ * Send a response.
515
+ *
516
+ * Examples:
517
+ *
518
+ * res.send(new Buffer('wahoo'));
519
+ * res.send({ some: 'json' });
520
+ * res.send('<p>some html</p>');
521
+ * res.status(404).send('Sorry, cant find that');
522
+ */
523
+ send: Send<ResBody, this>;
524
+ /**
525
+ * Send JSON response.
526
+ *
527
+ * Examples:
528
+ *
529
+ * res.json(null);
530
+ * res.json({ user: 'tj' });
531
+ * res.status(500).json('oh noes!');
532
+ * res.status(404).json('I dont have that');
533
+ */
534
+ json: Send<ResBody, this>;
535
+ /**
536
+ * Send JSON response with JSONP callback support.
537
+ *
538
+ * Examples:
539
+ *
540
+ * res.jsonp(null);
541
+ * res.jsonp({ user: 'tj' });
542
+ * res.status(500).jsonp('oh noes!');
543
+ * res.status(404).jsonp('I dont have that');
544
+ */
545
+ jsonp: Send<ResBody, this>;
546
+ /**
547
+ * Transfer the file at the given `path`.
548
+ *
549
+ * Automatically sets the _Content-Type_ response header field.
550
+ * The callback `fn(err)` is invoked when the transfer is complete
551
+ * or when an error occurs. Be sure to check `res.headersSent`
552
+ * if you wish to attempt responding, as the header and some data
553
+ * may have already been transferred.
554
+ *
555
+ * Options:
556
+ *
557
+ * - `maxAge` defaulting to 0 (can be string converted by `ms`)
558
+ * - `root` root directory for relative filenames
559
+ * - `headers` object of headers to serve with file
560
+ * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
561
+ *
562
+ * Other options are passed along to `send`.
563
+ *
564
+ * Examples:
565
+ *
566
+ * The following example illustrates how `res.sendFile()` may
567
+ * be used as an alternative for the `static()` middleware for
568
+ * dynamic situations. The code backing `res.sendFile()` is actually
569
+ * the same code, so HTTP cache support etc is identical.
570
+ *
571
+ * app.get('/user/:uid/photos/:file', function(req, res){
572
+ * var uid = req.params.uid
573
+ * , file = req.params.file;
574
+ *
575
+ * req.user.mayViewFilesFrom(uid, function(yes){
576
+ * if (yes) {
577
+ * res.sendFile('/uploads/' + uid + '/' + file);
578
+ * } else {
579
+ * res.send(403, 'Sorry! you cant see that.');
580
+ * }
581
+ * });
582
+ * });
583
+ *
584
+ * @api public
585
+ */
586
+ sendFile(path: string, fn?: Errback): void;
587
+ sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
588
+ /**
589
+ * @deprecated Use sendFile instead.
590
+ */
591
+ sendfile(path: string): void;
592
+ /**
593
+ * @deprecated Use sendFile instead.
594
+ */
595
+ sendfile(path: string, options: SendFileOptions): void;
596
+ /**
597
+ * @deprecated Use sendFile instead.
598
+ */
599
+ sendfile(path: string, fn: Errback): void;
600
+ /**
601
+ * @deprecated Use sendFile instead.
602
+ */
603
+ sendfile(path: string, options: SendFileOptions, fn: Errback): void;
604
+ /**
605
+ * Transfer the file at the given `path` as an attachment.
606
+ *
607
+ * Optionally providing an alternate attachment `filename`,
608
+ * and optional callback `fn(err)`. The callback is invoked
609
+ * when the data transfer is complete, or when an error has
610
+ * ocurred. Be sure to check `res.headersSent` if you plan to respond.
611
+ *
612
+ * The optional options argument passes through to the underlying
613
+ * res.sendFile() call, and takes the exact same parameters.
614
+ *
615
+ * This method uses `res.sendfile()`.
616
+ */
617
+ download(path: string, fn?: Errback): void;
618
+ download(path: string, filename: string, fn?: Errback): void;
619
+ download(path: string, filename: string, options: DownloadOptions, fn?: Errback): void;
620
+ /**
621
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
622
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
623
+ *
624
+ * Examples:
625
+ *
626
+ * res.type('.html');
627
+ * res.type('html');
628
+ * res.type('json');
629
+ * res.type('application/json');
630
+ * res.type('png');
631
+ */
632
+ contentType(type: string): this;
633
+ /**
634
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
635
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
636
+ *
637
+ * Examples:
638
+ *
639
+ * res.type('.html');
640
+ * res.type('html');
641
+ * res.type('json');
642
+ * res.type('application/json');
643
+ * res.type('png');
644
+ */
645
+ type(type: string): this;
646
+ /**
647
+ * Respond to the Acceptable formats using an `obj`
648
+ * of mime-type callbacks.
649
+ *
650
+ * This method uses `req.accepted`, an array of
651
+ * acceptable types ordered by their quality values.
652
+ * When "Accept" is not present the _first_ callback
653
+ * is invoked, otherwise the first match is used. When
654
+ * no match is performed the server responds with
655
+ * 406 "Not Acceptable".
656
+ *
657
+ * Content-Type is set for you, however if you choose
658
+ * you may alter this within the callback using `res.type()`
659
+ * or `res.set('Content-Type', ...)`.
660
+ *
661
+ * res.format({
662
+ * 'text/plain': function(){
663
+ * res.send('hey');
664
+ * },
665
+ *
666
+ * 'text/html': function(){
667
+ * res.send('<p>hey</p>');
668
+ * },
669
+ *
670
+ * 'appliation/json': function(){
671
+ * res.send({ message: 'hey' });
672
+ * }
673
+ * });
674
+ *
675
+ * In addition to canonicalized MIME types you may
676
+ * also use extnames mapped to these types:
677
+ *
678
+ * res.format({
679
+ * text: function(){
680
+ * res.send('hey');
681
+ * },
682
+ *
683
+ * html: function(){
684
+ * res.send('<p>hey</p>');
685
+ * },
686
+ *
687
+ * json: function(){
688
+ * res.send({ message: 'hey' });
689
+ * }
690
+ * });
691
+ *
692
+ * By default Express passes an `Error`
693
+ * with a `.status` of 406 to `next(err)`
694
+ * if a match is not made. If you provide
695
+ * a `.default` callback it will be invoked
696
+ * instead.
697
+ */
698
+ format(obj: any): this;
699
+ /**
700
+ * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
701
+ */
702
+ attachment(filename?: string): this;
703
+ /**
704
+ * Set header `field` to `val`, or pass
705
+ * an object of header fields.
706
+ *
707
+ * Examples:
708
+ *
709
+ * res.set('Foo', ['bar', 'baz']);
710
+ * res.set('Accept', 'application/json');
711
+ * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
712
+ *
713
+ * Aliased as `res.header()`.
714
+ */
715
+ set(field: any): this;
716
+ set(field: string, value?: string | string[]): this;
717
+ header(field: any): this;
718
+ header(field: string, value?: string | string[]): this; // Property indicating if HTTP headers has been sent for the response.
719
+ headersSent: boolean;
720
+ /** Get value for header `field`. */
721
+ get(field: string): string | undefined;
722
+ /** Clear cookie `name`. */
723
+ clearCookie(name: string, options?: CookieOptions): this;
724
+ /**
725
+ * Set cookie `name` to `val`, with the given `options`.
726
+ *
727
+ * Options:
728
+ *
729
+ * - `maxAge` max-age in milliseconds, converted to `expires`
730
+ * - `signed` sign the cookie
731
+ * - `path` defaults to "/"
732
+ *
733
+ * Examples:
734
+ *
735
+ * // "Remember Me" for 15 minutes
736
+ * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
737
+ *
738
+ * // save as above
739
+ * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
740
+ */
741
+ cookie(name: string, val: string, options: CookieOptions): this;
742
+ cookie(name: string, val: any, options: CookieOptions): this;
743
+ cookie(name: string, val: any): this;
744
+ /**
745
+ * Set the location header to `url`.
746
+ *
747
+ * The given `url` can also be the name of a mapped url, for
748
+ * example by default express supports "back" which redirects
749
+ * to the _Referrer_ or _Referer_ headers or "/".
750
+ *
751
+ * Examples:
752
+ *
753
+ * res.location('/foo/bar').;
754
+ * res.location('http://example.com');
755
+ * res.location('../login'); // /blog/post/1 -> /blog/login
756
+ *
757
+ * Mounting:
758
+ *
759
+ * When an application is mounted and `res.location()`
760
+ * is given a path that does _not_ lead with "/" it becomes
761
+ * relative to the mount-point. For example if the application
762
+ * is mounted at "/blog", the following would become "/blog/login".
763
+ *
764
+ * res.location('login');
765
+ *
766
+ * While the leading slash would result in a location of "/login":
767
+ *
768
+ * res.location('/login');
769
+ */
770
+ location(url: string): this;
771
+ /**
772
+ * Redirect to the given `url` with optional response `status`
773
+ * defaulting to 302.
774
+ *
775
+ * The resulting `url` is determined by `res.location()`, so
776
+ * it will play nicely with mounted apps, relative paths,
777
+ * `"back"` etc.
778
+ *
779
+ * Examples:
780
+ *
781
+ * res.redirect('back');
782
+ * res.redirect('/foo/bar');
783
+ * res.redirect('http://example.com');
784
+ * res.redirect(301, 'http://example.com');
785
+ * res.redirect('http://example.com', 301);
786
+ * res.redirect('../login'); // /blog/post/1 -> /blog/login
787
+ */
788
+ redirect(url: string): void;
789
+ redirect(status: number, url: string): void;
790
+ /** @deprecated use res.redirect(status, url) instead */
791
+ redirect(url: string, status: number): void;
792
+ /**
793
+ * Render `view` with the given `options` and optional callback `fn`.
794
+ * When a callback function is given a response will _not_ be made
795
+ * automatically, otherwise a response of _200_ and _text/html_ is given.
796
+ *
797
+ * Options:
798
+ *
799
+ * - `cache` boolean hinting to the engine it should cache
800
+ * - `filename` filename of the view being rendered
801
+ */
802
+ render(view: string, options?: object, callback?: (err: Error, html: string) => void): void;
803
+ render(view: string, callback?: (err: Error, html: string) => void): void;
804
+ locals: LocalsObj & Locals;
805
+ charset: string;
806
+ /**
807
+ * Adds the field to the Vary response header, if it is not there already.
808
+ * Examples:
809
+ *
810
+ * res.vary('User-Agent').render('docs');
811
+ */
812
+ vary(field: string): this;
813
+ app: Application;
814
+ /**
815
+ * Appends the specified value to the HTTP response header field.
816
+ * If the header is not already set, it creates the header with the specified value.
817
+ * The value parameter can be a string or an array.
818
+ *
819
+ * Note: calling res.set() after res.append() will reset the previously-set header value.
820
+ *
821
+ * @since 4.11.0
822
+ */
823
+ append(field: string, value?: string[] | string): this;
824
+ /**
825
+ * After middleware.init executed, Response will contain req property
826
+ * See: express/lib/middleware/init.js
827
+ */
828
+ req: Request;
829
+ }
830
+ type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any;
831
+ type ApplicationRequestHandler<T> = IRouterHandler<T> & IRouterMatcher<T> & ((...handlers: RequestHandlerParams[]) => T);
832
+ interface Application<LocalsObj extends Record<string, any> = Record<string, any>> extends EventEmitter, IRouter, Express.Application {
833
+ /**
834
+ * Express instance itself is a request handler, which could be invoked without
835
+ * third argument.
836
+ */
837
+ (req: Request | http.IncomingMessage, res: Response | http.ServerResponse): any;
838
+ /**
839
+ * Initialize the server.
840
+ *
841
+ * - setup default configuration
842
+ * - setup default middleware
843
+ * - setup route reflection methods
844
+ */
845
+ init(): void;
846
+ /**
847
+ * Initialize application configuration.
848
+ */
849
+ defaultConfiguration(): void;
850
+ /**
851
+ * Register the given template engine callback `fn`
852
+ * as `ext`.
853
+ *
854
+ * By default will `require()` the engine based on the
855
+ * file extension. For example if you try to render
856
+ * a "foo.jade" file Express will invoke the following internally:
857
+ *
858
+ * app.engine('jade', require('jade').__express);
859
+ *
860
+ * For engines that do not provide `.__express` out of the box,
861
+ * or if you wish to "map" a different extension to the template engine
862
+ * you may use this method. For example mapping the EJS template engine to
863
+ * ".html" files:
864
+ *
865
+ * app.engine('html', require('ejs').renderFile);
866
+ *
867
+ * In this case EJS provides a `.renderFile()` method with
868
+ * the same signature that Express expects: `(path, options, callback)`,
869
+ * though note that it aliases this method as `ejs.__express` internally
870
+ * so if you're using ".ejs" extensions you dont need to do anything.
871
+ *
872
+ * Some template engines do not follow this convention, the
873
+ * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
874
+ * library was created to map all of node's popular template
875
+ * engines to follow this convention, thus allowing them to
876
+ * work seamlessly within Express.
877
+ */
878
+ engine(ext: string, fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void): this;
879
+ /**
880
+ * Assign `setting` to `val`, or return `setting`'s value.
881
+ *
882
+ * app.set('foo', 'bar');
883
+ * app.get('foo');
884
+ * // => "bar"
885
+ * app.set('foo', ['bar', 'baz']);
886
+ * app.get('foo');
887
+ * // => ["bar", "baz"]
888
+ *
889
+ * Mounted servers inherit their parent server's settings.
890
+ */
891
+ set(setting: string, val: any): this;
892
+ get: ((name: string) => any) & IRouterMatcher<this>;
893
+ param(name: string | string[], handler: RequestParamHandler): this;
894
+ /**
895
+ * Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
896
+ *
897
+ * @deprecated since version 4.11
898
+ */
899
+ param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
900
+ /**
901
+ * Return the app's absolute pathname
902
+ * based on the parent(s) that have
903
+ * mounted it.
904
+ *
905
+ * For example if the application was
906
+ * mounted as "/admin", which itself
907
+ * was mounted as "/blog" then the
908
+ * return value would be "/blog/admin".
909
+ */
910
+ path(): string;
911
+ /**
912
+ * Check if `setting` is enabled (truthy).
913
+ *
914
+ * app.enabled('foo')
915
+ * // => false
916
+ *
917
+ * app.enable('foo')
918
+ * app.enabled('foo')
919
+ * // => true
920
+ */
921
+ enabled(setting: string): boolean;
922
+ /**
923
+ * Check if `setting` is disabled.
924
+ *
925
+ * app.disabled('foo')
926
+ * // => true
927
+ *
928
+ * app.enable('foo')
929
+ * app.disabled('foo')
930
+ * // => false
931
+ */
932
+ disabled(setting: string): boolean;
933
+ /** Enable `setting`. */
934
+ enable(setting: string): this;
935
+ /** Disable `setting`. */
936
+ disable(setting: string): this;
937
+ /**
938
+ * Render the given view `name` name with `options`
939
+ * and a callback accepting an error and the
940
+ * rendered template string.
941
+ *
942
+ * Example:
943
+ *
944
+ * app.render('email', { name: 'Tobi' }, function(err, html){
945
+ * // ...
946
+ * })
947
+ */
948
+ render(name: string, options?: object, callback?: (err: Error, html: string) => void): void;
949
+ render(name: string, callback: (err: Error, html: string) => void): void;
950
+ /**
951
+ * Listen for connections.
952
+ *
953
+ * A node `http.Server` is returned, with this
954
+ * application (which is a `Function`) as its
955
+ * callback. If you wish to create both an HTTP
956
+ * and HTTPS server you may do so with the "http"
957
+ * and "https" modules as shown here:
958
+ *
959
+ * var http = require('http')
960
+ * , https = require('https')
961
+ * , express = require('express')
962
+ * , app = express();
963
+ *
964
+ * http.createServer(app).listen(80);
965
+ * https.createServer({ ... }, app).listen(443);
966
+ */
967
+ listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server;
968
+ listen(port: number, hostname: string, callback?: () => void): http.Server;
969
+ listen(port: number, callback?: () => void): http.Server;
970
+ listen(callback?: () => void): http.Server;
971
+ listen(path: string, callback?: () => void): http.Server;
972
+ listen(handle: any, listeningListener?: () => void): http.Server;
973
+ router: string;
974
+ settings: any;
975
+ resource: any;
976
+ map: any;
977
+ locals: LocalsObj & Locals;
978
+ /**
979
+ * The app.routes object houses all of the routes defined mapped by the
980
+ * associated HTTP verb. This object may be used for introspection
981
+ * capabilities, for example Express uses this internally not only for
982
+ * routing but to provide default OPTIONS behaviour unless app.options()
983
+ * is used. Your application or framework may also remove routes by
984
+ * simply by removing them from this object.
985
+ */
986
+ routes: any;
987
+ /**
988
+ * Used to get all registered routes in Express Application
989
+ */
990
+ _router: any;
991
+ use: ApplicationRequestHandler<this>;
992
+ /**
993
+ * The mount event is fired on a sub-app, when it is mounted on a parent app.
994
+ * The parent app is passed to the callback function.
995
+ *
996
+ * NOTE:
997
+ * Sub-apps will:
998
+ * - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
999
+ * - Inherit the value of settings with no default value.
1000
+ */
1001
+ on: (event: "mount", callback: (parent: Application) => void) => this;
1002
+ /**
1003
+ * The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
1004
+ */
1005
+ mountpath: string | string[];
1006
+ }
1007
+ interface Express extends Application {
1008
+ request: Request;
1009
+ response: Response;
1010
+ }
1011
+ //#endregion
1012
+ //#region src/routes.d.ts
1013
+ declare const router: Router;
1014
+ //#endregion
1015
+ //#region src/openapi.d.ts
1016
+ declare const _default: {
1017
+ readonly openapi: "3.0.3";
1018
+ readonly info: {
1019
+ readonly title: "Neaps Tide Prediction API";
1020
+ readonly version: string;
1021
+ readonly description: "HTTP JSON API for tide predictions using harmonic constituents";
1022
+ readonly license: {
1023
+ readonly name: "MIT";
1024
+ };
1025
+ };
1026
+ readonly paths: {
1027
+ readonly "/extremes": {
1028
+ readonly get: {
1029
+ readonly summary: "Get extremes prediction for a location";
1030
+ readonly description: "Returns high and low tide predictions for the nearest station to the given coordinates";
1031
+ readonly parameters: readonly [{
1032
+ readonly $ref: "#/components/parameters/latitude";
1033
+ }, {
1034
+ readonly $ref: "#/components/parameters/longitude";
1035
+ }, {
1036
+ readonly $ref: "#/components/parameters/start";
1037
+ }, {
1038
+ readonly $ref: "#/components/parameters/end";
1039
+ }, {
1040
+ readonly $ref: "#/components/parameters/datum";
1041
+ }, {
1042
+ readonly $ref: "#/components/parameters/units";
1043
+ }];
1044
+ readonly responses: {
1045
+ readonly "200": {
1046
+ readonly description: "Successful prediction";
1047
+ readonly content: {
1048
+ readonly "application/json": {
1049
+ readonly schema: {
1050
+ readonly $ref: "#/components/schemas/ExtremesResponse";
1051
+ };
1052
+ };
1053
+ };
1054
+ };
1055
+ readonly "400": {
1056
+ readonly description: "Invalid parameters";
1057
+ readonly content: {
1058
+ readonly "application/json": {
1059
+ readonly schema: {
1060
+ readonly $ref: "#/components/schemas/Error";
1061
+ };
1062
+ };
1063
+ };
1064
+ };
1065
+ };
1066
+ };
1067
+ };
1068
+ readonly "/timeline": {
1069
+ readonly get: {
1070
+ readonly summary: "Get timeline prediction for a location";
1071
+ readonly description: "Returns water level predictions at regular intervals for the nearest station";
1072
+ readonly parameters: readonly [{
1073
+ readonly $ref: "#/components/parameters/latitude";
1074
+ }, {
1075
+ readonly $ref: "#/components/parameters/longitude";
1076
+ }, {
1077
+ readonly $ref: "#/components/parameters/start";
1078
+ }, {
1079
+ readonly $ref: "#/components/parameters/end";
1080
+ }, {
1081
+ readonly $ref: "#/components/parameters/datum";
1082
+ }, {
1083
+ readonly $ref: "#/components/parameters/units";
1084
+ }];
1085
+ readonly responses: {
1086
+ readonly "200": {
1087
+ readonly description: "Successful prediction";
1088
+ readonly content: {
1089
+ readonly "application/json": {
1090
+ readonly schema: {
1091
+ readonly $ref: "#/components/schemas/TimelineResponse";
1092
+ };
1093
+ };
1094
+ };
1095
+ };
1096
+ readonly "400": {
1097
+ readonly description: "Invalid parameters";
1098
+ readonly content: {
1099
+ readonly "application/json": {
1100
+ readonly schema: {
1101
+ readonly $ref: "#/components/schemas/Error";
1102
+ };
1103
+ };
1104
+ };
1105
+ };
1106
+ };
1107
+ };
1108
+ };
1109
+ readonly "/stations": {
1110
+ readonly get: {
1111
+ readonly summary: "Find stations";
1112
+ readonly description: "Find stations by ID or near a location";
1113
+ readonly parameters: readonly [{
1114
+ readonly name: "id";
1115
+ readonly in: "query";
1116
+ readonly description: "Station ID or source ID";
1117
+ readonly required: false;
1118
+ readonly schema: {
1119
+ readonly type: "string";
1120
+ };
1121
+ }, {
1122
+ readonly name: "latitude";
1123
+ readonly in: "query";
1124
+ readonly description: "Latitude for proximity search";
1125
+ readonly required: false;
1126
+ readonly schema: {
1127
+ readonly type: "number";
1128
+ readonly minimum: -90;
1129
+ readonly maximum: 90;
1130
+ };
1131
+ }, {
1132
+ readonly name: "longitude";
1133
+ readonly in: "query";
1134
+ readonly description: "Longitude for proximity search";
1135
+ readonly required: false;
1136
+ readonly schema: {
1137
+ readonly type: "number";
1138
+ readonly minimum: -180;
1139
+ readonly maximum: 180;
1140
+ };
1141
+ }, {
1142
+ readonly name: "limit";
1143
+ readonly in: "query";
1144
+ readonly description: "Maximum number of stations to return (for proximity search)";
1145
+ readonly required: false;
1146
+ readonly schema: {
1147
+ readonly type: "integer";
1148
+ readonly minimum: 1;
1149
+ readonly maximum: 100;
1150
+ readonly default: 10;
1151
+ };
1152
+ }];
1153
+ readonly responses: {
1154
+ readonly "200": {
1155
+ readonly description: "Stations found";
1156
+ readonly content: {
1157
+ readonly "application/json": {
1158
+ readonly schema: {
1159
+ readonly oneOf: readonly [{
1160
+ readonly $ref: "#/components/schemas/Station";
1161
+ }, {
1162
+ readonly type: "array";
1163
+ readonly items: {
1164
+ readonly $ref: "#/components/schemas/Station";
1165
+ };
1166
+ }];
1167
+ };
1168
+ };
1169
+ };
1170
+ };
1171
+ readonly "400": {
1172
+ readonly description: "Invalid parameters";
1173
+ readonly content: {
1174
+ readonly "application/json": {
1175
+ readonly schema: {
1176
+ readonly $ref: "#/components/schemas/Error";
1177
+ };
1178
+ };
1179
+ };
1180
+ };
1181
+ readonly "404": {
1182
+ readonly description: "Station not found";
1183
+ readonly content: {
1184
+ readonly "application/json": {
1185
+ readonly schema: {
1186
+ readonly $ref: "#/components/schemas/Error";
1187
+ };
1188
+ };
1189
+ };
1190
+ };
1191
+ };
1192
+ };
1193
+ };
1194
+ readonly "/stations/{id}/extremes": {
1195
+ readonly get: {
1196
+ readonly summary: "Get extremes prediction for a specific station";
1197
+ readonly parameters: readonly [{
1198
+ readonly $ref: "#/components/parameters/stationId";
1199
+ }, {
1200
+ readonly $ref: "#/components/parameters/start";
1201
+ }, {
1202
+ readonly $ref: "#/components/parameters/end";
1203
+ }, {
1204
+ readonly $ref: "#/components/parameters/datum";
1205
+ }, {
1206
+ readonly $ref: "#/components/parameters/units";
1207
+ }];
1208
+ readonly responses: {
1209
+ readonly "200": {
1210
+ readonly description: "Successful prediction";
1211
+ readonly content: {
1212
+ readonly "application/json": {
1213
+ readonly schema: {
1214
+ readonly $ref: "#/components/schemas/ExtremesResponse";
1215
+ };
1216
+ };
1217
+ };
1218
+ };
1219
+ readonly "400": {
1220
+ readonly description: "Invalid parameters";
1221
+ readonly content: {
1222
+ readonly "application/json": {
1223
+ readonly schema: {
1224
+ readonly $ref: "#/components/schemas/Error";
1225
+ };
1226
+ };
1227
+ };
1228
+ };
1229
+ readonly "404": {
1230
+ readonly description: "Station not found";
1231
+ readonly content: {
1232
+ readonly "application/json": {
1233
+ readonly schema: {
1234
+ readonly $ref: "#/components/schemas/Error";
1235
+ };
1236
+ };
1237
+ };
1238
+ };
1239
+ };
1240
+ };
1241
+ };
1242
+ readonly "/stations/{id}/timeline": {
1243
+ readonly get: {
1244
+ readonly summary: "Get timeline prediction for a specific station";
1245
+ readonly parameters: readonly [{
1246
+ readonly $ref: "#/components/parameters/stationId";
1247
+ }, {
1248
+ readonly $ref: "#/components/parameters/start";
1249
+ }, {
1250
+ readonly $ref: "#/components/parameters/end";
1251
+ }, {
1252
+ readonly $ref: "#/components/parameters/datum";
1253
+ }, {
1254
+ readonly $ref: "#/components/parameters/units";
1255
+ }];
1256
+ readonly responses: {
1257
+ readonly "200": {
1258
+ readonly description: "Successful prediction";
1259
+ readonly content: {
1260
+ readonly "application/json": {
1261
+ readonly schema: {
1262
+ readonly $ref: "#/components/schemas/TimelineResponse";
1263
+ };
1264
+ };
1265
+ };
1266
+ };
1267
+ readonly "400": {
1268
+ readonly description: "Invalid parameters";
1269
+ readonly content: {
1270
+ readonly "application/json": {
1271
+ readonly schema: {
1272
+ readonly $ref: "#/components/schemas/Error";
1273
+ };
1274
+ };
1275
+ };
1276
+ };
1277
+ readonly "404": {
1278
+ readonly description: "Station not found";
1279
+ readonly content: {
1280
+ readonly "application/json": {
1281
+ readonly schema: {
1282
+ readonly $ref: "#/components/schemas/Error";
1283
+ };
1284
+ };
1285
+ };
1286
+ };
1287
+ };
1288
+ };
1289
+ };
1290
+ readonly "/openapi.json": {
1291
+ readonly get: {
1292
+ readonly summary: "Get OpenAPI specification";
1293
+ readonly responses: {
1294
+ readonly "200": {
1295
+ readonly description: "OpenAPI specification";
1296
+ readonly content: {
1297
+ readonly "application/json": {
1298
+ readonly schema: {
1299
+ readonly type: "object";
1300
+ };
1301
+ };
1302
+ };
1303
+ };
1304
+ };
1305
+ };
1306
+ };
1307
+ };
1308
+ readonly components: {
1309
+ readonly parameters: {
1310
+ readonly latitude: {
1311
+ readonly name: "latitude";
1312
+ readonly in: "query";
1313
+ readonly description: "Latitude";
1314
+ readonly required: true;
1315
+ readonly schema: {
1316
+ readonly type: "number";
1317
+ readonly minimum: -90;
1318
+ readonly maximum: 90;
1319
+ };
1320
+ };
1321
+ readonly longitude: {
1322
+ readonly name: "longitude";
1323
+ readonly in: "query";
1324
+ readonly description: "Longitude";
1325
+ readonly required: true;
1326
+ readonly schema: {
1327
+ readonly type: "number";
1328
+ readonly minimum: -180;
1329
+ readonly maximum: 180;
1330
+ };
1331
+ };
1332
+ readonly start: {
1333
+ readonly name: "start";
1334
+ readonly in: "query";
1335
+ readonly required: false;
1336
+ readonly description: "Start date/time (ISO 8601 format, defaults to now)";
1337
+ readonly schema: {
1338
+ readonly type: "string";
1339
+ readonly format: "date-time";
1340
+ };
1341
+ };
1342
+ readonly end: {
1343
+ readonly name: "end";
1344
+ readonly in: "query";
1345
+ readonly required: false;
1346
+ readonly description: "End date/time (ISO 8601 format, defaults to 7 days from start)";
1347
+ readonly schema: {
1348
+ readonly type: "string";
1349
+ readonly format: "date-time";
1350
+ };
1351
+ };
1352
+ readonly datum: {
1353
+ readonly name: "datum";
1354
+ readonly in: "query";
1355
+ readonly required: false;
1356
+ readonly description: "Vertical datum (defaults to MLLW if available)";
1357
+ readonly schema: {
1358
+ readonly type: "string";
1359
+ readonly enum: readonly ["MLLW", "MLW", "MTL", "MSL", "MHW", "MHHW"];
1360
+ };
1361
+ };
1362
+ readonly units: {
1363
+ readonly name: "units";
1364
+ readonly in: "query";
1365
+ readonly required: false;
1366
+ readonly description: "Units for water levels (defaults to meters)";
1367
+ readonly schema: {
1368
+ readonly type: "string";
1369
+ readonly enum: readonly ["meters", "feet"];
1370
+ readonly default: "meters";
1371
+ };
1372
+ };
1373
+ readonly stationId: {
1374
+ readonly name: "id";
1375
+ readonly in: "path";
1376
+ readonly required: true;
1377
+ readonly description: "Station ID or source ID";
1378
+ readonly schema: {
1379
+ readonly type: "string";
1380
+ };
1381
+ };
1382
+ };
1383
+ readonly schemas: {
1384
+ readonly Station: {
1385
+ readonly type: "object";
1386
+ readonly properties: {
1387
+ readonly id: {
1388
+ readonly type: "string";
1389
+ };
1390
+ readonly name: {
1391
+ readonly type: "string";
1392
+ };
1393
+ readonly latitude: {
1394
+ readonly type: "number";
1395
+ };
1396
+ readonly longitude: {
1397
+ readonly type: "number";
1398
+ };
1399
+ readonly region: {
1400
+ readonly type: "string";
1401
+ };
1402
+ readonly country: {
1403
+ readonly type: "string";
1404
+ };
1405
+ readonly continent: {
1406
+ readonly type: "string";
1407
+ };
1408
+ readonly timezone: {
1409
+ readonly type: "string";
1410
+ };
1411
+ readonly type: {
1412
+ readonly type: "string";
1413
+ readonly enum: readonly ["reference", "subordinate"];
1414
+ };
1415
+ readonly source: {
1416
+ readonly type: "object";
1417
+ readonly additionalProperties: true;
1418
+ };
1419
+ readonly license: {
1420
+ readonly type: "object";
1421
+ readonly additionalProperties: true;
1422
+ };
1423
+ readonly disclaimers: {
1424
+ readonly type: "string";
1425
+ };
1426
+ readonly distance: {
1427
+ readonly type: "number";
1428
+ readonly description: "Distance from query point in meters (only for proximity searches)";
1429
+ };
1430
+ readonly datums: {
1431
+ readonly type: "object";
1432
+ readonly additionalProperties: {
1433
+ readonly type: "number";
1434
+ };
1435
+ };
1436
+ readonly harmonic_constituents: {
1437
+ readonly type: "array";
1438
+ readonly items: {
1439
+ readonly type: "object";
1440
+ readonly additionalProperties: true;
1441
+ };
1442
+ };
1443
+ readonly defaultDatum: {
1444
+ readonly type: "string";
1445
+ };
1446
+ readonly offsets: {
1447
+ readonly type: "object";
1448
+ readonly additionalProperties: true;
1449
+ };
1450
+ };
1451
+ readonly additionalProperties: true;
1452
+ };
1453
+ readonly Extreme: {
1454
+ readonly type: "object";
1455
+ readonly properties: {
1456
+ readonly time: {
1457
+ readonly type: "string";
1458
+ readonly format: "date-time";
1459
+ };
1460
+ readonly level: {
1461
+ readonly type: "number";
1462
+ };
1463
+ readonly high: {
1464
+ readonly type: "boolean";
1465
+ };
1466
+ readonly low: {
1467
+ readonly type: "boolean";
1468
+ };
1469
+ readonly label: {
1470
+ readonly type: "string";
1471
+ };
1472
+ };
1473
+ readonly required: readonly ["time", "level", "high", "low", "label"];
1474
+ };
1475
+ readonly ExtremesResponse: {
1476
+ readonly type: "object";
1477
+ readonly properties: {
1478
+ readonly datum: {
1479
+ readonly type: "string";
1480
+ };
1481
+ readonly units: {
1482
+ readonly type: "string";
1483
+ readonly enum: readonly ["meters", "feet"];
1484
+ };
1485
+ readonly station: {
1486
+ readonly $ref: "#/components/schemas/Station";
1487
+ };
1488
+ readonly distance: {
1489
+ readonly type: "number";
1490
+ };
1491
+ readonly extremes: {
1492
+ readonly type: "array";
1493
+ readonly items: {
1494
+ readonly $ref: "#/components/schemas/Extreme";
1495
+ };
1496
+ };
1497
+ };
1498
+ };
1499
+ readonly TimelineEntry: {
1500
+ readonly type: "object";
1501
+ readonly properties: {
1502
+ readonly time: {
1503
+ readonly type: "string";
1504
+ readonly format: "date-time";
1505
+ };
1506
+ readonly level: {
1507
+ readonly type: "number";
1508
+ };
1509
+ };
1510
+ readonly required: readonly ["time", "level"];
1511
+ };
1512
+ readonly TimelineResponse: {
1513
+ readonly type: "object";
1514
+ readonly properties: {
1515
+ readonly datum: {
1516
+ readonly type: "string";
1517
+ };
1518
+ readonly units: {
1519
+ readonly type: "string";
1520
+ readonly enum: readonly ["meters", "feet"];
1521
+ };
1522
+ readonly station: {
1523
+ readonly $ref: "#/components/schemas/Station";
1524
+ };
1525
+ readonly distance: {
1526
+ readonly type: "number";
1527
+ };
1528
+ readonly timeline: {
1529
+ readonly type: "array";
1530
+ readonly items: {
1531
+ readonly $ref: "#/components/schemas/TimelineEntry";
1532
+ };
1533
+ };
1534
+ };
1535
+ };
1536
+ readonly Error: {
1537
+ readonly type: "object";
1538
+ readonly properties: {
1539
+ readonly message: {
1540
+ readonly type: "string";
1541
+ };
1542
+ readonly errors: {
1543
+ readonly type: "array";
1544
+ readonly items: {
1545
+ readonly type: "object";
1546
+ readonly additionalProperties: true;
1547
+ };
1548
+ };
1549
+ };
1550
+ readonly required: readonly ["message"];
1551
+ };
1552
+ };
1553
+ };
1554
+ };
1555
+ //#endregion
1556
+ //#region src/index.d.ts
1557
+ declare function createApp(): Express;
1558
+ //#endregion
1559
+ export { createApp, _default as openapi, router as routes };
1560
+ //# sourceMappingURL=index.d.mts.map