url-safe-bitpacking 0.1.15 → 0.2.1
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 +6 -6
- package/dist/enums/dataTypes.d.ts +4 -9
- package/dist/factory/arrayFactory.d.ts +2 -0
- package/dist/factory/enumArrayFactory.d.ts +2 -2
- package/dist/factory/enumFactory.d.ts +2 -1
- package/dist/factory/enumOptionsFactory.d.ts +2 -0
- package/dist/factory/factory.d.ts +13 -7
- package/dist/factory/optionalFactory.d.ts +2 -0
- package/dist/factory/utils.d.ts +19 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +465 -352
- package/dist/parsers/arrayParser.d.ts +4 -0
- package/dist/parsers/enumOptionsFactory.d.ts +4 -0
- package/dist/parsers/optionalParser.d.ts +4 -0
- package/dist/parsers/parsers.d.ts +16 -12
- package/dist/stateHandling/index.d.ts +1 -0
- package/dist/stateHandling/stateData.d.ts +3 -0
- package/dist/stateHandling/stateDataObject.d.ts +15 -0
- package/dist/typeFactory/stateDataTyping.d.ts +1 -9
- package/dist/types/arrayData.d.ts +10 -0
- package/dist/types/booleanData.d.ts +1 -2
- package/dist/types/dataEntry.d.ts +12 -5
- package/dist/types/enumArrayData.d.ts +3 -3
- package/dist/types/enumData.d.ts +4 -2
- package/dist/types/enumOptionsData.d.ts +8 -0
- package/dist/types/floatData.d.ts +1 -2
- package/dist/types/index.d.ts +7 -5
- package/dist/types/intData.d.ts +1 -2
- package/dist/types/optionalData.d.ts +7 -0
- package/dist/types/stateDataEntry.d.ts +16 -0
- package/dist/types/versionData.d.ts +1 -2
- package/dist/update/arrayUpdate.d.ts +2 -0
- package/dist/update/enumOptionsUpdate.d.ts +2 -0
- package/dist/update/nestedDataMatching.d.ts +2 -0
- package/dist/update/optionalUpdate.d.ts +2 -0
- package/dist/update/updateValues.d.ts +8 -1
- package/package.json +1 -1
- package/dist/objectmap/index.d.ts +0 -4
- package/dist/objectmap/stateDataModel.d.ts +0 -33
- package/dist/objectmap/stateValueHelperMethods.d.ts +0 -13
- package/dist/objectmap/userMethods.d.ts +0 -12
- package/dist/types/arrayDefinitions.d.ts +0 -58
- package/dist/types/semanticMapping.d.ts +0 -6
- package/dist/types/stateValueModel.d.ts +0 -33
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ArrayDataEntry } from '@/types';
|
|
2
|
+
export declare const rawParser: (bitString: string, arrayData: ArrayDataEntry) => [ArrayDataEntry, string];
|
|
3
|
+
export declare const rawStateStringifier: (arrayData: ArrayDataEntry) => string;
|
|
4
|
+
export declare const rawStringifier: (arrayData: ArrayDataEntry) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EnumOptionsDataEntry } from '@/types';
|
|
2
|
+
export declare const rawParser: (bitString: string, enumOptionsData: EnumOptionsDataEntry) => [EnumOptionsDataEntry, string];
|
|
3
|
+
export declare const rawStateStringifier: (enumOptionsData: EnumOptionsDataEntry) => string;
|
|
4
|
+
export declare const rawStringifier: (enumOptionsData: EnumOptionsDataEntry) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OptionalDataEntry } from '@/types';
|
|
2
|
+
export declare const rawParser: (bitString: string, optionalData: OptionalDataEntry) => [OptionalDataEntry, string];
|
|
3
|
+
export declare const rawStateStringifier: (optionalData: OptionalDataEntry) => string;
|
|
4
|
+
export declare const rawStringifier: (optionalData: OptionalDataEntry) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataEntry, ComplexDataEntry, NestedData } from '../types/dataEntry';
|
|
2
2
|
/**
|
|
3
3
|
* Method that parses a bitstring into a value
|
|
4
4
|
* @param bitString - `string` of 0 | 1
|
|
@@ -28,13 +28,23 @@ export declare const getBitsCount: (mapData: DataEntry, bitString: string) => nu
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const dataEntryBitstringParser: (bitstring: string, dataEntry: DataEntry) => [DataEntry, string];
|
|
30
30
|
/**
|
|
31
|
-
* Method
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @returns
|
|
31
|
+
* Method that parses a bitstring for a given nested data descriptor
|
|
32
|
+
* @param bitstring - `string` of 0 | 1
|
|
33
|
+
* @param descriptor - `NestedData` that represents the framework applicable to the bitstring
|
|
34
|
+
* @returns `[NestedData, string]` that represents the actual data and the remaining bitstring
|
|
35
35
|
*/
|
|
36
|
-
export declare const
|
|
36
|
+
export declare const nestedDataBitstringParser: (bitstring: string, descriptor: NestedData) => [NestedData, string];
|
|
37
|
+
/**
|
|
38
|
+
* Method that parses a bitstring into its data for complex data entries
|
|
39
|
+
* @param bitstring - `string` of 0 | 1
|
|
40
|
+
* @param complexDataEntry - `DataEntry` that represents the data entry to parse
|
|
41
|
+
* @returns `[DataEntry, string]` that represents the data entry and the remaining bitstring
|
|
42
|
+
*/
|
|
43
|
+
export declare const complexDataEntryBitstringParser: <T extends ComplexDataEntry>(bitstring: string, complexDataEntry: T) => [T, string];
|
|
37
44
|
export declare const dataBitsStringifier: (data: DataEntry) => string;
|
|
45
|
+
export declare const complexDataStringifier: <T extends ComplexDataEntry>(complexDataEntry: T) => string;
|
|
46
|
+
export declare const complexDataStateStringifier: <T extends ComplexDataEntry>(complexDataEntry: T) => string;
|
|
47
|
+
export declare const nestedDataStringifier: (nestedData: NestedData) => string;
|
|
38
48
|
export declare const dataEntryCorrecting: (dataEntry: DataEntry) => DataEntry;
|
|
39
49
|
export declare const base64url = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
40
50
|
/**
|
|
@@ -78,9 +88,3 @@ export declare const parseBitsToBase64: (bits: string) => string;
|
|
|
78
88
|
* @returns `string` of 0 | 1
|
|
79
89
|
*/
|
|
80
90
|
export declare const parseBase64ToBits: (base64: string) => string;
|
|
81
|
-
/**
|
|
82
|
-
* Method to convert an array of data entries into a base64 string
|
|
83
|
-
* @param dataArray Data Entries to read to parse into bits and then a base64 string
|
|
84
|
-
* @returns bitstring representation of the data entries
|
|
85
|
-
*/
|
|
86
|
-
export declare const dataArrayStringifier: (dataEntryArray: DataEntryArray) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stateDataObject';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StateDescriptor, StateObject } from '@/types/stateDataEntry';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a state object from a state descriptor and updates the state object when the state changes.
|
|
4
|
+
* @param initialState - the initial state descriptor
|
|
5
|
+
* @param updateCallback - the callback that gets triggered when the state gets updated
|
|
6
|
+
* @returns the state object
|
|
7
|
+
*/
|
|
8
|
+
export declare const createStateDataObject: (initialState: StateDescriptor, updateCallback: (currentState: StateObject) => StateObject) => StateObject;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a state descriptor from a base64 string and a state descriptor
|
|
11
|
+
* @param base64 - the base64 string
|
|
12
|
+
* @param descriptor - the state descriptor
|
|
13
|
+
* @returns the state descriptor
|
|
14
|
+
*/
|
|
15
|
+
export declare const getInitialStateFromBase64: (base64: string, descriptor: StateDescriptor) => StateDescriptor;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const getVersionContentTypeFile: (versionContent: VersionContentDefinition) => string;
|
|
3
|
-
export declare const getStateDataTypeForSingleLevelContentTypeArray: (slcta: SingleLevelContentType[]) => string;
|
|
4
|
-
export declare const getStateDataTypeForSingleLevelContentType: (slct: SingleLevelContentType) => string;
|
|
5
|
-
export declare const getStateDataTypeNestedContentType: (ncdt: NestedContentType, attributeName: string) => string;
|
|
6
|
-
export declare const getStateDataTypeForDoubleLevelContentType: (dncdt: DoubleLevelContentType, attributeName: string) => string;
|
|
7
|
-
export declare const getStateDataTypeForOptionalEntryDataType: (oedt: OptionalEntryDataType, attributeName: string) => string;
|
|
8
|
-
export declare const getStateDataTypeForEnumEntryDataType: (eedt: EnumEntryDataType, attributeName: string) => string;
|
|
9
|
-
export declare const getStateDataTypeForArrayEntryDataType: (aedt: ArrayEntryDataType, attributeName: string) => string;
|
|
1
|
+
export {};
|
|
@@ -4,13 +4,16 @@ import { FloatData } from './floatData';
|
|
|
4
4
|
import { IntData } from './intData';
|
|
5
5
|
import { VersionData } from './versionData';
|
|
6
6
|
import { EnumArrayData } from './enumArrayData.ts';
|
|
7
|
+
import { OptionalData } from './optionalData.ts';
|
|
8
|
+
import { EnumOptionsData } from './enumOptionsData.ts';
|
|
9
|
+
import { ArrayData } from './arrayData.ts';
|
|
7
10
|
export type Prettify<T> = {
|
|
8
11
|
[K in keyof T]: T[K];
|
|
9
12
|
};
|
|
10
13
|
type DataDescription = {
|
|
11
14
|
name: string;
|
|
12
|
-
internalName?:
|
|
13
|
-
index
|
|
15
|
+
internalName?: number[];
|
|
16
|
+
index?: number;
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
16
19
|
* Boolean object
|
|
@@ -67,7 +70,11 @@ export type VersionDataEntry = Prettify<VersionData & DataDescription>;
|
|
|
67
70
|
*/
|
|
68
71
|
export type EnumArrayDataEntry = Prettify<EnumArrayData & DataDescription>;
|
|
69
72
|
export type DataEntry = BooleanDataEntry | IntDataEntry | EnumDataEntry | FloatDataEntry | VersionDataEntry | EnumArrayDataEntry;
|
|
70
|
-
export type
|
|
71
|
-
export
|
|
72
|
-
export type
|
|
73
|
+
export type OptionalDataEntry = Prettify<OptionalData & DataDescription>;
|
|
74
|
+
export type EnumOptionsDataEntry = Prettify<EnumOptionsData & DataDescription>;
|
|
75
|
+
export type ArrayDataEntry = Prettify<ArrayData & DataDescription>;
|
|
76
|
+
export type ComplexDataEntry = OptionalDataEntry | EnumOptionsDataEntry | ArrayDataEntry;
|
|
77
|
+
export type NestedData = (DataEntry | ComplexDataEntry)[];
|
|
78
|
+
export type ProtectedAttributeNames = Prettify<keyof BooleanDataEntry | keyof IntDataEntry | keyof EnumDataEntry | keyof FloatDataEntry | keyof VersionDataEntry | keyof EnumArrayDataEntry | keyof OptionalDataEntry | keyof EnumOptionsDataEntry | keyof ArrayDataEntry>;
|
|
79
|
+
export declare const PROTECTED_ATTRIBUTE_NAMES: readonly ["type", "value", "name", "internalName", "index", "min", "max", "bits", "precision", "significand", "minCount", "maxCount", "state", "stateBits", "descriptor", "mapping"];
|
|
73
80
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumMappingType } from './enumData';
|
|
2
2
|
/**
|
|
3
3
|
* Enum Array object
|
|
4
4
|
*
|
|
@@ -12,10 +12,10 @@ import { DataType } from '../enums/dataTypes';
|
|
|
12
12
|
* Note: the partical maximum benefit of using this versus using a `ArrayEntryDataType` with only enums is only about 22% for base_5
|
|
13
13
|
*/
|
|
14
14
|
export type EnumArrayData = {
|
|
15
|
-
type:
|
|
15
|
+
type: 'ENUM_ARRAY';
|
|
16
16
|
minCount: number;
|
|
17
17
|
maxCount: number;
|
|
18
18
|
value: number[];
|
|
19
|
-
min: number;
|
|
20
19
|
max: number;
|
|
20
|
+
mapping: EnumMappingType;
|
|
21
21
|
};
|
package/dist/types/enumData.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DataType } from '../enums/dataTypes';
|
|
2
1
|
export declare const EnumMaxBits = 8;
|
|
2
|
+
export type EnumMappingType = (string | number | object)[];
|
|
3
|
+
export type EnumOptionsType = string | number | EnumMappingType;
|
|
3
4
|
/**
|
|
4
5
|
* Enum object
|
|
5
6
|
*
|
|
@@ -7,8 +8,9 @@ export declare const EnumMaxBits = 8;
|
|
|
7
8
|
* The maximum acceptable value for the max is `255` (8 bits)
|
|
8
9
|
*/
|
|
9
10
|
export type EnumData = {
|
|
10
|
-
type:
|
|
11
|
+
type: 'ENUM';
|
|
11
12
|
value: number;
|
|
12
13
|
max: number;
|
|
13
14
|
bits: number;
|
|
15
|
+
mapping: EnumMappingType;
|
|
14
16
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataType } from '../enums/dataTypes';
|
|
2
1
|
export type PrecisionRangeType = -3 | -2 | -1 | 0 | 1 | 2 | 3;
|
|
3
2
|
export declare const SignificandMaxBits = 20;
|
|
4
3
|
/**
|
|
@@ -11,7 +10,7 @@ export declare const SignificandMaxBits = 20;
|
|
|
11
10
|
* Maximum value for the significand is `20` bits, which allows for a maximum of 1048576 possible values.
|
|
12
11
|
*/
|
|
13
12
|
export type FloatData = {
|
|
14
|
-
type:
|
|
13
|
+
type: 'FLOAT';
|
|
15
14
|
value: number;
|
|
16
15
|
min: number;
|
|
17
16
|
max: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
1
|
+
export * from './stateDataEntry';
|
|
2
|
+
export * from './enumOptionsData';
|
|
3
|
+
export * from './optionalData';
|
|
4
|
+
export * from './arrayData';
|
|
5
|
+
export * from './enumArrayData';
|
|
4
6
|
export * from './enumData';
|
|
5
7
|
export * from './floatData';
|
|
6
8
|
export * from './intData';
|
|
7
|
-
export * from './semanticMapping';
|
|
8
|
-
export * from './stateValueModel';
|
|
9
9
|
export * from './versionData';
|
|
10
|
+
export * from './booleanData';
|
|
11
|
+
export * from './dataEntry';
|
package/dist/types/intData.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DataType } from '../enums/dataTypes';
|
|
2
1
|
export declare const IntegerMaxBits = 12;
|
|
3
2
|
/**
|
|
4
3
|
* Int object
|
|
@@ -8,7 +7,7 @@ export declare const IntegerMaxBits = 12;
|
|
|
8
7
|
* the maximum acceptable delta between min and max is `4095` (12 bits).
|
|
9
8
|
*/
|
|
10
9
|
export type IntData = {
|
|
11
|
-
type:
|
|
10
|
+
type: 'INT';
|
|
12
11
|
value: number;
|
|
13
12
|
min: number;
|
|
14
13
|
max: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComplexDataEntry, DataEntry, NestedData, VersionDataEntry } from './dataEntry';
|
|
2
|
+
export type StateDataEntry<T extends DataEntry | ComplexDataEntry> = T & {
|
|
3
|
+
bitstring: string;
|
|
4
|
+
updateValue: (newEntry: T) => void;
|
|
5
|
+
};
|
|
6
|
+
export type State = [StateDataEntry<VersionDataEntry>, ...StateDataEntry<DataEntry | ComplexDataEntry>[]];
|
|
7
|
+
export type StateDescriptor = [VersionDataEntry, ...NestedData];
|
|
8
|
+
export type StateDataObject = {
|
|
9
|
+
[key: string]: object | string | boolean | number | (string | number | object)[] | null | StateDataObject | StateDataObject[];
|
|
10
|
+
};
|
|
11
|
+
export type StateObject = {
|
|
12
|
+
state: State;
|
|
13
|
+
bitstring: string;
|
|
14
|
+
base64: string;
|
|
15
|
+
data: StateDataObject;
|
|
16
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { DataType } from '../enums/dataTypes';
|
|
2
1
|
export type VersionRangeType = 4 | 6 | 8 | 10;
|
|
3
2
|
export declare const VersionRange: VersionRangeType[];
|
|
4
3
|
export type VersionData = {
|
|
5
|
-
type:
|
|
4
|
+
type: 'VERSION';
|
|
6
5
|
value: number;
|
|
7
6
|
bits: VersionRangeType;
|
|
8
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataEntry } from '../types/dataEntry';
|
|
1
|
+
import { DataEntry, ComplexDataEntry } from '../types/dataEntry';
|
|
2
2
|
/**
|
|
3
3
|
* Method to update the value of a data entry
|
|
4
4
|
* @param original - the original data entry
|
|
@@ -6,3 +6,10 @@ import { DataEntry } from '../types/dataEntry';
|
|
|
6
6
|
* @returns the updated data entry
|
|
7
7
|
*/
|
|
8
8
|
export declare const updateValue: (original: DataEntry, update: DataEntry) => DataEntry;
|
|
9
|
+
/**
|
|
10
|
+
* Method to update the value of a data entry
|
|
11
|
+
* @param original - the original data entry
|
|
12
|
+
* @param update - the update data entry
|
|
13
|
+
* @returns the updated data entry
|
|
14
|
+
*/
|
|
15
|
+
export declare const updateComplexValue: (original: ComplexDataEntry, update: ComplexDataEntry) => ComplexDataEntry;
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { DataEntry, DataEntryArray, NestedContentType, SingleLevelContentType, DoubleLevelContentType, ArrayEntryDataType, EnumEntryDataType, OptionalEntryDataType, DataEntryParsingReturnType, DerivativeStateDataType, InternalStateDataGenerationMethod, StateDataGenerationMethod, StateDataType } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Helper method for finding an existing data entry in case there was a previous object
|
|
4
|
-
* @param dataEntry - new DataEntry
|
|
5
|
-
* @param dataEntryArray - existing DataEntryArray
|
|
6
|
-
*/
|
|
7
|
-
export declare const findExistingDataEntry: (dataEntry: DataEntry, dataEntryArray: DataEntryArray) => DataEntry | undefined;
|
|
8
|
-
export declare const readDataEntry: (dataEntry: DataEntry, bitString: string) => DataEntryParsingReturnType;
|
|
9
|
-
export declare const updateDataEntry: (dataEntry: DataEntry, existingData: DataEntryArray) => DataEntryParsingReturnType;
|
|
10
|
-
/**
|
|
11
|
-
* Method that extracts the data for a data entry from the given data
|
|
12
|
-
* @param dataEntry - `DataEntry` object that represents the data entry to extract the data for
|
|
13
|
-
* @param prefix - `string` that represents the prefix of the data internam name of the `DataEntry` object
|
|
14
|
-
* @param additionalData - `DataEntryArray` or `string` that represents the additional data to extract the data from, if not provided, the default value will be returned
|
|
15
|
-
* @returns `[DataEntryArray | string | undefined, [string, DataEntry]]` tuple that represents the updated additional data and the extracted data entry
|
|
16
|
-
*/
|
|
17
|
-
export declare const internalGetDataEntry: (dataEntry: DataEntry, prefix: string, additionalData?: DataEntryArray | string) => [DataEntryArray | string | undefined, [string, DataEntry]];
|
|
18
|
-
export declare const getStateFromOptionalEntryDataType: (oedt: OptionalEntryDataType, prefix: string, attributeName: string) => InternalStateDataGenerationMethod;
|
|
19
|
-
export declare const getStateFromEnumEntryDataType: (eedt: EnumEntryDataType, prefix: string, attributeName: string) => (additionalData?: DataEntryArray | string) => [DataEntryArray | string | undefined, [string, StateDataType]];
|
|
20
|
-
/**
|
|
21
|
-
* Helper method to get the method to parse, initiliaze, or update the state data for an array entry data type
|
|
22
|
-
* @param aedt - `ArrayEntryDataType` object that represents the array entry data type
|
|
23
|
-
* @param prefix - `string` that represents the prefix of the data internam name of the `DataEntry` object
|
|
24
|
-
* @param attributeName - `string` that represents the name of the attribute to extract the data from
|
|
25
|
-
* @returns `InternalStateDataGenerationMethod` object that represents the method to parse, initiliaze, or update the state data for an array entry data type
|
|
26
|
-
*/
|
|
27
|
-
export declare const getStateFromArrayEntryDataType: (aedt: ArrayEntryDataType, prefix: string, attributeName: string) => (additionalData?: DataEntryArray | string) => [DataEntryArray | string | undefined, [string, DerivativeStateDataType]];
|
|
28
|
-
export declare const getStateDataFromDoubleLevelContentType: (dct: DoubleLevelContentType, prefix: string, attributeName: string) => InternalStateDataGenerationMethod;
|
|
29
|
-
export declare const getStateDateFromSingleLevelContentTypeArray: (slcta: SingleLevelContentType[], prefix: string, attributeName: string) => (additionalData?: DataEntryArray | string) => [DataEntryArray | string | undefined, [string, StateDataType]];
|
|
30
|
-
export declare const getStateDataFromNestedContentType: (nct: NestedContentType, prefix: string, attributeName: string) => InternalStateDataGenerationMethod;
|
|
31
|
-
export declare const getStateDataFromSingleLevelContentType: (slct: SingleLevelContentType, prefix: string) => InternalStateDataGenerationMethod;
|
|
32
|
-
export declare const getGenerationMethodForSingleLevelContentTypeArray: (slct: SingleLevelContentType[]) => StateDataGenerationMethod;
|
|
33
|
-
export declare const testOnlyResetCurrentDataEntryIndex: () => number;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DataEntryArray, NestedContentType, SingleLevelContentType } from '../types';
|
|
2
|
-
import { StateDataType, StateValueType } from '../types/stateValueModel';
|
|
3
|
-
export declare const getStateValue: (stateValue: StateDataType) => StateValueType;
|
|
4
|
-
export declare const getDataEntryArray: (stateValue: StateDataType) => DataEntryArray;
|
|
5
|
-
export declare const getBase64String: (stateValue: StateDataType) => string;
|
|
6
|
-
export declare const isSingleLevelContentType: (data: NestedContentType) => boolean;
|
|
7
|
-
export declare const isDoubleLevelContentType: (data: NestedContentType) => boolean;
|
|
8
|
-
export declare const singleLevelContentTypeIsDataEntry: (data: SingleLevelContentType) => boolean;
|
|
9
|
-
export declare const singleLevelContentTypeIsNestedContentDataType: (data: SingleLevelContentType) => boolean;
|
|
10
|
-
export declare const doubleLevelContentTypeIsEnumEntryDataType: (data: NestedContentType) => boolean;
|
|
11
|
-
export declare const doubleLevelContentTypeIsOptionalEntryDataType: (data: NestedContentType) => boolean;
|
|
12
|
-
export declare const doubleLevelContentTypeIsArrayDefinitionType: (data: NestedContentType) => boolean;
|
|
13
|
-
export declare const isDataEntry: (v: any) => boolean;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EnumSemantics, VersionHandler, VersionContentDefinition } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Method to create version definition objects
|
|
4
|
-
* @param {VersionArrayDefinitionType[]} versionContent - version definition array
|
|
5
|
-
* @param {number} maximumExpectedVersions - maximum expected versions to define
|
|
6
|
-
* @param {number} defaultVersion - number - optional, default it is the first,
|
|
7
|
-
* @param {EnumSemantics[] | EnumSemantics} enumSemanticsMapping - optional - UI semantics mapping for enums. If not given, values will be numbers
|
|
8
|
-
* @param {undefined | Record<string, string> | Record<string, string>[]} attributeSemanticsMapping - optional - UI semantics mapping, if nothing given no semantics will be mapped
|
|
9
|
-
* @param {number[]} exposedVersions?: number[] - optional - UI semantics, masks which objects to show and hide
|
|
10
|
-
* @returns ParsersForVersionObject
|
|
11
|
-
*/
|
|
12
|
-
export declare const createParserObject: (versionContent: VersionContentDefinition, maximumExpectedVersions: number, defaultVersion?: number, enumSemanticsMapping?: EnumSemantics | EnumSemantics[], attributeSemanticsMapping?: Record<string, string> | Record<string, string>[], exposedVersions?: number[]) => VersionHandler;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { DataEntry } from './dataEntry';
|
|
2
|
-
/**
|
|
3
|
-
* Nested Content Type
|
|
4
|
-
* content type that does nothing more than provide a name to an entry so that the data can be read from a key-value pair object
|
|
5
|
-
*/
|
|
6
|
-
export type NestedContentDataType = [string, NestedContentType];
|
|
7
|
-
/**
|
|
8
|
-
* Single Level Content Type
|
|
9
|
-
* data that can be behind a string in an object definition
|
|
10
|
-
*/
|
|
11
|
-
export type SingleLevelContentType = DataEntry | NestedContentDataType;
|
|
12
|
-
/**
|
|
13
|
-
* Content Type Union
|
|
14
|
-
*/
|
|
15
|
-
export type NestedContentType = SingleLevelContentType[] | DoubleLevelContentType;
|
|
16
|
-
/**
|
|
17
|
-
* Double Level Content Type
|
|
18
|
-
* is a data model array definition for which the first entry describes relevant data for the datamodel content type, but data model definition in of itself
|
|
19
|
-
*
|
|
20
|
-
* this additional state data is represented in the object model with a boolean for the OptionalEntryDataType, an Enum for the EnumEntryDataType and an array for the ArrayEntryDataType+++++++++
|
|
21
|
-
*/
|
|
22
|
-
export type DoubleLevelContentType = OptionalEntryDataType | EnumEntryDataType | ArrayEntryDataType;
|
|
23
|
-
/**
|
|
24
|
-
* Non Empty Valid Entry Array Type
|
|
25
|
-
* is a data model array definition that is not empty
|
|
26
|
-
*/
|
|
27
|
-
export type NonEmptyValidEntryArrayType = [SingleLevelContentType, ...SingleLevelContentType[]];
|
|
28
|
-
/**
|
|
29
|
-
* Optional Entry
|
|
30
|
-
* An optional entry is where the user can choose between two data model options
|
|
31
|
-
*
|
|
32
|
-
* the first value of the array is whether the user by default chooses the first option or the second option
|
|
33
|
-
*
|
|
34
|
-
* the two options should always be present!
|
|
35
|
-
*/
|
|
36
|
-
export type OptionalEntryDataType = [boolean, NonEmptyValidEntryArrayType, []] | [boolean, [], NonEmptyValidEntryArrayType];
|
|
37
|
-
/**
|
|
38
|
-
* Enum Entry
|
|
39
|
-
* An enum defintion is where the user is offered a list of optional data models to choose from
|
|
40
|
-
*
|
|
41
|
-
* the first value of the arrea the default option available
|
|
42
|
-
* all the other values are the option definitions
|
|
43
|
-
*
|
|
44
|
-
* the first value can't be bigger than the amount of options defined
|
|
45
|
-
* there should be at least two options given!
|
|
46
|
-
*/
|
|
47
|
-
export type EnumEntryDataType = [number, NonEmptyValidEntryArrayType, NonEmptyValidEntryArrayType, ...SingleLevelContentType[][]];
|
|
48
|
-
/**
|
|
49
|
-
* Array Entry
|
|
50
|
-
* An array definition is where the user is offered a list data models
|
|
51
|
-
*
|
|
52
|
-
* the first value of the array is the min and max count of the array
|
|
53
|
-
* the second value is the data model that is expected
|
|
54
|
-
*
|
|
55
|
-
* the delta of min and max count can't be less than 1 (and larger than 1024)
|
|
56
|
-
*/
|
|
57
|
-
export type ArrayEntryDataType = [[number, number], NonEmptyValidEntryArrayType];
|
|
58
|
-
export declare const PREFIX_SEPERATOR_DELIMETER = "_";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { SingleLevelContentType } from './arrayDefinitions';
|
|
2
|
-
import { DataEntry, DataEntryArray } from './dataEntry';
|
|
3
|
-
import { EnumSemantics } from './semanticMapping';
|
|
4
|
-
export type StateDataType = {
|
|
5
|
-
[attribute: string]: DataEntry | StateDataType | DerivativeStateDataType;
|
|
6
|
-
};
|
|
7
|
-
export type DerivativeStateDataType = {
|
|
8
|
-
s: DataEntry;
|
|
9
|
-
v: StateDataType | StateDataType[];
|
|
10
|
-
};
|
|
11
|
-
export type StateValueType = {
|
|
12
|
-
[attribute: string]: boolean | number | number[] | string | StateValueType | DerivativeStateValueType;
|
|
13
|
-
};
|
|
14
|
-
export type DerivativeStateValueType = {
|
|
15
|
-
s: boolean | number | string | number[];
|
|
16
|
-
v: StateValueType | StateValueType[];
|
|
17
|
-
};
|
|
18
|
-
export type StateDataGenerationMethod = (additionalData?: DataEntryArray | string) => StateDataType;
|
|
19
|
-
export type DataEntryParsingReturnType = [DataEntryArray | string | undefined, [string, DataEntry]];
|
|
20
|
-
export type InternalStateDataGenerationMethod = (additionalData?: DataEntryArray | string) => [DataEntryArray | string | undefined, [string, DataEntry | StateDataType | DerivativeStateDataType]];
|
|
21
|
-
export type ExposedParserStateDataMethod = (additionalData?: StateDataType | DataEntryArray | string) => StateDataType;
|
|
22
|
-
export type UpdateStateDataMethod = (state: StateDataType, entryToUpdate: DataEntry | DataEntry[]) => StateDataType;
|
|
23
|
-
export type StringifyStateDataMethod = (data: StateDataType | DataEntryArray) => string;
|
|
24
|
-
export type VersionContentDefinition = SingleLevelContentType[][];
|
|
25
|
-
export type VersionHandler = {
|
|
26
|
-
versionBitCount: number;
|
|
27
|
-
exposedVersions?: number[];
|
|
28
|
-
enumSemanticsMapping?: EnumSemantics | EnumSemantics[];
|
|
29
|
-
attributeSemanticsMapping?: Record<string, string> | Record<string, string>[];
|
|
30
|
-
parser: ExposedParserStateDataMethod;
|
|
31
|
-
updater: UpdateStateDataMethod;
|
|
32
|
-
stringify: StringifyStateDataMethod;
|
|
33
|
-
};
|