@vexcms/file-storage-convex 0.0.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.
@@ -0,0 +1,27 @@
1
+ import { FileStorageAdapter } from '@vexcms/core';
2
+
3
+ interface ConvexFileStorageOptions {
4
+ convexUrl?: string;
5
+ }
6
+ /**
7
+ * Create a Convex file storage adapter.
8
+ *
9
+ * Uses Convex's built-in file storage system. Sets `storageIdValueType` to
10
+ * `v.id("_storage")` so media collection schemas use Convex's typed storage reference.
11
+ *
12
+ * The runtime methods (getUploadUrl, getUrl, deleteFile) throw descriptive errors
13
+ * because they need to be wired to Convex runtime functions by the admin panel.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * defineConfig({
18
+ * media: {
19
+ * collections: [images],
20
+ * storageAdapter: convexFileStorage(),
21
+ * },
22
+ * });
23
+ * ```
24
+ */
25
+ declare function convexFileStorage(_props?: ConvexFileStorageOptions): FileStorageAdapter;
26
+
27
+ export { type ConvexFileStorageOptions, convexFileStorage };
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ // src/index.ts
2
+ function convexFileStorage(_props) {
3
+ return {
4
+ name: "convex",
5
+ storageIdValueType: 'v.id("_storage")',
6
+ getUploadUrl: async () => {
7
+ throw new Error(
8
+ "convexFileStorage.getUploadUrl() requires a Convex client. Wire via admin panel runtime."
9
+ );
10
+ },
11
+ getUrl: async () => {
12
+ throw new Error(
13
+ "convexFileStorage.getUrl() requires a Convex client. Wire via admin panel runtime."
14
+ );
15
+ },
16
+ deleteFile: async () => {
17
+ throw new Error(
18
+ "convexFileStorage.deleteFile() requires a Convex client. Wire via admin panel runtime."
19
+ );
20
+ }
21
+ };
22
+ }
23
+ export {
24
+ convexFileStorage
25
+ };
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { FileStorageAdapter } from \"@vexcms/core\";\n\nexport interface ConvexFileStorageOptions {\n convexUrl?: string;\n}\n\n/**\n * Create a Convex file storage adapter.\n *\n * Uses Convex's built-in file storage system. Sets `storageIdValueType` to\n * `v.id(\"_storage\")` so media collection schemas use Convex's typed storage reference.\n *\n * The runtime methods (getUploadUrl, getUrl, deleteFile) throw descriptive errors\n * because they need to be wired to Convex runtime functions by the admin panel.\n *\n * @example\n * ```ts\n * defineConfig({\n * media: {\n * collections: [images],\n * storageAdapter: convexFileStorage(),\n * },\n * });\n * ```\n */\nexport function convexFileStorage(\n _props?: ConvexFileStorageOptions,\n): FileStorageAdapter {\n return {\n name: \"convex\",\n storageIdValueType: 'v.id(\"_storage\")',\n getUploadUrl: async () => {\n throw new Error(\n \"convexFileStorage.getUploadUrl() requires a Convex client. Wire via admin panel runtime.\",\n );\n },\n getUrl: async () => {\n throw new Error(\n \"convexFileStorage.getUrl() requires a Convex client. Wire via admin panel runtime.\",\n );\n },\n deleteFile: async () => {\n throw new Error(\n \"convexFileStorage.deleteFile() requires a Convex client. Wire via admin panel runtime.\",\n );\n },\n };\n}\n"],"mappings":";AAyBO,SAAS,kBACd,QACoB;AACpB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,oBAAoB;AAAA,IACpB,cAAc,YAAY;AACxB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,QAAQ,YAAY;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,IACA,YAAY,YAAY;AACtB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@vexcms/file-storage-convex",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "peerDependencies": {
17
+ "convex": "^1.31.5",
18
+ "@vexcms/core": "0.0.1"
19
+ },
20
+ "devDependencies": {
21
+ "convex": "^1.31.5",
22
+ "tsup": "^8.5.1",
23
+ "typescript": "^5.9.3",
24
+ "vitest": "^4.0.0",
25
+ "@vexcms/core": "0.0.1",
26
+ "@vexcms/tsconfig": "0.0.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "dev": "tsup --watch",
34
+ "clean": "rm -rf dist",
35
+ "typecheck": "tsc --noEmit -p tsconfig.check.json",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest"
38
+ }
39
+ }