@yimingliao/cms 0.0.120 → 0.0.122
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/{chunk-FUAJWL2N.js → chunk-UO5SKNAK.js} +13 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1 -1
- package/dist/server/index.d.ts +10 -1
- package/dist/server/index.js +29 -3
- package/package.json +1 -1
|
@@ -5,6 +5,18 @@ var ADMIN_ROLES = {
|
|
|
5
5
|
EDITOR: "EDITOR"
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
// src/domain/resources/admin/constants.ts
|
|
9
|
+
var ADMIN_ROLE_ARRAY = [
|
|
10
|
+
ADMIN_ROLES.SUPER_ADMIN,
|
|
11
|
+
ADMIN_ROLES.ADMIN,
|
|
12
|
+
ADMIN_ROLES.EDITOR
|
|
13
|
+
];
|
|
14
|
+
var ADMIN_ROLE_I18N_MAP = {
|
|
15
|
+
[ADMIN_ROLES.SUPER_ADMIN]: `resources.admin.role.super-admin.text`,
|
|
16
|
+
[ADMIN_ROLES.ADMIN]: `resources.admin.role.admin.text`,
|
|
17
|
+
[ADMIN_ROLES.EDITOR]: `resources.admin.role.editor.text`
|
|
18
|
+
};
|
|
19
|
+
|
|
8
20
|
// src/domain/resources/file/utils/is-file-locked.ts
|
|
9
21
|
var isFileLocked = (file) => {
|
|
10
22
|
if (!file) return false;
|
|
@@ -61,4 +73,4 @@ var ROOT_FOLDER = {
|
|
|
61
73
|
var SIMPLE_UPLOAD_FOLDER_NAME = "simple-upload";
|
|
62
74
|
var SIMPLE_UPLOAD_FOLDER_KEY = `${SIMPLE_UPLOAD_FOLDER_NAME}`;
|
|
63
75
|
|
|
64
|
-
export { ADMIN_ROLES, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked };
|
|
76
|
+
export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ declare const isFolderLocked: (folder?: FolderFull | Folder) => boolean;
|
|
|
10
10
|
|
|
11
11
|
declare const isFileLocked: (file?: FileFull | FileCard | null) => boolean;
|
|
12
12
|
|
|
13
|
+
declare const ADMIN_ROLE_ARRAY: readonly ["SUPER_ADMIN", "ADMIN", "EDITOR"];
|
|
14
|
+
declare const ADMIN_ROLE_I18N_MAP: {
|
|
15
|
+
SUPER_ADMIN: string;
|
|
16
|
+
ADMIN: string;
|
|
17
|
+
EDITOR: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
13
20
|
declare const ROOT_FOLDER_ID = "01ARZ3NDEKTSV4RRFFQ69G5FAV";
|
|
14
21
|
declare const ROOT_FOLDER_NAME = "ROOT";
|
|
15
22
|
declare const ROOT_FOLDER: FolderFull;
|
|
@@ -110,4 +117,4 @@ declare const SIZE: {
|
|
|
110
117
|
};
|
|
111
118
|
type SizeUnit = keyof typeof SIZE;
|
|
112
119
|
|
|
113
|
-
export { BaseTranslation, ErrorDetail, ErrorResult, type ErrorResultParams, FileCard, FileFull, Folder, FolderFull, OG_TYPE_ARRAY, type OgType, PostFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TWITTER_CARD_ARRAY, type TwitterCard, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, isFileLocked, isFolderLocked, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd };
|
|
120
|
+
export { ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, BaseTranslation, ErrorDetail, ErrorResult, type ErrorResultParams, FileCard, FileFull, Folder, FolderFull, OG_TYPE_ARRAY, type OgType, PostFull, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, SIZE, type SizeUnit, SuccessResult, type SuccessResultParams, TWITTER_CARD_ARRAY, type TwitterCard, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, isFileLocked, isFolderLocked, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ADMIN_ROLES, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked } from './chunk-
|
|
1
|
+
export { ADMIN_ROLES, ADMIN_ROLE_ARRAY, ADMIN_ROLE_I18N_MAP, POST_TYPES, ROOT_FOLDER, ROOT_FOLDER_ID, ROOT_FOLDER_NAME, SIMPLE_UPLOAD_FOLDER_KEY, SIMPLE_UPLOAD_FOLDER_NAME, isFileLocked, isFolderLocked } from './chunk-UO5SKNAK.js';
|
|
2
2
|
export { FILE_TYPES, OG_TYPE_ARRAY, SIZE, TWITTER_CARD_ARRAY, classifyFileType, createBuildArticleMetadata, createBuildTranslations, createBuildWebsiteMetadata, datetimeToDb, datetimeToUi, ensureArray, findTranslation, formatDateTime, formatFileSize, getMediaInfo, jsonArrayToDb, jsonArrayToUi, mimeToExtension, result, serializeJsonLd } from './chunk-VSV6SQWC.js';
|
package/dist/server/index.d.ts
CHANGED
|
@@ -80,6 +80,15 @@ interface CreateExecuteApiParams {
|
|
|
80
80
|
}
|
|
81
81
|
declare function createExecuteApi({ initI18n, logger }: CreateExecuteApiParams): (fn: Api) => Promise<NextResponse<unknown>>;
|
|
82
82
|
|
|
83
|
+
interface RunActionOptions<T> {
|
|
84
|
+
shouldRun?: () => boolean | Promise<boolean>;
|
|
85
|
+
onSuccess?: (data?: T) => void;
|
|
86
|
+
onError?: (e?: unknown) => void;
|
|
87
|
+
}
|
|
88
|
+
declare function createRunAction({ logger }: {
|
|
89
|
+
logger: Logger;
|
|
90
|
+
}): <D>(action: () => Promise<Result<D>>, options?: RunActionOptions<D>) => Promise<Partial<D>>;
|
|
91
|
+
|
|
83
92
|
declare const adminCreateValidator: (schemas: ReturnType<typeof createSchemas>) => zod.ZodObject<{
|
|
84
93
|
role: zod.ZodEnum<{
|
|
85
94
|
SUPER_ADMIN: "SUPER_ADMIN";
|
|
@@ -1541,4 +1550,4 @@ declare class ServerError extends Error {
|
|
|
1541
1550
|
static internalServerError(): ServerError;
|
|
1542
1551
|
}
|
|
1543
1552
|
|
|
1544
|
-
export { ADMIN_ORDER_BY, ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type SeoMetadataUpsertFormData, ServerError, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminUpdateAction, createCache, createExecuteApi, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderUpdateAction, createMultiFileSchema, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostUpdateAction, createSchemas, createSeoMetadataUpsertAction, createTocItemSchema, createTransporter, createZod };
|
|
1553
|
+
export { ADMIN_ORDER_BY, ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type SeoMetadataUpsertFormData, ServerError, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminUpdateAction, createCache, createExecuteApi, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderUpdateAction, createMultiFileSchema, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostUpdateAction, createRunAction, createSchemas, createSeoMetadataUpsertAction, createTocItemSchema, createTransporter, createZod };
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-
|
|
1
|
+
import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-UO5SKNAK.js';
|
|
2
2
|
import { SIZE, result, datetimeToDb, jsonArrayToDb, mimeToExtension, classifyFileType, TWITTER_CARD_ARRAY, OG_TYPE_ARRAY } from '../chunk-VSV6SQWC.js';
|
|
3
3
|
import jwt from 'jsonwebtoken';
|
|
4
4
|
import argon2 from 'argon2';
|
|
@@ -1957,7 +1957,7 @@ var normalizeError = (error, translator) => {
|
|
|
1957
1957
|
};
|
|
1958
1958
|
};
|
|
1959
1959
|
|
|
1960
|
-
// src/server/interfaces/execution/
|
|
1960
|
+
// src/server/interfaces/execution/create-execute-action.ts
|
|
1961
1961
|
function createExecuteAction({
|
|
1962
1962
|
initI18n,
|
|
1963
1963
|
cacheResult,
|
|
@@ -2012,6 +2012,32 @@ function createExecuteApi({ initI18n, logger }) {
|
|
|
2012
2012
|
};
|
|
2013
2013
|
}
|
|
2014
2014
|
|
|
2015
|
+
// src/server/interfaces/execution/create-run-action.ts
|
|
2016
|
+
function createRunAction({ logger }) {
|
|
2017
|
+
return async function runAction(action, options) {
|
|
2018
|
+
const { shouldRun, onSuccess, onError } = options || {};
|
|
2019
|
+
if (shouldRun) {
|
|
2020
|
+
const shouldProceed = await shouldRun();
|
|
2021
|
+
if (shouldProceed === false) {
|
|
2022
|
+
return {};
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
try {
|
|
2026
|
+
const response = await action();
|
|
2027
|
+
if (response.success) {
|
|
2028
|
+
const data = response.data ?? {};
|
|
2029
|
+
onSuccess?.(data);
|
|
2030
|
+
return data;
|
|
2031
|
+
}
|
|
2032
|
+
throw new Error(response.message);
|
|
2033
|
+
} catch (error) {
|
|
2034
|
+
logger.error({ error });
|
|
2035
|
+
onError?.(error);
|
|
2036
|
+
return {};
|
|
2037
|
+
}
|
|
2038
|
+
};
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2015
2041
|
// src/server/interfaces/middlewares/auth/create-auth-middleware.ts
|
|
2016
2042
|
function createAuthMiddleware({
|
|
2017
2043
|
adminRefreshTokenCommandRepository,
|
|
@@ -4356,4 +4382,4 @@ function createForgotPasswordEmail({
|
|
|
4356
4382
|
};
|
|
4357
4383
|
}
|
|
4358
4384
|
|
|
4359
|
-
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, ServerError, createAdminCommandRepository, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminRefreshTokenQueryRepository, createAdminUpdateAction, createArgon2Service, createAuthMiddleware, createAuthUseCases, createCache, createCacheResult, createChangePasswordAction, createCookieService, createCryptoService, createEmailUnverifiedAction, createEmailVerificationEmail, createExecuteAction, createExecuteApi, createExist, createFileCommandRepository, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileQueryRepository, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCommandRepository, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderQueryRepository, createFolderUpdateAction, createForgotPasswordAction, createForgotPasswordEmail, createIpRateLimiter, createJwtService, createMultiFileSchema, createPostCommandRepository, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostQueryRepository, createPostUpdateAction, createRenderEmailTemplate, createResetPasswordAction, createSchemas, createSendEmail, createSeoMetadataCommandRepository, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createUnique, createVerifyAccessToken, createVerifyAction, createVerifyEmailAction, createVerifyRefreshToken, createZod, normalizeCacheKey };
|
|
4385
|
+
export { ADMIN_ORDER_BY, ORDER_BY, POST_ORDER_BY, ServerError, createAdminCommandRepository, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminRefreshTokenQueryRepository, createAdminUpdateAction, createArgon2Service, createAuthMiddleware, createAuthUseCases, createCache, createCacheResult, createChangePasswordAction, createCookieService, createCryptoService, createEmailUnverifiedAction, createEmailVerificationEmail, createExecuteAction, createExecuteApi, createExist, createFileCommandRepository, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileQueryRepository, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCommandRepository, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderQueryRepository, createFolderUpdateAction, createForgotPasswordAction, createForgotPasswordEmail, createIpRateLimiter, createJwtService, createMultiFileSchema, createPostCommandRepository, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostQueryRepository, createPostUpdateAction, createRenderEmailTemplate, createResetPasswordAction, createRunAction, createSchemas, createSendEmail, createSeoMetadataCommandRepository, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createUnique, createVerifyAccessToken, createVerifyAction, createVerifyEmailAction, createVerifyRefreshToken, createZod, normalizeCacheKey };
|