rimecms 0.23.15 → 0.23.16
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/core/areas/config/augment-metas.d.ts +1 -1
- package/dist/core/areas/config/augment-metas.js +1 -1
- package/dist/core/areas/config/augment-title.d.ts +1 -1
- package/dist/core/areas/config/augment-url.d.ts +1 -1
- package/dist/core/areas/config/augment-url.js +1 -1
- package/dist/core/areas/config/augment-versions.d.ts +1 -1
- package/dist/core/areas/config/augment-versions.js +1 -1
- package/dist/core/areas/config/builder.js +1 -1
- package/dist/core/areas/config/builder.server.js +1 -0
- package/dist/core/collections/config/augment-auth.d.ts +1 -1
- package/dist/core/collections/config/augment-auth.js +1 -1
- package/dist/core/collections/config/augment-auth.server.js +2 -1
- package/dist/core/collections/config/augment-metas.d.ts +1 -1
- package/dist/core/collections/config/augment-metas.js +1 -1
- package/dist/core/collections/config/augment-nested.d.ts +7 -5
- package/dist/core/collections/config/augment-nested.js +1 -1
- package/dist/core/collections/config/augment-nested.server.d.ts +7 -5
- package/dist/core/collections/config/augment-nested.server.js +1 -1
- package/dist/core/collections/config/augment-thumbnail.d.ts +1 -1
- package/dist/core/collections/config/augment-title.d.ts +1 -1
- package/dist/core/collections/config/augment-upload.js +3 -2
- package/dist/core/collections/config/augment-upload.server.d.ts +1 -2
- package/dist/core/collections/config/augment-upload.server.js +2 -3
- package/dist/core/collections/config/augment-url.d.ts +1 -1
- package/dist/core/collections/config/augment-url.js +1 -1
- package/dist/core/collections/config/augment-versions.d.ts +1 -1
- package/dist/core/collections/config/augment-versions.js +1 -1
- package/dist/core/collections/config/builder.js +1 -1
- package/dist/core/collections/config/builder.server.js +1 -0
- package/dist/core/config/shared/find-thumbnail.d.ts +1 -1
- package/dist/core/config/shared/find-thumbnail.js +1 -1
- package/dist/core/config/shared/find-title.d.ts +1 -1
- package/dist/core/config/shared/find-title.js +1 -1
- package/dist/core/config/shared/get-staff-collection.d.ts +20 -6
- package/dist/core/config/shared/get-staff-collection.js +1 -1
- package/dist/core/config/shared/upload-directories.js +1 -0
- package/dist/core/config/shared/versions-alias.server.js +2 -0
- package/dist/core/config/types.d.ts +5 -2
- package/dist/fields/rich-text/core/features/link/index.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
5
5
|
* to an Area
|
|
6
6
|
*/
|
|
7
7
|
export const augmentMetas = (config) => {
|
|
8
|
-
const fields = [...config.fields];
|
|
8
|
+
const fields = [...(config.fields || [])];
|
|
9
9
|
fields.push(
|
|
10
10
|
//
|
|
11
11
|
text('editedBy').hidden(), date('createdAt').hidden(), date('updatedAt').hidden());
|
|
@@ -3,7 +3,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
3
3
|
* Add url field
|
|
4
4
|
*/
|
|
5
5
|
export const augmentUrl = (config) => {
|
|
6
|
-
let fields = [...config.fields];
|
|
6
|
+
let fields = [...(config.fields || [])];
|
|
7
7
|
if (config.$url) {
|
|
8
8
|
fields = [...fields, text('url').localized().hidden()];
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@ import type { VersionsConfig } from '../../config/types.js';
|
|
|
2
2
|
import type { Area } from '../../../types.js';
|
|
3
3
|
type Input = {
|
|
4
4
|
versions?: Area<any>['versions'];
|
|
5
|
-
fields
|
|
5
|
+
fields?: Area<any>['fields'];
|
|
6
6
|
};
|
|
7
7
|
type WithVersionsConfig<T> = Omit<T, 'versions'> & {
|
|
8
8
|
versions?: Required<VersionsConfig>;
|
|
@@ -4,7 +4,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
4
4
|
* Normalize versions prop and add status field if config.versions.drat is true
|
|
5
5
|
*/
|
|
6
6
|
export const augmentVersions = (config) => {
|
|
7
|
-
const fields = [...config.fields];
|
|
7
|
+
const fields = [...(config.fields || [])];
|
|
8
8
|
const { versions, ...rest } = config;
|
|
9
9
|
let normalizedVersions;
|
|
10
10
|
if (versions) {
|
|
@@ -17,7 +17,7 @@ export const create = (slug, incomingConfig) => {
|
|
|
17
17
|
kebab: toKebabCase(augmented.slug),
|
|
18
18
|
icon: augmented.icon || FileText,
|
|
19
19
|
label: augmented.label ? augmented.label : capitalize(area.slug),
|
|
20
|
-
fields: augmented.fields,
|
|
20
|
+
fields: augmented.fields || [],
|
|
21
21
|
asTitle: augmented.asTitle,
|
|
22
22
|
versions: augmented.versions,
|
|
23
23
|
live: incomingConfig.live || false,
|
|
@@ -2,7 +2,7 @@ import type { Collection, CollectionAuthConfig } from '../../config/types.js';
|
|
|
2
2
|
type Input = {
|
|
3
3
|
slug: string;
|
|
4
4
|
auth?: boolean | CollectionAuthConfig;
|
|
5
|
-
fields
|
|
5
|
+
fields?: Collection<any>['fields'];
|
|
6
6
|
};
|
|
7
7
|
export type WithNormalizedAuth<T> = Omit<T, 'auth'> & {
|
|
8
8
|
auth?: CollectionAuthConfig;
|
|
@@ -68,7 +68,7 @@ export const augmentAuth = (config) => {
|
|
|
68
68
|
// Add email field for non api key auth type.
|
|
69
69
|
...(!IS_API_AUTH ? [usersFields.email.clone()] : []),
|
|
70
70
|
rolesField,
|
|
71
|
-
...normalizedAuthConfig.fields,
|
|
71
|
+
...(normalizedAuthConfig.fields || []),
|
|
72
72
|
// Add apiKeyId for api key auth type.
|
|
73
73
|
...(IS_API_AUTH
|
|
74
74
|
? [
|
|
@@ -6,9 +6,10 @@ export const augmentAuthServer = (config) => {
|
|
|
6
6
|
/**
|
|
7
7
|
* For APIKeys auth collections,
|
|
8
8
|
* register the staff ownerId as a reference
|
|
9
|
+
* this way APIKeys are always correlated to a staff member
|
|
9
10
|
*/
|
|
10
11
|
function addSchemaStaffReferenceForAPIKeys() {
|
|
11
|
-
collection.fields.forEach((field) => {
|
|
12
|
+
(collection.fields || []).forEach((field) => {
|
|
12
13
|
if (field instanceof FormFieldBuilder && field.name === 'ownerId') {
|
|
13
14
|
field = field.$generateSchema(() => `ownerId: text('onwer_id').references(() => staff.id, {onDelete: 'cascade'})`);
|
|
14
15
|
}
|
|
@@ -4,7 +4,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
4
4
|
* Add updatedAt createdAt editedBy fields
|
|
5
5
|
*/
|
|
6
6
|
export const augmentMetas = (config) => {
|
|
7
|
-
const fields = [...config.fields];
|
|
7
|
+
const fields = [...(config.fields || [])];
|
|
8
8
|
fields.push(
|
|
9
9
|
//
|
|
10
10
|
text('editedBy').hidden(), date('createdAt').hidden(), date('updatedAt').hidden());
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Collection } from '../../../types.js';
|
|
2
|
+
type IncomingConfig = {
|
|
3
|
+
slug: string;
|
|
4
|
+
nested?: boolean;
|
|
5
|
+
fields?: Collection<any>['fields'];
|
|
6
|
+
};
|
|
2
7
|
/**
|
|
3
8
|
* Add root table fields _parent and _position
|
|
4
9
|
* for nested collection
|
|
5
10
|
*/
|
|
6
|
-
export declare const augmentNested: <T extends
|
|
7
|
-
|
|
8
|
-
nested?: boolean;
|
|
9
|
-
fields: Collection<any>["fields"];
|
|
10
|
-
}>(config: T) => T;
|
|
11
|
+
export declare const augmentNested: <T extends IncomingConfig>(config: T) => T;
|
|
12
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
5
5
|
* for nested collection
|
|
6
6
|
*/
|
|
7
7
|
export const augmentNested = (config) => {
|
|
8
|
-
const fields = [...config.fields];
|
|
8
|
+
const fields = [...(config.fields || [])];
|
|
9
9
|
if (config.nested) {
|
|
10
10
|
const _parentField = text('_parent').hidden()._root();
|
|
11
11
|
fields.push(_parentField);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Collection } from '../../../types.js';
|
|
2
|
+
type IncomingConfig = {
|
|
3
|
+
slug: string;
|
|
4
|
+
nested?: boolean;
|
|
5
|
+
fields?: Collection<any>['fields'];
|
|
6
|
+
};
|
|
2
7
|
/**
|
|
3
8
|
* Add root table fields _parent and _position
|
|
4
9
|
* for nested collection
|
|
5
10
|
*/
|
|
6
|
-
export declare const augmentNestedServer: <T extends
|
|
7
|
-
|
|
8
|
-
nested?: boolean;
|
|
9
|
-
fields: Collection<any>["fields"];
|
|
10
|
-
}>(config: T) => T;
|
|
11
|
+
export declare const augmentNestedServer: <T extends IncomingConfig>(config: T) => T;
|
|
12
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
5
5
|
* for nested collection
|
|
6
6
|
*/
|
|
7
7
|
export const augmentNestedServer = (config) => {
|
|
8
|
-
const fields = [...config.fields];
|
|
8
|
+
const fields = [...(config.fields || [])];
|
|
9
9
|
if (config.nested) {
|
|
10
10
|
const _parentField = text('_parent')
|
|
11
11
|
.$generateSchema(() => `_parent: text('_parent').references((): any => ${config.slug}.id, {onDelete: 'set null'})`)
|
|
@@ -3,7 +3,7 @@ import type { Collection } from '../../../types.js';
|
|
|
3
3
|
type Input = {
|
|
4
4
|
upload?: UploadConfig;
|
|
5
5
|
auth?: false | CollectionAuthConfig;
|
|
6
|
-
fields
|
|
6
|
+
fields?: Collection<any>['fields'];
|
|
7
7
|
};
|
|
8
8
|
type WithAsThumbnail<T> = T & {
|
|
9
9
|
asThumbnail: string | null;
|
|
@@ -27,10 +27,11 @@ export const augmentUpload = (config) => {
|
|
|
27
27
|
if (!normalizedUploadConfig.upload)
|
|
28
28
|
return normalizedUploadConfig;
|
|
29
29
|
const { upload } = normalizedUploadConfig;
|
|
30
|
-
let fields = [...config.fields];
|
|
30
|
+
let fields = [...(config.fields || [])];
|
|
31
31
|
if (upload) {
|
|
32
32
|
// Add panel thumbnail size if not already present
|
|
33
|
-
const isPanelThumbnailInSizes = upload.imageSizes &&
|
|
33
|
+
const isPanelThumbnailInSizes = upload.imageSizes &&
|
|
34
|
+
upload.imageSizes.some((size) => size.name === 'thumbnail');
|
|
34
35
|
if (!isPanelThumbnailInSizes) {
|
|
35
36
|
const thumbnailSize = { name: 'thumbnail', width: 400, compression: 60 };
|
|
36
37
|
upload.imageSizes = [thumbnailSize, ...(upload.imageSizes || [])];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Collection } from '../../config/types.js';
|
|
2
2
|
import { type WithNormalizedUpload } from './augment-upload.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* add corresponding fields with validation if config.upload.accept is defined
|
|
4
|
+
* Override _path field to add foreign key constraints
|
|
6
5
|
*/
|
|
7
6
|
export declare const augmentUploadServer: <T extends Collection<any>>(config: T) => WithNormalizedUpload<T>;
|
|
@@ -2,12 +2,11 @@ import { FormFieldBuilder } from '../../fields/builders/form-field-builder.js';
|
|
|
2
2
|
import { withDirectoriesSuffix } from '../../naming.js';
|
|
3
3
|
import { augmentUpload } from './augment-upload.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* add corresponding fields with validation if config.upload.accept is defined
|
|
5
|
+
* Override _path field to add foreign key constraints
|
|
7
6
|
*/
|
|
8
7
|
export const augmentUploadServer = (config) => {
|
|
9
8
|
const collection = augmentUpload(config);
|
|
10
|
-
collection.fields.forEach((field) => {
|
|
9
|
+
(collection.fields || []).forEach((field) => {
|
|
11
10
|
if (field instanceof FormFieldBuilder && field.name === '_path') {
|
|
12
11
|
field = field.$generateSchema(() => `_path: text('_path').references(() => ${withDirectoriesSuffix(config.slug)}.id, {onDelete: 'cascade', onUpdate: 'cascade'})`);
|
|
13
12
|
}
|
|
@@ -3,7 +3,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
3
3
|
* Add url field
|
|
4
4
|
*/
|
|
5
5
|
export const augmentUrl = (config) => {
|
|
6
|
-
let fields = [...config.fields];
|
|
6
|
+
let fields = [...(config.fields || [])];
|
|
7
7
|
if (config.$url) {
|
|
8
8
|
fields = [...fields, text('url').localized().hidden()];
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@ import type { VersionsConfig } from '../../config/types.js';
|
|
|
2
2
|
import type { Collection } from '../../../types.js';
|
|
3
3
|
type Input = {
|
|
4
4
|
versions?: Collection<any>['versions'];
|
|
5
|
-
fields
|
|
5
|
+
fields?: Collection<any>['fields'];
|
|
6
6
|
};
|
|
7
7
|
type WithVersionsConfig<T> = Omit<T, 'versions'> & {
|
|
8
8
|
versions?: Required<VersionsConfig>;
|
|
@@ -4,7 +4,7 @@ import { text } from '../../../fields/text/index.js';
|
|
|
4
4
|
* Normalize versions prop and add status field if config.versions.draft is true
|
|
5
5
|
*/
|
|
6
6
|
export const augmentVersions = (config) => {
|
|
7
|
-
const fields = [...config.fields];
|
|
7
|
+
const fields = [...(config.fields || [])];
|
|
8
8
|
const { versions, ...rest } = config;
|
|
9
9
|
let normalizedVersions;
|
|
10
10
|
if (versions) {
|
|
@@ -31,7 +31,7 @@ export const create = (slug, incomingConfig) => {
|
|
|
31
31
|
auth: augmented.auth,
|
|
32
32
|
nested: augmented.nested,
|
|
33
33
|
upload: augmented.upload,
|
|
34
|
-
fields: augmented.fields,
|
|
34
|
+
fields: augmented.fields || [],
|
|
35
35
|
asTitle: augmented.asTitle,
|
|
36
36
|
asThumbnail: augmented.asThumbnail,
|
|
37
37
|
versions: augmented.versions,
|
|
@@ -5,5 +5,5 @@ interface ThumbnailFieldResult {
|
|
|
5
5
|
field: FormFieldBuilder<FormField>;
|
|
6
6
|
path: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function findThumbnailField(fields
|
|
8
|
+
export declare function findThumbnailField(fields?: FieldBuilder<Field>[], basePath?: string): ThumbnailFieldResult | null;
|
|
9
9
|
export {};
|
|
@@ -2,7 +2,7 @@ import { FormFieldBuilder } from '../../fields/builders/form-field-builder.js';
|
|
|
2
2
|
import { isGroupField } from '../../../fields/group/index.js';
|
|
3
3
|
import { RelationFieldBuilder } from '../../../fields/relation';
|
|
4
4
|
import { TabsBuilder } from '../../../fields/tabs/index.js';
|
|
5
|
-
export function findThumbnailField(fields, basePath = '') {
|
|
5
|
+
export function findThumbnailField(fields = [], basePath = '') {
|
|
6
6
|
for (const field of fields) {
|
|
7
7
|
// Direct check for isThumbnail
|
|
8
8
|
if (field instanceof RelationFieldBuilder &&
|
|
@@ -10,5 +10,5 @@ interface TitleFieldResult {
|
|
|
10
10
|
field: FormFieldBuilder<FormField>;
|
|
11
11
|
path: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function findTitleField(fields
|
|
13
|
+
export declare function findTitleField(fields?: FieldBuilder<Field>[], basePath?: string): TitleFieldResult | null;
|
|
14
14
|
export {};
|
|
@@ -2,7 +2,7 @@ import { FormFieldBuilder } from '../../fields/builders/form-field-builder.js';
|
|
|
2
2
|
import { isGroupField } from '../../../fields/group/index.js';
|
|
3
3
|
import { TabsBuilder } from '../../../fields/tabs/index.js';
|
|
4
4
|
export const hasMaybeTitle = (field) => ['text', 'date', 'slug', 'email'].includes(field.type);
|
|
5
|
-
export function findTitleField(fields, basePath = '') {
|
|
5
|
+
export function findTitleField(fields = [], basePath = '') {
|
|
6
6
|
for (const field of fields) {
|
|
7
7
|
// Direct check for isTitle
|
|
8
8
|
if (field instanceof FormFieldBuilder &&
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import type { CollectionWithoutSlug } from '../../collections/config/types.js';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import type { Field } from '../../../types.js';
|
|
3
|
+
import type { Access, AdditionalStaffConfig } from '../types.js';
|
|
4
|
+
import type { FieldBuilder } from '../../fields/builders/field-builder.js';
|
|
5
|
+
export declare const staffCollection: {
|
|
6
|
+
label: {
|
|
7
|
+
singular: string;
|
|
8
|
+
plural: string;
|
|
9
|
+
};
|
|
10
|
+
panel: {
|
|
11
|
+
description: string;
|
|
12
|
+
group: string;
|
|
13
|
+
};
|
|
14
|
+
auth: {
|
|
15
|
+
type: string;
|
|
16
|
+
roles: string[];
|
|
17
|
+
};
|
|
18
|
+
icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
|
|
19
|
+
fields: FieldBuilder<Field>[];
|
|
20
|
+
access: Access;
|
|
8
21
|
};
|
|
22
|
+
export declare const getStaffCollection: ({ roles: incomingRoles, fields, access, panel, label }?: AdditionalStaffConfig) => CollectionWithoutSlug<"staff">;
|
|
@@ -20,7 +20,7 @@ export const staffCollection = {
|
|
|
20
20
|
update: (user, { id }) => access.isAdminOrMe(user, id)
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
export const getStaffCollection = ({ roles: incomingRoles = [], fields, access, panel, label } = {}) => {
|
|
23
|
+
export const getStaffCollection = ({ roles: incomingRoles = [], fields = [], access, panel, label } = {}) => {
|
|
24
24
|
const staffConfig = cloneDeep(staffCollection);
|
|
25
25
|
let roles = incomingRoles.map((role) => typeof role === 'string' ? { value: role } : role);
|
|
26
26
|
if (roles) {
|
|
@@ -24,6 +24,7 @@ export function makeVersionsCollectionsAliases(config) {
|
|
|
24
24
|
label: collection.label,
|
|
25
25
|
type: collection.type,
|
|
26
26
|
asTitle: collection.asTitle,
|
|
27
|
+
asThumbnail: collection.asThumbnail,
|
|
27
28
|
icon: collection.icon,
|
|
28
29
|
panel: false,
|
|
29
30
|
_generateTypes: false,
|
|
@@ -41,6 +42,7 @@ export function makeVersionsCollectionsAliases(config) {
|
|
|
41
42
|
versions: undefined,
|
|
42
43
|
access: area.access,
|
|
43
44
|
asTitle: area.asTitle,
|
|
45
|
+
asThumbnail: null,
|
|
44
46
|
$hooks: area.$hooks,
|
|
45
47
|
fields: area.fields,
|
|
46
48
|
type: 'collection',
|
|
@@ -177,7 +177,7 @@ export type PrototypePanelConfig = {
|
|
|
177
177
|
type PrototypeConfig<S extends string = string> = {
|
|
178
178
|
slug: S;
|
|
179
179
|
/** Document fields definition */
|
|
180
|
-
fields
|
|
180
|
+
fields?: FieldBuilder<Field>[];
|
|
181
181
|
/** Optional icon */
|
|
182
182
|
icon?: Component<IconProps>;
|
|
183
183
|
/** Enable document versions */
|
|
@@ -275,6 +275,8 @@ export type ImageSizesConfig = {
|
|
|
275
275
|
export type BuiltCollection = Omit<Collection<string>, 'icon' | 'versions' | 'upload' | 'auth'> & {
|
|
276
276
|
slug: CollectionSlug;
|
|
277
277
|
type: 'collection';
|
|
278
|
+
/** Make fields mandatory */
|
|
279
|
+
fields: FieldBuilder<Field>[];
|
|
278
280
|
/** The kebab-case version of the slug for urls */
|
|
279
281
|
kebab: string;
|
|
280
282
|
label: CollectionLabel;
|
|
@@ -293,12 +295,13 @@ export type BuiltAreaClient = Omit<BuiltArea, '$url' | '$hooks'>;
|
|
|
293
295
|
export type BuiltArea = Omit<Area<string>, 'versions'> & {
|
|
294
296
|
slug: AreaSlug;
|
|
295
297
|
type: 'area';
|
|
298
|
+
/** Make fields mandatory */
|
|
299
|
+
fields: FieldBuilder<Field>[];
|
|
296
300
|
/** The kebab-case version of the slug for urls */
|
|
297
301
|
kebab: string;
|
|
298
302
|
label: string;
|
|
299
303
|
asTitle: string;
|
|
300
304
|
versions?: Required<VersionsConfig>;
|
|
301
|
-
fields: FieldBuilder<Field>[];
|
|
302
305
|
icon: Component<IconProps>;
|
|
303
306
|
access: WithRequired<Access, 'create' | 'read' | 'update' | 'delete'>;
|
|
304
307
|
_generateTypes?: false;
|
|
@@ -5,9 +5,9 @@ import LinkSelector from './component/link-selector.svelte';
|
|
|
5
5
|
const linkExtension = import.meta.env.SSR
|
|
6
6
|
? undefined
|
|
7
7
|
: Link.extend({
|
|
8
|
+
// @ts-expect-error @tiptap error
|
|
8
9
|
addOptions() {
|
|
9
10
|
return {
|
|
10
|
-
// @ts-expect-error @tiptap error
|
|
11
11
|
...this.parent?.(),
|
|
12
12
|
types: []
|
|
13
13
|
};
|