@contember/binding 1.0.3 → 1.1.0-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/development/accessorPropagation/useEntityListSubTree.js +4 -2
- package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useEntitySubTree.js +4 -2
- package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.js +25 -0
- package/dist/development/accessorPropagation/useExtendTree.js.map +1 -0
- package/dist/development/accessorTree/AccessorTree.js +9 -4
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/AccessorTreeStateContext.js +6 -0
- package/dist/development/accessorTree/AccessorTreeStateContext.js.map +1 -0
- package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +17 -4
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/useAccessorTreeState.js +5 -0
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -0
- package/dist/development/accessors/EntityAccessor.js +0 -32
- package/dist/development/accessors/EntityAccessor.js.map +1 -1
- package/dist/development/accessors/EntityListAccessor.js +1 -1
- package/dist/development/accessors/EntityListAccessor.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +3 -0
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/DataBinding.js +11 -23
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/DirtinessTracker.js +4 -13
- package/dist/development/core/DirtinessTracker.js.map +1 -1
- package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/development/core/EventManager.js +12 -7
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/MarkerComparator.js +1 -1
- package/dist/development/core/MarkerMerger.js +1 -4
- package/dist/development/core/MarkerMerger.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +100 -94
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/RequestResponseNormalizer.js +27 -31
- package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/development/core/StateInitializer.js +23 -26
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js +10 -10
- package/dist/development/core/TreeAugmenter.js.map +1 -1
- package/dist/development/core/TreeFilterGenerator.js +2 -2
- package/dist/development/core/TreeFilterGenerator.js.map +1 -1
- package/dist/development/core/TreeStore.js +3 -3
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/VariableInputTransformer.js +4 -1
- package/dist/development/core/VariableInputTransformer.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.js +13 -12
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/FieldOperations.js +2 -2
- package/dist/development/core/operations/FieldOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +3 -3
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/operations/OperationsHelpers.js +2 -2
- package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js +5 -3
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/core/schema/Schema.js +3 -0
- package/dist/development/core/schema/Schema.js.map +1 -1
- package/dist/development/core/schema/SchemaPreprocessor.js +1 -1
- package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +4 -12
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +4 -22
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.js +5 -1
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.js +3 -5
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.js +3 -5
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/dao/Environment.js +147 -94
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/TreeNodeEnvironmentFactory.js +159 -0
- package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -0
- package/dist/development/helperComponents/If.js +39 -0
- package/dist/development/helperComponents/If.js.map +1 -0
- package/dist/development/helperComponents/SugaredField.js +1 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js +38 -0
- package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -0
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +41 -0
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -0
- package/dist/development/helperComponents/helpers/evaluateCondition.js +46 -0
- package/dist/development/helperComponents/helpers/evaluateCondition.js.map +1 -0
- package/dist/development/index.js +4 -1
- package/dist/development/index.js.map +1 -1
- package/dist/development/queryLanguage/MarkerFactory.js +4 -3
- package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js +18 -6
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/production/accessorPropagation/useEntityListSubTree.js +4 -2
- package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useEntitySubTree.js +4 -2
- package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.js +25 -0
- package/dist/production/accessorPropagation/useExtendTree.js.map +1 -0
- package/dist/production/accessorTree/AccessorTree.js +9 -4
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/AccessorTreeStateContext.js +6 -0
- package/dist/production/accessorTree/AccessorTreeStateContext.js.map +1 -0
- package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +17 -4
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/useAccessorTreeState.js +5 -0
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -0
- package/dist/production/accessors/EntityAccessor.js +0 -32
- package/dist/production/accessors/EntityAccessor.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js +1 -1
- package/dist/production/accessors/EntityListAccessor.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.js +3 -0
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/DataBinding.js +11 -14
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/DirtinessTracker.js +4 -13
- package/dist/production/core/DirtinessTracker.js.map +1 -1
- package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
- package/dist/production/core/EventManager.js +11 -6
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/MarkerComparator.js +1 -1
- package/dist/production/core/MarkerMerger.js +1 -4
- package/dist/production/core/MarkerMerger.js.map +1 -1
- package/dist/production/core/MutationGenerator.js +100 -94
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/RequestResponseNormalizer.js +27 -31
- package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
- package/dist/production/core/StateInitializer.js +23 -26
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js +10 -10
- package/dist/production/core/TreeAugmenter.js.map +1 -1
- package/dist/production/core/TreeFilterGenerator.js +2 -2
- package/dist/production/core/TreeFilterGenerator.js.map +1 -1
- package/dist/production/core/TreeStore.js +3 -3
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/VariableInputTransformer.js +4 -1
- package/dist/production/core/VariableInputTransformer.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.js +13 -12
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/FieldOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js +3 -3
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/operations/OperationsHelpers.js +2 -2
- package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js +5 -3
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/core/schema/Schema.js +3 -0
- package/dist/production/core/schema/Schema.js.map +1 -1
- package/dist/production/core/schema/SchemaPreprocessor.js +1 -1
- package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
- package/dist/production/coreComponents/EntityListSubTree.js +4 -12
- package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/coreComponents/EntitySubTree.js +4 -22
- package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/coreComponents/Field.js +5 -1
- package/dist/production/coreComponents/Field.js.map +1 -1
- package/dist/production/coreComponents/HasMany.js +3 -5
- package/dist/production/coreComponents/HasMany.js.map +1 -1
- package/dist/production/coreComponents/HasOne.js +3 -5
- package/dist/production/coreComponents/HasOne.js.map +1 -1
- package/dist/production/dao/Environment.js +147 -94
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/TreeNodeEnvironmentFactory.js +159 -0
- package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -0
- package/dist/production/helperComponents/If.js +39 -0
- package/dist/production/helperComponents/If.js.map +1 -0
- package/dist/production/helperComponents/SugaredField.js +1 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js +38 -0
- package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -0
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +41 -0
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -0
- package/dist/production/helperComponents/helpers/evaluateCondition.js +46 -0
- package/dist/production/helperComponents/helpers/evaluateCondition.js.map +1 -0
- package/dist/production/index.js +4 -1
- package/dist/production/index.js.map +1 -1
- package/dist/production/queryLanguage/MarkerFactory.js +4 -3
- package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js +15 -6
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/types/accessorPropagation/index.d.ts +1 -0
- package/dist/types/accessorPropagation/index.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntityListSubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useEntityListSubTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts +2 -1
- package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
- package/dist/types/accessorPropagation/useExtendTree.d.ts +5 -0
- package/dist/types/accessorPropagation/useExtendTree.d.ts.map +1 -0
- package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +4 -0
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -0
- package/dist/types/accessorTree/MutationRequestResponse.d.ts +5 -1
- package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts +4 -4
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -1
- package/dist/types/accessorTree/PersistResult.d.ts +2 -1
- package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
- package/dist/types/accessorTree/QueryRequestResponse.d.ts +11 -10
- package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/RuntimeId.d.ts +16 -6
- package/dist/types/accessorTree/RuntimeId.d.ts.map +1 -1
- package/dist/types/accessorTree/index.d.ts +1 -0
- package/dist/types/accessorTree/index.d.ts.map +1 -1
- package/dist/types/accessorTree/useAccessorTreeState.d.ts +2 -0
- package/dist/types/accessorTree/useAccessorTreeState.d.ts.map +1 -0
- package/dist/types/accessors/EntityAccessor.d.ts +1 -3
- package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
- package/dist/types/accessors/EntityListAccessor.d.ts +2 -2
- package/dist/types/accessors/EntityListAccessor.d.ts.map +1 -1
- package/dist/types/core/AccessorErrorManager.d.ts.map +1 -1
- package/dist/types/core/DataBinding.d.ts.map +1 -1
- package/dist/types/core/DirtinessTracker.d.ts +2 -5
- package/dist/types/core/DirtinessTracker.d.ts.map +1 -1
- package/dist/types/core/ErrorsPreprocessor.d.ts +2 -2
- package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -1
- package/dist/types/core/EventManager.d.ts +1 -1
- package/dist/types/core/EventManager.d.ts.map +1 -1
- package/dist/types/core/MarkerMerger.d.ts.map +1 -1
- package/dist/types/core/MutationGenerator.d.ts.map +1 -1
- package/dist/types/core/RequestResponseNormalizer.d.ts.map +1 -1
- package/dist/types/core/StateInitializer.d.ts +1 -5
- package/dist/types/core/StateInitializer.d.ts.map +1 -1
- package/dist/types/core/TreeStore.d.ts +3 -3
- package/dist/types/core/TreeStore.d.ts.map +1 -1
- package/dist/types/core/VariableInputTransformer.d.ts.map +1 -1
- package/dist/types/core/operations/EntityOperations.d.ts.map +1 -1
- package/dist/types/core/operations/ListOperations.d.ts +2 -1
- package/dist/types/core/operations/ListOperations.d.ts.map +1 -1
- package/dist/types/core/requestAliases/MutationAlias.d.ts.map +1 -1
- package/dist/types/core/schema/RawSchemaEntity.d.ts +3 -2
- package/dist/types/core/schema/RawSchemaEntity.d.ts.map +1 -1
- package/dist/types/core/schema/Schema.d.ts +2 -0
- package/dist/types/core/schema/Schema.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaEntity.d.ts +1 -1
- package/dist/types/core/schema/SchemaEntity.d.ts.map +1 -1
- package/dist/types/core/schema/index.d.ts +0 -1
- package/dist/types/core/schema/index.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/Field.d.ts.map +1 -1
- package/dist/types/coreComponents/HasMany.d.ts +1 -1
- package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
- package/dist/types/coreComponents/HasOne.d.ts +1 -1
- package/dist/types/coreComponents/HasOne.d.ts.map +1 -1
- package/dist/types/dao/Environment.d.ts +81 -42
- package/dist/types/dao/Environment.d.ts.map +1 -1
- package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts +19 -0
- package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -0
- package/dist/types/helperComponents/If.d.ts +14 -0
- package/dist/types/helperComponents/If.d.ts.map +1 -0
- package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts +9 -0
- package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts.map +1 -0
- package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts +10 -0
- package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts.map +1 -0
- package/dist/types/helperComponents/helpers/evaluateCondition.d.ts +4 -0
- package/dist/types/helperComponents/helpers/evaluateCondition.d.ts.map +1 -0
- package/dist/types/helperComponents/index.d.ts +1 -0
- package/dist/types/helperComponents/index.d.ts.map +1 -1
- package/dist/types/queryLanguage/MarkerFactory.d.ts.map +1 -1
- package/dist/types/queryLanguage/Parser.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/EntityId.d.ts +1 -1
- package/dist/types/treeParameters/primitives/EntityId.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/src/accessorPropagation/index.ts +1 -0
- package/src/accessorPropagation/useEntityListSubTree.ts +8 -1
- package/src/accessorPropagation/useEntitySubTree.ts +8 -1
- package/src/accessorPropagation/useExtendTree.ts +28 -0
- package/src/accessorTree/AccessorTree.tsx +18 -12
- package/src/accessorTree/AccessorTreeStateContext.ts +6 -0
- package/src/accessorTree/MutationRequestResponse.ts +3 -1
- package/src/accessorTree/NormalizedPersistedData.ts +4 -4
- package/src/accessorTree/PersistResult.ts +2 -1
- package/src/accessorTree/QueryRequestResponse.ts +17 -14
- package/src/accessorTree/RuntimeId.ts +27 -6
- package/src/accessorTree/index.ts +1 -0
- package/src/accessorTree/useAccessorTreeState.ts +4 -0
- package/src/accessors/EntityAccessor.ts +2 -51
- package/src/accessors/EntityListAccessor.ts +3 -3
- package/src/core/AccessorErrorManager.ts +3 -0
- package/src/core/DataBinding.ts +11 -33
- package/src/core/DirtinessTracker.ts +4 -16
- package/src/core/ErrorsPreprocessor.ts +2 -2
- package/src/core/EventManager.ts +14 -8
- package/src/core/MarkerMerger.ts +1 -4
- package/src/core/MutationGenerator.ts +137 -130
- package/src/core/RequestResponseNormalizer.ts +37 -38
- package/src/core/StateInitializer.ts +35 -42
- package/src/core/TreeAugmenter.ts +11 -11
- package/src/core/TreeFilterGenerator.ts +5 -5
- package/src/core/TreeStore.ts +12 -6
- package/src/core/VariableInputTransformer.ts +7 -4
- package/src/core/operations/EntityOperations.ts +12 -13
- package/src/core/operations/FieldOperations.ts +2 -2
- package/src/core/operations/ListOperations.ts +6 -5
- package/src/core/operations/OperationsHelpers.ts +2 -2
- package/src/core/requestAliases/MutationAlias.ts +5 -3
- package/src/core/schema/RawSchemaEntity.ts +1 -2
- package/src/core/schema/Schema.ts +5 -0
- package/src/core/schema/SchemaEntity.ts +1 -1
- package/src/core/schema/SchemaPreprocessor.ts +1 -1
- package/src/core/schema/index.ts +0 -1
- package/src/coreComponents/EntityListSubTree.tsx +5 -16
- package/src/coreComponents/EntitySubTree.tsx +17 -32
- package/src/coreComponents/Field.tsx +4 -0
- package/src/coreComponents/HasMany.tsx +4 -6
- package/src/coreComponents/HasOne.tsx +6 -7
- package/src/dao/Environment.ts +221 -126
- package/src/dao/TreeNodeEnvironmentFactory.ts +228 -0
- package/src/helperComponents/If.tsx +71 -0
- package/src/helperComponents/helpers/FilterEvaluator.ts +48 -0
- package/src/helperComponents/helpers/FilterFieldsCollector.ts +49 -0
- package/src/helperComponents/helpers/evaluateCondition.ts +52 -0
- package/src/helperComponents/index.ts +1 -0
- package/src/queryLanguage/MarkerFactory.ts +5 -3
- package/src/queryLanguage/Parser.ts +24 -11
- package/src/treeParameters/primitives/EntityId.ts +1 -1
- package/dist/development/core/schema/SchemaValidator.js +0 -116
- package/dist/development/core/schema/SchemaValidator.js.map +0 -1
- package/dist/types/core/schema/SchemaValidator.d.ts +0 -14
- package/dist/types/core/schema/SchemaValidator.d.ts.map +0 -1
- package/src/core/schema/SchemaValidator.ts +0 -238
|
@@ -8,14 +8,15 @@ import {
|
|
|
8
8
|
} from '../accessorPropagation'
|
|
9
9
|
import { NIL_UUID, PRIMARY_KEY_NAME } from '../bindingTypes'
|
|
10
10
|
import { Environment } from '../dao'
|
|
11
|
-
import { MarkerFactory } from '../queryLanguage'
|
|
11
|
+
import { MarkerFactory, QueryLanguage } from '../queryLanguage'
|
|
12
12
|
import type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'
|
|
13
13
|
import { Component } from './Component'
|
|
14
14
|
import { EntityList, EntityListBaseProps } from './EntityList'
|
|
15
15
|
import { Field } from './Field'
|
|
16
|
+
import { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'
|
|
16
17
|
|
|
17
18
|
export interface EntityListSubTreeAdditionalProps {
|
|
18
|
-
variables?: Environment.
|
|
19
|
+
variables?: Environment.ValuesMapWithFactory
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export type EntityListSubTreeProps<ListProps, EntityProps> = {
|
|
@@ -65,20 +66,8 @@ export const EntityListSubTree = Component(
|
|
|
65
66
|
</EntityList>
|
|
66
67
|
),
|
|
67
68
|
generateEnvironment: (props, oldEnvironment) => {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
? oldEnvironment
|
|
71
|
-
: oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))
|
|
72
|
-
|
|
73
|
-
if (newEnvironment.hasName('rootWhere') || newEnvironment.hasName('rootWhereAsFilter')) {
|
|
74
|
-
return newEnvironment
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const rootWhere = { id: NIL_UUID } as const
|
|
78
|
-
return newEnvironment.putDelta({
|
|
79
|
-
rootWhere,
|
|
80
|
-
rootWhereAsFilter: whereToFilter(rootWhere),
|
|
81
|
-
})
|
|
69
|
+
const environment = oldEnvironment.withVariables(props.variables)
|
|
70
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)
|
|
82
71
|
},
|
|
83
72
|
},
|
|
84
73
|
'EntityListSubTree',
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { whereToFilter } from '@contember/client'
|
|
2
1
|
import { useConstantValueInvariant } from '@contember/react-utils'
|
|
3
2
|
import { ReactElement, ReactNode, useCallback } from 'react'
|
|
4
3
|
import { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'
|
|
5
4
|
import { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'
|
|
6
|
-
import {
|
|
5
|
+
import { PRIMARY_KEY_NAME } from '../bindingTypes'
|
|
7
6
|
import { Environment } from '../dao'
|
|
8
|
-
import { MarkerFactory
|
|
7
|
+
import { MarkerFactory } from '../queryLanguage'
|
|
9
8
|
import type {
|
|
10
9
|
SugaredQualifiedSingleEntity,
|
|
11
10
|
SugaredUnconstrainedQualifiedSingleEntity,
|
|
@@ -14,18 +13,25 @@ import type {
|
|
|
14
13
|
import { Component } from './Component'
|
|
15
14
|
import { Entity } from './Entity'
|
|
16
15
|
import { Field } from './Field'
|
|
16
|
+
import { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'
|
|
17
17
|
|
|
18
18
|
export interface EntitySubTreeAdditionalProps {
|
|
19
|
-
variables?: Environment.
|
|
19
|
+
variables?: Environment.ValuesMapWithFactory
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps
|
|
23
23
|
|
|
24
|
-
export type EntitySubTreeProps<EntityProps> =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
export type EntitySubTreeProps<EntityProps> =
|
|
25
|
+
& {
|
|
26
|
+
treeRootId?: TreeRootId
|
|
27
|
+
children?: ReactNode
|
|
28
|
+
}
|
|
29
|
+
& EntitySubTreeAdditionalProps
|
|
30
|
+
& (
|
|
31
|
+
| SugaredQualifiedSingleEntity
|
|
32
|
+
| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)
|
|
33
|
+
)
|
|
34
|
+
|
|
29
35
|
export const EntitySubTree = Component(
|
|
30
36
|
<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {
|
|
31
37
|
useConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')
|
|
@@ -69,29 +75,8 @@ export const EntitySubTree = Component(
|
|
|
69
75
|
</>
|
|
70
76
|
),
|
|
71
77
|
generateEnvironment: (props, oldEnvironment) => {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
? oldEnvironment
|
|
75
|
-
: oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))
|
|
76
|
-
|
|
77
|
-
if (newEnvironment.hasName('rootWhere') || newEnvironment.hasName('rootWhereAsFilter')) {
|
|
78
|
-
return newEnvironment
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (props.isCreating) {
|
|
82
|
-
const rootWhere = { id: NIL_UUID } as const
|
|
83
|
-
return newEnvironment.putDelta({
|
|
84
|
-
rootWhere,
|
|
85
|
-
rootWhereAsFilter: whereToFilter(rootWhere),
|
|
86
|
-
rootShouldExists: 'no',
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
const qualifiedSingleEntity = QueryLanguage.desugarQualifiedSingleEntity(props, newEnvironment, { missingSetOnCreate: 'fill' })
|
|
90
|
-
return newEnvironment.putDelta({
|
|
91
|
-
rootWhere: qualifiedSingleEntity.where,
|
|
92
|
-
rootWhereAsFilter: whereToFilter(qualifiedSingleEntity.where),
|
|
93
|
-
rootShouldExists: qualifiedSingleEntity.setOnCreate ? 'maybe' : 'yes',
|
|
94
|
-
})
|
|
78
|
+
const environment = oldEnvironment.withVariables(props.variables)
|
|
79
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)
|
|
95
80
|
},
|
|
96
81
|
},
|
|
97
82
|
'EntitySubTree',
|
|
@@ -4,6 +4,7 @@ import { useField } from '../accessorPropagation'
|
|
|
4
4
|
import { MarkerFactory } from '../queryLanguage'
|
|
5
5
|
import type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'
|
|
6
6
|
import { Component } from './Component'
|
|
7
|
+
import { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'
|
|
7
8
|
|
|
8
9
|
export interface FieldBasicProps extends SugaredRelativeSingleField {}
|
|
9
10
|
|
|
@@ -34,6 +35,9 @@ export const Field = Component(
|
|
|
34
35
|
},
|
|
35
36
|
{
|
|
36
37
|
generateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),
|
|
38
|
+
generateEnvironment: (props, environment) => {
|
|
39
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)
|
|
40
|
+
},
|
|
37
41
|
},
|
|
38
42
|
'Field',
|
|
39
43
|
) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement
|
|
@@ -5,13 +5,13 @@ import { Environment } from '../dao'
|
|
|
5
5
|
import { MarkerFactory } from '../queryLanguage'
|
|
6
6
|
import type { SugaredRelativeEntityList } from '../treeParameters'
|
|
7
7
|
import { Component } from './Component'
|
|
8
|
-
import type { EntityBaseProps } from './Entity'
|
|
9
8
|
import { EntityList, EntityListBaseProps } from './EntityList'
|
|
10
9
|
import { Field } from './Field'
|
|
10
|
+
import { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'
|
|
11
11
|
|
|
12
12
|
export type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {
|
|
13
13
|
children?: ReactNode
|
|
14
|
-
variables?: Environment.
|
|
14
|
+
variables?: Environment.ValuesMapWithFactory
|
|
15
15
|
} & (
|
|
16
16
|
| {}
|
|
17
17
|
| {
|
|
@@ -28,10 +28,8 @@ export const HasMany = Component(
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
generateEnvironment: (props, oldEnvironment) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))
|
|
31
|
+
const environment = oldEnvironment.withVariables(props.variables)
|
|
32
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)
|
|
35
33
|
},
|
|
36
34
|
staticRender: props => (
|
|
37
35
|
<EntityList {...props} accessor={undefined as any}>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react'
|
|
2
2
|
import { useEntity } from '../accessorPropagation'
|
|
3
3
|
import { PRIMARY_KEY_NAME } from '../bindingTypes'
|
|
4
4
|
import { Environment } from '../dao'
|
|
5
5
|
import { MarkerFactory } from '../queryLanguage'
|
|
6
6
|
import type { SugaredRelativeSingleEntity } from '../treeParameters'
|
|
7
7
|
import { Component } from './Component'
|
|
8
|
-
import { Entity
|
|
8
|
+
import { Entity } from './Entity'
|
|
9
9
|
import { Field } from './Field'
|
|
10
|
+
import { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'
|
|
10
11
|
|
|
11
12
|
export type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {
|
|
12
13
|
children?: ReactNode
|
|
13
|
-
variables?: Environment.
|
|
14
|
+
variables?: Environment.ValuesMapWithFactory
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const HasOne = Component(
|
|
@@ -21,10 +22,8 @@ export const HasOne = Component(
|
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
generateEnvironment: (props, oldEnvironment) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))
|
|
25
|
+
const environment = oldEnvironment.withVariables(props.variables)
|
|
26
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)
|
|
28
27
|
},
|
|
29
28
|
staticRender: props => (
|
|
30
29
|
<Entity {...props} accessor={undefined as any}>
|
package/src/dao/Environment.ts
CHANGED
|
@@ -1,201 +1,296 @@
|
|
|
1
1
|
import type { ReactNode } from 'react'
|
|
2
|
-
import
|
|
2
|
+
import { BindingError } from '../BindingError'
|
|
3
|
+
import type { Filter } from '../treeParameters'
|
|
4
|
+
import equal from 'fast-deep-equal/es6'
|
|
5
|
+
import { Schema, SchemaColumn, SchemaEntity, SchemaRelation } from '../core/schema'
|
|
3
6
|
|
|
4
7
|
class Environment {
|
|
5
|
-
private
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.names = {
|
|
9
|
-
...Environment.defaultNameStore,
|
|
10
|
-
...names,
|
|
11
|
-
}
|
|
8
|
+
private constructor(
|
|
9
|
+
private readonly options: Environment.Options,
|
|
10
|
+
) {
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
public static create(
|
|
13
|
+
public static create() {
|
|
15
14
|
return new Environment({
|
|
16
|
-
...Environment.defaultSystemVariables,
|
|
17
15
|
dimensions: {},
|
|
18
|
-
|
|
16
|
+
variables: {},
|
|
17
|
+
parameters: {},
|
|
18
|
+
})
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
public
|
|
22
|
-
|
|
21
|
+
public getSubTree(): Environment.SubTreeNode {
|
|
22
|
+
for (let env: Environment = this; env.options.node; env = env.getParent()) {
|
|
23
|
+
const node = env.options.node
|
|
24
|
+
if (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {
|
|
25
|
+
return node
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
throw new BindingError('Not in a SubTree')
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
public
|
|
26
|
-
|
|
31
|
+
public getSubTreeNode(): Environment.AnyNode {
|
|
32
|
+
if (!this.options.node) {
|
|
33
|
+
throw new BindingError()
|
|
34
|
+
}
|
|
35
|
+
return this.options.node
|
|
27
36
|
}
|
|
28
37
|
|
|
29
|
-
public
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
return this.names[name] as V
|
|
38
|
+
public withSubTree(SubTree: Environment.SubTreeNode) {
|
|
39
|
+
const { parent, ...options } = this.options
|
|
40
|
+
return new Environment({
|
|
41
|
+
...options,
|
|
42
|
+
node: SubTree,
|
|
43
|
+
})
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
public
|
|
40
|
-
if (!this.
|
|
41
|
-
|
|
46
|
+
public withSubTreeChild(node: Environment.InnerNode) {
|
|
47
|
+
if (!this.options.node) {
|
|
48
|
+
throw new BindingError(`Cannot call withSubTreeChild without previous call of withSubTree`)
|
|
42
49
|
}
|
|
43
|
-
|
|
50
|
+
if (this.options.node.entity.fields.get(node.field.name) !== node.field) {
|
|
51
|
+
throw new BindingError()
|
|
52
|
+
}
|
|
53
|
+
return new Environment({
|
|
54
|
+
...this.options,
|
|
55
|
+
node,
|
|
56
|
+
parent: this,
|
|
57
|
+
})
|
|
44
58
|
}
|
|
45
59
|
|
|
46
|
-
public getValue<V extends Environment.Value = Environment.Value>(name: keyof Environment.NameStore): V {
|
|
47
|
-
return this.names[name] as V
|
|
48
|
-
}
|
|
49
60
|
|
|
50
|
-
public
|
|
51
|
-
return this.
|
|
61
|
+
public hasVariable(key: string): boolean {
|
|
62
|
+
return key in this.options.variables
|
|
52
63
|
}
|
|
53
64
|
|
|
54
|
-
public
|
|
55
|
-
|
|
65
|
+
public getVariable<V extends Environment.Value = Environment.Value>(key: string): V {
|
|
66
|
+
if (!(key in this.options.variables)) {
|
|
67
|
+
throw new BindingError(`Variable ${key} not found`)
|
|
68
|
+
}
|
|
69
|
+
return this.options.variables[key] as V
|
|
56
70
|
}
|
|
57
71
|
|
|
58
|
-
public
|
|
59
|
-
return
|
|
72
|
+
public getVariableOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {
|
|
73
|
+
return (this.options.variables[key] as V) ?? fallback
|
|
60
74
|
}
|
|
61
75
|
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
/** @deprecated use getVariable or getParameter */
|
|
77
|
+
public getValue<V extends Environment.Value = Environment.Value>(key: string): V {
|
|
78
|
+
console.warn('Environment.getValue() is deprecated, use Environment.getVariable() or Environment.getParameter() instead.')
|
|
79
|
+
return this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, undefined) as V
|
|
64
80
|
}
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[name]: value,
|
|
71
|
-
})
|
|
82
|
+
/** @deprecated use getVariableOrElse or getParameterOrElse */
|
|
83
|
+
public getValueOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {
|
|
84
|
+
console.warn('Environment.getValueOrElse() is deprecated, use Environment.getVariableOrElse() or Environment.getParameterOrElse() instead.')
|
|
85
|
+
return this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, fallback) as V | F
|
|
72
86
|
}
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return this.putName(name, value)
|
|
88
|
+
/** @deprecated */
|
|
89
|
+
public hasName(key: string): boolean {
|
|
90
|
+
console.warn('Environment.hasName() is deprecated, use Environment.hasVariable() or Environment.hasParameter() instead.')
|
|
91
|
+
return key in this.options.variables || key in this.options.parameters
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
public
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
public withVariables(variables: Environment.ValuesMapWithFactory | undefined): Environment {
|
|
95
|
+
if (variables === undefined) {
|
|
96
|
+
return this
|
|
97
|
+
}
|
|
98
|
+
const newVariables = { ...this.options.variables }
|
|
99
|
+
for (const [newName, newValue] of Object.entries(variables)) {
|
|
100
|
+
if (newName === 'labelMiddleware') {
|
|
101
|
+
throw new BindingError('You cannot pass labelMiddleware to withVariables method. Use withLabelMiddleware instead.')
|
|
102
|
+
}
|
|
103
|
+
const resolvedValue = typeof newValue === 'function' ? newValue(this) : newValue
|
|
104
|
+
if (resolvedValue === undefined) {
|
|
105
|
+
delete newVariables[newName]
|
|
88
106
|
} else {
|
|
89
|
-
|
|
107
|
+
newVariables[newName] = resolvedValue
|
|
90
108
|
}
|
|
91
109
|
}
|
|
110
|
+
return new Environment({ ...this.options, variables: newVariables })
|
|
111
|
+
}
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
public hasParameter(key: string): boolean {
|
|
114
|
+
return key in this.options.parameters
|
|
94
115
|
}
|
|
95
116
|
|
|
96
|
-
public
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
): Environment {
|
|
100
|
-
const normalizedDimensions: Environment.NameStore['dimensions'] = {
|
|
101
|
-
...defaultDimensions,
|
|
102
|
-
...dimensions,
|
|
117
|
+
public getParameter<F>(key: string): string | number {
|
|
118
|
+
if (!(key in this.options.parameters)) {
|
|
119
|
+
throw new BindingError(`Parameter ${key} not found`)
|
|
103
120
|
}
|
|
121
|
+
return this.options.parameters[key] as string | number
|
|
122
|
+
}
|
|
104
123
|
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
? this
|
|
108
|
-
: new Environment({
|
|
109
|
-
...this.names,
|
|
110
|
-
dimensions: { ...normalizedDimensions },
|
|
111
|
-
})
|
|
124
|
+
public getParameterOrElse<F>(key: string, fallback: F): string | number | F {
|
|
125
|
+
return this.options.parameters[key] ?? fallback
|
|
112
126
|
}
|
|
113
127
|
|
|
114
|
-
public static generateDelta(
|
|
115
|
-
currentEnvironment: Environment,
|
|
116
|
-
delta: Environment.DeltaFactory,
|
|
117
|
-
): Partial<Environment.NameStore> {
|
|
118
|
-
const newDelta: Partial<Environment.NameStore> = {}
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
public withParameters(parameters: Environment.Parameters): Environment {
|
|
130
|
+
return new Environment({ ...this.options, parameters })
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public hasDimension(dimensionName: string): boolean {
|
|
134
|
+
return dimensionName in this.options.dimensions
|
|
135
|
+
}
|
|
122
136
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
!Environment.systemVariableNames.has(name as Environment.SystemVariableName)
|
|
127
|
-
? value(currentEnvironment)
|
|
128
|
-
: delta[name]
|
|
137
|
+
public getDimension<F>(dimensionName: string): string[] {
|
|
138
|
+
if (!(dimensionName in this.options.dimensions)) {
|
|
139
|
+
throw new BindingError(`Dimension ${dimensionName} does not exist.`)
|
|
129
140
|
}
|
|
141
|
+
return this.options.dimensions[dimensionName]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public getDimensionOrElse<F>(dimensionName: string, fallback: F): string[] | F {
|
|
145
|
+
return this.options.dimensions[dimensionName] ?? fallback
|
|
146
|
+
}
|
|
130
147
|
|
|
131
|
-
|
|
148
|
+
public getAllDimensions(): Environment.SelectedDimensions {
|
|
149
|
+
return this.options.dimensions
|
|
132
150
|
}
|
|
133
151
|
|
|
134
|
-
public
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const middleware: Environment.SystemMiddleware[N] = this.names[name]
|
|
139
|
-
if (typeof middleware === 'function') {
|
|
140
|
-
return (middleware as (...args: A) => any)(...args)
|
|
152
|
+
public withDimensions(dimensions: Environment.SelectedDimensions): Environment {
|
|
153
|
+
const newDimensions = {
|
|
154
|
+
...this.options.dimensions,
|
|
155
|
+
...dimensions,
|
|
141
156
|
}
|
|
142
|
-
|
|
157
|
+
if (equal(newDimensions, this.options.dimensions)) {
|
|
158
|
+
return this
|
|
159
|
+
}
|
|
160
|
+
return new Environment({ ...this.options, dimensions: newDimensions })
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public getSchema(): Schema {
|
|
164
|
+
if (!this.options.schema) {
|
|
165
|
+
throw new BindingError('Schema is not set')
|
|
166
|
+
}
|
|
167
|
+
return this.options.schema
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public withSchema(schema: Schema): Environment {
|
|
171
|
+
return new Environment({ ...this.options, schema })
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public getParent(): Environment {
|
|
175
|
+
if (!this.options.parent) {
|
|
176
|
+
throw new BindingError('There is no parent environment')
|
|
177
|
+
}
|
|
178
|
+
return this.options.parent
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public merge(other: Environment): Environment {
|
|
182
|
+
if (other === this) {
|
|
183
|
+
return this
|
|
184
|
+
}
|
|
185
|
+
if (!equal(this.options.node, other.options.node)) {
|
|
186
|
+
throw new BindingError(`Cannot merge two environments with different tree position.`)
|
|
187
|
+
}
|
|
188
|
+
if (this.options.parameters !== other.options.parameters) {
|
|
189
|
+
throw new BindingError(`Cannot merge two environments with different parameters.`)
|
|
190
|
+
}
|
|
191
|
+
if (this.options.dimensions !== other.options.dimensions) {
|
|
192
|
+
throw new BindingError(`Cannot merge two environments with different dimensions.`)
|
|
193
|
+
}
|
|
194
|
+
if (equal(this.options.variables, other.options.variables) && this.options.parent === other.options.parent) {
|
|
195
|
+
return this
|
|
196
|
+
}
|
|
197
|
+
for (const key in other.options.variables) {
|
|
198
|
+
if (key in this.options.variables && !equal(this.options.variables[key], other.options.variables[key])) {
|
|
199
|
+
throw new BindingError(`Cannot merge two environments with different value of variable ${key}:\n`
|
|
200
|
+
+ JSON.stringify(this.options.variables[key]) + '\n'
|
|
201
|
+
+ JSON.stringify(other.options.variables[key]))
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return new Environment({
|
|
206
|
+
...this.options,
|
|
207
|
+
parent: this.options.parent && other.options.parent ? this.options.parent.merge(other.options.parent) : undefined,
|
|
208
|
+
variables: { ...this.options.variables, ...other.options.variables },
|
|
209
|
+
})
|
|
143
210
|
}
|
|
144
211
|
}
|
|
145
212
|
|
|
146
213
|
namespace Environment {
|
|
147
|
-
export type Name = string
|
|
214
|
+
export type Name = string
|
|
148
215
|
|
|
149
216
|
export type Value = ReactNode
|
|
150
217
|
|
|
151
|
-
export
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
218
|
+
export type ResolvedValue = Value | Filter
|
|
219
|
+
|
|
220
|
+
export interface Options {
|
|
221
|
+
node?: AnyNode
|
|
222
|
+
schema?: Schema
|
|
223
|
+
dimensions: SelectedDimensions
|
|
224
|
+
parameters: Parameters
|
|
225
|
+
variables: CustomVariables
|
|
226
|
+
parent?: Environment
|
|
156
227
|
}
|
|
157
228
|
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
'rootWhereAsFilter',
|
|
162
|
-
'rootShouldExists',
|
|
163
|
-
])
|
|
229
|
+
export type SubTreeNode =
|
|
230
|
+
| SubTreeEntityNode
|
|
231
|
+
| SubTreeEntityListNode
|
|
164
232
|
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
233
|
+
export type InnerNode =
|
|
234
|
+
| EntityNode
|
|
235
|
+
| EntityListNode
|
|
236
|
+
| ColumnNode
|
|
169
237
|
|
|
170
|
-
export type
|
|
238
|
+
export type AnyNode =
|
|
239
|
+
| SubTreeNode
|
|
240
|
+
| InnerNode
|
|
171
241
|
|
|
172
|
-
export interface
|
|
173
|
-
|
|
242
|
+
export interface SubTreeEntityNode {
|
|
243
|
+
type: 'subtree-entity'
|
|
244
|
+
entity: SchemaEntity
|
|
245
|
+
expectedCardinality: 'zero' | 'one' | 'zero-or-one'
|
|
246
|
+
filter: Filter
|
|
174
247
|
}
|
|
175
248
|
|
|
176
|
-
export interface
|
|
177
|
-
|
|
249
|
+
export interface SubTreeEntityListNode {
|
|
250
|
+
type: 'subtree-entity-list'
|
|
251
|
+
entity: SchemaEntity
|
|
252
|
+
expectedCardinality: 'zero-to-many' | 'zero'
|
|
253
|
+
filter: Filter
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface EntityNode {
|
|
257
|
+
type: 'entity'
|
|
258
|
+
entity: SchemaEntity
|
|
259
|
+
field: SchemaRelation
|
|
260
|
+
}
|
|
178
261
|
|
|
179
|
-
|
|
262
|
+
export interface EntityListNode {
|
|
263
|
+
type: 'entity-list'
|
|
264
|
+
entity: SchemaEntity
|
|
265
|
+
field: SchemaRelation
|
|
180
266
|
}
|
|
181
267
|
|
|
182
|
-
export
|
|
183
|
-
|
|
268
|
+
export interface ColumnNode {
|
|
269
|
+
type: 'column'
|
|
270
|
+
entity: SchemaEntity
|
|
271
|
+
field: SchemaColumn
|
|
272
|
+
}
|
|
184
273
|
|
|
185
|
-
export
|
|
186
|
-
[
|
|
274
|
+
export interface SelectedDimensions {
|
|
275
|
+
[key: string]: string[]
|
|
187
276
|
}
|
|
188
277
|
|
|
189
|
-
export type
|
|
278
|
+
export type Parameters = {
|
|
279
|
+
[K in string]?: string | number
|
|
280
|
+
}
|
|
190
281
|
|
|
191
|
-
export
|
|
192
|
-
|
|
282
|
+
export interface CustomVariables {
|
|
283
|
+
[key: string]: Value
|
|
193
284
|
}
|
|
194
285
|
|
|
195
|
-
export
|
|
196
|
-
|
|
197
|
-
|
|
286
|
+
export interface ValuesMapWithFactory {
|
|
287
|
+
[key: string]:
|
|
288
|
+
| ((environment: Environment) => Value)
|
|
289
|
+
| Value
|
|
198
290
|
}
|
|
291
|
+
|
|
292
|
+
/** @deprecated */
|
|
293
|
+
export type DeltaFactory = ValuesMapWithFactory
|
|
199
294
|
}
|
|
200
295
|
|
|
201
296
|
export { Environment }
|