@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
|
@@ -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;AAMvE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACrG,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE/F,KAAK,UAAU,GAAG,MAAM,IAAI,CAAA;AAE5B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAc,YAAW,qBAAqB;IAC1D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA4B;IAC5D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwB;IAC7C,OAAO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,CAAA;QAChD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;QAC9C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KACpC;IASD,qBAAqB,CAAC,QAAQ,EAAE;QAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QAC5C,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;QAChD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;QAC9C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KACpC,GAAG,IAAI;IAsBR,mBAAmB,IAAI,KAAK,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;KAC1C,CAAC;IAIF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAI9D,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAIjE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAQ9E,KAAK,IAAI,IAAI;CASb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/bindx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
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.26",
|
|
21
21
|
"@contember/graphql-builder": "^2.1.0-beta.1",
|
|
22
22
|
"@contember/graphql-client": "^2.1.0-beta.1"
|
|
23
23
|
},
|
|
@@ -253,7 +253,7 @@ export class ContemberAdapter implements BackendAdapter {
|
|
|
253
253
|
* but the store expects flat arrays keyed by the original field name.
|
|
254
254
|
* This function uses the QuerySpec to identify which fields need unwrapping.
|
|
255
255
|
*/
|
|
256
|
-
function unwrapPaginateFields(data: Record<string, unknown>, spec: QuerySpec): Record<string, unknown> {
|
|
256
|
+
export function unwrapPaginateFields(data: Record<string, unknown>, spec: QuerySpec): Record<string, unknown> {
|
|
257
257
|
const result: Record<string, unknown> = {}
|
|
258
258
|
|
|
259
259
|
// Copy all fields from data first
|
|
@@ -264,28 +264,45 @@ function unwrapPaginateFields(data: Record<string, unknown>, spec: QuerySpec): R
|
|
|
264
264
|
if (!fieldName) continue
|
|
265
265
|
|
|
266
266
|
if (field.isArray && field.nested) {
|
|
267
|
-
// Has-many field — look for paginate key or
|
|
267
|
+
// Has-many field — look for paginate key, alias, or plain field name
|
|
268
268
|
const paginateKey = `paginate${fieldName.charAt(0).toUpperCase()}${fieldName.slice(1)}`
|
|
269
269
|
const alias = field.name !== fieldName ? field.name : null
|
|
270
|
-
|
|
270
|
+
// Try alias first, then paginate key, then plain field name
|
|
271
|
+
const lookupKey = alias ?? (data[paginateKey] !== undefined ? paginateKey : fieldName)
|
|
271
272
|
|
|
272
273
|
const value = data[lookupKey]
|
|
273
274
|
handledKeys.add(lookupKey)
|
|
275
|
+
// Also mark the plain field name as handled to prevent duplicate in extra fields
|
|
276
|
+
if (lookupKey !== fieldName) handledKeys.add(fieldName)
|
|
274
277
|
|
|
275
278
|
if (value && typeof value === 'object' && 'edges' in value) {
|
|
276
279
|
const connection = value as { edges: { node: unknown }[]; pageInfo?: { totalCount: number } }
|
|
277
280
|
const items = unwrapPaginateResult(connection, !!field.totalCount) as Record<string, unknown>[]
|
|
278
281
|
result[field.name] = items.map(item => unwrapPaginateFields(item, field.nested!))
|
|
282
|
+
} else if (Array.isArray(value)) {
|
|
283
|
+
// Plain array — recurse into nested fields for each item
|
|
284
|
+
result[field.name] = value.map(item =>
|
|
285
|
+
typeof item === 'object' && item !== null
|
|
286
|
+
? unwrapPaginateFields(item as Record<string, unknown>, field.nested!)
|
|
287
|
+
: item,
|
|
288
|
+
)
|
|
279
289
|
} else {
|
|
280
290
|
result[field.name] = value
|
|
281
291
|
}
|
|
282
292
|
} else if (field.nested) {
|
|
283
|
-
//
|
|
293
|
+
// Relation — recurse into nested
|
|
284
294
|
const lookupKey = field.name !== fieldName ? field.name : fieldName
|
|
285
295
|
const value = data[lookupKey]
|
|
286
296
|
handledKeys.add(lookupKey)
|
|
287
297
|
|
|
288
|
-
if (value
|
|
298
|
+
if (Array.isArray(value)) {
|
|
299
|
+
// Has-many relation (isArray may not be set by selection builder when no params)
|
|
300
|
+
result[field.name] = value.map(item =>
|
|
301
|
+
typeof item === 'object' && item !== null
|
|
302
|
+
? unwrapPaginateFields(item as Record<string, unknown>, field.nested!)
|
|
303
|
+
: item,
|
|
304
|
+
)
|
|
305
|
+
} else if (value && typeof value === 'object') {
|
|
289
306
|
result[field.name] = unwrapPaginateFields(value as Record<string, unknown>, field.nested)
|
|
290
307
|
} else {
|
|
291
308
|
result[field.name] = value
|
package/src/adapter/index.ts
CHANGED
|
@@ -18,4 +18,4 @@ export type {
|
|
|
18
18
|
} from './types.js'
|
|
19
19
|
export { MockAdapter, type MockDataStore, type MockAdapterOptions } from './MockAdapter.js'
|
|
20
20
|
export { MockQueryEngine } from './MockQueryEngine.js'
|
|
21
|
-
export { ContemberAdapter, type ContemberAdapterOptions } from './ContemberAdapter.js'
|
|
21
|
+
export { ContemberAdapter, type ContemberAdapterOptions, unwrapPaginateFields } from './ContemberAdapter.js'
|
|
@@ -146,7 +146,14 @@ export class ActionDispatcher {
|
|
|
146
146
|
}
|
|
147
147
|
break
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
case 'CONNECT_TO_LIST':
|
|
150
|
+
if (event.type === 'hasMany:connecting') {
|
|
151
|
+
return {
|
|
152
|
+
...action,
|
|
153
|
+
itemId: event.itemId,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
break
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
return action
|
|
@@ -278,6 +285,16 @@ export class ActionDispatcher {
|
|
|
278
285
|
break
|
|
279
286
|
}
|
|
280
287
|
|
|
288
|
+
case 'CONNECT_TO_LIST':
|
|
289
|
+
this.store.planHasManyConnection(
|
|
290
|
+
action.entityType,
|
|
291
|
+
action.entityId,
|
|
292
|
+
action.fieldName,
|
|
293
|
+
action.itemId,
|
|
294
|
+
action.alias,
|
|
295
|
+
)
|
|
296
|
+
break
|
|
297
|
+
|
|
281
298
|
case 'ADD_TO_LIST': {
|
|
282
299
|
// Create entity if itemId not provided
|
|
283
300
|
const itemId = action.itemId ?? this.store.createEntity(action.targetType, action.itemData)
|
|
@@ -287,6 +304,7 @@ export class ActionDispatcher {
|
|
|
287
304
|
action.entityId,
|
|
288
305
|
action.fieldName,
|
|
289
306
|
itemId,
|
|
307
|
+
action.alias,
|
|
290
308
|
)
|
|
291
309
|
break
|
|
292
310
|
}
|
|
@@ -297,6 +315,8 @@ export class ActionDispatcher {
|
|
|
297
315
|
action.entityId,
|
|
298
316
|
action.fieldName,
|
|
299
317
|
action.itemKey,
|
|
318
|
+
action.removalType,
|
|
319
|
+
action.alias,
|
|
300
320
|
)
|
|
301
321
|
break
|
|
302
322
|
|
|
@@ -307,6 +327,7 @@ export class ActionDispatcher {
|
|
|
307
327
|
action.fieldName,
|
|
308
328
|
action.fromIndex,
|
|
309
329
|
action.toIndex,
|
|
330
|
+
action.alias,
|
|
310
331
|
)
|
|
311
332
|
break
|
|
312
333
|
|
|
@@ -26,6 +26,7 @@ const TRACKABLE_ACTION_TYPES = new Set<Action['type']>([
|
|
|
26
26
|
'DELETE_RELATION',
|
|
27
27
|
'RESET_ENTITY',
|
|
28
28
|
'RESET_RELATION',
|
|
29
|
+
'CONNECT_TO_LIST',
|
|
29
30
|
'ADD_TO_LIST',
|
|
30
31
|
'REMOVE_FROM_LIST',
|
|
31
32
|
'MOVE_IN_LIST',
|
|
@@ -119,6 +120,7 @@ export function getAffectedKeys(action: Action): StoreAffectedKeys {
|
|
|
119
120
|
)
|
|
120
121
|
break
|
|
121
122
|
|
|
123
|
+
case 'CONNECT_TO_LIST':
|
|
122
124
|
case 'ADD_TO_LIST':
|
|
123
125
|
case 'REMOVE_FROM_LIST':
|
|
124
126
|
case 'MOVE_IN_LIST':
|
package/src/core/actions.ts
CHANGED
|
@@ -117,6 +117,18 @@ export interface SetPlaceholderDataAction {
|
|
|
117
117
|
|
|
118
118
|
// ==================== List Actions ====================
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Connects an existing entity to a has-many list
|
|
122
|
+
*/
|
|
123
|
+
export interface ConnectToListAction {
|
|
124
|
+
readonly type: 'CONNECT_TO_LIST'
|
|
125
|
+
readonly entityType: string
|
|
126
|
+
readonly entityId: string
|
|
127
|
+
readonly fieldName: string
|
|
128
|
+
readonly itemId: string
|
|
129
|
+
readonly alias?: string
|
|
130
|
+
}
|
|
131
|
+
|
|
120
132
|
/**
|
|
121
133
|
* Adds an item to a has-many list
|
|
122
134
|
*/
|
|
@@ -128,6 +140,7 @@ export interface AddToListAction {
|
|
|
128
140
|
readonly targetType: string
|
|
129
141
|
readonly itemData?: Record<string, unknown>
|
|
130
142
|
readonly itemId?: string
|
|
143
|
+
readonly alias?: string
|
|
131
144
|
}
|
|
132
145
|
|
|
133
146
|
/**
|
|
@@ -139,6 +152,8 @@ export interface RemoveFromListAction {
|
|
|
139
152
|
readonly entityId: string
|
|
140
153
|
readonly fieldName: string
|
|
141
154
|
readonly itemKey: string
|
|
155
|
+
readonly removalType: 'disconnect' | 'delete'
|
|
156
|
+
readonly alias?: string
|
|
142
157
|
}
|
|
143
158
|
|
|
144
159
|
/**
|
|
@@ -151,6 +166,7 @@ export interface MoveInListAction {
|
|
|
151
166
|
readonly fieldName: string
|
|
152
167
|
readonly fromIndex: number
|
|
153
168
|
readonly toIndex: number
|
|
169
|
+
readonly alias?: string
|
|
154
170
|
}
|
|
155
171
|
|
|
156
172
|
// ==================== Load State Actions ====================
|
|
@@ -276,6 +292,7 @@ export type Action =
|
|
|
276
292
|
| ResetRelationAction
|
|
277
293
|
| CommitRelationAction
|
|
278
294
|
| SetPlaceholderDataAction
|
|
295
|
+
| ConnectToListAction
|
|
279
296
|
| AddToListAction
|
|
280
297
|
| RemoveFromListAction
|
|
281
298
|
| MoveInListAction
|
|
@@ -489,3 +506,60 @@ export function clearAllErrors(
|
|
|
489
506
|
): ClearAllErrorsAction {
|
|
490
507
|
return { type: 'CLEAR_ALL_ERRORS', entityType, entityId }
|
|
491
508
|
}
|
|
509
|
+
|
|
510
|
+
// ==================== List Action Creators ====================
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Creates a CONNECT_TO_LIST action
|
|
514
|
+
*/
|
|
515
|
+
export function connectToList(
|
|
516
|
+
entityType: string,
|
|
517
|
+
entityId: string,
|
|
518
|
+
fieldName: string,
|
|
519
|
+
itemId: string,
|
|
520
|
+
alias?: string,
|
|
521
|
+
): ConnectToListAction {
|
|
522
|
+
return { type: 'CONNECT_TO_LIST', entityType, entityId, fieldName, itemId, alias }
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Creates an ADD_TO_LIST action
|
|
527
|
+
*/
|
|
528
|
+
export function addToList(
|
|
529
|
+
entityType: string,
|
|
530
|
+
entityId: string,
|
|
531
|
+
fieldName: string,
|
|
532
|
+
targetType: string,
|
|
533
|
+
itemId: string,
|
|
534
|
+
alias?: string,
|
|
535
|
+
): AddToListAction {
|
|
536
|
+
return { type: 'ADD_TO_LIST', entityType, entityId, fieldName, targetType, itemId, alias }
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Creates a REMOVE_FROM_LIST action
|
|
541
|
+
*/
|
|
542
|
+
export function removeFromList(
|
|
543
|
+
entityType: string,
|
|
544
|
+
entityId: string,
|
|
545
|
+
fieldName: string,
|
|
546
|
+
itemKey: string,
|
|
547
|
+
removalType: 'disconnect' | 'delete',
|
|
548
|
+
alias?: string,
|
|
549
|
+
): RemoveFromListAction {
|
|
550
|
+
return { type: 'REMOVE_FROM_LIST', entityType, entityId, fieldName, itemKey, removalType, alias }
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Creates a MOVE_IN_LIST action
|
|
555
|
+
*/
|
|
556
|
+
export function moveInList(
|
|
557
|
+
entityType: string,
|
|
558
|
+
entityId: string,
|
|
559
|
+
fieldName: string,
|
|
560
|
+
fromIndex: number,
|
|
561
|
+
toIndex: number,
|
|
562
|
+
alias?: string,
|
|
563
|
+
): MoveInListAction {
|
|
564
|
+
return { type: 'MOVE_IN_LIST', entityType, entityId, fieldName, fromIndex, toIndex, alias }
|
|
565
|
+
}
|
|
@@ -123,10 +123,38 @@ export function createBeforeEvent(
|
|
|
123
123
|
} satisfies EntityResettingEvent
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
case 'CONNECT_TO_LIST': {
|
|
127
|
+
return {
|
|
128
|
+
type: 'hasMany:connecting',
|
|
129
|
+
timestamp,
|
|
130
|
+
entityType: action.entityType,
|
|
131
|
+
entityId: action.entityId,
|
|
132
|
+
fieldName: action.fieldName,
|
|
133
|
+
itemId: action.itemId,
|
|
134
|
+
} satisfies HasManyConnectingEvent
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
case 'ADD_TO_LIST': {
|
|
138
|
+
return {
|
|
139
|
+
type: 'hasMany:connecting',
|
|
140
|
+
timestamp,
|
|
141
|
+
entityType: action.entityType,
|
|
142
|
+
entityId: action.entityId,
|
|
143
|
+
fieldName: action.fieldName,
|
|
144
|
+
itemId: action.itemId ?? '',
|
|
145
|
+
} satisfies HasManyConnectingEvent
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
case 'REMOVE_FROM_LIST': {
|
|
149
|
+
return {
|
|
150
|
+
type: 'hasMany:disconnecting',
|
|
151
|
+
timestamp,
|
|
152
|
+
entityType: action.entityType,
|
|
153
|
+
entityId: action.entityId,
|
|
154
|
+
fieldName: action.fieldName,
|
|
155
|
+
itemId: action.itemKey,
|
|
156
|
+
} satisfies HasManyDisconnectingEvent
|
|
157
|
+
}
|
|
130
158
|
|
|
131
159
|
default:
|
|
132
160
|
return null
|
|
@@ -169,6 +197,11 @@ export function captureStateBeforeAction(
|
|
|
169
197
|
}
|
|
170
198
|
}
|
|
171
199
|
|
|
200
|
+
case 'CONNECT_TO_LIST':
|
|
201
|
+
case 'ADD_TO_LIST':
|
|
202
|
+
case 'REMOVE_FROM_LIST':
|
|
203
|
+
return {}
|
|
204
|
+
|
|
172
205
|
default:
|
|
173
206
|
return {}
|
|
174
207
|
}
|
|
@@ -336,6 +369,39 @@ export function createAfterEvent(
|
|
|
336
369
|
} satisfies LoadStateChangedEvent
|
|
337
370
|
}
|
|
338
371
|
|
|
372
|
+
case 'CONNECT_TO_LIST': {
|
|
373
|
+
return {
|
|
374
|
+
type: 'hasMany:connected',
|
|
375
|
+
timestamp,
|
|
376
|
+
entityType: action.entityType,
|
|
377
|
+
entityId: action.entityId,
|
|
378
|
+
fieldName: action.fieldName,
|
|
379
|
+
itemId: action.itemId,
|
|
380
|
+
} satisfies HasManyConnectedEvent
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
case 'ADD_TO_LIST': {
|
|
384
|
+
return {
|
|
385
|
+
type: 'hasMany:connected',
|
|
386
|
+
timestamp,
|
|
387
|
+
entityType: action.entityType,
|
|
388
|
+
entityId: action.entityId,
|
|
389
|
+
fieldName: action.fieldName,
|
|
390
|
+
itemId: action.itemId ?? '',
|
|
391
|
+
} satisfies HasManyConnectedEvent
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
case 'REMOVE_FROM_LIST': {
|
|
395
|
+
return {
|
|
396
|
+
type: 'hasMany:disconnected',
|
|
397
|
+
timestamp,
|
|
398
|
+
entityType: action.entityType,
|
|
399
|
+
entityId: action.entityId,
|
|
400
|
+
fieldName: action.fieldName,
|
|
401
|
+
itemId: action.itemKey,
|
|
402
|
+
} satisfies HasManyDisconnectedEvent
|
|
403
|
+
}
|
|
404
|
+
|
|
339
405
|
default:
|
|
340
406
|
return null
|
|
341
407
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
clearEntityErrors,
|
|
12
12
|
clearAllErrors as clearAllErrorsAction,
|
|
13
13
|
} from '../core/actions.js'
|
|
14
|
-
import { type FieldAccessor, type HasOneAccessor, type HasManyAccessor, type EntityFieldsAccessor, type Unsubscribe, type EntityAccessor } from './types.js'
|
|
14
|
+
import { FIELD_REF_META, type FieldRefMeta, type FieldAccessor, type HasOneAccessor, type HasManyAccessor, type EntityFieldsAccessor, type Unsubscribe, type EntityAccessor } from './types.js'
|
|
15
15
|
import { deepEqual } from '../utils/deepEqual.js'
|
|
16
16
|
import { createClientError, type ErrorInput, type FieldError } from '../errors/types.js'
|
|
17
17
|
import type {
|
|
@@ -114,6 +114,17 @@ export class EntityHandle<T extends object = object, TSelected = T> extends Enti
|
|
|
114
114
|
return createHandleProxy<EntityHandle<T, TSelected>, EntityAccessor<T, TSelected>>(handle, (target) => target.fields)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
get [FIELD_REF_META](): FieldRefMeta {
|
|
118
|
+
return {
|
|
119
|
+
entityType: this.entityType,
|
|
120
|
+
entityId: this.entityId,
|
|
121
|
+
path: [],
|
|
122
|
+
fieldName: '',
|
|
123
|
+
isArray: false,
|
|
124
|
+
isRelation: false,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
117
128
|
/**
|
|
118
129
|
* Gets the entity ID.
|
|
119
130
|
*/
|
|
@@ -2,9 +2,14 @@ import { EntityRelatedHandle } from './BaseHandle.js'
|
|
|
2
2
|
import { EntityHandle } from './EntityHandle.js'
|
|
3
3
|
import type { ActionDispatcher } from '../core/ActionDispatcher.js'
|
|
4
4
|
import type { SnapshotStore } from '../store/SnapshotStore.js'
|
|
5
|
+
import type { HasManyRemovalType } from '../store/RelationStore.js'
|
|
5
6
|
import type { SchemaRegistry } from '../schema/SchemaRegistry.js'
|
|
6
7
|
import type { SelectionMeta } from '../selection/types.js'
|
|
7
8
|
import {
|
|
9
|
+
connectToList,
|
|
10
|
+
addToList,
|
|
11
|
+
removeFromList,
|
|
12
|
+
moveInList,
|
|
8
13
|
addRelationError,
|
|
9
14
|
clearRelationErrors,
|
|
10
15
|
} from '../core/actions.js'
|
|
@@ -191,6 +196,19 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
191
196
|
const connection = rawData as { edges: Array<{ node: Record<string, unknown> }> }
|
|
192
197
|
return connection.edges.map(edge => edge.node)
|
|
193
198
|
}
|
|
199
|
+
// Object with numeric keys (store may convert arrays to objects): { "0": {...}, "1": {...}, ...metadata }
|
|
200
|
+
if (rawData && typeof rawData === 'object' && !Array.isArray(rawData)) {
|
|
201
|
+
const obj = rawData as Record<string, unknown>
|
|
202
|
+
const items: Array<Record<string, unknown>> = []
|
|
203
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
204
|
+
if (/^\d+$/.test(key) && value && typeof value === 'object' && 'id' in (value as object)) {
|
|
205
|
+
items.push(value as Record<string, unknown>)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (items.length > 0) {
|
|
209
|
+
return items
|
|
210
|
+
}
|
|
211
|
+
}
|
|
194
212
|
return null
|
|
195
213
|
}
|
|
196
214
|
|
|
@@ -285,30 +303,34 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
285
303
|
*/
|
|
286
304
|
connect(itemId: string): void {
|
|
287
305
|
this.assertNotDisposed()
|
|
288
|
-
this.
|
|
289
|
-
this.entityType,
|
|
290
|
-
this.entityId,
|
|
291
|
-
this.fieldName,
|
|
292
|
-
itemId,
|
|
293
|
-
this.alias,
|
|
306
|
+
this.dispatcher.dispatch(
|
|
307
|
+
connectToList(this.entityType, this.entityId, this.fieldName, itemId, this.alias),
|
|
294
308
|
)
|
|
295
|
-
|
|
296
309
|
// Register parent-child so that changes to the connected entity propagate to the parent
|
|
297
310
|
this.store.registerParentChild(this.entityType, this.entityId, this.itemType, itemId)
|
|
298
311
|
}
|
|
299
312
|
|
|
300
313
|
/**
|
|
301
314
|
* Disconnects an entity from this has-many relation.
|
|
315
|
+
* Sets the FK to null — only works when the FK column is nullable.
|
|
316
|
+
* For created entities (via add()), cancels the add operation.
|
|
302
317
|
*/
|
|
303
318
|
disconnect(itemId: string): void {
|
|
304
319
|
this.assertNotDisposed()
|
|
305
|
-
this.
|
|
306
|
-
this.entityType,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
320
|
+
this.dispatcher.dispatch(
|
|
321
|
+
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, 'disconnect', this.alias),
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Deletes an entity from this has-many relation.
|
|
327
|
+
* Removes the entity itself from the database.
|
|
328
|
+
* For created entities (via add()), cancels the add operation.
|
|
329
|
+
*/
|
|
330
|
+
delete(itemId: string): void {
|
|
331
|
+
this.assertNotDisposed()
|
|
332
|
+
this.dispatcher.dispatch(
|
|
333
|
+
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, 'delete', this.alias),
|
|
312
334
|
)
|
|
313
335
|
}
|
|
314
336
|
|
|
@@ -320,16 +342,12 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
320
342
|
add(data?: Partial<TEntity>): string {
|
|
321
343
|
this.assertNotDisposed()
|
|
322
344
|
|
|
323
|
-
//
|
|
345
|
+
// Pre-create entity so we can return tempId
|
|
324
346
|
const tempId = this.store.createEntity(this.itemType, data as Record<string, unknown>)
|
|
325
347
|
|
|
326
|
-
// Add to has-many relation
|
|
327
|
-
this.
|
|
328
|
-
this.entityType,
|
|
329
|
-
this.entityId,
|
|
330
|
-
this.fieldName,
|
|
331
|
-
tempId,
|
|
332
|
-
this.alias,
|
|
348
|
+
// Add to has-many relation through dispatcher (enables events/interceptors)
|
|
349
|
+
this.dispatcher.dispatch(
|
|
350
|
+
addToList(this.entityType, this.entityId, this.fieldName, this.itemType, tempId, this.alias),
|
|
333
351
|
)
|
|
334
352
|
|
|
335
353
|
// Register parent-child so that changes to the new entity propagate to the parent
|
|
@@ -341,20 +359,38 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
341
359
|
/**
|
|
342
360
|
* Removes an item from the list by ID.
|
|
343
361
|
* For newly created entities (via add()), cancels the add operation.
|
|
344
|
-
* For existing server entities,
|
|
362
|
+
* For existing server entities, auto-detects removal strategy from schema:
|
|
363
|
+
* - manyHasMany → disconnect (removes the junction record)
|
|
364
|
+
* - oneHasMany + nullable FK → disconnect (sets FK to null)
|
|
365
|
+
* - oneHasMany + non-nullable FK → delete (child can't exist without parent)
|
|
366
|
+
* Falls back to disconnect when schema metadata is not available.
|
|
345
367
|
*/
|
|
346
368
|
remove(itemId: string): void {
|
|
347
369
|
this.assertNotDisposed()
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
this.entityType,
|
|
351
|
-
this.entityId,
|
|
352
|
-
this.fieldName,
|
|
353
|
-
itemId,
|
|
354
|
-
this.alias,
|
|
370
|
+
this.dispatcher.dispatch(
|
|
371
|
+
removeFromList(this.entityType, this.entityId, this.fieldName, itemId, this.resolveRemovalType(), this.alias),
|
|
355
372
|
)
|
|
356
373
|
}
|
|
357
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Resolves the default removal type for this has-many relation based on schema metadata.
|
|
377
|
+
* - manyHasMany → disconnect (removes junction record, target entity stays)
|
|
378
|
+
* - oneHasMany + nullable FK → disconnect (sets FK to null, child entity stays)
|
|
379
|
+
* - oneHasMany + non-nullable FK → delete (child can't exist without parent)
|
|
380
|
+
* - unknown → disconnect (safe fallback)
|
|
381
|
+
*/
|
|
382
|
+
private resolveRemovalType(): HasManyRemovalType {
|
|
383
|
+
const relationKind = this.schema.getHasManyRelationKind(this.entityType, this.fieldName)
|
|
384
|
+
if (relationKind === 'oneHasMany') {
|
|
385
|
+
const nullable = this.schema.getRelationNullable(this.entityType, this.fieldName)
|
|
386
|
+
if (nullable === true) {
|
|
387
|
+
return 'disconnect'
|
|
388
|
+
}
|
|
389
|
+
return 'delete'
|
|
390
|
+
}
|
|
391
|
+
return 'disconnect'
|
|
392
|
+
}
|
|
393
|
+
|
|
358
394
|
/**
|
|
359
395
|
* Moves an item from one position to another within the list.
|
|
360
396
|
* Note: This only affects client-side order. For persistent ordering,
|
|
@@ -362,14 +398,8 @@ export class HasManyListHandle<TEntity extends object = object, TSelected = TEnt
|
|
|
362
398
|
*/
|
|
363
399
|
move(fromIndex: number, toIndex: number): void {
|
|
364
400
|
this.assertNotDisposed()
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
this.entityType,
|
|
368
|
-
this.entityId,
|
|
369
|
-
this.fieldName,
|
|
370
|
-
fromIndex,
|
|
371
|
-
toIndex,
|
|
372
|
-
this.alias,
|
|
401
|
+
this.dispatcher.dispatch(
|
|
402
|
+
moveInList(this.entityType, this.entityId, this.fieldName, fromIndex, toIndex, this.alias),
|
|
373
403
|
)
|
|
374
404
|
}
|
|
375
405
|
|
|
@@ -358,6 +358,7 @@ export class HasOneHandle<TEntity extends object = object, TSelected = TEntity>
|
|
|
358
358
|
|
|
359
359
|
/**
|
|
360
360
|
* Disconnects the relation.
|
|
361
|
+
* Sets the FK to null — only works when the FK column is nullable.
|
|
361
362
|
*/
|
|
362
363
|
disconnect(): void {
|
|
363
364
|
this.assertNotDisposed()
|
|
@@ -367,7 +368,7 @@ export class HasOneHandle<TEntity extends object = object, TSelected = TEntity>
|
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
/**
|
|
370
|
-
* Marks the
|
|
371
|
+
* Marks the related entity for deletion.
|
|
371
372
|
*/
|
|
372
373
|
delete(): void {
|
|
373
374
|
this.assertNotDisposed()
|
|
@@ -376,6 +377,21 @@ export class HasOneHandle<TEntity extends object = object, TSelected = TEntity>
|
|
|
376
377
|
)
|
|
377
378
|
}
|
|
378
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Removes the related entity using the appropriate strategy based on schema metadata.
|
|
382
|
+
* - nullable FK → disconnect (sets FK to null, related entity stays)
|
|
383
|
+
* - non-nullable FK → delete (related entity can't exist without parent)
|
|
384
|
+
* - unknown → disconnect (safe fallback)
|
|
385
|
+
*/
|
|
386
|
+
remove(): void {
|
|
387
|
+
const nullable = this.schema.getRelationNullable(this.entityType, this.fieldName)
|
|
388
|
+
if (nullable === false) {
|
|
389
|
+
this.delete()
|
|
390
|
+
} else {
|
|
391
|
+
this.disconnect()
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
379
395
|
/**
|
|
380
396
|
* Resets the relation to server state.
|
|
381
397
|
*/
|
package/src/handles/types.ts
CHANGED
|
@@ -165,7 +165,8 @@ export interface HasManyRef<
|
|
|
165
165
|
remove(itemId: string): void
|
|
166
166
|
move(fromIndex: number, toIndex: number): void
|
|
167
167
|
connect(itemId: string): void
|
|
168
|
-
disconnect(itemId: string
|
|
168
|
+
disconnect(itemId: string): void
|
|
169
|
+
delete(itemId: string): void
|
|
169
170
|
reset(): void
|
|
170
171
|
readonly __entityType: TEntity
|
|
171
172
|
readonly __selected?: TSelected
|
|
@@ -229,6 +230,7 @@ export interface HasOneRefInterface<
|
|
|
229
230
|
$connect(id: string): void
|
|
230
231
|
$disconnect(): void
|
|
231
232
|
$delete(): void
|
|
233
|
+
$remove(): void
|
|
232
234
|
$reset(): void
|
|
233
235
|
readonly $errors: readonly FieldError[]
|
|
234
236
|
readonly $hasError: boolean
|
|
@@ -288,6 +290,7 @@ export interface EntityRefInterface<
|
|
|
288
290
|
TEntityName extends string = string,
|
|
289
291
|
TSchema extends Record<string, object> = Record<string, object>,
|
|
290
292
|
> {
|
|
293
|
+
readonly [FIELD_REF_META]: FieldRefMeta<TEntityName>
|
|
291
294
|
readonly id: string
|
|
292
295
|
readonly $isDirty: boolean
|
|
293
296
|
readonly $isPersisting: boolean
|