url-safe-bitpacking 0.1.15 → 0.2.0

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.
Files changed (43) hide show
  1. package/dist/enums/dataTypes.d.ts +4 -9
  2. package/dist/factory/arrayFactory.d.ts +2 -0
  3. package/dist/factory/enumArrayFactory.d.ts +1 -1
  4. package/dist/factory/enumFactory.d.ts +1 -1
  5. package/dist/factory/enumOptionsFactory.d.ts +2 -0
  6. package/dist/factory/factory.d.ts +8 -0
  7. package/dist/factory/optionalFactory.d.ts +2 -0
  8. package/dist/factory/utils.d.ts +9 -0
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.js +434 -345
  11. package/dist/parsers/arrayParser.d.ts +4 -0
  12. package/dist/parsers/enumOptionsFactory.d.ts +4 -0
  13. package/dist/parsers/optionalParser.d.ts +4 -0
  14. package/dist/parsers/parsers.d.ts +16 -12
  15. package/dist/stateHandling/index.d.ts +1 -0
  16. package/dist/stateHandling/stateData.d.ts +3 -0
  17. package/dist/stateHandling/stateDataObject.d.ts +15 -0
  18. package/dist/typeFactory/stateDataTyping.d.ts +1 -9
  19. package/dist/types/arrayData.d.ts +10 -0
  20. package/dist/types/booleanData.d.ts +1 -2
  21. package/dist/types/dataEntry.d.ts +12 -5
  22. package/dist/types/enumArrayData.d.ts +2 -3
  23. package/dist/types/enumData.d.ts +2 -2
  24. package/dist/types/enumOptionsData.d.ts +8 -0
  25. package/dist/types/floatData.d.ts +1 -2
  26. package/dist/types/index.d.ts +7 -5
  27. package/dist/types/intData.d.ts +1 -2
  28. package/dist/types/optionalData.d.ts +7 -0
  29. package/dist/types/stateDataEntry.d.ts +16 -0
  30. package/dist/types/versionData.d.ts +1 -2
  31. package/dist/update/arrayUpdate.d.ts +2 -0
  32. package/dist/update/enumOptionsUpdate.d.ts +2 -0
  33. package/dist/update/nestedDataMatching.d.ts +2 -0
  34. package/dist/update/optionalUpdate.d.ts +2 -0
  35. package/dist/update/updateValues.d.ts +8 -1
  36. package/package.json +1 -1
  37. package/dist/objectmap/index.d.ts +0 -4
  38. package/dist/objectmap/stateDataModel.d.ts +0 -33
  39. package/dist/objectmap/stateValueHelperMethods.d.ts +0 -13
  40. package/dist/objectmap/userMethods.d.ts +0 -12
  41. package/dist/types/arrayDefinitions.d.ts +0 -58
  42. package/dist/types/semanticMapping.d.ts +0 -6
  43. package/dist/types/stateValueModel.d.ts +0 -33
@@ -1,9 +1,4 @@
1
- export declare enum DataType {
2
- VERSION = 0,
3
- BOOLEAN = 1,
4
- ENUM = 2,
5
- INT = 3,
6
- FLOAT = 4,
7
- ENUM_ARRAY = 5
8
- }
9
- export declare const getDataTypeName: (type: DataType) => string;
1
+ export declare const DataTypeValues: readonly ["VERSION", "BOOLEAN", "ENUM", "INT", "FLOAT", "ENUM_ARRAY"];
2
+ export declare const ComplexDataValues: readonly ["OPTIONAL", "ENUM_OPTIONS", "ARRAY"];
3
+ export type DataType = (typeof DataTypeValues)[number];
4
+ export type ComplexDataType = (typeof ComplexDataValues)[number];
@@ -0,0 +1,2 @@
1
+ import { ArrayDataEntry, NestedData } from '@/types';
2
+ export declare const create: (descriptor: NestedData, defaultState?: number, minCount?: number, maxCount?: number, name?: string, index?: number) => ArrayDataEntry;
@@ -1,2 +1,2 @@
1
1
  import { EnumArrayDataEntry } from '@/types';
2
- export declare const create: (value: number[], min?: number, max?: number, minCount?: number, maxCount?: number, name?: string, index?: number) => EnumArrayDataEntry;
2
+ export declare const create: (value: number[], options: (string | number | object)[] | string | number, minCount?: number, maxCount?: number, name?: string, index?: number) => EnumArrayDataEntry;
@@ -1,2 +1,2 @@
1
1
  import { EnumDataEntry } from '../types';
