@btst/stack 2.8.1 → 2.9.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.
- package/README.md +3 -2
- package/dist/components/markdown/index.d.cts +15 -2
- package/dist/components/markdown/index.d.mts +15 -2
- package/dist/components/markdown/index.d.ts +15 -2
- package/dist/packages/stack/src/plugins/blog/client/components/forms/image-field.cjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/forms/image-field.mjs +30 -1
- package/dist/packages/stack/src/plugins/blog/client/components/forms/markdown-editor-with-overrides.cjs +49 -9
- package/dist/packages/stack/src/plugins/blog/client/components/forms/markdown-editor-with-overrides.mjs +50 -10
- package/dist/packages/stack/src/plugins/blog/client/components/forms/markdown-editor.cjs +77 -9
- package/dist/packages/stack/src/plugins/blog/client/components/forms/markdown-editor.mjs +77 -9
- package/dist/packages/stack/src/plugins/cms/client/components/forms/content-form.cjs +24 -5
- package/dist/packages/stack/src/plugins/cms/client/components/forms/content-form.mjs +24 -5
- package/dist/packages/stack/src/plugins/cms/client/components/forms/file-upload.cjs +47 -13
- package/dist/packages/stack/src/plugins/cms/client/components/forms/file-upload.mjs +47 -13
- package/dist/packages/stack/src/plugins/kanban/client/components/forms/board-form.cjs +1 -1
- package/dist/packages/stack/src/plugins/kanban/client/components/forms/board-form.mjs +1 -1
- package/dist/packages/stack/src/plugins/kanban/client/components/forms/task-form.cjs +6 -2
- package/dist/packages/stack/src/plugins/kanban/client/components/forms/task-form.mjs +6 -2
- package/dist/packages/stack/src/plugins/media/api/adapters/local.cjs +55 -0
- package/dist/packages/stack/src/plugins/media/api/adapters/local.mjs +37 -0
- package/dist/packages/stack/src/plugins/media/api/getters.cjs +83 -0
- package/dist/packages/stack/src/plugins/media/api/getters.mjs +78 -0
- package/dist/packages/stack/src/plugins/media/api/mutations.cjs +88 -0
- package/dist/packages/stack/src/plugins/media/api/mutations.mjs +82 -0
- package/dist/packages/stack/src/plugins/media/api/plugin.cjs +525 -0
- package/dist/packages/stack/src/plugins/media/api/plugin.mjs +523 -0
- package/dist/packages/stack/src/plugins/media/api/query-key-defs.cjs +19 -0
- package/dist/packages/stack/src/plugins/media/api/query-key-defs.mjs +16 -0
- package/dist/packages/stack/src/plugins/media/api/serializers.cjs +17 -0
- package/dist/packages/stack/src/plugins/media/api/serializers.mjs +14 -0
- package/dist/packages/stack/src/plugins/media/api/storage-adapter.cjs +15 -0
- package/dist/packages/stack/src/plugins/media/api/storage-adapter.mjs +11 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/asset-card.cjs +129 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/asset-card.mjs +127 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/asset-preview-button.cjs +58 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/asset-preview-button.mjs +56 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/browse-tab.cjs +94 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/browse-tab.mjs +92 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/folder-tree.cjs +171 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/folder-tree.mjs +168 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/index.cjs +308 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/index.mjs +305 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/upload-tab.cjs +104 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/upload-tab.mjs +102 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/url-tab.cjs +70 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/url-tab.mjs +68 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/utils.cjs +21 -0
- package/dist/packages/stack/src/plugins/media/client/components/media-picker/utils.mjs +17 -0
- package/dist/packages/stack/src/plugins/media/client/components/pages/library-page.cjs +35 -0
- package/dist/packages/stack/src/plugins/media/client/components/pages/library-page.internal.cjs +125 -0
- package/dist/packages/stack/src/plugins/media/client/components/pages/library-page.internal.mjs +123 -0
- package/dist/packages/stack/src/plugins/media/client/components/pages/library-page.mjs +33 -0
- package/dist/packages/stack/src/plugins/media/client/hooks/use-media.cjs +222 -0
- package/dist/packages/stack/src/plugins/media/client/hooks/use-media.mjs +214 -0
- package/dist/packages/stack/src/plugins/media/client/plugin.cjs +94 -0
- package/dist/packages/stack/src/plugins/media/client/plugin.mjs +92 -0
- package/dist/packages/stack/src/plugins/media/client/upload.cjs +121 -0
- package/dist/packages/stack/src/plugins/media/client/upload.mjs +119 -0
- package/dist/packages/stack/src/plugins/media/client/utils/image-compression.cjs +67 -0
- package/dist/packages/stack/src/plugins/media/client/utils/image-compression.mjs +65 -0
- package/dist/packages/stack/src/plugins/media/db.cjs +62 -0
- package/dist/packages/stack/src/plugins/media/db.mjs +60 -0
- package/dist/packages/stack/src/plugins/media/schemas.cjs +41 -0
- package/dist/packages/stack/src/plugins/media/schemas.mjs +35 -0
- package/dist/packages/ui/src/components/minimal-tiptap/components/image/image-edit-block.cjs +18 -1
- package/dist/packages/ui/src/components/minimal-tiptap/components/image/image-edit-block.mjs +19 -2
- package/dist/packages/ui/src/components/minimal-tiptap/components/image/image-edit-dialog.cjs +2 -2
- package/dist/packages/ui/src/components/minimal-tiptap/components/image/image-edit-dialog.mjs +2 -2
- package/dist/packages/ui/src/components/minimal-tiptap/components/section/five.cjs +3 -2
- package/dist/packages/ui/src/components/minimal-tiptap/components/section/five.mjs +3 -2
- package/dist/packages/ui/src/components/minimal-tiptap/minimal-tiptap.cjs +12 -5
- package/dist/packages/ui/src/components/minimal-tiptap/minimal-tiptap.mjs +12 -5
- package/dist/plugins/blog/client/index.d.cts +58 -1
- package/dist/plugins/blog/client/index.d.mts +58 -1
- package/dist/plugins/blog/client/index.d.ts +58 -1
- package/dist/plugins/cms/client/index.d.cts +73 -3
- package/dist/plugins/cms/client/index.d.mts +73 -3
- package/dist/plugins/cms/client/index.d.ts +73 -3
- package/dist/plugins/kanban/api/index.d.cts +1 -1
- package/dist/plugins/kanban/api/index.d.mts +1 -1
- package/dist/plugins/kanban/api/index.d.ts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
- package/dist/plugins/kanban/client/index.d.cts +1 -1
- package/dist/plugins/kanban/client/index.d.mts +1 -1
- package/dist/plugins/kanban/client/index.d.ts +1 -1
- package/dist/plugins/kanban/query-keys.d.cts +1 -1
- package/dist/plugins/kanban/query-keys.d.mts +1 -1
- package/dist/plugins/kanban/query-keys.d.ts +1 -1
- package/dist/plugins/media/api/adapters/s3.cjs +106 -0
- package/dist/plugins/media/api/adapters/s3.d.cts +60 -0
- package/dist/plugins/media/api/adapters/s3.d.mts +60 -0
- package/dist/plugins/media/api/adapters/s3.d.ts +60 -0
- package/dist/plugins/media/api/adapters/s3.mjs +104 -0
- package/dist/plugins/media/api/adapters/vercel-blob.cjs +53 -0
- package/dist/plugins/media/api/adapters/vercel-blob.d.cts +41 -0
- package/dist/plugins/media/api/adapters/vercel-blob.d.mts +41 -0
- package/dist/plugins/media/api/adapters/vercel-blob.d.ts +41 -0
- package/dist/plugins/media/api/adapters/vercel-blob.mjs +51 -0
- package/dist/plugins/media/api/index.cjs +26 -0
- package/dist/plugins/media/api/index.d.cts +116 -0
- package/dist/plugins/media/api/index.d.mts +116 -0
- package/dist/plugins/media/api/index.d.ts +116 -0
- package/dist/plugins/media/api/index.mjs +6 -0
- package/dist/plugins/media/client/components/index.cjs +10 -0
- package/dist/plugins/media/client/components/index.d.cts +55 -0
- package/dist/plugins/media/client/components/index.d.mts +55 -0
- package/dist/plugins/media/client/components/index.d.ts +55 -0
- package/dist/plugins/media/client/components/index.mjs +2 -0
- package/dist/plugins/media/client/hooks/index.cjs +13 -0
- package/dist/plugins/media/client/hooks/index.d.cts +53 -0
- package/dist/plugins/media/client/hooks/index.d.mts +53 -0
- package/dist/plugins/media/client/hooks/index.d.ts +53 -0
- package/dist/plugins/media/client/hooks/index.mjs +1 -0
- package/dist/plugins/media/client/index.cjs +9 -0
- package/dist/plugins/media/client/index.d.cts +242 -0
- package/dist/plugins/media/client/index.d.mts +242 -0
- package/dist/plugins/media/client/index.d.ts +242 -0
- package/dist/plugins/media/client/index.mjs +2 -0
- package/dist/plugins/media/client.css +1 -0
- package/dist/plugins/media/query-keys.cjs +72 -0
- package/dist/plugins/media/query-keys.d.cts +49 -0
- package/dist/plugins/media/query-keys.d.mts +49 -0
- package/dist/plugins/media/query-keys.d.ts +49 -0
- package/dist/plugins/media/query-keys.mjs +70 -0
- package/dist/plugins/media/style.css +1 -0
- package/dist/shared/{stack.DRpeDS6X.d.ts → stack.BMx2QYOK.d.ts} +25 -0
- package/dist/shared/stack.BttDsJJn.d.cts +109 -0
- package/dist/shared/stack.BttDsJJn.d.mts +109 -0
- package/dist/shared/stack.BttDsJJn.d.ts +109 -0
- package/dist/shared/stack.C7vfOBmO.d.mts +63 -0
- package/dist/shared/stack.CAni8dnD.d.cts +63 -0
- package/dist/shared/stack.CI8iRKKi.d.cts +286 -0
- package/dist/shared/stack.CLcnSF_b.d.cts +25 -0
- package/dist/shared/stack.CLcnSF_b.d.mts +25 -0
- package/dist/shared/stack.CLcnSF_b.d.ts +25 -0
- package/dist/shared/stack.CYSwntXC.d.ts +63 -0
- package/dist/shared/{stack.Jb0kQDJC.d.mts → stack.Cd6McBu1.d.mts} +25 -0
- package/dist/shared/stack.DJDjdG64.d.ts +286 -0
- package/dist/shared/{stack.BxFl46lB.d.cts → stack.DxQl8Wa1.d.cts} +25 -0
- package/dist/shared/stack.FgBVDSPi.d.mts +286 -0
- package/package.json +113 -4
- package/src/plugins/blog/client/components/forms/image-field.tsx +35 -4
- package/src/plugins/blog/client/components/forms/markdown-editor-with-overrides.tsx +67 -12
- package/src/plugins/blog/client/components/forms/markdown-editor.tsx +106 -10
- package/src/plugins/blog/client/overrides.ts +58 -1
- package/src/plugins/cms/client/components/forms/content-form.tsx +26 -7
- package/src/plugins/cms/client/components/forms/file-upload.tsx +73 -15
- package/src/plugins/cms/client/overrides.ts +57 -2
- package/src/plugins/kanban/client/components/forms/board-form.tsx +1 -1
- package/src/plugins/kanban/client/components/forms/task-form.tsx +7 -1
- package/src/plugins/kanban/client/overrides.ts +25 -0
- package/src/plugins/media/__tests__/__stubs__/vercel-blob-server.ts +9 -0
- package/src/plugins/media/__tests__/getters.test.ts +274 -0
- package/src/plugins/media/__tests__/mutations.test.ts +299 -0
- package/src/plugins/media/__tests__/plugin.test.ts +752 -0
- package/src/plugins/media/__tests__/query-key-defs.test.ts +54 -0
- package/src/plugins/media/__tests__/storage-adapters.test.ts +351 -0
- package/src/plugins/media/api/adapters/local.ts +79 -0
- package/src/plugins/media/api/adapters/s3.ts +198 -0
- package/src/plugins/media/api/adapters/vercel-blob.ts +131 -0
- package/src/plugins/media/api/getters.ts +174 -0
- package/src/plugins/media/api/index.ts +41 -0
- package/src/plugins/media/api/mutations.ts +179 -0
- package/src/plugins/media/api/plugin.ts +855 -0
- package/src/plugins/media/api/query-key-defs.ts +41 -0
- package/src/plugins/media/api/serializers.ts +28 -0
- package/src/plugins/media/api/storage-adapter.ts +139 -0
- package/src/plugins/media/client/components/index.tsx +6 -0
- package/src/plugins/media/client/components/media-picker/asset-card.tsx +150 -0
- package/src/plugins/media/client/components/media-picker/asset-preview-button.tsx +67 -0
- package/src/plugins/media/client/components/media-picker/browse-tab.tsx +116 -0
- package/src/plugins/media/client/components/media-picker/folder-tree.tsx +188 -0
- package/src/plugins/media/client/components/media-picker/index.tsx +347 -0
- package/src/plugins/media/client/components/media-picker/upload-tab.tsx +108 -0
- package/src/plugins/media/client/components/media-picker/url-tab.tsx +72 -0
- package/src/plugins/media/client/components/media-picker/utils.ts +17 -0
- package/src/plugins/media/client/components/pages/library-page.internal.tsx +134 -0
- package/src/plugins/media/client/components/pages/library-page.tsx +42 -0
- package/src/plugins/media/client/hooks/index.tsx +9 -0
- package/src/plugins/media/client/hooks/use-media.tsx +289 -0
- package/src/plugins/media/client/index.ts +4 -0
- package/src/plugins/media/client/overrides.ts +127 -0
- package/src/plugins/media/client/plugin.tsx +184 -0
- package/src/plugins/media/client/upload.ts +171 -0
- package/src/plugins/media/client/utils/image-compression.ts +131 -0
- package/src/plugins/media/client.css +1 -0
- package/src/plugins/media/db.ts +62 -0
- package/src/plugins/media/query-keys.ts +96 -0
- package/src/plugins/media/schemas.ts +37 -0
- package/src/plugins/media/style.css +1 -0
- package/src/plugins/media/types.ts +26 -0
- package/dist/shared/{stack.BOokfhZD.d.cts → stack.B6S3cgwN.d.cts} +16 -16
- package/dist/shared/{stack.CWxAl9K3.d.mts → stack.Bzfx-_lq.d.mts} +16 -16
- package/dist/shared/{stack.BvCR4-9H.d.ts → stack.j5SFLC1d.d.ts} +16 -16
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export { a as MEDIA_QUERY_KEYS, c as MediaApiContext, M as MediaApiRouter, e as MediaBackendConfig, d as MediaBackendHooks, b as assetListDiscriminator, m as mediaBackendPlugin } from '../../../shared/stack.FgBVDSPi.mjs';
|
|
2
|
+
export { A as AssetListParams, c as AssetListResult, F as FolderListParams, g as getAssetById, b as getFolderById, l as listAssets, a as listFolders } from '../../../shared/stack.C7vfOBmO.mjs';
|
|
3
|
+
import { DBAdapter } from '@btst/db';
|
|
4
|
+
import { A as Asset, F as Folder, S as SerializedAsset, a as SerializedFolder } from '../../../shared/stack.CLcnSF_b.mjs';
|
|
5
|
+
import { D as DirectStorageAdapter } from '../../../shared/stack.BttDsJJn.mjs';
|
|
6
|
+
export { S as S3StorageAdapter, b as S3UploadToken, a as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.BttDsJJn.mjs';
|
|
7
|
+
import '@btst/stack/plugins/api';
|
|
8
|
+
import 'better-call';
|
|
9
|
+
import 'zod';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Input for creating a new asset record.
|
|
13
|
+
*/
|
|
14
|
+
interface CreateAssetInput {
|
|
15
|
+
filename: string;
|
|
16
|
+
originalName: string;
|
|
17
|
+
mimeType: string;
|
|
18
|
+
size: number;
|
|
19
|
+
url: string;
|
|
20
|
+
folderId?: string;
|
|
21
|
+
alt?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Input for updating an existing asset record.
|
|
25
|
+
*/
|
|
26
|
+
interface UpdateAssetInput {
|
|
27
|
+
alt?: string;
|
|
28
|
+
folderId?: string | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Input for creating a new folder.
|
|
32
|
+
*/
|
|
33
|
+
interface CreateFolderInput {
|
|
34
|
+
name: string;
|
|
35
|
+
parentId?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create an asset record in the database.
|
|
39
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
40
|
+
*
|
|
41
|
+
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
42
|
+
* The caller is responsible for any access-control checks before invoking this function.
|
|
43
|
+
*/
|
|
44
|
+
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
45
|
+
/**
|
|
46
|
+
* Update an asset's `alt` text or `folderId`.
|
|
47
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
48
|
+
*
|
|
49
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
50
|
+
*/
|
|
51
|
+
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Delete an asset record from the database by its ID.
|
|
54
|
+
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
55
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
56
|
+
*
|
|
57
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
58
|
+
*/
|
|
59
|
+
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a folder record in the database.
|
|
62
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
63
|
+
*
|
|
64
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
65
|
+
*/
|
|
66
|
+
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
67
|
+
/**
|
|
68
|
+
* Delete a folder record from the database by its ID.
|
|
69
|
+
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
70
|
+
* any of its descendants contain assets (which have associated storage files
|
|
71
|
+
* that must be deleted via the storage adapter first).
|
|
72
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
73
|
+
*
|
|
74
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
75
|
+
*/
|
|
76
|
+
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Serialize an Asset for SSR/SSG use (convert dates to strings).
|
|
80
|
+
* Pure function — no DB access, no hooks.
|
|
81
|
+
*/
|
|
82
|
+
declare function serializeAsset(asset: Asset): SerializedAsset;
|
|
83
|
+
/**
|
|
84
|
+
* Serialize a Folder for SSR/SSG use (convert dates to strings).
|
|
85
|
+
* Pure function — no DB access, no hooks.
|
|
86
|
+
*/
|
|
87
|
+
declare function serializeFolder(folder: Folder): SerializedFolder;
|
|
88
|
+
|
|
89
|
+
interface LocalStorageAdapterOptions {
|
|
90
|
+
/**
|
|
91
|
+
* Absolute path to the directory where uploaded files are stored.
|
|
92
|
+
* @default "./public/uploads"
|
|
93
|
+
*/
|
|
94
|
+
uploadDir?: string;
|
|
95
|
+
/**
|
|
96
|
+
* URL prefix used to build the public URL for uploaded files.
|
|
97
|
+
* @default "/uploads"
|
|
98
|
+
*/
|
|
99
|
+
publicPath?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a local filesystem storage adapter.
|
|
103
|
+
* Files are written to `uploadDir` and served at `publicPath`.
|
|
104
|
+
* Suitable for development and self-hosted deployments.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* mediaBackendPlugin({
|
|
109
|
+
* storageAdapter: localAdapter({ uploadDir: "./public/uploads", publicPath: "/uploads" })
|
|
110
|
+
* })
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function localAdapter(options?: LocalStorageAdapterOptions): DirectStorageAdapter;
|
|
114
|
+
|
|
115
|
+
export { DirectStorageAdapter, createAsset, createFolder, deleteAsset, deleteFolder, localAdapter, serializeAsset, serializeFolder, updateAsset };
|
|
116
|
+
export type { CreateAssetInput, CreateFolderInput, LocalStorageAdapterOptions, UpdateAssetInput };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export { a as MEDIA_QUERY_KEYS, c as MediaApiContext, M as MediaApiRouter, e as MediaBackendConfig, d as MediaBackendHooks, b as assetListDiscriminator, m as mediaBackendPlugin } from '../../../shared/stack.DJDjdG64.js';
|
|
2
|
+
export { A as AssetListParams, c as AssetListResult, F as FolderListParams, g as getAssetById, b as getFolderById, l as listAssets, a as listFolders } from '../../../shared/stack.CYSwntXC.js';
|
|
3
|
+
import { DBAdapter } from '@btst/db';
|
|
4
|
+
import { A as Asset, F as Folder, S as SerializedAsset, a as SerializedFolder } from '../../../shared/stack.CLcnSF_b.js';
|
|
5
|
+
import { D as DirectStorageAdapter } from '../../../shared/stack.BttDsJJn.js';
|
|
6
|
+
export { S as S3StorageAdapter, b as S3UploadToken, a as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.BttDsJJn.js';
|
|
7
|
+
import '@btst/stack/plugins/api';
|
|
8
|
+
import 'better-call';
|
|
9
|
+
import 'zod';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Input for creating a new asset record.
|
|
13
|
+
*/
|
|
14
|
+
interface CreateAssetInput {
|
|
15
|
+
filename: string;
|
|
16
|
+
originalName: string;
|
|
17
|
+
mimeType: string;
|
|
18
|
+
size: number;
|
|
19
|
+
url: string;
|
|
20
|
+
folderId?: string;
|
|
21
|
+
alt?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Input for updating an existing asset record.
|
|
25
|
+
*/
|
|
26
|
+
interface UpdateAssetInput {
|
|
27
|
+
alt?: string;
|
|
28
|
+
folderId?: string | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Input for creating a new folder.
|
|
32
|
+
*/
|
|
33
|
+
interface CreateFolderInput {
|
|
34
|
+
name: string;
|
|
35
|
+
parentId?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create an asset record in the database.
|
|
39
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
40
|
+
*
|
|
41
|
+
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
42
|
+
* The caller is responsible for any access-control checks before invoking this function.
|
|
43
|
+
*/
|
|
44
|
+
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
45
|
+
/**
|
|
46
|
+
* Update an asset's `alt` text or `folderId`.
|
|
47
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
48
|
+
*
|
|
49
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
50
|
+
*/
|
|
51
|
+
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Delete an asset record from the database by its ID.
|
|
54
|
+
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
55
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
56
|
+
*
|
|
57
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
58
|
+
*/
|
|
59
|
+
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a folder record in the database.
|
|
62
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
63
|
+
*
|
|
64
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
65
|
+
*/
|
|
66
|
+
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
67
|
+
/**
|
|
68
|
+
* Delete a folder record from the database by its ID.
|
|
69
|
+
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
70
|
+
* any of its descendants contain assets (which have associated storage files
|
|
71
|
+
* that must be deleted via the storage adapter first).
|
|
72
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
73
|
+
*
|
|
74
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
75
|
+
*/
|
|
76
|
+
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Serialize an Asset for SSR/SSG use (convert dates to strings).
|
|
80
|
+
* Pure function — no DB access, no hooks.
|
|
81
|
+
*/
|
|
82
|
+
declare function serializeAsset(asset: Asset): SerializedAsset;
|
|
83
|
+
/**
|
|
84
|
+
* Serialize a Folder for SSR/SSG use (convert dates to strings).
|
|
85
|
+
* Pure function — no DB access, no hooks.
|
|
86
|
+
*/
|
|
87
|
+
declare function serializeFolder(folder: Folder): SerializedFolder;
|
|
88
|
+
|
|
89
|
+
interface LocalStorageAdapterOptions {
|
|
90
|
+
/**
|
|
91
|
+
* Absolute path to the directory where uploaded files are stored.
|
|
92
|
+
* @default "./public/uploads"
|
|
93
|
+
*/
|
|
94
|
+
uploadDir?: string;
|
|
95
|
+
/**
|
|
96
|
+
* URL prefix used to build the public URL for uploaded files.
|
|
97
|
+
* @default "/uploads"
|
|
98
|
+
*/
|
|
99
|
+
publicPath?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a local filesystem storage adapter.
|
|
103
|
+
* Files are written to `uploadDir` and served at `publicPath`.
|
|
104
|
+
* Suitable for development and self-hosted deployments.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* mediaBackendPlugin({
|
|
109
|
+
* storageAdapter: localAdapter({ uploadDir: "./public/uploads", publicPath: "/uploads" })
|
|
110
|
+
* })
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare function localAdapter(options?: LocalStorageAdapterOptions): DirectStorageAdapter;
|
|
114
|
+
|
|
115
|
+
export { DirectStorageAdapter, createAsset, createFolder, deleteAsset, deleteFolder, localAdapter, serializeAsset, serializeFolder, updateAsset };
|
|
116
|
+
export type { CreateAssetInput, CreateFolderInput, LocalStorageAdapterOptions, UpdateAssetInput };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { mediaBackendPlugin } from '../../../packages/stack/src/plugins/media/api/plugin.mjs';
|
|
2
|
+
export { getAssetById, getFolderById, listAssets, listFolders } from '../../../packages/stack/src/plugins/media/api/getters.mjs';
|
|
3
|
+
export { createAsset, createFolder, deleteAsset, deleteFolder, updateAsset } from '../../../packages/stack/src/plugins/media/api/mutations.mjs';
|
|
4
|
+
export { serializeAsset, serializeFolder } from '../../../packages/stack/src/plugins/media/api/serializers.mjs';
|
|
5
|
+
export { MEDIA_QUERY_KEYS, assetListDiscriminator } from '../../../packages/stack/src/plugins/media/api/query-key-defs.mjs';
|
|
6
|
+
export { localAdapter } from '../../../packages/stack/src/plugins/media/api/adapters/local.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('../../../../packages/stack/src/plugins/media/client/components/media-picker/index.cjs');
|
|
4
|
+
const libraryPage = require('../../../../packages/stack/src/plugins/media/client/components/pages/library-page.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.ImageInputField = index.ImageInputField;
|
|
9
|
+
exports.MediaPicker = index.MediaPicker;
|
|
10
|
+
exports.LibraryPageComponent = libraryPage.LibraryPageComponent;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { S as SerializedAsset } from '../../../../shared/stack.CLcnSF_b.cjs';
|
|
4
|
+
|
|
5
|
+
interface MediaPickerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Element that triggers opening the picker. Required.
|
|
8
|
+
*/
|
|
9
|
+
trigger: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the user confirms their selection.
|
|
12
|
+
*/
|
|
13
|
+
onSelect: (assets: SerializedAsset[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Allow multiple selection.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Filter displayed assets by MIME type prefix (e.g. "image/").
|
|
21
|
+
*/
|
|
22
|
+
accept?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* MediaPicker — a Popover-based media browser.
|
|
26
|
+
*
|
|
27
|
+
* Reads API config from the `media` plugin overrides context (set up in StackProvider).
|
|
28
|
+
* Must be rendered inside a `StackProvider` that includes media overrides.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <MediaPicker
|
|
33
|
+
* trigger={<Button size="sm">Browse media</Button>}
|
|
34
|
+
* accept={["image/*"]}
|
|
35
|
+
* onSelect={(assets) => form.setValue("image", assets[0].url)}
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function MediaPicker({ trigger, onSelect, multiple, accept, }: MediaPickerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* ImageInputField — displays an image preview with change/remove actions, or a
|
|
42
|
+
* "Browse Media" button that opens the full MediaPicker popover (Browse / Upload / URL tabs).
|
|
43
|
+
*
|
|
44
|
+
* Upload mode, folder selection, and multi-mode cloud support are all handled inside
|
|
45
|
+
* the MediaPicker's UploadTab — this component is purely a thin wrapper.
|
|
46
|
+
*/
|
|
47
|
+
declare function ImageInputField({ value, onChange, }: {
|
|
48
|
+
value: string;
|
|
49
|
+
onChange: (v: string) => void;
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare function LibraryPageComponent(): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
export { ImageInputField, LibraryPageComponent, MediaPicker };
|
|
55
|
+
export type { MediaPickerProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { S as SerializedAsset } from '../../../../shared/stack.CLcnSF_b.mjs';
|
|
4
|
+
|
|
5
|
+
interface MediaPickerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Element that triggers opening the picker. Required.
|
|
8
|
+
*/
|
|
9
|
+
trigger: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the user confirms their selection.
|
|
12
|
+
*/
|
|
13
|
+
onSelect: (assets: SerializedAsset[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Allow multiple selection.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Filter displayed assets by MIME type prefix (e.g. "image/").
|
|
21
|
+
*/
|
|
22
|
+
accept?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* MediaPicker — a Popover-based media browser.
|
|
26
|
+
*
|
|
27
|
+
* Reads API config from the `media` plugin overrides context (set up in StackProvider).
|
|
28
|
+
* Must be rendered inside a `StackProvider` that includes media overrides.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <MediaPicker
|
|
33
|
+
* trigger={<Button size="sm">Browse media</Button>}
|
|
34
|
+
* accept={["image/*"]}
|
|
35
|
+
* onSelect={(assets) => form.setValue("image", assets[0].url)}
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function MediaPicker({ trigger, onSelect, multiple, accept, }: MediaPickerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* ImageInputField — displays an image preview with change/remove actions, or a
|
|
42
|
+
* "Browse Media" button that opens the full MediaPicker popover (Browse / Upload / URL tabs).
|
|
43
|
+
*
|
|
44
|
+
* Upload mode, folder selection, and multi-mode cloud support are all handled inside
|
|
45
|
+
* the MediaPicker's UploadTab — this component is purely a thin wrapper.
|
|
46
|
+
*/
|
|
47
|
+
declare function ImageInputField({ value, onChange, }: {
|
|
48
|
+
value: string;
|
|
49
|
+
onChange: (v: string) => void;
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare function LibraryPageComponent(): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
export { ImageInputField, LibraryPageComponent, MediaPicker };
|
|
55
|
+
export type { MediaPickerProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { S as SerializedAsset } from '../../../../shared/stack.CLcnSF_b.js';
|
|
4
|
+
|
|
5
|
+
interface MediaPickerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Element that triggers opening the picker. Required.
|
|
8
|
+
*/
|
|
9
|
+
trigger: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Called when the user confirms their selection.
|
|
12
|
+
*/
|
|
13
|
+
onSelect: (assets: SerializedAsset[]) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Allow multiple selection.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Filter displayed assets by MIME type prefix (e.g. "image/").
|
|
21
|
+
*/
|
|
22
|
+
accept?: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* MediaPicker — a Popover-based media browser.
|
|
26
|
+
*
|
|
27
|
+
* Reads API config from the `media` plugin overrides context (set up in StackProvider).
|
|
28
|
+
* Must be rendered inside a `StackProvider` that includes media overrides.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <MediaPicker
|
|
33
|
+
* trigger={<Button size="sm">Browse media</Button>}
|
|
34
|
+
* accept={["image/*"]}
|
|
35
|
+
* onSelect={(assets) => form.setValue("image", assets[0].url)}
|
|
36
|
+
* />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function MediaPicker({ trigger, onSelect, multiple, accept, }: MediaPickerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* ImageInputField — displays an image preview with change/remove actions, or a
|
|
42
|
+
* "Browse Media" button that opens the full MediaPicker popover (Browse / Upload / URL tabs).
|
|
43
|
+
*
|
|
44
|
+
* Upload mode, folder selection, and multi-mode cloud support are all handled inside
|
|
45
|
+
* the MediaPicker's UploadTab — this component is purely a thin wrapper.
|
|
46
|
+
*/
|
|
47
|
+
declare function ImageInputField({ value, onChange, }: {
|
|
48
|
+
value: string;
|
|
49
|
+
onChange: (v: string) => void;
|
|
50
|
+
}): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare function LibraryPageComponent(): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
export { ImageInputField, LibraryPageComponent, MediaPicker };
|
|
55
|
+
export type { MediaPickerProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const useMedia = require('../../../../packages/stack/src/plugins/media/client/hooks/use-media.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.useAssets = useMedia.useAssets;
|
|
8
|
+
exports.useCreateFolder = useMedia.useCreateFolder;
|
|
9
|
+
exports.useDeleteAsset = useMedia.useDeleteAsset;
|
|
10
|
+
exports.useDeleteFolder = useMedia.useDeleteFolder;
|
|
11
|
+
exports.useFolders = useMedia.useFolders;
|
|
12
|
+
exports.useRegisterAsset = useMedia.useRegisterAsset;
|
|
13
|
+
exports.useUploadAsset = useMedia.useUploadAsset;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { A as AssetListParams } from '../../../../shared/stack.CAni8dnD.cjs';
|
|
3
|
+
import { S as SerializedAsset, a as SerializedFolder } from '../../../../shared/stack.CLcnSF_b.cjs';
|
|
4
|
+
import '@btst/db';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Infinite-scroll list of assets, optionally filtered by folder / MIME type / search.
|
|
8
|
+
*/
|
|
9
|
+
declare function useAssets(params?: AssetListParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<{
|
|
10
|
+
items: SerializedAsset[];
|
|
11
|
+
total: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}, unknown>, Error>;
|
|
15
|
+
/**
|
|
16
|
+
* List of folders, optionally filtered by parentId.
|
|
17
|
+
* Pass `null` for root-level folders, `undefined` for all folders.
|
|
18
|
+
*/
|
|
19
|
+
declare function useFolders(parentId?: string | null): _tanstack_react_query.UseQueryResult<SerializedFolder[], Error>;
|
|
20
|
+
/**
|
|
21
|
+
* Upload an asset — adapter-aware. Handles direct, S3, and Vercel Blob flows.
|
|
22
|
+
*/
|
|
23
|
+
declare function useUploadAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
24
|
+
file: File;
|
|
25
|
+
folderId?: string;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Register an asset URL directly (for when the URL already exists).
|
|
29
|
+
*/
|
|
30
|
+
declare function useRegisterAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
31
|
+
url: string;
|
|
32
|
+
filename: string;
|
|
33
|
+
mimeType?: string;
|
|
34
|
+
size?: number;
|
|
35
|
+
folderId?: string;
|
|
36
|
+
}, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete an asset by ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function useDeleteAsset(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new folder.
|
|
43
|
+
*/
|
|
44
|
+
declare function useCreateFolder(): _tanstack_react_query.UseMutationResult<SerializedFolder, Error, {
|
|
45
|
+
name: string;
|
|
46
|
+
parentId?: string;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a folder by ID.
|
|
50
|
+
*/
|
|
51
|
+
declare function useDeleteFolder(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
52
|
+
|
|
53
|
+
export { useAssets, useCreateFolder, useDeleteAsset, useDeleteFolder, useFolders, useRegisterAsset, useUploadAsset };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { A as AssetListParams } from '../../../../shared/stack.C7vfOBmO.mjs';
|
|
3
|
+
import { S as SerializedAsset, a as SerializedFolder } from '../../../../shared/stack.CLcnSF_b.mjs';
|
|
4
|
+
import '@btst/db';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Infinite-scroll list of assets, optionally filtered by folder / MIME type / search.
|
|
8
|
+
*/
|
|
9
|
+
declare function useAssets(params?: AssetListParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<{
|
|
10
|
+
items: SerializedAsset[];
|
|
11
|
+
total: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}, unknown>, Error>;
|
|
15
|
+
/**
|
|
16
|
+
* List of folders, optionally filtered by parentId.
|
|
17
|
+
* Pass `null` for root-level folders, `undefined` for all folders.
|
|
18
|
+
*/
|
|
19
|
+
declare function useFolders(parentId?: string | null): _tanstack_react_query.UseQueryResult<SerializedFolder[], Error>;
|
|
20
|
+
/**
|
|
21
|
+
* Upload an asset — adapter-aware. Handles direct, S3, and Vercel Blob flows.
|
|
22
|
+
*/
|
|
23
|
+
declare function useUploadAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
24
|
+
file: File;
|
|
25
|
+
folderId?: string;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Register an asset URL directly (for when the URL already exists).
|
|
29
|
+
*/
|
|
30
|
+
declare function useRegisterAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
31
|
+
url: string;
|
|
32
|
+
filename: string;
|
|
33
|
+
mimeType?: string;
|
|
34
|
+
size?: number;
|
|
35
|
+
folderId?: string;
|
|
36
|
+
}, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete an asset by ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function useDeleteAsset(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new folder.
|
|
43
|
+
*/
|
|
44
|
+
declare function useCreateFolder(): _tanstack_react_query.UseMutationResult<SerializedFolder, Error, {
|
|
45
|
+
name: string;
|
|
46
|
+
parentId?: string;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a folder by ID.
|
|
50
|
+
*/
|
|
51
|
+
declare function useDeleteFolder(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
52
|
+
|
|
53
|
+
export { useAssets, useCreateFolder, useDeleteAsset, useDeleteFolder, useFolders, useRegisterAsset, useUploadAsset };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { A as AssetListParams } from '../../../../shared/stack.CYSwntXC.js';
|
|
3
|
+
import { S as SerializedAsset, a as SerializedFolder } from '../../../../shared/stack.CLcnSF_b.js';
|
|
4
|
+
import '@btst/db';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Infinite-scroll list of assets, optionally filtered by folder / MIME type / search.
|
|
8
|
+
*/
|
|
9
|
+
declare function useAssets(params?: AssetListParams): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<{
|
|
10
|
+
items: SerializedAsset[];
|
|
11
|
+
total: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}, unknown>, Error>;
|
|
15
|
+
/**
|
|
16
|
+
* List of folders, optionally filtered by parentId.
|
|
17
|
+
* Pass `null` for root-level folders, `undefined` for all folders.
|
|
18
|
+
*/
|
|
19
|
+
declare function useFolders(parentId?: string | null): _tanstack_react_query.UseQueryResult<SerializedFolder[], Error>;
|
|
20
|
+
/**
|
|
21
|
+
* Upload an asset — adapter-aware. Handles direct, S3, and Vercel Blob flows.
|
|
22
|
+
*/
|
|
23
|
+
declare function useUploadAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
24
|
+
file: File;
|
|
25
|
+
folderId?: string;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Register an asset URL directly (for when the URL already exists).
|
|
29
|
+
*/
|
|
30
|
+
declare function useRegisterAsset(): _tanstack_react_query.UseMutationResult<SerializedAsset, Error, {
|
|
31
|
+
url: string;
|
|
32
|
+
filename: string;
|
|
33
|
+
mimeType?: string;
|
|
34
|
+
size?: number;
|
|
35
|
+
folderId?: string;
|
|
36
|
+
}, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete an asset by ID.
|
|
39
|
+
*/
|
|
40
|
+
declare function useDeleteAsset(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new folder.
|
|
43
|
+
*/
|
|
44
|
+
declare function useCreateFolder(): _tanstack_react_query.UseMutationResult<SerializedFolder, Error, {
|
|
45
|
+
name: string;
|
|
46
|
+
parentId?: string;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a folder by ID.
|
|
50
|
+
*/
|
|
51
|
+
declare function useDeleteFolder(): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
52
|
+
|
|
53
|
+
export { useAssets, useCreateFolder, useDeleteAsset, useDeleteFolder, useFolders, useRegisterAsset, useUploadAsset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useAssets, useCreateFolder, useDeleteAsset, useDeleteFolder, useFolders, useRegisterAsset, useUploadAsset } from '../../../../packages/stack/src/plugins/media/client/hooks/use-media.mjs';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const plugin = require('../../../packages/stack/src/plugins/media/client/plugin.cjs');
|
|
4
|
+
const upload = require('../../../packages/stack/src/plugins/media/client/upload.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.mediaClientPlugin = plugin.mediaClientPlugin;
|
|
9
|
+
exports.uploadAsset = upload.uploadAsset;
|