@routier/core 0.0.1-alpha.1 → 0.0.1-alpha.2
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/assertions/index.d.ts +5 -0
- package/dist/assertions/index.js +131 -0
- package/dist/assertions/index.js.map +1 -0
- package/dist/codegen/SlotPath.d.ts +7 -0
- package/dist/codegen/blocks.d.ts +130 -0
- package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/CompareHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/DeserializeHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/EnableChangeTrackingHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/EnrichmentHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/FreezeHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/HashHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/HashTypeHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/IdSelectorHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/MergeHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/PrepareHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/SerializeHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/StripHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/clone/CloneObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/compare/CompareObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/compare/CompareValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/deserialize/DeserializeComputedValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/deserialize/DeserializeDateHandler.d.ts +9 -0
- package/dist/codegen/handlers/deserialize/DeserializeFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/deserialize/DeserializeObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/deserialize/DeserializeValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentComputedValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.d.ts +6 -0
- package/dist/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.d.ts +6 -0
- package/dist/codegen/handlers/freeze/FreezeObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/freeze/FreezePrimitiveValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashComputedValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashDateHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashIdentityHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashKeyHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/hashType/HashTypeValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/idSelector/IdSelectorValueHandler.d.ts +6 -0
- package/{src/codegen/handlers/index.ts → dist/codegen/handlers/index.d.ts} +1 -1
- package/dist/codegen/handlers/merge/MergeComputedValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/merge/MergeDefaultFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/merge/MergeDefaultValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/merge/MergeFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/merge/MergePrimitiveHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareComputedValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareFunctionHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareIdentityHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareKeyHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/prepare/PrepareValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/serialize/SerializeDateHandler.d.ts +9 -0
- package/dist/codegen/handlers/serialize/SerializeObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/serialize/SerializeValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripIdentityHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripKeyHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripObjectHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripValueHandler.d.ts +6 -0
- package/dist/codegen/handlers/types.d.ts +18 -0
- package/{src/codegen/index.ts → dist/codegen/index.d.ts} +1 -1
- package/dist/codegen/types.d.ts +9 -0
- package/dist/codegen/utils.d.ts +22 -0
- package/dist/collections/Changes.d.ts +51 -0
- package/dist/collections/Changes.test.d.ts +1 -0
- package/dist/collections/IdSet.d.ts +7 -0
- package/dist/collections/MemoryDataCollection.d.ts +22 -0
- package/dist/collections/MemoryDataCollection.test.d.ts +1 -0
- package/dist/collections/SchemaCollection.d.ts +8 -0
- package/dist/collections/TagCollection.d.ts +15 -0
- package/dist/collections/TagCollection.test.d.ts +1 -0
- package/{src/collections/index.ts → dist/collections/index.d.ts} +1 -1
- package/dist/collections/index.js +659 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/errors/SchemaError.d.ts +3 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +90 -0
- package/dist/errors/index.js.map +1 -0
- package/{src/expressions/index.ts → dist/expressions/index.d.ts} +1 -1
- package/{src/expressions/parser.ts → dist/expressions/index.js} +387 -205
- package/dist/expressions/index.js.map +1 -0
- package/dist/expressions/parser.d.ts +4 -0
- package/dist/expressions/parser.test.d.ts +1 -0
- package/{src/expressions/types.ts → dist/expressions/types.d.ts} +42 -99
- package/dist/expressions/utils.d.ts +10 -0
- package/dist/expressions/utils.test.d.ts +1 -0
- package/{src/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.js +8434 -0
- package/dist/index.js.map +1 -0
- package/dist/performance/index.d.ts +5 -0
- package/dist/performance/index.js +65 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/pipeline/SyncronousQueue.d.ts +7 -0
- package/dist/pipeline/SyncronousQueue.test.d.ts +1 -0
- package/dist/pipeline/TrampolinePipeline.d.ts +36 -0
- package/dist/pipeline/TrampolinePipeline.test.d.ts +1 -0
- package/dist/pipeline/index.d.ts +2 -0
- package/{src/pipeline/TrampolinePipeline.ts → dist/pipeline/index.js} +297 -140
- package/dist/pipeline/index.js.map +1 -0
- package/dist/plugins/EphemeralDataPlugin.d.ts +13 -0
- package/dist/plugins/capabilities/DbPluginCapability.d.ts +23 -0
- package/{src/plugins/capabilities/index.ts → dist/plugins/capabilities/index.d.ts} +1 -1
- package/dist/plugins/capabilities/logging/DbPluginLoggingCapability.d.ts +28 -0
- package/dist/plugins/capabilities/logging/index.d.ts +1 -0
- package/{src/plugins/index.ts → dist/plugins/index.d.ts} +1 -1
- package/dist/plugins/index.js +2328 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/query/Query.d.ts +13 -0
- package/dist/plugins/query/QueryOptionsCollection.d.ts +27 -0
- package/dist/plugins/query/QueryOptionsCollection.test.d.ts +1 -0
- package/{src/plugins/query/index.ts → dist/plugins/query/index.d.ts} +1 -1
- package/{src/plugins/query/types.ts → dist/plugins/query/types.d.ts} +29 -20
- package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +21 -0
- package/dist/plugins/replication/ReplicationDbPlugin.d.ts +21 -0
- package/{src/plugins/replication/index.ts → dist/plugins/replication/index.d.ts} +1 -1
- package/{src/plugins/replication/types.ts → dist/plugins/replication/types.d.ts} +1 -2
- package/dist/plugins/translators/DataTranslator.d.ts +18 -0
- package/dist/plugins/translators/JsonTranslator.d.ts +17 -0
- package/dist/plugins/translators/JsonTranslator.test.d.ts +1 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +14 -0
- package/{src/plugins/translators/index.ts → dist/plugins/translators/index.d.ts} +1 -1
- package/{src/plugins/types.ts → dist/plugins/types.d.ts} +11 -26
- package/dist/results/Result.d.ts +29 -0
- package/{src/results/index.ts → dist/results/index.d.ts} +1 -1
- package/dist/results/index.js +192 -0
- package/dist/results/index.js.map +1 -0
- package/{src/results/types.ts → dist/results/types.d.ts} +18 -7
- package/dist/results/utils.d.ts +2 -0
- package/dist/schema/PropertyInfo.d.ts +132 -0
- package/dist/schema/PropertyInfo.test.d.ts +1 -0
- package/dist/schema/SchemaDefinition.d.ts +17 -0
- package/dist/schema/builder.d.ts +17 -0
- package/{src/schema/index.ts → dist/schema/index.d.ts} +1 -1
- package/dist/schema/index.js +4822 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/property/base/SchemaBase.d.ts +23 -0
- package/dist/schema/property/base/index.d.ts +1 -0
- package/dist/schema/property/modifiers/SchemaDefault.d.ts +13 -0
- package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +11 -0
- package/dist/schema/property/modifiers/SchemaDistinct.d.ts +7 -0
- package/dist/schema/property/modifiers/SchemaFrom.d.ts +23 -0
- package/dist/schema/property/modifiers/SchemaIdentity.d.ts +7 -0
- package/dist/schema/property/modifiers/SchemaIndex.d.ts +23 -0
- package/dist/schema/property/modifiers/SchemaKey.d.ts +13 -0
- package/dist/schema/property/modifiers/SchemaNullable.d.ts +9 -0
- package/dist/schema/property/modifiers/SchemaOptional.d.ts +9 -0
- package/dist/schema/property/modifiers/SchemaReadonly.d.ts +15 -0
- package/dist/schema/property/modifiers/SchemaSerialize.d.ts +9 -0
- package/dist/schema/property/modifiers/SchemaTracked.d.ts +7 -0
- package/{src/schema/property/modifiers/index.ts → dist/schema/property/modifiers/index.d.ts} +1 -1
- package/dist/schema/property/types/SchemaArray.d.ts +23 -0
- package/dist/schema/property/types/SchemaBoolean.d.ts +27 -0
- package/dist/schema/property/types/SchemaDate.d.ts +27 -0
- package/dist/schema/property/types/SchemaNumber.d.ts +31 -0
- package/dist/schema/property/types/SchemaObject.d.ts +20 -0
- package/dist/schema/property/types/SchemaString.d.ts +31 -0
- package/{src/schema/property/types/index.ts → dist/schema/property/types/index.d.ts} +1 -1
- package/dist/schema/table/SchemaComputed.d.ts +10 -0
- package/dist/schema/table/SchemaFunction.d.ts +8 -0
- package/{src/schema/table/index.ts → dist/schema/table/index.d.ts} +1 -1
- package/{src/schema/types.ts → dist/schema/types.d.ts} +59 -99
- package/{src/types/index.ts → dist/types/index.d.ts} +1 -2
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utilities/arrays.d.ts +1 -0
- package/dist/utilities/arrays.test.d.ts +1 -0
- package/dist/utilities/dates.d.ts +1 -0
- package/dist/utilities/dates.test.d.ts +1 -0
- package/dist/utilities/dbPluginEventUtils.d.ts +14 -0
- package/{src/utilities/index.ts → dist/utilities/index.d.ts} +1 -1
- package/dist/utilities/index.js +554 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/objects.d.ts +2 -0
- package/dist/utilities/queryOptionsCollection.d.ts +2 -0
- package/dist/utilities/replication.d.ts +3 -0
- package/dist/utilities/runtime.d.ts +1 -0
- package/dist/utilities/strings.d.ts +1 -0
- package/dist/utilities/types.d.ts +1 -0
- package/dist/utilities/uuid.d.ts +2 -0
- package/package.json +6 -1
- package/readme.md +95 -0
- package/CHANGELOG.md +0 -8
- package/rspack.config.mjs +0 -65
- package/src/assertions/index.ts +0 -37
- package/src/codegen/SlotPath.ts +0 -20
- package/src/codegen/blocks.ts +0 -578
- package/src/codegen/handlers/CloneHandlerBuilder.ts +0 -13
- package/src/codegen/handlers/CompareHandlerBuilder.ts +0 -13
- package/src/codegen/handlers/DeserializeHandlerBuilder.ts +0 -20
- package/src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts +0 -13
- package/src/codegen/handlers/EnrichmentHandlerBuilder.ts +0 -28
- package/src/codegen/handlers/FreezeHandlerBuilder.ts +0 -13
- package/src/codegen/handlers/HashHandlerBuilder.ts +0 -25
- package/src/codegen/handlers/HashTypeHandlerBuilder.ts +0 -11
- package/src/codegen/handlers/IdSelectorHandlerBuilder.ts +0 -10
- package/src/codegen/handlers/MergeHandlerBuilder.ts +0 -19
- package/src/codegen/handlers/PrepareHandlerBuilder.ts +0 -23
- package/src/codegen/handlers/SerializeHandlerBuilder.ts +0 -15
- package/src/codegen/handlers/StripHandlerBuilder.ts +0 -18
- package/src/codegen/handlers/clone/CloneObjectHandler.ts +0 -29
- package/src/codegen/handlers/clone/CloneValueHandler.ts +0 -33
- package/src/codegen/handlers/compare/CompareObjectHandler.ts +0 -15
- package/src/codegen/handlers/compare/CompareValueHandler.ts +0 -27
- package/src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts +0 -16
- package/src/codegen/handlers/deserialize/DeserializeDateHandler.ts +0 -45
- package/src/codegen/handlers/deserialize/DeserializeFunctionHandler.ts +0 -16
- package/src/codegen/handlers/deserialize/DeserializeObjectHandler.ts +0 -29
- package/src/codegen/handlers/deserialize/DeserializeValueHandler.ts +0 -33
- package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.ts +0 -20
- package/src/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.ts +0 -15
- package/src/codegen/handlers/enrichment/EnrichmentComputedValueHandler.ts +0 -37
- package/src/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.ts +0 -50
- package/src/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.ts +0 -18
- package/src/codegen/handlers/enrichment/EnrichmentFunctionHandler.ts +0 -38
- package/src/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.ts +0 -44
- package/src/codegen/handlers/enrichment/EnrichmentObjectHandler.ts +0 -29
- package/src/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.ts +0 -16
- package/src/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.ts +0 -13
- package/src/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.ts +0 -21
- package/src/codegen/handlers/freeze/FreezeObjectHandler.ts +0 -20
- package/src/codegen/handlers/freeze/FreezePrimitiveValueHandler.ts +0 -15
- package/src/codegen/handlers/hash/HashComputedValueHandler.ts +0 -15
- package/src/codegen/handlers/hash/HashDateHandler.ts +0 -26
- package/src/codegen/handlers/hash/HashFunctionHandler.ts +0 -16
- package/src/codegen/handlers/hash/HashIdentityHandler.ts +0 -15
- package/src/codegen/handlers/hash/HashKeyHandler.ts +0 -26
- package/src/codegen/handlers/hash/HashValueHandler.ts +0 -26
- package/src/codegen/handlers/hashType/HashTypeValueHandler.ts +0 -20
- package/src/codegen/handlers/idSelector/IdSelectorValueHandler.ts +0 -28
- package/src/codegen/handlers/merge/MergeComputedValueHandler.ts +0 -37
- package/src/codegen/handlers/merge/MergeDefaultFunctionHandler.ts +0 -40
- package/src/codegen/handlers/merge/MergeDefaultValueHandler.ts +0 -32
- package/src/codegen/handlers/merge/MergeFunctionHandler.ts +0 -16
- package/src/codegen/handlers/merge/MergePrimitiveHandler.ts +0 -21
- package/src/codegen/handlers/prepare/PrepareComputedValueHandler.ts +0 -16
- package/src/codegen/handlers/prepare/PrepareFunctionHandler.ts +0 -16
- package/src/codegen/handlers/prepare/PrepareIdentityHandler.ts +0 -21
- package/src/codegen/handlers/prepare/PrepareKeyHandler.ts +0 -21
- package/src/codegen/handlers/prepare/PrepareObjectHandler.ts +0 -38
- package/src/codegen/handlers/prepare/PrepareValueHandler.ts +0 -36
- package/src/codegen/handlers/serialize/SerializeDateHandler.ts +0 -45
- package/src/codegen/handlers/serialize/SerializeObjectHandler.ts +0 -28
- package/src/codegen/handlers/serialize/SerializeValueHandler.ts +0 -33
- package/src/codegen/handlers/strip/StripIdentityHandler.ts +0 -15
- package/src/codegen/handlers/strip/StripKeyHandler.ts +0 -15
- package/src/codegen/handlers/strip/StripObjectHandler.ts +0 -35
- package/src/codegen/handlers/strip/StripValueHandler.ts +0 -36
- package/src/codegen/handlers/types.ts +0 -119
- package/src/codegen/types.ts +0 -2
- package/src/codegen/utils.ts +0 -74
- package/src/collections/Changes.test.ts +0 -337
- package/src/collections/Changes.ts +0 -177
- package/src/collections/IdSet.ts +0 -28
- package/src/collections/MemoryDataCollection.test.ts +0 -424
- package/src/collections/MemoryDataCollection.ts +0 -134
- package/src/collections/SchemaCollection.ts +0 -22
- package/src/collections/TagCollection.test.ts +0 -443
- package/src/collections/TagCollection.ts +0 -62
- package/src/errors/SchemaError.ts +0 -6
- package/src/errors/index.ts +0 -1
- package/src/expressions/parser.test.ts +0 -913
- package/src/expressions/utils.test.ts +0 -346
- package/src/expressions/utils.ts +0 -59
- package/src/performance/index.ts +0 -26
- package/src/pipeline/SyncronousQueue.test.ts +0 -269
- package/src/pipeline/SyncronousQueue.ts +0 -30
- package/src/pipeline/TrampolinePipeline.test.ts +0 -374
- package/src/pipeline/index.ts +0 -2
- package/src/plugins/EphemeralDataPlugin.ts +0 -132
- package/src/plugins/capabilities/DbPluginCapability.ts +0 -111
- package/src/plugins/capabilities/logging/DbPluginLoggingCapability.ts +0 -261
- package/src/plugins/capabilities/logging/index.ts +0 -1
- package/src/plugins/query/Query.ts +0 -67
- package/src/plugins/query/QueryOptionsCollection.test.ts +0 -86
- package/src/plugins/query/QueryOptionsCollection.ts +0 -154
- package/src/plugins/replication/OptimisticReplicationDbPlugin.ts +0 -202
- package/src/plugins/replication/ReplicationDbPlugin.ts +0 -137
- package/src/plugins/translators/DataTranslator.ts +0 -46
- package/src/plugins/translators/JsonTranslator.test.ts +0 -618
- package/src/plugins/translators/JsonTranslator.ts +0 -211
- package/src/plugins/translators/SqlTranslator.ts +0 -45
- package/src/results/Result.ts +0 -91
- package/src/results/utils.ts +0 -15
- package/src/schema/PropertyInfo.test.ts +0 -479
- package/src/schema/PropertyInfo.ts +0 -374
- package/src/schema/SchemaDefinition.ts +0 -626
- package/src/schema/builder.ts +0 -18
- package/src/schema/property/base/SchemaBase.ts +0 -49
- package/src/schema/property/base/index.ts +0 -1
- package/src/schema/property/modifiers/SchemaDefault.ts +0 -29
- package/src/schema/property/modifiers/SchemaDeserialize.ts +0 -23
- package/src/schema/property/modifiers/SchemaDistinct.ts +0 -14
- package/src/schema/property/modifiers/SchemaFrom.ts +0 -54
- package/src/schema/property/modifiers/SchemaIdentity.ts +0 -13
- package/src/schema/property/modifiers/SchemaIndex.ts +0 -60
- package/src/schema/property/modifiers/SchemaKey.ts +0 -28
- package/src/schema/property/modifiers/SchemaNullable.ts +0 -18
- package/src/schema/property/modifiers/SchemaOptional.ts +0 -19
- package/src/schema/property/modifiers/SchemaReadonly.ts +0 -34
- package/src/schema/property/modifiers/SchemaSerialize.ts +0 -18
- package/src/schema/property/modifiers/SchemaTracked.ts +0 -14
- package/src/schema/property/types/SchemaArray.ts +0 -50
- package/src/schema/property/types/SchemaBoolean.ts +0 -59
- package/src/schema/property/types/SchemaDate.ts +0 -58
- package/src/schema/property/types/SchemaNumber.ts +0 -69
- package/src/schema/property/types/SchemaObject.ts +0 -44
- package/src/schema/property/types/SchemaString.ts +0 -69
- package/src/schema/table/SchemaComputed.ts +0 -20
- package/src/schema/table/SchemaFunction.ts +0 -15
- package/src/utilities/arrays.test.ts +0 -312
- package/src/utilities/arrays.ts +0 -12
- package/src/utilities/dates.test.ts +0 -388
- package/src/utilities/dates.ts +0 -11
- package/src/utilities/dbPluginEventUtils.ts +0 -44
- package/src/utilities/objects.ts +0 -7
- package/src/utilities/queryOptionsCollection.ts +0 -16
- package/src/utilities/replication.ts +0 -23
- package/src/utilities/runtime.ts +0 -3
- package/src/utilities/strings.ts +0 -18
- package/src/utilities/types.ts +0 -1
- package/src/utilities/uuid.ts +0 -56
- package/tsconfig.json +0 -28
- package/vitest.config.ts +0 -11
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { isDate } from './dates';
|
|
3
|
-
|
|
4
|
-
describe('isDate', () => {
|
|
5
|
-
describe('valid Date objects', () => {
|
|
6
|
-
it('should return true for new Date()', () => {
|
|
7
|
-
const date = new Date();
|
|
8
|
-
expect(isDate(date)).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should return true for Date with specific value', () => {
|
|
12
|
-
const date = new Date('2023-01-15T10:30:00Z');
|
|
13
|
-
expect(isDate(date)).toBe(true);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should return true for Date with timestamp', () => {
|
|
17
|
-
const date = new Date(1673778600000);
|
|
18
|
-
expect(isDate(date)).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should return true for Date with year, month, day', () => {
|
|
22
|
-
const date = new Date(2023, 0, 15); // January 15, 2023
|
|
23
|
-
expect(isDate(date)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should return true for Date with all parameters', () => {
|
|
27
|
-
const date = new Date(2023, 0, 15, 10, 30, 45, 123);
|
|
28
|
-
expect(isDate(date)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return true for Date.now()', () => {
|
|
32
|
-
const date = new Date(Date.now());
|
|
33
|
-
expect(isDate(date)).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should return true for invalid Date object', () => {
|
|
37
|
-
const date = new Date('invalid date string');
|
|
38
|
-
expect(isDate(date)).toBe(true); // Still a Date object, even if invalid
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('null and undefined values', () => {
|
|
43
|
-
it('should return false for null', () => {
|
|
44
|
-
expect(isDate(null)).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should return false for undefined', () => {
|
|
48
|
-
expect(isDate(undefined)).toBe(false);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should return false for void 0', () => {
|
|
52
|
-
expect(isDate(void 0)).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('primitive types', () => {
|
|
57
|
-
it('should return false for string', () => {
|
|
58
|
-
expect(isDate('2023-01-15')).toBe(false);
|
|
59
|
-
expect(isDate('not a date')).toBe(false);
|
|
60
|
-
expect(isDate('')).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should return false for number', () => {
|
|
64
|
-
expect(isDate(1673778600000)).toBe(false);
|
|
65
|
-
expect(isDate(0)).toBe(false);
|
|
66
|
-
expect(isDate(-1)).toBe(false);
|
|
67
|
-
expect(isDate(3.14)).toBe(false);
|
|
68
|
-
expect(isDate(NaN)).toBe(false);
|
|
69
|
-
expect(isDate(Infinity)).toBe(false);
|
|
70
|
-
expect(isDate(-Infinity)).toBe(false);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should return false for boolean', () => {
|
|
74
|
-
expect(isDate(true)).toBe(false);
|
|
75
|
-
expect(isDate(false)).toBe(false);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should return false for symbol', () => {
|
|
79
|
-
const symbol = Symbol('test');
|
|
80
|
-
expect(isDate(symbol)).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should return false for bigint', () => {
|
|
84
|
-
expect(isDate(BigInt(1673778600000))).toBe(false);
|
|
85
|
-
expect(isDate(BigInt(0))).toBe(false);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('other object types', () => {
|
|
90
|
-
it('should return false for plain object', () => {
|
|
91
|
-
expect(isDate({})).toBe(false);
|
|
92
|
-
expect(isDate({ year: 2023, month: 1, day: 15 })).toBe(false);
|
|
93
|
-
expect(isDate({ toString: () => '2023-01-15' })).toBe(false);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should return false for array', () => {
|
|
97
|
-
expect(isDate([])).toBe(false);
|
|
98
|
-
expect(isDate([2023, 1, 15])).toBe(false);
|
|
99
|
-
expect(isDate(['2023', '01', '15'])).toBe(false);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should return false for function', () => {
|
|
103
|
-
expect(isDate(() => { })).toBe(false);
|
|
104
|
-
expect(isDate(function () { })).toBe(false);
|
|
105
|
-
expect(isDate(Date)).toBe(false); // Date constructor
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should return false for class instance', () => {
|
|
109
|
-
class CustomDate {
|
|
110
|
-
constructor(public value: string) { }
|
|
111
|
-
toString() { return this.value; }
|
|
112
|
-
}
|
|
113
|
-
const customDate = new CustomDate('2023-01-15');
|
|
114
|
-
expect(isDate(customDate)).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should return false for object with date-like properties', () => {
|
|
118
|
-
const dateLike = {
|
|
119
|
-
getTime: () => 1673778600000,
|
|
120
|
-
getFullYear: () => 2023,
|
|
121
|
-
getMonth: () => 0,
|
|
122
|
-
getDate: () => 15,
|
|
123
|
-
toString: () => '2023-01-15T10:30:00.000Z'
|
|
124
|
-
};
|
|
125
|
-
expect(isDate(dateLike)).toBe(false);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should return false for object with instanceof Date check', () => {
|
|
129
|
-
const fakeDate = {
|
|
130
|
-
[Symbol.hasInstance]: () => true
|
|
131
|
-
};
|
|
132
|
-
expect(isDate(fakeDate)).toBe(false);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe('special values', () => {
|
|
137
|
-
it('should return false for empty string', () => {
|
|
138
|
-
expect(isDate('')).toBe(false);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('should return false for zero', () => {
|
|
142
|
-
expect(isDate(0)).toBe(false);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should return false for negative zero', () => {
|
|
146
|
-
expect(isDate(-0)).toBe(false);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('should return false for NaN', () => {
|
|
150
|
-
expect(isDate(NaN)).toBe(false);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('should return false for Infinity', () => {
|
|
154
|
-
expect(isDate(Infinity)).toBe(false);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('should return false for -Infinity', () => {
|
|
158
|
-
expect(isDate(-Infinity)).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('type safety', () => {
|
|
163
|
-
it('should provide proper type narrowing', () => {
|
|
164
|
-
const unknownValue: unknown = new Date();
|
|
165
|
-
|
|
166
|
-
if (isDate(unknownValue)) {
|
|
167
|
-
// TypeScript should know this is a Date here
|
|
168
|
-
expect(unknownValue.getTime()).toBeDefined();
|
|
169
|
-
expect(unknownValue.getFullYear()).toBeDefined();
|
|
170
|
-
expect(unknownValue.toISOString()).toBeDefined();
|
|
171
|
-
} else {
|
|
172
|
-
expect(true).toBe(false); // This should not happen
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('should work with union types', () => {
|
|
177
|
-
const value: string | Date | null = new Date();
|
|
178
|
-
|
|
179
|
-
if (isDate(value)) {
|
|
180
|
-
expect(value.getTime()).toBeDefined();
|
|
181
|
-
} else {
|
|
182
|
-
expect(true).toBe(false); // This should not happen
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('should work with any type', () => {
|
|
187
|
-
const value: any = new Date();
|
|
188
|
-
|
|
189
|
-
if (isDate(value)) {
|
|
190
|
-
expect(value.getTime()).toBeDefined();
|
|
191
|
-
} else {
|
|
192
|
-
expect(true).toBe(false); // This should not happen
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
describe('edge cases', () => {
|
|
198
|
-
it('should return false for Date-like objects created without new', () => {
|
|
199
|
-
// Date() without new returns a string representation of current date
|
|
200
|
-
const dateLike = Date();
|
|
201
|
-
expect(isDate(dateLike)).toBe(false);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('should return false for objects with date methods but not instanceof Date', () => {
|
|
205
|
-
const dateLike = {
|
|
206
|
-
getTime: () => 1673778600000,
|
|
207
|
-
getFullYear: () => 2023,
|
|
208
|
-
getMonth: () => 0,
|
|
209
|
-
getDate: () => 15,
|
|
210
|
-
toISOString: () => '2023-01-15T10:30:00.000Z'
|
|
211
|
-
};
|
|
212
|
-
expect(isDate(dateLike)).toBe(false);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it('should return false for null prototype objects', () => {
|
|
216
|
-
const obj = Object.create(null);
|
|
217
|
-
obj.getTime = () => 1673778600000;
|
|
218
|
-
expect(isDate(obj)).toBe(false);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('should return true for objects with modified prototype', () => {
|
|
222
|
-
const obj = {};
|
|
223
|
-
Object.setPrototypeOf(obj, Date.prototype);
|
|
224
|
-
expect(isDate(obj)).toBe(true); // This actually works with instanceof Date
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
describe('performance characteristics', () => {
|
|
229
|
-
it('should handle large number of checks efficiently', () => {
|
|
230
|
-
const testValues = [
|
|
231
|
-
new Date(),
|
|
232
|
-
'2023-01-15',
|
|
233
|
-
1673778600000,
|
|
234
|
-
null,
|
|
235
|
-
undefined,
|
|
236
|
-
{},
|
|
237
|
-
[],
|
|
238
|
-
true,
|
|
239
|
-
false,
|
|
240
|
-
0,
|
|
241
|
-
'',
|
|
242
|
-
NaN
|
|
243
|
-
];
|
|
244
|
-
|
|
245
|
-
const start = performance.now();
|
|
246
|
-
|
|
247
|
-
for (let i = 0; i < 10000; i++) {
|
|
248
|
-
testValues.forEach(value => {
|
|
249
|
-
isDate(value);
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const end = performance.now();
|
|
254
|
-
const duration = end - start;
|
|
255
|
-
|
|
256
|
-
expect(duration).toBeLessThan(100); // Should complete in under 100ms
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
it('should handle mixed type arrays efficiently', () => {
|
|
260
|
-
const mixedArray = Array.from({ length: 1000 }, (_, i) => {
|
|
261
|
-
switch (i % 7) {
|
|
262
|
-
case 0: return new Date();
|
|
263
|
-
case 1: return 'string';
|
|
264
|
-
case 2: return 123;
|
|
265
|
-
case 3: return null;
|
|
266
|
-
case 4: return undefined;
|
|
267
|
-
case 5: return {};
|
|
268
|
-
case 6: return [];
|
|
269
|
-
default: return true;
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
const start = performance.now();
|
|
274
|
-
const results = mixedArray.map(value => isDate(value));
|
|
275
|
-
const end = performance.now();
|
|
276
|
-
|
|
277
|
-
expect(results.filter(Boolean)).toHaveLength(Math.ceil(1000 / 7)); // Only Date objects should be true
|
|
278
|
-
expect(end - start).toBeLessThan(50); // Should complete in under 50ms
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
describe('real-world scenarios', () => {
|
|
283
|
-
it('should work with API responses', () => {
|
|
284
|
-
const apiResponse = {
|
|
285
|
-
id: 1,
|
|
286
|
-
name: 'Test Item',
|
|
287
|
-
createdAt: new Date('2023-01-15T10:30:00Z'),
|
|
288
|
-
updatedAt: '2023-01-15T10:30:00Z',
|
|
289
|
-
deletedAt: null as any
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
expect(isDate(apiResponse.createdAt)).toBe(true);
|
|
293
|
-
expect(isDate(apiResponse.updatedAt)).toBe(false);
|
|
294
|
-
expect(isDate(apiResponse.deletedAt)).toBe(false);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it('should work with form data', () => {
|
|
298
|
-
const formData = {
|
|
299
|
-
name: 'John Doe',
|
|
300
|
-
email: 'john@example.com',
|
|
301
|
-
birthDate: new Date('1990-05-15'),
|
|
302
|
-
registrationDate: '2023-01-15',
|
|
303
|
-
lastLogin: null as any
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
expect(isDate(formData.birthDate)).toBe(true);
|
|
307
|
-
expect(isDate(formData.registrationDate)).toBe(false);
|
|
308
|
-
expect(isDate(formData.lastLogin)).toBe(false);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('should work with database records', () => {
|
|
312
|
-
const dbRecord = {
|
|
313
|
-
id: 123,
|
|
314
|
-
title: 'Sample Record',
|
|
315
|
-
created: new Date(),
|
|
316
|
-
modified: new Date(),
|
|
317
|
-
metadata: {
|
|
318
|
-
lastBackup: new Date('2023-01-01T00:00:00Z'),
|
|
319
|
-
version: '1.0.0'
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
expect(isDate(dbRecord.created)).toBe(true);
|
|
324
|
-
expect(isDate(dbRecord.modified)).toBe(true);
|
|
325
|
-
expect(isDate(dbRecord.metadata.lastBackup)).toBe(true);
|
|
326
|
-
expect(isDate(dbRecord.metadata.version)).toBe(false);
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
it('should work with event handlers', () => {
|
|
330
|
-
const eventData = {
|
|
331
|
-
type: 'user_action',
|
|
332
|
-
timestamp: new Date(),
|
|
333
|
-
userId: 456,
|
|
334
|
-
action: 'click',
|
|
335
|
-
metadata: {
|
|
336
|
-
x: 100,
|
|
337
|
-
y: 200,
|
|
338
|
-
timestamp: '2023-01-15T10:30:00Z'
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
expect(isDate(eventData.timestamp)).toBe(true);
|
|
343
|
-
expect(isDate(eventData.metadata.timestamp)).toBe(false);
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
describe('error handling', () => {
|
|
348
|
-
it('should not throw errors for any input', () => {
|
|
349
|
-
const problematicValues = [
|
|
350
|
-
null,
|
|
351
|
-
undefined,
|
|
352
|
-
{},
|
|
353
|
-
[],
|
|
354
|
-
() => { },
|
|
355
|
-
new Proxy({}, {}),
|
|
356
|
-
new WeakMap(),
|
|
357
|
-
new WeakSet(),
|
|
358
|
-
Symbol(),
|
|
359
|
-
BigInt(123),
|
|
360
|
-
new ArrayBuffer(8),
|
|
361
|
-
new Uint8Array([1, 2, 3])
|
|
362
|
-
];
|
|
363
|
-
|
|
364
|
-
problematicValues.forEach(value => {
|
|
365
|
-
expect(() => isDate(value)).not.toThrow();
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
it('should handle objects with circular references', () => {
|
|
370
|
-
const circular: any = {};
|
|
371
|
-
circular.self = circular;
|
|
372
|
-
|
|
373
|
-
expect(() => isDate(circular)).not.toThrow();
|
|
374
|
-
expect(isDate(circular)).toBe(false);
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
it('should handle objects with getters that throw', () => {
|
|
378
|
-
const obj = {
|
|
379
|
-
get value() {
|
|
380
|
-
throw new Error('Getter error');
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
expect(() => isDate(obj)).not.toThrow();
|
|
385
|
-
expect(isDate(obj)).toBe(false);
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
});
|
package/src/utilities/dates.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { InferCreateType, InferType, SchemaId } from "src/schema";
|
|
2
|
-
import { DbPluginBulkPersistEvent, EntityUpdateInfo } from "../plugins";
|
|
3
|
-
|
|
4
|
-
type DbEvent = {
|
|
5
|
-
type: "add",
|
|
6
|
-
data: InferCreateType<unknown>;
|
|
7
|
-
} | {
|
|
8
|
-
type: "update",
|
|
9
|
-
data: EntityUpdateInfo<unknown>;
|
|
10
|
-
} | {
|
|
11
|
-
type: "remove",
|
|
12
|
-
data: InferType<unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const toEventArray = (event: DbPluginBulkPersistEvent): [SchemaId, DbEvent][] => {
|
|
16
|
-
|
|
17
|
-
const result: [SchemaId, DbEvent][] = [];
|
|
18
|
-
for (const [schemaId, changes] of event.operation) {
|
|
19
|
-
|
|
20
|
-
if (changes.hasItems === false) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (changes.adds.length > 0) {
|
|
25
|
-
result.push(...changes.adds.map(add => {
|
|
26
|
-
return [schemaId as SchemaId, { data: { ...add }, type: "add" }] as [SchemaId, DbEvent];
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (changes.updates.length > 0) {
|
|
31
|
-
result.push(...changes.updates.map(update => {
|
|
32
|
-
return [schemaId as SchemaId, { data: { ...update }, type: "update" }] as [SchemaId, DbEvent];
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (changes.removes.length > 0) {
|
|
37
|
-
result.push(...changes.removes.map(remove => {
|
|
38
|
-
return [schemaId as SchemaId, { data: { ...remove }, type: "remove" }] as [SchemaId, DbEvent];
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return result
|
|
44
|
-
}
|
package/src/utilities/objects.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QueryOptionsCollection } from "../plugins/query";
|
|
2
|
-
|
|
3
|
-
export const combineQueryOptionsCollections = <T>(...collections: QueryOptionsCollection<T>[]) => {
|
|
4
|
-
const result = new QueryOptionsCollection<T>();
|
|
5
|
-
|
|
6
|
-
for (let i = 0, length = collections.length; i < length; i++) {
|
|
7
|
-
const collection = collections[i];
|
|
8
|
-
|
|
9
|
-
// Add scoped items first
|
|
10
|
-
collection.forEach(item => {
|
|
11
|
-
result.add(item.name, item.value);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BulkPersistResult, BulkPersistChanges } from "../collections";
|
|
2
|
-
import { DbPluginBulkPersistEvent } from "../plugins";
|
|
3
|
-
|
|
4
|
-
export const resolveBulkPersistChanges = (event: DbPluginBulkPersistEvent, result: BulkPersistResult, bulkPersistChanges: BulkPersistChanges) => {
|
|
5
|
-
// make sure we swap the adds here, that way we can make sure other persist events
|
|
6
|
-
// don't take their additions and try to change subsequent calls
|
|
7
|
-
for (const [schemaId, changes] of event.operation) {
|
|
8
|
-
|
|
9
|
-
const schemmaBulkPersistResult = result.get(schemaId);
|
|
10
|
-
const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);
|
|
11
|
-
|
|
12
|
-
// Set the original removes
|
|
13
|
-
schemaBulkPersistChanges.removes = changes.removes;
|
|
14
|
-
|
|
15
|
-
// Set the original updates
|
|
16
|
-
schemaBulkPersistChanges.updates = changes.updates;
|
|
17
|
-
|
|
18
|
-
// Take the adds from the result and set them to be persisted
|
|
19
|
-
// in the replicated plugins because the id's are set in the
|
|
20
|
-
// memory data store
|
|
21
|
-
schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;
|
|
22
|
-
}
|
|
23
|
-
}
|
package/src/utilities/runtime.ts
DELETED
package/src/utilities/strings.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const hash = (value: string, seed: number = 0) => {
|
|
2
|
-
// From Stack Overflow
|
|
3
|
-
// https://stackoverflow.com/a/52171480/3329760
|
|
4
|
-
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
5
|
-
|
|
6
|
-
for (let i = 0, ch: number; i < value.length; i++) {
|
|
7
|
-
ch = value.charCodeAt(i);
|
|
8
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
9
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
13
|
-
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
14
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
15
|
-
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
16
|
-
|
|
17
|
-
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
18
|
-
}
|
package/src/utilities/types.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type UnknownRecord = Record<string, unknown>;
|
package/src/utilities/uuid.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export const uuid = (length: number = 16): string => {
|
|
2
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
3
|
-
const charLength = chars.length;
|
|
4
|
-
let result = '';
|
|
5
|
-
|
|
6
|
-
for (let i = 0; i < length; i++) {
|
|
7
|
-
result += chars[Math.random() * charLength | 0];
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const HEX_CHARS = '0123456789abcdef';
|
|
13
|
-
const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
14
|
-
|
|
15
|
-
const hasCrypto =
|
|
16
|
-
typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
|
|
17
|
-
|
|
18
|
-
export const uuidv4 = (): string => {
|
|
19
|
-
let randomBytes: Uint8Array | null = null;
|
|
20
|
-
if (hasCrypto) {
|
|
21
|
-
randomBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let byteIndex = 0;
|
|
25
|
-
let uuid = '';
|
|
26
|
-
|
|
27
|
-
for (let i = 0; i < UUID_TEMPLATE.length; i++) {
|
|
28
|
-
const c = UUID_TEMPLATE[i];
|
|
29
|
-
if (c === '-') {
|
|
30
|
-
uuid += '-';
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let r: number;
|
|
35
|
-
if (hasCrypto && randomBytes) {
|
|
36
|
-
// Each byte gives two hex digits (nibbles)
|
|
37
|
-
r =
|
|
38
|
-
(i % 2 === 0
|
|
39
|
-
? randomBytes[byteIndex] >> 4
|
|
40
|
-
: randomBytes[byteIndex++] & 0x0f);
|
|
41
|
-
} else {
|
|
42
|
-
r = Math.floor(Math.random() * 16);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (c === 'x') {
|
|
46
|
-
uuid += HEX_CHARS[r];
|
|
47
|
-
} else if (c === 'y') {
|
|
48
|
-
// Variant bits: 8, 9, A, or B
|
|
49
|
-
uuid += HEX_CHARS[(r & 0x3) | 0x8];
|
|
50
|
-
} else if (c === '4') {
|
|
51
|
-
uuid += '4';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return uuid;
|
|
56
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"allowJs": true,
|
|
5
|
-
"allowSyntheticDefaultImports": true,
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"lib": [
|
|
8
|
-
"ESNext"
|
|
9
|
-
],
|
|
10
|
-
"target": "ESNext",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"noImplicitAny": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"outDir": "./dist",
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"esModuleInterop": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"resolveJsonModule": true
|
|
19
|
-
},
|
|
20
|
-
"include": [
|
|
21
|
-
"./src/**/*"
|
|
22
|
-
],
|
|
23
|
-
"exclude": [
|
|
24
|
-
"node_modules",
|
|
25
|
-
"dist",
|
|
26
|
-
"./src/__tests__/*"
|
|
27
|
-
]
|
|
28
|
-
}
|