@contember/bindx 0.1.43 → 0.1.45
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/core/ActionDispatcher.d.ts +7 -0
- package/dist/core/ActionDispatcher.d.ts.map +1 -1
- package/dist/dataview/types.d.ts +6 -1
- package/dist/dataview/types.d.ts.map +1 -1
- package/dist/handles/BaseHandle.d.ts +9 -18
- package/dist/handles/BaseHandle.d.ts.map +1 -1
- package/dist/handles/EntityHandle.d.ts +12 -4
- package/dist/handles/EntityHandle.d.ts.map +1 -1
- package/dist/handles/FieldHandle.d.ts.map +1 -1
- package/dist/handles/HasManyListHandle.d.ts +0 -4
- package/dist/handles/HasManyListHandle.d.ts.map +1 -1
- package/dist/handles/HasOneHandle.d.ts +0 -4
- package/dist/handles/HasOneHandle.d.ts.map +1 -1
- package/dist/handles/PlaceholderHandle.d.ts +18 -0
- package/dist/handles/PlaceholderHandle.d.ts.map +1 -1
- package/dist/handles/types.d.ts +10 -0
- package/dist/handles/types.d.ts.map +1 -1
- package/dist/persistence/BatchPersister.d.ts +8 -3
- package/dist/persistence/BatchPersister.d.ts.map +1 -1
- package/dist/store/DirtyTracker.d.ts +3 -1
- package/dist/store/DirtyTracker.d.ts.map +1 -1
- package/dist/store/EntityMetaStore.d.ts +4 -0
- package/dist/store/EntityMetaStore.d.ts.map +1 -1
- package/dist/store/EntitySnapshotStore.d.ts +14 -0
- package/dist/store/EntitySnapshotStore.d.ts.map +1 -1
- package/dist/store/ReachabilityAnalyzer.d.ts +33 -0
- package/dist/store/ReachabilityAnalyzer.d.ts.map +1 -0
- package/dist/store/RelationStore.d.ts +21 -10
- package/dist/store/RelationStore.d.ts.map +1 -1
- package/dist/store/RootRegistry.d.ts +28 -0
- package/dist/store/RootRegistry.d.ts.map +1 -0
- package/dist/store/SnapshotStore.d.ts +42 -2
- package/dist/store/SnapshotStore.d.ts.map +1 -1
- package/dist/store/SubscriptionManager.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core/ActionDispatcher.ts +38 -21
- package/src/dataview/filterHandlers.ts +4 -4
- package/src/dataview/types.ts +6 -1
- package/src/handles/BaseHandle.ts +9 -30
- package/src/handles/EntityHandle.ts +35 -30
- package/src/handles/FieldHandle.ts +0 -4
- package/src/handles/HasManyListHandle.ts +0 -22
- package/src/handles/HasOneHandle.ts +0 -19
- package/src/handles/PlaceholderHandle.ts +93 -0
- package/src/handles/types.ts +10 -0
- package/src/persistence/BatchPersister.ts +60 -22
- package/src/store/DirtyTracker.ts +9 -1
- package/src/store/EntityMetaStore.ts +10 -0
- package/src/store/EntitySnapshotStore.ts +32 -0
- package/src/store/ReachabilityAnalyzer.ts +92 -0
- package/src/store/RelationStore.ts +61 -37
- package/src/store/RootRegistry.ts +44 -0
- package/src/store/SnapshotStore.ts +91 -30
- package/src/store/SubscriptionManager.ts +8 -2
- package/dist/core/Disposable.d.ts +0 -57
- package/dist/core/Disposable.d.ts.map +0 -1
- package/src/core/Disposable.ts +0 -126
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationStore.d.ts","sourceRoot":"","sources":["../../src/store/RelationStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAUpD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,QAAQ,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,+BAA+B;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACtB,uGAAuG;IACvG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC3B,iEAAiE;IACjE,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAChD,mDAAmD;IACnD,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC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IActE;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAkBpE;;;OAGG;IACH,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,MAAM,EAAE;IAYxE;;;OAGG;IACH,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,MAAM,EAAE;IAgBtE;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IA2EnD;;OAEG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAwB5D;;OAEG;IACH,KAAK,IAAI,IAAI;CAIb;AAID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAgB5E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks explicitly-created top-level entities ("roots").
|
|
3
|
+
*
|
|
4
|
+
* Reachability-based create detection treats a created entity as a `create`
|
|
5
|
+
* only when it is reachable from a root through live relations. Roots are:
|
|
6
|
+
* - every entity that exists on the server (tracked via EntityMetaStore), and
|
|
7
|
+
* - explicitly-created top-level entities that have no persisted parent.
|
|
8
|
+
*
|
|
9
|
+
* The first set is derivable from metadata. The second set is NOT derivable
|
|
10
|
+
* from the relation graph — a top-level `<Entity create>` or a `useEntityList`
|
|
11
|
+
* add has no parent relation anchoring it, so it must be registered here when
|
|
12
|
+
* created and unregistered when removed.
|
|
13
|
+
*
|
|
14
|
+
* Keys use the same composite format as the rest of the store: "entityType:id".
|
|
15
|
+
*/
|
|
16
|
+
export declare class RootRegistry {
|
|
17
|
+
private readonly roots;
|
|
18
|
+
register(key: string): void;
|
|
19
|
+
unregister(key: string): void;
|
|
20
|
+
keys(): IterableIterator<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Moves a root entry from oldKey to newKey (used after persist rekeys a temp
|
|
23
|
+
* id to a server-assigned id).
|
|
24
|
+
*/
|
|
25
|
+
rekey(oldKey: string, newKey: string): void;
|
|
26
|
+
clear(): void;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=RootRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootRegistry.d.ts","sourceRoot":"","sources":["../../src/store/RootRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAE1C,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI3B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,IAAI,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAIhC;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAM3C,KAAK,IAAI,IAAI;CAGb"}
|
|
@@ -31,6 +31,8 @@ export declare class SnapshotStore implements SnapshotVersionBumper {
|
|
|
31
31
|
private readonly relations;
|
|
32
32
|
private readonly meta;
|
|
33
33
|
private readonly touched;
|
|
34
|
+
private readonly roots;
|
|
35
|
+
private readonly reachability;
|
|
34
36
|
private readonly dirtyTracker;
|
|
35
37
|
/**
|
|
36
38
|
* Tracks the last embedded data reference propagated from parent to child.
|
|
@@ -80,7 +82,28 @@ export declare class SnapshotStore implements SnapshotVersionBumper {
|
|
|
80
82
|
setFieldValue(entityType: string, id: string, fieldPath: string[], value: unknown): void;
|
|
81
83
|
commitEntity(entityType: string, id: string): void;
|
|
82
84
|
resetEntity(entityType: string, id: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Removes a single entity and all of its own per-entity state (snapshot,
|
|
87
|
+
* metadata, root registration, errors, touched state, propagation tracking,
|
|
88
|
+
* and owned relation state).
|
|
89
|
+
*
|
|
90
|
+
* This does NOT cascade into descendants, and it does NOT strip inbound edges
|
|
91
|
+
* (other entities' has-many membership / has-one currentId that point AT the
|
|
92
|
+
* removed id). Callers must therefore only remove an entity that is unreachable
|
|
93
|
+
* — i.e. no live parent relation references it — so the graph cannot dangle. The
|
|
94
|
+
* lazy {@link sweepUnreachableCreated} guarantees this by construction; the React
|
|
95
|
+
* unmount cleanup routes through it (via {@link unregisterRootEntity} + a sweep)
|
|
96
|
+
* rather than calling removeEntity on a possibly-referenced id.
|
|
97
|
+
*/
|
|
83
98
|
removeEntity(entityType: string, id: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Whether an entity (looked up by id alone) exists in the store and has never
|
|
101
|
+
* been persisted to the server. Used to decide relation-state semantics when a
|
|
102
|
+
* has-one target is deleted — deleting a never-persisted target reverts the
|
|
103
|
+
* relation to 'disconnected' rather than 'deleted', since there is no server
|
|
104
|
+
* row to delete.
|
|
105
|
+
*/
|
|
106
|
+
isNeverPersisted(entityId: string): boolean;
|
|
84
107
|
getLoadState(entityType: string, id: string): {
|
|
85
108
|
status: LoadStatus;
|
|
86
109
|
error?: FieldError;
|
|
@@ -93,6 +116,15 @@ export declare class SnapshotStore implements SnapshotVersionBumper {
|
|
|
93
116
|
unscheduleForDeletion(entityType: string, id: string): void;
|
|
94
117
|
isScheduledForDeletion(entityType: string, id: string): boolean;
|
|
95
118
|
createEntity(entityType: string, initialData?: Record<string, unknown>): string;
|
|
119
|
+
/**
|
|
120
|
+
* Unregisters a top-level root WITHOUT removing its snapshot. Called by the React
|
|
121
|
+
* unmount cleanup (a `<Entity create>` form / `useEntityList` draft) before a
|
|
122
|
+
* {@link sweepUnreachableCreated} pass: dropping the root lets the sweep reclaim a
|
|
123
|
+
* truly-orphaned create, while a create still anchored by another live relation
|
|
124
|
+
* stays reachable and survives. (Un-rooting also happens implicitly via
|
|
125
|
+
* {@link registerParentChild} and the rekey in {@link mapTempIdToPersistedId}.)
|
|
126
|
+
*/
|
|
127
|
+
unregisterRootEntity(entityType: string, id: string): void;
|
|
96
128
|
mapTempIdToPersistedId(entityType: string, tempId: string, persistedId: string): void;
|
|
97
129
|
getPersistedId(entityType: string, id: string): string | null;
|
|
98
130
|
isNewEntity(entityType: string, id: string): boolean;
|
|
@@ -100,10 +132,8 @@ export declare class SnapshotStore implements SnapshotVersionBumper {
|
|
|
100
132
|
getHasMany(parentType: string, parentId: string, fieldName: string, alias?: string): StoredHasManyState | undefined;
|
|
101
133
|
setHasManyServerIds(parentType: string, parentId: string, fieldName: string, serverIds: string[], alias?: string): void;
|
|
102
134
|
planHasManyRemoval(parentType: string, parentId: string, fieldName: string, itemId: string, type: HasManyRemovalType, alias?: string): void;
|
|
103
|
-
cancelHasManyRemoval(parentType: string, parentId: string, fieldName: string, itemId: string, alias?: string): void;
|
|
104
135
|
getHasManyPlannedRemovals(parentType: string, parentId: string, fieldName: string, alias?: string): Map<string, HasManyRemovalType> | undefined;
|
|
105
136
|
planHasManyConnection(parentType: string, parentId: string, fieldName: string, itemId: string, alias?: string): void;
|
|
106
|
-
cancelHasManyConnection(parentType: string, parentId: string, fieldName: string, itemId: string, alias?: string): void;
|
|
107
137
|
getHasManyPlannedConnections(parentType: string, parentId: string, fieldName: string, alias?: string): Set<string> | undefined;
|
|
108
138
|
commitHasMany(parentType: string, parentId: string, fieldName: string, newServerIds: string[], alias?: string): void;
|
|
109
139
|
resetHasMany(parentType: string, parentId: string, fieldName: string, alias?: string): void;
|
|
@@ -171,6 +201,16 @@ export declare class SnapshotStore implements SnapshotVersionBumper {
|
|
|
171
201
|
entityId: string;
|
|
172
202
|
changeType: 'create' | 'update' | 'delete';
|
|
173
203
|
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Removes the snapshots of created (never-persisted) entities that are no longer
|
|
206
|
+
* reachable from any root — the lazy memory sweep that replaces eager purge.
|
|
207
|
+
*
|
|
208
|
+
* Correctness never depends on this (unreachable creates are already excluded
|
|
209
|
+
* from getAllDirtyEntities); it only reclaims memory. Run it off the hot path,
|
|
210
|
+
* e.g. once a persist settles. Shared (diamond) children are kept because
|
|
211
|
+
* reachability reports them as live as long as any parent references them.
|
|
212
|
+
*/
|
|
213
|
+
sweepUnreachableCreated(): void;
|
|
174
214
|
getDirtyFields(entityType: string, entityId: string): string[];
|
|
175
215
|
getDirtyRelations(entityType: string, entityId: string): string[];
|
|
176
216
|
commitFields(entityType: string, entityId: string, fieldNames: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotStore.d.ts","sourceRoot":"","sources":["../../src/store/SnapshotStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAE1F,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"SnapshotStore.d.ts","sourceRoot":"","sources":["../../src/store/SnapshotStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAE1F,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAQvE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB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;;;OAGG;IACH,MAAM,IAAI,IAAI;IASd;;;OAGG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAS9D;;OAEG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAYhE;;;OAGG;IACH,uBAAuB,CACtB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,qBAAqB,EAC7B,YAAY,GAAE,GAAG,CAAC,MAAM,CAAa,GACnC,IAAI;IAuCP;;;;OAIG;IACH,yBAAyB,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,GAC3B,IAAI;IA4BP;;;OAGG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IASrC;;;OAGG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IASvC;;OAEG;IACH,YAAY,IAAI,IAAI;IAOpB;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;CAqDvF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/bindx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "Type-safe data binding framework (core)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@contember/bindx-client": "0.1.
|
|
20
|
+
"@contember/bindx-client": "0.1.45",
|
|
21
21
|
"@contember/graphql-client": "^2.1.0-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
@@ -177,6 +177,20 @@ export class ActionDispatcher {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Reverts a has-one relation to the disconnected state. Shared by
|
|
182
|
+
* DISCONNECT_RELATION and the never-persisted arm of DELETE_RELATION (deleting a
|
|
183
|
+
* never-created target just cancels its creation — there is no server row to
|
|
184
|
+
* delete), so the "disconnected" semantics live in one place.
|
|
185
|
+
*/
|
|
186
|
+
private disconnectRelation(entityType: string, entityId: string, fieldName: string): void {
|
|
187
|
+
this.store.setRelation(entityType, entityId, fieldName, {
|
|
188
|
+
currentId: null,
|
|
189
|
+
state: 'disconnected',
|
|
190
|
+
placeholderData: {},
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
180
194
|
/**
|
|
181
195
|
* Executes an action, updating the store.
|
|
182
196
|
*/
|
|
@@ -216,7 +230,7 @@ export class ActionDispatcher {
|
|
|
216
230
|
)
|
|
217
231
|
break
|
|
218
232
|
|
|
219
|
-
case 'CONNECT_RELATION':
|
|
233
|
+
case 'CONNECT_RELATION': {
|
|
220
234
|
this.store.setRelation(
|
|
221
235
|
action.entityType,
|
|
222
236
|
action.entityId,
|
|
@@ -228,30 +242,33 @@ export class ActionDispatcher {
|
|
|
228
242
|
)
|
|
229
243
|
this.store.registerParentChild(action.entityType, action.entityId, action.targetType, action.targetId)
|
|
230
244
|
break
|
|
245
|
+
}
|
|
231
246
|
|
|
232
|
-
case 'DISCONNECT_RELATION':
|
|
233
|
-
this.
|
|
234
|
-
action.entityType,
|
|
235
|
-
action.entityId,
|
|
236
|
-
action.fieldName,
|
|
237
|
-
{
|
|
238
|
-
currentId: null,
|
|
239
|
-
state: 'disconnected',
|
|
240
|
-
placeholderData: {},
|
|
241
|
-
},
|
|
242
|
-
)
|
|
247
|
+
case 'DISCONNECT_RELATION': {
|
|
248
|
+
this.disconnectRelation(action.entityType, action.entityId, action.fieldName)
|
|
243
249
|
break
|
|
250
|
+
}
|
|
244
251
|
|
|
245
|
-
case 'DELETE_RELATION':
|
|
246
|
-
this.store.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
case 'DELETE_RELATION': {
|
|
253
|
+
const deletedId = this.store.getRelation(action.entityType, action.entityId, action.fieldName)?.currentId
|
|
254
|
+
// Deleting a never-persisted target just cancels its creation — there is
|
|
255
|
+
// no server row to delete. Revert the relation to 'disconnected' so the
|
|
256
|
+
// parent is not spuriously dirtied by a 'deleted' state; reachability then
|
|
257
|
+
// drops the orphaned create. A server target gets the normal 'deleted'.
|
|
258
|
+
if (deletedId && this.store.isNeverPersisted(deletedId)) {
|
|
259
|
+
this.disconnectRelation(action.entityType, action.entityId, action.fieldName)
|
|
260
|
+
} else {
|
|
261
|
+
this.store.setRelation(
|
|
262
|
+
action.entityType,
|
|
263
|
+
action.entityId,
|
|
264
|
+
action.fieldName,
|
|
265
|
+
{
|
|
266
|
+
state: 'deleted',
|
|
267
|
+
},
|
|
268
|
+
)
|
|
269
|
+
}
|
|
254
270
|
break
|
|
271
|
+
}
|
|
255
272
|
|
|
256
273
|
case 'RESET_RELATION':
|
|
257
274
|
this.store.resetRelation(
|
|
@@ -393,16 +393,16 @@ export function createRelationFilterHandler(fieldPath: string): FilterHandler<Re
|
|
|
393
393
|
export function createIsDefinedFilterHandler(fieldPath: string): FilterHandler<IsDefinedFilterArtifact> {
|
|
394
394
|
return {
|
|
395
395
|
defaultArtifact(): IsDefinedFilterArtifact {
|
|
396
|
-
return {
|
|
396
|
+
return {}
|
|
397
397
|
},
|
|
398
398
|
|
|
399
399
|
isActive(artifact: IsDefinedFilterArtifact): boolean {
|
|
400
|
-
return artifact.
|
|
400
|
+
return artifact.nullCondition !== undefined
|
|
401
401
|
},
|
|
402
402
|
|
|
403
403
|
toWhere(artifact: IsDefinedFilterArtifact): Record<string, unknown> | undefined {
|
|
404
|
-
if (artifact.
|
|
405
|
-
return buildNestedWhere(fieldPath, { isNull:
|
|
404
|
+
if (artifact.nullCondition === undefined) return undefined
|
|
405
|
+
return buildNestedWhere(fieldPath, { isNull: artifact.nullCondition })
|
|
406
406
|
},
|
|
407
407
|
}
|
|
408
408
|
}
|
package/src/dataview/types.ts
CHANGED
|
@@ -88,7 +88,12 @@ export interface EnumListFilterArtifact {
|
|
|
88
88
|
* IsDefined filter artifact
|
|
89
89
|
*/
|
|
90
90
|
export interface IsDefinedFilterArtifact {
|
|
91
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Follows the shared `nullCondition` convention used by every other filter handler.
|
|
93
|
+
* `false` = exclude nulls (is-defined); `true` = include-nulls-only (not-defined);
|
|
94
|
+
* `undefined` = filter inactive.
|
|
95
|
+
*/
|
|
96
|
+
readonly nullCondition?: boolean
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
/**
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import type { Disposable, DisposableGroup } from '../core/Disposable.js'
|
|
2
1
|
import type { ActionDispatcher } from '../core/ActionDispatcher.js'
|
|
3
2
|
import type { SnapshotStore } from '../store/SnapshotStore.js'
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Base class for all handles.
|
|
7
|
-
* Provides common functionality for subscription and disposal.
|
|
8
6
|
*
|
|
9
|
-
* Handles are
|
|
7
|
+
* Handles are stateless live views over the store:
|
|
10
8
|
* - Have stable identity (same instance across renders)
|
|
11
|
-
* - Provide subscribe/
|
|
9
|
+
* - Provide subscribe/getVersion for useSyncExternalStore
|
|
12
10
|
* - Dispatch actions for mutations
|
|
11
|
+
*
|
|
12
|
+
* They own no resources — the only subscriptions a handle creates are returned
|
|
13
|
+
* from `subscribe()` and owned by `useSyncExternalStore`, not stored on the
|
|
14
|
+
* handle. There is therefore intentionally no dispose lifecycle: a handle is
|
|
15
|
+
* reclaimed by GC once unreferenced, and a superseded handle (one replaced by a
|
|
16
|
+
* fresh instance on a data change) stays fully usable for late reads/writes.
|
|
13
17
|
*/
|
|
14
|
-
export abstract class BaseHandle
|
|
15
|
-
protected _disposed = false
|
|
16
|
-
|
|
18
|
+
export abstract class BaseHandle {
|
|
17
19
|
constructor(
|
|
18
20
|
protected readonly store: SnapshotStore,
|
|
19
21
|
protected readonly dispatcher: ActionDispatcher,
|
|
@@ -28,29 +30,6 @@ export abstract class BaseHandle implements Disposable {
|
|
|
28
30
|
* Get current version for change detection.
|
|
29
31
|
*/
|
|
30
32
|
abstract getVersion(): number
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Dispose resources (unsubscribe, cleanup).
|
|
34
|
-
*/
|
|
35
|
-
dispose(): void {
|
|
36
|
-
this._disposed = true
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Check if the handle has been disposed.
|
|
41
|
-
*/
|
|
42
|
-
get isDisposed(): boolean {
|
|
43
|
-
return this._disposed
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Throws if the handle has been disposed.
|
|
48
|
-
*/
|
|
49
|
-
protected assertNotDisposed(): void {
|
|
50
|
-
if (this._disposed) {
|
|
51
|
-
throw new Error('Handle has been disposed')
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
33
|
}
|
|
55
34
|
|
|
56
35
|
/**
|
|
@@ -26,14 +26,13 @@ import type {
|
|
|
26
26
|
import { HasOneHandle } from './HasOneHandle.js'
|
|
27
27
|
import { HasManyListHandle } from './HasManyListHandle.js'
|
|
28
28
|
import { createHandleProxy } from './proxyFactory.js'
|
|
29
|
-
import type { SelectionMeta } from '../selection/types.js'
|
|
29
|
+
import type { SelectionMeta, SelectionFieldMeta } from '../selection/types.js'
|
|
30
30
|
import { UnfetchedFieldError } from '../errors/UnfetchedFieldError.js'
|
|
31
31
|
|
|
32
|
-
/** Minimal internal interface for cached relation handles that need reset
|
|
33
|
-
* At runtime, the proxied handles satisfy this through delegation
|
|
32
|
+
/** Minimal internal interface for cached relation handles that need reset.
|
|
33
|
+
* At runtime, the proxied handles satisfy this through delegation. */
|
|
34
34
|
interface RelationHandleRaw {
|
|
35
35
|
reset(): void
|
|
36
|
-
dispose(): void
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
interface CachedFieldHandle {
|
|
@@ -428,7 +427,6 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
428
427
|
* Also resets all relation states (hasOne, hasMany).
|
|
429
428
|
*/
|
|
430
429
|
reset(): void {
|
|
431
|
-
this.assertNotDisposed()
|
|
432
430
|
this.dispatcher.dispatch(resetEntity(this.entityType, this.entityId))
|
|
433
431
|
|
|
434
432
|
// Reset all cached relation handles
|
|
@@ -441,27 +439,9 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
441
439
|
* Commits changes (serverData = data).
|
|
442
440
|
*/
|
|
443
441
|
commit(): void {
|
|
444
|
-
this.assertNotDisposed()
|
|
445
442
|
this.dispatcher.dispatch(commitEntity(this.entityType, this.entityId))
|
|
446
443
|
}
|
|
447
444
|
|
|
448
|
-
/**
|
|
449
|
-
* Disposes the handle and all cached child handles.
|
|
450
|
-
*/
|
|
451
|
-
override dispose(): void {
|
|
452
|
-
super.dispose()
|
|
453
|
-
|
|
454
|
-
for (const { raw } of this.fieldHandleCache.values()) {
|
|
455
|
-
raw.dispose()
|
|
456
|
-
}
|
|
457
|
-
this.fieldHandleCache.clear()
|
|
458
|
-
|
|
459
|
-
for (const { raw } of this.relationHandleCache.values()) {
|
|
460
|
-
raw.dispose()
|
|
461
|
-
}
|
|
462
|
-
this.relationHandleCache.clear()
|
|
463
|
-
}
|
|
464
|
-
|
|
465
445
|
/**
|
|
466
446
|
* Creates a proxy for field access.
|
|
467
447
|
* Returns appropriate handle type based on schema field definition:
|
|
@@ -474,12 +454,14 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
474
454
|
get fields(): EntityFieldsAccessor<T, TSelected> {
|
|
475
455
|
return new Proxy({} as EntityFieldsAccessor<T, TSelected>, {
|
|
476
456
|
get: (_, fieldName: string) => {
|
|
457
|
+
const fieldMeta = this.resolveSelectionField(fieldName)
|
|
458
|
+
|
|
477
459
|
// Selection validation
|
|
478
|
-
if (this.selection && !
|
|
460
|
+
if (this.selection && !fieldMeta) {
|
|
479
461
|
throw new UnfetchedFieldError(this.entityType, this.entityId, [fieldName])
|
|
480
462
|
}
|
|
481
463
|
|
|
482
|
-
const nestedSelection =
|
|
464
|
+
const nestedSelection = fieldMeta?.nested
|
|
483
465
|
|
|
484
466
|
// Use schema to determine field type
|
|
485
467
|
const fieldDef = this.schema.getFieldDef(this.entityType, fieldName)
|
|
@@ -495,8 +477,10 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
495
477
|
}
|
|
496
478
|
|
|
497
479
|
if (fieldDef.type === 'hasMany') {
|
|
498
|
-
// Has-many relation - return HasManyListHandle
|
|
499
|
-
|
|
480
|
+
// Has-many relation - return HasManyListHandle.
|
|
481
|
+
// Thread the selected alias so the handle reads data stored under the
|
|
482
|
+
// auto-generated alias (e.g. `tags_<hash>`) for params-bearing relations.
|
|
483
|
+
return this.hasMany(fieldName, fieldMeta?.alias, nestedSelection)
|
|
500
484
|
}
|
|
501
485
|
|
|
502
486
|
// Unknown field type - fallback to FieldHandle
|
|
@@ -505,6 +489,30 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
505
489
|
})
|
|
506
490
|
}
|
|
507
491
|
|
|
492
|
+
/**
|
|
493
|
+
* Resolves the selection metadata for an accessed property name.
|
|
494
|
+
*
|
|
495
|
+
* Direct lookup covers scalars, has-one, plain has-many, and explicit-alias access.
|
|
496
|
+
* A has-many selected with params (filter/orderBy/limit/offset) is keyed by an
|
|
497
|
+
* auto-generated alias (e.g. `tags_<hash>`) while consumers still read it by the
|
|
498
|
+
* real field name (`tags`). For that case fall back to matching on `fieldName` so
|
|
499
|
+
* the stored alias is recovered. The fallback is restricted to array relations:
|
|
500
|
+
* explicit scalar/has-one aliases are addressed by their chosen alias and must
|
|
501
|
+
* still report as unfetched when read by their original name.
|
|
502
|
+
*/
|
|
503
|
+
private resolveSelectionField(name: string): SelectionFieldMeta | undefined {
|
|
504
|
+
if (!this.selection) return undefined
|
|
505
|
+
|
|
506
|
+
const direct = this.selection.fields.get(name)
|
|
507
|
+
if (direct) return direct
|
|
508
|
+
|
|
509
|
+
for (const meta of this.selection.fields.values()) {
|
|
510
|
+
if (meta.isArray && meta.fieldName === name) return meta
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return undefined
|
|
514
|
+
}
|
|
515
|
+
|
|
508
516
|
/**
|
|
509
517
|
* Type brand - ensures EntityRef<Author> is not assignable to EntityRef<Tag>.
|
|
510
518
|
* This is a phantom property that only exists in the type system.
|
|
@@ -541,7 +549,6 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
541
549
|
* Adds a client-side error to this entity.
|
|
542
550
|
*/
|
|
543
551
|
addError(error: ErrorInput): void {
|
|
544
|
-
this.assertNotDisposed()
|
|
545
552
|
this.dispatcher.dispatch(
|
|
546
553
|
addEntityError(this.entityType, this.entityId, createClientError(error)),
|
|
547
554
|
)
|
|
@@ -551,7 +558,6 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
551
558
|
* Clears entity-level errors.
|
|
552
559
|
*/
|
|
553
560
|
clearErrors(): void {
|
|
554
|
-
this.assertNotDisposed()
|
|
555
561
|
this.dispatcher.dispatch(
|
|
556
562
|
clearEntityErrors(this.entityType, this.entityId),
|
|
557
563
|
)
|
|
@@ -561,7 +567,6 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
561
567
|
* Clears all errors (entity-level, fields, and relations).
|
|
562
568
|
*/
|
|
563
569
|
clearAllErrors(): void {
|
|
564
|
-
this.assertNotDisposed()
|
|
565
570
|
this.dispatcher.dispatch(
|
|
566
571
|
clearAllErrorsAction(this.entityType, this.entityId),
|
|
567
572
|
)
|
|
@@ -124,7 +124,6 @@ export class FieldHandle<T = unknown> extends EntityRelatedHandle {
|
|
|
124
124
|
* Call this on blur or other interaction events.
|
|
125
125
|
*/
|
|
126
126
|
touch(): void {
|
|
127
|
-
this.assertNotDisposed()
|
|
128
127
|
this.store.setFieldTouched(this.entityType, this.entityId, this.fieldName, true)
|
|
129
128
|
}
|
|
130
129
|
|
|
@@ -133,7 +132,6 @@ export class FieldHandle<T = unknown> extends EntityRelatedHandle {
|
|
|
133
132
|
* Also clears non-sticky client errors.
|
|
134
133
|
*/
|
|
135
134
|
setValue(value: T | null): void {
|
|
136
|
-
this.assertNotDisposed()
|
|
137
135
|
// Clear non-sticky errors when value changes
|
|
138
136
|
this.store.clearNonStickyFieldErrors(this.entityType, this.entityId, this.fieldName)
|
|
139
137
|
this.dispatcher.dispatch(
|
|
@@ -159,7 +157,6 @@ export class FieldHandle<T = unknown> extends EntityRelatedHandle {
|
|
|
159
157
|
* Adds a client-side error to this field.
|
|
160
158
|
*/
|
|
161
159
|
addError(error: ErrorInput): void {
|
|
162
|
-
this.assertNotDisposed()
|
|
163
160
|
this.dispatcher.dispatch(
|
|
164
161
|
addFieldError(this.entityType, this.entityId, this.fieldName, createClientError(error)),
|
|
165
162
|
)
|
|
@@ -169,7 +166,6 @@ export class FieldHandle<T = unknown> extends EntityRelatedHandle {
|
|
|
169
166
|
* Clears all errors from this field.
|
|
170
167
|
*/
|
|
171
168
|
clearErrors(): void {
|
|
172
|
-
this.assertNotDisposed()
|
|
173
169
|
this.dispatcher.dispatch(
|
|
174
170
|
clearFieldErrors(this.entityType, this.entityId, this.fieldName),
|
|
175
171
|
)
|
|
@@ -340,7 +340,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
340
340
|
* Connects an existing entity to this has-many relation.
|
|
341
341
|
*/
|
|
342
342
|
connect(itemId: string): void {
|
|
343
|
-
this.assertNotDisposed()
|
|
344
343
|
this.dispatcher.dispatch(
|
|
345
344
|
connectToList(this.entityType, this.entityId, this.fieldName, itemId, this.itemType, this.alias),
|
|
346
345
|
)
|
|
@@ -352,7 +351,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
352
351
|
* For created entities (via add()), cancels the add operation.
|
|
353
352
|
*/
|
|
354
353
|
disconnect(itemId: string): void {
|
|
355
|
-
this.assertNotDisposed()
|
|
356
354
|
this.dispatcher.dispatch(
|
|
357
355
|
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, 'disconnect', this.alias),
|
|
358
356
|
)
|
|
@@ -364,7 +362,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
364
362
|
* For created entities (via add()), cancels the add operation.
|
|
365
363
|
*/
|
|
366
364
|
delete(itemId: string): void {
|
|
367
|
-
this.assertNotDisposed()
|
|
368
365
|
this.dispatcher.dispatch(
|
|
369
366
|
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, 'delete', this.alias),
|
|
370
367
|
)
|
|
@@ -376,7 +373,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
376
373
|
* For connecting existing entities, use connect() instead.
|
|
377
374
|
*/
|
|
378
375
|
add(data?: Partial<TEntity>): string {
|
|
379
|
-
this.assertNotDisposed()
|
|
380
376
|
|
|
381
377
|
// Pre-create entity so we can return tempId
|
|
382
378
|
const tempId = this.store.createEntity(this.itemType, data as Record<string, unknown>)
|
|
@@ -399,7 +395,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
399
395
|
* Falls back to disconnect when schema metadata is not available.
|
|
400
396
|
*/
|
|
401
397
|
remove(itemId: string): void {
|
|
402
|
-
this.assertNotDisposed()
|
|
403
398
|
this.dispatcher.dispatch(
|
|
404
399
|
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, this.resolveRemovalType(), this.alias),
|
|
405
400
|
)
|
|
@@ -430,7 +425,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
430
425
|
* use an 'order' field on the entity.
|
|
431
426
|
*/
|
|
432
427
|
move(fromIndex: number, toIndex: number): void {
|
|
433
|
-
this.assertNotDisposed()
|
|
434
428
|
this.dispatcher.dispatch(
|
|
435
429
|
moveInList(this.entityType, this.entityId, this.fieldName, fromIndex, toIndex, this.alias),
|
|
436
430
|
)
|
|
@@ -441,7 +435,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
441
435
|
* Clears all planned connections and removals.
|
|
442
436
|
*/
|
|
443
437
|
reset(): void {
|
|
444
|
-
this.assertNotDisposed()
|
|
445
438
|
this.store.resetHasMany(
|
|
446
439
|
this.entityType,
|
|
447
440
|
this.entityId,
|
|
@@ -450,19 +443,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
450
443
|
)
|
|
451
444
|
}
|
|
452
445
|
|
|
453
|
-
/**
|
|
454
|
-
* Disposes the handle.
|
|
455
|
-
*/
|
|
456
|
-
override dispose(): void {
|
|
457
|
-
super.dispose()
|
|
458
|
-
|
|
459
|
-
for (const handle of this.itemHandleCacheRaw.values()) {
|
|
460
|
-
handle.dispose()
|
|
461
|
-
}
|
|
462
|
-
this.itemHandleCacheRaw.clear()
|
|
463
|
-
this.itemHandleCacheProxy.clear()
|
|
464
|
-
}
|
|
465
|
-
|
|
466
446
|
/**
|
|
467
447
|
* Type brand - ensures HasManyRef<Author> is not assignable to HasManyRef<Tag>.
|
|
468
448
|
* This is a phantom property that only exists in the type system.
|
|
@@ -489,7 +469,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
489
469
|
* Adds a client-side error to this relation.
|
|
490
470
|
*/
|
|
491
471
|
addError(error: ErrorInput): void {
|
|
492
|
-
this.assertNotDisposed()
|
|
493
472
|
this.dispatcher.dispatch(
|
|
494
473
|
addRelationError(this.entityType, this.entityId, this.fieldName, createClientError(error)),
|
|
495
474
|
)
|
|
@@ -499,7 +478,6 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
499
478
|
* Clears all errors from this relation.
|
|
500
479
|
*/
|
|
501
480
|
clearErrors(): void {
|
|
502
|
-
this.assertNotDisposed()
|
|
503
481
|
this.dispatcher.dispatch(
|
|
504
482
|
clearRelationErrors(this.entityType, this.entityId, this.fieldName),
|
|
505
483
|
)
|