2
- export declare const create: (value: number, max?: number, name?: string, index?: number) => EnumDataEntry;
2
+ export declare const create: (value: number, options: (string | number | object)[] | string | number, name?: string, index?: number) => EnumDataEntry;
@@ -0,0 +1,2 @@
1
+ import { EnumOptionsDataEntry, NestedData } from '@/types';
2
+ export declare const create: (descriptor: NestedData[], defaultState?: number, name?: string, index?: number) => EnumOptionsDataEntry;
@@ -4,6 +4,9 @@ import { create as createBoolean } from './booleanFactory';
4
4
  import { create as createVersion } from './versionFactory';
5
5
  import { create as createEnum } from './enumFactory';
6
6
  import { create as createEnumArray } from './enumArrayFactory';
7
+ import { create as createOptional } from './optionalFactory';
8
+ import { create as createEnumOptions } from './enumOptionsFactory';
9
+ import { create as createArray } from './arrayFactory';
7
10
  /**
8
11
  * Record containing all the factory methods for the different data entry objects
9
12
  */
@@ -15,3 +18,8 @@ export declare const DataEntryFactory: {
15
18
  createVersion: typeof createVersion;
16
19
  createEnumArray: typeof createEnumArray;
17
20
  };
21
+ export declare const ComplexDataEntryFactory: {
22
+ createOptional: typeof createOptional;
23
+ createEnumOptions: typeof createEnumOptions;
24
+ createArray: typeof createArray;
25
+ };
@@ -0,0 +1,2 @@
1
+ import { NestedData, OptionalDataEntry } from '@/types';
2
+ export declare const create: (descriptor: [null, NestedData] | [NestedData, null], defaultState?: boolean, name?: string, index?: number) => OptionalDataEntry;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Method to get the max and mapping from the options
3
+ * @param options - `any[] | string | number` the options to get the max and mapping from
4
+ * @returns `{ max: number; mapping: any[] }` the max and mapping
5
+ */
6
+ export declare const getOptionsFromEnumOptions: (options: (string | number | object)[] | string | number) => {
7
+ max: number;
8
+ mapping: (string | number | object)[];
9
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { DataType } from './enums';
2
- export { DataEntryFactory } from './factory';
3
- export { SingleLevelContentType, NestedContentDataType, NestedContentType, DoubleLevelContentType, NonEmptyValidEntryArrayType, ArrayEntryDataType, OptionalEntryDataType, EnumEntryDataType, PrecisionRangeType, SignificandMaxBits, FloatDataEntry, IntegerMaxBits, IntDataEntry, EnumDataEntry, EnumArrayDataEntry, VersionRangeType, VersionDataEntry, BooleanDataEntry, DataEntry, DataEntryArray, StateDataType, StateValueType, EnumSemantics, DerivativeStateDataType, VersionContentDefinition, PREFIX_SEPERATOR_DELIMETER, PROTECTED_ATTRIBUTE_NAMES } from './types';
4
- export { createParserObject, getStateValue, getBase64String, getDataEntryArray, isDataEntry, isDoubleLevelContentType, isSingleLevelContentType, doubleLevelContentTypeIsEnumEntryDataType, doubleLevelContentTypeIsOptionalEntryDataType, doubleLevelContentTypeIsArrayDefinitionType } from './objectmap';
1
+ export { DataType, DataTypeValues, ComplexDataType, ComplexDataValues } from './enums';
2
+ export { DataEntryFactory, ComplexDataEntryFactory } from './factory';
3
+ export { PrecisionRangeType, SignificandMaxBits, FloatDataEntry, IntegerMaxBits, IntDataEntry, EnumDataEntry, EnumArrayDataEntry, VersionRangeType, VersionDataEntry, BooleanDataEntry, DataEntry, ComplexDataEntry, NestedData, ProtectedAttributeNames, StateDescriptor, StateObject, StateDataObject, StateDataEntry, State, PROTECTED_ATTRIBUTE_NAMES } from './types';
5
4
  export { parseBase64ToBits, getBitsCount, valueBitsParser, dataBitsParser, dataEntryBitstringParser, dataBitsStringifier, dataEntryCorrecting } from './parsers';
5
+ export { createStateDataObject, getInitialStateFromBase64 } from './stateHandling';
6
6
  export { interpolateEntryAt, getRelativeValue } from './utils';