@routier/core 0.0.1-alpha.1 → 0.0.1-alpha.3
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/ReadonlySchemaCollection.d.ts +17 -0
- package/dist/collections/SchemaCollection.d.ts +10 -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} +2 -1
- package/dist/collections/index.js +717 -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 +8589 -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 +2332 -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} +13 -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/dist/schema/communication/broadcast.d.ts +11 -0
- package/{src/schema/index.ts → dist/schema/index.d.ts} +1 -1
- package/dist/schema/index.js +4929 -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} +61 -101
- 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/dist/utilities/functions.d.ts +1 -0
- package/{src/utilities/index.ts → dist/utilities/index.d.ts} +2 -1
- package/dist/utilities/index.js +571 -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 +4 -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,211 +0,0 @@
|
|
|
1
|
-
import { DataTranslator } from "./DataTranslator";
|
|
2
|
-
import { QueryOption } from "../query/types";
|
|
3
|
-
import { assertIsArray } from "../../assertions";
|
|
4
|
-
import { ParamsFilter } from "../../expressions";
|
|
5
|
-
import { isDate } from "../../utilities";
|
|
6
|
-
|
|
7
|
-
export class JsonTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {
|
|
8
|
-
|
|
9
|
-
override filter<TResult>(data: unknown, option: QueryOption<TShape, "filter">): TResult {
|
|
10
|
-
|
|
11
|
-
assertIsArray(data);
|
|
12
|
-
|
|
13
|
-
if (option.value.filter) {
|
|
14
|
-
|
|
15
|
-
if (option.value.params == null) {
|
|
16
|
-
// standard filtering
|
|
17
|
-
return data.filter(option.value.filter) as TResult;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// params filtering
|
|
21
|
-
const selector = option.value.filter as ParamsFilter<unknown, {}>
|
|
22
|
-
return data.filter(w => selector([w, option.value.params])) as TResult;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return data as TResult;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override map<T>(data: unknown, option: QueryOption<T, "map">): T {
|
|
29
|
-
|
|
30
|
-
if (Array.isArray(data) == false) {
|
|
31
|
-
throw new Error("Can only map an array of data");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const response = [];
|
|
35
|
-
|
|
36
|
-
// We want deserialization to flow through mappings
|
|
37
|
-
// TODO: Speed this up!
|
|
38
|
-
// Generate a function on the fly?
|
|
39
|
-
for (let i = 0, length = data.length; i < length; i++) {
|
|
40
|
-
|
|
41
|
-
for (let j = 0, l = option.value.fields.length; j < l; j++) {
|
|
42
|
-
const field = option.value.fields[j];
|
|
43
|
-
|
|
44
|
-
if (field.property != null) {
|
|
45
|
-
const value = field.property.getValue(data[i]);
|
|
46
|
-
|
|
47
|
-
if (value != null) {
|
|
48
|
-
field.property.setValue(data[i], field.property.deserialize(value));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
response.push(option.value.selector(data[i]));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return response as T;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
override count<TResult extends number>(data: unknown, _: QueryOption<TShape, "count">): TResult {
|
|
60
|
-
|
|
61
|
-
if (Array.isArray(data)) {
|
|
62
|
-
return data.length as TResult;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
throw new Error("Cannot count resulting data, it must be an array. Please return array of data for function: count()");
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
override min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "min">): TResult {
|
|
69
|
-
return this._minMax(data, "min", (a: any, b: any) => a - b);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
override max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "max">): TResult {
|
|
73
|
-
return this._minMax(data, "max", (a: any, b: any) => b - a);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
override sort<TResult>(data: unknown, option: QueryOption<TShape, "sort">): TResult {
|
|
77
|
-
|
|
78
|
-
if (Array.isArray(data)) {
|
|
79
|
-
|
|
80
|
-
data.sort((a, b) => {
|
|
81
|
-
if (option.value.direction === "asc") {
|
|
82
|
-
return (option.value.selector(a) as any) - (option.value.selector(b) as any);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return (option.value.selector(b) as any) - (option.value.selector(a) as any);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return data as TResult;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
override sum<TResult extends number>(data: unknown, _: QueryOption<TShape, "sum">): TResult {
|
|
93
|
-
|
|
94
|
-
assertIsArray(data, this._formatDataNotArrayError("sum"));
|
|
95
|
-
|
|
96
|
-
const map = this.query.options.getLast("map");
|
|
97
|
-
|
|
98
|
-
let sum = 0;
|
|
99
|
-
const field = this._getSelectionField("sum", map);
|
|
100
|
-
|
|
101
|
-
for (let i = 0, length = data.length; i < length; i++) {
|
|
102
|
-
const value = data[i];
|
|
103
|
-
|
|
104
|
-
if (typeof value !== "number") {
|
|
105
|
-
throw new Error(`Cannot sum, property is not a number. Property: ${field.sourceName}`);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
sum += value;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return sum as TResult;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
override distinct<TResult>(data: unknown, _: QueryOption<TShape, "distinct">): TResult {
|
|
115
|
-
|
|
116
|
-
assertIsArray(data, this._formatDataNotArrayError("distinct"));
|
|
117
|
-
|
|
118
|
-
const result = new Set<string | number | Date>();
|
|
119
|
-
|
|
120
|
-
// would be nice to have property info here for type detection
|
|
121
|
-
let needsDateConversion = false;
|
|
122
|
-
|
|
123
|
-
for (let i = 0, length = data.length; i < length; i++) {
|
|
124
|
-
const value = data[i];
|
|
125
|
-
|
|
126
|
-
if (typeof value === "number" || typeof value === "string") {
|
|
127
|
-
result.add(value);
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (isDate(value)) {
|
|
132
|
-
needsDateConversion = true;
|
|
133
|
-
result.add(value.toISOString());
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (needsDateConversion) {
|
|
140
|
-
return [...result].map(w => new Date(w)) as TResult;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return [...result] as TResult
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
override skip<TResult>(data: unknown, option: QueryOption<TShape, "skip">): TResult {
|
|
147
|
-
|
|
148
|
-
if (Array.isArray(data)) {
|
|
149
|
-
|
|
150
|
-
if (option.value > 0) {
|
|
151
|
-
|
|
152
|
-
if (data.length < option.value) {
|
|
153
|
-
// We don't have enough data to skip, return an empty array
|
|
154
|
-
return [] as TResult;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return data.slice(option.value) as TResult;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return data as TResult;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return data as TResult;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
override take<TResult>(data: unknown, option: QueryOption<TShape, "take">): TResult {
|
|
167
|
-
if (Array.isArray(data)) {
|
|
168
|
-
|
|
169
|
-
if (option.value > 0) {
|
|
170
|
-
|
|
171
|
-
if (data.length < option.value) {
|
|
172
|
-
return data as TResult;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return data.slice(0, option.value) as TResult;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return data as TResult;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return data as TResult;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
private _getSelectionField(name: string, mapOption: QueryOption<TShape, "map"> | null) {
|
|
185
|
-
|
|
186
|
-
if (mapOption == null ||
|
|
187
|
-
mapOption.value.fields.length === 0 ||
|
|
188
|
-
mapOption.value.fields.length > 1) {
|
|
189
|
-
throw new Error(`${name}() operation can only be performed when one field is mapped for a result. Ex. myset.map(x => x.someNumberOrDateOrString).${name}()`)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return mapOption.value.fields[0];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private _minMax<T extends string | number | Date>(data: unknown, name: string, sort: (a: any, b: any) => any): T {
|
|
196
|
-
|
|
197
|
-
assertIsArray(data, this._formatDataNotArrayError(name));
|
|
198
|
-
|
|
199
|
-
data.sort(sort);
|
|
200
|
-
|
|
201
|
-
if (data.length === 0) {
|
|
202
|
-
throw new Error("Cannot perform operation on empty array, result query contains no data")
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return data[0] as T;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
private _formatDataNotArrayError(functionName: string) {
|
|
209
|
-
return `Cannot sum resulting data, it must be an array. Please return array of data for function: ${functionName}()`
|
|
210
|
-
}
|
|
211
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { QueryOption } from "../query/types";
|
|
2
|
-
import { DataTranslator } from "./DataTranslator";
|
|
3
|
-
|
|
4
|
-
export class SqlTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {
|
|
5
|
-
|
|
6
|
-
count<TResult extends number>(data: unknown, _: QueryOption<TShape, "count">): TResult {
|
|
7
|
-
return data as TResult;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "min">): TResult {
|
|
11
|
-
return data as TResult;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, "max">): TResult {
|
|
15
|
-
return data as TResult;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
sum<TResult extends number>(data: unknown, _: QueryOption<TShape, "sum">): TResult {
|
|
19
|
-
return data as TResult;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
distinct<TResult>(data: unknown, _: QueryOption<TShape, "distinct">): TResult {
|
|
23
|
-
return data as TResult;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
filter<TResult>(data: unknown, _: QueryOption<TShape, "filter">): TResult {
|
|
27
|
-
return data as TResult;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
skip(data: unknown, _: QueryOption<TShape, "skip">): TShape {
|
|
31
|
-
return data as TShape;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
take(data: unknown, _: QueryOption<TShape, "take">): TShape {
|
|
35
|
-
return data as TShape;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
sort(data: unknown, _: QueryOption<TShape, "sort">): TShape {
|
|
39
|
-
return data as TShape;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
map(data: unknown, _: QueryOption<TShape, "map">): TShape {
|
|
43
|
-
return data as TShape;
|
|
44
|
-
}
|
|
45
|
-
}
|
package/src/results/Result.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { PartialResultType, PluginEventPartialResultType, PluginEventResultType, ResultType } from "./types";
|
|
2
|
-
|
|
3
|
-
abstract class BaseResult {
|
|
4
|
-
static ERROR = "error" as const;
|
|
5
|
-
static SUCCESS = "success" as const;
|
|
6
|
-
static PARTIAL = "partial" as const;
|
|
7
|
-
|
|
8
|
-
static resolve<T>(result: ResultType<T> | PartialResultType<T>, resolve: (data: T) => void, reject: (error?: any) => void) {
|
|
9
|
-
if (result.ok === BaseResult.SUCCESS) {
|
|
10
|
-
resolve(result.data);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (result.ok === BaseResult.PARTIAL) {
|
|
15
|
-
reject({
|
|
16
|
-
partial: result.data,
|
|
17
|
-
error: result.error
|
|
18
|
-
});
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
reject(result.error);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static assertSuccess<T>(result: any): asserts result is { ok: "success"; data: T } {
|
|
26
|
-
if (result.ok !== BaseResult.SUCCESS) {
|
|
27
|
-
throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class Result extends BaseResult {
|
|
33
|
-
static success<T>(data: T): ResultType<T>;
|
|
34
|
-
static success<T>(): ResultType<never>;
|
|
35
|
-
static success<T>(data?: T): ResultType<T> {
|
|
36
|
-
return {
|
|
37
|
-
ok: Result.SUCCESS,
|
|
38
|
-
data
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static error<T>(error: any): ResultType<T> {
|
|
43
|
-
return {
|
|
44
|
-
ok: Result.ERROR,
|
|
45
|
-
error
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
static partial<T>(data: T, error: any): PartialResultType<T> {
|
|
50
|
-
return {
|
|
51
|
-
ok: Result.PARTIAL,
|
|
52
|
-
data,
|
|
53
|
-
error
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export class PluginEventResult extends BaseResult {
|
|
59
|
-
static success<T>(id: string, data: T): PluginEventResultType<T>;
|
|
60
|
-
static success<T>(id: string): PluginEventResultType<never>;
|
|
61
|
-
static success<T>(id: string, data?: T): PluginEventResultType<T> {
|
|
62
|
-
return {
|
|
63
|
-
id,
|
|
64
|
-
ok: Result.SUCCESS,
|
|
65
|
-
data
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static error<T>(id: string, error: any): PluginEventResultType<T> {
|
|
70
|
-
return {
|
|
71
|
-
id,
|
|
72
|
-
ok: Result.ERROR,
|
|
73
|
-
error
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
static partial<T>(id: string, data: T, error: any): PluginEventPartialResultType<T> {
|
|
78
|
-
return {
|
|
79
|
-
id,
|
|
80
|
-
ok: Result.PARTIAL,
|
|
81
|
-
data,
|
|
82
|
-
error
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static assertSuccess<T>(result: PluginEventResultType<T>): asserts result is { ok: "success"; data: T; id: string } {
|
|
87
|
-
if (result.ok !== Result.SUCCESS) {
|
|
88
|
-
throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
package/src/results/utils.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Result } from "./Result";
|
|
2
|
-
import { CallbackResult } from "./types";
|
|
3
|
-
|
|
4
|
-
export function toPromise<T>(fn: (callback: CallbackResult<T>) => void) {
|
|
5
|
-
return new Promise<T>((resolve, reject) => {
|
|
6
|
-
fn((r) => {
|
|
7
|
-
if (r.ok === Result.ERROR) {
|
|
8
|
-
reject(r.error);
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
resolve(r.data);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}
|