@based/schema 5.1.8 → 5.1.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,4 +1,4 @@
1
- import { ALIAS, BINARY, JSON, BOOLEAN, CARDINALITY, TIMESTAMP, INT16, INT32, INT8, UINT8, UINT16, UINT32, NUMBER, ENUM, ID, MICRO_BUFFER, REFERENCE, REFERENCES, STRING, TEXT, ALIASES, VECTOR, COLVEC, NULL, OBJECT, } from './types.js';
1
+ import { ALIAS, BINARY, JSON, BOOLEAN, CARDINALITY, TIMESTAMP, INT16, INT32, INT8, UINT8, UINT16, UINT32, NUMBER, ENUM, ID, MICRO_BUFFER, REFERENCE, REFERENCES, STRING, TEXT, ALIASES, VECTOR, COLVEC, NULL, OBJECT, CARDINALITY_RAW, } from './types.js';
2
2
  export const DEFAULT_MAP = {
3
3
  [NULL]: 0,
4
4
  [OBJECT]: 0,
@@ -25,5 +25,6 @@ export const DEFAULT_MAP = {
25
25
  [TEXT]: {},
26
26
  [VECTOR]: undefined, // maybe not can set a vec with 0
27
27
  [COLVEC]: undefined, // maybe not can set a vec with 0
28
+ [CARDINALITY_RAW]: undefined,
28
29
  };
29
30
  //# sourceMappingURL=defaultMap.js.map
@@ -23,7 +23,8 @@ export declare const VECTOR = 27;
23
23
  export declare const JSON = 28;
24
24
  export declare const OBJECT = 29;
25
25
  export declare const COLVEC = 30;
26
- export type TypeIndex = typeof NULL | typeof TIMESTAMP | typeof NUMBER | typeof CARDINALITY | typeof INT8 | typeof UINT8 | typeof INT16 | typeof UINT16 | typeof INT32 | typeof UINT32 | typeof BOOLEAN | typeof ENUM | typeof STRING | typeof TEXT | typeof REFERENCE | typeof REFERENCES | typeof MICRO_BUFFER | typeof ALIAS | typeof ALIASES | typeof BINARY | typeof ID | typeof VECTOR | typeof JSON | typeof OBJECT | typeof COLVEC;
26
+ export declare const CARDINALITY_RAW = 31;
27
+ export type TypeIndex = typeof NULL | typeof TIMESTAMP | typeof NUMBER | typeof CARDINALITY | typeof CARDINALITY_RAW | typeof INT8 | typeof UINT8 | typeof INT16 | typeof UINT16 | typeof INT32 | typeof UINT32 | typeof BOOLEAN | typeof ENUM | typeof STRING | typeof TEXT | typeof REFERENCE | typeof REFERENCES | typeof MICRO_BUFFER | typeof ALIAS | typeof ALIASES | typeof BINARY | typeof ID | typeof VECTOR | typeof JSON | typeof OBJECT | typeof COLVEC;
27
28
  export declare enum VectorBaseType {
28
29
  Int8 = 1,
29
30
  Uint8 = 2,
@@ -24,6 +24,7 @@ export const VECTOR = 27;
24
24
  export const JSON = 28;
25
25
  export const OBJECT = 29;
26
26
  export const COLVEC = 30;
27
+ export const CARDINALITY_RAW = 31;
27
28
  export var VectorBaseType;
28
29
  (function (VectorBaseType) {
29
30
  VectorBaseType[VectorBaseType["Int8"] = 1] = "Int8";
package/dist/def/types.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ALIAS, ALIASES, BINARY, BOOLEAN, CARDINALITY, COLVEC, ENUM, INT16, INT32, INT8, JSON, MICRO_BUFFER, NULL, NUMBER, OBJECT, REFERENCE, REFERENCES, STRING, TEXT, TIMESTAMP, UINT16, UINT32, UINT8, VECTOR, VectorBaseType, } from './typeIndexes.js';
1
+ import { ALIAS, ALIASES, BINARY, BOOLEAN, CARDINALITY, CARDINALITY_RAW, COLVEC, ENUM, INT16, INT32, INT8, JSON, MICRO_BUFFER, NULL, NUMBER, OBJECT, REFERENCE, REFERENCES, STRING, TEXT, TIMESTAMP, UINT16, UINT32, UINT8, VECTOR, VectorBaseType, } from './typeIndexes.js';
2
2
  export * from './typeIndexes.js';
3
3
  export const TYPE_INDEX_MAP = {
4
4
  alias: ALIAS,
@@ -22,6 +22,7 @@ export const TYPE_INDEX_MAP = {
22
22
  binary: BINARY,
23
23
  vector: VECTOR,
24
24
  cardinality: CARDINALITY,
25
+ cardinalityRAW: CARDINALITY_RAW,
25
26
  json: JSON,
26
27
  object: OBJECT,
27
28
  colvec: COLVEC,
@@ -65,6 +66,7 @@ export const SIZE_MAP = {
65
66
  json: 0,
66
67
  object: 0,
67
68
  colvec: 0, // separate
69
+ cardinalityRaw: 0, // separate
68
70
  };
69
71
  const reverseMap = {};
70
72
  for (const k in TYPE_INDEX_MAP) {
@@ -1,5 +1,5 @@
1
1
  import { convertToTimestamp } from '@based/utils';
2
- import { ALIAS, BINARY, JSON, BOOLEAN, CARDINALITY, TIMESTAMP, INT16, INT32, INT8, UINT8, UINT16, UINT32, NUMBER, ENUM, ID, MICRO_BUFFER, REFERENCE, REFERENCES, STRING, TEXT, ALIASES, VECTOR, COLVEC, NULL, OBJECT, TYPE_INDEX_MAP, } from './types.js';
2
+ import { ALIAS, BINARY, JSON, BOOLEAN, CARDINALITY, TIMESTAMP, INT16, INT32, INT8, UINT8, UINT16, UINT32, NUMBER, ENUM, ID, MICRO_BUFFER, REFERENCE, REFERENCES, STRING, TEXT, ALIASES, VECTOR, COLVEC, NULL, OBJECT, TYPE_INDEX_MAP, CARDINALITY_RAW, } from './types.js';
3
3
  import { MAX_ID, MIN_ID, } from '../types.js';
4
4
  import v from 'validator';
5
5
  import { getPropType } from '../parse/index.js';
@@ -103,6 +103,12 @@ export const VALIDATION_MAP = {
103
103
  return (typeof val === 'string' ||
104
104
  (val instanceof Uint8Array && val.byteLength === 8));
105
105
  },
106
+ [CARDINALITY_RAW]: (value) => {
107
+ if (value instanceof Uint8Array) {
108
+ return true;
109
+ }
110
+ return false;
111
+ },
106
112
  [TIMESTAMP]: (value, t) => {
107
113
  if (typeof value !== 'number' ||
108
114
  (t.step && value % t.step !== 0) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@based/schema",
3
- "version": "5.1.8",
3
+ "version": "5.1.10",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md",
@@ -31,7 +31,7 @@
31
31
  "typescript": "^5.6.3"
32
32
  },
33
33
  "dependencies": {
34
- "@based/utils": "1.2.4",
34
+ "@based/utils": "1.2.5",
35
35
  "picocolors": "^1.1.0",
36
36
  "validator": "^13.15.20"
37
37
  }