@yimingliao/cms 0.0.17 → 0.0.19
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/index.d.ts +3 -10
- package/dist/server/index.d.ts +44 -22
- package/dist/server/index.js +223 -12
- package/dist/{base-DbGnfZr6.d.ts → types-Bhnz5Z1F.d.ts} +15 -8
- package/package.json +20 -1
- package/prisma/.DS_Store +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FolderFull } from './
|
|
2
|
-
export { A as ADMIN_ROLES, a as Admin, b as AdminCard, c as AdminFull, d as AdminRefreshToken, e as AdminRole, f as AdminSafe, g as AdminTranslation, h as Alternate, B as BaseTranslation, D as DeviceInfo, E as ExternalLink,
|
|
1
|
+
import { F as FolderFull } from './types-Bhnz5Z1F.js';
|
|
2
|
+
export { A as ADMIN_ROLES, a as Admin, b as AdminCard, c as AdminFull, d as AdminRefreshToken, e as AdminRole, f as AdminSafe, g as AdminTranslation, h as Alternate, B as BaseTranslation, i as BlobFile, D as DeviceInfo, E as ExternalLink, j as FILE_TYPES, k as Faq, l as File, m as FileCard, n as FileFull, o as FileTranslation, p as FileType, q as Folder, M as MultiItems, P as POST_TYPES, r as Post, s as PostFull, t as PostListCard, u as PostTranslation, v as PostType, S as SeoMetadata, w as SingleItem, T as TocItem, x as Translation } from './types-Bhnz5Z1F.js';
|
|
3
3
|
|
|
4
4
|
declare const ROOT_FOLDER_ID = "01ARZ3NDEKTSV4RRFFQ69G5FAV";
|
|
5
5
|
declare const ROOT_FOLDER_NAME = "ROOT";
|
|
@@ -20,13 +20,6 @@ declare const getMediaInfo: (file: Blob) => Promise<MediaInfo>;
|
|
|
20
20
|
|
|
21
21
|
declare const formatFileSize: (size: number, decimals?: number) => string;
|
|
22
22
|
|
|
23
|
-
interface BlobFile extends File {
|
|
24
|
-
id: string;
|
|
25
|
-
width: number | null;
|
|
26
|
-
height: number | null;
|
|
27
|
-
duration: number | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
interface SuccessResult<D = unknown> {
|
|
31
24
|
success: true;
|
|
32
25
|
message?: string;
|
|
@@ -67,4 +60,4 @@ declare const result: {
|
|
|
67
60
|
error: typeof error;
|
|
68
61
|
};
|
|
69
62
|
|
|
70
|
-
export { type
|
|
63
|
+
export { type ErrorDetail, type ErrorResult, type ErrorResultParams, FolderFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, type Result, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, type SuccessResult, type SuccessResultParams, classifyFileType, formatFileSize, getMediaInfo, mimeToExtension, result };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import jwt from 'jsonwebtoken';
|
|
2
2
|
import { BinaryLike } from 'node:crypto';
|
|
3
3
|
import { cookies } from 'next/headers';
|
|
4
|
-
import
|
|
4
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
5
5
|
import { Logger } from 'logry';
|
|
6
|
-
import { e as AdminRole,
|
|
6
|
+
import { i as BlobFile, e as AdminRole, w as SingleItem, B as BaseTranslation, a as Admin, c as AdminFull, f as AdminSafe, D as DeviceInfo, d as AdminRefreshToken, l as File, n as FileFull, p as FileType, q as Folder, F as FolderFull, v as PostType, M as MultiItems, E as ExternalLink, k as Faq, T as TocItem, r as Post, t as PostListCard, u as PostTranslation, s as PostFull, S as SeoMetadata, g as AdminTranslation, o as FileTranslation, h as Alternate } from '../types-Bhnz5Z1F.js';
|
|
7
|
+
import { Pool } from 'generic-pool';
|
|
8
|
+
import SFTPClient from 'ssh2-sftp-client';
|
|
9
|
+
import Keyv from 'keyv';
|
|
7
10
|
|
|
8
|
-
interface
|
|
11
|
+
interface CreateJwtServiceOptions {
|
|
9
12
|
defaultSecret: string;
|
|
10
13
|
issuer?: string;
|
|
11
14
|
audience?: string;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
* JWT service
|
|
15
|
-
*
|
|
16
|
-
* Sign, Verify
|
|
17
|
-
*/
|
|
18
|
-
declare function createJwtService(config: JwtServiceConfig): {
|
|
16
|
+
declare function createJwtService({ defaultSecret, ...options }: CreateJwtServiceOptions): {
|
|
19
17
|
sign: ({ payload, secret, expiresIn, }: {
|
|
20
18
|
payload: object;
|
|
21
19
|
secret: string;
|
|
@@ -32,15 +30,10 @@ declare function createArgon2Service(): {
|
|
|
32
30
|
verify: (hash: string, plain: string) => Promise<boolean>;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
|
-
interface
|
|
33
|
+
interface CreateCryptoServiceOptions {
|
|
36
34
|
defaultSecret: string;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
* Crypto service
|
|
40
|
-
*
|
|
41
|
-
* Encrypt & Decrypt, Calculate checksum, Sign
|
|
42
|
-
*/
|
|
43
|
-
declare function createCryptoService(config: CryptoServiceConfig): {
|
|
36
|
+
declare function createCryptoService({ defaultSecret, }: CreateCryptoServiceOptions): {
|
|
44
37
|
generateToken: () => string;
|
|
45
38
|
hash: (value: BinaryLike) => string;
|
|
46
39
|
hashBuffer: (value: BinaryLike) => Buffer;
|
|
@@ -56,11 +49,6 @@ declare function createCryptoService(config: CryptoServiceConfig): {
|
|
|
56
49
|
};
|
|
57
50
|
};
|
|
58
51
|
|
|
59
|
-
/**
|
|
60
|
-
* Cookie Service
|
|
61
|
-
*
|
|
62
|
-
* Set, Get, Verify, Delete
|
|
63
|
-
*/
|
|
64
52
|
declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnType<typeof cookies>>>, cryptoService: ReturnType<typeof createCryptoService>): {
|
|
65
53
|
set: ({ name, value, expireSeconds, }: {
|
|
66
54
|
name: string;
|
|
@@ -86,6 +74,40 @@ declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnTy
|
|
|
86
74
|
}) => Promise<void>;
|
|
87
75
|
};
|
|
88
76
|
|
|
77
|
+
interface StorageService {
|
|
78
|
+
upload(options: {
|
|
79
|
+
blobFile: BlobFile;
|
|
80
|
+
folderKey?: string;
|
|
81
|
+
}): Promise<string>;
|
|
82
|
+
remove(options: {
|
|
83
|
+
key: string;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
move(options: {
|
|
86
|
+
fromKey: string;
|
|
87
|
+
toKey: string;
|
|
88
|
+
}): Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface CreateR2ServiceOptions {
|
|
92
|
+
r2Client: S3Client;
|
|
93
|
+
bucketName: string;
|
|
94
|
+
logger: Logger;
|
|
95
|
+
}
|
|
96
|
+
declare function createR2Service({ r2Client, bucketName, logger, }: CreateR2ServiceOptions): StorageService;
|
|
97
|
+
|
|
98
|
+
interface CreateSftpServiceOptions {
|
|
99
|
+
sftpPool: Pool<SFTPClient>;
|
|
100
|
+
basePath: string;
|
|
101
|
+
logger: Logger;
|
|
102
|
+
}
|
|
103
|
+
declare function createSftpService({ sftpPool, basePath, logger, }: CreateSftpServiceOptions): StorageService;
|
|
104
|
+
|
|
105
|
+
interface CreateSftpPoolOptions {
|
|
106
|
+
sftpClientOptions: SFTPClient.ConnectOptions;
|
|
107
|
+
logger: Logger;
|
|
108
|
+
}
|
|
109
|
+
declare const createSftpPool: ({ sftpClientOptions, logger, }: CreateSftpPoolOptions) => Pool<SFTPClient>;
|
|
110
|
+
|
|
89
111
|
interface CreateServerCacheOptions {
|
|
90
112
|
redisUrl: string;
|
|
91
113
|
namespace: string;
|
|
@@ -611,4 +633,4 @@ declare const POST_ORDER_BY: ({
|
|
|
611
633
|
index: "asc";
|
|
612
634
|
})[];
|
|
613
635
|
|
|
614
|
-
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, type RawCacheKey, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCache, createCacheResult, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createIpRateLimiter, createJwtService, createPostCommandRepository, createPostQueryRepository, createSeoMetadataCommandRepository, normalizeCacheKey };
|
|
636
|
+
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, type RawCacheKey, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCache, createCacheResult, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createIpRateLimiter, createJwtService, createPostCommandRepository, createPostQueryRepository, createR2Service, createSeoMetadataCommandRepository, createSftpPool, createSftpService, normalizeCacheKey };
|
package/dist/server/index.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { ADMIN_ROLES, mimeToExtension, classifyFileType, ROOT_FOLDER_ID } from '../chunk-SEX4DOKX.js';
|
|
2
2
|
import jwt from 'jsonwebtoken';
|
|
3
|
-
import argon2
|
|
3
|
+
import argon2 from 'argon2';
|
|
4
4
|
import crypto, { timingSafeEqual } from 'crypto';
|
|
5
5
|
import { headers } from 'next/headers';
|
|
6
|
+
import { PutObjectCommand, DeleteObjectCommand, CopyObjectCommand } from '@aws-sdk/client-s3';
|
|
7
|
+
import path2 from 'path/posix';
|
|
8
|
+
import { ulid } from 'ulid';
|
|
9
|
+
import { createPool } from 'generic-pool';
|
|
10
|
+
import SFTPClient from 'ssh2-sftp-client';
|
|
6
11
|
import KeyvRedis from '@keyv/redis';
|
|
7
12
|
import Keyv from 'keyv';
|
|
8
|
-
import { ulid } from 'ulid';
|
|
9
13
|
|
|
10
|
-
function createJwtService(
|
|
11
|
-
|
|
14
|
+
function createJwtService({
|
|
15
|
+
defaultSecret,
|
|
16
|
+
...options
|
|
17
|
+
}) {
|
|
12
18
|
function sign({
|
|
13
19
|
payload = {},
|
|
14
20
|
secret = defaultSecret,
|
|
@@ -38,8 +44,8 @@ function createJwtService(config) {
|
|
|
38
44
|
verify
|
|
39
45
|
};
|
|
40
46
|
}
|
|
41
|
-
var
|
|
42
|
-
type: argon2id,
|
|
47
|
+
var DEFAULT_OPTIONS = {
|
|
48
|
+
type: argon2.argon2id,
|
|
43
49
|
memoryCost: 19456,
|
|
44
50
|
// ~19MB
|
|
45
51
|
timeCost: 2,
|
|
@@ -47,7 +53,7 @@ var OPTIONS = {
|
|
|
47
53
|
};
|
|
48
54
|
function createArgon2Service() {
|
|
49
55
|
async function hash(password) {
|
|
50
|
-
return await argon2.hash(password,
|
|
56
|
+
return await argon2.hash(password, DEFAULT_OPTIONS);
|
|
51
57
|
}
|
|
52
58
|
async function verify(hash2, plain) {
|
|
53
59
|
return await argon2.verify(hash2, plain);
|
|
@@ -57,8 +63,9 @@ function createArgon2Service() {
|
|
|
57
63
|
verify
|
|
58
64
|
};
|
|
59
65
|
}
|
|
60
|
-
function createCryptoService(
|
|
61
|
-
|
|
66
|
+
function createCryptoService({
|
|
67
|
+
defaultSecret
|
|
68
|
+
}) {
|
|
62
69
|
const SECRET = crypto.createHash("sha256").update(defaultSecret).digest();
|
|
63
70
|
const ALGORITHM = "aes-256-gcm";
|
|
64
71
|
const IV_LENGTH = 12;
|
|
@@ -118,7 +125,7 @@ function createCryptoService(config) {
|
|
|
118
125
|
sign
|
|
119
126
|
};
|
|
120
127
|
}
|
|
121
|
-
var
|
|
128
|
+
var DEFAULT_OPTIONS2 = {
|
|
122
129
|
httpOnly: true,
|
|
123
130
|
secure: process.env["NODE_ENV"] === "production",
|
|
124
131
|
sameSite: "strict",
|
|
@@ -131,7 +138,7 @@ function createCookieService(nextCookies, cryptoService) {
|
|
|
131
138
|
expireSeconds
|
|
132
139
|
}) {
|
|
133
140
|
const cookieStore = await nextCookies();
|
|
134
|
-
cookieStore.set(name, value, { ...
|
|
141
|
+
cookieStore.set(name, value, { ...DEFAULT_OPTIONS2, maxAge: expireSeconds });
|
|
135
142
|
}
|
|
136
143
|
async function setSignedCookie({
|
|
137
144
|
name,
|
|
@@ -195,6 +202,210 @@ function createCookieService(nextCookies, cryptoService) {
|
|
|
195
202
|
delete: deleteCokkie
|
|
196
203
|
};
|
|
197
204
|
}
|
|
205
|
+
function createObjectKey({
|
|
206
|
+
filename,
|
|
207
|
+
mimeType,
|
|
208
|
+
folderKey = ""
|
|
209
|
+
}) {
|
|
210
|
+
const extensionFromFilename = path2.extname(filename ?? "").toLowerCase();
|
|
211
|
+
const extensionFromMime = !extensionFromFilename && mimeType ? `.${mimeToExtension(mimeType)}` : "";
|
|
212
|
+
const extension = extensionFromFilename || extensionFromMime;
|
|
213
|
+
const normalizedFolder = folderKey.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
214
|
+
const id = ulid();
|
|
215
|
+
const filenameWithId = id + extension;
|
|
216
|
+
if (!normalizedFolder) return filenameWithId;
|
|
217
|
+
return path2.join(normalizedFolder, filenameWithId);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/server/infrastructure/storage/r2/r2.service.ts
|
|
221
|
+
function createR2Service({
|
|
222
|
+
r2Client,
|
|
223
|
+
bucketName,
|
|
224
|
+
logger
|
|
225
|
+
}) {
|
|
226
|
+
async function upload({
|
|
227
|
+
blobFile,
|
|
228
|
+
folderKey = ""
|
|
229
|
+
}) {
|
|
230
|
+
const key = createObjectKey({
|
|
231
|
+
filename: blobFile.name,
|
|
232
|
+
mimeType: blobFile.type,
|
|
233
|
+
folderKey
|
|
234
|
+
});
|
|
235
|
+
try {
|
|
236
|
+
const buffer = Buffer.from(await blobFile.arrayBuffer());
|
|
237
|
+
await r2Client.send(
|
|
238
|
+
new PutObjectCommand({
|
|
239
|
+
Bucket: bucketName,
|
|
240
|
+
Key: key,
|
|
241
|
+
Body: buffer,
|
|
242
|
+
ContentType: blobFile.type || void 0
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
logger.debug("R2 upload success", { key });
|
|
246
|
+
return key;
|
|
247
|
+
} catch (error) {
|
|
248
|
+
logger.error("R2 upload failed", { key, error });
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
async function remove({ key }) {
|
|
253
|
+
try {
|
|
254
|
+
await r2Client.send(
|
|
255
|
+
new DeleteObjectCommand({
|
|
256
|
+
Bucket: bucketName,
|
|
257
|
+
Key: key
|
|
258
|
+
})
|
|
259
|
+
);
|
|
260
|
+
logger.debug("R2 object removed", { key });
|
|
261
|
+
} catch (error) {
|
|
262
|
+
logger.error("R2 remove failed", { key, error });
|
|
263
|
+
throw error;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async function move({ fromKey, toKey }) {
|
|
267
|
+
if (fromKey === toKey) {
|
|
268
|
+
logger.debug("R2 move skipped (same key)", { key: fromKey });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
await r2Client.send(
|
|
273
|
+
new CopyObjectCommand({
|
|
274
|
+
Bucket: bucketName,
|
|
275
|
+
CopySource: encodeURI(`${bucketName}/${fromKey}`),
|
|
276
|
+
Key: toKey
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
await remove({ key: fromKey });
|
|
280
|
+
logger.debug("R2 object moved", { fromKey, toKey });
|
|
281
|
+
} catch (error) {
|
|
282
|
+
logger.error("R2 move failed", { fromKey, toKey, error });
|
|
283
|
+
throw error;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
upload,
|
|
288
|
+
remove,
|
|
289
|
+
move
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function createSftpService({
|
|
293
|
+
sftpPool,
|
|
294
|
+
basePath,
|
|
295
|
+
logger
|
|
296
|
+
}) {
|
|
297
|
+
async function upload({
|
|
298
|
+
blobFile,
|
|
299
|
+
folderKey = ""
|
|
300
|
+
}) {
|
|
301
|
+
const key = createObjectKey({
|
|
302
|
+
filename: blobFile.name,
|
|
303
|
+
mimeType: blobFile.type,
|
|
304
|
+
folderKey
|
|
305
|
+
});
|
|
306
|
+
const fullPath = path2.join(basePath, key);
|
|
307
|
+
const client = await sftpPool.acquire();
|
|
308
|
+
try {
|
|
309
|
+
const buffer = Buffer.from(await blobFile.arrayBuffer());
|
|
310
|
+
await client.put(buffer, fullPath);
|
|
311
|
+
logger.debug("SFTP upload success", { key });
|
|
312
|
+
return key;
|
|
313
|
+
} catch (error) {
|
|
314
|
+
logger.error("SFTP upload failed", { key, error });
|
|
315
|
+
throw error;
|
|
316
|
+
} finally {
|
|
317
|
+
await sftpPool.release(client);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async function remove({ key }) {
|
|
321
|
+
const fullPath = path2.join(basePath, key);
|
|
322
|
+
const client = await sftpPool.acquire();
|
|
323
|
+
try {
|
|
324
|
+
await client.delete(fullPath);
|
|
325
|
+
logger.debug("SFTP object removed", { key });
|
|
326
|
+
} catch (error) {
|
|
327
|
+
if (error instanceof Error && /no such file/i.test(error.message)) {
|
|
328
|
+
logger.debug("SFTP remove skipped (not found)", { key });
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
logger.error("SFTP remove failed", { key, error });
|
|
332
|
+
throw error;
|
|
333
|
+
} finally {
|
|
334
|
+
await sftpPool.release(client);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async function move({ fromKey, toKey }) {
|
|
338
|
+
if (fromKey === toKey) {
|
|
339
|
+
logger.debug("SFTP move skipped (same key)", { key: fromKey });
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const fromPath = path2.join(basePath, fromKey);
|
|
343
|
+
const toPath = path2.join(basePath, toKey);
|
|
344
|
+
const client = await sftpPool.acquire();
|
|
345
|
+
try {
|
|
346
|
+
await client.rename(fromPath, toPath);
|
|
347
|
+
logger.debug("SFTP object moved", { fromKey, toKey });
|
|
348
|
+
} catch (error) {
|
|
349
|
+
logger.error("SFTP move failed", { fromKey, toKey, error });
|
|
350
|
+
throw error;
|
|
351
|
+
} finally {
|
|
352
|
+
await sftpPool.release(client);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
upload,
|
|
357
|
+
remove,
|
|
358
|
+
move
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
var createSftpPool = ({
|
|
362
|
+
sftpClientOptions,
|
|
363
|
+
logger
|
|
364
|
+
}) => {
|
|
365
|
+
return createPool(
|
|
366
|
+
{
|
|
367
|
+
create: async () => {
|
|
368
|
+
const client = new SFTPClient();
|
|
369
|
+
try {
|
|
370
|
+
await client.connect({
|
|
371
|
+
readyTimeout: 2e4,
|
|
372
|
+
keepaliveInterval: 1e4,
|
|
373
|
+
keepaliveCountMax: 3,
|
|
374
|
+
...sftpClientOptions
|
|
375
|
+
});
|
|
376
|
+
return client;
|
|
377
|
+
} catch (error) {
|
|
378
|
+
logger.error("SFTP connect failed", { error });
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
validate: async (client) => {
|
|
383
|
+
try {
|
|
384
|
+
await client.realPath("/");
|
|
385
|
+
return true;
|
|
386
|
+
} catch {
|
|
387
|
+
logger.debug("SFTP session invalid, removing from pool");
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
destroy: async (client) => {
|
|
392
|
+
try {
|
|
393
|
+
await client.end();
|
|
394
|
+
} catch (error) {
|
|
395
|
+
logger.error("SFTP destroy failed", { error });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
max: 3,
|
|
401
|
+
min: 0,
|
|
402
|
+
idleTimeoutMillis: 6e4,
|
|
403
|
+
acquireTimeoutMillis: 1e4,
|
|
404
|
+
evictionRunIntervalMillis: 3e4,
|
|
405
|
+
testOnBorrow: true
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
};
|
|
198
409
|
|
|
199
410
|
// src/server/infrastructure/cache/cache-key-delimiter.ts
|
|
200
411
|
var CACHE_KEY_DELIMITER = "|";
|
|
@@ -1417,4 +1628,4 @@ function createSeoMetadataCommandRepository(prisma) {
|
|
|
1417
1628
|
};
|
|
1418
1629
|
}
|
|
1419
1630
|
|
|
1420
|
-
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCache, createCacheResult, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createIpRateLimiter, createJwtService, createPostCommandRepository, createPostQueryRepository, createSeoMetadataCommandRepository, normalizeCacheKey };
|
|
1631
|
+
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCache, createCacheResult, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createIpRateLimiter, createJwtService, createPostCommandRepository, createPostQueryRepository, createR2Service, createSeoMetadataCommandRepository, createSftpPool, createSftpService, normalizeCacheKey };
|
|
@@ -85,7 +85,7 @@ declare const FILE_TYPES: {
|
|
|
85
85
|
};
|
|
86
86
|
type FileType = (typeof FILE_TYPES)[keyof typeof FILE_TYPES];
|
|
87
87
|
|
|
88
|
-
interface File {
|
|
88
|
+
interface File$1 {
|
|
89
89
|
id: string;
|
|
90
90
|
key: string;
|
|
91
91
|
checksum: string;
|
|
@@ -127,10 +127,10 @@ interface Folder {
|
|
|
127
127
|
type FolderFull = Folder & {
|
|
128
128
|
parentFolder: (Folder & {
|
|
129
129
|
subFolders: Folder[];
|
|
130
|
-
files: File[];
|
|
130
|
+
files: File$1[];
|
|
131
131
|
}) | null;
|
|
132
132
|
subFolders: Folder[];
|
|
133
|
-
files: File[];
|
|
133
|
+
files: File$1[];
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
declare const POST_TYPES: {
|
|
@@ -242,7 +242,7 @@ type PostListCard = Post & {
|
|
|
242
242
|
postsInTopic: Post[];
|
|
243
243
|
children: Post[];
|
|
244
244
|
taggedPosts: Post[];
|
|
245
|
-
coverImage: File | null;
|
|
245
|
+
coverImage: File$1 | null;
|
|
246
246
|
translations: PostTranslation[];
|
|
247
247
|
};
|
|
248
248
|
|
|
@@ -266,7 +266,7 @@ type PostFull = Post & {
|
|
|
266
266
|
translations: PostTranslation[];
|
|
267
267
|
};
|
|
268
268
|
|
|
269
|
-
type FileFull = File & {
|
|
269
|
+
type FileFull = File$1 & {
|
|
270
270
|
folder: Folder | null;
|
|
271
271
|
adminAsAvatarImage: Admin[];
|
|
272
272
|
postsAsCoverImage: Post[];
|
|
@@ -280,13 +280,13 @@ type FileFull = File & {
|
|
|
280
280
|
translations: FileTranslation[];
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
type FileCard = File & {
|
|
283
|
+
type FileCard = File$1 & {
|
|
284
284
|
translations: FileTranslation[];
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
type AdminFull = AdminSafe & {
|
|
288
288
|
adminRefreshTokens: AdminRefreshToken[];
|
|
289
|
-
avatarImage: (File & {
|
|
289
|
+
avatarImage: (File$1 & {
|
|
290
290
|
translations: FileTranslation[];
|
|
291
291
|
}) | null;
|
|
292
292
|
posts: Post[];
|
|
@@ -337,4 +337,11 @@ interface SeoMetadata {
|
|
|
337
337
|
updatedAt: Date;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
interface BlobFile extends File {
|
|
341
|
+
id: string;
|
|
342
|
+
width: number | null;
|
|
343
|
+
height: number | null;
|
|
344
|
+
duration: number | null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export { ADMIN_ROLES as A, type BaseTranslation as B, type DeviceInfo as D, type ExternalLink as E, type FolderFull as F, type MultiItems as M, POST_TYPES as P, type SeoMetadata as S, type TocItem as T, type Admin as a, type AdminCard as b, type AdminFull as c, type AdminRefreshToken as d, type AdminRole as e, type AdminSafe as f, type AdminTranslation as g, type Alternate as h, type BlobFile as i, FILE_TYPES as j, type Faq as k, type File$1 as l, type FileCard as m, type FileFull as n, type FileTranslation as o, type FileType as p, type Folder as q, type Post as r, type PostFull as s, type PostListCard as t, type PostTranslation as u, type PostType as v, type SingleItem as w, type Translation as x };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yimingliao/cms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"author": "Yiming Liao",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,12 +35,31 @@
|
|
|
35
35
|
"ulid": "^3.0.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@aws-sdk/client-s3": "^3.1004.0",
|
|
38
39
|
"@prisma/client": "6.5.0",
|
|
39
40
|
"@types/jsonwebtoken": "^9.0.10",
|
|
40
41
|
"@types/mime-types": "^3.0.1",
|
|
42
|
+
"@types/ssh2-sftp-client": "^9.0.6",
|
|
43
|
+
"generic-pool": "^3.9.0",
|
|
41
44
|
"next": "^16.1.6",
|
|
42
45
|
"prisma": "6.5.0",
|
|
43
46
|
"tsup": "^8.5.1",
|
|
44
47
|
"typescript": "^5.9.3"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@aws-sdk/client-s3": "^3.0.0",
|
|
51
|
+
"generic-pool": "^3.9.0",
|
|
52
|
+
"ssh2-sftp-client": "^12.1.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@aws-sdk/client-s3": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"generic-pool": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"ssh2-sftp-client": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
45
64
|
}
|
|
46
65
|
}
|
package/prisma/.DS_Store
ADDED
|
Binary file
|