@happyvertical/smrt-core 0.46.0 → 0.47.1

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 (90) hide show
  1. package/AGENTS.md +39 -0
  2. package/agents/generators.md +19 -5
  3. package/agents/system-diagnostics.md +43 -0
  4. package/dist/browser.js +2 -1
  5. package/dist/change-feed.d.ts +8 -0
  6. package/dist/change-feed.d.ts.map +1 -1
  7. package/dist/change-feed.js +1 -1
  8. package/dist/change-feed.js.map +1 -1
  9. package/dist/decorators/compatibility.d.ts +46 -0
  10. package/dist/decorators/compatibility.d.ts.map +1 -1
  11. package/dist/decorators/compatibility.js +48 -5
  12. package/dist/decorators/compatibility.js.map +1 -1
  13. package/dist/decorators/index.d.ts +119 -1
  14. package/dist/decorators/index.d.ts.map +1 -1
  15. package/dist/decorators/index.js +52 -8
  16. package/dist/decorators/index.js.map +1 -1
  17. package/dist/generators/custom-action.d.ts +379 -2
  18. package/dist/generators/custom-action.d.ts.map +1 -1
  19. package/dist/generators/custom-action.js +694 -17
  20. package/dist/generators/custom-action.js.map +1 -1
  21. package/dist/generators/index.d.ts +1 -1
  22. package/dist/generators/index.d.ts.map +1 -1
  23. package/dist/generators/index.js +2 -2
  24. package/dist/generators/preflight-route.d.ts +12 -10
  25. package/dist/generators/preflight-route.d.ts.map +1 -1
  26. package/dist/generators/preflight-route.js +46 -14
  27. package/dist/generators/preflight-route.js.map +1 -1
  28. package/dist/generators/rest.d.ts +44 -0
  29. package/dist/generators/rest.d.ts.map +1 -1
  30. package/dist/generators/rest.js +84 -9
  31. package/dist/generators/rest.js.map +1 -1
  32. package/dist/generators.js +2 -2
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +5 -4
  36. package/dist/knowledge.d.ts.map +1 -1
  37. package/dist/knowledge.js +59 -15
  38. package/dist/knowledge.js.map +1 -1
  39. package/dist/manifest/static-manifest.d.ts.map +1 -1
  40. package/dist/manifest/static-manifest.js +125 -53
  41. package/dist/manifest/static-manifest.js.map +1 -1
  42. package/dist/manifest/store.js +1 -1
  43. package/dist/manifest/store.js.map +1 -1
  44. package/dist/manifest.json +184 -53
  45. package/dist/postgres-permissions.d.ts +9 -1
  46. package/dist/postgres-permissions.d.ts.map +1 -1
  47. package/dist/postgres-permissions.js +127 -13
  48. package/dist/postgres-permissions.js.map +1 -1
  49. package/dist/registry/index.d.ts +1 -1
  50. package/dist/registry/index.d.ts.map +1 -1
  51. package/dist/registry/shared-state.d.ts +19 -0
  52. package/dist/registry/shared-state.d.ts.map +1 -1
  53. package/dist/registry/shared-state.js +16 -1
  54. package/dist/registry/shared-state.js.map +1 -1
  55. package/dist/registry.d.ts +136 -1
  56. package/dist/registry.d.ts.map +1 -1
  57. package/dist/registry.js +231 -1
  58. package/dist/registry.js.map +1 -1
  59. package/dist/scanner/manifest-generator.d.ts.map +1 -1
  60. package/dist/scanner/manifest-generator.js +18 -16
  61. package/dist/scanner/manifest-generator.js.map +1 -1
  62. package/dist/scanner/types.d.ts +59 -6
  63. package/dist/scanner/types.d.ts.map +1 -1
  64. package/dist/scanner/types.js.map +1 -1
  65. package/dist/smrt-knowledge.json +42 -35
  66. package/dist/system/diagnostics.d.ts +299 -0
  67. package/dist/system/diagnostics.d.ts.map +1 -0
  68. package/dist/system/diagnostics.js +530 -0
  69. package/dist/system/diagnostics.js.map +1 -0
  70. package/dist/system/index.d.ts +1 -0
  71. package/dist/system/index.d.ts.map +1 -1
  72. package/dist/system/index.js +2 -1
  73. package/dist/utils/scanner-module.d.ts +16 -0
  74. package/dist/utils/scanner-module.d.ts.map +1 -1
  75. package/dist/vite-plugin/api-client-entries.d.ts.map +1 -1
  76. package/dist/vite-plugin/api-client-entries.js +10 -8
  77. package/dist/vite-plugin/api-client-entries.js.map +1 -1
  78. package/dist/vite-plugin/index.d.ts +34 -1
  79. package/dist/vite-plugin/index.d.ts.map +1 -1
  80. package/dist/vite-plugin/index.js +82 -3
  81. package/dist/vite-plugin/index.js.map +1 -1
  82. package/dist/vite-plugin/sveltekit-generator.d.ts +28 -2
  83. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
  84. package/dist/vite-plugin/sveltekit-generator.js +121 -51
  85. package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
  86. package/dist/vite-plugin/web-collections.d.ts.map +1 -1
  87. package/dist/vite-plugin/web-collections.js +1 -1
  88. package/dist/vite-plugin/web-collections.js.map +1 -1
  89. package/dist/vite-plugin.js +2 -2
  90. package/package.json +16 -11
