@based/schema 5.1.1 → 5.1.3
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/README.md +1 -47
- package/dist/dbSchema.js +3 -3
- package/dist/def/typeDef.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Display & format WIP
|
|
4
4
|
|
|
5
|
-
Using `display` will not validate or transform and will purely change how the value is shown in UI and API.
|
|
6
|
-
|
|
7
5
|
Use `format` to specify in which format the value has to represented and modified. This may impose some validation and will influence how the UI shows the value.
|
|
8
6
|
|
|
9
7
|
### For example
|
|
@@ -15,16 +13,13 @@ Use `format` to specify in which format the value has to represented and modifie
|
|
|
15
13
|
props: {
|
|
16
14
|
price: {
|
|
17
15
|
type: 'int32',
|
|
18
|
-
display: 'euro',
|
|
19
16
|
},
|
|
20
17
|
authorEmail: {
|
|
21
18
|
type: 'string',
|
|
22
19
|
format: 'email',
|
|
23
|
-
display: 'lowercase',
|
|
24
20
|
},
|
|
25
21
|
lastModified: {
|
|
26
22
|
type: 'timestamp',
|
|
27
|
-
display: 'date-time'
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
25
|
}
|
|
@@ -32,47 +27,6 @@ Use `format` to specify in which format the value has to represented and modifie
|
|
|
32
27
|
}
|
|
33
28
|
```
|
|
34
29
|
|
|
35
|
-
### Display options
|
|
36
|
-
|
|
37
|
-
#### Timestamp
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
'date',
|
|
41
|
-
'date-time',
|
|
42
|
-
'date-time-text',
|
|
43
|
-
'human',
|
|
44
|
-
'time',
|
|
45
|
-
'time-precise',
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
#### Number
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
'short',
|
|
52
|
-
'human',
|
|
53
|
-
'ratio',
|
|
54
|
-
'bytes',
|
|
55
|
-
'euro',
|
|
56
|
-
'dollar',
|
|
57
|
-
'pound',
|
|
58
|
-
|
|
59
|
-
'round-short',
|
|
60
|
-
'round-human',
|
|
61
|
-
'round-ratio',
|
|
62
|
-
'round-bytes',
|
|
63
|
-
'round-euro',
|
|
64
|
-
'round-dollar',
|
|
65
|
-
'round-pound',
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
#### String
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
'lowercase',
|
|
72
|
-
'uppercase',
|
|
73
|
-
'capitalize',
|
|
74
|
-
```
|
|
75
|
-
|
|
76
30
|
### Format options
|
|
77
31
|
|
|
78
32
|
#### String
|
|
@@ -135,7 +89,7 @@ Use `format` to specify in which format the value has to represented and modifie
|
|
|
135
89
|
'mimeType',
|
|
136
90
|
'latLong',
|
|
137
91
|
'slug',
|
|
138
|
-
'
|
|
92
|
+
'password',
|
|
139
93
|
'taxID',
|
|
140
94
|
'licensePlate',
|
|
141
95
|
'VAT',
|
package/dist/dbSchema.js
CHANGED
|
@@ -6,7 +6,7 @@ function _makeEdgeTypes(newTypes, typeName, props, propPrefix) {
|
|
|
6
6
|
for (const propName in props) {
|
|
7
7
|
const prop = props[propName];
|
|
8
8
|
const propType = getPropType(prop);
|
|
9
|
-
const nextPropPrefix = propPrefix ? `${propPrefix}
|
|
9
|
+
const nextPropPrefix = propPrefix ? `${propPrefix}_${propName}` : propName;
|
|
10
10
|
if (propType === 'object') {
|
|
11
11
|
_makeEdgeTypes(newTypes, typeName, prop.props, nextPropPrefix);
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@ function _makeEdgeTypes(newTypes, typeName, props, propPrefix) {
|
|
|
16
16
|
.filter((k) => k[0] === '$')
|
|
17
17
|
.forEach((k) => (edgeProps[k] = prop[k]));
|
|
18
18
|
if (Object.keys(edgeProps).length > 0) {
|
|
19
|
-
putEdgeProps(`${typeName}
|
|
19
|
+
putEdgeProps(`${typeName}_${nextPropPrefix}`, `${prop.ref}_${prop.prop}`, edgeProps);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
else if (propType === 'references') {
|
|
@@ -25,7 +25,7 @@ function _makeEdgeTypes(newTypes, typeName, props, propPrefix) {
|
|
|
25
25
|
.filter((k) => k[0] === '$')
|
|
26
26
|
.forEach((k) => (edgeProps[k] = prop.items[k]));
|
|
27
27
|
if (Object.keys(edgeProps).length > 0) {
|
|
28
|
-
putEdgeProps(`${typeName}
|
|
28
|
+
putEdgeProps(`${typeName}_${nextPropPrefix}`, `${prop.items.ref}_${prop.items.prop}`, edgeProps);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
package/dist/def/typeDef.js
CHANGED
|
@@ -52,7 +52,7 @@ export const updateTypeDefs = (schema) => {
|
|
|
52
52
|
// Update edgeNodeTypeId
|
|
53
53
|
if (!prop.edgeNodeTypeId) {
|
|
54
54
|
if (prop.edges) {
|
|
55
|
-
const edgeTypeName = `_${[`${schema.type}
|
|
55
|
+
const edgeTypeName = `_${[`${schema.type}_${prop.path.join('_')}`, `${dstType.type}_${dstType.props[prop.inversePropName].path.join('_')}`].sort().join(':')}`;
|
|
56
56
|
const edgeType = schemaTypesParsed[edgeTypeName];
|
|
57
57
|
prop.edgeNodeTypeId = edgeType.id;
|
|
58
58
|
dstType.props[prop.inversePropName].edgeNodeTypeId = edgeType.id;
|