@contember/binding 0.7.0-beta.5 → 0.8.0-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/LICENSE +1 -1
- package/dist/binding.d.ts +15 -7
- package/dist/development/accessors/EntityListAccessor.js +3 -3
- package/dist/development/accessors/EntityListAccessor.js.map +1 -1
- package/dist/development/core/DataBinding.js +1 -1
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/MarkerTreeGenerator.js +2 -2
- package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/core/StateInitializer.js +63 -20
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/operations/ListOperations.js +7 -4
- package/dist/development/core/operations/ListOperations.js.map +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js +1 -1
- package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/index.js +1 -0
- package/dist/development/index.js.map +1 -1
- package/dist/production/accessors/EntityListAccessor.js +3 -3
- package/dist/production/accessors/EntityListAccessor.js.map +1 -1
- package/dist/production/core/DataBinding.js +1 -1
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/MarkerTreeGenerator.js +2 -2
- package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/core/StateInitializer.js +63 -20
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/operations/ListOperations.js +7 -4
- package/dist/production/core/operations/ListOperations.js.map +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js +1 -1
- package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
- package/dist/production/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/index.js +1 -0
- package/dist/production/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -69,7 +69,7 @@ ${error.message}
|
|
|
69
69
|
this.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {
|
|
70
70
|
type: "listEntity",
|
|
71
71
|
parent: state
|
|
72
|
-
});
|
|
72
|
+
}, stateToConnect);
|
|
73
73
|
state.plannedRemovals?.delete(idToConnect.value);
|
|
74
74
|
let changesDelta = 0;
|
|
75
75
|
if (persistedEntityIds.has(idToConnect.value)) {
|
|
@@ -84,7 +84,7 @@ ${error.message}
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
disconnectEntity(listState, childEntity) {
|
|
87
|
+
disconnectEntity(listState, childEntity, options) {
|
|
88
88
|
this.eventManager.syncOperation(() => {
|
|
89
89
|
const persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState);
|
|
90
90
|
for (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {
|
|
@@ -101,7 +101,9 @@ ${error.message}
|
|
|
101
101
|
if (state.plannedRemovals === void 0) {
|
|
102
102
|
state.plannedRemovals = new Map();
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
if (!options.noPersist) {
|
|
105
|
+
state.plannedRemovals.set(disconnectedChildIdValue, "disconnect");
|
|
106
|
+
}
|
|
105
107
|
} else if (disconnectedChildRealm.entity.id.existsOnServer) {
|
|
106
108
|
changesDelta--;
|
|
107
109
|
}
|
|
@@ -113,7 +115,7 @@ ${error.message}
|
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
createNewEntity(outerState, initialize) {
|
|
116
|
-
this.eventManager.syncOperation(() => {
|
|
118
|
+
return this.eventManager.syncOperation(() => {
|
|
117
119
|
const id = new UnpersistedEntityDummyId();
|
|
118
120
|
for (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {
|
|
119
121
|
const newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {
|
|
@@ -123,6 +125,7 @@ ${error.message}
|
|
|
123
125
|
this.stateInitializer.runImmediateUserInitialization(newEntity, initialize);
|
|
124
126
|
this.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE);
|
|
125
127
|
}
|
|
128
|
+
return id;
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
getChildEntityById(state, id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.SugaredValidationError): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, { type: 'validation', error })\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else {\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: string) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id)\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.SugaredValidationError): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, { type: 'validation', error })\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else {\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: string) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id)\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":"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"}
|
|
@@ -7,7 +7,7 @@ const aliasToUuidReplacement = "-";
|
|
|
7
7
|
const standaloneUuidPrefix = uuidToAliasReplacement;
|
|
8
8
|
class MutationAlias {
|
|
9
9
|
static encodeTopLevel(operation) {
|
|
10
|
-
const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId}t`;
|
|
10
|
+
const treeRootId = operation.treeRootId === void 0 ? "u" : `t${operation.treeRootId.replace("-", "_")}t`;
|
|
11
11
|
const entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement);
|
|
12
12
|
const alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`;
|
|
13
13
|
return alias;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;UACpE,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU;
|
|
1
|
+
{"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;UACpE,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK;UAC9F,WAAW,UAAU,SAAS,QAAQ,kBAAkB;UAExD,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;WAUjG;AAAA;AAAA,SAGM,eAAe,OAAsD;UAC5E,UAAU,MAAM,MAAM;QAExB,CAAC,SAAS;aACN;AAAA;UAEF,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;UAC9E,qBAAsC,QAAQ;UAC9C,OAAO,QAAQ;UACf,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;UACzF,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;WAE/C;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;WAClD,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;WACxD,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\n\nexport interface SugaredFieldProps extends Omit<FieldProps
|
|
1
|
+
{"version":3,"file":"SugaredField.js","sources":["../../../src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '../treeParameters'\nimport { FieldValue } from '../treeParameters'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;MASa,eAAe,UAAU,CAA4C,UAAwC;MACrH,OAAO,MAAM,UAAU,UAAU;yCAC5B,OAAD;AAAA,SAAW;AAAA,MAAO,OAAO,MAAM;AAAA;AAAA;uCAE/B,OAAD;AAAA,OAAW;AAAA,OAAW,MAAM;AAAA;AAAA,GACjC;;"}
|
package/dist/production/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { NIL_UUID, PRIMARY_KEY_NAME, TYPENAME_KEY_NAME } from "./bindingTypes.js";
|
|
2
2
|
export { BindingError, throwBindingError } from "./BindingError.js";
|
|
3
|
+
export { v4 as generateUuid } from "uuid";
|
|
3
4
|
export { AccessorProvider } from "./accessorPropagation/AccessorProvider.js";
|
|
4
5
|
export { BindingOperationsProvider } from "./accessorPropagation/BindingOperationsProvider.js";
|
|
5
6
|
export { EntityKeyProvider } from "./accessorPropagation/EntityKeyProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/binding",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-alpha.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/production/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
],
|
|
19
19
|
"typings": "./dist/binding.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@contember/client": "0.
|
|
22
|
-
"@contember/react-client": "0.
|
|
23
|
-
"@contember/react-multipass-rendering": "0.
|
|
24
|
-
"@contember/react-utils": "0.
|
|
21
|
+
"@contember/client": "0.8.0-alpha.3",
|
|
22
|
+
"@contember/react-client": "0.8.0-alpha.3",
|
|
23
|
+
"@contember/react-multipass-rendering": "0.8.0-alpha.3",
|
|
24
|
+
"@contember/react-utils": "0.8.0-alpha.3",
|
|
25
25
|
"chevrotain": "6.5.0",
|
|
26
26
|
"js-levenshtein": "1.1.6",
|
|
27
27
|
"uuid": "8.3.2"
|