@@ -1,5 +1,5 @@
1
- import { ToolEffect } from '../registry/types.js';
2
- import { MethodDefinition } from '../scanner/types.js';
1
+ import { ApiHttpMethod, ToolEffect } from '../registry/types.js';
2
+ import { MethodDefinition, SmartObjectManifest } from '../scanner/types.js';
3
3
  export type CustomActionScope = 'item' | 'collection';
4
4
  export type { ToolEffect } from '../registry/types.js';
5
5
  /**
@@ -279,6 +279,11 @@ export interface ResolveCustomActionMetadataOptions {
279
279
  method?: {
280
280
  isStatic?: boolean;
281
281
  parameters?: MethodDefinition['parameters'];
282
+ /**
283
+ * The method's `@method()` config, whose options win field by field over
284
+ * the class-level `api.routes` entry for the same action (#2686).
285
+ */
286
+ decoratorConfig?: Record<string, unknown>;
282
287
  };
283
288
  apiConfig?: unknown;
284
289
  /** Collection-class actions have a collection receiver even when non-static. */
@@ -292,6 +297,23 @@ type ToolArgs = Record<string, unknown>;
292
297
  * schema; runtime callers may still provide their legacy collection fallback.
293
298
  */
294
299
  export declare function resolveCustomActionMetadata(options: ResolveCustomActionMetadataOptions): ResolvedCustomActionMetadata;
300
+ /**
301
+ * The declared scope, when it contradicts the receiver the method actually
302
+ * has; `undefined` when there is no declaration or it agrees.
303
+ *
304
+ * A scope is a DECLARATION about a method, not a relocation of it: nothing in
305
+ * a config can move an instance method onto the class. Silently ignoring a
306
+ * contradiction leaves an author believing a route exists at a collection URL
307
+ * that was never written, so the generators report this at build time
308
+ * (#2686).
309
+ */
310
+ export declare function resolveDeclaredScopeMismatch(options: {
311
+ actionName: string;
312
+ method?: ExposableMethod;
313
+ apiConfig?: unknown;
314
+ /** The receiver-derived scope, as the emitter computed it. */
315
+ effectiveScope: CustomActionScope;
316
+ }): CustomActionScope | undefined;
295
317
  /** Build the custom-action portion of an MCP/WebMCP JSON Schema. */
296
318
  export declare function buildCustomActionInputSchema(metadata: CustomActionMetadata): JsonSchema;
297
319
  /**
@@ -322,4 +344,359 @@ export declare const SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY = "io.happyvertical/s
322
344
  * REST callers receive non-2xx semantics even when an adapter omits it.
323
345
  */
324
346
  export declare function normalizeCustomActionFailure(value: unknown): CustomActionFailure | undefined;
