tina4-nodejs 3.13.91 → 3.13.94

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.
Files changed (135) hide show
  1. package/CLAUDE.md +16 -3
  2. package/README.md +1 -1
  3. package/package.json +12 -9
  4. package/packages/cli/dist/bin.js +1312 -987
  5. package/packages/core/dist/index.js +1312 -987
  6. package/packages/core/src/auth.ts +141 -21
  7. package/packages/core/src/devMailbox.ts +20 -44
  8. package/packages/core/src/index.ts +2 -2
  9. package/packages/core/src/messenger.ts +72 -0
  10. package/packages/core/src/queueBackends/kafkaBackend.ts +108 -12
  11. package/packages/core/src/sessionHandlers/childError.ts +72 -0
  12. package/packages/core/src/sessionHandlers/mongoClient.ts +9 -3
  13. package/packages/core/src/sessionHandlers/redisHandler.ts +18 -5
  14. package/packages/core/src/sessionHandlers/respClient.ts +5 -1
  15. package/packages/frond/dist/index.js +74 -31
  16. package/packages/frond/src/engine.ts +99 -33
  17. package/packages/orm/dist/index.js +3102 -2777
  18. package/packages/orm/src/adapters/sqlite.ts +4 -1
  19. package/packages/orm/src/database.ts +108 -8
  20. package/types/cli/src/bin.d.ts +92 -0
  21. package/types/cli/src/commands/build.d.ts +2 -0
  22. package/types/cli/src/commands/generate.d.ts +47 -0
  23. package/types/cli/src/commands/init.d.ts +1 -0
  24. package/types/cli/src/commands/metrics.d.ts +6 -0
  25. package/types/cli/src/commands/migrate.d.ts +1 -0
  26. package/types/cli/src/commands/migrateCreate.d.ts +1 -0
  27. package/types/cli/src/commands/migrateRollback.d.ts +1 -0
  28. package/types/cli/src/commands/migrateStatus.d.ts +1 -0
  29. package/types/cli/src/commands/queue.d.ts +20 -0
  30. package/types/cli/src/commands/routes.d.ts +1 -0
  31. package/types/cli/src/commands/seed.d.ts +1 -0
  32. package/types/cli/src/commands/serve.d.ts +6 -0
  33. package/types/cli/src/commands/test.d.ts +1 -0
  34. package/types/core/src/ai.d.ts +64 -0
  35. package/types/core/src/api.d.ts +262 -0
  36. package/types/core/src/auth.d.ts +154 -0
  37. package/types/core/src/authGate.d.ts +20 -0
  38. package/types/core/src/background.d.ts +34 -0
  39. package/types/core/src/cache.d.ts +160 -0
  40. package/types/core/src/constants.d.ts +38 -0
  41. package/types/core/src/container.d.ts +44 -0
  42. package/types/core/src/context/chunker.d.ts +31 -0
  43. package/types/core/src/context/index.d.ts +93 -0
  44. package/types/core/src/devAdmin.d.ts +179 -0
  45. package/types/core/src/devMailbox.d.ts +54 -0
  46. package/types/core/src/docs.d.ts +141 -0
  47. package/types/core/src/docsAutoDiscovery.d.ts +6 -0
  48. package/types/core/src/dotenv.d.ts +65 -0
  49. package/types/core/src/env.d.ts +28 -0
  50. package/types/core/src/errorOverlay.d.ts +36 -0
  51. package/types/core/src/events.d.ts +75 -0
  52. package/types/core/src/fakeData.d.ts +55 -0
  53. package/types/core/src/feedback.d.ts +90 -0
  54. package/types/core/src/graphql.d.ts +207 -0
  55. package/types/core/src/health.d.ts +22 -0
  56. package/types/core/src/htmlElement.d.ts +75 -0
  57. package/types/core/src/i18n.d.ts +37 -0
  58. package/types/core/src/index.d.ts +93 -0
  59. package/types/core/src/job.d.ts +39 -0
  60. package/types/core/src/logger.d.ts +123 -0
  61. package/types/core/src/mcp.d.ts +248 -0
  62. package/types/core/src/messenger.d.ts +191 -0
  63. package/types/core/src/metrics.d.ts +77 -0
  64. package/types/core/src/middleware.d.ts +207 -0
  65. package/types/core/src/mqtt.d.ts +257 -0
  66. package/types/core/src/mqttMessage.d.ts +67 -0
  67. package/types/core/src/plan.d.ts +96 -0
  68. package/types/core/src/projectIndex.d.ts +56 -0
  69. package/types/core/src/queue.d.ts +219 -0
  70. package/types/core/src/queueBackends/kafkaBackend.d.ts +117 -0
  71. package/types/core/src/queueBackends/liteBackend.d.ts +119 -0
  72. package/types/core/src/queueBackends/mongoBackend.d.ts +97 -0
  73. package/types/core/src/queueBackends/rabbitmqBackend.d.ts +55 -0
  74. package/types/core/src/rateLimiter.d.ts +49 -0
  75. package/types/core/src/request.d.ts +25 -0
  76. package/types/core/src/response.d.ts +28 -0
  77. package/types/core/src/routeDiscovery.d.ts +12 -0
  78. package/types/core/src/router.d.ts +355 -0
  79. package/types/core/src/scss.d.ts +19 -0
  80. package/types/core/src/server.d.ts +131 -0
  81. package/types/core/src/service.d.ts +115 -0
  82. package/types/core/src/session.d.ts +256 -0
  83. package/types/core/src/sessionHandlers/childError.d.ts +34 -0
  84. package/types/core/src/sessionHandlers/databaseHandler.d.ts +42 -0
  85. package/types/core/src/sessionHandlers/mongoClient.d.ts +24 -0
  86. package/types/core/src/sessionHandlers/mongoHandler.d.ts +61 -0
  87. package/types/core/src/sessionHandlers/redisHandler.d.ts +60 -0
  88. package/types/core/src/sessionHandlers/respClient.d.ts +22 -0
  89. package/types/core/src/sessionHandlers/valkeyHandler.d.ts +65 -0
  90. package/types/core/src/static.d.ts +2 -0
  91. package/types/core/src/test.d.ts +94 -0
  92. package/types/core/src/testClient.d.ts +36 -0
  93. package/types/core/src/testing.d.ts +58 -0
  94. package/types/core/src/types.d.ts +219 -0
  95. package/types/core/src/validator.d.ts +52 -0
  96. package/types/core/src/websocket.d.ts +376 -0
  97. package/types/core/src/websocketBackplane.d.ts +166 -0
  98. package/types/core/src/websocketConnection.d.ts +54 -0
  99. package/types/core/src/wsdl.d.ts +101 -0
  100. package/types/frond/src/engine.d.ts +263 -0
  101. package/types/frond/src/index.d.ts +2 -0
  102. package/types/orm/src/adapters/firebird.d.ts +138 -0
  103. package/types/orm/src/adapters/mongodb.d.ts +81 -0
  104. package/types/orm/src/adapters/mssql.d.ts +70 -0
  105. package/types/orm/src/adapters/mysql.d.ts +66 -0
  106. package/types/orm/src/adapters/odbc.d.ts +97 -0
  107. package/types/orm/src/adapters/postgres.d.ts +85 -0
  108. package/types/orm/src/adapters/sqlite.d.ts +56 -0
  109. package/types/orm/src/autoCrud.d.ts +73 -0
  110. package/types/orm/src/baseModel.d.ts +391 -0
  111. package/types/orm/src/cachedDatabase.d.ts +177 -0
  112. package/types/orm/src/database.d.ts +609 -0
  113. package/types/orm/src/databaseResult.d.ts +85 -0
  114. package/types/orm/src/docstore.d.ts +182 -0
  115. package/types/orm/src/fakeData.d.ts +22 -0
  116. package/types/orm/src/index.d.ts +40 -0
  117. package/types/orm/src/migration.d.ts +275 -0
  118. package/types/orm/src/model.d.ts +7 -0
  119. package/types/orm/src/query.d.ts +14 -0
  120. package/types/orm/src/queryBuilder.d.ts +173 -0
  121. package/types/orm/src/realtime/index.d.ts +7 -0
  122. package/types/orm/src/realtime/models/attachment.d.ts +43 -0
  123. package/types/orm/src/realtime/models/channel.d.ts +32 -0
  124. package/types/orm/src/realtime/models/channelMember.d.ts +32 -0
  125. package/types/orm/src/realtime/models/message.d.ts +36 -0
  126. package/types/orm/src/realtime/models/workspace.d.ts +26 -0
  127. package/types/orm/src/realtime/realtime.d.ts +24 -0
  128. package/types/orm/src/realtime/storage.d.ts +61 -0
  129. package/types/orm/src/seeder.d.ts +118 -0
  130. package/types/orm/src/sqlTranslator.d.ts +134 -0
  131. package/types/orm/src/types.d.ts +138 -0
  132. package/types/orm/src/validation.d.ts +6 -0
  133. package/types/swagger/src/generator.d.ts +46 -0
  134. package/types/swagger/src/index.d.ts +2 -0
  135. package/types/swagger/src/ui.d.ts +11 -0
