@contember/binding 1.1.0-alpha.1 → 1.1.0-alpha.4
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 +27 -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/useAccessorTreeState.js +5 -0
- package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -0
- package/dist/development/core/DataBinding.js +1 -1
- 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/EventManager.js +12 -7
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +95 -89
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/StateInitializer.js +15 -18
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeStore.js +2 -2
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/operations/EntityOperations.js +8 -7
- package/dist/development/core/operations/EntityOperations.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +1 -1
- package/dist/development/core/operations/ListOperations.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/Entity.js +1 -1
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.js +1 -1
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/dao/Environment.js +11 -1
- package/dist/development/dao/Environment.js.map +1 -1
- package/dist/development/dao/TreeNodeEnvironmentFactory.js +2 -2
- package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +16 -8
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- 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 +3 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/development/markers/PlaceholderGenerator.js +4 -4
- package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/development/utils/Hashing.js +21 -6
- package/dist/development/utils/Hashing.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 +27 -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/useAccessorTreeState.js +5 -0
- package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -0
- package/dist/production/core/DataBinding.js +1 -1
- 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/EventManager.js +11 -6
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/MutationGenerator.js +95 -89
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/StateInitializer.js +15 -18
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeStore.js +2 -2
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/operations/EntityOperations.js +8 -7
- package/dist/production/core/operations/EntityOperations.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js +1 -1
- package/dist/production/core/operations/ListOperations.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/Entity.js +1 -1
- package/dist/production/coreComponents/Entity.js.map +1 -1
- package/dist/production/coreComponents/EntityList.js +1 -1
- package/dist/production/coreComponents/EntityList.js.map +1 -1
- package/dist/production/dao/Environment.js +11 -1
- package/dist/production/dao/Environment.js.map +1 -1
- package/dist/production/dao/TreeNodeEnvironmentFactory.js +2 -2
- package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -1
- package/dist/production/helperComponents/DeferredSubTrees.js +16 -8
- package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
- 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 +3 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/production/markers/PlaceholderGenerator.js +4 -4
- package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
- package/dist/production/utils/Hashing.js +21 -6
- package/dist/production/utils/Hashing.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/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/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/EventManager.d.ts +1 -1
- package/dist/types/core/EventManager.d.ts.map +1 -1
- package/dist/types/core/MutationGenerator.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.map +1 -1
- package/dist/types/core/operations/EntityOperations.d.ts.map +1 -1
- package/dist/types/core/operations/ListOperations.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/SchemaEntity.d.ts +1 -1
- package/dist/types/core/schema/SchemaEntity.d.ts.map +1 -1
- package/dist/types/dao/Environment.d.ts +2 -0
- package/dist/types/dao/Environment.d.ts.map +1 -1
- package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
- 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/markers/PlaceholderGenerator.d.ts +3 -2
- package/dist/types/markers/PlaceholderGenerator.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/utils/Hashing.d.ts +3 -2
- package/dist/types/utils/Hashing.d.ts.map +1 -1
- package/package.json +7 -5
- 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 +30 -0
- package/src/accessorTree/AccessorTree.tsx +18 -12
- package/src/accessorTree/AccessorTreeStateContext.ts +6 -0
- package/src/accessorTree/index.ts +1 -0
- package/src/accessorTree/useAccessorTreeState.ts +4 -0
- package/src/core/DataBinding.ts +0 -1
- package/src/core/DirtinessTracker.ts +4 -16
- package/src/core/EventManager.ts +14 -8
- package/src/core/MutationGenerator.ts +132 -125
- package/src/core/StateInitializer.ts +22 -29
- package/src/core/TreeStore.ts +2 -0
- package/src/core/operations/EntityOperations.ts +8 -9
- package/src/core/operations/ListOperations.ts +2 -1
- package/src/core/schema/RawSchemaEntity.ts +1 -2
- package/src/core/schema/SchemaEntity.ts +1 -1
- package/src/core/schema/SchemaPreprocessor.ts +1 -1
- package/src/coreComponents/Entity.tsx +1 -1
- package/src/coreComponents/EntityList.tsx +1 -1
- package/src/dao/Environment.ts +12 -1
- package/src/dao/TreeNodeEnvironmentFactory.ts +2 -2
- package/src/helperComponents/DeferredSubTrees.tsx +19 -13
- 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/markers/EntityListSubTreeMarker.ts +1 -1
- package/src/markers/EntitySubTreeMarker.ts +1 -1
- package/src/markers/PlaceholderGenerator.ts +5 -2
- package/src/utils/Hashing.ts +23 -8
|
@@ -19,7 +19,6 @@ import type {
|
|
|
19
19
|
} from '../treeParameters'
|
|
20
20
|
import { assertNever } from '../utils'
|
|
21
21
|
import type { AccessorErrorManager } from './AccessorErrorManager'
|
|
22
|
-
import type { Config } from './Config'
|
|
23
22
|
import type { EventManager } from './EventManager'
|
|
24
23
|
import { EntityOperations, FieldOperations, ListOperations } from './operations'
|
|
25
24
|
import { RealmKeyGenerator } from './RealmKeyGenerator'
|
|
@@ -44,27 +43,14 @@ export class StateInitializer {
|
|
|
44
43
|
private readonly listOperations: ListOperations
|
|
45
44
|
|
|
46
45
|
public constructor(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
private readonly config: Config,
|
|
46
|
+
accessorErrorManager: AccessorErrorManager,
|
|
47
|
+
batchUpdatesOptions: BatchUpdatesOptions,
|
|
50
48
|
private readonly eventManager: EventManager,
|
|
51
49
|
private readonly treeStore: TreeStore,
|
|
52
50
|
) {
|
|
53
|
-
this.fieldOperations = new FieldOperations(
|
|
54
|
-
this.entityOperations = new EntityOperations(
|
|
55
|
-
|
|
56
|
-
this.batchUpdatesOptions,
|
|
57
|
-
this.eventManager,
|
|
58
|
-
this,
|
|
59
|
-
this.treeStore,
|
|
60
|
-
)
|
|
61
|
-
this.listOperations = new ListOperations(
|
|
62
|
-
this.accessorErrorManager,
|
|
63
|
-
this.batchUpdatesOptions,
|
|
64
|
-
this.eventManager,
|
|
65
|
-
this,
|
|
66
|
-
this.treeStore,
|
|
67
|
-
)
|
|
51
|
+
this.fieldOperations = new FieldOperations(accessorErrorManager, this.eventManager, this, this.treeStore)
|
|
52
|
+
this.entityOperations = new EntityOperations(accessorErrorManager, batchUpdatesOptions, this.eventManager, this, this.treeStore)
|
|
53
|
+
this.listOperations = new ListOperations(accessorErrorManager, batchUpdatesOptions, this.eventManager, this, this.treeStore)
|
|
68
54
|
}
|
|
69
55
|
|
|
70
56
|
public initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode {
|
|
@@ -126,7 +112,7 @@ export class StateInitializer {
|
|
|
126
112
|
|
|
127
113
|
return stub
|
|
128
114
|
}
|
|
129
|
-
const realm = this.createEntityRealm(blueprint, realmKey, entity)
|
|
115
|
+
const realm = this.createEntityRealm(blueprint, realmKey, entity, copyFrom)
|
|
130
116
|
|
|
131
117
|
this.registerEntityRealm(realm)
|
|
132
118
|
|
|
@@ -139,7 +125,7 @@ export class StateInitializer {
|
|
|
139
125
|
if (!value || value.type !== 'field') {
|
|
140
126
|
throw new BindingError()
|
|
141
127
|
}
|
|
142
|
-
this.initializeFromFieldMarker(realm, field, value
|
|
128
|
+
this.initializeFromFieldMarker(realm, field, undefined, value)
|
|
143
129
|
} else if (field instanceof HasManyRelationMarker) {
|
|
144
130
|
// todo: get from copyFrom
|
|
145
131
|
this.initializeFromHasManyRelationMarker(realm, field, new Set())
|
|
@@ -168,7 +154,12 @@ export class StateInitializer {
|
|
|
168
154
|
return realm
|
|
169
155
|
}
|
|
170
156
|
|
|
171
|
-
private createEntityRealm(
|
|
157
|
+
private createEntityRealm(
|
|
158
|
+
blueprint: EntityRealmBlueprint,
|
|
159
|
+
realmKey: string,
|
|
160
|
+
entity: EntityState,
|
|
161
|
+
copyFrom?: EntityRealmState,
|
|
162
|
+
): EntityRealmState {
|
|
172
163
|
const entityRealm: EntityRealmState = {
|
|
173
164
|
type: 'entityRealm',
|
|
174
165
|
|
|
@@ -183,7 +174,7 @@ export class StateInitializer {
|
|
|
183
174
|
eventListeners: this.initializeEntityEventListenerStore(blueprint),
|
|
184
175
|
fieldsWithPendingConnectionUpdates: undefined,
|
|
185
176
|
plannedHasOneDeletions: undefined,
|
|
186
|
-
unpersistedChangesCount: 0,
|
|
177
|
+
unpersistedChangesCount: copyFrom?.unpersistedChangesCount ?? 0,
|
|
187
178
|
getAccessor: () => {
|
|
188
179
|
if (entityRealm.accessor === undefined) {
|
|
189
180
|
const entity = entityRealm.entity
|
|
@@ -359,8 +350,9 @@ export class StateInitializer {
|
|
|
359
350
|
placeholderName: FieldName,
|
|
360
351
|
fieldMarker: FieldMarker,
|
|
361
352
|
persistedValue: Scalar | undefined,
|
|
353
|
+
copyFromState: FieldState | undefined,
|
|
362
354
|
): FieldState {
|
|
363
|
-
const resolvedFieldValue = persistedValue ?? fieldMarker.defaultValue ?? null
|
|
355
|
+
const resolvedFieldValue = copyFromState ? copyFromState.value : (persistedValue ?? fieldMarker.defaultValue ?? null)
|
|
364
356
|
|
|
365
357
|
const fieldState: FieldState = {
|
|
366
358
|
type: 'field',
|
|
@@ -373,7 +365,7 @@ export class StateInitializer {
|
|
|
373
365
|
eventListeners: this.initializeFieldEventListenerStore(fieldMarker),
|
|
374
366
|
errors: undefined,
|
|
375
367
|
touchLog: undefined,
|
|
376
|
-
hasUnpersistedChanges: false,
|
|
368
|
+
hasUnpersistedChanges: copyFromState?.hasUnpersistedChanges ?? false,
|
|
377
369
|
|
|
378
370
|
getAccessor: () => {
|
|
379
371
|
if (fieldState.accessor === undefined) {
|
|
@@ -409,15 +401,16 @@ export class StateInitializer {
|
|
|
409
401
|
private initializeFromFieldMarker(
|
|
410
402
|
parent: EntityRealmState,
|
|
411
403
|
field: FieldMarker,
|
|
412
|
-
|
|
404
|
+
persistedValue: EntityFieldPersistedData | undefined,
|
|
405
|
+
copyFromState?: FieldState,
|
|
413
406
|
) {
|
|
414
|
-
if (
|
|
407
|
+
if (persistedValue instanceof Set) {
|
|
415
408
|
throw new BindingError(
|
|
416
409
|
`Received a collection of referenced entities where a single '${field.fieldName}' field was expected. ` +
|
|
417
410
|
`Perhaps you wanted to use a <Repeater />?`,
|
|
418
411
|
)
|
|
419
412
|
}
|
|
420
|
-
if (
|
|
413
|
+
if (persistedValue instanceof ServerId) {
|
|
421
414
|
throw new BindingError(
|
|
422
415
|
`Received a referenced entity where a single '${field.fieldName}' field was expected. ` +
|
|
423
416
|
`Perhaps you wanted to use <HasOne />?`,
|
|
@@ -425,7 +418,7 @@ export class StateInitializer {
|
|
|
425
418
|
}
|
|
426
419
|
parent.children.set(
|
|
427
420
|
field.placeholderName,
|
|
428
|
-
this.initializeFieldState(parent, field.placeholderName, field,
|
|
421
|
+
this.initializeFieldState(parent, field.placeholderName, field, persistedValue, copyFromState),
|
|
429
422
|
)
|
|
430
423
|
}
|
|
431
424
|
|
package/src/core/TreeStore.ts
CHANGED
|
@@ -174,6 +174,7 @@ export class TreeStore {
|
|
|
174
174
|
environment,
|
|
175
175
|
)
|
|
176
176
|
: QueryLanguage.desugarQualifiedEntityList(aliasOrParameters as SugaredQualifiedEntityList, environment),
|
|
177
|
+
environment,
|
|
177
178
|
)
|
|
178
179
|
} else if (mode === 'entity') {
|
|
179
180
|
placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(
|
|
@@ -183,6 +184,7 @@ export class TreeStore {
|
|
|
183
184
|
environment,
|
|
184
185
|
)
|
|
185
186
|
: QueryLanguage.desugarQualifiedSingleEntity(aliasOrParameters as SugaredQualifiedSingleEntity, environment),
|
|
187
|
+
environment,
|
|
186
188
|
)
|
|
187
189
|
} else {
|
|
188
190
|
throw new BindingError()
|
|
@@ -127,16 +127,11 @@ export class EntityOperations {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
const persistedId = persistedData?.get(targetHasOneMarker.placeholderName)
|
|
130
|
-
if (persistedId instanceof ServerId) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
changesDelta++ // We're changing it from the persisted id.
|
|
135
|
-
}
|
|
130
|
+
if (persistedId instanceof ServerId && persistedId.value === stateToConnect.entity.id.value) {
|
|
131
|
+
changesDelta-- // It was removed from the list but now we're adding it back.
|
|
132
|
+
} else if (persistedId instanceof ServerId && persistedId.value === previouslyConnectedState.entity.id.value) {
|
|
133
|
+
changesDelta++ // We're changing it from the persisted id.
|
|
136
134
|
} else if (!previouslyConnectedState.entity.id.existsOnServer) {
|
|
137
|
-
// This assumes the invariant enforced above that we cannot connect unpersisted entities.
|
|
138
|
-
// Hence the previouslyConnectedState still refers to the entity created initially.
|
|
139
|
-
|
|
140
135
|
if (
|
|
141
136
|
persistedId === null || // We're updating.
|
|
142
137
|
(persistedId === undefined && // We're creating.
|
|
@@ -145,6 +140,9 @@ export class EntityOperations {
|
|
|
145
140
|
changesDelta++
|
|
146
141
|
}
|
|
147
142
|
}
|
|
143
|
+
if (stateToConnect.type === 'entityRealm') {
|
|
144
|
+
changesDelta += stateToConnect.unpersistedChangesCount
|
|
145
|
+
}
|
|
148
146
|
|
|
149
147
|
// TODO do something about the existing state…
|
|
150
148
|
|
|
@@ -152,6 +150,7 @@ export class EntityOperations {
|
|
|
152
150
|
stateToConnect.entity.id,
|
|
153
151
|
stateToConnect.entity.entityName,
|
|
154
152
|
previouslyConnectedState.blueprint,
|
|
153
|
+
stateToConnect,
|
|
155
154
|
)
|
|
156
155
|
|
|
157
156
|
this.eventManager.registerUpdatedConnection(state, targetHasOneMarker.placeholderName)
|
|
@@ -106,7 +106,8 @@ export class ListOperations {
|
|
|
106
106
|
if (persistedEntityIds.has(idToConnect.value)) {
|
|
107
107
|
// It was removed from the list but now we're adding it back.
|
|
108
108
|
changesDelta--
|
|
109
|
-
} else {
|
|
109
|
+
} else if (idToConnect.existsOnServer) {
|
|
110
|
+
// ignoring unpersisted entities
|
|
110
111
|
changesDelta++
|
|
111
112
|
}
|
|
112
113
|
if (stateToConnect.type === 'entityRealm') {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { EntityName } from '../../treeParameters'
|
|
2
2
|
import type { SchemaColumn } from './SchemaColumn'
|
|
3
3
|
import type { SchemaRelation } from './SchemaRelation'
|
|
4
|
-
import type { SchemaUniqueConstraint } from './SchemaUniqueConstraint'
|
|
5
4
|
|
|
6
5
|
export type RawSchemaFields = Array<SchemaRelation | SchemaColumn>
|
|
7
6
|
|
|
@@ -9,5 +8,5 @@ export interface RawSchemaEntity {
|
|
|
9
8
|
name: EntityName
|
|
10
9
|
customPrimaryAllowed: boolean
|
|
11
10
|
fields: RawSchemaFields
|
|
12
|
-
unique:
|
|
11
|
+
unique: { fields: string[] }[]
|
|
13
12
|
}
|
|
@@ -32,7 +32,7 @@ export class SchemaPreprocessor {
|
|
|
32
32
|
customPrimaryAllowed: entity.customPrimaryAllowed,
|
|
33
33
|
fields: this.processRawFields(entity.fields),
|
|
34
34
|
name: entity.name,
|
|
35
|
-
unique: entity.unique,
|
|
35
|
+
unique: entity.unique.map(it => ({ fields: new Set(it.fields) })),
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -14,7 +14,7 @@ export const Entity = Component(
|
|
|
14
14
|
({ children, accessor }: EntityProps) => {
|
|
15
15
|
return (
|
|
16
16
|
// HACK: the ?. is actually important, despite the typings.
|
|
17
|
-
<AccessorProvider accessor={accessor} key={accessor?.key}>
|
|
17
|
+
<AccessorProvider accessor={accessor} key={accessor?.id ?? accessor?.key}>
|
|
18
18
|
{children}
|
|
19
19
|
</AccessorProvider>
|
|
20
20
|
)
|
package/src/dao/Environment.ts
CHANGED
|
@@ -107,7 +107,15 @@ class Environment {
|
|
|
107
107
|
newVariables[newName] = resolvedValue
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
return new Environment({
|
|
110
|
+
return new Environment({
|
|
111
|
+
...this.options,
|
|
112
|
+
variables: newVariables,
|
|
113
|
+
parent: this,
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public getAllVariables() {
|
|
118
|
+
return this.options.variables
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
public hasParameter(key: string): boolean {
|
|
@@ -125,6 +133,9 @@ class Environment {
|
|
|
125
133
|
return this.options.parameters[key] ?? fallback
|
|
126
134
|
}
|
|
127
135
|
|
|
136
|
+
public getAllParameters() {
|
|
137
|
+
return this.options.parameters
|
|
138
|
+
}
|
|
128
139
|
|
|
129
140
|
public withParameters(parameters: Environment.Parameters): Environment {
|
|
130
141
|
return new Environment({ ...this.options, parameters })
|
|
@@ -201,11 +201,11 @@ export class TreeNodeEnvironmentFactory {
|
|
|
201
201
|
|
|
202
202
|
private static describeLocation(environment: Environment): string {
|
|
203
203
|
const path = []
|
|
204
|
+
const loc = environment.getSubTreeNode()
|
|
204
205
|
for (let env = environment;; env = env.getParent()) {
|
|
205
206
|
const node = env.getSubTreeNode()
|
|
206
207
|
if (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {
|
|
207
|
-
|
|
208
|
-
return `entity '${node.entity.name}'${pathText}`
|
|
208
|
+
return `entity '${loc.entity.name}' in path '${[node.entity.name, ...path].join('.')}'`
|
|
209
209
|
}
|
|
210
210
|
path.push(node.field.name)
|
|
211
211
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { ReactNode, useCallback, useEffect, useState } from 'react'
|
|
2
|
-
import { TreeRootIdProvider, useBindingOperations } from '../accessorPropagation'
|
|
2
|
+
import { TreeRootIdProvider, useBindingOperations, useHasEntity, useEnvironment } from '../accessorPropagation'
|
|
3
3
|
import { useMutationState } from '../accessorTree'
|
|
4
4
|
import { Component } from '../coreComponents'
|
|
5
5
|
import { useEntityBeforePersist } from '../entityEvents'
|
|
6
6
|
import { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker } from '../markers'
|
|
7
7
|
import { MarkerFactory } from '../queryLanguage'
|
|
8
8
|
import type { TreeRootId } from '../treeParameters'
|
|
9
|
+
import { useConstantValueInvariant } from '@contember/react-utils'
|
|
9
10
|
|
|
10
11
|
export interface DeferredSubTreesProps {
|
|
11
12
|
fallback: ReactNode
|
|
@@ -30,16 +31,20 @@ export const DeferredSubTrees = Component<DeferredSubTreesProps>(
|
|
|
30
31
|
const [abortController] = useState(() => new AbortController())
|
|
31
32
|
const signal = abortController.signal
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
const hasEntity = useHasEntity()
|
|
35
|
+
useConstantValueInvariant(hasEntity)
|
|
36
|
+
if (hasEntity) {
|
|
37
|
+
useEntityBeforePersist(
|
|
38
|
+
useCallback(getAccessor => {
|
|
39
|
+
// This is a hack. We're really just circumventing the change of ids after a creation so that nested
|
|
40
|
+
// components don't error.
|
|
41
|
+
if (getAccessor().existsOnServer) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
setLoadState({ name: 'initial' })
|
|
45
|
+
}, []),
|
|
46
|
+
)
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
useEffect(() => {
|
|
45
50
|
return () => {
|
|
@@ -47,6 +52,7 @@ export const DeferredSubTrees = Component<DeferredSubTreesProps>(
|
|
|
47
52
|
}
|
|
48
53
|
}, [abortController])
|
|
49
54
|
|
|
55
|
+
const environment = useEnvironment()
|
|
50
56
|
useEffect(() => {
|
|
51
57
|
if (isMutating || loadState.name !== 'initial' || signal.aborted) {
|
|
52
58
|
return
|
|
@@ -55,7 +61,7 @@ export const DeferredSubTrees = Component<DeferredSubTreesProps>(
|
|
|
55
61
|
|
|
56
62
|
const newFragment = <OnlyKeepSubTrees>{props.children}</OnlyKeepSubTrees>
|
|
57
63
|
|
|
58
|
-
extendTree(newFragment, { signal })
|
|
64
|
+
extendTree(newFragment, { signal, environment })
|
|
59
65
|
.then(treeRootId => !signal.aborted && setLoadState({ name: 'success', treeRootId }))
|
|
60
66
|
.catch(error => {
|
|
61
67
|
if (signal.aborted) {
|
|
@@ -63,7 +69,7 @@ export const DeferredSubTrees = Component<DeferredSubTreesProps>(
|
|
|
63
69
|
}
|
|
64
70
|
throw error
|
|
65
71
|
})
|
|
66
|
-
}, [extendTree, isMutating, loadState.name, props.children, signal])
|
|
72
|
+
}, [environment, extendTree, isMutating, loadState.name, props.children, signal])
|
|
67
73
|
|
|
68
74
|
switch (loadState.name) {
|
|
69
75
|
case 'initial':
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
import { Component, Field } from '../coreComponents'
|
|
4
|
+
import { EntityAccessor } from '../accessors'
|
|
5
|
+
import { QueryLanguage } from '../queryLanguage'
|
|
6
|
+
import { useEntity, useEnvironment } from '../accessorPropagation'
|
|
7
|
+
import { Filter } from '../treeParameters'
|
|
8
|
+
import { FilterFieldsCollector } from './helpers/FilterFieldsCollector'
|
|
9
|
+
import { FilterEvaluator } from './helpers/FilterEvaluator'
|
|
10
|
+
|
|
11
|
+
export type IfProps =
|
|
12
|
+
| IfFilterProps
|
|
13
|
+
| IfCallbackProps
|
|
14
|
+
|
|
15
|
+
export interface IfFilterProps {
|
|
16
|
+
condition: string | Filter
|
|
17
|
+
children?: ReactNode
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IfCallbackProps {
|
|
21
|
+
condition: (accessor: EntityAccessor) => boolean
|
|
22
|
+
children?: ReactNode
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const If = Component<IfProps>(props => {
|
|
26
|
+
return typeof props.condition !== 'function'
|
|
27
|
+
? <IfFilter condition={props.condition}>{props.children}</IfFilter>
|
|
28
|
+
: <IfCallback condition={props.condition}>{props.children}</IfCallback>
|
|
29
|
+
},
|
|
30
|
+
'If',
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const IfCallback = Component<IfCallbackProps>(
|
|
34
|
+
({ children, condition }) => {
|
|
35
|
+
const entity = useEntity()
|
|
36
|
+
const evaluated = useMemo(() => condition(entity), [condition, entity])
|
|
37
|
+
|
|
38
|
+
return evaluated ? <>{children}</> : null
|
|
39
|
+
},
|
|
40
|
+
({ children }) => {
|
|
41
|
+
return <>{children}</>
|
|
42
|
+
},
|
|
43
|
+
'IfCallback',
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const IfFilter = Component<IfFilterProps>(
|
|
47
|
+
({ children, condition }) => {
|
|
48
|
+
const env = useEnvironment()
|
|
49
|
+
const entity = useEntity()
|
|
50
|
+
|
|
51
|
+
const schema = env.getSchema()
|
|
52
|
+
const evaluated = useMemo(
|
|
53
|
+
() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),
|
|
54
|
+
[condition, entity, env, schema],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return evaluated ? <>{children}</> : null
|
|
58
|
+
},
|
|
59
|
+
({ children, condition }, env) => {
|
|
60
|
+
const desugaredFilter = QueryLanguage.desugarFilter(condition, env)
|
|
61
|
+
const collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)
|
|
62
|
+
const additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>
|
|
63
|
+
|
|
64
|
+
return <>
|
|
65
|
+
{additionalFields}
|
|
66
|
+
{children}
|
|
67
|
+
</>
|
|
68
|
+
},
|
|
69
|
+
'IfFilter',
|
|
70
|
+
)
|
|
71
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Schema } from '../../core/schema'
|
|
2
|
+
import { Input } from '@contember/client'
|
|
3
|
+
import { EntityAccessor } from '../../accessors'
|
|
4
|
+
import { Filter } from '../../treeParameters'
|
|
5
|
+
import { BindingError } from '../../BindingError'
|
|
6
|
+
import { evaluateCondition } from './evaluateCondition'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export class FilterEvaluator {
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly schema: Schema,
|
|
12
|
+
) {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
evaluateFilter(entity: EntityAccessor, filter: Filter): boolean {
|
|
16
|
+
const entitySchema = this.schema.getEntity(entity.name)
|
|
17
|
+
if (!entitySchema) {
|
|
18
|
+
throw new BindingError()
|
|
19
|
+
}
|
|
20
|
+
let acc = true
|
|
21
|
+
for (const [key, value] of Object.entries(filter)) {
|
|
22
|
+
if (key === 'and' || key === 'or') {
|
|
23
|
+
if (!Array.isArray(value)) {
|
|
24
|
+
throw new BindingError()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const operation = key === 'and' ? 'every' : 'some' as const
|
|
28
|
+
acc &&= value[operation](it => this.evaluateFilter(entity, it))
|
|
29
|
+
|
|
30
|
+
} else if (key === 'not') {
|
|
31
|
+
acc &&= !this.evaluateFilter(entity, value as Filter)
|
|
32
|
+
|
|
33
|
+
} else {
|
|
34
|
+
const field = entitySchema.fields.get(key)
|
|
35
|
+
if (!field) {
|
|
36
|
+
throw new BindingError()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (field.__typename === '_Column') {
|
|
40
|
+
acc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)
|
|
41
|
+
} else {
|
|
42
|
+
acc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return acc
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Schema, SchemaEntity } from '../../core/schema'
|
|
2
|
+
import { Filter } from '../../treeParameters'
|
|
3
|
+
import { BindingError } from '../../BindingError'
|
|
4
|
+
|
|
5
|
+
export class FilterFieldsCollector {
|
|
6
|
+
constructor(
|
|
7
|
+
private readonly schema: Schema,
|
|
8
|
+
private readonly rootFilter: Filter,
|
|
9
|
+
) {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
collectFields(entity: SchemaEntity): Set<string> {
|
|
14
|
+
const result = new Set<string>()
|
|
15
|
+
this.collectFieldsInternal(this.rootFilter, entity, [], result)
|
|
16
|
+
return result
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private collectFieldsInternal(filter: Filter, entity: SchemaEntity, path: string[], result: Set<string>): void {
|
|
20
|
+
for (const [key, value] of Object.entries(filter)) {
|
|
21
|
+
if (key === 'and' || key === 'or') {
|
|
22
|
+
if (!Array.isArray(value)) {
|
|
23
|
+
throw new BindingError()
|
|
24
|
+
}
|
|
25
|
+
value?.forEach(it => this.collectFieldsInternal(it, entity, path, result))
|
|
26
|
+
|
|
27
|
+
} else if (key === 'not') {
|
|
28
|
+
this.collectFieldsInternal(value as Filter, entity, path, result)
|
|
29
|
+
|
|
30
|
+
} else {
|
|
31
|
+
const field = entity.fields.get(key)
|
|
32
|
+
if (!field) {
|
|
33
|
+
throw new BindingError(`Invalid field: the name "${key}" does not exist on entity "${entity.name}" `
|
|
34
|
+
+ `in a ${path.length === 0 ? 'root' : `path "${path.join('.')}"`} of a following filter:\n`
|
|
35
|
+
+ JSON.stringify(this.rootFilter, null, ' '))
|
|
36
|
+
}
|
|
37
|
+
if (field.__typename === '_Column') {
|
|
38
|
+
result.add([...path, key].join('.'))
|
|
39
|
+
} else {
|
|
40
|
+
const entity = this.schema.getEntity(field.targetEntity)
|
|
41
|
+
if (!entity) {
|
|
42
|
+
throw new BindingError()
|
|
43
|
+
}
|
|
44
|
+
this.collectFieldsInternal(value as Filter, entity, [...path, key], result)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GraphQlLiteral, Input } from '@contember/client'
|
|
2
|
+
import { Scalar } from '../../treeParameters'
|
|
3
|
+
import { BindingError } from '../../BindingError'
|
|
4
|
+
|
|
5
|
+
const unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {
|
|
6
|
+
if (value instanceof GraphQlLiteral) {
|
|
7
|
+
return value.value
|
|
8
|
+
}
|
|
9
|
+
return value
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const evaluateCondition = (value: Scalar | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {
|
|
13
|
+
const handlers: {
|
|
14
|
+
[K in keyof Required<Input.Condition<any>>]: (
|
|
15
|
+
param: Exclude<Input.Condition<any>[K], undefined>,
|
|
16
|
+
) => boolean
|
|
17
|
+
} = {
|
|
18
|
+
and: expr => expr.every(it => evaluateCondition(value, it)),
|
|
19
|
+
or: expr => expr.some(it => evaluateCondition(value, it)),
|
|
20
|
+
not: expr => !evaluateCondition(value, expr),
|
|
21
|
+
eq: expr => value === unwrapGraphqlLiteral(expr),
|
|
22
|
+
notEq: expr => value !== unwrapGraphqlLiteral(expr),
|
|
23
|
+
isNull: expr => (value === null) === expr,
|
|
24
|
+
in: expr => expr.map(unwrapGraphqlLiteral).includes(value),
|
|
25
|
+
notIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),
|
|
26
|
+
lt: expr => value !== null && value < unwrapGraphqlLiteral(expr),
|
|
27
|
+
lte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),
|
|
28
|
+
gt: expr => value !== null && value > unwrapGraphqlLiteral(expr),
|
|
29
|
+
gte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),
|
|
30
|
+
contains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),
|
|
31
|
+
startsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),
|
|
32
|
+
endsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),
|
|
33
|
+
containsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),
|
|
34
|
+
startsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
|
|
35
|
+
endsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
|
|
36
|
+
never: () => false,
|
|
37
|
+
always: () => true,
|
|
38
|
+
// deprecated
|
|
39
|
+
null: expr => (value === null) === expr,
|
|
40
|
+
}
|
|
41
|
+
return Object.entries(condition).every(([operator, argument]) => {
|
|
42
|
+
if (value === undefined) {
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
const handlerKey = operator as keyof typeof handlers
|
|
46
|
+
const handler = handlers[handlerKey]
|
|
47
|
+
if (!handler) {
|
|
48
|
+
throw new BindingError()
|
|
49
|
+
}
|
|
50
|
+
return handler(argument)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
@@ -11,7 +11,7 @@ export class EntityListSubTreeMarker {
|
|
|
11
11
|
public readonly fields: EntityFieldMarkersContainer,
|
|
12
12
|
public readonly environment: Environment,
|
|
13
13
|
) {
|
|
14
|
-
this.placeholderName = PlaceholderGenerator.getEntityListSubTreePlaceholder(this.parameters)
|
|
14
|
+
this.placeholderName = PlaceholderGenerator.getEntityListSubTreePlaceholder(this.parameters, this.environment)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public get entityName() {
|
|
@@ -11,7 +11,7 @@ export class EntitySubTreeMarker {
|
|
|
11
11
|
public readonly fields: EntityFieldMarkersContainer,
|
|
12
12
|
public readonly environment: Environment,
|
|
13
13
|
) {
|
|
14
|
-
this.placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(this.parameters)
|
|
14
|
+
this.placeholderName = PlaceholderGenerator.getEntitySubTreePlaceholder(this.parameters, this.environment)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
public get entityName() {
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
UnconstrainedQualifiedSingleEntity,
|
|
9
9
|
} from '../treeParameters'
|
|
10
10
|
import { Hashing } from '../utils'
|
|
11
|
+
import { Environment } from '../dao'
|
|
11
12
|
|
|
12
13
|
export class PlaceholderGenerator {
|
|
13
14
|
public static getFieldPlaceholder(fieldName: FieldName): string {
|
|
@@ -24,13 +25,15 @@ export class PlaceholderGenerator {
|
|
|
24
25
|
|
|
25
26
|
public static getEntitySubTreePlaceholder(
|
|
26
27
|
subTreeParameters: QualifiedSingleEntity | UnconstrainedQualifiedSingleEntity,
|
|
28
|
+
environment: Environment,
|
|
27
29
|
): string {
|
|
28
|
-
return `est_${Hashing.hashEntitySubTreeParameters(subTreeParameters)}`
|
|
30
|
+
return `est_${Hashing.hashEntitySubTreeParameters(subTreeParameters, environment)}`
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
public static getEntityListSubTreePlaceholder(
|
|
32
34
|
subTreeParameters: QualifiedEntityList | UnconstrainedQualifiedEntityList,
|
|
35
|
+
environment: Environment,
|
|
33
36
|
): string {
|
|
34
|
-
return `lst_${Hashing.hashEntityListSubTreeParameters(subTreeParameters)}`
|
|
37
|
+
return `lst_${Hashing.hashEntityListSubTreeParameters(subTreeParameters, environment)}`
|
|
35
38
|
}
|
|
36
39
|
}
|