347
+ /**
348
+ * The `@method()` decorator's options, as they reach a consumer.
349
+ *
350
+ * Narrowed from the manifest's untyped `MethodDefinition.decoratorConfig` by
351
+ * {@link readMethodDecoratorConfig}. The authoring type is `MethodOptions` in
352
+ * `decorators/index.ts`; this is the read side, and it is deliberately
353
+ * defensive — every field is validated, and a malformed one is dropped rather
354
+ * than trusted, the same stance `readConfiguredToolMetadata` takes for a
355
+ * scanned `api.routes` entry.
356
+ */
357
+ export interface MethodDecoratorConfig {
358
+ /**
359
+ * `false` withholds a method the wire-ability heuristic accepted; `true`
360
+ * exposes one it rejected.
361
+ *
362
+ * `true` bypasses the HEURISTIC only. It cannot manufacture a receiver, undo
363
+ * `api: false`, escape an `include`/`exclude` boundary, reach a non-public
364
+ * method, or claim a CRUD verb the generated operation already owns — and it
365
+ * does not hydrate a parameter the transport cannot build (a model instance
366
+ * still arrives as whatever JSON the caller sent).
367
+ */
368
+ expose?: boolean;
369
+ /** Why the method is withheld. Reported by the knowledge artifact. */
370
+ reason?: string;
371
+ /** HTTP verb for the generated route. Migrates from `api.routes[m].method`. */
372
+ httpMethod?: ApiHttpMethod;
373
+ /** Route path segment(s). Migrates from `api.routes[m].path`. */
374
+ path?: string;
375
+ /**
376
+ * Declared receiver scope. Migrates from `api.routes[m].scope`.
377
+ *
378
+ * DECLARATIVE, not relocating: the executable receiver decides (an instance
379
+ * method is item-scoped, a static or collection-class method is
380
+ * collection-scoped), exactly as `api.routes[m].scope` already behaves. A
381
+ * mismatch keeps the receiver and reports a diagnostic.
382
+ */
383
+ scope?: CustomActionScope;
384
+ /** Browser/agent-visible effect. Migrates from `api.routes[m].effect`. */
385
+ effect?: ToolEffect;
386
+ /** Whether repeating the action with the same arguments is safe. */
387
+ idempotent?: boolean;
388
+ /** Whether the action may interact outside the SMRT application. */
389
+ openWorld?: boolean;
390
+ /** AI/tool description. Migrates from `ai.descriptions[m]`. */
391
+ description?: string;
392
+ }
393
+ /**
394
+ * The only parameter facts the wire-ability test reads.
395
+ *
396
+ * Deliberately looser than the manifest's `MethodParameterDefinition`: callers
397
+ * outside the vite plugin hold their own structural view of a registered
398
+ * method (`@happyvertical/smrt-users`' `MethodLike`, for one) and must be able
399
+ * to ask this question without first widening their type to the manifest's.
400
+ */
401
+ export interface WireableParameter {
402
+ name: string;
403
+ type?: string | undefined;
404
+ /** See `MethodParameterDefinition.typeUnresolved`. */
405
+ typeUnresolved?: boolean | undefined;
406
+ /** See `MethodParameterDefinition.memberTypes`. */
407
+ memberTypes?: readonly string[] | undefined;
408
+ /**
409
+ * See `MethodParameterDefinition.unionBranches`. Preferred over
410
+ * `memberTypes` when present: it keeps each union branch's members attached
411
+ * to that branch instead of flattening them together (#2686).
412
+ */
413
+ unionBranches?: readonly {
414
+ type: string;
415
+ memberTypes?: readonly string[] | undefined;
416
+ }[] | undefined;
417
+ }
418
+ /** Minimal method shape the exposure resolver reads. */
419
+ export interface ExposableMethod {
420
+ isPublic?: boolean;
421
+ isStatic?: boolean;
422
+ parameters?: readonly WireableParameter[] | undefined;
423
+ decoratorConfig?: Record<string, unknown>;
424
+ }
425
+ /**
426
+ * Read and validate the `@method()` config the scanner put on a manifest
427
+ * method. Returns `undefined` for an undecorated method.
428
+ */
429
+ export declare function readMethodDecoratorConfig(method: ExposableMethod | undefined): MethodDecoratorConfig | undefined;
430
+ /** Options that let the wire-ability test consult the surrounding manifest. */
431
+ export interface WireabilityOptions {
432
+ /**
433
+ * True when `name` identifies a class the manifest knows about — a model,
434
+ * collection, or junction. Such a parameter wants a live instance with
435
+ * methods and a database binding; JSON cannot produce one.
436
+ *
437
+ * OPTIONAL, and its absence is a documented widening: without a class
438
+ * inventory the test cannot distinguish `Asset` from `AssetOptions`, so it
439
+ * accepts both — and because every OTHER rejection still applies, the caller
440
+ * then disagrees with the emitters on exactly the largest group of withheld
441
+ * methods. Build it with {@link createManifestClassNamePredicate} from a
442
+ * manifest, or {@link createClassNamePredicate} from a live registry's class
443
+ * names. The parameter stays optional only because `resolveApiActionSet`'s
444
+ * arguments are public API and optional there.
445
+ */
446
+ isModelClassName?: (name: string) => boolean;
447
+ }
448
+ /** Result of testing one method (or one parameter) for wire-ability. */
449
+ export interface WireabilityVerdict {
450
+ wireable: boolean;
451
+ /** Present only when `wireable` is false. */
452
+ reason?: string;
453
+ }
454
+ /**
455
+ * Build the `isModelClassName` predicate {@link classifyMethodWireability}
456
+ * needs, from a manifest.
457
+ *
458
+ * Both the SIMPLE and QUALIFIED name of every manifest class are registered: a
459
+ * parameter is annotated with the simple name in source, but a qualified name
460
+ * can reach the predicate through a `TSQualifiedName` annotation.
461
+ *
462
+ * Returns `undefined` for a missing manifest, which widens the gate — see
463
+ * {@link WireabilityOptions.isModelClassName}.
464
+ */
465
+ export declare function createManifestClassNamePredicate(manifest: SmartObjectManifest | undefined): ((name: string) => boolean) | undefined;
466
+ /**
467
+ * The same predicate from a bare name list, for a caller whose class inventory
468
+ * is the live `ObjectRegistry` rather than a manifest — notably
469
+ * `@happyvertical/smrt-users`' CLI resource listing, which iterates
470
+ * `ObjectRegistry.getAllClasses()` and has no manifest to hand.
471
+ *
472
+ * Exported so that caller does not grow its own copy: without a predicate the
473
+ * gate half-applies (every rejection EXCEPT model instances), which is worse
474
+ * than either extreme because the consumer then disagrees with the emitters on
475
+ * exactly the largest group of withheld methods.
476
+ */
477
+ export declare function createClassNamePredicate(names: Iterable<string>): (name: string) => boolean;
478
+ /**
479
+ * Whether one declared parameter can be built from a JSON request body or
480
+ * query string.
481
+ */
482
+ export declare function classifyParameterWireability(parameter: WireableParameter, options?: WireabilityOptions): WireabilityVerdict;
483
+ /**
484
+ * Whether every declared parameter of a method can be built from a JSON
485
+ * request body or query string.
486
+ *
487
+ * A method with NO manifest parameter metadata is wire-able: that is the
488
+ * legacy options-bag contract every transport already supports, and absent
489
+ * metadata is not evidence of a hostile signature.
490
+ */
491
+ export declare function classifyMethodWireability(method: Pick<ExposableMethod, 'parameters'>, options?: WireabilityOptions): WireabilityVerdict;
492
+ /**
493
+ * Why a public method is not reachable as a generated API action.
494
+ *
495
+ * Machine-readable so callers can react differently per cause: the route
496
+ * emitters warn on `no-receiver` (a configuration mistake worth shouting
497
+ * about) and stay quiet on the rest, while the knowledge artifact reports the
498
+ * accompanying `reason` text for every one of them (#2686).
499
+ */
500
+ export type ApiMethodRejectionCode = 'api-disabled' | 'crud-reserved' | 'not-public' | 'lifecycle-method' | 'excluded' | 'not-included' | 'withheld' | 'not-wireable' | 'no-receiver';
501
+ /** Verdict of {@link resolveApiMethodExposure}. */
502
+ export interface ApiMethodExposure {
503
+ exposed: boolean;
504
+ /** Present only when `exposed` is false. */
505
+ code?: ApiMethodRejectionCode;
506
+ /** Human-readable explanation, present only when `exposed` is false. */
507
+ reason?: string;
508
+ }
509
+ export interface ResolveApiMethodExposureOptions extends WireabilityOptions {
510
+ actionName: string;
511
+ method: ExposableMethod;
512
+ /** The class's scanned `api` config (`decoratorConfig.api`). */
513
+ apiConfig?: unknown;
514
+ /**
515
+ * True when the HOST is a collection class, which emits only
516
+ * collection-scoped routes. Drives the receiver check.
517
+ */
518
+ isCollectionClass?: boolean;
519
+ }
520
+ /**
521
+ * The single decision every generated-API consumer asks: is this method
522
+ * reachable as a custom REST action, and if not, why?
523
+ *
524
+ * ONE resolver, four consumers — both SvelteKit route emitters
525
+ * (`generateRoutesForObject`, `generateCollectionRoutesForObject`), the
526
+ * cli↔api coherence resolver (`resolveApiActionSet`), and the knowledge
527
+ * artifact's API projection. They previously each re-derived a subset: the
528
+ * emitters filtered on `shouldIncludeInApi` plus their own receiver skip,
529
+ * `resolveApiActionSet` mirrored both, and `knowledge.ts` mirrored the
530
+ * receiver half a third time. A gate added to only one of them would report a
531
+ * method as unavailable while still writing its route file, which is the exact
532
+ * incoherence this issue exists to close (#2686).
533
+ *
534
+ * Order matters, and is the tested precedence contract:
535
+ *
536
+ * 1. `api: false` — the class has no REST surface at all.
537
+ * 2. A CRUD verb — the generated operation already owns the name (#2646).
538
+ * 3. Non-public — never a surface.
539
+ * 4. A framework lifecycle method (`save`, `initialize`, `toJSON`, ...) — the
540
+ * mechanism behind generated CRUD, not a distinct operation, even when a
541
+ * subclass declares its own override. `CLIGenerator` and `MCPGenerator`
542
+ * already gate on this; REST did not, and this is where it joins them
543
+ * (#2638, #2657).
544
+ * 5. `api.exclude` — an explicit withdrawal.
545
+ * 6. `api.include` — an explicit allowlist boundary.
546
+ * 7. `@method({ expose: false })` — an explicit withdrawal that outranks every
547
+ * remaining rule, including a legacy `api.routes` entry for the same
548
+ * method. This is why the decorator is `@method()` and not `@action()`:
549
+ * declaring something an action in order to say it is not one contradicts
550
+ * itself.
551
+ * 8. Explicit legacy exposure — a name listed in `api.include` or carrying an
552
+ * `api.routes` entry is a DECLARATION that this method is a route, made
553
+ * before the heuristic existed. It bypasses the heuristic. This is the
554
+ * documented compatibility exception that makes "nothing breaks" true for
555
+ * the 42 existing route entries; without it, migrating a class to the new
556
+ * gate could silently drop a route its author had spelled out.
557
+ * 9. `@method({ expose: true })` — bypasses the heuristic, and NOTHING else.
558
+ * It cannot manufacture a receiver (step 10 still applies), reach a
559
+ * non-public method, or hydrate a parameter the transport cannot build.
560
+ * 10. Wire-ability — every parameter must be constructible from JSON.
561
+ * 11. Receiver — a collection class emits only collection-scoped routes, and a
562
+ * model class cannot host a collection-scoped instance method.
563
+ */
564
+ export declare function resolveApiMethodExposure(options: ResolveApiMethodExposureOptions): ApiMethodExposure;
565
+ /**
566
+ * The effective route/tool metadata for one custom action, with `@method()`
567
+ * winning FIELD BY FIELD over the class-level `api.routes` map and
568
+ * `ai.descriptions`.
569
+ *
570
+ * Field-by-field, not wholesale: `@method({ description: '...' })` on a class
571
+ * that already declares `routes: { runReview: { method: 'POST', path:
572
+ * 'reviews' } }` must not silently reset that verb and path to their defaults.
573
+ * Only options the decorator actually supplies override their legacy
574
+ * counterparts (#2686).
575
+ */
576
+ export interface EffectiveActionMetadata {
577
+ httpMethod?: ApiHttpMethod;
578
+ path?: string;
579
+ scope?: CustomActionScope;
580
+ effect?: ToolEffect;
581
+ idempotent?: boolean;
582
+ openWorld?: boolean;
583
+ description?: string;
584
+ }
585
+ export declare function resolveEffectiveActionMetadata(options: {
586
+ actionName: string;
587
+ method?: ExposableMethod;
588
+ apiConfig?: unknown;
589
+ aiConfig?: unknown;
590
+ }): EffectiveActionMetadata;
591
+ /**
592
+ * Whether a method's `@method()` declaration is also a RUNTIME REST route
593
+ * declaration, the way an `api.routes[m]` entry is.
594
+ *
595
+ * The runtime `APIGenerator` transport is deliberately declaration-gated: it
596
+ * serves a custom collection action only where one was declared, because its URL
597
+ * shape supports a single segment and an undeclared public method has never had
598
+ * a route there. `dispatchCustomCollectionAction` and the `isRestActionRoutable`
599
+ * preflight prediction must agree on that gate exactly, so both read this (#2686).
600
+ *
601
+ * True for any option that migrates from `ApiCustomRouteConfig` — its complete
602
+ * field set is `scope`, `method`, `path`, `effect`, `idempotent`, `openWorld` —
603
+ * because a legacy `routes: { m: { effect: 'write' } }` entry with no path or
604
+ * verb already dispatches at `POST /<collection>/m`, and migrating it onto the
605
+ * method must not silently delete that endpoint. Also true for an explicit
606
+ * `expose: true`, which is a stronger statement that the method is an action
607
+ * than an empty route entry is.
608
+ *
609
+ * FALSE for a bare `@method()` and for a `description`-only one. Neither
610
+ * migrates from a route entry — `description` migrates from `ai.descriptions`,
611
+ * and a bare decorator is a review marker — so counting them would hand the
612
+ * runtime transport endpoints it never served.
613
+ */
614
+ export declare function declaresRuntimeRestRoute(method: ExposableMethod | undefined): boolean;
615
+ /**
616
+ * Whether the author WROTE a runtime REST route declaration on this method,
617
+ * ignoring whether they then withheld it.
618
+ *
619
+ * Deliberately distinct from {@link declaresRuntimeRestRoute}: the dispatcher
620
+ * must still SEE a withheld declaration in order to refuse it explicitly. This
621
+ * router resolves `POST /<collection>/<segment>` to `create` when nothing
622
+ * claims the segment, so dropping a withheld action from the candidate set
623
+ * would turn a request aimed at an explicitly withheld operation into a silent
624
+ * row insert. The candidate set reads this; the preflight PREDICTION reads
625
+ * {@link declaresRuntimeRestRoute}, which adds the `expose: false` veto —
626
+ * "there is a declaration here" and "it is reachable" are different questions.
627
+ */
628
+ export declare function declaresRuntimeRestRouteShape(method: ExposableMethod | undefined): boolean;
629
+ /**
630
+ * Coerce one transport-supplied argument into the runtime value the declared
631
+ * parameter type needs.
632
+ *
633
+ * Today that means exactly one conversion: a `Date` parameter, which the
634
+ * wire-ability heuristic accepts as JSON-shaped. JSON has no date type, so a
635
+ * caller can only send an ISO string (or an epoch number) and the receiving
636
+ * method — which calls `getTime()`, or hands the value to a query builder that
637
+ * expects a `Date` — would otherwise get a string. Accepting `Date` as
638
+ * wire-able and NOT hydrating it here would generate a route that 500s, so the
639
+ * two are one decision (#2686).
640
+ *
641
+ * Deliberately narrow:
642
+ * - Only a TOP-LEVEL declared parameter is converted. A `Date` nested inside a
643
+ * named options bag is invisible to the manifest (the bag is accepted
644
+ * heuristically, its members unresolved), so it is not hydrated and the
645
+ * method must accept the string itself.
646
+ * - An already-`Date` value, and anything that is not a string or finite
647
+ * number, passes through untouched, so a runtime caller invoking the same
648
+ * helper is never degraded.
649
+ * - An unparseable string passes through as-is rather than becoming an
650
+ * `Invalid Date`, leaving the method's own validation in charge of the error
651
+ * message.
652
+ */
653
+ export declare function coerceCustomActionArgument(value: unknown, declaredType: string | undefined): unknown;
654
+ /**
655
+ * The `Date` half of {@link coerceCustomActionArgument}, exported on its own
656
+ * because generated SvelteKit route code calls it directly: the generator
657
+ * already knows at build time which parameters are `Date`-typed, so the
658
+ * emitted handler names the conversion rather than re-deriving it from a type
659
+ * string at runtime. Both paths share this one implementation so the two
660
+ * transports cannot drift.
661
+ */
662
+ export declare function toCustomActionDate(value: unknown): unknown;
663
+ /**
664
+ * Decode a `number`-typed action argument that arrived over a QUERY STRING.
665
+ *
666
+ * A GET handler builds its options from `URLSearchParams`, so every value is a
667
+ * string: `limit: number` reached the method as `'2'` and any arithmetic on it
668
+ * silently produced string concatenation or `NaN` (#2686). A JSON body needs no
669
+ * such repair, which is why this is emitted only on GET routes.
670
+ *
671
+ * Leaves anything it cannot decode alone, so a malformed value reaches the
672
+ * method's own validation rather than becoming a silent `NaN`.
673
+ */
674
+ export declare function toCustomActionNumber(value: unknown): unknown;
675
+ /**
676
+ * The `boolean` counterpart to {@link toCustomActionNumber}. A query string
677
+ * carries `?active=false`, and the bare string `'false'` is TRUTHY — the most
678
+ * dangerous of these coercions, since it inverts a guard rather than degrading
679
+ * it. Only the four canonical spellings decode; anything else is left for the
680
+ * method's own validation.
681
+ */
682
+ export declare function toCustomActionBoolean(value: unknown): unknown;
683
+ /**
684
+ * The query-string decoder a GET route should apply to one parameter, or
685
+ * `undefined` when the value passes through untouched.
686
+ *
687
+ * Mirrors {@link declaredTypeAcceptsDate}: a nullish branch does not change the
688
+ * representation, but a genuine alternative (`number | string`) means the
689
+ * method already accepts what the query string sends, so nothing is decoded.
690
+ */
691
+ export declare function queryStringDecoderFor(declaredType: string | undefined): 'toCustomActionDate' | 'toCustomActionNumber' | 'toCustomActionBoolean' | undefined;
692
+ /**
693
+ * True when the declared type is a `Date` and nothing else.
694
+ *
695
+ * `Date | null` and `Date | undefined` qualify — a nullish branch is not an
696
+ * alternative representation. `Date | string` deliberately does NOT: that
697
+ * signature already accepts the string a JSON caller sends, so the method's
698
+ * own handling is authoritative and converting behind its back would change
699
+ * which branch it takes.
700
+ */
701
+ export declare function declaredTypeAcceptsDate(declaredType: string): boolean;
325
702
  //# sourceMappingURL=custom-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-action.d.ts","sourceRoot":"","sources":["../../src/generators/custom-action.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,YAAY,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,eAAO,MAAM,gCAAgC,EAAE,WAAW,CAAC,MAAM,CAuB/D,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAC7C,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,EAC9D,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,GAAG,CAAC,MAAM,CAAC,CAab;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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