@@ -0,0 +1,36 @@
1
+ import { Router } from "./router.js";
2
+ export declare class TestResponse {
3
+ readonly status: number;
4
+ readonly body: string;
5
+ readonly headers: Record<string, string>;
6
+ readonly contentType: string;
7
+ constructor(statusCode: number, headers: Record<string, string>, body: string);
8
+ /** Parse body as JSON. */
9
+ json(): unknown;
10
+ /** Return body as a string. */
11
+ text(): string;
12
+ toString(): string;
13
+ }
14
+ export interface RequestOptions {
15
+ json?: Record<string, unknown> | unknown[];
16
+ body?: string;
17
+ headers?: Record<string, string>;
18
+ }
19
+ export declare class TestClient {
20
+ private router;
21
+ constructor(router?: Router);
22
+ /** Send a GET request. */
23
+ get(path: string, options?: RequestOptions): Promise<TestResponse>;
24
+ /** Send a POST request. */
25
+ post(path: string, options?: RequestOptions): Promise<TestResponse>;
26
+ /** Send a PUT request. */
27
+ put(path: string, options?: RequestOptions): Promise<TestResponse>;
28
+ /** Send a PATCH request. */
29
+ patch(path: string, options?: RequestOptions): Promise<TestResponse>;
30
+ /** Send a DELETE request. */
31
+ delete(path: string, options?: RequestOptions): Promise<TestResponse>;
32
+ /** Build a mock request, match the route, execute the handler. */
33
+ private _request;
34
+ /** Gather the captured status/headers/body into a TestResponse and free the socket. */
35
+ private _collect;
36
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Tina4 Node.js — Inline testing framework.
3
+ *
4
+ * Attach test assertions to functions and run them all at once.
5
+ *
6
+ * import { tests, assertEqual, assertRaises, runAll } from "./testing.js";
7
+ *
8
+ * const add = tests(
9
+ * assertEqual([5, 3], 8),
10
+ * assertRaises(Error, [null]),
11
+ * )(function add(a: number, b: number | null = null): number {
12
+ * if (b === null) throw new Error("b required");
13
+ * return a + b;
14
+ * });
15
+ *
16
+ * runAll();
17
+ */
18
+ interface Assertion {
19
+ type: "equal" | "raises" | "true" | "false";
20
+ args: unknown[];
21
+ expected?: unknown;
22
+ exception?: new (...a: unknown[]) => Error;
23
+ }
24
+ interface TestResults {
25
+ passed: number;
26
+ failed: number;
27
+ errors: number;
28
+ details: Array<{
29
+ name: string;
30
+ status: string;
31
+ message?: string;
32
+ }>;
33
+ }
34
+ /** Assert that calling the function with `args` returns `expected`. */
35
+ export declare function assertEqual(args: unknown[], expected: unknown): Assertion;
36
+ /** Assert that calling the function with `args` throws an instance of `errorClass`. */
37
+ export declare function assertRaises(errorClass: new (...a: unknown[]) => Error, args: unknown[]): Assertion;
38
+ /** Assert that calling the function with `args` returns a truthy value. */
39
+ export declare function assertTrue(args: unknown[]): Assertion;
40
+ /** Assert that calling the function with `args` returns a falsy value. */
41
+ export declare function assertFalse(args: unknown[]): Assertion;
42
+ /**
43
+ * Attach inline test assertions to a function.
44
+ *
45
+ * Returns a wrapper that accepts the function and registers it,
46
+ * then returns the original function unchanged.
47
+ *
48
+ * const myFn = tests(assertEqual([1,2], 3))(function myFn(a,b) { return a+b; });
49
+ */
50
+ export declare function tests(...assertions: Assertion[]): <T extends (...args: unknown[]) => unknown>(fn: T) => T;
51
+ /** Run all registered tests. Returns results summary. */
52
+ export declare function runAll(options?: {
53
+ quiet?: boolean;
54
+ failfast?: boolean;
55
+ }): TestResults;
56
+ /** Reset the test registry (useful between test runs). */
57
+ export declare function reset(): void;
58
+ export {};
@@ -0,0 +1,219 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ export interface UploadedFile {
3
+ fieldName: string;
4
+ filename: string;
5
+ type: string;
6
+ content: Buffer;
7
+ size: number;
8
+ }
9
+ export interface Tina4Session {
10
+ get(key: string, defaultValue?: unknown): unknown;
11
+ set(key: string, value: unknown): void;
12
+ delete(key: string): void;
13
+ clear(): void;
14
+ save(): void;
15
+ readonly id: string;
16
+ }
17
+ export interface Tina4Request extends IncomingMessage {
18
+ /**
19
+ * Path params. Typed params arrive coerced: `{id:int}`/`{id:integer}` and
20
+ * `{p:float}`/`{p:number}` are JS `number`s; every other type and untyped
21
+ * `{id}` stay `string` (parity with Python/PHP/Ruby).
22
+ */
23
+ params: Record<string, string | number>;
24
+ query: Record<string, string>;
25
+ /**
26
+ * Request path only — no query string. Matches `request.path` in
27
+ * Python/PHP/Ruby. Example: `/users/42`.
28
+ */
29
+ path: string;
30
+ /**
31
+ * Raw query string with no leading "?". Matches `request.query_string`
32
+ * (Python/Ruby) and `request.queryString` (PHP). Example: `"page=2"`.
33
+ */
34
+ queryString: string;
35
+ /**
36
+ * Full absolute URL — `scheme://host[:port]/path[?query]`.
37
+ * Honours X-Forwarded-Proto / X-Forwarded-Host. Matches PHP/Ruby/Python parity.
38
+ *
39
+ * Note: this overrides Node's native `IncomingMessage.url` (which contains
40
+ * only path+query). Inside Tina4 handlers, `req.url` is always the full URL.
41
+ */
42
+ url: string;
43
+ body: unknown;
44
+ ip: string;
45
+ files: Record<string, UploadedFile | UploadedFile[]>;
46
+ cookies: Record<string, string>;
47
+ contentType: string;
48
+ session: Tina4Session;
49
+ user?: Record<string, unknown>;
50
+ /** Get a specific header value by name (case-insensitive). */
51
+ header(name: string): string | undefined;
52
+ /** Extract the Bearer token from the Authorization header. */
53
+ bearerToken(): string | null;
54
+ /**
55
+ * Get a parameter by key from merged params (route + query). Route params
56
+ * may be coerced numbers (e.g. `{id:int}`); query params are always strings.
57
+ */
58
+ param(key: string, defaultValue?: string | number): string | number | undefined;
59
+ /** Parse the request body based on content type. */
60
+ parseBody(): Promise<void>;
61
+ }
62
+ export interface CookieOptions {
63
+ maxAge?: number;
64
+ expires?: Date;
65
+ path?: string;
66
+ domain?: string;
67
+ secure?: boolean;
68
+ httpOnly?: boolean;
69
+ sameSite?: "Strict" | "Lax" | "None";
70
+ }
71
+ export interface Tina4ResponseMethods {
72
+ json(data: unknown, status?: number): Tina4Response;
73
+ html(content: string, status?: number): Tina4Response;
74
+ text(content: string, status?: number): Tina4Response;
75
+ xml(content: string, status?: number): Tina4Response;
76
+ status(code: number): Tina4Response;
77
+ header(name: string, value: string | number | readonly string[]): Tina4Response;
78
+ addHeader(name: string, value: string): void;
79
+ send(data: unknown, statusCode?: number, contentType?: string): Tina4Response;
80
+ redirect(url: string, code?: number): Tina4Response;
81
+ cookie(name: string, value: string, options?: CookieOptions): Tina4Response;
82
+ clearCookie(name: string, options?: CookieOptions): Tina4Response;
83
+ file(path: string, options?: {
84
+ download?: boolean;
85
+ contentType?: string;
86
+ }): Tina4Response;
87
+ error(code: string, message: string, status?: number): Tina4Response;
88
+ render(template: string, data?: Record<string, unknown>, status?: number, templateDir?: string): Promise<Tina4Response>;
89
+ /** Stream response from an async generator (SSE or chunked). */
90
+ stream(source: AsyncIterable<string | Buffer>, contentType?: string): Promise<Tina4Response>;
91
+ /** The underlying ServerResponse for advanced use */
92
+ raw: ServerResponse;
93
+ }
94
+ /**
95
+ * Tina4 Response — callable AND has methods.
96
+ *
97
+ * return response({ users: [] }); // Auto-JSON
98
+ * return response({ ok: true }, HTTP_CREATED); // JSON with status
99
+ * return response("<h1>Hi</h1>"); // Auto-HTML
100
+ * return response("Not found", HTTP_NOT_FOUND); // Plain text
101
+ * return response(data, HTTP_OK, APPLICATION_JSON); // Explicit
102
+ * return response.json(data, 201); // Explicit method
103
+ * return response.redirect("/login"); // Special case
104
+ */
105
+ export type Tina4Response = ((data?: unknown, statusCode?: number, contentType?: string) => Tina4Response) & Tina4ResponseMethods;
106
+ export type RouteHandler = (req: Tina4Request, res: Tina4Response) => Tina4Response | void | Promise<Tina4Response | void>;
107
+ export interface RouteDefinition {
108
+ method: string;
109
+ pattern: string;
110
+ handler: RouteHandler;
111
+ filePath?: string;
112
+ meta?: RouteMeta;
113
+ /** Middleware functions and/or string specs (e.g. "ResponseCache:300"). */
114
+ middlewares?: MiddlewareSpec[];
115
+ /** Template file to render when handler returns a plain object */
116
+ template?: string;
117
+ /** Whether this route requires bearer-token authentication */
118
+ secure?: boolean;
119
+ /** Whether this route's response should be cached */
120
+ cached?: boolean;
121
+ /** Opt out of secure-by-default auth on write routes */
122
+ noAuth?: boolean;
123
+ }
124
+ export interface RouteMeta {
125
+ summary?: string;
126
+ description?: string;
127
+ tags?: string[];
128
+ responses?: Record<string, {
129
+ description: string;
130
+ }>;
131
+ /** Request-body example surfaced in the OpenAPI requestBody. */
132
+ example?: unknown;
133
+ /** Marks the operation deprecated in the spec. */
134
+ deprecated?: boolean;
135
+ /**
136
+ * Per-route security requirement (v3.13.42). Overrides the default scheme.
137
+ * Accepted forms (normalized by the generator into a security-requirement list):
138
+ * "bearerAuth" -> [{ bearerAuth: [] }]
139
+ * "public" | "none" | [] -> [] (explicitly no auth)
140
+ * { apiKeyAuth: [] } -> [{ apiKeyAuth: [] }] (AND within one map)
141
+ * [{ oauth2: ["read"] }, { bearerAuth: [] }] -> verbatim (OR across maps)
142
+ */
143
+ security?: string | string[] | Record<string, string[]> | Array<Record<string, string[]>>;
144
+ /** Scopes for a single named scheme passed as `security: "oauth2"` + `scopes: [...]`. */
145
+ scopes?: string[];
146
+ /**
147
+ * Reference a registered component schema as the request body (v3.13.42):
148
+ * requestSchema: "CreateUser" OR { name: "CreateUser", contentType: "application/json" }
149
+ * Emits `$ref: #/components/schemas/CreateUser` and lands the schema in components.schemas.
150
+ */
151
+ requestSchema?: string | {
152
+ name: string;
153
+ contentType?: string;
154
+ };
155
+ /**
156
+ * Reference registered component schemas as response bodies, keyed by status (v3.13.42):
157
+ * responseSchemas: { 200: "User", 201: { name: "User", isList: true } }
158
+ */
159
+ responseSchemas?: Record<string, string | {
160
+ name: string;
161
+ isList?: boolean;
162
+ }>;
163
+ }
164
+ export interface Tina4Config {
165
+ port?: number;
166
+ host?: string;
167
+ /** Base directory for the project. When set, routesDir, modelsDir, templatesDir,
168
+ * and staticDir are resolved relative to this path instead of process.cwd(). */
169
+ basePath?: string;
170
+ routesDir?: string;
171
+ modelsDir?: string;
172
+ templatesDir?: string;
173
+ staticDir?: string;
174
+ database?: {
175
+ type?: "sqlite" | "postgres" | "mysql";
176
+ path?: string;
177
+ url?: string;
178
+ };
179
+ }
180
+ export type Middleware = (req: Tina4Request, res: Tina4Response, next: () => void) => void | Promise<void>;
181
+ /**
182
+ * A route middleware entry: either a middleware function, or a string spec
183
+ * resolved by the router to a built-in middleware.
184
+ *
185
+ * String forms (parity with Python/PHP/Ruby):
186
+ * "ResponseCache" → responseCache() with the default/env TTL
187
+ * "ResponseCache:300" → responseCache({ ttl: 300 })
188
+ *
189
+ * The router resolves string specs to middleware functions when the route
190
+ * runs, so callers can register a response-cache middleware without importing
191
+ * `responseCache`.
192
+ */
193
+ export type MiddlewareSpec = Middleware | string;
194
+ /**
195
+ * Handler for WebSocket routes.
196
+ * connection — object with send/broadcast/close methods and route params.
197
+ * event — one of "open", "message", or "close".
198
+ * data — the incoming text message (only present for "message" events).
199
+ */
200
+ export type WebSocketRouteHandler = ((connection: import("./websocketConnection.js").WebSocketConnection, event: "open" | "message" | "close", data: string) => void | Promise<void>) & {
201
+ /**
202
+ * Decorator-style secured flag — mirrors Python's `handler._secured`. When
203
+ * truthy the WS route requires a valid JWT on the upgrade. `Router.websocket`
204
+ * reads this into the route's `authRequired`. Lets a handler be marked
205
+ * secured in EITHER order (before or after registration).
206
+ */
207
+ _secured?: boolean;
208
+ };
209
+ export interface WebSocketRouteDefinition {
210
+ pattern: string;
211
+ handler: WebSocketRouteHandler;
212
+ /**
213
+ * True when this WS route requires a valid JWT on the upgrade. Public by
214
+ * default (mirrors GET). Set imperatively via `Router.websocket(path, fn,
215
+ * { secured: true })` / the returned `.secure()`, or by a `_secured` flag on
216
+ * the handler (decorator style).
217
+ */
218
+ authRequired?: boolean;
219
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Tina4 Validator — Request body validation.
3
+ *
4
+ * Usage:
5
+ * import { Validator } from "@tina4/core";
6
+ *
7
+ * const validator = new Validator(req.body as Record<string, unknown>);
8
+ * validator.required("name", "email");
9
+ * validator.email("email");
10
+ * validator.minLength("name", 2);
11
+ * validator.maxLength("name", 100);
12
+ * validator.integer("age");
13
+ * validator.min("age", 0);
14
+ * validator.max("age", 150);
15
+ * validator.inList("role", ["admin", "user", "guest"]);
16
+ * validator.regex("phone", /^\+?[\d\s\-]+$/);
17
+ *
18
+ * if (!validator.isValid()) {
19
+ * return res.error("VALIDATION_FAILED", validator.errors()[0].message, 400);
20
+ * }
21
+ */
22
+ export interface ValidationError {
23
+ field: string;
24
+ message: string;
25
+ }
26
+ export declare class Validator {
27
+ private data;
28
+ private validationErrors;
29
+ constructor(data?: Record<string, unknown> | null);
30
+ /** Check that one or more fields are present and non-empty. */
31
+ required(...fields: string[]): this;
32
+ /** Check that a field contains a valid email address. */
33
+ email(field: string): this;
34
+ /** Check that a string field has at least `length` characters. */
35
+ minLength(field: string, length: number): this;
36
+ /** Check that a string field has at most `length` characters. */
37
+ maxLength(field: string, length: number): this;
38
+ /** Check that a field is an integer (or can be parsed as one). */
39
+ integer(field: string): this;
40
+ /** Check that a numeric field is >= `minimum`. */
41
+ min(field: string, minimum: number): this;
42
+ /** Check that a numeric field is <= `maximum`. */
43
+ max(field: string, maximum: number): this;
44
+ /** Check that a field's value is one of the allowed values. */
45
+ inList(field: string, allowed: unknown[]): this;
46
+ /** Check that a field matches a regular expression. */
47
+ regex(field: string, pattern: RegExp | string): this;
48
+ /** Return the list of validation errors (empty if valid). */
49
+ errors(): ValidationError[];
50
+ /** Return true if no validation errors have been recorded. */
51
+ isValid(): boolean;
52
+ }