toilscript 0.1.21 → 0.1.23
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/dist/cli.generated.d.ts +49 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +49 -1
- package/dist/toilscript.js +66 -27
- package/dist/toilscript.js.map +3 -3
- package/dist/web.js +3 -3
- package/package.json +1 -1
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.23/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.23/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
|
@@ -2954,6 +2954,10 @@ declare module "types:toilscript/src/parser" {
|
|
|
2954
2954
|
dependees: Map<string, Dependee>;
|
|
2955
2955
|
/** Normalized paths whose `@rest` runtime import has already been injected. */
|
|
2956
2956
|
restImportedSources: Set<string>;
|
|
2957
|
+
/** Monotonic id handed to each `@ratelimit` route so the edge can key one
|
|
2958
|
+
* shared limiter per route. Program-wide (one Parser per program), assigned
|
|
2959
|
+
* deterministically in route declaration order. */
|
|
2960
|
+
ratelimitRouteCounter: number;
|
|
2957
2961
|
/** An array of parsed sources. */
|
|
2958
2962
|
sources: Source[];
|
|
2959
2963
|
/** Current overridden module name. */
|
|
@@ -3014,6 +3018,18 @@ declare module "types:toilscript/src/parser" {
|
|
|
3014
3018
|
* return; plus a module-level self-registration into the runtime `Rest` router.
|
|
3015
3019
|
*/
|
|
3016
3020
|
private injectRestController;
|
|
3021
|
+
/**
|
|
3022
|
+
* Bind a `@user` class to `AuthService.getUser()` typing. The lib declares
|
|
3023
|
+
* `getUser(): AuthUser | null`; here we inject a `@global` `AuthUser` that
|
|
3024
|
+
* extends the user's class, so `AuthService.getUser()` is auto-typed with the
|
|
3025
|
+
* user's fields and NO type argument. `AuthUser` is a no-field subclass, so
|
|
3026
|
+
* the decode bridge's `changetype` is an identity. There is exactly one
|
|
3027
|
+
* authenticated-user type per program; a second `@user` produces a duplicate
|
|
3028
|
+
* `AuthUser` (a natural compile error).
|
|
3029
|
+
*/
|
|
3030
|
+
private injectUserBinding;
|
|
3031
|
+
/** True if `decorators` carries a decorator of `kind` (e.g. `@auth`). */
|
|
3032
|
+
private hasDecoratorKind;
|
|
3017
3033
|
/** The mount prefix from `@rest("api")` -> "/api"; "" for the bare/object form (root). */
|
|
3018
3034
|
private restPrefixOf;
|
|
3019
3035
|
/** The class-default stream from `@rest({ stream: DataStream.Binary })`, else "JSON". */
|
|
@@ -3022,6 +3038,34 @@ declare module "types:toilscript/src/parser" {
|
|
|
3022
3038
|
private routeDecoratorOf;
|
|
3023
3039
|
/** Generate one `if (method && path-match) { decode; call; encode }` route block. */
|
|
3024
3040
|
private buildRouteBlock;
|
|
3041
|
+
/**
|
|
3042
|
+
* The `.cache(...)` suffix to append to a route's `Response` when the
|
|
3043
|
+
* handler method carries `@cache(...)`, else `""`. Only integer and
|
|
3044
|
+
* boolean literal arguments are accepted (the parameters of
|
|
3045
|
+
* `Response.cache(edgeTtlMinutes, browserTtlSeconds?, privateScope?,
|
|
3046
|
+
* allowAuth?)`); any other argument shape yields `""` so a malformed
|
|
3047
|
+
* decorator degrades to "not cached" rather than miscompiling. Each arg
|
|
3048
|
+
* is emitted from its verbatim source text.
|
|
3049
|
+
*/
|
|
3050
|
+
private cacheSuffixOf;
|
|
3051
|
+
/**
|
|
3052
|
+
* The rate-limit guard to prepend to a route block when the handler carries
|
|
3053
|
+
* `@ratelimit(strategy, limit, window)`, else `""`. `strategy` is a member of
|
|
3054
|
+
* the `RateLimit` enum (`FixedWindow`/`SlidingWindow`/`TokenBucket`) or a bare
|
|
3055
|
+
* integer tag; `limit` and `window` must be integer literals (mirrors
|
|
3056
|
+
* `@cache`). Lowers to a single ambient `RateLimitService.guard(...)` call that
|
|
3057
|
+
* returns a `429` `Response` when over the limit, or `null` to proceed. A
|
|
3058
|
+
* malformed decorator yields `""` (no guard) rather than miscompiling.
|
|
3059
|
+
*/
|
|
3060
|
+
private ratelimitGuardOf;
|
|
3061
|
+
/**
|
|
3062
|
+
* The integer strategy tag to emit for a `@ratelimit` strategy argument:
|
|
3063
|
+
* `RateLimit.SlidingWindow` -> "1", `RateLimit.TokenBucket` -> "2", any other
|
|
3064
|
+
* member (incl. `FixedWindow`) -> "0", an explicit integer literal passes
|
|
3065
|
+
* through verbatim (the host clamps an unknown tag to FixedWindow). Returns
|
|
3066
|
+
* "" when the argument is neither, so the caller emits no guard.
|
|
3067
|
+
*/
|
|
3068
|
+
private ratelimitStrategyTag;
|
|
3025
3069
|
/** Find an object-literal field value by name, or null. */
|
|
3026
3070
|
private objectField;
|
|
3027
3071
|
/** The member of an enum access expression (`Methods.GET` -> "GET"), or null. */
|
|
@@ -7769,7 +7813,11 @@ declare module "types:toilscript/src/ast" {
|
|
|
7769
7813
|
Delete = 23,
|
|
7770
7814
|
Patch = 24,
|
|
7771
7815
|
Head = 25,
|
|
7772
|
-
Options = 26
|
|
7816
|
+
Options = 26,
|
|
7817
|
+
Cache = 27,
|
|
7818
|
+
Auth = 28,
|
|
7819
|
+
User = 29,
|
|
7820
|
+
Ratelimit = 30
|
|
7773
7821
|
}
|
|
7774
7822
|
export namespace DecoratorKind {
|
|
7775
7823
|
/** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */
|