@easy-cms/core 0.17.0 → 0.19.0
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 +12 -3
- package/dist/index.js +5 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1124,6 +1124,13 @@ interface ContainerAdmin {
|
|
|
1124
1124
|
/** Panels in the edit page's side column, below publishing (components from admin modules). */
|
|
1125
1125
|
readonly sidebar?: readonly AdminComponent[];
|
|
1126
1126
|
}
|
|
1127
|
+
interface CollectionAdmin extends ContainerAdmin {
|
|
1128
|
+
/**
|
|
1129
|
+
* `settings` lists the collection under Settings in the admin menu (with Users and API keys)
|
|
1130
|
+
* instead of with the content, e.g. for redirects or forms settings.
|
|
1131
|
+
*/
|
|
1132
|
+
readonly group?: 'settings';
|
|
1133
|
+
}
|
|
1127
1134
|
interface CollectionConfig {
|
|
1128
1135
|
/** URL and table name. Lowercase letters, digits, `-` and `_`. */
|
|
1129
1136
|
readonly slug: string;
|
|
@@ -1156,8 +1163,8 @@ interface CollectionConfig {
|
|
|
1156
1163
|
readonly preview?: PreviewURL;
|
|
1157
1164
|
readonly access?: CollectionAccess;
|
|
1158
1165
|
readonly hooks?: CollectionHooks;
|
|
1159
|
-
/** Custom admin components. */
|
|
1160
|
-
readonly admin?:
|
|
1166
|
+
/** Custom admin components, and where the collection is in the menu. */
|
|
1167
|
+
readonly admin?: CollectionAdmin;
|
|
1161
1168
|
}
|
|
1162
1169
|
interface GlobalConfig {
|
|
1163
1170
|
readonly slug: string;
|
|
@@ -1654,6 +1661,8 @@ interface AdminCollection {
|
|
|
1654
1661
|
fields: AdminField[];
|
|
1655
1662
|
/** Panels from admin modules in the edit page's side column. */
|
|
1656
1663
|
sidebar?: AdminComponentRef[];
|
|
1664
|
+
/** Listed under Settings in the menu (users, API keys, `admin.group: 'settings'`). */
|
|
1665
|
+
group?: 'settings';
|
|
1657
1666
|
permissions: {
|
|
1658
1667
|
read: boolean;
|
|
1659
1668
|
create: boolean;
|
|
@@ -1729,4 +1738,4 @@ declare const BUILTIN_COLLECTIONS: readonly ["users", "media"];
|
|
|
1729
1738
|
/** Checks a config and returns every problem found. An empty array means it is valid. */
|
|
1730
1739
|
declare function validateConfig(config: Config): ConfigIssue[];
|
|
1731
1740
|
|
|
1732
|
-
export { ADMIN_ICONS, API_KEYS, API_KEY_GLOBAL_OPERATIONS, API_KEY_OPERATIONS, type Access, type AccessArgs, type AccessOptions, type AdminBrand, type AdminCollection, type AdminComponent, type AdminComponentRef, type AdminConfig, type AdminField, type AdminGlobal, type AdminIcon, type AdminLocale, type AdminSchema, type AfterChangeHook, type AfterDeleteHook, type AfterReadHook, type ApiKeyContext, type ApiKeyGlobalOperation, type ApiKeyOperation, type ApiKeyPermissions, type ArrayField, Auth, type AuthConfig, type AuthUser, BUILTIN_COLLECTIONS, type BeforeChangeHook, type BeforeDeleteHook, type BeforeValidateHook, type Block, type BlocksField, type BooleanField, type BuiltinApiKeysCollection, type BuiltinMediaCollection, type BuiltinUsersCollection, type BundleHints, CONFIG_FILE_NAMES, CSRF_COOKIE, CSRF_HEADER, type CollectionAccess, type CollectionConfig, type CollectionDocument, type CollectionHooks, type CollectionSlug, type Config, ConfigError, type ConfigIssue, type ContainerAdmin, type CopyProgress, type CopyResult, type CreateEasyCMSOptions, type CreateInput, type CreateMigrationResult, DEFAULT_ADMIN_PATH, DEFAULT_API_PATH, DEFAULT_DEPTH, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_VERSIONS, DEFAULT_TOKEN_EXPIRATION, type Database, type DatabaseAdapter, type DatabaseInitArgs, type DatabaseTransfer, type DateField, type DepthOptions, EXTENSIONS, EasyCMS, EasyCMSError, type EmailField, type Endpoint, type EndpointRequest, FIELD_TYPES, type Field, type FieldAccess, type FieldAccessFn, type FieldAdmin, type FieldError, type FieldType, type FieldValidate, type FieldValidateContext, type FieldValue, type FieldsInput, type FieldsValue, type FindArgs, type FindOptions, ForbiddenError, type GlobalAccess, type GlobalConfig, type GlobalDocument, type GlobalHooks, type GlobalInput, type GlobalSlug, type GroupField, type ID, INTERNAL_COLLECTIONS, type ImageSize, type InferCollection, type InferGlobal, type JsonField, type Label, type LivePreview, type LoadConfigOptions, type LocalStorageOptions, type LocalizationConfig, type Logger, type LoginArgs, MAX_DEPTH, MEDIA, MIN_PASSWORD_LENGTH, MIN_SECRET_LENGTH, type MediaDocument, type MediaSize, type MigrationInfo, NotFoundError, type NumberField, type Operation, type PaginatedDocs, PayloadTooLargeError, type Plugin, type PreviewTarget, type PreviewURL, QueryError, type RawDocument, type ReadOptions, type RelationshipField, type ResolvedConfig, type RestHandler, type RestHandlerOptions, type RichTextDocument, type RichTextField, type Role, type RoutesConfig, SESSION_COOKIE, type ScheduledJob, SchemaError, type SchemaMode, type SelectField, type SelectOption, type Session, type SlugField, type StorageAdapter, type StoredFile, type TextField, type TextareaField, TooManyRequestsError, UnauthorizedError, type UpdateInput, type UploadConfig, type UploadField, ValidationError, type Version, type VersionSummary, type VersionsConfig, WEBHOOK_EVENTS, type WebhookConfig, type WebhookEvent, type WebhookPayload, type Where, type WhereOperators, anyone, applyDefaults, applyPlugins, configSignature, consoleLogger, copyDatabase, createEasyCMS, createRestHandler, createRootEndpointHandler, defineConfig, fillMissing, findConfigFile, generateSlugs, generateTypes, hasRows, hashPassword, imageDimensions, importConfig, isAdmin, isLoggedIn, keyAllows, loadConfig, localStorage, mergeForUpdate, mimeAllowed, parseId, populate, readCookie, resolveAdminModule, resolveConfig, rowFields, silentLogger, singularize, slugify, sniffMimeType, validateConfig, validateFields, verifyPassword };
|
|
1741
|
+
export { ADMIN_ICONS, API_KEYS, API_KEY_GLOBAL_OPERATIONS, API_KEY_OPERATIONS, type Access, type AccessArgs, type AccessOptions, type AdminBrand, type AdminCollection, type AdminComponent, type AdminComponentRef, type AdminConfig, type AdminField, type AdminGlobal, type AdminIcon, type AdminLocale, type AdminSchema, type AfterChangeHook, type AfterDeleteHook, type AfterReadHook, type ApiKeyContext, type ApiKeyGlobalOperation, type ApiKeyOperation, type ApiKeyPermissions, type ArrayField, Auth, type AuthConfig, type AuthUser, BUILTIN_COLLECTIONS, type BeforeChangeHook, type BeforeDeleteHook, type BeforeValidateHook, type Block, type BlocksField, type BooleanField, type BuiltinApiKeysCollection, type BuiltinMediaCollection, type BuiltinUsersCollection, type BundleHints, CONFIG_FILE_NAMES, CSRF_COOKIE, CSRF_HEADER, type CollectionAccess, type CollectionAdmin, type CollectionConfig, type CollectionDocument, type CollectionHooks, type CollectionSlug, type Config, ConfigError, type ConfigIssue, type ContainerAdmin, type CopyProgress, type CopyResult, type CreateEasyCMSOptions, type CreateInput, type CreateMigrationResult, DEFAULT_ADMIN_PATH, DEFAULT_API_PATH, DEFAULT_DEPTH, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_VERSIONS, DEFAULT_TOKEN_EXPIRATION, type Database, type DatabaseAdapter, type DatabaseInitArgs, type DatabaseTransfer, type DateField, type DepthOptions, EXTENSIONS, EasyCMS, EasyCMSError, type EmailField, type Endpoint, type EndpointRequest, FIELD_TYPES, type Field, type FieldAccess, type FieldAccessFn, type FieldAdmin, type FieldError, type FieldType, type FieldValidate, type FieldValidateContext, type FieldValue, type FieldsInput, type FieldsValue, type FindArgs, type FindOptions, ForbiddenError, type GlobalAccess, type GlobalConfig, type GlobalDocument, type GlobalHooks, type GlobalInput, type GlobalSlug, type GroupField, type ID, INTERNAL_COLLECTIONS, type ImageSize, type InferCollection, type InferGlobal, type JsonField, type Label, type LivePreview, type LoadConfigOptions, type LocalStorageOptions, type LocalizationConfig, type Logger, type LoginArgs, MAX_DEPTH, MEDIA, MIN_PASSWORD_LENGTH, MIN_SECRET_LENGTH, type MediaDocument, type MediaSize, type MigrationInfo, NotFoundError, type NumberField, type Operation, type PaginatedDocs, PayloadTooLargeError, type Plugin, type PreviewTarget, type PreviewURL, QueryError, type RawDocument, type ReadOptions, type RelationshipField, type ResolvedConfig, type RestHandler, type RestHandlerOptions, type RichTextDocument, type RichTextField, type Role, type RoutesConfig, SESSION_COOKIE, type ScheduledJob, SchemaError, type SchemaMode, type SelectField, type SelectOption, type Session, type SlugField, type StorageAdapter, type StoredFile, type TextField, type TextareaField, TooManyRequestsError, UnauthorizedError, type UpdateInput, type UploadConfig, type UploadField, ValidationError, type Version, type VersionSummary, type VersionsConfig, WEBHOOK_EVENTS, type WebhookConfig, type WebhookEvent, type WebhookPayload, type Where, type WhereOperators, anyone, applyDefaults, applyPlugins, configSignature, consoleLogger, copyDatabase, createEasyCMS, createRestHandler, createRootEndpointHandler, defineConfig, fillMissing, findConfigFile, generateSlugs, generateTypes, hasRows, hashPassword, imageDimensions, importConfig, isAdmin, isLoggedIn, keyAllows, loadConfig, localStorage, mergeForUpdate, mimeAllowed, parseId, populate, readCookie, resolveAdminModule, resolveConfig, rowFields, silentLogger, singularize, slugify, sniffMimeType, validateConfig, validateFields, verifyPassword };
|
package/dist/index.js
CHANGED
|
@@ -1838,6 +1838,9 @@ function validateContainer(container, path, collectionSlugs, add) {
|
|
|
1838
1838
|
} else {
|
|
1839
1839
|
const sidebar = admin.sidebar;
|
|
1840
1840
|
if (sidebar !== void 0) validateComponents(sidebar, `${path}.admin.sidebar`, add);
|
|
1841
|
+
const group = admin.group;
|
|
1842
|
+
if (group !== void 0 && group !== "settings")
|
|
1843
|
+
add(`${path}.admin.group`, `must be 'settings' (got ${JSON.stringify(group)})`);
|
|
1841
1844
|
}
|
|
1842
1845
|
}
|
|
1843
1846
|
const reserved = new Set(SYSTEM_FIELD_NAMES);
|
|
@@ -4130,6 +4133,7 @@ async function readAdminModule(cms, index) {
|
|
|
4130
4133
|
}
|
|
4131
4134
|
|
|
4132
4135
|
// src/rest/admin-schema.ts
|
|
4136
|
+
var SETTINGS = /* @__PURE__ */ new Set([USERS, API_KEYS]);
|
|
4133
4137
|
function componentRef(component) {
|
|
4134
4138
|
if (typeof component === "string") return { tag: component };
|
|
4135
4139
|
return component.props ? { tag: component.tag, props: JSON.parse(JSON.stringify(component.props)) } : { tag: component.tag };
|
|
@@ -4228,6 +4232,7 @@ async function collection(config, user, localized) {
|
|
|
4228
4232
|
if (config.useAsTitle) result.useAsTitle = config.useAsTitle;
|
|
4229
4233
|
if (config.icon) result.icon = config.icon;
|
|
4230
4234
|
if (config.admin?.sidebar?.length) result.sidebar = config.admin.sidebar.map(componentRef);
|
|
4235
|
+
if (config.admin?.group === "settings" || SETTINGS.has(config.slug)) result.group = "settings";
|
|
4231
4236
|
if (config.editIn === "drawer" && !result.drafts && !result.versions && !result.preview)
|
|
4232
4237
|
result.editIn = "drawer";
|
|
4233
4238
|
return result;
|