rimecms 0.25.2 → 0.25.4
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from '../../logger/index.server.js';
|
|
1
2
|
export const find = async (args) => {
|
|
2
3
|
//
|
|
3
4
|
const { config, event, locale, sort, limit, offset, depth, query, draft, select = [], isSystemOperation } = args;
|
|
@@ -45,18 +46,25 @@ export const find = async (args) => {
|
|
|
45
46
|
withBlank: !hasSelect
|
|
46
47
|
});
|
|
47
48
|
for (const hook of config.$hooks?.beforeRead || []) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
try {
|
|
50
|
+
const result = await hook({
|
|
51
|
+
doc: document,
|
|
52
|
+
config,
|
|
53
|
+
operation: 'read',
|
|
54
|
+
event,
|
|
55
|
+
context
|
|
56
|
+
});
|
|
57
|
+
context = result.context;
|
|
58
|
+
document = result.doc;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
// If a beforeRead hook throws an error, we skip processing this document and continue with the next one
|
|
62
|
+
logger.error(error.message, error);
|
|
63
|
+
return null; // Indicate that this document should be filtered out
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
66
|
return document;
|
|
59
67
|
}
|
|
60
68
|
const documents = await Promise.all(documentsRaw.map((doc) => processDocument(doc)));
|
|
61
|
-
return documents;
|
|
69
|
+
return documents.filter((d) => !!d);
|
|
62
70
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CollectionWithoutSlug } from '../../collections/config/types.js';
|
|
2
|
+
import type { FieldBuilder } from '../../fields/builders/field-builder.js';
|
|
2
3
|
import type { Field } from '../../../types.js';
|
|
3
4
|
import type { Access, AdditionalStaffConfig } from '../types.js';
|
|
4
|
-
import type { FieldBuilder } from '../../fields/builders/field-builder.js';
|
|
5
5
|
export declare const staffCollection: {
|
|
6
6
|
label: {
|
|
7
7
|
singular: string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FieldBuilder } from '../../core/fields/builders/field-builder.js';
|
|
2
|
-
import type { GenericDoc } from '../../core/types/doc.js';
|
|
3
2
|
import type { Field, FieldAccess } from '../types.js';
|
|
4
3
|
import type { DocumentFormContext } from '../../panel/context/documentForm.svelte.js';
|
|
4
|
+
import type { GenericDoc } from '../../types.js';
|
|
5
|
+
import type { WithOptional } from '../../util/types.js';
|
|
5
6
|
import type { Component } from 'svelte';
|
|
6
7
|
type TypedComponent = Component<{
|
|
7
8
|
path: string;
|
|
8
9
|
config: ComponentField;
|
|
9
|
-
form: DocumentFormContext<GenericDoc
|
|
10
|
+
form: DocumentFormContext<WithOptional<GenericDoc, 'id'>>;
|
|
10
11
|
}>;
|
|
11
12
|
export declare const component: (component: TypedComponent) => ComponentFieldBuilder;
|
|
12
13
|
export declare class ComponentFieldBuilder extends FieldBuilder<ComponentField> {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
{#each authorizedFields as field, index (index)}
|
|
41
41
|
{#if !form.isLive || (form.isLive && isLiveField(field.raw))}
|
|
42
42
|
{#if field instanceof ComponentFieldBuilder}
|
|
43
|
-
{@const FieldComponent = field.component}
|
|
43
|
+
{@const FieldComponent = field.raw.component}
|
|
44
44
|
<div data-type={field.type} class="rz-render-fields__field rz-render-fields__field--full">
|
|
45
|
-
<FieldComponent {path} config={field} {form} />
|
|
45
|
+
<FieldComponent {path} config={field.raw} {form} />
|
|
46
46
|
</div>
|
|
47
47
|
{:else if isPresentative(field.raw)}
|
|
48
48
|
{@const Separator = field.component}
|