import type { PatternsFieldType, QueryOperator, NumberRange, StringLengthRange, BaseReferenceField, ReferenceField, MultiReferenceField, NonReferenceField, Field, FieldSpec, SchemaPermissions, ItemPermissions, } from '@wix/bex-core'; export type { PatternsFieldType, QueryOperator, NumberRange, StringLengthRange, BaseReferenceField, ReferenceField, MultiReferenceField, NonReferenceField, Field, FieldSpec, SchemaPermissions, ItemPermissions, }; export type { BackupConfig, BulkInsertError, BulkInsertResult, } from '@wix/bex-core'; export interface CategoryCollectionInfo { collectionId: string; displayName: string; } export interface CursorQueryResult { items: any[]; cursor?: string | undefined | null; total?: number | null; } export interface OffsetQueryResult { items: any[]; total?: number | null; hasNext?: boolean; } export interface Query { limit: number; offset?: number; page: number; search?: string; cursor?: string | null; filters: Record; sort?: { fieldName: string; order: 'asc' | 'desc' }[]; } export interface FieldActions { editField?: (fieldId: string, updates: Partial) => Promise; addField?: (field: Field) => Promise; deleteField?: (fieldId: string) => Promise; duplicateField?: (fieldId: string) => Promise; duplicateFieldWithContent?: (fieldId: string) => Promise; makePrimary?: (fieldId: string) => Promise; renameField?: (fieldId: string, newName: string) => Promise; } export interface SchemaConfig { id: string; fields: Record; displayField: string; idField: string; extensible?: { filterable?: boolean } | null; containsPii?: boolean; /** * Whether the schema's fields can be edited at all (e.g. native collections). * Gate field management on both this and `schemaPermissions`. */ isSchemaEditable?: boolean; /** Field-management permissions for the current user. */ schemaPermissions?: SchemaPermissions; /** Item CRUD permissions for the current user. */ itemPermissions?: ItemPermissions; fieldActions?: FieldActions; refresh?: () => Promise; actions: { get: (entityId: string) => Promise; create: (newEntity: Record) => Promise; update: (updatedEntity: Record) => Promise; delete: (entityId: string) => Promise; bulkDelete: (entityIds: string[]) => Promise; find: ( query: Query, options?: { searchableFieldIds?: string[]; }, ) => Promise; move?: ( id: string, params: { moveAfterId: string | null | undefined }, ) => Promise; readonly backup?: { create: () => Promise<{ backupId: string }>; waitForCompletion: ( backupId: string, options?: { signal?: AbortSignal }, ) => Promise; cancel?: (backupId: string) => Promise; restore?: (backupId: string) => Promise<{ restorationId: string }>; waitForRestoration?: ( restorationId: string, options?: { signal?: AbortSignal }, ) => Promise; }; readonly bulkInsert?: (entities: Record[]) => Promise<{ succeeded?: number; failed?: number; errors?: { rowIndex: number; message?: string; code?: string }[]; }>; }; }