hotstaq 0.9.19 → 0.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/HotRouteMethod.d.ts +34 -1
- package/build/src/HotRouteMethod.d.ts.map +1 -1
- package/build/src/HotRouteMethod.js +35 -1
- package/build/src/HotRouteMethod.js.map +1 -1
- package/build/src/HotStaq.d.ts +11 -3
- package/build/src/HotStaq.d.ts.map +1 -1
- package/build/src/HotStaq.js +18 -2
- package/build/src/HotStaq.js.map +1 -1
- package/build/src/HotStaqRegisterComponent.d.ts.map +1 -1
- package/build/src/HotStaqRegisterComponent.js +12 -2
- package/build/src/HotStaqRegisterComponent.js.map +1 -1
- package/build/src/api.d.ts +2 -2
- package/build/src/api.d.ts.map +1 -1
- package/build/src/api.js +3 -2
- package/build/src/api.js.map +1 -1
- package/build-web/HotStaq.js +2 -2
- package/build-web/HotStaq.min.js +363 -363
- package/package.json +1 -1
- package/src/HotRouteMethod.ts +36 -1
- package/src/HotStaq.ts +20 -3
- package/src/HotStaqRegisterComponent.ts +14 -4
- package/src/api.ts +4 -4
package/package.json
CHANGED
package/src/HotRouteMethod.ts
CHANGED
|
@@ -342,6 +342,41 @@ export interface TestCaseObject
|
|
|
342
342
|
func: TestCaseFunction;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Backwards-compat alias for the validator-name string. Re-introduced
|
|
347
|
+
* after 725eab8 removed it — `@hotstaq/userroute` and `@hotstaq/dataroute`
|
|
348
|
+
* still ship .d.ts files that import this name, so removing it breaks
|
|
349
|
+
* the TS build of every downstream package even when only the type
|
|
350
|
+
* surface changed and the runtime kept working.
|
|
351
|
+
*
|
|
352
|
+
* The enum values mirror the keys registered in HotStaq.valids[…]; any
|
|
353
|
+
* additional validator type can also be passed as a plain string.
|
|
354
|
+
*/
|
|
355
|
+
export enum HotValidationType
|
|
356
|
+
{
|
|
357
|
+
UUID = "UUID",
|
|
358
|
+
Boolean = "boolean",
|
|
359
|
+
Number = "number",
|
|
360
|
+
Integer = "Integer",
|
|
361
|
+
Float = "Float",
|
|
362
|
+
Text = "Text",
|
|
363
|
+
Email = "Email",
|
|
364
|
+
Phone = "Phone",
|
|
365
|
+
URL = "URL",
|
|
366
|
+
IPv4 = "IPv4",
|
|
367
|
+
IP = "IP",
|
|
368
|
+
IPv6 = "IPv6",
|
|
369
|
+
Date = "Date",
|
|
370
|
+
Object = "Object",
|
|
371
|
+
Array = "Array",
|
|
372
|
+
Map = "Map",
|
|
373
|
+
Enum = "Enum",
|
|
374
|
+
JSON = "JSON",
|
|
375
|
+
JS = "JS",
|
|
376
|
+
Undefined = "undefined",
|
|
377
|
+
Null = "null"
|
|
378
|
+
}
|
|
379
|
+
|
|
345
380
|
/**
|
|
346
381
|
* Is chained together to create a validation chain.
|
|
347
382
|
*/
|
|
@@ -351,7 +386,7 @@ export interface HotValidation
|
|
|
351
386
|
* The type of validation to perform.
|
|
352
387
|
* @default Text
|
|
353
388
|
*/
|
|
354
|
-
type?: string;
|
|
389
|
+
type?: string | HotValidationType;
|
|
355
390
|
/**
|
|
356
391
|
* The default value to set if the incoming input is null or undefined.
|
|
357
392
|
*/
|
package/src/HotStaq.ts
CHANGED
|
@@ -238,7 +238,7 @@ export class HotStaq implements IHotStaq
|
|
|
238
238
|
/**
|
|
239
239
|
* The current version of HotStaq.
|
|
240
240
|
*/
|
|
241
|
-
static version: string = "0.9.
|
|
241
|
+
static version: string = "0.9.21";
|
|
242
242
|
/**
|
|
243
243
|
* Indicates if this is a web build.
|
|
244
244
|
*/
|
|
@@ -1022,13 +1022,30 @@ export class HotStaq implements IHotStaq
|
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
1024
1024
|
/**
|
|
1025
|
-
* Parse a boolean value.
|
|
1025
|
+
* Parse a boolean value. Accepts:
|
|
1026
|
+
* - boolean (returned as-is — the previously-missing branch was
|
|
1027
|
+
* dropping `true` to `false` because the function fell through
|
|
1028
|
+
* to the bottom `return (false)` for `typeof value === "boolean"`)
|
|
1029
|
+
* - number / bigint (0 → false, anything else → true)
|
|
1030
|
+
* - string (case-insensitive "true"/"yes"/"yep" → true,
|
|
1031
|
+
* "false"/"no"/"nah" / "" → false)
|
|
1032
|
+
* - null / undefined → false
|
|
1033
|
+
* - anything else → false
|
|
1026
1034
|
*/
|
|
1027
|
-
static parseBoolean (value:
|
|
1035
|
+
static parseBoolean (value: any): boolean
|
|
1028
1036
|
{
|
|
1029
1037
|
if (value == null)
|
|
1030
1038
|
return (false);
|
|
1031
1039
|
|
|
1040
|
+
// `typeof true === "boolean"` — without this branch the function
|
|
1041
|
+
// fell through past the number/string arms to the trailing
|
|
1042
|
+
// `return (false)` on a literal boolean true. That silently
|
|
1043
|
+
// stripped boolean params validated through HotStaq.valids["boolean"]
|
|
1044
|
+
// because the validator calls parseBoolean on every value, including
|
|
1045
|
+
// JSON-booleans that arrive already-typed correctly.
|
|
1046
|
+
if (typeof (value) === "boolean")
|
|
1047
|
+
return (value);
|
|
1048
|
+
|
|
1032
1049
|
if ((typeof(value) === "number") || (typeof(value) === "bigint"))
|
|
1033
1050
|
{
|
|
1034
1051
|
if (value === 0)
|
|
@@ -121,12 +121,22 @@ export function registerComponent (tag: string, elementOptions: ElementDefinitio
|
|
|
121
121
|
htmlHandler = HotStaq.fixHTML (str);
|
|
122
122
|
|
|
123
123
|
let childrenToReadd: Node[] = [];
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
// Save the children from being replaced.
|
|
126
|
-
|
|
126
|
+
//
|
|
127
|
+
// Snapshot .children first (it's a live HTMLCollection that
|
|
128
|
+
// shrinks as we removeChild). Iterating the snapshot forward
|
|
129
|
+
// preserves source order in childrenToReadd, which the
|
|
130
|
+
// re-append loop below relies on. The previous reverse-index
|
|
131
|
+
// loop pushed nodes in reverse, then the forward-iterating
|
|
132
|
+
// re-append produced reversed children in the rendered DOM —
|
|
133
|
+
// e.g. <admin-form-field>s declared as [name, points, key]
|
|
134
|
+
// ended up rendered as [key, points, name].
|
|
135
|
+
const originalChildren: Node[] = Array.from (this.children);
|
|
136
|
+
for (let iIdx = 0; iIdx < originalChildren.length; iIdx++)
|
|
127
137
|
{
|
|
128
|
-
let child: Node =
|
|
129
|
-
|
|
138
|
+
let child: Node = originalChildren[iIdx];
|
|
139
|
+
|
|
130
140
|
childrenToReadd.push (this.removeChild (child));
|
|
131
141
|
}
|
|
132
142
|
|
package/src/api.ts
CHANGED
|
@@ -14,9 +14,9 @@ import { ValidationError, FalsyOptions, ValidationOptions } from "./HotProcessIn
|
|
|
14
14
|
// Server stuff
|
|
15
15
|
import { HotAPI, EventExecutionType, APItoLoad } from "./HotAPI";
|
|
16
16
|
import { HotRoute } from "./HotRoute";
|
|
17
|
-
import { HotRouteMethod, IHotRouteMethod, HotEventMethod, HotRouteMethodParameter,
|
|
18
|
-
ServerAuthorizationFunction, ServerExecutionFunction, PassType,
|
|
19
|
-
ServerRequest, IServerRequest, HotValidation } from "./HotRouteMethod";
|
|
17
|
+
import { HotRouteMethod, IHotRouteMethod, HotEventMethod, HotRouteMethodParameter,
|
|
18
|
+
ServerAuthorizationFunction, ServerExecutionFunction, PassType,
|
|
19
|
+
ServerRequest, IServerRequest, HotValidation, HotValidationType } from "./HotRouteMethod";
|
|
20
20
|
import { HotServer, HotServerType } from "./HotServer";
|
|
21
21
|
import { StaticRoute, HTTPHeader, ServableFileExtension, HotHTTPServer } from "./HotHTTPServer";
|
|
22
22
|
import { HotMCPServer } from "./HotMCPServer";
|
|
@@ -95,7 +95,7 @@ export {
|
|
|
95
95
|
HotEventMethod, HotRouteMethodParameter, PassType,
|
|
96
96
|
ServerAuthorizationFunction,
|
|
97
97
|
ServerExecutionFunction,
|
|
98
|
-
IServerRequest, HotValidation,
|
|
98
|
+
IServerRequest, HotValidation, HotValidationType,
|
|
99
99
|
ServerRequest,
|
|
100
100
|
HotServer,
|
|
101
101
|
HotServerType,
|