@farm.js/core 0.1.0-beta.11 → 0.1.0-beta.14

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 (238) hide show
  1. package/dist/chunk-53MVSX3R.mjs +168 -0
  2. package/dist/chunk-53MVSX3R.mjs.map +1 -0
  3. package/dist/{chunk-AW6I64AP.mjs → chunk-6ZXIQSXE.mjs} +16 -1
  4. package/dist/chunk-6ZXIQSXE.mjs.map +1 -0
  5. package/dist/chunk-7ZVN3YZI.mjs +333 -0
  6. package/dist/chunk-7ZVN3YZI.mjs.map +1 -0
  7. package/dist/{chunk-5EVQFRL2.mjs → chunk-ARCGE2VT.mjs} +2 -2
  8. package/dist/chunk-ARCGE2VT.mjs.map +1 -0
  9. package/dist/{chunk-7N62DNSO.mjs → chunk-H3TE3LOV.mjs} +2 -2
  10. package/dist/{chunk-QTZZ2ISQ.mjs → chunk-KLA67WKG.mjs} +1 -1
  11. package/dist/chunk-KLA67WKG.mjs.map +1 -0
  12. package/dist/{chunk-K5ZTUF22.mjs → chunk-L2PE36GQ.mjs} +7 -3
  13. package/dist/chunk-L2PE36GQ.mjs.map +1 -0
  14. package/dist/{chunk-4LND3PXF.mjs → chunk-OPHK6OJN.mjs} +513 -48
  15. package/dist/chunk-OPHK6OJN.mjs.map +1 -0
  16. package/dist/{chunk-77BOAQHI.mjs → chunk-PNFQQSRA.mjs} +754 -156
  17. package/dist/chunk-PNFQQSRA.mjs.map +1 -0
  18. package/dist/chunk-USLFXFFH.mjs +46 -0
  19. package/dist/chunk-USLFXFFH.mjs.map +1 -0
  20. package/dist/{chunk-4677KXB7.mjs → chunk-VUL55IAX.mjs} +368 -103
  21. package/dist/chunk-VUL55IAX.mjs.map +1 -0
  22. package/dist/client.cjs.map +1 -1
  23. package/dist/client.mjs +1 -1
  24. package/dist/{devtools-A22KUJZT.mjs → devtools-GAZ7F3KL.mjs} +4 -3
  25. package/dist/{devtools-A22KUJZT.mjs.map → devtools-GAZ7F3KL.mjs.map} +1 -1
  26. package/dist/docs.cjs +622 -124
  27. package/dist/docs.cjs.map +1 -1
  28. package/dist/docs.mjs +5 -3
  29. package/dist/font.cjs +19 -2
  30. package/dist/font.cjs.map +1 -1
  31. package/dist/font.mjs +7 -3
  32. package/dist/index.cjs +2235 -689
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.mjs +27 -19
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/internal/build-runtime.cjs +2062 -525
  37. package/dist/internal/build-runtime.cjs.map +1 -1
  38. package/dist/internal/build-runtime.mjs +13 -10
  39. package/dist/internal/client-runtime.cjs +169 -2
  40. package/dist/internal/client-runtime.cjs.map +1 -1
  41. package/dist/internal/client-runtime.mjs +170 -2
  42. package/dist/internal/client-runtime.mjs.map +1 -1
  43. package/dist/internal/config-runtime.cjs +22 -0
  44. package/dist/internal/config-runtime.cjs.map +1 -1
  45. package/dist/internal/config-runtime.mjs +3 -2
  46. package/dist/internal/metadata-image-runtime.cjs +199 -0
  47. package/dist/internal/metadata-image-runtime.cjs.map +1 -0
  48. package/dist/internal/metadata-image-runtime.mjs +8 -0
  49. package/dist/internal/metadata-image-runtime.mjs.map +1 -0
  50. package/dist/internal/production-runtime.cjs +310 -0
  51. package/dist/internal/production-runtime.cjs.map +1 -1
  52. package/dist/internal/production-runtime.mjs +10 -0
  53. package/dist/internal/production-runtime.mjs.map +1 -1
  54. package/dist/navigation.cjs.map +1 -1
  55. package/dist/navigation.mjs +2 -2
  56. package/dist/plugin.cjs +1550 -348
  57. package/dist/plugin.cjs.map +1 -1
  58. package/dist/plugin.mjs +9 -5
  59. package/dist/server.cjs +1663 -419
  60. package/dist/server.cjs.map +1 -1
  61. package/dist/server.mjs +17 -19
  62. package/dist/server.mjs.map +1 -1
  63. package/dist/version.cjs +1 -1
  64. package/dist/version.cjs.map +1 -1
  65. package/dist/version.mjs +1 -1
  66. package/dist/vite.cjs +1604 -358
  67. package/dist/vite.cjs.map +1 -1
  68. package/dist/vite.mjs +9 -5
  69. package/package.json +10 -1
  70. package/types/client.d.ts +115 -4
  71. package/dist/after.d.mts +0 -25
  72. package/dist/after.d.ts +0 -25
  73. package/dist/agent-runtime.d.mts +0 -94
  74. package/dist/agent-runtime.d.ts +0 -94
  75. package/dist/api/route-manager.d.mts +0 -66
  76. package/dist/api/route-manager.d.ts +0 -66
  77. package/dist/api/runtime.d.mts +0 -3
  78. package/dist/api/runtime.d.ts +0 -3
  79. package/dist/api.d.mts +0 -48
  80. package/dist/api.d.ts +0 -48
  81. package/dist/app-BNE2FoZ4.d.mts +0 -302
  82. package/dist/app-DRGUmJ3s.d.ts +0 -302
  83. package/dist/app-markdown.d.mts +0 -22
  84. package/dist/app-markdown.d.ts +0 -22
  85. package/dist/cache.d.mts +0 -192
  86. package/dist/cache.d.ts +0 -192
  87. package/dist/chunk-4677KXB7.mjs.map +0 -1
  88. package/dist/chunk-4LND3PXF.mjs.map +0 -1
  89. package/dist/chunk-5EVQFRL2.mjs.map +0 -1
  90. package/dist/chunk-77BOAQHI.mjs.map +0 -1
  91. package/dist/chunk-AW6I64AP.mjs.map +0 -1
  92. package/dist/chunk-K5ZTUF22.mjs.map +0 -1
  93. package/dist/chunk-QM746KUO.mjs +0 -56
  94. package/dist/chunk-QM746KUO.mjs.map +0 -1
  95. package/dist/chunk-QTZZ2ISQ.mjs.map +0 -1
  96. package/dist/client-BT1mFQas.d.mts +0 -447
  97. package/dist/client-Nn0q4eO4.d.ts +0 -447
  98. package/dist/client-cache-CIlyBlmx.d.ts +0 -6
  99. package/dist/client-cache-D-EZ7XVW.d.mts +0 -6
  100. package/dist/client-plugins-Bc5jHcNr.d.ts +0 -1927
  101. package/dist/client-plugins-jsk-ZLzJ.d.mts +0 -1927
  102. package/dist/client-plugins.d.mts +0 -22
  103. package/dist/client-plugins.d.ts +0 -22
  104. package/dist/client.d.mts +0 -447
  105. package/dist/client.d.ts +0 -447
  106. package/dist/config.d.mts +0 -29
  107. package/dist/config.d.ts +0 -29
  108. package/dist/cron.d.mts +0 -78
  109. package/dist/cron.d.ts +0 -78
  110. package/dist/deferred.d.mts +0 -42
  111. package/dist/deferred.d.ts +0 -42
  112. package/dist/deployment.d.mts +0 -34
  113. package/dist/deployment.d.ts +0 -34
  114. package/dist/docs.d.mts +0 -69
  115. package/dist/docs.d.ts +0 -69
  116. package/dist/env-types.d.mts +0 -12
  117. package/dist/env-types.d.ts +0 -12
  118. package/dist/env.d.mts +0 -45
  119. package/dist/env.d.ts +0 -45
  120. package/dist/environment/vite.d.mts +0 -22
  121. package/dist/environment/vite.d.ts +0 -22
  122. package/dist/environment.d.mts +0 -18
  123. package/dist/environment.d.ts +0 -18
  124. package/dist/font.d.mts +0 -70
  125. package/dist/font.d.ts +0 -70
  126. package/dist/headers.d.mts +0 -22
  127. package/dist/headers.d.ts +0 -22
  128. package/dist/i18n/client.d.mts +0 -32
  129. package/dist/i18n/client.d.ts +0 -32
  130. package/dist/i18n/index.d.mts +0 -20
  131. package/dist/i18n/index.d.ts +0 -20
  132. package/dist/i18n/server.d.mts +0 -30
  133. package/dist/i18n/server.d.ts +0 -30
  134. package/dist/image/server.d.mts +0 -37
  135. package/dist/image/server.d.ts +0 -37
  136. package/dist/image/sharp.d.mts +0 -7
  137. package/dist/image/sharp.d.ts +0 -7
  138. package/dist/image-config-Duob7wER.d.mts +0 -50
  139. package/dist/image-config-Duob7wER.d.ts +0 -50
  140. package/dist/image.d.mts +0 -39
  141. package/dist/image.d.ts +0 -39
  142. package/dist/index.d.mts +0 -455
  143. package/dist/index.d.ts +0 -455
  144. package/dist/integration-api-CHT2OKAf.d.mts +0 -93
  145. package/dist/integration-api-CHT2OKAf.d.ts +0 -93
  146. package/dist/integrations.d.mts +0 -22
  147. package/dist/integrations.d.ts +0 -22
  148. package/dist/internal/build-runtime.d.mts +0 -39
  149. package/dist/internal/build-runtime.d.ts +0 -39
  150. package/dist/internal/client-runtime.d.mts +0 -2
  151. package/dist/internal/client-runtime.d.ts +0 -2
  152. package/dist/internal/config-runtime.d.mts +0 -39
  153. package/dist/internal/config-runtime.d.ts +0 -39
  154. package/dist/internal/production-node-env.d.mts +0 -12
  155. package/dist/internal/production-node-env.d.ts +0 -12
  156. package/dist/internal/production-runtime.d.mts +0 -41
  157. package/dist/internal/production-runtime.d.ts +0 -41
  158. package/dist/markdown.d.mts +0 -60
  159. package/dist/markdown.d.ts +0 -60
  160. package/dist/metadata-7ffpT3jr.d.mts +0 -22
  161. package/dist/metadata-JHn-8eht.d.ts +0 -22
  162. package/dist/middleware.d.mts +0 -164
  163. package/dist/middleware.d.ts +0 -164
  164. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  165. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  166. package/dist/navigation.d.mts +0 -14
  167. package/dist/navigation.d.ts +0 -14
  168. package/dist/observability.d.mts +0 -335
  169. package/dist/observability.d.ts +0 -335
  170. package/dist/params-BALtrRim.d.ts +0 -15
  171. package/dist/params-ry-lxqmy.d.mts +0 -15
  172. package/dist/plugin-BJDf43dc.d.mts +0 -165
  173. package/dist/plugin-BJDf43dc.d.ts +0 -165
  174. package/dist/plugin.d.mts +0 -22
  175. package/dist/plugin.d.ts +0 -22
  176. package/dist/production-runtime-9KG7GuvW.d.ts +0 -79
  177. package/dist/production-runtime-B-fweKts.d.mts +0 -79
  178. package/dist/production-runtime-C_B79w2P.d.mts +0 -28
  179. package/dist/production-runtime-DDEM1D2q.d.ts +0 -28
  180. package/dist/query/client.d.mts +0 -61
  181. package/dist/query/client.d.ts +0 -61
  182. package/dist/query/index.d.mts +0 -90
  183. package/dist/query/index.d.ts +0 -90
  184. package/dist/query/parsers.d.mts +0 -25
  185. package/dist/query/parsers.d.ts +0 -25
  186. package/dist/query/server.d.mts +0 -55
  187. package/dist/query/server.d.ts +0 -55
  188. package/dist/request-Dsq4kGW0.d.mts +0 -6
  189. package/dist/request-udtobOLv.d.ts +0 -6
  190. package/dist/request.d.mts +0 -2
  191. package/dist/request.d.ts +0 -2
  192. package/dist/resolver-DJqjLMg_.d.mts +0 -14
  193. package/dist/resolver-IH4RmPEl.d.ts +0 -14
  194. package/dist/route-runtime-DoOHzCAD.d.mts +0 -38
  195. package/dist/route-runtime-DoOHzCAD.d.ts +0 -38
  196. package/dist/router.d.mts +0 -36
  197. package/dist/router.d.ts +0 -36
  198. package/dist/routes.d.mts +0 -224
  199. package/dist/routes.d.ts +0 -224
  200. package/dist/runtime-9nQjVM7X.d.mts +0 -206
  201. package/dist/runtime-Cxpq6xZN.d.mts +0 -27
  202. package/dist/runtime-DgeS2skB.d.ts +0 -206
  203. package/dist/runtime-bv63eUiO.d.ts +0 -27
  204. package/dist/server-action-security.d.mts +0 -43
  205. package/dist/server-action-security.d.ts +0 -43
  206. package/dist/server-fn-client.d.mts +0 -32
  207. package/dist/server-fn-client.d.ts +0 -32
  208. package/dist/server-fn.d.mts +0 -93
  209. package/dist/server-fn.d.ts +0 -93
  210. package/dist/server-plugins.d.mts +0 -55
  211. package/dist/server-plugins.d.ts +0 -55
  212. package/dist/server-query-client.d.mts +0 -50
  213. package/dist/server-query-client.d.ts +0 -50
  214. package/dist/server-query.d.mts +0 -36
  215. package/dist/server-query.d.ts +0 -36
  216. package/dist/server.d.mts +0 -48
  217. package/dist/server.d.ts +0 -48
  218. package/dist/storage.d.mts +0 -52
  219. package/dist/storage.d.ts +0 -52
  220. package/dist/testing.d.mts +0 -101
  221. package/dist/testing.d.ts +0 -101
  222. package/dist/transport-BmbGTXA5.d.mts +0 -49
  223. package/dist/transport-BmbGTXA5.d.ts +0 -49
  224. package/dist/types-BMxWr97v.d.mts +0 -81
  225. package/dist/types-BMxWr97v.d.ts +0 -81
  226. package/dist/types-C9N-nk5R.d.mts +0 -53
  227. package/dist/types-C9N-nk5R.d.ts +0 -53
  228. package/dist/types-D1A6-XvH.d.mts +0 -73
  229. package/dist/types-D1A6-XvH.d.ts +0 -73
  230. package/dist/utils-CA0z0c-2.d.ts +0 -23
  231. package/dist/utils-mYVkSOt2.d.mts +0 -23
  232. package/dist/version.d.mts +0 -3
  233. package/dist/version.d.ts +0 -3
  234. package/dist/vite.d.mts +0 -22
  235. package/dist/vite.d.ts +0 -22
  236. package/dist/workflows.d.mts +0 -110
  237. package/dist/workflows.d.ts +0 -110
  238. /package/dist/{chunk-7N62DNSO.mjs.map → chunk-H3TE3LOV.mjs.map} +0 -0
