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

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 (237) hide show
  1. package/dist/{chunk-5EVQFRL2.mjs → chunk-3WIRO3N7.mjs} +2 -2
  2. package/dist/chunk-3WIRO3N7.mjs.map +1 -0
  3. package/dist/chunk-53MVSX3R.mjs +168 -0
  4. package/dist/chunk-53MVSX3R.mjs.map +1 -0
  5. package/dist/{chunk-AW6I64AP.mjs → chunk-6ZXIQSXE.mjs} +16 -1
  6. package/dist/chunk-6ZXIQSXE.mjs.map +1 -0
  7. package/dist/chunk-7ZVN3YZI.mjs +333 -0
  8. package/dist/chunk-7ZVN3YZI.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-USLFXFFH.mjs +46 -0
  17. package/dist/chunk-USLFXFFH.mjs.map +1 -0
  18. package/dist/{chunk-4677KXB7.mjs → chunk-VSDZEB5M.mjs} +368 -103
  19. package/dist/chunk-VSDZEB5M.mjs.map +1 -0
  20. package/dist/{chunk-77BOAQHI.mjs → chunk-Z3YG4OZT.mjs} +725 -147
  21. package/dist/chunk-Z3YG4OZT.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 +2206 -680
  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 +2033 -516
  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 +1521 -339
  57. package/dist/plugin.cjs.map +1 -1
  58. package/dist/plugin.mjs +9 -5
  59. package/dist/server.cjs +1634 -410
  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 +1575 -349
  67. package/dist/vite.cjs.map +1 -1
  68. package/dist/vite.mjs +9 -5
  69. package/package.json +10 -1
  70. package/dist/after.d.mts +0 -25
  71. package/dist/after.d.ts +0 -25
  72. package/dist/agent-runtime.d.mts +0 -94
  73. package/dist/agent-runtime.d.ts +0 -94
  74. package/dist/api/route-manager.d.mts +0 -66
  75. package/dist/api/route-manager.d.ts +0 -66
  76. package/dist/api/runtime.d.mts +0 -3
  77. package/dist/api/runtime.d.ts +0 -3
  78. package/dist/api.d.mts +0 -48
  79. package/dist/api.d.ts +0 -48
  80. package/dist/app-BNE2FoZ4.d.mts +0 -302
  81. package/dist/app-DRGUmJ3s.d.ts +0 -302
  82. package/dist/app-markdown.d.mts +0 -22
  83. package/dist/app-markdown.d.ts +0 -22
  84. package/dist/cache.d.mts +0 -192
  85. package/dist/cache.d.ts +0 -192
  86. package/dist/chunk-4677KXB7.mjs.map +0 -1
  87. package/dist/chunk-4LND3PXF.mjs.map +0 -1
  88. package/dist/chunk-5EVQFRL2.mjs.map +0 -1
  89. package/dist/chunk-77BOAQHI.mjs.map +0 -1
  90. package/dist/chunk-AW6I64AP.mjs.map +0 -1
  91. package/dist/chunk-K5ZTUF22.mjs.map +0 -1
  92. package/dist/chunk-QM746KUO.mjs +0 -56
  93. package/dist/chunk-QM746KUO.mjs.map +0 -1
  94. package/dist/chunk-QTZZ2ISQ.mjs.map +0 -1
  95. package/dist/client-BT1mFQas.d.mts +0 -447
  96. package/dist/client-Nn0q4eO4.d.ts +0 -447
  97. package/dist/client-cache-CIlyBlmx.d.ts +0 -6
  98. package/dist/client-cache-D-EZ7XVW.d.mts +0 -6
  99. package/dist/client-plugins-Bc5jHcNr.d.ts +0 -1927
  100. package/dist/client-plugins-jsk-ZLzJ.d.mts +0 -1927
  101. package/dist/client-plugins.d.mts +0 -22
  102. package/dist/client-plugins.d.ts +0 -22
  103. package/dist/client.d.mts +0 -447
  104. package/dist/client.d.ts +0 -447
  105. package/dist/config.d.mts +0 -29
  106. package/dist/config.d.ts +0 -29
  107. package/dist/cron.d.mts +0 -78
  108. package/dist/cron.d.ts +0 -78
  109. package/dist/deferred.d.mts +0 -42
  110. package/dist/deferred.d.ts +0 -42
  111. package/dist/deployment.d.mts +0 -34
  112. package/dist/deployment.d.ts +0 -34
  113. package/dist/docs.d.mts +0 -69
  114. package/dist/docs.d.ts +0 -69
  115. package/dist/env-types.d.mts +0 -12
  116. package/dist/env-types.d.ts +0 -12
  117. package/dist/env.d.mts +0 -45
  118. package/dist/env.d.ts +0 -45
  119. package/dist/environment/vite.d.mts +0 -22
  120. package/dist/environment/vite.d.ts +0 -22
  121. package/dist/environment.d.mts +0 -18
  122. package/dist/environment.d.ts +0 -18
  123. package/dist/font.d.mts +0 -70
  124. package/dist/font.d.ts +0 -70
  125. package/dist/headers.d.mts +0 -22
  126. package/dist/headers.d.ts +0 -22
  127. package/dist/i18n/client.d.mts +0 -32
  128. package/dist/i18n/client.d.ts +0 -32
  129. package/dist/i18n/index.d.mts +0 -20
  130. package/dist/i18n/index.d.ts +0 -20
  131. package/dist/i18n/server.d.mts +0 -30
  132. package/dist/i18n/server.d.ts +0 -30
  133. package/dist/image/server.d.mts +0 -37
  134. package/dist/image/server.d.ts +0 -37
  135. package/dist/image/sharp.d.mts +0 -7
  136. package/dist/image/sharp.d.ts +0 -7
  137. package/dist/image-config-Duob7wER.d.mts +0 -50
  138. package/dist/image-config-Duob7wER.d.ts +0 -50
  139. package/dist/image.d.mts +0 -39
  140. package/dist/image.d.ts +0 -39
  141. package/dist/index.d.mts +0 -455
  142. package/dist/index.d.ts +0 -455
  143. package/dist/integration-api-CHT2OKAf.d.mts +0 -93
  144. package/dist/integration-api-CHT2OKAf.d.ts +0 -93
  145. package/dist/integrations.d.mts +0 -22
  146. package/dist/integrations.d.ts +0 -22
  147. package/dist/internal/build-runtime.d.mts +0 -39
  148. package/dist/internal/build-runtime.d.ts +0 -39
  149. package/dist/internal/client-runtime.d.mts +0 -2
  150. package/dist/internal/client-runtime.d.ts +0 -2
  151. package/dist/internal/config-runtime.d.mts +0 -39
  152. package/dist/internal/config-runtime.d.ts +0 -39
  153. package/dist/internal/production-node-env.d.mts +0 -12
  154. package/dist/internal/production-node-env.d.ts +0 -12
  155. package/dist/internal/production-runtime.d.mts +0 -41
  156. package/dist/internal/production-runtime.d.ts +0 -41
  157. package/dist/markdown.d.mts +0 -60
  158. package/dist/markdown.d.ts +0 -60
  159. package/dist/metadata-7ffpT3jr.d.mts +0 -22
  160. package/dist/metadata-JHn-8eht.d.ts +0 -22
  161. package/dist/middleware.d.mts +0 -164
  162. package/dist/middleware.d.ts +0 -164
  163. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  164. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  165. package/dist/navigation.d.mts +0 -14
  166. package/dist/navigation.d.ts +0 -14
  167. package/dist/observability.d.mts +0 -335
  168. package/dist/observability.d.ts +0 -335
  169. package/dist/params-BALtrRim.d.ts +0 -15
  170. package/dist/params-ry-lxqmy.d.mts +0 -15
  171. package/dist/plugin-BJDf43dc.d.mts +0 -165
  172. package/dist/plugin-BJDf43dc.d.ts +0 -165
  173. package/dist/plugin.d.mts +0 -22
  174. package/dist/plugin.d.ts +0 -22
  175. package/dist/production-runtime-9KG7GuvW.d.ts +0 -79
  176. package/dist/production-runtime-B-fweKts.d.mts +0 -79
  177. package/dist/production-runtime-C_B79w2P.d.mts +0 -28
  178. package/dist/production-runtime-DDEM1D2q.d.ts +0 -28
  179. package/dist/query/client.d.mts +0 -61
  180. package/dist/query/client.d.ts +0 -61
  181. package/dist/query/index.d.mts +0 -90
  182. package/dist/query/index.d.ts +0 -90
  183. package/dist/query/parsers.d.mts +0 -25
  184. package/dist/query/parsers.d.ts +0 -25
  185. package/dist/query/server.d.mts +0 -55
  186. package/dist/query/server.d.ts +0 -55
  187. package/dist/request-Dsq4kGW0.d.mts +0 -6
  188. package/dist/request-udtobOLv.d.ts +0 -6
  189. package/dist/request.d.mts +0 -2
  190. package/dist/request.d.ts +0 -2
  191. package/dist/resolver-DJqjLMg_.d.mts +0 -14
  192. package/dist/resolver-IH4RmPEl.d.ts +0 -14
  193. package/dist/route-runtime-DoOHzCAD.d.mts +0 -38
  194. package/dist/route-runtime-DoOHzCAD.d.ts +0 -38
  195. package/dist/router.d.mts +0 -36
  196. package/dist/router.d.ts +0 -36
  197. package/dist/routes.d.mts +0 -224
  198. package/dist/routes.d.ts +0 -224
  199. package/dist/runtime-9nQjVM7X.d.mts +0 -206
  200. package/dist/runtime-Cxpq6xZN.d.mts +0 -27
  201. package/dist/runtime-DgeS2skB.d.ts +0 -206
  202. package/dist/runtime-bv63eUiO.d.ts +0 -27
  203. package/dist/server-action-security.d.mts +0 -43
  204. package/dist/server-action-security.d.ts +0 -43
  205. package/dist/server-fn-client.d.mts +0 -32
  206. package/dist/server-fn-client.d.ts +0 -32
  207. package/dist/server-fn.d.mts +0 -93
  208. package/dist/server-fn.d.ts +0 -93
  209. package/dist/server-plugins.d.mts +0 -55
  210. package/dist/server-plugins.d.ts +0 -55
  211. package/dist/server-query-client.d.mts +0 -50
  212. package/dist/server-query-client.d.ts +0 -50
  213. package/dist/server-query.d.mts +0 -36
  214. package/dist/server-query.d.ts +0 -36
  215. package/dist/server.d.mts +0 -48
  216. package/dist/server.d.ts +0 -48
  217. package/dist/storage.d.mts +0 -52
  218. package/dist/storage.d.ts +0 -52
  219. package/dist/testing.d.mts +0 -101
  220. package/dist/testing.d.ts +0 -101
  221. package/dist/transport-BmbGTXA5.d.mts +0 -49
  222. package/dist/transport-BmbGTXA5.d.ts +0 -49
  223. package/dist/types-BMxWr97v.d.mts +0 -81
  224. package/dist/types-BMxWr97v.d.ts +0 -81
  225. package/dist/types-C9N-nk5R.d.mts +0 -53
  226. package/dist/types-C9N-nk5R.d.ts +0 -53
  227. package/dist/types-D1A6-XvH.d.mts +0 -73
  228. package/dist/types-D1A6-XvH.d.ts +0 -73
  229. package/dist/utils-CA0z0c-2.d.ts +0 -23
  230. package/dist/utils-mYVkSOt2.d.mts +0 -23
  231. package/dist/version.d.mts +0 -3
  232. package/dist/version.d.ts +0 -3
  233. package/dist/vite.d.mts +0 -22
  234. package/dist/vite.d.ts +0 -22
  235. package/dist/workflows.d.mts +0 -110
  236. package/dist/workflows.d.ts +0 -110
  237. /package/dist/{chunk-7N62DNSO.mjs.map → chunk-H3TE3LOV.mjs.map} +0 -0
@@ -1,61 +0,0 @@
1
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-BALtrRim.js';
2
- import { Parser } from './parsers.js';
3
- export { asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.js';
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 };
@@ -1,90 +0,0 @@
1
- export { Parser, asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.mjs';
2
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-ry-lxqmy.mjs';
3
- import { ReactNode, ComponentType } from 'react';
4
-
5
- /**
6
- * Farm.js Query State Types
7
- */
8
-
9
- /**
10
- * Props for Farm.js page components with search params
11
- */
12
- /**
13
- * Props for Farm.js layout components
14
- */
15
- interface LayoutPropsSafe {
16
- children: ReactNode;
17
- params: Record<string, string>;
18
- }
19
- interface PagePropsSafe {
20
- params: Record<string, string>;
21
- searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>;
22
- }
23
- /**
24
- * Query state configuration for Farm.js
25
- */
26
- interface QueryStateConfig {
27
- /**
28
- * Default history method for URL updates
29
- * @default 'push'
30
- */
31
- defaultHistoryMethod?: "push" | "replace";
32
- /**
33
- * Default shallow routing behavior
34
- * @default true
35
- */
36
- shallow?: boolean;
37
- /**
38
- * Default scroll behavior
39
- * @default true
40
- */
41
- scroll?: boolean;
42
- /**
43
- * Custom serialization options
44
- */
45
- serialization?: {
46
- /**
47
- * Custom URL key mappings
48
- */
49
- urlKeys?: Record<string, string>;
50
- /**
51
- * Custom base URL for serialization
52
- */
53
- baseUrl?: string;
54
- };
55
- }
56
- /**
57
- * Farm.js specific query state context
58
- */
59
- interface FarmQueryStateContext {
60
- /**
61
- * Current search parameters
62
- */
63
- searchParams: URLSearchParams;
64
- /**
65
- * Current pathname
66
- */
67
- pathname: string;
68
- /**
69
- * Update URL with new search parameters
70
- */
71
- updateUrl: (params: Record<string, any>, options?: {
72
- method?: "push" | "replace";
73
- shallow?: boolean;
74
- scroll?: boolean;
75
- }) => void;
76
- /**
77
- * Clear all search parameters
78
- */
79
- clearParams: () => void;
80
- }
81
- /**
82
- * Higher-order component for providing query state context
83
- */
84
- type QueryStateProvider = ComponentType<{
85
- children: ReactNode;
86
- searchParams?: URLSearchParams;
87
- pathname?: string;
88
- }>;
89
-
90
- export type { FarmQueryStateContext, LayoutPropsSafe, PagePropsSafe, QueryStateConfig, QueryStateProvider };
@@ -1,90 +0,0 @@
1
- export { Parser, asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.js';
2
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-BALtrRim.js';
3
- import { ReactNode, ComponentType } from 'react';
4
-
5
- /**
6
- * Farm.js Query State Types
7
- */
8
-
9
- /**
10
- * Props for Farm.js page components with search params
11
- */
12
- /**
13
- * Props for Farm.js layout components
14
- */
15
- interface LayoutPropsSafe {
16
- children: ReactNode;
17
- params: Record<string, string>;
18
- }
19
- interface PagePropsSafe {
20
- params: Record<string, string>;
21
- searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>;
22
- }
23
- /**
24
- * Query state configuration for Farm.js
25
- */
26
- interface QueryStateConfig {
27
- /**
28
- * Default history method for URL updates
29
- * @default 'push'
30
- */
31
- defaultHistoryMethod?: "push" | "replace";
32
- /**
33
- * Default shallow routing behavior
34
- * @default true
35
- */
36
- shallow?: boolean;
37
- /**
38
- * Default scroll behavior
39
- * @default true
40
- */
41
- scroll?: boolean;
42
- /**
43
- * Custom serialization options
44
- */
45
- serialization?: {
46
- /**
47
- * Custom URL key mappings
48
- */
49
- urlKeys?: Record<string, string>;
50
- /**
51
- * Custom base URL for serialization
52
- */
53
- baseUrl?: string;
54
- };
55
- }
56
- /**
57
- * Farm.js specific query state context
58
- */
59
- interface FarmQueryStateContext {
60
- /**
61
- * Current search parameters
62
- */
63
- searchParams: URLSearchParams;
64
- /**
65
- * Current pathname
66
- */
67
- pathname: string;
68
- /**
69
- * Update URL with new search parameters
70
- */
71
- updateUrl: (params: Record<string, any>, options?: {
72
- method?: "push" | "replace";
73
- shallow?: boolean;
74
- scroll?: boolean;
75
- }) => void;
76
- /**
77
- * Clear all search parameters
78
- */
79
- clearParams: () => void;
80
- }
81
- /**
82
- * Higher-order component for providing query state context
83
- */
84
- type QueryStateProvider = ComponentType<{
85
- children: ReactNode;
86
- searchParams?: URLSearchParams;
87
- pathname?: string;
88
- }>;
89
-
90
- export type { FarmQueryStateContext, LayoutPropsSafe, PagePropsSafe, QueryStateConfig, QueryStateProvider };
@@ -1,25 +0,0 @@
1
- /**
2
- * Farm.js Query State Parsers
3
- *
4
- * Shared parsers that can be used in both client and server contexts
5
- */
6
- interface Parser<T> {
7
- parse: (value: string) => T | null;
8
- serialize: (value: T) => string;
9
- withDefault?: (defaultValue: T) => Parser<T>;
10
- }
11
- declare const asString: Parser<string>;
12
- declare const asInteger: Parser<number>;
13
- declare const asFloat: Parser<number>;
14
- declare const asBoolean: Parser<boolean>;
15
- declare function asArrayOf<T>(itemParser: Parser<T>): Parser<T[]>;
16
- declare function asJson<T>(): Parser<T>;
17
- declare const asIsoDate: Parser<Date>;
18
- declare const asIsoDateTime: Parser<Date>;
19
- declare function createParser<T>(config: {
20
- parse: (value: string) => T | null;
21
- serialize: (value: T) => string;
22
- }): Parser<T>;
23
- type inferParserType<T> = T extends Parser<infer U> ? U : never;
24
-
25
- export { type Parser, asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, type inferParserType };
@@ -1,25 +0,0 @@
1
- /**
2
- * Farm.js Query State Parsers
3
- *
4
- * Shared parsers that can be used in both client and server contexts
5
- */
6
- interface Parser<T> {
7
- parse: (value: string) => T | null;
8
- serialize: (value: T) => string;
9
- withDefault?: (defaultValue: T) => Parser<T>;
10
- }
11
- declare const asString: Parser<string>;
12
- declare const asInteger: Parser<number>;
13
- declare const asFloat: Parser<number>;
14
- declare const asBoolean: Parser<boolean>;
15
- declare function asArrayOf<T>(itemParser: Parser<T>): Parser<T[]>;
16
- declare function asJson<T>(): Parser<T>;
17
- declare const asIsoDate: Parser<Date>;
18
- declare const asIsoDateTime: Parser<Date>;
19
- declare function createParser<T>(config: {
20
- parse: (value: string) => T | null;
21
- serialize: (value: T) => string;
22
- }): Parser<T>;
23
- type inferParserType<T> = T extends Parser<infer U> ? U : never;
24
-
25
- export { type Parser, asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, type inferParserType };
@@ -1,55 +0,0 @@
1
- import { Parser } from './parsers.mjs';
2
- export { asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.mjs';
3
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-ry-lxqmy.mjs';
4
-
5
- /**
6
- * Farm.js Server-Side Query State Management
7
- *
8
- * Server-side utilities for parsing and handling URL search parameters
9
- */
10
-
11
- type SearchParams = Record<string, string | string[] | undefined>;
12
- /**
13
- * Server-side utility to load and parse search parameters
14
- *
15
- * @example
16
- * ```tsx
17
- * // In a server component
18
- * import { loadSearchParams, parseAsString, parseAsInteger } from 'farm/query/server';
19
- *
20
- * export default async function MyPage({ searchParams }: PageProps) {
21
- * const params = await loadSearchParams(searchParams, {
22
- * search: parseAsString.withDefault!(''),
23
- * page: parseAsInteger.withDefault!(1),
24
- * });
25
- *
26
- * return <div>Search: {params.search}, Page: {params.page}</div>;
27
- * }
28
- * ```
29
- */
30
- declare function loadSearchParams<T extends Record<string, Parser<any>>>(searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>, parsers: T): Promise<{
31
- [K in keyof T]: ReturnType<T[K]["parse"]>;
32
- }>;
33
- /**
34
- * Creates pagination metadata for server components.
35
- *
36
- * @param searchParams The search parameters promise.
37
- * @param options Configuration options for pagination.
38
- * @returns Pagination metadata.
39
- */
40
- declare function createPaginationMeta(searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>, options: {
41
- totalItems: number;
42
- itemsPerPage?: number;
43
- pageParam?: string;
44
- }): Promise<{
45
- currentPage: number;
46
- itemsPerPage: number;
47
- totalItems: number;
48
- totalPages: number;
49
- offset: number;
50
- limit: number;
51
- hasNextPage: boolean;
52
- hasPreviousPage: boolean;
53
- }>;
54
-
55
- export { Parser, type SearchParams, createPaginationMeta, loadSearchParams };
@@ -1,55 +0,0 @@
1
- import { Parser } from './parsers.js';
2
- export { asArrayOf, asBoolean, asFloat, asInteger, asIsoDate, asIsoDateTime, asJson, asString, createParser, inferParserType } from './parsers.js';
3
- export { R as RouteParamsInput, l as loadRouteParams, p as parseRouteParams } from '../params-BALtrRim.js';
4
-
5
- /**
6
- * Farm.js Server-Side Query State Management
7
- *
8
- * Server-side utilities for parsing and handling URL search parameters
9
- */
10
-
11
- type SearchParams = Record<string, string | string[] | undefined>;
12
- /**
13
- * Server-side utility to load and parse search parameters
14
- *
15
- * @example
16
- * ```tsx
17
- * // In a server component
18
- * import { loadSearchParams, parseAsString, parseAsInteger } from 'farm/query/server';
19
- *
20
- * export default async function MyPage({ searchParams }: PageProps) {
21
- * const params = await loadSearchParams(searchParams, {
22
- * search: parseAsString.withDefault!(''),
23
- * page: parseAsInteger.withDefault!(1),
24
- * });
25
- *
26
- * return <div>Search: {params.search}, Page: {params.page}</div>;
27
- * }
28
- * ```
29
- */
30
- declare function loadSearchParams<T extends Record<string, Parser<any>>>(searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>, parsers: T): Promise<{
31
- [K in keyof T]: ReturnType<T[K]["parse"]>;
32
- }>;
33
- /**
34
- * Creates pagination metadata for server components.
35
- *
36
- * @param searchParams The search parameters promise.
37
- * @param options Configuration options for pagination.
38
- * @returns Pagination metadata.
39
- */
40
- declare function createPaginationMeta(searchParams: Promise<URLSearchParams | Record<string, string | string[] | undefined>>, options: {
41
- totalItems: number;
42
- itemsPerPage?: number;
43
- pageParam?: string;
44
- }): Promise<{
45
- currentPage: number;
46
- itemsPerPage: number;
47
- totalItems: number;
48
- totalPages: number;
49
- offset: number;
50
- limit: number;
51
- hasNextPage: boolean;
52
- hasPreviousPage: boolean;
53
- }>;
54
-
55
- export { Parser, type SearchParams, createPaginationMeta, loadSearchParams };
@@ -1,6 +0,0 @@
1
- import './types-BMxWr97v.mjs';
2
-
3
- declare function _runWithCurrentRequest<T>(request: Request, fn: () => Promise<T> | T): Promise<T>;
4
- declare function getCurrentRequest(): Request;
5
-
6
- export { _runWithCurrentRequest as _, getCurrentRequest as g };
@@ -1,6 +0,0 @@
1
- import './types-BMxWr97v.js';
2
-
3
- declare function _runWithCurrentRequest<T>(request: Request, fn: () => Promise<T> | T): Promise<T>;
4
- declare function getCurrentRequest(): Request;
5
-
6
- export { _runWithCurrentRequest as _, getCurrentRequest as g };
@@ -1,2 +0,0 @@
1
- export { g as getCurrentRequest } from './request-Dsq4kGW0.mjs';
2
- import './types-BMxWr97v.mjs';
package/dist/request.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { g as getCurrentRequest } from './request-udtobOLv.js';
2
- import './types-BMxWr97v.js';
@@ -1,14 +0,0 @@
1
- import { b as FarmI18nLocaleSource, R as ResolvedFarmI18nConfig } from './types-BMxWr97v.mjs';
2
-
3
- interface FarmLocaleResolution {
4
- locale: string;
5
- source: FarmI18nLocaleSource;
6
- pathname: string;
7
- redirect?: string;
8
- persist: boolean;
9
- }
10
- declare function getFarmLocaleVaryHeaders(config: ResolvedFarmI18nConfig, resolution: FarmLocaleResolution): string[];
11
- declare function createFarmLocaleCookie(locale: string, config: Pick<ResolvedFarmI18nConfig, "cookie">): string;
12
- declare function matchFarmLocale(requested: string | null | undefined, locales: readonly string[]): string | undefined;
13
-
14
- export { type FarmLocaleResolution as F, createFarmLocaleCookie as c, getFarmLocaleVaryHeaders as g, matchFarmLocale as m };
@@ -1,14 +0,0 @@
1
- import { b as FarmI18nLocaleSource, R as ResolvedFarmI18nConfig } from './types-BMxWr97v.js';
2
-
3
- interface FarmLocaleResolution {
4
- locale: string;
5
- source: FarmI18nLocaleSource;
6
- pathname: string;
7
- redirect?: string;
8
- persist: boolean;
9
- }
10
- declare function getFarmLocaleVaryHeaders(config: ResolvedFarmI18nConfig, resolution: FarmLocaleResolution): string[];
11
- declare function createFarmLocaleCookie(locale: string, config: Pick<ResolvedFarmI18nConfig, "cookie">): string;
12
- declare function matchFarmLocale(requested: string | null | undefined, locales: readonly string[]): string | undefined;
13
-
14
- export { type FarmLocaleResolution as F, createFarmLocaleCookie as c, getFarmLocaleVaryHeaders as g, matchFarmLocale as m };
@@ -1,38 +0,0 @@
1
- type FarmRouteRuntime = "auto" | "node" | "edge";
2
- type FarmRouteRegions = "auto" | readonly string[];
3
- type FarmRouteMaxDuration = "auto" | number;
4
- /** Portable execution controls shared by file, programmatic, and config routes. */
5
- interface FarmRouteRuntimeConfig {
6
- runtime?: FarmRouteRuntime;
7
- regions?: FarmRouteRegions;
8
- maxDuration?: FarmRouteMaxDuration;
9
- }
10
- interface ResolvedFarmRouteRuntimeConfig {
11
- runtime: FarmRouteRuntime;
12
- regions?: string[];
13
- maxDuration?: number;
14
- }
15
- type FarmRouteRuntimeEntryKind = "page" | "api" | "rule";
16
- type FarmRouteRenderingMode = "static" | "dynamic";
17
- interface FarmRouteRuntimeManifestEntry extends ResolvedFarmRouteRuntimeConfig {
18
- kind: FarmRouteRuntimeEntryKind;
19
- pattern: string;
20
- rendering: FarmRouteRenderingMode;
21
- source?: string;
22
- }
23
- interface FarmRouteRuntimeManifest {
24
- version: 1;
25
- routes: FarmRouteRuntimeManifestEntry[];
26
- }
27
- declare function normalizeFarmRouteRuntimeConfig(value: FarmRouteRuntimeConfig | null | undefined, source?: string): FarmRouteRuntimeConfig;
28
- /** Merge from lowest to highest precedence. Explicit "auto" values reset inherited hints. */
29
- declare function mergeFarmRouteRuntimeConfigs(...configs: Array<FarmRouteRuntimeConfig | null | undefined>): FarmRouteRuntimeConfig;
30
- declare function resolveFarmRouteRuntimeConfig(config: FarmRouteRuntimeConfig | null | undefined, source?: string): ResolvedFarmRouteRuntimeConfig;
31
- declare function hasFarmRouteRuntimeControls(config: FarmRouteRuntimeConfig | null | undefined): boolean;
32
- declare function getFarmRouteRuntimeConfig(value: unknown): FarmRouteRuntimeConfig;
33
- declare function createFarmRouteRuntimeKey(config: ResolvedFarmRouteRuntimeConfig): string;
34
- /** Resolve matching route rules from broadest to most specific. */
35
- declare function resolveFarmRouteRuleRuntimeConfig(pathname: string, routeRules: Record<string, FarmRouteRuntimeConfig> | null | undefined): FarmRouteRuntimeConfig;
36
- declare function farmRouteRuleMatches(pattern: string, pathname: string): boolean;
37
-
38
- export { type FarmRouteRuntimeConfig as F, type ResolvedFarmRouteRuntimeConfig as R, type FarmRouteRuntime as a, type FarmRouteRegions as b, type FarmRouteMaxDuration as c, type FarmRouteRuntimeEntryKind as d, type FarmRouteRenderingMode as e, type FarmRouteRuntimeManifestEntry as f, type FarmRouteRuntimeManifest as g, hasFarmRouteRuntimeControls as h, getFarmRouteRuntimeConfig as i, createFarmRouteRuntimeKey as j, resolveFarmRouteRuleRuntimeConfig as k, farmRouteRuleMatches as l, mergeFarmRouteRuntimeConfigs as m, normalizeFarmRouteRuntimeConfig as n, resolveFarmRouteRuntimeConfig as r };
@@ -1,38 +0,0 @@
1
- type FarmRouteRuntime = "auto" | "node" | "edge";
2
- type FarmRouteRegions = "auto" | readonly string[];
3
- type FarmRouteMaxDuration = "auto" | number;
4
- /** Portable execution controls shared by file, programmatic, and config routes. */
5
- interface FarmRouteRuntimeConfig {
6
- runtime?: FarmRouteRuntime;
7
- regions?: FarmRouteRegions;
8
- maxDuration?: FarmRouteMaxDuration;
9
- }
10
- interface ResolvedFarmRouteRuntimeConfig {
11
- runtime: FarmRouteRuntime;
12
- regions?: string[];
13
- maxDuration?: number;
14
- }
15
- type FarmRouteRuntimeEntryKind = "page" | "api" | "rule";
16
- type FarmRouteRenderingMode = "static" | "dynamic";
17
- interface FarmRouteRuntimeManifestEntry extends ResolvedFarmRouteRuntimeConfig {
18
- kind: FarmRouteRuntimeEntryKind;
19
- pattern: string;
20
- rendering: FarmRouteRenderingMode;
21
- source?: string;
22
- }
23
- interface FarmRouteRuntimeManifest {
24
- version: 1;
25
- routes: FarmRouteRuntimeManifestEntry[];
26
- }
27
- declare function normalizeFarmRouteRuntimeConfig(value: FarmRouteRuntimeConfig | null | undefined, source?: string): FarmRouteRuntimeConfig;
28
- /** Merge from lowest to highest precedence. Explicit "auto" values reset inherited hints. */
29
- declare function mergeFarmRouteRuntimeConfigs(...configs: Array<FarmRouteRuntimeConfig | null | undefined>): FarmRouteRuntimeConfig;
30
- declare function resolveFarmRouteRuntimeConfig(config: FarmRouteRuntimeConfig | null | undefined, source?: string): ResolvedFarmRouteRuntimeConfig;
31
- declare function hasFarmRouteRuntimeControls(config: FarmRouteRuntimeConfig | null | undefined): boolean;
32
- declare function getFarmRouteRuntimeConfig(value: unknown): FarmRouteRuntimeConfig;
33
- declare function createFarmRouteRuntimeKey(config: ResolvedFarmRouteRuntimeConfig): string;
34
- /** Resolve matching route rules from broadest to most specific. */
35
- declare function resolveFarmRouteRuleRuntimeConfig(pathname: string, routeRules: Record<string, FarmRouteRuntimeConfig> | null | undefined): FarmRouteRuntimeConfig;
36
- declare function farmRouteRuleMatches(pattern: string, pathname: string): boolean;
37
-
38
- export { type FarmRouteRuntimeConfig as F, type ResolvedFarmRouteRuntimeConfig as R, type FarmRouteRuntime as a, type FarmRouteRegions as b, type FarmRouteMaxDuration as c, type FarmRouteRuntimeEntryKind as d, type FarmRouteRenderingMode as e, type FarmRouteRuntimeManifestEntry as f, type FarmRouteRuntimeManifest as g, hasFarmRouteRuntimeControls as h, getFarmRouteRuntimeConfig as i, createFarmRouteRuntimeKey as j, resolveFarmRouteRuleRuntimeConfig as k, farmRouteRuleMatches as l, mergeFarmRouteRuntimeConfigs as m, normalizeFarmRouteRuntimeConfig as n, resolveFarmRouteRuntimeConfig as r };
package/dist/router.d.mts DELETED
@@ -1,36 +0,0 @@
1
- type FarmRouterPrimitiveParam = string | number | boolean;
2
- type FarmRouterPathParam = FarmRouterPrimitiveParam | readonly FarmRouterPrimitiveParam[] | null | undefined;
3
- type FarmRouterPathParams = Record<string, FarmRouterPathParam>;
4
- type FarmRouterParams = Record<string, string>;
5
- interface FarmRouterRoute<TMeta = unknown> {
6
- path: string;
7
- name?: string;
8
- meta?: TMeta;
9
- }
10
- type FarmRouterRouteInput<TMeta = unknown> = string | FarmRouterRoute<TMeta>;
11
- interface FarmRouterMatch<TMeta = unknown> {
12
- route: FarmRouterRoute<TMeta>;
13
- pathname: string;
14
- params: FarmRouterParams;
15
- }
16
- type FarmRouterQueryValue = FarmRouterPrimitiveParam | readonly FarmRouterPrimitiveParam[] | null | undefined;
17
- interface FarmRouterBuildOptions {
18
- query?: URLSearchParams | Record<string, FarmRouterQueryValue>;
19
- hash?: string;
20
- trailingSlash?: boolean;
21
- }
22
- interface FarmRouterActiveOptions {
23
- exact?: boolean;
24
- }
25
- interface FarmRouter<TMeta = unknown> {
26
- routes: FarmRouterRoute<TMeta>[];
27
- match(pathname: string): FarmRouterMatch<TMeta> | null;
28
- build(pattern: string, params?: FarmRouterPathParams, options?: FarmRouterBuildOptions): string;
29
- isActive(pattern: string, pathname: string, options?: FarmRouterActiveOptions): boolean;
30
- }
31
- declare function createFarmRouter<TMeta = unknown>(routes: FarmRouterRouteInput<TMeta>[]): FarmRouter<TMeta>;
32
- declare function matchFarmRoute(pattern: string, pathname: string): FarmRouterParams | null;
33
- declare function buildFarmRoutePath(pattern: string, params?: FarmRouterPathParams, options?: FarmRouterBuildOptions): string;
34
- declare function isFarmRouteActive(pattern: string, pathname: string, options?: FarmRouterActiveOptions): boolean;
35
-
36
- export { type FarmRouter, type FarmRouterActiveOptions, type FarmRouterBuildOptions, type FarmRouterMatch, type FarmRouterParams, type FarmRouterPathParam, type FarmRouterPathParams, type FarmRouterPrimitiveParam, type FarmRouterQueryValue, type FarmRouterRoute, type FarmRouterRouteInput, buildFarmRoutePath, createFarmRouter, isFarmRouteActive, matchFarmRoute };
package/dist/router.d.ts DELETED
@@ -1,36 +0,0 @@
1
- type FarmRouterPrimitiveParam = string | number | boolean;
2
- type FarmRouterPathParam = FarmRouterPrimitiveParam | readonly FarmRouterPrimitiveParam[] | null | undefined;
3
- type FarmRouterPathParams = Record<string, FarmRouterPathParam>;
4
- type FarmRouterParams = Record<string, string>;
5
- interface FarmRouterRoute<TMeta = unknown> {
6
- path: string;
7
- name?: string;
8
- meta?: TMeta;
9
- }
10
- type FarmRouterRouteInput<TMeta = unknown> = string | FarmRouterRoute<TMeta>;
11
- interface FarmRouterMatch<TMeta = unknown> {
12
- route: FarmRouterRoute<TMeta>;
13
- pathname: string;
14
- params: FarmRouterParams;
15
- }
16
- type FarmRouterQueryValue = FarmRouterPrimitiveParam | readonly FarmRouterPrimitiveParam[] | null | undefined;
17
- interface FarmRouterBuildOptions {
18
- query?: URLSearchParams | Record<string, FarmRouterQueryValue>;
19
- hash?: string;
20
- trailingSlash?: boolean;
21
- }
22
- interface FarmRouterActiveOptions {
23
- exact?: boolean;
24
- }
25
- interface FarmRouter<TMeta = unknown> {
26
- routes: FarmRouterRoute<TMeta>[];
27
- match(pathname: string): FarmRouterMatch<TMeta> | null;
28
- build(pattern: string, params?: FarmRouterPathParams, options?: FarmRouterBuildOptions): string;
29
- isActive(pattern: string, pathname: string, options?: FarmRouterActiveOptions): boolean;
30
- }
31
- declare function createFarmRouter<TMeta = unknown>(routes: FarmRouterRouteInput<TMeta>[]): FarmRouter<TMeta>;
32
- declare function matchFarmRoute(pattern: string, pathname: string): FarmRouterParams | null;
33
- declare function buildFarmRoutePath(pattern: string, params?: FarmRouterPathParams, options?: FarmRouterBuildOptions): string;
34
- declare function isFarmRouteActive(pattern: string, pathname: string, options?: FarmRouterActiveOptions): boolean;
35
-
36
- export { type FarmRouter, type FarmRouterActiveOptions, type FarmRouterBuildOptions, type FarmRouterMatch, type FarmRouterParams, type FarmRouterPathParam, type FarmRouterPathParams, type FarmRouterPrimitiveParam, type FarmRouterQueryValue, type FarmRouterRoute, type FarmRouterRouteInput, buildFarmRoutePath, createFarmRouter, isFarmRouteActive, matchFarmRoute };