@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.
Files changed (46) hide show
  1. package/dist/adapter/ContemberAdapter.d.ts +9 -0
  2. package/dist/adapter/ContemberAdapter.d.ts.map +1 -1
  3. package/dist/adapter/index.d.ts +1 -1
  4. package/dist/adapter/index.d.ts.map +1 -1
  5. package/dist/core/ActionDispatcher.d.ts.map +1 -1
  6. package/dist/core/actionClassification.d.ts.map +1 -1
  7. package/dist/core/actions.d.ts +32 -1
  8. package/dist/core/actions.d.ts.map +1 -1
  9. package/dist/events/eventFactory.d.ts.map +1 -1
  10. package/dist/handles/EntityHandle.d.ts +2 -1
  11. package/dist/handles/EntityHandle.d.ts.map +1 -1
  12. package/dist/handles/HasManyListHandle.d.ts +21 -1
  13. package/dist/handles/HasManyListHandle.d.ts.map +1 -1
  14. package/dist/handles/HasOneHandle.d.ts +9 -1
  15. package/dist/handles/HasOneHandle.d.ts.map +1 -1
  16. package/dist/handles/types.d.ts +4 -1
  17. package/dist/handles/types.d.ts.map +1 -1
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/persistence/ContemberSchemaMutationAdapter.d.ts +7 -1
  21. package/dist/persistence/ContemberSchemaMutationAdapter.d.ts.map +1 -1
  22. package/dist/schema/index.d.ts +1 -1
  23. package/dist/schema/index.d.ts.map +1 -1
  24. package/dist/schema/types.d.ts +1 -1
  25. package/dist/schema/types.d.ts.map +1 -1
  26. package/dist/store/RelationStore.d.ts +2 -2
  27. package/dist/store/RelationStore.d.ts.map +1 -1
  28. package/dist/store/SnapshotStore.d.ts +1 -1
  29. package/dist/store/SnapshotStore.d.ts.map +1 -1
  30. package/package.json +2 -2
  31. package/src/adapter/ContemberAdapter.ts +22 -5
  32. package/src/adapter/index.ts +1 -1
  33. package/src/core/ActionDispatcher.ts +22 -1
  34. package/src/core/actionClassification.ts +2 -0
  35. package/src/core/actions.ts +74 -0
  36. package/src/events/eventFactory.ts +70 -4
  37. package/src/handles/EntityHandle.ts +12 -1
  38. package/src/handles/HasManyListHandle.ts +68 -38
  39. package/src/handles/HasOneHandle.ts +17 -1
  40. package/src/handles/types.ts +4 -1
  41. package/src/index.ts +6 -1
  42. package/src/persistence/ContemberSchemaMutationAdapter.ts +2 -1
  43. package/src/schema/index.ts +1 -0
  44. package/src/schema/types.ts +1 -0
  45. package/src/store/RelationStore.ts +3 -3
  46. 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: 'many' | 'one'; readonly entity: string }
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
  }
@@ -3,6 +3,7 @@ export {
3
3
  type ScalarFieldDef,
4
4
  type HasOneRelationDef,
5
5
  type HasManyRelationDef,
6
+ type HasManyRelationKind,
6
7
  type FieldDef,
7
8
  type EntitySchemaDef,
8
9
  type SchemaDefinition,
@@ -3,6 +3,7 @@ export {
3
3
  type ScalarFieldDef,
4
4
  type HasOneRelationDef,
5
5
  type HasManyRelationDef,
6
+ type HasManyRelationKind,
6
7
  type FieldDef,
7
8
  type EntitySchemaDef,
8
9
  type SchemaDefinition,
@@ -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 a disconnect.
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, 'disconnect')
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') {