@based/schema 5.0.0-alpha.12 → 5.0.0-alpha.13
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/def/selvaBuffer.js +7 -3
- package/dist/def/types.d.ts +11 -0
- package/dist/def/types.js +13 -0
- package/package.json +2 -2
package/dist/def/selvaBuffer.js
CHANGED
|
@@ -14,6 +14,7 @@ selvaTypeMap[WEAK_REFERENCES] = 7;
|
|
|
14
14
|
selvaTypeMap[ALIAS] = 8;
|
|
15
15
|
selvaTypeMap[ALIASES] = 9;
|
|
16
16
|
const EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT = 0x01;
|
|
17
|
+
const EDGE_FIELD_CONSTRAINT_FLAG_SKIP_DUMP = 0x80;
|
|
17
18
|
function blockCapacity(blockCapacity) {
|
|
18
19
|
const buf = new Uint8Array(Uint32Array.BYTES_PER_ELEMENT);
|
|
19
20
|
const view = new DataView(buf.buffer);
|
|
@@ -23,8 +24,11 @@ function blockCapacity(blockCapacity) {
|
|
|
23
24
|
function sepPropCount(props) {
|
|
24
25
|
return props.filter((prop) => prop.separate).length;
|
|
25
26
|
}
|
|
26
|
-
function makeEdgeConstraintFlags(prop) {
|
|
27
|
-
return prop.dependent ? EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT : 0x00
|
|
27
|
+
function makeEdgeConstraintFlags(prop, inverseProp) {
|
|
28
|
+
return ((prop.dependent ? EDGE_FIELD_CONSTRAINT_FLAG_DEPENDENT : 0x00) |
|
|
29
|
+
(prop.typeIndex === REFERENCE && inverseProp && inverseProp.typeIndex === REFERENCES
|
|
30
|
+
? EDGE_FIELD_CONSTRAINT_FLAG_SKIP_DUMP
|
|
31
|
+
: 0x00));
|
|
28
32
|
}
|
|
29
33
|
const propDefBuffer = (schema, prop, isEdge) => {
|
|
30
34
|
const type = prop.typeIndex;
|
|
@@ -43,7 +47,7 @@ const propDefBuffer = (schema, prop, isEdge) => {
|
|
|
43
47
|
let eschema = [];
|
|
44
48
|
// @ts-ignore
|
|
45
49
|
buf[0] = selvaType + 2 * !!isEdge; // field type
|
|
46
|
-
buf[1] = makeEdgeConstraintFlags(prop); // flags
|
|
50
|
+
buf[1] = makeEdgeConstraintFlags(prop, dstType.props[prop.inversePropName]); // flags
|
|
47
51
|
view.setUint16(2, dstType.id, true); // dst_node_type
|
|
48
52
|
view.setUint32(5, 0, true); // schema_len
|
|
49
53
|
if (!isEdge) {
|
package/dist/def/types.d.ts
CHANGED
|
@@ -51,6 +51,17 @@ export declare const TYPE_INDEX_MAP: {
|
|
|
51
51
|
json: number;
|
|
52
52
|
object: number;
|
|
53
53
|
};
|
|
54
|
+
export declare const enum numberTypes {
|
|
55
|
+
number = 4,
|
|
56
|
+
uint16 = 22,
|
|
57
|
+
uint32 = 7,
|
|
58
|
+
int16 = 21,
|
|
59
|
+
int32 = 23,
|
|
60
|
+
uint8 = 6,
|
|
61
|
+
int8 = 20,
|
|
62
|
+
cardinality = 5
|
|
63
|
+
}
|
|
64
|
+
export declare function isNumberType(type: TypeIndex): boolean;
|
|
54
65
|
export type InternalSchemaProp = keyof typeof TYPE_INDEX_MAP;
|
|
55
66
|
export type TypeIndex = (typeof TYPE_INDEX_MAP)[InternalSchemaProp];
|
|
56
67
|
export type PropDef = {
|
package/dist/def/types.js
CHANGED
|
@@ -50,6 +50,19 @@ export const TYPE_INDEX_MAP = {
|
|
|
50
50
|
json: JSON,
|
|
51
51
|
object: OBJECT,
|
|
52
52
|
};
|
|
53
|
+
const numberTypeValues = [
|
|
54
|
+
NUMBER,
|
|
55
|
+
UINT16,
|
|
56
|
+
UINT32,
|
|
57
|
+
INT16,
|
|
58
|
+
INT32,
|
|
59
|
+
UINT8,
|
|
60
|
+
INT8,
|
|
61
|
+
CARDINALITY,
|
|
62
|
+
];
|
|
63
|
+
export function isNumberType(type) {
|
|
64
|
+
return numberTypeValues.includes(type);
|
|
65
|
+
}
|
|
53
66
|
export const SIZE_MAP = {
|
|
54
67
|
timestamp: 8, // 64bit
|
|
55
68
|
// double-precision 64-bit binary format IEEE 754 value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@based/schema",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"fflate": "0.8.1",
|
|
33
|
-
"@saulx/utils": "^6.
|
|
33
|
+
"@saulx/utils": "^6.6.0",
|
|
34
34
|
"picocolors": "^1.1.0"
|
|
35
35
|
}
|
|
36
36
|
}
|