rimecms 0.28.8 → 0.28.10
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,6 +1,7 @@
|
|
|
1
1
|
import { RimeError } from '../errors/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import {} from '../../index.js';
|
|
3
3
|
import { createBlankDocument } from '../../util/doc.js';
|
|
4
|
+
import { FormFieldBuilder } from '../fields/builders/index.js';
|
|
4
5
|
import { PRIVATE_FIELDS } from './auth/constant.server.js';
|
|
5
6
|
import { isAuthConfig } from './auth/util.js';
|
|
6
7
|
import { create } from './operations/create.js';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { flatten } from 'flat';
|
|
2
2
|
import cache from '../../dev/cache/index.server.js';
|
|
3
|
+
/**
|
|
4
|
+
* We actually need to serialize config values that will trigger
|
|
5
|
+
* types, routes, or schema generations, meaning that for now
|
|
6
|
+
* a basic serialization approach is sufficient.
|
|
7
|
+
*/
|
|
3
8
|
const serializeValue = (value) => {
|
|
4
9
|
if (value === null)
|
|
5
10
|
return 'null';
|
|
@@ -13,8 +18,16 @@ const serializeValue = (value) => {
|
|
|
13
18
|
}
|
|
14
19
|
return `func:${value.toString()}`;
|
|
15
20
|
case 'object':
|
|
16
|
-
// Handle arrays and objects
|
|
17
21
|
try {
|
|
22
|
+
// Builder instances (fields, tabs, blocks, ...) may hold their real state behind
|
|
23
|
+
// private class fields (e.g. TabBuilder's #tab), invisible to Object.keys()/
|
|
24
|
+
// JSON.stringify() — flatten() then treats them as leaf objects with zero own keys,
|
|
25
|
+
// silently serializing as `{}` regardless of actual content. compile() is the same
|
|
26
|
+
// method already calls to get a plain, fully-resolved representation, so
|
|
27
|
+
// reuse it here instead of reflecting blindly.
|
|
28
|
+
if (typeof value.compile === 'function') {
|
|
29
|
+
return serializeValue(value.compile());
|
|
30
|
+
}
|
|
18
31
|
if (Array.isArray(value)) {
|
|
19
32
|
return `array:${JSON.stringify(value)}`;
|
|
20
33
|
}
|