toilscript 0.1.22 → 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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "imports": {
3
- "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.22/dist/toilscript.js",
4
- "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.22/dist/cli.js",
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. */
@@ -3044,6 +3048,24 @@ declare module "types:toilscript/src/parser" {
3044
3048
  * is emitted from its verbatim source text.
3045
3049
  */
3046
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;
3047
3069
  /** Find an object-literal field value by name, or null. */
3048
3070
  private objectField;
3049
3071
  /** The member of an enum access expression (`Methods.GET` -> "GET"), or null. */
@@ -7794,7 +7816,8 @@ declare module "types:toilscript/src/ast" {
7794
7816
  Options = 26,
7795
7817
  Cache = 27,
7796
7818
  Auth = 28,
7797
- User = 29
7819
+ User = 29,
7820
+ Ratelimit = 30
7798
7821
  }
7799
7822
  export namespace DecoratorKind {
7800
7823
  /** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */