@farm.js/convex 0.0.0-stage → 0.1.0-beta.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 (99) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +63 -2
  3. package/dist/ConvexClientProvider.d.ts +3 -0
  4. package/dist/ConvexClientProvider.d.ts.map +1 -0
  5. package/dist/ConvexClientProvider.js +6 -0
  6. package/dist/adapter-client.d.ts +3 -0
  7. package/dist/adapter-client.d.ts.map +1 -0
  8. package/dist/adapter-client.js +21 -0
  9. package/dist/client.d.ts +5 -0
  10. package/dist/client.d.ts.map +1 -0
  11. package/dist/client.js +3 -0
  12. package/dist/clients.d.ts +3 -0
  13. package/dist/clients.d.ts.map +1 -0
  14. package/dist/clients.js +10 -0
  15. package/dist/component/_generated/api.d.ts +38 -0
  16. package/dist/component/_generated/api.d.ts.map +1 -0
  17. package/dist/component/_generated/api.js +30 -0
  18. package/dist/component/_generated/component.d.ts +57 -0
  19. package/dist/component/_generated/component.d.ts.map +1 -0
  20. package/dist/component/_generated/component.js +10 -0
  21. package/dist/component/_generated/dataModel.d.ts +46 -0
  22. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  23. package/dist/component/_generated/dataModel.js +10 -0
  24. package/dist/component/_generated/server.d.ts +133 -0
  25. package/dist/component/_generated/server.d.ts.map +1 -0
  26. package/dist/component/_generated/server.js +78 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +2 -0
  30. package/dist/component/rateLimits.d.ts +15 -0
  31. package/dist/component/rateLimits.d.ts.map +1 -0
  32. package/dist/component/rateLimits.js +40 -0
  33. package/dist/component/schema.d.ts +24 -0
  34. package/dist/component/schema.d.ts.map +1 -0
  35. package/dist/component/schema.js +13 -0
  36. package/dist/component/storage.d.ts +17 -0
  37. package/dist/component/storage.d.ts.map +1 -0
  38. package/dist/component/storage.js +62 -0
  39. package/dist/component/validators.d.ts +8 -0
  40. package/dist/component/validators.d.ts.map +1 -0
  41. package/dist/component/validators.js +5 -0
  42. package/dist/component.d.ts +12 -0
  43. package/dist/component.d.ts.map +1 -0
  44. package/dist/component.js +52 -0
  45. package/dist/detect.d.ts +6 -0
  46. package/dist/detect.d.ts.map +1 -0
  47. package/dist/detect.js +18 -0
  48. package/dist/dev.d.ts +10 -0
  49. package/dist/dev.d.ts.map +1 -0
  50. package/dist/dev.js +122 -0
  51. package/dist/environment.d.ts +6 -0
  52. package/dist/environment.d.ts.map +1 -0
  53. package/dist/environment.js +62 -0
  54. package/dist/extensions.d.ts +8 -0
  55. package/dist/extensions.d.ts.map +1 -0
  56. package/dist/extensions.js +55 -0
  57. package/dist/forward.d.ts +2 -0
  58. package/dist/forward.d.ts.map +1 -0
  59. package/dist/forward.js +38 -0
  60. package/dist/functions.d.ts +42 -0
  61. package/dist/functions.d.ts.map +1 -0
  62. package/dist/functions.js +90 -0
  63. package/dist/homes.d.ts +11 -0
  64. package/dist/homes.d.ts.map +1 -0
  65. package/dist/homes.js +81 -0
  66. package/dist/index.d.ts +35 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +87 -0
  69. package/dist/known.d.ts +7 -0
  70. package/dist/known.d.ts.map +1 -0
  71. package/dist/known.js +33 -0
  72. package/dist/pairs.d.ts +6 -0
  73. package/dist/pairs.d.ts.map +1 -0
  74. package/dist/pairs.js +28 -0
  75. package/dist/rate-limit.d.ts +4 -0
  76. package/dist/rate-limit.d.ts.map +1 -0
  77. package/dist/rate-limit.js +16 -0
  78. package/dist/runtime.d.ts +5 -0
  79. package/dist/runtime.d.ts.map +1 -0
  80. package/dist/runtime.js +14 -0
  81. package/dist/secret.d.ts +3 -0
  82. package/dist/secret.d.ts.map +1 -0
  83. package/dist/secret.js +8 -0
  84. package/dist/server.d.ts +10 -0
  85. package/dist/server.d.ts.map +1 -0
  86. package/dist/server.js +70 -0
  87. package/dist/site-token.d.ts +4 -0
  88. package/dist/site-token.d.ts.map +1 -0
  89. package/dist/site-token.js +26 -0
  90. package/dist/storage.d.ts +6 -0
  91. package/dist/storage.d.ts.map +1 -0
  92. package/dist/storage.js +49 -0
  93. package/dist/token-auth.d.ts +13 -0
  94. package/dist/token-auth.d.ts.map +1 -0
  95. package/dist/token-auth.js +69 -0
  96. package/dist/types.d.ts +165 -0
  97. package/dist/types.d.ts.map +1 -0
  98. package/dist/types.js +1 -0
  99. package/package.json +76 -3
@@ -0,0 +1,6 @@
1
+ import type { FarmStorageCustomDriverConfig } from "@farm.js/core/storage";
2
+ import type { Driver } from "unstorage";
3
+ import type { ConvexStorageOptions } from "./types.js";
4
+ export declare function createConvexStorageDriver(options?: ConvexStorageOptions): Driver;
5
+ export declare function convexStorage(options?: ConvexStorageOptions): FarmStorageCustomDriverConfig;
6
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAA0C,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAyC/F,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CASpF;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,6BAA6B,CAE/F"}
@@ -0,0 +1,49 @@
1
+ import { createAdapterCaller } from "./adapter-client.js";
2
+ function createKeyPrefixer(namespace) {
3
+ const prefix = namespace ? `${namespace}:` : "";
4
+ return {
5
+ addPrefix: (key) => `${prefix}${key}`,
6
+ removePrefix: (key) => key.slice(prefix.length),
7
+ };
8
+ }
9
+ function createReadMethods(caller, prefixer) {
10
+ const getItem = (key) => caller.query("getStorageItem", { key: prefixer.addPrefix(key) });
11
+ return {
12
+ getItem,
13
+ hasItem: async (key) => (await getItem(key)) !== null,
14
+ getKeys: async (base) => {
15
+ const keys = await caller.query("listStorageKeys", {
16
+ prefix: prefixer.addPrefix(base ?? ""),
17
+ });
18
+ return keys.map(prefixer.removePrefix);
19
+ },
20
+ };
21
+ }
22
+ function createWriteMethods(caller, prefixer) {
23
+ const clearBatch = (base) => caller.mutation("clearStorageItems", { prefix: prefixer.addPrefix(base ?? "") });
24
+ return {
25
+ setItem: async (key, value) => {
26
+ await caller.mutation("setStorageItem", { key: prefixer.addPrefix(key), value });
27
+ },
28
+ removeItem: async (key) => {
29
+ await caller.mutation("removeStorageItem", { key: prefixer.addPrefix(key) });
30
+ },
31
+ clear: async (base) => {
32
+ while ((await clearBatch(base)) > 0)
33
+ ;
34
+ },
35
+ };
36
+ }
37
+ export function createConvexStorageDriver(options = {}) {
38
+ const caller = createAdapterCaller(options);
39
+ const prefixer = createKeyPrefixer(options.namespace);
40
+ return {
41
+ name: "convex",
42
+ options,
43
+ ...createReadMethods(caller, prefixer),
44
+ ...createWriteMethods(caller, prefixer),
45
+ };
46
+ }
47
+ export function convexStorage(options = {}) {
48
+ return { driver: createConvexStorageDriver(options) };
49
+ }
@@ -0,0 +1,13 @@
1
+ /** Re-check the visitor's Convex token, for example right after signing in or out without a reload. */
2
+ export declare function refreshConvexAuth(): void;
3
+ type UseTokenAuth = () => {
4
+ isLoading: boolean;
5
+ isAuthenticated: boolean;
6
+ fetchAccessToken: (args: {
7
+ forceRefreshToken: boolean;
8
+ }) => Promise<string | null>;
9
+ };
10
+ /** One stable hook per token path, as ConvexProviderWithAuth expects. */
11
+ export declare function readTokenAuth(tokenPath: string): UseTokenAuth;
12
+ export {};
13
+ //# sourceMappingURL=token-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-auth.d.ts","sourceRoot":"","sources":["../src/token-auth.ts"],"names":[],"mappings":"AAIA,uGAAuG;AACvG,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAsBD,KAAK,YAAY,GAAG,MAAM;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,CAAC,IAAI,EAAE;QAAE,iBAAiB,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACpF,CAAC;AAmDF,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAO7D"}
@@ -0,0 +1,69 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ const REFRESH_EVENT = "farm:convex-auth";
3
+ /** Re-check the visitor's Convex token, for example right after signing in or out without a reload. */
4
+ export function refreshConvexAuth() {
5
+ if (typeof window !== "undefined")
6
+ window.dispatchEvent(new Event(REFRESH_EVENT));
7
+ }
8
+ async function fetchToken(tokenPath) {
9
+ try {
10
+ const response = await fetch(tokenPath, {
11
+ credentials: "same-origin",
12
+ headers: { accept: "application/json" },
13
+ });
14
+ if (!response.ok)
15
+ return null;
16
+ const payload = await response.json();
17
+ const token = typeof payload === "object" && payload ? Reflect.get(payload, "token") : null;
18
+ return typeof token === "string" ? token : null;
19
+ }
20
+ catch {
21
+ return null;
22
+ }
23
+ }
24
+ const hooksByPath = new Map();
25
+ function createTokenAuth(tokenPath) {
26
+ return function useTokenAuth() {
27
+ const [state, setState] = useState({ isLoading: true, token: null });
28
+ const latest = useRef(null);
29
+ const check = useCallback(async () => {
30
+ const token = await fetchToken(tokenPath);
31
+ latest.current = token;
32
+ setState((current) => current.isLoading || current.token !== token ? { isLoading: false, token } : current);
33
+ }, []);
34
+ useEffect(() => {
35
+ void check();
36
+ const recheck = () => void check();
37
+ window.addEventListener(REFRESH_EVENT, recheck);
38
+ window.addEventListener("focus", recheck);
39
+ return () => {
40
+ window.removeEventListener(REFRESH_EVENT, recheck);
41
+ window.removeEventListener("focus", recheck);
42
+ };
43
+ }, [check]);
44
+ // A new identity per signed-in token makes Convex fetch again when the visitor changes.
45
+ const fetchAccessToken = useCallback(async ({ forceRefreshToken }) => {
46
+ if (!forceRefreshToken && latest.current)
47
+ return latest.current;
48
+ const token = await fetchToken(tokenPath);
49
+ latest.current = token;
50
+ return token;
51
+ },
52
+ // eslint-disable-next-line react-hooks/exhaustive-deps
53
+ [state.token]);
54
+ return useMemo(() => ({
55
+ isLoading: state.isLoading,
56
+ isAuthenticated: state.token !== null,
57
+ fetchAccessToken,
58
+ }), [state.isLoading, state.token, fetchAccessToken]);
59
+ };
60
+ }
61
+ /** One stable hook per token path, as ConvexProviderWithAuth expects. */
62
+ export function readTokenAuth(tokenPath) {
63
+ let hook = hooksByPath.get(tokenPath);
64
+ if (!hook) {
65
+ hook = createTokenAuth(tokenPath);
66
+ hooksByPath.set(tokenPath, hook);
67
+ }
68
+ return hook;
69
+ }
@@ -0,0 +1,165 @@
1
+ import type { ChildProcess } from "node:child_process";
2
+ import type { ReactNode } from "react";
3
+ import type { FarmIntegrationLogger, FarmIntegrationProviderComponentReference, FarmIntegrationRouteMethod } from "@farm.js/core";
4
+ export type ConvexTokenReader = (request: Request) => Promise<string | null | undefined> | string | null | undefined;
5
+ export type ConvexService = "auth" | "billing";
6
+ export type ConvexServiceSide = "convex" | "farm";
7
+ export type ConvexHomes = Partial<Record<ConvexService, ConvexServiceSide>>;
8
+ export type ConvexPairRelation = "conflict" | "together";
9
+ export interface ConvexDevOptions {
10
+ args?: readonly string[];
11
+ }
12
+ export interface ConvexIntegrationInput {
13
+ url?: string;
14
+ siteURL?: string;
15
+ provider?: FarmIntegrationProviderComponentReference;
16
+ dev?: boolean | ConvexDevOptions;
17
+ token?: ConvexTokenReader;
18
+ /** Same-origin path the browser fetches the visitor's Convex token from, such as "/api/auth/token". */
19
+ tokenPath?: string;
20
+ home?: ConvexHomes;
21
+ functionsDirectory?: string;
22
+ log?: FarmIntegrationLogger;
23
+ use?: readonly ConvexExtension[];
24
+ /** Turn on helpers for the components in convex.config.ts. @default true */
25
+ detect?: boolean;
26
+ }
27
+ /** A route on the app's own domain that Farm forwards to the Convex site URL. */
28
+ export interface ConvexExtensionRoute {
29
+ /** Farm route pattern, such as "/api/auth/[...auth]" or "/api/webhooks/polar". */
30
+ path: string;
31
+ /** Methods to forward. Defaults to GET and POST. */
32
+ methods?: readonly FarmIntegrationRouteMethod[];
33
+ /** Path on the Convex site URL. Defaults to the incoming path. */
34
+ to?: string;
35
+ }
36
+ /** A path on the Convex site URL that turns the visitor's session cookie into a Convex token. */
37
+ export interface ConvexSiteToken {
38
+ path: string;
39
+ /** Skip the request unless the cookie header contains this, such as "session_token=". */
40
+ cookie?: string;
41
+ }
42
+ /** A service that lives in Convex, such as auth or billing, wired into Farm by convex({ use }). */
43
+ export interface ConvexExtension {
44
+ name: string;
45
+ /**
46
+ * What kind of service the component is, for the check that it is not also set up in Farm.
47
+ * An extension that signs visitors in counts as auth.
48
+ */
49
+ service?: ConvexService;
50
+ /** The Convex component it needs in convex.config.ts, such as "@convex-dev/polar". */
51
+ component?: string;
52
+ routes?: readonly ConvexExtensionRoute[];
53
+ /** Reads the visitor's Convex token on the server. Only one extension can sign visitors in. */
54
+ token?: ConvexTokenReader;
55
+ /** Reads the visitor's token from a path on the Convex site URL instead of `token`. */
56
+ siteToken?: ConvexSiteToken;
57
+ /** Same-origin path the browser fetches the visitor's Convex token from. */
58
+ tokenPath?: string;
59
+ /** Browser provider used instead of the default one. */
60
+ provider?: FarmIntegrationProviderComponentReference;
61
+ }
62
+ export interface ConvexDeploymentURLs {
63
+ url: string;
64
+ siteURL: string;
65
+ }
66
+ export interface ConvexRuntime extends ConvexDeploymentURLs {
67
+ token?: ConvexTokenReader;
68
+ }
69
+ export interface ConvexProviderProps {
70
+ url: string;
71
+ /** Same-origin path to fetch the visitor's Convex token from; omit for signed-out clients. */
72
+ tokenPath?: string;
73
+ children?: ReactNode;
74
+ }
75
+ export interface ConvexServerOptions {
76
+ request?: Request;
77
+ token?: string;
78
+ }
79
+ export interface ConvexPair {
80
+ service: ConvexService;
81
+ component: string;
82
+ integration: string;
83
+ relation: ConvexPairRelation;
84
+ }
85
+ export interface ConvexServiceSetup {
86
+ service: ConvexService;
87
+ side: ConvexServiceSide;
88
+ name: string;
89
+ }
90
+ export interface ConvexHomeConflict {
91
+ service: ConvexService;
92
+ component: string;
93
+ integration: string;
94
+ }
95
+ export interface ConvexFarmConfigView {
96
+ root?: string;
97
+ auth?: unknown;
98
+ integrations?: Record<string, ConvexIntegrationView | undefined>;
99
+ }
100
+ export interface ConvexIntegrationView {
101
+ type?: string;
102
+ }
103
+ export interface ConvexDevState {
104
+ child?: ChildProcess;
105
+ }
106
+ /** Options for component(): what Farm should do for a Convex component. */
107
+ export interface ConvexComponentOptions {
108
+ /** Shown in errors and warnings. Defaults to the component's package name. */
109
+ name?: string;
110
+ /** Paths on your domain forwarded to Convex: { "/api/webhooks/resend": "/resend-webhook" }. */
111
+ routes?: Readonly<Record<string, string>> | readonly ConvexExtensionRoute[];
112
+ /**
113
+ * Receive the component's webhooks on your domain. `true` uses /api/webhooks/<name> for a known
114
+ * component; a string sets the path.
115
+ */
116
+ webhooks?: string | true;
117
+ /** The webhook path the component registers in convex/http.ts, if it is not the default. */
118
+ convexPath?: string;
119
+ token?: ConvexTokenReader;
120
+ tokenPath?: string;
121
+ provider?: FarmIntegrationProviderComponentReference;
122
+ }
123
+ /** What Farm knows about a well-known Convex component. */
124
+ export interface ConvexKnownComponent {
125
+ name: string;
126
+ service?: ConvexService;
127
+ routes?: readonly ConvexExtensionRoute[];
128
+ webhook?: {
129
+ path: string;
130
+ convexPath: string;
131
+ };
132
+ siteToken?: ConvexSiteToken;
133
+ tokenPath?: string;
134
+ }
135
+ export interface ConvexAdapterOptions {
136
+ url?: string;
137
+ secret?: string;
138
+ module?: string;
139
+ }
140
+ export interface ConvexStorageOptions extends ConvexAdapterOptions {
141
+ namespace?: string;
142
+ }
143
+ export interface ConvexAdapterCaller {
144
+ query<Result>(name: string, args: Record<string, unknown>): Promise<Result>;
145
+ mutation<Result>(name: string, args: Record<string, unknown>): Promise<Result>;
146
+ }
147
+ export interface ConvexRuntimeHolder {
148
+ __farmConvexRuntime?: ConvexRuntime;
149
+ }
150
+ export interface ForwardRequestInit extends RequestInit {
151
+ duplex: "half";
152
+ }
153
+ export interface ConvexPluginInput {
154
+ dev: ConvexDevOptions | undefined;
155
+ homes: ConvexHomes;
156
+ functionsDirectory: string;
157
+ extensions: readonly ConvexExtension[];
158
+ /** No deployment yet: farm dev runs convex dev to create one. */
159
+ waitingForDeployment?: boolean;
160
+ }
161
+ export interface ConvexKeyPrefixer {
162
+ addPrefix(key: string): string;
163
+ removePrefix(key: string): string;
164
+ }
165
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,qBAAqB,EACrB,yCAAyC,EACzC,0BAA0B,EAC3B,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAE5E,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAA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C,CAAC;CAChF;AAED,MAAM,WAAW,mBAAmB;IAClC,mBAAmB,CAAC,EAAE,aAAa,CAAC;CACrC;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAClC,KAAK,EAAE,WAAW,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;IACvC,iEAAiE;IACjE,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@farm.js/convex",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Convex integration for Farm.js",
5
+ "keywords": [
6
+ "convex",
7
+ "farm.js",
8
+ "realtime"
9
+ ],
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/farming-labs/farm.js",
14
+ "directory": "packages/farm-convex"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "type": "module",
20
+ "main": "./dist/index.js",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ },
28
+ "./client": {
29
+ "types": "./dist/client.d.ts",
30
+ "import": "./dist/client.js"
31
+ },
32
+ "./server": {
33
+ "types": "./dist/server.d.ts",
34
+ "import": "./dist/server.js"
35
+ },
36
+ "./functions": {
37
+ "types": "./dist/functions.d.ts",
38
+ "import": "./dist/functions.js"
39
+ },
40
+ "./convex.config": {
41
+ "types": "./dist/component/convex.config.d.ts",
42
+ "import": "./dist/component/convex.config.js"
43
+ },
44
+ "./convex.config.js": {
45
+ "types": "./dist/component/convex.config.d.ts",
46
+ "import": "./dist/component/convex.config.js"
47
+ }
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "dependencies": {
53
+ "unstorage": "2.0.0-alpha.10",
54
+ "@farm.js/integration-utils": "0.1.42",
55
+ "@farm.js/core": "0.1.42"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^22.20.5",
59
+ "@types/react": "^18.2.45",
60
+ "convex": "1.48.0",
61
+ "react": "19.2.8",
62
+ "typescript": "^5.3.3",
63
+ "vite": "8.3.4",
64
+ "vitest": "5.0.5"
65
+ },
66
+ "peerDependencies": {
67
+ "convex": "^1.25.0",
68
+ "react": "^18.2.0 || ^19.0.0"
69
+ },
70
+ "engines": {
71
+ "node": ">=22.13.0"
72
+ },
73
+ "scripts": {
74
+ "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
75
+ "dev": "tsc --watch",
76
+ "type-check": "tsc --noEmit",
77
+ "test": "vitest run"
78
+ }
6
79
  }