@@ -1,165 +0,0 @@
1
- type MaybePromise<T> = T | Promise<T>;
2
- type FarmClientPluginEnforce = "pre" | "post";
3
- type FarmClientNavigationAction = "push" | "replace" | "pop";
4
- type FarmClientHydrationMode = "hydrate" | "render";
5
- interface FarmClientLocation {
6
- href: string;
7
- pathname: string;
8
- search: string;
9
- hash: string;
10
- }
11
- interface FarmClientPluginRouter {
12
- navigate(href: string, options?: Record<string, unknown>): MaybePromise<void>;
13
- prefetch?(href: string): MaybePromise<void>;
14
- getNavigationState?(): unknown;
15
- }
16
- interface FarmClientPluginMetadata {
17
- name: string;
18
- version?: string;
19
- }
20
- interface FarmClientPluginSetupEvent<TPublic = undefined> {
21
- plugin: FarmClientPluginMetadata;
22
- public: Readonly<TPublic>;
23
- router: FarmClientPluginRouter;
24
- isDev: boolean;
25
- isProd: boolean;
26
- deploymentId?: string;
27
- }
28
- interface FarmClientPluginStateEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginSetupEvent<TPublic> {
29
- state: TState;
30
- }
31
- interface FarmClientHydrationSession {
32
- container: Element;
33
- location: FarmClientLocation;
34
- mode: FarmClientHydrationMode;
35
- startedAt: number;
36
- }
37
- interface FarmClientHydrationEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic>, FarmClientHydrationSession {
38
- }
39
- interface FarmClientHydrationCompleteEvent<TState = unknown, TPublic = undefined> extends FarmClientHydrationEvent<TState, TPublic> {
40
- durationMs: number;
41
- recovered: boolean;
42
- }
43
- interface FarmClientNavigationSession {
44
- id: string;
45
- from: FarmClientLocation | null;
46
- to: FarmClientLocation;
47
- action: FarmClientNavigationAction;
48
- signal: AbortSignal;
49
- startedAt: number;
50
- route?: {
51
- pattern?: string | null;
52
- params?: Record<string, string>;
53
- };
54
- }
55
- interface FarmClientNavigationEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic>, FarmClientNavigationSession {
56
- }
57
- interface FarmClientNavigationLoadedEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationEvent<TState, TPublic> {
58
- durationMs: number;
59
- data?: unknown;
60
- }
61
- interface FarmClientNavigationResolvedEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationEvent<TState, TPublic> {
62
- durationMs: number;
63
- }
64
- interface FarmClientNavigationErrorEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationResolvedEvent<TState, TPublic> {
65
- error: unknown;
66
- }
67
- type FarmClientPluginErrorPhase = "setup" | "hydration" | "navigation" | "window" | "unhandled-rejection" | "performance" | `plugin:${string}` | (string & {});
68
- interface FarmClientPluginErrorEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
69
- error: unknown;
70
- phase: FarmClientPluginErrorPhase;
71
- location: FarmClientLocation;
72
- navigation?: FarmClientNavigationSession;
73
- }
74
- interface FarmClientPerformanceEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
75
- entry: PerformanceEntry;
76
- location: FarmClientLocation;
77
- }
78
- interface FarmClientPluginCloseEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
79
- reason: "pagehide" | "hmr" | "manual" | (string & {});
80
- }
81
- interface FarmClientPlugin<TState = unknown, TPublic = undefined> {
82
- setup?(event: FarmClientPluginSetupEvent<TPublic>): MaybePromise<TState>;
83
- hydration?: {
84
- before?(event: FarmClientHydrationEvent<TState, TPublic>): MaybePromise<void>;
85
- after?(event: FarmClientHydrationCompleteEvent<TState, TPublic>): MaybePromise<void>;
86
- };
87
- navigation?: {
88
- before?(event: FarmClientNavigationEvent<TState, TPublic>): MaybePromise<void>;
89
- loaded?(event: FarmClientNavigationLoadedEvent<TState, TPublic>): MaybePromise<void>;
90
- resolved?(event: FarmClientNavigationResolvedEvent<TState, TPublic>): MaybePromise<void>;
91
- rendered?(event: FarmClientNavigationResolvedEvent<TState, TPublic>): MaybePromise<void>;
92
- error?(event: FarmClientNavigationErrorEvent<TState, TPublic>): MaybePromise<void>;
93
- };
94
- error?(event: FarmClientPluginErrorEvent<TState, TPublic>): MaybePromise<void>;
95
- performance?(event: FarmClientPerformanceEvent<TState, TPublic>): MaybePromise<void>;
96
- close?(event: FarmClientPluginCloseEvent<TState, TPublic>): MaybePromise<void>;
97
- }
98
- interface FarmClientPluginRegistration<TPublic = undefined> {
99
- name: string;
100
- version?: string;
101
- enforce?: FarmClientPluginEnforce;
102
- definition: FarmClientPlugin<any, TPublic>;
103
- public?: TPublic;
104
- }
105
- interface FarmClientPluginManagerOptions {
106
- router: FarmClientPluginRouter;
107
- isDev?: boolean;
108
- isProd?: boolean;
109
- deploymentId?: string;
110
- window?: Window;
111
- }
112
- declare class FarmClientPluginManager {
113
- private readonly registrations;
114
- private readonly options;
115
- private readonly instances;
116
- private readonly performanceObservers;
117
- private startPromise?;
118
- private closePromise?;
119
- private currentNavigation?;
120
- private navigationSequence;
121
- private starting;
122
- private started;
123
- private closed;
124
- private readonly reportedErrors;
125
- private readonly handleWindowError;
126
- private readonly handleUnhandledRejection;
127
- private readonly handlePageHide;
128
- constructor(registrations: readonly FarmClientPluginRegistration[], options: FarmClientPluginManagerOptions);
129
- start(): Promise<void>;
130
- beginHydration(input: {
131
- container: Element;
132
- mode: FarmClientHydrationMode;
133
- }): Promise<FarmClientHydrationSession>;
134
- completeHydration(session: FarmClientHydrationSession, options?: {
135
- recovered?: boolean;
136
- }): Promise<void>;
137
- failHydration(session: FarmClientHydrationSession, error: unknown): Promise<void>;
138
- beginNavigation(input: {
139
- from?: string | URL | FarmClientLocation | null;
140
- to: string | URL | FarmClientLocation;
141
- action: FarmClientNavigationAction;
142
- route?: FarmClientNavigationSession["route"];
143
- }): Promise<FarmClientNavigationSession>;
144
- markNavigationLoaded(session: FarmClientNavigationSession, data?: unknown): Promise<void>;
145
- resolveNavigation(session: FarmClientNavigationSession): Promise<void>;
146
- scheduleNavigationRendered(session: FarmClientNavigationSession): Promise<void>;
147
- failNavigation(session: FarmClientNavigationSession, error: unknown): Promise<void>;
148
- reportError(error: unknown, phase: FarmClientPluginErrorPhase, navigation?: FarmClientNavigationSession, location?: FarmClientLocation): Promise<void>;
149
- close(reason?: FarmClientPluginCloseEvent["reason"]): Promise<void>;
150
- getPlugins(): readonly FarmClientPluginMetadata[];
151
- private startInternal;
152
- private installBrowserListeners;
153
- private installPerformanceObservers;
154
- private closeInternal;
155
- private runHook;
156
- private runErrorHooks;
157
- private createSetupEvent;
158
- private createStateEvent;
159
- private getLocation;
160
- private getBaseUrl;
161
- private logHookError;
162
- }
163
- declare function createClientPluginManager(registrations: readonly FarmClientPluginRegistration[], options: FarmClientPluginManagerOptions): FarmClientPluginManager;
164
-
165
- export { FarmClientPluginManager as F, type FarmClientHydrationCompleteEvent as a, type FarmClientHydrationEvent as b, createClientPluginManager as c, type FarmClientHydrationMode as d, type FarmClientHydrationSession as e, type FarmClientLocation as f, type FarmClientNavigationAction as g, type FarmClientNavigationErrorEvent as h, type FarmClientNavigationEvent as i, type FarmClientNavigationLoadedEvent as j, type FarmClientNavigationResolvedEvent as k, type FarmClientNavigationSession as l, type FarmClientPerformanceEvent as m, type FarmClientPlugin as n, type FarmClientPluginCloseEvent as o, type FarmClientPluginEnforce as p, type FarmClientPluginErrorEvent as q, type FarmClientPluginErrorPhase as r, type FarmClientPluginManagerOptions as s, type FarmClientPluginMetadata as t, type FarmClientPluginRegistration as u, type FarmClientPluginRouter as v, type FarmClientPluginSetupEvent as w, type FarmClientPluginStateEvent as x };
@@ -1,165 +0,0 @@
1
- type MaybePromise<T> = T | Promise<T>;
2
- type FarmClientPluginEnforce = "pre" | "post";
3
- type FarmClientNavigationAction = "push" | "replace" | "pop";
4
- type FarmClientHydrationMode = "hydrate" | "render";
5
- interface FarmClientLocation {
6
- href: string;
7
- pathname: string;
8
- search: string;
9
- hash: string;
10
- }
11
- interface FarmClientPluginRouter {
12
- navigate(href: string, options?: Record<string, unknown>): MaybePromise<void>;
13
- prefetch?(href: string): MaybePromise<void>;
14
- getNavigationState?(): unknown;
15
- }
16
- interface FarmClientPluginMetadata {
17
- name: string;
18
- version?: string;
19
- }
20
- interface FarmClientPluginSetupEvent<TPublic = undefined> {
21
- plugin: FarmClientPluginMetadata;
22
- public: Readonly<TPublic>;
23
- router: FarmClientPluginRouter;
24
- isDev: boolean;
25
- isProd: boolean;
26
- deploymentId?: string;
27
- }
28
- interface FarmClientPluginStateEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginSetupEvent<TPublic> {
29
- state: TState;
30
- }
31
- interface FarmClientHydrationSession {
32
- container: Element;
33
- location: FarmClientLocation;
34
- mode: FarmClientHydrationMode;
35
- startedAt: number;
36
- }
37
- interface FarmClientHydrationEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic>, FarmClientHydrationSession {
38
- }
39
- interface FarmClientHydrationCompleteEvent<TState = unknown, TPublic = undefined> extends FarmClientHydrationEvent<TState, TPublic> {
40
- durationMs: number;
41
- recovered: boolean;
42
- }
43
- interface FarmClientNavigationSession {
44
- id: string;
45
- from: FarmClientLocation | null;
46
- to: FarmClientLocation;
47
- action: FarmClientNavigationAction;
48
- signal: AbortSignal;
49
- startedAt: number;
50
- route?: {
51
- pattern?: string | null;
52
- params?: Record<string, string>;
53
- };
54
- }
55
- interface FarmClientNavigationEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic>, FarmClientNavigationSession {
56
- }
57
- interface FarmClientNavigationLoadedEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationEvent<TState, TPublic> {
58
- durationMs: number;
59
- data?: unknown;
60
- }
61
- interface FarmClientNavigationResolvedEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationEvent<TState, TPublic> {
62
- durationMs: number;
63
- }
64
- interface FarmClientNavigationErrorEvent<TState = unknown, TPublic = undefined> extends FarmClientNavigationResolvedEvent<TState, TPublic> {
65
- error: unknown;
66
- }
67
- type FarmClientPluginErrorPhase = "setup" | "hydration" | "navigation" | "window" | "unhandled-rejection" | "performance" | `plugin:${string}` | (string & {});
68
- interface FarmClientPluginErrorEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
69
- error: unknown;
70
- phase: FarmClientPluginErrorPhase;
71
- location: FarmClientLocation;
72
- navigation?: FarmClientNavigationSession;
73
- }
74
- interface FarmClientPerformanceEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
75
- entry: PerformanceEntry;
76
- location: FarmClientLocation;
77
- }
78
- interface FarmClientPluginCloseEvent<TState = unknown, TPublic = undefined> extends FarmClientPluginStateEvent<TState, TPublic> {
79
- reason: "pagehide" | "hmr" | "manual" | (string & {});
80
- }
81
- interface FarmClientPlugin<TState = unknown, TPublic = undefined> {
82
- setup?(event: FarmClientPluginSetupEvent<TPublic>): MaybePromise<TState>;
83
- hydration?: {
84
- before?(event: FarmClientHydrationEvent<TState, TPublic>): MaybePromise<void>;
85
- after?(event: FarmClientHydrationCompleteEvent<TState, TPublic>): MaybePromise<void>;
86
- };
87
- navigation?: {
88
- before?(event: FarmClientNavigationEvent<TState, TPublic>): MaybePromise<void>;
89
- loaded?(event: FarmClientNavigationLoadedEvent<TState, TPublic>): MaybePromise<void>;
90
- resolved?(event: FarmClientNavigationResolvedEvent<TState, TPublic>): MaybePromise<void>;
91
- rendered?(event: FarmClientNavigationResolvedEvent<TState, TPublic>): MaybePromise<void>;
92
- error?(event: FarmClientNavigationErrorEvent<TState, TPublic>): MaybePromise<void>;
93
- };
94
- error?(event: FarmClientPluginErrorEvent<TState, TPublic>): MaybePromise<void>;
95
- performance?(event: FarmClientPerformanceEvent<TState, TPublic>): MaybePromise<void>;
96
- close?(event: FarmClientPluginCloseEvent<TState, TPublic>): MaybePromise<void>;
97
- }
98
- interface FarmClientPluginRegistration<TPublic = undefined> {
99
- name: string;
100
- version?: string;
101
- enforce?: FarmClientPluginEnforce;
102
- definition: FarmClientPlugin<any, TPublic>;
103
- public?: TPublic;
104
- }
105
- interface FarmClientPluginManagerOptions {
106
- router: FarmClientPluginRouter;
107
- isDev?: boolean;
108
- isProd?: boolean;
109
- deploymentId?: string;
110
- window?: Window;
111
- }
112
- declare class FarmClientPluginManager {
113
- private readonly registrations;
114
- private readonly options;
115
- private readonly instances;
116
- private readonly performanceObservers;
117
- private startPromise?;
118
- private closePromise?;
119
- private currentNavigation?;
120
- private navigationSequence;
121
- private starting;
122
- private started;
123
- private closed;
124
- private readonly reportedErrors;
125
- private readonly handleWindowError;
126
- private readonly handleUnhandledRejection;
127
- private readonly handlePageHide;
128
- constructor(registrations: readonly FarmClientPluginRegistration[], options: FarmClientPluginManagerOptions);
129
- start(): Promise<void>;
130
- beginHydration(input: {
131
- container: Element;
132
- mode: FarmClientHydrationMode;
133
- }): Promise<FarmClientHydrationSession>;
134
- completeHydration(session: FarmClientHydrationSession, options?: {
135
- recovered?: boolean;
136
- }): Promise<void>;
137
- failHydration(session: FarmClientHydrationSession, error: unknown): Promise<void>;
138
- beginNavigation(input: {
139
- from?: string | URL | FarmClientLocation | null;
140
- to: string | URL | FarmClientLocation;
141
- action: FarmClientNavigationAction;
142
- route?: FarmClientNavigationSession["route"];
143
- }): Promise<FarmClientNavigationSession>;
144
- markNavigationLoaded(session: FarmClientNavigationSession, data?: unknown): Promise<void>;
145
- resolveNavigation(session: FarmClientNavigationSession): Promise<void>;
146
- scheduleNavigationRendered(session: FarmClientNavigationSession): Promise<void>;
147
- failNavigation(session: FarmClientNavigationSession, error: unknown): Promise<void>;
148
- reportError(error: unknown, phase: FarmClientPluginErrorPhase, navigation?: FarmClientNavigationSession, location?: FarmClientLocation): Promise<void>;
149
- close(reason?: FarmClientPluginCloseEvent["reason"]): Promise<void>;
150
- getPlugins(): readonly FarmClientPluginMetadata[];
151
- private startInternal;
152
- private installBrowserListeners;
153
- private installPerformanceObservers;
154
- private closeInternal;
155
- private runHook;
156
- private runErrorHooks;
157
- private createSetupEvent;
158
- private createStateEvent;
159
- private getLocation;
160
- private getBaseUrl;
161
- private logHookError;
162
- }
163
- declare function createClientPluginManager(registrations: readonly FarmClientPluginRegistration[], options: FarmClientPluginManagerOptions): FarmClientPluginManager;
164
-
165
- export { FarmClientPluginManager as F, type FarmClientHydrationCompleteEvent as a, type FarmClientHydrationEvent as b, createClientPluginManager as c, type FarmClientHydrationMode as d, type FarmClientHydrationSession as e, type FarmClientLocation as f, type FarmClientNavigationAction as g, type FarmClientNavigationErrorEvent as h, type FarmClientNavigationEvent as i, type FarmClientNavigationLoadedEvent as j, type FarmClientNavigationResolvedEvent as k, type FarmClientNavigationSession as l, type FarmClientPerformanceEvent as m, type FarmClientPlugin as n, type FarmClientPluginCloseEvent as o, type FarmClientPluginEnforce as p, type FarmClientPluginErrorEvent as q, type FarmClientPluginErrorPhase as r, type FarmClientPluginManagerOptions as s, type FarmClientPluginMetadata as t, type FarmClientPluginRegistration as u, type FarmClientPluginRouter as v, type FarmClientPluginSetupEvent as w, type FarmClientPluginStateEvent as x };
package/dist/plugin.d.mts DELETED
@@ -1,22 +0,0 @@
1
- export { aO as APIHandlerLifecyclePayload, aK as APIRouteDiscoveredPayload, aR as BundleLifecyclePayload, U as BundleResultPayload, aP as ErrorLifecyclePayload, V as FarmPlugin, aE as FarmPluginBuildHooks, aG as FarmPluginClientConfig, aj as FarmPluginContext, aF as FarmPluginDevHooks, aB as FarmPluginDiscoveredRoute, aD as FarmPluginRenderHooks, an as FarmPluginRouteRuntimePayload, aC as FarmPluginRouterHooks, at as FarmPluginRuntimeAfterEvent, aq as FarmPluginRuntimeBaseEvent, as as FarmPluginRuntimeBeforeEvent, aw as FarmPluginRuntimeCloseEvent, ar as FarmPluginRuntimeContextEvent, au as FarmPluginRuntimeErrorEvent, ax as FarmPluginRuntimeHooks, am as FarmPluginRuntimeKind, az as FarmPluginRuntimeRequestHandler, ay as FarmPluginRuntimeRequestOptions, aA as FarmPluginRuntimeSession, av as FarmPluginRuntimeStartEvent, ao as FarmPluginSetupContext, ap as FarmPluginStateContext, ak as FarmRequestPluginContext, al as FarmRequestStore, aQ as HMRUpdatePayload, aJ as MiddlewareDiscoveredPayload, aS as NitroBuildLifecyclePayload, a3 as PluginManager, ai as PluginRequestContext, aN as RenderLifecyclePayload, aH as RouteDiscoveredPayload, aL as RouteMatchPayload, aM as RouteMatchResultPayload, aI as RoutesGeneratedPayload, aT as ShutdownPayload, a2 as definePlugin, f as farmPlugin } from './client-plugins-jsk-ZLzJ.mjs';
2
- import 'vite';
3
- import './plugin-BJDf43dc.mjs';
4
- import './env.mjs';
5
- import 'react';
6
- import 'http';
7
- import './types-D1A6-XvH.mjs';
8
- import 'db0';
9
- import 'unstorage';
10
- import './integration-api-CHT2OKAf.mjs';
11
- import '@farming-labs/orm';
12
- import './types-C9N-nk5R.mjs';
13
- import '@farming-labs/docs';
14
- import './markdown.mjs';
15
- import './observability.mjs';
16
- import './workflows.mjs';
17
- import './cron.mjs';
18
- import './server-action-security.mjs';
19
- import './image-config-Duob7wER.mjs';
20
- import './types-BMxWr97v.mjs';
21
- import './cache.mjs';
22
- import './route-runtime-DoOHzCAD.mjs';
package/dist/plugin.d.ts DELETED
@@ -1,22 +0,0 @@
1
- export { aO as APIHandlerLifecyclePayload, aK as APIRouteDiscoveredPayload, aR as BundleLifecyclePayload, U as BundleResultPayload, aP as ErrorLifecyclePayload, V as FarmPlugin, aE as FarmPluginBuildHooks, aG as FarmPluginClientConfig, aj as FarmPluginContext, aF as FarmPluginDevHooks, aB as FarmPluginDiscoveredRoute, aD as FarmPluginRenderHooks, an as FarmPluginRouteRuntimePayload, aC as FarmPluginRouterHooks, at as FarmPluginRuntimeAfterEvent, aq as FarmPluginRuntimeBaseEvent, as as FarmPluginRuntimeBeforeEvent, aw as FarmPluginRuntimeCloseEvent, ar as FarmPluginRuntimeContextEvent, au as FarmPluginRuntimeErrorEvent, ax as FarmPluginRuntimeHooks, am as FarmPluginRuntimeKind, az as FarmPluginRuntimeRequestHandler, ay as FarmPluginRuntimeRequestOptions, aA as FarmPluginRuntimeSession, av as FarmPluginRuntimeStartEvent, ao as FarmPluginSetupContext, ap as FarmPluginStateContext, ak as FarmRequestPluginContext, al as FarmRequestStore, aQ as HMRUpdatePayload, aJ as MiddlewareDiscoveredPayload, aS as NitroBuildLifecyclePayload, a3 as PluginManager, ai as PluginRequestContext, aN as RenderLifecyclePayload, aH as RouteDiscoveredPayload, aL as RouteMatchPayload, aM as RouteMatchResultPayload, aI as RoutesGeneratedPayload, aT as ShutdownPayload, a2 as definePlugin, f as farmPlugin } from './client-plugins-Bc5jHcNr.js';
2
- import 'vite';
3
- import './plugin-BJDf43dc.js';
4
- import './env.js';
5
- import 'react';
6
- import 'http';
7
- import './types-D1A6-XvH.js';
8
- import 'db0';
9
- import 'unstorage';
10
- import './integration-api-CHT2OKAf.js';
11
- import '@farming-labs/orm';
12
- import './types-C9N-nk5R.js';
13
- import '@farming-labs/docs';
14
- import './markdown.js';
15
- import './observability.js';
16
- import './workflows.js';
17
- import './cron.js';
18
- import './server-action-security.js';
19
- import './image-config-Duob7wER.js';
20
- import './types-BMxWr97v.js';
21
- import './cache.js';
22
- import './route-runtime-DoOHzCAD.js';
@@ -1,79 +0,0 @@
1
- import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-Bc5jHcNr.js';
2
- import { R as ResolvedFarmI18nConfig } from './types-BMxWr97v.js';
3
-
4
- /**
5
- * Server-side middleware utilities for accessing middleware data in pages
6
- */
7
-
8
- type MiddlewareStoreInput = Record<string, any> | Map<string, any>;
9
- /**
10
- * Internal: Run code with middleware data available
11
- * This is called by the server renderer
12
- */
13
- declare function _runWithMiddlewareData<T>(data: MiddlewareStoreInput, fn: () => T | Promise<T>): Promise<T>;
14
- /** Internal: Run code with server-only middleware context available. */
15
- declare function _runWithMiddlewareContext<T>(context: MiddlewareStoreInput, fn: () => T | Promise<T>): Promise<T>;
16
- /**
17
- * Get middleware data in a server component
18
- * No props needed - uses global storage!
19
- *
20
- * @example
21
- * ```tsx
22
- * import { getMiddlewareData } from 'farm/middleware';
23
- *
24
- * export default function Page() {
25
- * const data = getMiddlewareData(); // ← No props needed!
26
- * const user = data.get('user');
27
- * const demoInfo = data.get('demoInfo');
28
- *
29
- * return <div>Welcome {user?.name}</div>;
30
- * }
31
- * ```
32
- */
33
- declare function getMiddlewareData<T extends Record<string, any> = Record<string, any>>(): Map<keyof T, T[keyof T]>;
34
- /**
35
- * Get a specific value from middleware data (synchronous)
36
- * Uses AsyncLocalStorage for request scoping - no props needed.
37
- *
38
- * @example
39
- * ```tsx
40
- * import { getMiddlewareValue } from 'farm/middleware';
41
- *
42
- * export default function Page() {
43
- * const user = getMiddlewareValue<User>('user'); // ← No props needed!
44
- * const stats = getMiddlewareValue('dashboardStats');
45
- *
46
- * return <div>Welcome {user?.name}</div>;
47
- * }
48
- * ```
49
- */
50
- declare function getMiddlewareValue<T = any>(key: string): T | undefined;
51
- /**
52
- * Read server-only values set by route middleware for the current request.
53
- * The returned store is available to the matched page, layouts, and nested
54
- * Server Components, but is never added to hydration props.
55
- */
56
- declare function getMiddlewareContext<T extends Record<string, any> = Record<string, any>>(): ReadonlyMiddlewareStore<T>;
57
-
58
- interface ProductionMiddlewareModuleEntry {
59
- path: string;
60
- filePath?: string;
61
- module: MiddlewareModule | Record<string, any>;
62
- }
63
- interface ProductionMiddlewareRunnerOptions {
64
- config?: FarmMiddlewareConfig | null;
65
- modules?: ProductionMiddlewareModuleEntry[];
66
- i18n?: ResolvedFarmI18nConfig;
67
- }
68
- interface ProductionMiddlewareResult {
69
- request: Request;
70
- response: Response | null;
71
- data: Map<string, any>;
72
- context: Map<string, any>;
73
- headers: Headers;
74
- handled: boolean;
75
- }
76
- declare function createProductionMiddlewareRunner(options?: ProductionMiddlewareRunnerOptions): (request: Request) => Promise<ProductionMiddlewareResult>;
77
- declare function applyProductionMiddlewareHeaders(response: Response, middlewareHeaders?: Headers | null): Response;
78
-
79
- export { _runWithMiddlewareContext as _, applyProductionMiddlewareHeaders as a, _runWithMiddlewareData as b, createProductionMiddlewareRunner as c, getMiddlewareData as d, getMiddlewareValue as e, getMiddlewareContext as g };
@@ -1,79 +0,0 @@
1
- import { X as ReadonlyMiddlewareStore, Y as FarmMiddlewareConfig, Z as MiddlewareModule } from './client-plugins-jsk-ZLzJ.mjs';
2
- import { R as ResolvedFarmI18nConfig } from './types-BMxWr97v.mjs';
3
-
4
- /**
5
- * Server-side middleware utilities for accessing middleware data in pages
6
- */
7
-
8
- type MiddlewareStoreInput = Record<string, any> | Map<string, any>;
9
- /**
10
- * Internal: Run code with middleware data available
11
- * This is called by the server renderer
12
- */
13
- declare function _runWithMiddlewareData<T>(data: MiddlewareStoreInput, fn: () => T | Promise<T>): Promise<T>;
14
- /** Internal: Run code with server-only middleware context available. */
15
- declare function _runWithMiddlewareContext<T>(context: MiddlewareStoreInput, fn: () => T | Promise<T>): Promise<T>;
16
- /**
17
- * Get middleware data in a server component
18
- * No props needed - uses global storage!
19
- *
20
- * @example
21
- * ```tsx
22
- * import { getMiddlewareData } from 'farm/middleware';
23
- *
24
- * export default function Page() {
25
- * const data = getMiddlewareData(); // ← No props needed!
26
- * const user = data.get('user');
27
- * const demoInfo = data.get('demoInfo');
28
- *
29
- * return <div>Welcome {user?.name}</div>;
30
- * }
31
- * ```
32
- */
33
- declare function getMiddlewareData<T extends Record<string, any> = Record<string, any>>(): Map<keyof T, T[keyof T]>;
34
- /**
35
- * Get a specific value from middleware data (synchronous)
36
- * Uses AsyncLocalStorage for request scoping - no props needed.
37
- *
38
- * @example
39
- * ```tsx
40
- * import { getMiddlewareValue } from 'farm/middleware';
41
- *
42
- * export default function Page() {
43
- * const user = getMiddlewareValue<User>('user'); // ← No props needed!
44
- * const stats = getMiddlewareValue('dashboardStats');
45
- *
46
- * return <div>Welcome {user?.name}</div>;
47
- * }
48
- * ```
49
- */
50
- declare function getMiddlewareValue<T = any>(key: string): T | undefined;
51
- /**
52
- * Read server-only values set by route middleware for the current request.
53
- * The returned store is available to the matched page, layouts, and nested
54
- * Server Components, but is never added to hydration props.
55
- */
56
- declare function getMiddlewareContext<T extends Record<string, any> = Record<string, any>>(): ReadonlyMiddlewareStore<T>;
57
-
58
- interface ProductionMiddlewareModuleEntry {
59
- path: string;
60
- filePath?: string;
61
- module: MiddlewareModule | Record<string, any>;
62
- }
63
- interface ProductionMiddlewareRunnerOptions {
64
- config?: FarmMiddlewareConfig | null;
65
- modules?: ProductionMiddlewareModuleEntry[];
66
- i18n?: ResolvedFarmI18nConfig;
67
- }
68
- interface ProductionMiddlewareResult {
69
- request: Request;
70
- response: Response | null;
71
- data: Map<string, any>;
72
- context: Map<string, any>;
73
- headers: Headers;
74
- handled: boolean;
75
- }
76
- declare function createProductionMiddlewareRunner(options?: ProductionMiddlewareRunnerOptions): (request: Request) => Promise<ProductionMiddlewareResult>;
77
- declare function applyProductionMiddlewareHeaders(response: Response, middlewareHeaders?: Headers | null): Response;
78
-
79
- export { _runWithMiddlewareContext as _, applyProductionMiddlewareHeaders as a, _runWithMiddlewareData as b, createProductionMiddlewareRunner as c, getMiddlewareData as d, getMiddlewareValue as e, getMiddlewareContext as g };
@@ -1,28 +0,0 @@
1
- import './plugin-BJDf43dc.mjs';
2
-
3
- interface FarmChunkRecoveryOptions {
4
- /**
5
- * How long a page is considered already recovered before another chunk
6
- * failure may trigger a reload. Defaults to 30 seconds.
7
- */
8
- maxAgeMs?: number;
9
- /**
10
- * Override the storage key. Mostly useful for tests and embedded runtimes.
11
- */
12
- storageKey?: string;
13
- /**
14
- * Called right before Farm reloads the page.
15
- */
16
- onRecover?: (error: unknown) => void;
17
- /**
18
- * Test hooks for browser globals.
19
- */
20
- reload?: () => void;
21
- storage?: Pick<Storage, "getItem" | "setItem" | "removeItem"> | null;
22
- location?: Pick<Location, "pathname" | "search" | "reload">;
23
- now?: () => number;
24
- }
25
- declare function isChunkLoadError(errorLike: unknown): boolean;
26
- declare function installChunkErrorRecovery(options?: FarmChunkRecoveryOptions): () => void;
27
-
28
- export { type FarmChunkRecoveryOptions as F, isChunkLoadError as a, installChunkErrorRecovery as i };
@@ -1,28 +0,0 @@
1
- import './plugin-BJDf43dc.js';
2
-
3
- interface FarmChunkRecoveryOptions {
4
- /**
5
- * How long a page is considered already recovered before another chunk
6
- * failure may trigger a reload. Defaults to 30 seconds.
7
- */
8
- maxAgeMs?: number;
9
- /**
10
- * Override the storage key. Mostly useful for tests and embedded runtimes.
11
- */
12
- storageKey?: string;
13
- /**
14
- * Called right before Farm reloads the page.
15
- */
16
- onRecover?: (error: unknown) => void;
17
- /**
18
- * Test hooks for browser globals.
19
- */
20
- reload?: () => void;
21
- storage?: Pick<Storage, "getItem" | "setItem" | "removeItem"> | null;
22
- location?: Pick<Location, "pathname" | "search" | "reload">;
23
- now?: () => number;
24
- }
25
- declare function isChunkLoadError(errorLike: unknown): boolean;
26
- declare function installChunkErrorRecovery(options?: FarmChunkRecoveryOptions): () => void;
27
-
28
- export { type FarmChunkRecoveryOptions as F, isChunkLoadError as a, installChunkErrorRecovery as i };
@@ -1,61 +0,0 @@
1
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-ry-lxqmy.mjs';
2
- import { Parser } from './parsers.mjs';
3
- export { asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.mjs';
4
-
5
- /**
6
- * Farm.js Client-Side Query State Management
7
- *
8
- * Type-safe URL search parameter state management - Like useState, but stored in the URL query string.
9
- * Client-only hooks for managing query parameters in the browser.
10
- * Inspired by nuqs implementation patterns.
11
- */
12
-
13
- type UrlUpdateType = "push" | "replace";
14
- type HistoryMethod = "pushState" | "replaceState";
15
- interface Options {
16
- history?: HistoryMethod;
17
- shallow?: boolean;
18
- scroll?: boolean;
19
- throttleMs?: number;
20
- }
21
- declare function useQueryState<TParser extends Parser<any>>(key: string, parser: TParser, options?: Options): [
22
- NonNullable<ReturnType<TParser["parse"]>> | null,
23
- (value: NonNullable<ReturnType<TParser["parse"]>> | null) => void
24
- ];
25
- declare function useQueryState<T>(key: string, parser: Parser<T>, options?: Options): [T | null, (value: T | null) => void];
26
- declare function useQueryStates<T extends Record<string, Parser<any>>>(parsers: T, options?: Options): [
27
- {
28
- [K in keyof T]: ReturnType<T[K]["parse"]>;
29
- },
30
- (updates: Partial<{
31
- [K in keyof T]: ReturnType<T[K]["parse"]> | null;
32
- }>) => void
33
- ];
34
- declare function usePagination(options?: {
35
- defaultPage?: number;
36
- defaultLimit?: number;
37
- pageKey?: string;
38
- limitKey?: string;
39
- }): {
40
- page: number;
41
- setPage: (value: number | null) => void;
42
- limit: number;
43
- setLimit: (value: number | null) => void;
44
- offset: number;
45
- resetPagination: () => void;
46
- };
47
- declare function useSearchFilters<T extends Record<string, any>>(options?: {
48
- searchKey?: string;
49
- defaultFilters?: T;
50
- filterKeys?: (keyof T)[];
51
- }): {
52
- search: string | null;
53
- setSearch: (value: string | null) => void;
54
- filters: T;
55
- setFilters: (updates: Partial<{
56
- [x: string]: string | null;
57
- }>) => void;
58
- clearFilters: () => void;
59
- };
60
-
61
- export { type HistoryMethod, type Options, Parser, type UrlUpdateType, usePagination, useQueryState, useQueryStates, useSearchFilters };