toilscript 0.1.20 → 0.1.22

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.20/dist/toilscript.js",
4
- "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.20/dist/cli.js",
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",
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
  }
@@ -3014,6 +3014,18 @@ declare module "types:toilscript/src/parser" {
3014
3014
  * return; plus a module-level self-registration into the runtime `Rest` router.
3015
3015
  */
3016
3016
  private injectRestController;
3017
+ /**
3018
+ * Bind a `@user` class to `AuthService.getUser()` typing. The lib declares
3019
+ * `getUser(): AuthUser | null`; here we inject a `@global` `AuthUser` that
3020
+ * extends the user's class, so `AuthService.getUser()` is auto-typed with the
3021
+ * user's fields and NO type argument. `AuthUser` is a no-field subclass, so
3022
+ * the decode bridge's `changetype` is an identity. There is exactly one
3023
+ * authenticated-user type per program; a second `@user` produces a duplicate
3024
+ * `AuthUser` (a natural compile error).
3025
+ */
3026
+ private injectUserBinding;
3027
+ /** True if `decorators` carries a decorator of `kind` (e.g. `@auth`). */
3028
+ private hasDecoratorKind;
3017
3029
  /** The mount prefix from `@rest("api")` -> "/api"; "" for the bare/object form (root). */
3018
3030
  private restPrefixOf;
3019
3031
  /** The class-default stream from `@rest({ stream: DataStream.Binary })`, else "JSON". */
@@ -3022,6 +3034,16 @@ declare module "types:toilscript/src/parser" {
3022
3034
  private routeDecoratorOf;
3023
3035
  /** Generate one `if (method && path-match) { decode; call; encode }` route block. */
3024
3036
  private buildRouteBlock;
3037
+ /**
3038
+ * The `.cache(...)` suffix to append to a route's `Response` when the
3039
+ * handler method carries `@cache(...)`, else `""`. Only integer and
3040
+ * boolean literal arguments are accepted (the parameters of
3041
+ * `Response.cache(edgeTtlMinutes, browserTtlSeconds?, privateScope?,
3042
+ * allowAuth?)`); any other argument shape yields `""` so a malformed
3043
+ * decorator degrades to "not cached" rather than miscompiling. Each arg
3044
+ * is emitted from its verbatim source text.
3045
+ */
3046
+ private cacheSuffixOf;
3025
3047
  /** Find an object-literal field value by name, or null. */
3026
3048
  private objectField;
3027
3049
  /** The member of an enum access expression (`Methods.GET` -> "GET"), or null. */
@@ -7769,7 +7791,10 @@ declare module "types:toilscript/src/ast" {
7769
7791
  Delete = 23,
7770
7792
  Patch = 24,
7771
7793
  Head = 25,
7772
- Options = 26
7794
+ Options = 26,
7795
+ Cache = 27,
7796
+ Auth = 28,
7797
+ User = 29
7773
7798
  }
7774
7799
  export namespace DecoratorKind {
7775
7800
  /** Returns the kind of the specified decorator name node. Defaults to {@link DecoratorKind.CUSTOM}. */