@happyvertical/smrt-web 0.42.6 → 0.43.0

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/index.d.ts CHANGED
@@ -532,6 +532,10 @@ export declare interface RegisterWebMcpToolsOptions {
532
532
  basePath?: string;
533
533
  /** Injectable fetch (tests / SSR-safe wrappers). */
534
534
  fetchFn?: typeof fetch;
535
+ /** Shared smrt-web cache handle used by page collections. */
536
+ client?: SmrtWebClient;
537
+ /** Optional cache scope matching the page collection's scope. */
538
+ scope?: string;
535
539
  /**
536
540
  * Override how a definition's CRUD fetchers are built. Defaults to
537
541
  * {@link createDefinitionFetchers}; the primary seam for testing `execute`
@@ -571,6 +575,8 @@ export declare interface SmrtCrudFetchers {
571
575
  create(data: Record<string, unknown>): Promise<unknown>;
572
576
  update?(id: string, data: Record<string, unknown>): Promise<unknown>;
573
577
  delete?(id: string): Promise<unknown>;
578
+ /** Invoke a generated custom action route. */
579
+ custom?(action: string, args: Record<string, unknown>, route?: SmrtWebToolRouteDescriptor): Promise<unknown>;
574
580
  }
575
581
 
576
582
  /**
@@ -726,6 +732,12 @@ export declare interface SmrtWebCollection<TData extends object> {
726
732
  * server outcome (see {@link SmrtWebTransaction}).
727
733
  */
728
734
  insert(row: SmrtWebRow<TData>): SmrtWebTransaction;
735
+ /** Optimistically update a row and persist it through the REST surface. */
736
+ update(key: string, changes: Omit<Partial<SmrtWebRow<TData>>, 'id'>): SmrtWebTransaction;
737
+ /** Optimistically delete a row and persist it through the REST surface. */
738
+ delete(key: string): SmrtWebTransaction;
739
+ /** Execute a custom action and invalidate this collection's related caches. */
740
+ action(action: string, args: Record<string, unknown>, route?: SmrtWebToolRouteDescriptor): Promise<unknown>;
729
741
  }
730
742
 
731
743
  export declare interface SmrtWebCollectionDefinition<TData extends object = object> {
@@ -1077,6 +1089,17 @@ export declare interface SmrtWebSubscription {
1077
1089
  unsubscribe(): void;
1078
1090
  }
1079
1091
 
1092
+ export declare interface SmrtWebToolRouteDescriptor {
1093
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1094
+ scope: 'item' | 'collection';
1095
+ /** Route segments below the collection endpoint; dynamic segments use `[x]`. */
1096
+ path: string[];
1097
+ /** Transport names rewritten by the tool schema (e.g. `actionId` → `id`). */
1098
+ parameterAliases?: Record<string, string>;
1099
+ /** The generated method accepts one `options` bag as its sole argument. */
1100
+ optionsBag?: boolean;
1101
+ }
1102
+
1080
1103
  /**
1081
1104
  * A pending optimistic mutation. Await {@link isPersisted} to observe the
1082
1105
  * server outcome: it resolves once the write has been persisted through the
@@ -1213,6 +1236,8 @@ export declare interface WebToolDescriptor {
1213
1236
  inputSchema: Record<string, unknown>;
1214
1237
  /** True for non-mutating reads → WebMCP `annotations.readOnlyHint`. */
1215
1238
  readOnly: boolean;
1239
+ /** Generated custom-route transport metadata. */
1240
+ route?: SmrtWebToolRouteDescriptor;
1216
1241
  }
1217
1242
 
1218
1243
  /**