@contember/bindx 0.1.24 → 0.1.26
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/adapter/ContemberAdapter.d.ts +9 -0
- package/dist/adapter/ContemberAdapter.d.ts.map +1 -1
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/core/ActionDispatcher.d.ts.map +1 -1
- package/dist/core/actionClassification.d.ts.map +1 -1
- package/dist/core/actions.d.ts +32 -1
- package/dist/core/actions.d.ts.map +1 -1
- package/dist/events/eventFactory.d.ts.map +1 -1
- package/dist/handles/EntityHandle.d.ts +2 -1
- package/dist/handles/EntityHandle.d.ts.map +1 -1
- package/dist/handles/HasManyListHandle.d.ts +21 -1
- package/dist/handles/HasManyListHandle.d.ts.map +1 -1
- package/dist/handles/HasOneHandle.d.ts +9 -1
- package/dist/handles/HasOneHandle.d.ts.map +1 -1
- package/dist/handles/types.d.ts +4 -1
- package/dist/handles/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/persistence/ContemberSchemaMutationAdapter.d.ts +7 -1
- package/dist/persistence/ContemberSchemaMutationAdapter.d.ts.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/types.d.ts +1 -1
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/store/RelationStore.d.ts +2 -2
- package/dist/store/RelationStore.d.ts.map +1 -1
- package/dist/store/SnapshotStore.d.ts +1 -1
- package/dist/store/SnapshotStore.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/adapter/ContemberAdapter.ts +22 -5
- package/src/adapter/index.ts +1 -1
- package/src/core/ActionDispatcher.ts +22 -1
- package/src/core/actionClassification.ts +2 -0
- package/src/core/actions.ts +74 -0
- package/src/events/eventFactory.ts +70 -4
- package/src/handles/EntityHandle.ts +12 -1
- package/src/handles/HasManyListHandle.ts +68 -38
- package/src/handles/HasOneHandle.ts +17 -1
- package/src/handles/types.ts +4 -1
- package/src/index.ts +6 -1
- package/src/persistence/ContemberSchemaMutationAdapter.ts +2 -1
- package/src/schema/index.ts +1 -0
- package/src/schema/types.ts +1 -0
- package/src/store/RelationStore.ts +3 -3
- package/src/store/SnapshotStore.ts +2 -1
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type {
|
|
|
14
14
|
ScalarFieldDef,
|
|
15
15
|
HasOneRelationDef,
|
|
16
16
|
HasManyRelationDef,
|
|
17
|
+
HasManyRelationKind,
|
|
17
18
|
FieldDef,
|
|
18
19
|
EntitySchemaDef,
|
|
19
20
|
SchemaDefinition,
|
|
@@ -166,7 +167,7 @@ export { EntityHandle, HasOneHandle, HasManyListHandle, FieldHandle } from './ha
|
|
|
166
167
|
export { FIELD_REF_META } from './handles/index.js'
|
|
167
168
|
|
|
168
169
|
// Adapter
|
|
169
|
-
export { MockAdapter, ContemberAdapter } from './adapter/index.js'
|
|
170
|
+
export { MockAdapter, ContemberAdapter, unwrapPaginateFields } from './adapter/index.js'
|
|
170
171
|
|
|
171
172
|
// Core
|
|
172
173
|
export { createEntityLoader, resolveSelectionMeta, buildQuery } from './core/index.js'
|
|
@@ -190,6 +191,10 @@ export {
|
|
|
190
191
|
clearRelationErrors,
|
|
191
192
|
clearAllServerErrors,
|
|
192
193
|
clearAllErrors,
|
|
194
|
+
connectToList,
|
|
195
|
+
addToList,
|
|
196
|
+
removeFromList,
|
|
197
|
+
moveInList,
|
|
193
198
|
} from './core/actions.js'
|
|
194
199
|
|
|
195
200
|
// Store
|
|
@@ -9,7 +9,8 @@ export interface SchemaNames {
|
|
|
9
9
|
readonly fields: {
|
|
10
10
|
readonly [fieldName: string]:
|
|
11
11
|
| { readonly type: 'column'; readonly enumName?: string; readonly columnType?: string }
|
|
12
|
-
| { readonly type: '
|
|
12
|
+
| { readonly type: 'one'; readonly entity: string; readonly nullable?: boolean }
|
|
13
|
+
| { readonly type: 'many'; readonly entity: string; readonly relationKind?: 'oneHasMany' | 'manyHasMany'; readonly nullable?: boolean }
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
}
|
package/src/schema/index.ts
CHANGED
package/src/schema/types.ts
CHANGED
|
@@ -368,10 +368,10 @@ export class RelationStore {
|
|
|
368
368
|
/**
|
|
369
369
|
* Removes an entity from a has-many relation.
|
|
370
370
|
* For newly created entities (via add()), cancels the connection.
|
|
371
|
-
* For existing server entities, plans
|
|
371
|
+
* For existing server entities, plans the specified removal type.
|
|
372
372
|
* Returns the key if a removal was planned (caller should notify), or null if handled inline.
|
|
373
373
|
*/
|
|
374
|
-
removeFromHasMany(key: string, itemId: string): 'planned_removal' | 'cancelled_connection' | null {
|
|
374
|
+
removeFromHasMany(key: string, itemId: string, removalType: HasManyRemovalType): 'planned_removal' | 'cancelled_connection' | null {
|
|
375
375
|
const existing = this.hasManyStates.get(key)
|
|
376
376
|
if (!existing) return null
|
|
377
377
|
|
|
@@ -410,7 +410,7 @@ export class RelationStore {
|
|
|
410
410
|
this.hasManyStates.set(key, newState)
|
|
411
411
|
return 'cancelled_connection'
|
|
412
412
|
} else {
|
|
413
|
-
this.planHasManyRemoval(key, itemId,
|
|
413
|
+
this.planHasManyRemoval(key, itemId, removalType)
|
|
414
414
|
return 'planned_removal'
|
|
415
415
|
}
|
|
416
416
|
}
|
|
@@ -377,10 +377,11 @@ export class SnapshotStore implements SnapshotVersionBumper {
|
|
|
377
377
|
parentId: string,
|
|
378
378
|
fieldName: string,
|
|
379
379
|
itemId: string,
|
|
380
|
+
removalType: HasManyRemovalType,
|
|
380
381
|
alias?: string,
|
|
381
382
|
): void {
|
|
382
383
|
const key = this.getRelationKey(parentType, parentId, alias ?? fieldName)
|
|
383
|
-
const result = this.relations.removeFromHasMany(key, itemId)
|
|
384
|
+
const result = this.relations.removeFromHasMany(key, itemId, removalType)
|
|
384
385
|
if (result === 'planned_removal') {
|
|
385
386
|
this.notifyRelationSubscribers(key)
|
|
386
387
|
} else if (result === 'cancelled_connection') {
|