@based/db 0.0.51 → 0.0.52
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/lib/darwin_aarch64/libnode-v20.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v21.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v24.node +0 -0
- package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
- package/dist/lib/linux_aarch64/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libselva.so +0 -0
- package/dist/src/schema.js +8 -10
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/schema.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getPropType } from '@based/schema';
|
|
2
|
+
import { deepCopy } from '@saulx/utils';
|
|
2
3
|
const exclude = new Set(['id', 'lastId', 'hash']);
|
|
3
4
|
export const schemaLooseEqual = (a, b, key) => {
|
|
4
5
|
if (a === b) {
|
|
@@ -49,20 +50,17 @@ export const schemaLooseEqual = (a, b, key) => {
|
|
|
49
50
|
export const parseSchema = (strictSchema) => {
|
|
50
51
|
let parsedSchema = strictSchema;
|
|
51
52
|
if (strictSchema.props) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const props = { ...strictSchema.props };
|
|
57
|
-
for (const key in props) {
|
|
58
|
-
const prop = { ...props[key] };
|
|
53
|
+
// TODO do this more precise
|
|
54
|
+
parsedSchema = deepCopy(strictSchema);
|
|
55
|
+
for (const key in parsedSchema.props) {
|
|
56
|
+
const prop = parsedSchema.props[key];
|
|
59
57
|
const propType = getPropType(prop);
|
|
60
58
|
let refProp;
|
|
61
59
|
if (propType === 'reference') {
|
|
62
60
|
refProp = prop;
|
|
63
61
|
}
|
|
64
62
|
else if (propType === 'references') {
|
|
65
|
-
refProp =
|
|
63
|
+
refProp = prop.items;
|
|
66
64
|
prop.items = refProp;
|
|
67
65
|
}
|
|
68
66
|
if (refProp) {
|
|
@@ -82,12 +80,12 @@ export const parseSchema = (strictSchema) => {
|
|
|
82
80
|
};
|
|
83
81
|
refProp.prop = inverseKey;
|
|
84
82
|
}
|
|
85
|
-
props[key] = prop;
|
|
86
83
|
}
|
|
84
|
+
parsedSchema.types ??= {};
|
|
87
85
|
// @ts-ignore This creates an internal type to use for root props
|
|
88
86
|
parsedSchema.types._root = {
|
|
89
87
|
id: 1,
|
|
90
|
-
props,
|
|
88
|
+
props: parsedSchema.props,
|
|
91
89
|
};
|
|
92
90
|
delete parsedSchema.props;
|
|
93
91
|
}
|