@contember/bindx-react 0.1.25 → 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.
@@ -1,31 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { GraphQlClient } from '@contember/graphql-client';
3
- import { SnapshotStore, UndoManager, type SchemaDefinition, type UndoManagerConfig, type UpdateMode } from '@contember/bindx';
4
- /**
5
- * Runtime schema names format (from Contember API / generated code).
6
- * Used by ContemberBindxProvider for backwards compatibility.
7
- */
8
- export interface SchemaNames {
9
- readonly entities: {
10
- readonly [entityName: string]: {
11
- readonly name: string;
12
- readonly scalars: readonly string[];
13
- readonly fields: {
14
- readonly [fieldName: string]: {
15
- readonly type: 'column';
16
- readonly enumName?: string;
17
- readonly columnType?: string;
18
- } | {
19
- readonly type: 'many' | 'one';
20
- readonly entity: string;
21
- };
22
- };
23
- };
24
- };
25
- readonly enums?: {
26
- readonly [enumName: string]: readonly string[];
27
- };
28
- }
3
+ import { SnapshotStore, UndoManager, type SchemaDefinition, type SchemaNames, type UndoManagerConfig, type UpdateMode } from '@contember/bindx';
29
4
  /**
30
5
  * Converts SchemaNames (Contember format) to SchemaDefinition (bindx format)
31
6
  * so that a SchemaRegistry can be created for standalone hooks.
@@ -1 +1 @@
1
- {"version":3,"file":"ContemberBindxProvider.d.ts","sourceRoot":"","sources":["../../src/hooks/ContemberBindxProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAoB,aAAa,EAAuF,WAAW,EAAkB,KAAK,gBAAgB,EAAiB,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAInQ;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAClB,QAAQ,EAAE,UAAU,EA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EjC,CAAA"}
1
+ {"version":3,"file":"ContemberBindxProvider.d.ts","sourceRoot":"","sources":["../../src/hooks/ContemberBindxProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAoB,aAAa,EAAuF,WAAW,EAAkB,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAiB,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIrR;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwBnG;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC3C,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAA;IACnB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,eAAe;IACf,QAAQ,EAAE,SAAS,CAAA;IAEnB,MAAM,EAAE,aAAa,CAAA;IAErB,gHAAgH;IAChH,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAA;IACnC,sFAAsF;IACtF,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAA;IAC9B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,mEAiEjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/bindx-react",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Type-safe React data binding framework",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -15,8 +15,8 @@
15
15
  "react": ">=18.0.0"
16
16
  },
17
17
  "dependencies": {
18
- "@contember/bindx": "0.1.25",
19
- "@contember/bindx-client": "0.1.25",
18
+ "@contember/bindx": "0.1.26",
19
+ "@contember/bindx-client": "0.1.26",
20
20
  "@contember/graphql-client": "^2.1.0-beta.1",
21
21
  "@radix-ui/primitive": "^1.1.3",
22
22
  "@radix-ui/react-slot": "^1.2.4"
@@ -1,31 +1,10 @@
1
1
  import { memo, useMemo, type ReactNode } from 'react'
2
2
  import { GraphQlClient } from '@contember/graphql-client'
3
3
  import { ContentClient } from '@contember/bindx-client'
4
- import { ContemberAdapter, SnapshotStore, ActionDispatcher, BatchPersister, MutationCollector, ContemberSchemaMutationAdapter, UndoManager, SchemaRegistry, type SchemaDefinition, type FieldDef, type UndoManagerConfig, type UpdateMode } from '@contember/bindx'
4
+ import { ContemberAdapter, SnapshotStore, ActionDispatcher, BatchPersister, MutationCollector, ContemberSchemaMutationAdapter, UndoManager, SchemaRegistry, type SchemaDefinition, type SchemaNames, type FieldDef, type UndoManagerConfig, type UpdateMode } from '@contember/bindx'
5
5
  import { BindxContext, type BindxContextValue } from './BackendAdapterContext.js'
6
6
  import { QueryBatcher } from '../batching/QueryBatcher.js'
7
7
 
8
- /**
9
- * Runtime schema names format (from Contember API / generated code).
10
- * Used by ContemberBindxProvider for backwards compatibility.
11
- */
12
- export interface SchemaNames {
13
- readonly entities: {
14
- readonly [entityName: string]: {
15
- readonly name: string
16
- readonly scalars: readonly string[]
17
- readonly fields: {
18
- readonly [fieldName: string]:
19
- | { readonly type: 'column'; readonly enumName?: string; readonly columnType?: string }
20
- | { readonly type: 'many' | 'one'; readonly entity: string }
21
- }
22
- }
23
- }
24
- readonly enums?: {
25
- readonly [enumName: string]: readonly string[]
26
- }
27
- }
28
-
29
8
  /**
30
9
  * Converts SchemaNames (Contember format) to SchemaDefinition (bindx format)
31
10
  * so that a SchemaRegistry can be created for standalone hooks.
@@ -46,9 +25,9 @@ export function schemaNamesToDef(schemaNames: SchemaNames): SchemaDefinition<Rec
46
25
  fields[fieldName] = { type: 'scalar', columnType }
47
26
  }
48
27
  } else if (fieldDef.type === 'one') {
49
- fields[fieldName] = { type: 'hasOne', target: fieldDef.entity }
28
+ fields[fieldName] = { type: 'hasOne', target: fieldDef.entity, nullable: fieldDef.nullable }
50
29
  } else if (fieldDef.type === 'many') {
51
- fields[fieldName] = { type: 'hasMany', target: fieldDef.entity }
30
+ fields[fieldName] = { type: 'hasMany', target: fieldDef.entity, relationKind: fieldDef.relationKind, nullable: fieldDef.nullable }
52
31
  }
53
32
  }
54
33
  entities[entityName] = { fields }
@@ -198,6 +198,7 @@ function createCollectorFieldRef(
198
198
  move: () => {},
199
199
  connect: () => {},
200
200
  disconnect: () => {},
201
+ delete: () => {},
201
202
  reset: () => {},
202
203
  onItemConnected: noop,
203
204
  onItemDisconnected: noop,
@@ -215,6 +216,7 @@ function createCollectorFieldRef(
215
216
  return createCollectorProxy<unknown>(scope, targetEntityName, schemaRegistry)
216
217
  },
217
218
  $delete: () => {},
219
+ $remove: () => {},
218
220
  $errors: [],
219
221
  $hasError: false,
220
222
  $addError: () => {},