@btst/stack 2.11.0 → 2.11.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/dist/packages/stack/src/plugins/media/api/plugin.cjs +4 -1
- package/dist/packages/stack/src/plugins/media/api/plugin.mjs +5 -2
- package/dist/plugins/blog/api/index.d.cts +2 -2
- package/dist/plugins/blog/api/index.d.mts +2 -2
- package/dist/plugins/blog/api/index.d.ts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +2 -2
- package/dist/plugins/blog/client/index.d.mts +2 -2
- package/dist/plugins/blog/client/index.d.ts +2 -2
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- 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/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/{packages/stack/src/plugins → plugins}/media/api/adapters/local.cjs +7 -1
- package/dist/plugins/media/api/adapters/local.d.cts +30 -0
- package/dist/plugins/media/api/adapters/local.d.mts +30 -0
- package/dist/plugins/media/api/adapters/local.d.ts +30 -0
- package/dist/{packages/stack/src/plugins → plugins}/media/api/adapters/local.mjs +7 -1
- package/dist/plugins/media/api/adapters/s3.d.cts +1 -1
- package/dist/plugins/media/api/adapters/s3.d.mts +1 -1
- package/dist/plugins/media/api/adapters/s3.d.ts +1 -1
- package/dist/plugins/media/api/adapters/vercel-blob.d.cts +1 -1
- package/dist/plugins/media/api/adapters/vercel-blob.d.mts +1 -1
- package/dist/plugins/media/api/adapters/vercel-blob.d.ts +1 -1
- package/dist/plugins/media/api/index.cjs +0 -2
- package/dist/plugins/media/api/index.d.cts +5 -102
- package/dist/plugins/media/api/index.d.mts +5 -102
- package/dist/plugins/media/api/index.d.ts +5 -102
- package/dist/plugins/media/api/index.mjs +0 -1
- package/dist/plugins/media/query-keys.d.cts +2 -2
- package/dist/plugins/media/query-keys.d.mts +2 -2
- package/dist/plugins/media/query-keys.d.ts +2 -2
- package/dist/shared/{stack.Bci0-plK.d.ts → stack.C5ucdatf.d.ts} +76 -3
- package/dist/shared/{stack.IUeyQKrm.d.mts → stack.DEW8EtFu.d.cts} +13 -13
- package/dist/shared/{stack.6mEHS2WH.d.mts → stack.DGsFF5qb.d.cts} +6 -6
- package/dist/shared/{stack.C_MUwwgR.d.mts → stack.DpZoZd98.d.mts} +76 -3
- package/dist/shared/{stack.DjgpFWq3.d.cts → stack.DvMUCTTl.d.mts} +13 -13
- package/dist/shared/{stack.AJTXI7kw.d.cts → stack.NtflNnnH.d.mts} +6 -6
- package/dist/shared/{stack.QYn-Px94.d.ts → stack.QrBE0Bc8.d.ts} +6 -6
- package/dist/shared/{stack.DO6vOGQG.d.cts → stack.lkebw2nj.d.cts} +1 -1
- package/dist/shared/{stack.DO6vOGQG.d.mts → stack.lkebw2nj.d.mts} +1 -1
- package/dist/shared/{stack.DO6vOGQG.d.ts → stack.lkebw2nj.d.ts} +1 -1
- package/dist/shared/{stack.D7HSzZdG.d.ts → stack.qta0-CPq.d.ts} +13 -13
- package/dist/shared/{stack.D6zyQnMo.d.cts → stack.vVFh38aS.d.cts} +76 -3
- package/package.json +14 -1
- package/src/plugins/media/__tests__/storage-adapters.test.ts +11 -0
- package/src/plugins/media/api/adapters/local.ts +10 -1
- package/src/plugins/media/api/index.ts +0 -5
- package/src/plugins/media/api/plugin.ts +6 -0
- package/dist/shared/{stack.eq5eg1yt.d.cts → stack.BOokfhZD.d.cts} +13 -13
- package/dist/shared/{stack.CMbX8Q5C.d.ts → stack.BvCR4-9H.d.ts} +13 -13
- package/dist/shared/{stack.Dj04W2c3.d.mts → stack.CWxAl9K3.d.mts} +13 -13
- package/dist/shared/{stack.BQmuNl5p.d.ts → stack.Sod_PZhB.d.cts} +9 -9
- package/dist/shared/{stack.BQmuNl5p.d.cts → stack.Sod_PZhB.d.mts} +9 -9
- package/dist/shared/{stack.BQmuNl5p.d.mts → stack.Sod_PZhB.d.ts} +9 -9
|
@@ -1,81 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CreateAssetInput, e as CreateFolderInput, M as MEDIA_QUERY_KEYS, g as MediaApiContext, j as MediaApiRouter, i as MediaBackendConfig, h as MediaBackendHooks, U as UpdateAssetInput, f as assetListDiscriminator, c as createAsset, a as createFolder, d as deleteAsset, b as deleteFolder, m as mediaBackendPlugin, u as updateAsset } from '../../../shared/stack.DpZoZd98.mjs';
|
|
2
2
|
export { A as AssetListParams, d as AssetListResult, F as FolderListParams, g as getAssetById, b as getFolderById, c as getFolderByName, l as listAssets, a as listFolders } from '../../../shared/stack.C7u9lq9T.mjs';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { D as DirectStorageAdapter } from '../../../shared/stack.DO6vOGQG.mjs';
|
|
6
|
-
export { S as S3StorageAdapter, b as S3UploadToken, a as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.DO6vOGQG.mjs';
|
|
3
|
+
import { A as Asset, S as SerializedAsset, F as Folder, a as SerializedFolder } from '../../../shared/stack.BMlLOMED.mjs';
|
|
4
|
+
export { D as DirectStorageAdapter, a as S3StorageAdapter, b as S3UploadToken, S as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.lkebw2nj.mjs';
|
|
7
5
|
import '@btst/stack/plugins/api';
|
|
8
6
|
import 'better-call';
|
|
9
7
|
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
|
-
tenantId?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Input for updating an existing asset record.
|
|
26
|
-
*/
|
|
27
|
-
interface UpdateAssetInput {
|
|
28
|
-
alt?: string;
|
|
29
|
-
folderId?: string | null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Input for creating a new folder.
|
|
33
|
-
*/
|
|
34
|
-
interface CreateFolderInput {
|
|
35
|
-
name: string;
|
|
36
|
-
parentId?: string;
|
|
37
|
-
tenantId?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Create an asset record in the database.
|
|
41
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
42
|
-
*
|
|
43
|
-
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
44
|
-
* The caller is responsible for any access-control checks before invoking this function.
|
|
45
|
-
*/
|
|
46
|
-
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
47
|
-
/**
|
|
48
|
-
* Update an asset's `alt` text or `folderId`.
|
|
49
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
50
|
-
*
|
|
51
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
52
|
-
*/
|
|
53
|
-
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
54
|
-
/**
|
|
55
|
-
* Delete an asset record from the database by its ID.
|
|
56
|
-
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
57
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
58
|
-
*
|
|
59
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
60
|
-
*/
|
|
61
|
-
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Create a folder record in the database.
|
|
64
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
65
|
-
*
|
|
66
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
67
|
-
*/
|
|
68
|
-
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
69
|
-
/**
|
|
70
|
-
* Delete a folder record from the database by its ID.
|
|
71
|
-
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
72
|
-
* any of its descendants contain assets (which have associated storage files
|
|
73
|
-
* that must be deleted via the storage adapter first).
|
|
74
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
75
|
-
*
|
|
76
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
77
|
-
*/
|
|
78
|
-
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
8
|
+
import '@btst/db';
|
|
79
9
|
|
|
80
10
|
/**
|
|
81
11
|
* Serialize an Asset for SSR/SSG use (convert dates to strings).
|
|
@@ -88,31 +18,4 @@ declare function serializeAsset(asset: Asset): SerializedAsset;
|
|
|
88
18
|
*/
|
|
89
19
|
declare function serializeFolder(folder: Folder): SerializedFolder;
|
|
90
20
|
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Absolute path to the directory where uploaded files are stored.
|
|
94
|
-
* @default "./public/uploads"
|
|
95
|
-
*/
|
|
96
|
-
uploadDir?: string;
|
|
97
|
-
/**
|
|
98
|
-
* URL prefix used to build the public URL for uploaded files.
|
|
99
|
-
* @default "/uploads"
|
|
100
|
-
*/
|
|
101
|
-
publicPath?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Create a local filesystem storage adapter.
|
|
105
|
-
* Files are written to `uploadDir` and served at `publicPath`.
|
|
106
|
-
* Suitable for development and self-hosted deployments.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* mediaBackendPlugin({
|
|
111
|
-
* storageAdapter: localAdapter({ uploadDir: "./public/uploads", publicPath: "/uploads" })
|
|
112
|
-
* })
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
declare function localAdapter(options?: LocalStorageAdapterOptions): DirectStorageAdapter;
|
|
116
|
-
|
|
117
|
-
export { DirectStorageAdapter, createAsset, createFolder, deleteAsset, deleteFolder, localAdapter, serializeAsset, serializeFolder, updateAsset };
|
|
118
|
-
export type { CreateAssetInput, CreateFolderInput, LocalStorageAdapterOptions, UpdateAssetInput };
|
|
21
|
+
export { serializeAsset, serializeFolder };
|
|
@@ -1,81 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as CreateAssetInput, e as CreateFolderInput, M as MEDIA_QUERY_KEYS, g as MediaApiContext, j as MediaApiRouter, i as MediaBackendConfig, h as MediaBackendHooks, U as UpdateAssetInput, f as assetListDiscriminator, c as createAsset, a as createFolder, d as deleteAsset, b as deleteFolder, m as mediaBackendPlugin, u as updateAsset } from '../../../shared/stack.C5ucdatf.js';
|
|
2
2
|
export { A as AssetListParams, d as AssetListResult, F as FolderListParams, g as getAssetById, b as getFolderById, c as getFolderByName, l as listAssets, a as listFolders } from '../../../shared/stack.DD-ZORI7.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { D as DirectStorageAdapter } from '../../../shared/stack.DO6vOGQG.js';
|
|
6
|
-
export { S as S3StorageAdapter, b as S3UploadToken, a as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.DO6vOGQG.js';
|
|
3
|
+
import { A as Asset, S as SerializedAsset, F as Folder, a as SerializedFolder } from '../../../shared/stack.BMlLOMED.js';
|
|
4
|
+
export { D as DirectStorageAdapter, a as S3StorageAdapter, b as S3UploadToken, S as StorageAdapter, U as UploadOptions, c as VercelBlobHandlerCallbacks, V as VercelBlobStorageAdapter } from '../../../shared/stack.lkebw2nj.js';
|
|
7
5
|
import '@btst/stack/plugins/api';
|
|
8
6
|
import 'better-call';
|
|
9
7
|
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
|
-
tenantId?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Input for updating an existing asset record.
|
|
26
|
-
*/
|
|
27
|
-
interface UpdateAssetInput {
|
|
28
|
-
alt?: string;
|
|
29
|
-
folderId?: string | null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Input for creating a new folder.
|
|
33
|
-
*/
|
|
34
|
-
interface CreateFolderInput {
|
|
35
|
-
name: string;
|
|
36
|
-
parentId?: string;
|
|
37
|
-
tenantId?: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Create an asset record in the database.
|
|
41
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
42
|
-
*
|
|
43
|
-
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
44
|
-
* The caller is responsible for any access-control checks before invoking this function.
|
|
45
|
-
*/
|
|
46
|
-
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
47
|
-
/**
|
|
48
|
-
* Update an asset's `alt` text or `folderId`.
|
|
49
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
50
|
-
*
|
|
51
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
52
|
-
*/
|
|
53
|
-
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
54
|
-
/**
|
|
55
|
-
* Delete an asset record from the database by its ID.
|
|
56
|
-
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
57
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
58
|
-
*
|
|
59
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
60
|
-
*/
|
|
61
|
-
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Create a folder record in the database.
|
|
64
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
65
|
-
*
|
|
66
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
67
|
-
*/
|
|
68
|
-
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
69
|
-
/**
|
|
70
|
-
* Delete a folder record from the database by its ID.
|
|
71
|
-
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
72
|
-
* any of its descendants contain assets (which have associated storage files
|
|
73
|
-
* that must be deleted via the storage adapter first).
|
|
74
|
-
* Pure DB function — no authorization hooks, no HTTP context.
|
|
75
|
-
*
|
|
76
|
-
* @remarks **Security:** No authorization hooks are called.
|
|
77
|
-
*/
|
|
78
|
-
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
8
|
+
import '@btst/db';
|
|
79
9
|
|
|
80
10
|
/**
|
|
81
11
|
* Serialize an Asset for SSR/SSG use (convert dates to strings).
|
|
@@ -88,31 +18,4 @@ declare function serializeAsset(asset: Asset): SerializedAsset;
|
|
|
88
18
|
*/
|
|
89
19
|
declare function serializeFolder(folder: Folder): SerializedFolder;
|
|
90
20
|
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Absolute path to the directory where uploaded files are stored.
|
|
94
|
-
* @default "./public/uploads"
|
|
95
|
-
*/
|
|
96
|
-
uploadDir?: string;
|
|
97
|
-
/**
|
|
98
|
-
* URL prefix used to build the public URL for uploaded files.
|
|
99
|
-
* @default "/uploads"
|
|
100
|
-
*/
|
|
101
|
-
publicPath?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Create a local filesystem storage adapter.
|
|
105
|
-
* Files are written to `uploadDir` and served at `publicPath`.
|
|
106
|
-
* Suitable for development and self-hosted deployments.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* mediaBackendPlugin({
|
|
111
|
-
* storageAdapter: localAdapter({ uploadDir: "./public/uploads", publicPath: "/uploads" })
|
|
112
|
-
* })
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
declare function localAdapter(options?: LocalStorageAdapterOptions): DirectStorageAdapter;
|
|
116
|
-
|
|
117
|
-
export { DirectStorageAdapter, createAsset, createFolder, deleteAsset, deleteFolder, localAdapter, serializeAsset, serializeFolder, updateAsset };
|
|
118
|
-
export type { CreateAssetInput, CreateFolderInput, LocalStorageAdapterOptions, UpdateAssetInput };
|
|
21
|
+
export { serializeAsset, serializeFolder };
|
|
@@ -3,4 +3,3 @@ export { getAssetById, getFolderById, getFolderByName, listAssets, listFolders }
|
|
|
3
3
|
export { createAsset, createFolder, deleteAsset, deleteFolder, updateAsset } from '../../../packages/stack/src/plugins/media/api/mutations.mjs';
|
|
4
4
|
export { serializeAsset, serializeFolder } from '../../../packages/stack/src/plugins/media/api/serializers.mjs';
|
|
5
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';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { j as MediaApiRouter, A as AssetListDiscriminator } from '../../shared/stack.vVFh38aS.cjs';
|
|
3
3
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
4
4
|
import { S as SerializedAsset, a as SerializedFolder } from '../../shared/stack.BMlLOMED.cjs';
|
|
5
5
|
import { A as AssetListParams } from '../../shared/stack.jU2iG86n.cjs';
|
|
6
6
|
import '@btst/stack/plugins/api';
|
|
7
|
-
import '../../shared/stack.
|
|
7
|
+
import '../../shared/stack.lkebw2nj.cjs';
|
|
8
8
|
import 'better-call';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '@btst/db';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { j as MediaApiRouter, A as AssetListDiscriminator } from '../../shared/stack.DpZoZd98.mjs';
|
|
3
3
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
4
4
|
import { S as SerializedAsset, a as SerializedFolder } from '../../shared/stack.BMlLOMED.mjs';
|
|
5
5
|
import { A as AssetListParams } from '../../shared/stack.C7u9lq9T.mjs';
|
|
6
6
|
import '@btst/stack/plugins/api';
|
|
7
|
-
import '../../shared/stack.
|
|
7
|
+
import '../../shared/stack.lkebw2nj.mjs';
|
|
8
8
|
import 'better-call';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '@btst/db';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { j as MediaApiRouter, A as AssetListDiscriminator } from '../../shared/stack.C5ucdatf.js';
|
|
3
3
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
4
4
|
import { S as SerializedAsset, a as SerializedFolder } from '../../shared/stack.BMlLOMED.js';
|
|
5
5
|
import { A as AssetListParams } from '../../shared/stack.DD-ZORI7.js';
|
|
6
6
|
import '@btst/stack/plugins/api';
|
|
7
|
-
import '../../shared/stack.
|
|
7
|
+
import '../../shared/stack.lkebw2nj.js';
|
|
8
8
|
import 'better-call';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import '@btst/db';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
-
import {
|
|
2
|
+
import { S as StorageAdapter, b as S3UploadToken } from './stack.lkebw2nj.js';
|
|
3
3
|
import { d as AssetListResult, l as listAssets, a as listFolders, A as AssetListParams } from './stack.DD-ZORI7.js';
|
|
4
4
|
import * as better_call from 'better-call';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { A as Asset, F as Folder } from './stack.BMlLOMED.js';
|
|
7
|
+
import { DBAdapter } from '@btst/db';
|
|
7
8
|
|
|
8
9
|
declare const AssetListQuerySchema: z.ZodObject<{
|
|
9
10
|
folderId: z.ZodOptional<z.ZodString>;
|
|
@@ -21,6 +22,75 @@ declare const createFolderSchema: z.ZodObject<{
|
|
|
21
22
|
parentId: z.ZodOptional<z.ZodString>;
|
|
22
23
|
}, z.core.$strip>;
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Input for creating a new asset record.
|
|
27
|
+
*/
|
|
28
|
+
interface CreateAssetInput {
|
|
29
|
+
filename: string;
|
|
30
|
+
originalName: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
size: number;
|
|
33
|
+
url: string;
|
|
34
|
+
folderId?: string;
|
|
35
|
+
alt?: string;
|
|
36
|
+
tenantId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Input for updating an existing asset record.
|
|
40
|
+
*/
|
|
41
|
+
interface UpdateAssetInput {
|
|
42
|
+
alt?: string;
|
|
43
|
+
folderId?: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Input for creating a new folder.
|
|
47
|
+
*/
|
|
48
|
+
interface CreateFolderInput {
|
|
49
|
+
name: string;
|
|
50
|
+
parentId?: string;
|
|
51
|
+
tenantId?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create an asset record in the database.
|
|
55
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
56
|
+
*
|
|
57
|
+
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
58
|
+
* The caller is responsible for any access-control checks before invoking this function.
|
|
59
|
+
*/
|
|
60
|
+
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
61
|
+
/**
|
|
62
|
+
* Update an asset's `alt` text or `folderId`.
|
|
63
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
64
|
+
*
|
|
65
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
66
|
+
*/
|
|
67
|
+
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Delete an asset record from the database by its ID.
|
|
70
|
+
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
71
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
72
|
+
*
|
|
73
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
74
|
+
*/
|
|
75
|
+
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a folder record in the database.
|
|
78
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
79
|
+
*
|
|
80
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
81
|
+
*/
|
|
82
|
+
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
83
|
+
/**
|
|
84
|
+
* Delete a folder record from the database by its ID.
|
|
85
|
+
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
86
|
+
* any of its descendants contain assets (which have associated storage files
|
|
87
|
+
* that must be deleted via the storage adapter first).
|
|
88
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
89
|
+
*
|
|
90
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
91
|
+
*/
|
|
92
|
+
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
93
|
+
|
|
24
94
|
/**
|
|
25
95
|
* Context passed to media API hooks.
|
|
26
96
|
*/
|
|
@@ -270,9 +340,12 @@ declare const mediaBackendPlugin: (config: MediaBackendConfig) => _btst_stack_pl
|
|
|
270
340
|
}, {
|
|
271
341
|
listAssets: (params?: Parameters<typeof listAssets>[1]) => Promise<AssetListResult>;
|
|
272
342
|
getAssetById: (id: string) => Promise<Asset | null>;
|
|
343
|
+
createAsset: (input: Parameters<typeof createAsset>[1]) => Promise<Asset>;
|
|
344
|
+
updateAsset: (id: string, input: Parameters<typeof updateAsset>[2]) => Promise<Asset | null>;
|
|
273
345
|
listFolders: (params?: Parameters<typeof listFolders>[1]) => Promise<Folder[]>;
|
|
274
346
|
getFolderById: (id: string) => Promise<Folder | null>;
|
|
275
347
|
getFolderByName: (name: string, parentId?: string | null, tenantId?: string) => Promise<Folder | null>;
|
|
348
|
+
createFolder: (input: Parameters<typeof createFolder>[1]) => Promise<Folder>;
|
|
276
349
|
}>;
|
|
277
350
|
type MediaApiRouter = ReturnType<ReturnType<typeof mediaBackendPlugin>["routes"]>;
|
|
278
351
|
|
|
@@ -300,5 +373,5 @@ declare const MEDIA_QUERY_KEYS: {
|
|
|
300
373
|
foldersList: (parentId?: string | null) => readonly ["media", "folders", "list", string];
|
|
301
374
|
};
|
|
302
375
|
|
|
303
|
-
export { MEDIA_QUERY_KEYS as a,
|
|
304
|
-
export type { AssetListDiscriminator as A,
|
|
376
|
+
export { MEDIA_QUERY_KEYS as M, createFolder as a, deleteFolder as b, createAsset as c, deleteAsset as d, assetListDiscriminator as f, mediaBackendPlugin as m, updateAsset as u };
|
|
377
|
+
export type { AssetListDiscriminator as A, CreateAssetInput as C, UpdateAssetInput as U, CreateFolderInput as e, MediaApiContext as g, MediaBackendHooks as h, MediaBackendConfig as i, MediaApiRouter as j };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
4
|
-
import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.
|
|
4
|
+
import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.Sod_PZhB.cjs';
|
|
5
5
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
6
6
|
import { DBAdapter } from '@btst/db';
|
|
7
7
|
import * as better_call from 'better-call';
|
|
@@ -236,6 +236,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
236
236
|
title: string;
|
|
237
237
|
content: string;
|
|
238
238
|
excerpt: string;
|
|
239
|
+
slug?: string | undefined;
|
|
240
|
+
published?: boolean | undefined;
|
|
241
|
+
publishedAt?: unknown;
|
|
242
|
+
createdAt?: unknown;
|
|
243
|
+
updatedAt?: unknown;
|
|
244
|
+
image?: string | undefined;
|
|
239
245
|
tags?: ({
|
|
240
246
|
name: string;
|
|
241
247
|
} | {
|
|
@@ -243,16 +249,16 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
243
249
|
name: string;
|
|
244
250
|
slug: string;
|
|
245
251
|
})[] | undefined;
|
|
246
|
-
slug?: string | undefined;
|
|
247
|
-
createdAt?: unknown;
|
|
248
|
-
updatedAt?: unknown;
|
|
249
|
-
publishedAt?: unknown;
|
|
250
|
-
image?: string | undefined;
|
|
251
|
-
published?: boolean | undefined;
|
|
252
252
|
}, {
|
|
253
253
|
title: string;
|
|
254
254
|
content: string;
|
|
255
255
|
excerpt: string;
|
|
256
|
+
slug?: string | undefined;
|
|
257
|
+
published?: boolean | undefined;
|
|
258
|
+
publishedAt?: unknown;
|
|
259
|
+
createdAt?: unknown;
|
|
260
|
+
updatedAt?: unknown;
|
|
261
|
+
image?: string | undefined;
|
|
256
262
|
tags?: ({
|
|
257
263
|
name: string;
|
|
258
264
|
} | {
|
|
@@ -260,12 +266,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
260
266
|
name: string;
|
|
261
267
|
slug: string;
|
|
262
268
|
})[] | undefined;
|
|
263
|
-
slug?: string | undefined;
|
|
264
|
-
createdAt?: unknown;
|
|
265
|
-
updatedAt?: unknown;
|
|
266
|
-
publishedAt?: unknown;
|
|
267
|
-
image?: string | undefined;
|
|
268
|
-
published?: boolean | undefined;
|
|
269
269
|
}>;
|
|
270
270
|
}, Post>;
|
|
271
271
|
readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from './stack.Sod_PZhB.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,6 +128,10 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
+
published: boolean;
|
|
132
|
+
title: string;
|
|
133
|
+
content: string;
|
|
134
|
+
excerpt: string;
|
|
131
135
|
tags: ({
|
|
132
136
|
name: string;
|
|
133
137
|
} | {
|
|
@@ -135,14 +139,10 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
135
139
|
name: string;
|
|
136
140
|
slug: string;
|
|
137
141
|
})[];
|
|
138
|
-
title: string;
|
|
139
|
-
content: string;
|
|
140
|
-
excerpt: string;
|
|
141
|
-
published: boolean;
|
|
142
142
|
slug?: string | undefined;
|
|
143
|
+
publishedAt?: Date | undefined;
|
|
143
144
|
createdAt?: Date | undefined;
|
|
144
145
|
updatedAt?: Date | undefined;
|
|
145
|
-
publishedAt?: Date | undefined;
|
|
146
146
|
image?: string | undefined;
|
|
147
147
|
}, unknown>;
|
|
148
148
|
/** Update an existing post by id */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
-
import {
|
|
2
|
+
import { S as StorageAdapter, b as S3UploadToken } from './stack.lkebw2nj.mjs';
|
|
3
3
|
import { d as AssetListResult, l as listAssets, a as listFolders, A as AssetListParams } from './stack.C7u9lq9T.mjs';
|
|
4
4
|
import * as better_call from 'better-call';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { A as Asset, F as Folder } from './stack.BMlLOMED.mjs';
|
|
7
|
+
import { DBAdapter } from '@btst/db';
|
|
7
8
|
|
|
8
9
|
declare const AssetListQuerySchema: z.ZodObject<{
|
|
9
10
|
folderId: z.ZodOptional<z.ZodString>;
|
|
@@ -21,6 +22,75 @@ declare const createFolderSchema: z.ZodObject<{
|
|
|
21
22
|
parentId: z.ZodOptional<z.ZodString>;
|
|
22
23
|
}, z.core.$strip>;
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Input for creating a new asset record.
|
|
27
|
+
*/
|
|
28
|
+
interface CreateAssetInput {
|
|
29
|
+
filename: string;
|
|
30
|
+
originalName: string;
|
|
31
|
+
mimeType: string;
|
|
32
|
+
size: number;
|
|
33
|
+
url: string;
|
|
34
|
+
folderId?: string;
|
|
35
|
+
alt?: string;
|
|
36
|
+
tenantId?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Input for updating an existing asset record.
|
|
40
|
+
*/
|
|
41
|
+
interface UpdateAssetInput {
|
|
42
|
+
alt?: string;
|
|
43
|
+
folderId?: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Input for creating a new folder.
|
|
47
|
+
*/
|
|
48
|
+
interface CreateFolderInput {
|
|
49
|
+
name: string;
|
|
50
|
+
parentId?: string;
|
|
51
|
+
tenantId?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create an asset record in the database.
|
|
55
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
56
|
+
*
|
|
57
|
+
* @remarks **Security:** No authorization hooks (e.g. `onBeforeUpload`) are called.
|
|
58
|
+
* The caller is responsible for any access-control checks before invoking this function.
|
|
59
|
+
*/
|
|
60
|
+
declare function createAsset(adapter: DBAdapter, input: CreateAssetInput): Promise<Asset>;
|
|
61
|
+
/**
|
|
62
|
+
* Update an asset's `alt` text or `folderId`.
|
|
63
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
64
|
+
*
|
|
65
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
66
|
+
*/
|
|
67
|
+
declare function updateAsset(adapter: DBAdapter, id: string, input: UpdateAssetInput): Promise<Asset | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Delete an asset record from the database by its ID.
|
|
70
|
+
* Does NOT delete the underlying file — the caller must do that via the storage adapter.
|
|
71
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
72
|
+
*
|
|
73
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
74
|
+
*/
|
|
75
|
+
declare function deleteAsset(adapter: DBAdapter, id: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a folder record in the database.
|
|
78
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
79
|
+
*
|
|
80
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
81
|
+
*/
|
|
82
|
+
declare function createFolder(adapter: DBAdapter, input: CreateFolderInput): Promise<Folder>;
|
|
83
|
+
/**
|
|
84
|
+
* Delete a folder record from the database by its ID.
|
|
85
|
+
* Child folders are cascade-deleted automatically. Throws if the folder or
|
|
86
|
+
* any of its descendants contain assets (which have associated storage files
|
|
87
|
+
* that must be deleted via the storage adapter first).
|
|
88
|
+
* Pure DB function — no authorization hooks, no HTTP context.
|
|
89
|
+
*
|
|
90
|
+
* @remarks **Security:** No authorization hooks are called.
|
|
91
|
+
*/
|
|
92
|
+
declare function deleteFolder(adapter: DBAdapter, id: string): Promise<void>;
|
|
93
|
+
|
|
24
94
|
/**
|
|
25
95
|
* Context passed to media API hooks.
|
|
26
96
|
*/
|
|
@@ -270,9 +340,12 @@ declare const mediaBackendPlugin: (config: MediaBackendConfig) => _btst_stack_pl
|
|
|
270
340
|
}, {
|
|
271
341
|
listAssets: (params?: Parameters<typeof listAssets>[1]) => Promise<AssetListResult>;
|
|
272
342
|
getAssetById: (id: string) => Promise<Asset | null>;
|
|
343
|
+
createAsset: (input: Parameters<typeof createAsset>[1]) => Promise<Asset>;
|
|
344
|
+
updateAsset: (id: string, input: Parameters<typeof updateAsset>[2]) => Promise<Asset | null>;
|
|
273
345
|
listFolders: (params?: Parameters<typeof listFolders>[1]) => Promise<Folder[]>;
|
|
274
346
|
getFolderById: (id: string) => Promise<Folder | null>;
|
|
275
347
|
getFolderByName: (name: string, parentId?: string | null, tenantId?: string) => Promise<Folder | null>;
|
|
348
|
+
createFolder: (input: Parameters<typeof createFolder>[1]) => Promise<Folder>;
|
|
276
349
|
}>;
|
|
277
350
|
type MediaApiRouter = ReturnType<ReturnType<typeof mediaBackendPlugin>["routes"]>;
|
|
278
351
|
|
|
@@ -300,5 +373,5 @@ declare const MEDIA_QUERY_KEYS: {
|
|
|
300
373
|
foldersList: (parentId?: string | null) => readonly ["media", "folders", "list", string];
|
|
301
374
|
};
|
|
302
375
|
|
|
303
|
-
export { MEDIA_QUERY_KEYS as a,
|
|
304
|
-
export type { AssetListDiscriminator as A,
|
|
376
|
+
export { MEDIA_QUERY_KEYS as M, createFolder as a, deleteFolder as b, createAsset as c, deleteAsset as d, assetListDiscriminator as f, mediaBackendPlugin as m, updateAsset as u };
|
|
377
|
+
export type { AssetListDiscriminator as A, CreateAssetInput as C, UpdateAssetInput as U, CreateFolderInput as e, MediaApiContext as g, MediaBackendHooks as h, MediaBackendConfig as i, MediaApiRouter as j };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
4
|
-
import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.
|
|
4
|
+
import { P as Post, T as Tag, c as createPostSchema, u as updatePostSchema, S as SerializedPost, a as SerializedTag } from './stack.Sod_PZhB.mjs';
|
|
5
5
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
6
6
|
import { DBAdapter } from '@btst/db';
|
|
7
7
|
import * as better_call from 'better-call';
|
|
@@ -236,6 +236,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
236
236
|
title: string;
|
|
237
237
|
content: string;
|
|
238
238
|
excerpt: string;
|
|
239
|
+
slug?: string | undefined;
|
|
240
|
+
published?: boolean | undefined;
|
|
241
|
+
publishedAt?: unknown;
|
|
242
|
+
createdAt?: unknown;
|
|
243
|
+
updatedAt?: unknown;
|
|
244
|
+
image?: string | undefined;
|
|
239
245
|
tags?: ({
|
|
240
246
|
name: string;
|
|
241
247
|
} | {
|
|
@@ -243,16 +249,16 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
243
249
|
name: string;
|
|
244
250
|
slug: string;
|
|
245
251
|
})[] | undefined;
|
|
246
|
-
slug?: string | undefined;
|
|
247
|
-
createdAt?: unknown;
|
|
248
|
-
updatedAt?: unknown;
|
|
249
|
-
publishedAt?: unknown;
|
|
250
|
-
image?: string | undefined;
|
|
251
|
-
published?: boolean | undefined;
|
|
252
252
|
}, {
|
|
253
253
|
title: string;
|
|
254
254
|
content: string;
|
|
255
255
|
excerpt: string;
|
|
256
|
+
slug?: string | undefined;
|
|
257
|
+
published?: boolean | undefined;
|
|
258
|
+
publishedAt?: unknown;
|
|
259
|
+
createdAt?: unknown;
|
|
260
|
+
updatedAt?: unknown;
|
|
261
|
+
image?: string | undefined;
|
|
256
262
|
tags?: ({
|
|
257
263
|
name: string;
|
|
258
264
|
} | {
|
|
@@ -260,12 +266,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
260
266
|
name: string;
|
|
261
267
|
slug: string;
|
|
262
268
|
})[] | undefined;
|
|
263
|
-
slug?: string | undefined;
|
|
264
|
-
createdAt?: unknown;
|
|
265
|
-
updatedAt?: unknown;
|
|
266
|
-
publishedAt?: unknown;
|
|
267
|
-
image?: string | undefined;
|
|
268
|
-
published?: boolean | undefined;
|
|
269
269
|
}>;
|
|
270
270
|
}, Post>;
|
|
271
271
|
readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
|