@contember/bindx
Advanced tools
@@ -1,4 +0,5 @@ | ||
| import { GraphQlClient } from '@contember/graphql-client'; | ||
| import { ContentClient, ContentQueryBuilder, SchemaNames } from '@contember/client-content'; | ||
| import { ContentClient } from '@contember/bindx-client'; | ||
| import type { GraphQlClient } from '@contember/graphql-client'; | ||
| import type { BackendAdapter, Query, QueryResult, QueryOptions, PersistResult, CreateResult, DeleteResult } from './types.js'; | ||
| import type { SchemaRegistry } from '../schema/SchemaRegistry.js'; | ||
| /** | ||
@@ -10,13 +11,13 @@ * Options for ContemberAdapter | ||
| client: GraphQlClient; | ||
| /** Contember schema names for query building */ | ||
| schema: SchemaNames; | ||
| /** Schema registry for relation target resolution */ | ||
| schemaRegistry: SchemaRegistry; | ||
| } | ||
| /** | ||
| * Backend adapter for Contember Content API. | ||
| * Uses @contember/client-content for type-safe GraphQL operations. | ||
| * Uses @contember/bindx-client for GraphQL operations. | ||
| */ | ||
| export declare class ContemberAdapter implements BackendAdapter { | ||
| private readonly contentClient; | ||
| private readonly queryBuilder; | ||
| constructor(contentClient: ContentClient, queryBuilder: ContentQueryBuilder); | ||
| private readonly schemaRegistry; | ||
| constructor(contentClient: ContentClient, schemaRegistry: SchemaRegistry); | ||
| query(queries: readonly Query[], options?: QueryOptions): Promise<QueryResult[]>; | ||
@@ -29,14 +30,10 @@ private buildGetQuery; | ||
| /** | ||
| * Converts Contember mutation result to our ContemberMutationResult type. | ||
| * Converts raw mutation result to ContemberMutationResult type. | ||
| */ | ||
| private toMutationResult; | ||
| /** | ||
| * Builds ContentEntitySelection from QuerySpec | ||
| * Creates a QuerySpecContext for an entity, wiring in SchemaRegistry for relation target resolution. | ||
| */ | ||
| private buildEntitySelection; | ||
| /** | ||
| * Recursively applies QueryFieldSpec[] to ContentEntitySelection | ||
| */ | ||
| private applyFieldsToSelection; | ||
| private createContext; | ||
| } | ||
| //# sourceMappingURL=ContemberAdapter.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ContemberAdap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,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA4BnE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAsBxB;;OAEG;IACH,OAAO,CAAC,aAAa;CAMrB"} |
@@ -1,25 +0,2 @@ | ||
| /** | ||
| * ComponentBrand provides unique identity for each component created with createComponent. | ||
| * Each instance has a unique runtime Symbol for brand validation. | ||
| * The class structure itself provides nominal typing in TypeScript. | ||
| */ | ||
| export declare class ComponentBrand { | ||
| readonly name: string; | ||
| /** | ||
| * Private property to ensure nominal typing. | ||
| * Each class instance is considered a unique type. | ||
| */ | ||
| private readonly __nominal; | ||
| /** | ||
| * Runtime symbol for brand validation. | ||
| * Used to check that EntityRef includes required component brands. | ||
| */ | ||
| readonly brandSymbol: symbol; | ||
| constructor(name: string); | ||
| } | ||
| /** | ||
| * Type alias for any ComponentBrand. | ||
| * Used as default/base type in generic constraints. | ||
| */ | ||
| export type AnyBrand = ComponentBrand; | ||
| export { ComponentBrand, type AnyBrand } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=ComponentBrand.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ComponentBrand.d.ts","sourceRoot":"","sources":["../../src/brand/ComponentBrand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,cAAc;aAaE,IAAI,EAAE,MAAM;IAZxC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAO;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;gBAEA,IAAI,EAAE,MAAM;CAGxC;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAA"} | ||
| {"version":3,"file":"ComponentBrand.d.ts","sourceRoot":"","sources":["../../src/brand/ComponentBrand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -7,5 +7,4 @@ /** | ||
| export { MutationCollector, type EntityMutationResult } from '../persistence/MutationCollector.js'; | ||
| export { ContemberSchemaMutationAdapter } from '../persistence/ContemberSchemaMutationAdapter.js'; | ||
| export { ContemberSchemaMutationAdapter, type SchemaNames } from '../persistence/ContemberSchemaMutationAdapter.js'; | ||
| export type { MutationSchemaProvider } from '../persistence/MutationSchemaProvider.js'; | ||
| export type { SchemaNames, SchemaEntityNames, ContentClientInput, } from '@contember/client-content'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contember/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAClG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAA;AACjG,YAAY,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAA;AAGtF,YAAY,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,GAClB,MAAM,2BAA2B,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contember/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAClG,OAAO,EAAE,8BAA8B,EAAE,KAAK,WAAW,EAAE,MAAM,kDAAkD,CAAA;AACnH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAA"} |
| import { EntityRelatedHandle } from './BaseHandle.js'; | ||
| import { FieldHandle } from './FieldHandle.js'; | ||
| import type { ActionDispatcher } from '../core/ActionDispatcher.js'; | ||
@@ -7,7 +6,5 @@ import { type SnapshotStore } from '../store/SnapshotStore.js'; | ||
| import type { EntitySnapshot } from '../store/snapshots.js'; | ||
| import { type EntityRef, type SelectedEntityFields, type Unsubscribe } from './types.js'; | ||
| import { type FieldRef, type HasOneAccessor, type HasManyRef, type SelectedEntityFields, type Unsubscribe, type EntityAccessor } from './types.js'; | ||
| import { type ErrorInput, type FieldError } from '../errors/types.js'; | ||
| import type { EventTypeMap, AfterEventTypes, BeforeEventTypes, EventListener, Interceptor, EntityPersistedEvent, EntityPersistingEvent } from '../events/types.js'; | ||
| import { HasOneHandle } from './HasOneHandle.js'; | ||
| import { HasManyListHandle } from './HasManyListHandle.js'; | ||
| import type { SelectionMeta } from '../selection/types.js'; | ||
@@ -31,3 +28,3 @@ /** | ||
| */ | ||
| export declare class EntityHandle<T extends object = object, TSelected = T> extends EntityRelatedHandle implements EntityRef<T, TSelected> { | ||
| export declare class EntityHandle<T extends object = object, TSelected = T> extends EntityRelatedHandle { | ||
| private readonly schema; | ||
@@ -41,20 +38,6 @@ private readonly selection?; | ||
| readonly __brands?: Set<symbol>; | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| readonly __schema: Record<string, object>; | ||
| readonly $fields: SelectedEntityFields<T, TSelected>; | ||
| readonly $data: TSelected | null; | ||
| readonly $isDirty: boolean; | ||
| readonly $persistedId: string | null; | ||
| readonly $isNew: boolean; | ||
| readonly $errors: readonly FieldError[]; | ||
| readonly $hasError: boolean; | ||
| $addError: (error: ErrorInput) => void; | ||
| $clearErrors: () => void; | ||
| $clearAllErrors: () => void; | ||
| $on: <E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>) => Unsubscribe; | ||
| $intercept: <E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>) => Unsubscribe; | ||
| $onPersisted: (listener: EventListener<EntityPersistedEvent>) => Unsubscribe; | ||
| $interceptPersisting: (interceptor: Interceptor<EntityPersistingEvent>) => Unsubscribe; | ||
| private constructor(); | ||
| static create<T extends object = object, TSelected = T>(id: string, entityType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): EntityHandle<T, TSelected>; | ||
| static create<T extends object = object, TSelected = T>(id: string, entityType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): EntityAccessor<T, TSelected>; | ||
| static createRaw<T extends object = object, TSelected = T>(id: string, entityType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): EntityHandle<T, TSelected>; | ||
| static wrapProxy<T extends object, TSelected>(handle: EntityHandle<T, TSelected>): EntityAccessor<T, TSelected>; | ||
| /** | ||
@@ -65,6 +48,2 @@ * Gets the entity ID. | ||
| /** | ||
| * Gets the entity type. | ||
| */ | ||
| get type(): string; | ||
| /** | ||
| * Gets the current entity snapshot. | ||
@@ -120,7 +99,7 @@ */ | ||
| */ | ||
| field<K extends keyof T>(fieldName: K): FieldHandle<T[K]>; | ||
| field<K extends keyof T>(fieldName: K): FieldRef<T[K]>; | ||
| /** | ||
| * Gets a has-one relation handle. | ||
| */ | ||
| hasOne<TRelated extends object>(fieldName: string, nestedSelection?: SelectionMeta): HasOneHandle<TRelated>; | ||
| hasOne<TRelated extends object>(fieldName: string, nestedSelection?: SelectionMeta): HasOneAccessor<TRelated>; | ||
| /** | ||
@@ -132,4 +111,14 @@ * Gets a has-many relation handle. | ||
| */ | ||
| hasMany<TItem extends object>(fieldName: string, alias?: string, nestedSelection?: SelectionMeta): HasManyListHandle<TItem>; | ||
| hasMany<TItem extends object>(fieldName: string, alias?: string, nestedSelection?: SelectionMeta): HasManyRef<TItem>; | ||
| /** | ||
| * Gets a raw (unproxied) has-one relation handle from cache. | ||
| * Creates the handle if not cached yet. | ||
| */ | ||
| private getHasOneHandleRaw; | ||
| /** | ||
| * Gets a raw (unproxied) has-many relation handle from cache. | ||
| * Creates the handle if not cached yet. | ||
| */ | ||
| private getHasManyHandleRaw; | ||
| /** | ||
| * Resets the entity to server data. | ||
@@ -136,0 +125,0 @@ * Also resets all relation states (hasOne, hasMany). |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"EntityHandle.d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,WAAW,IAAI,IAAI;IAOnB;;OAEG;IACH,cAAc,IAAI,IAAI;IAStB;;OAEG;IACH,cAAc,IAAI,SAAS,MAAM,EAAE;IAInC;;OAEG;IACH,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAMtC;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,eAAe,EAC3B,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACtC,WAAW;IAKd;;OAEG;IACH,SAAS,CAAC,CAAC,SAAS,gBAAgB,EACnC,SAAS,EAAE,CAAC,EACZ,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACvC,WAAW;IAKd;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,WAAW;IAIvE;;OAEG;IACH,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC,GAAG,WAAW;CAIjF"} |
@@ -17,3 +17,3 @@ import { EntityRelatedHandle } from './BaseHandle.js'; | ||
| */ | ||
| export declare class FieldHandle<T = unknown> extends EntityRelatedHandle implements FieldRef<T> { | ||
| export declare class FieldHandle<T = unknown> extends EntityRelatedHandle { | ||
| private readonly fieldPath; | ||
@@ -26,3 +26,5 @@ private readonly _enumName?; | ||
| private constructor(); | ||
| static create<T = unknown>(entityType: string, entityId: string, fieldPath: string[], store: SnapshotStore, dispatcher: ActionDispatcher, enumName?: string, columnType?: string): FieldHandle<T>; | ||
| static create<T = unknown>(entityType: string, entityId: string, fieldPath: string[], store: SnapshotStore, dispatcher: ActionDispatcher, enumName?: string, columnType?: string): FieldRef<T>; | ||
| static createRaw<T = unknown>(entityType: string, entityId: string, fieldPath: string[], store: SnapshotStore, dispatcher: ActionDispatcher, enumName?: string, columnType?: string): FieldHandle<T>; | ||
| static wrapProxy<T>(handle: FieldHandle<T>): FieldRef<T>; | ||
| /** | ||
@@ -101,3 +103,3 @@ * JSX field reference metadata for collection phase. | ||
| */ | ||
| nested<K extends keyof NonNullable<T>>(key: K): FieldHandle<NonNullable<T>[K]>; | ||
| nested<K extends keyof NonNullable<T>>(key: K): FieldRef<NonNullable<T>[K]>; | ||
| /** | ||
@@ -104,0 +106,0 @@ * Subscribe to field value changes. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"FieldHandle.d.ts","sourceRoot":"","sources":["../../src/handles/FieldHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAEhH,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACxF,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,MAAM,oBAAoB,CAAA;AAG3B;;;;;;;;;GASG;AACH,qBAAa,WAAW,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,mBAAoB,YAAW,QAAQ,CAAC,CAAC,CAAC;IAStF,OAAO,CAAC,QAAQ,CAAC,SAAS;IAG1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAZ9B,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,sBAAsB,CAAkC;IAEhE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkD;IAEjF,OAAO;IAYP,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,EACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EACh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ACpC,GAAG,EAAE,CAAC,GACJ,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAY9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,CAAC,GAAG,WAAW;IAWjE;;;OAGG;IACH,UAAU,CAAC,WAAW,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,WAAW;CAWrE"} |
@@ -16,3 +16,3 @@ import { EntityRelatedHandle } from './BaseHandle.js'; | ||
| */ | ||
| export declare class HasManyListHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle implements HasManyRef<TEntity, TSelected> { | ||
| export declare class HasManyListHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle { | ||
| private readonly fieldName; | ||
@@ -22,3 +22,4 @@ private readonly itemType; | ||
| private readonly selection?; | ||
| private itemHandleCache; | ||
| private itemHandleCacheRaw; | ||
| private itemHandleCacheProxy; | ||
| /** Runtime brand symbols for validation */ | ||
@@ -43,3 +44,3 @@ readonly __brands?: Set<symbol>; | ||
| private constructor(); | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, itemType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, alias?: string, selection?: SelectionMeta): HasManyListHandle<TEntity, TSelected>; | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, itemType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, alias?: string, selection?: SelectionMeta): HasManyRef<TEntity, TSelected>; | ||
| /** | ||
@@ -46,0 +47,0 @@ * JSX field reference metadata for collection phase. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"HasManyListHandle.d.ts","sourceRoot":"","sources":["../../src/handles/HasManyListHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,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O,EAAE,MAAM,GAAG,IAAI;IAa9C;;;OAGG;IACH,KAAK,IAAI,IAAI;IAUb;;OAEG;IACM,OAAO,IAAI,IAAI;IAUxB;;;OAGG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,SAAS,UAAU,EAAE,CAElC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAOjC;;OAEG;IACH,WAAW,IAAI,IAAI;IASnB;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,aAAa,CAAC,qBAAqB,CAAC,GAAG,WAAW;IAW5E;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,aAAa,CAAC,wBAAwB,CAAC,GAAG,WAAW;IAWlF;;OAEG;IACH,uBAAuB,CAAC,WAAW,EAAE,WAAW,CAAC,sBAAsB,CAAC,GAAG,WAAW;IAWtF;;OAEG;IACH,0BAA0B,CAAC,WAAW,EAAE,WAAW,CAAC,yBAAyB,CAAC,GAAG,WAAW;CAW5F"} |
@@ -6,5 +6,7 @@ import { EntityRelatedHandle } from './BaseHandle.js'; | ||
| import type { SelectionMeta } from '../selection/types.js'; | ||
| import { FIELD_REF_META, type HasOneRef, type FieldRefMeta, type SelectedEntityFields, type Unsubscribe, type EntityAccessor } from './types.js'; | ||
| import { FIELD_REF_META, type FieldRefMeta, type SelectedEntityFields, type Unsubscribe, type EntityAccessor, type HasOneAccessor } from './types.js'; | ||
| import { type ErrorInput, type FieldError } from '../errors/types.js'; | ||
| import type { EventTypeMap, AfterEventTypes, BeforeEventTypes, EventListener, Interceptor, EntityPersistedEvent, EntityPersistingEvent, RelationConnectedEvent, RelationDisconnectedEvent, RelationConnectingEvent, RelationDisconnectingEvent } from '../events/types.js'; | ||
| import { EntityHandle } from './EntityHandle.js'; | ||
| import { PlaceholderHandle } from './PlaceholderHandle.js'; | ||
| /** | ||
@@ -17,3 +19,3 @@ * HasOneHandle provides access to a has-one relation. | ||
| */ | ||
| export declare class HasOneHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle implements HasOneRef<TEntity, TSelected> { | ||
| export declare class HasOneHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle { | ||
| private readonly fieldName; | ||
@@ -23,27 +25,12 @@ private readonly targetType; | ||
| private readonly selection?; | ||
| private entityHandleCache; | ||
| private placeholderCache; | ||
| private entityHandleCacheRaw; | ||
| private entityHandleCacheProxy; | ||
| private placeholderCacheRaw; | ||
| private placeholderCacheProxy; | ||
| /** Runtime brand symbols for validation */ | ||
| readonly __brands?: Set<symbol>; | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| readonly __schema: Record<string, object>; | ||
| readonly $id: string; | ||
| readonly $isDirty: boolean; | ||
| readonly $state: 'connected' | 'disconnected' | 'deleted' | 'creating'; | ||
| readonly $fields: SelectedEntityFields<TEntity, TSelected>; | ||
| readonly $entity: EntityAccessor<TEntity, TSelected>; | ||
| readonly $errors: readonly FieldError[]; | ||
| readonly $hasError: boolean; | ||
| $connect: (id: string) => void; | ||
| $disconnect: () => void; | ||
| $delete: () => void; | ||
| $reset: () => void; | ||
| $addError: (error: ErrorInput) => void; | ||
| $clearErrors: () => void; | ||
| $onConnect: (listener: EventListener<RelationConnectedEvent>) => Unsubscribe; | ||
| $onDisconnect: (listener: EventListener<RelationDisconnectedEvent>) => Unsubscribe; | ||
| $interceptConnect: (interceptor: Interceptor<RelationConnectingEvent>) => Unsubscribe; | ||
| $interceptDisconnect: (interceptor: Interceptor<RelationDisconnectingEvent>) => Unsubscribe; | ||
| private constructor(); | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): HasOneHandle<TEntity, TSelected>; | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): HasOneAccessor<TEntity, TSelected>; | ||
| static createRaw<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, schema: SchemaRegistry, brands?: Set<symbol>, selection?: SelectionMeta): HasOneHandle<TEntity, TSelected>; | ||
| static wrapProxy<TEntity extends object, TSelected>(handle: HasOneHandle<TEntity, TSelected>): HasOneAccessor<TEntity, TSelected>; | ||
| /** | ||
@@ -80,2 +67,8 @@ * JSX field reference metadata for collection phase. | ||
| /** | ||
| * Gets the raw (unproxied) related entity handle. | ||
| * Returns raw EntityHandle or raw PlaceholderHandle. | ||
| * Used internally to avoid going through the proxy layer. | ||
| */ | ||
| get entityRaw(): EntityHandle<TEntity, TSelected> | PlaceholderHandle<TEntity, TSelected>; | ||
| /** | ||
| * Gets the related entity accessor with direct field access. | ||
@@ -93,2 +86,6 @@ * Implements HasOneRef.$entity - returns EntityAccessor for the related entity. | ||
| /** | ||
| * Checks if the related entity is currently being persisted. | ||
| */ | ||
| get isPersisting(): boolean; | ||
| /** | ||
| * Checks if the relation is dirty. | ||
@@ -154,21 +151,21 @@ */ | ||
| interceptDisconnect(interceptor: Interceptor<RelationDisconnectingEvent>): Unsubscribe; | ||
| /** Raw data snapshot of the related entity - delegates to $entity */ | ||
| get $data(): TSelected | null; | ||
| /** Whether this entity is new - delegates to $entity */ | ||
| get $isNew(): boolean; | ||
| /** Server-assigned ID after persistence - delegates to $entity */ | ||
| get $persistedId(): string | null; | ||
| /** Raw data snapshot of the related entity - delegates to entityRaw */ | ||
| get data(): TSelected | null; | ||
| /** Whether this entity is new - delegates to entityRaw */ | ||
| get isNew(): boolean; | ||
| /** Server-assigned ID after persistence - delegates to entityRaw */ | ||
| get persistedId(): string | null; | ||
| /** Type brand for entity name */ | ||
| get __entityName(): string; | ||
| /** Clear all errors - delegates to $entity */ | ||
| $clearAllErrors(): void; | ||
| /** Clear all errors - delegates to entityRaw */ | ||
| clearAllErrors(): void; | ||
| /** Subscribe to any event on the related entity */ | ||
| $on<E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>): Unsubscribe; | ||
| on<E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>): Unsubscribe; | ||
| /** Intercept any before event on the related entity */ | ||
| $intercept<E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>): Unsubscribe; | ||
| intercept<E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>): Unsubscribe; | ||
| /** Subscribe to persist success events on the related entity */ | ||
| $onPersisted(listener: EventListener<EntityPersistedEvent>): Unsubscribe; | ||
| onPersisted(listener: EventListener<EntityPersistedEvent>): Unsubscribe; | ||
| /** Intercept persist on the related entity */ | ||
| $interceptPersisting(interceptor: Interceptor<EntityPersistingEvent>): Unsubscribe; | ||
| interceptPersisting(interceptor: Interceptor<EntityPersistingEvent>): Unsubscribe; | ||
| } | ||
| //# sourceMappingURL=HasOneHandle.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"HasOneHandle.d.ts","sourceRoot":"","sources":["../../src/handles/HasOneHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAQ1D,OAAO,EACN,cAAc,EACd,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,W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Aa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACtC,WAAW;IAId,uDAAuD;IACvD,SAAS,CAAC,CAAC,SAAS,gBAAgB,EACnC,SAAS,EAAE,CAAC,EACZ,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACvC,WAAW;IAId,gEAAgE;IAChE,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,WAAW;IAIvE,8CAA8C;IAC9C,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,qBAAqB,CAAC,GAAG,WAAW;CAIjF"} |
| import type { ActionDispatcher } from '../core/ActionDispatcher.js'; | ||
| import type { SnapshotStore } from '../store/SnapshotStore.js'; | ||
| import { type EntityRef, type SelectedEntityFields, type Unsubscribe } from './types.js'; | ||
| import { type SelectedEntityFields, type Unsubscribe, type EntityAccessor } from './types.js'; | ||
| import type { ErrorInput, FieldError } from '../errors/types.js'; | ||
@@ -14,3 +14,3 @@ import type { EventTypeMap, AfterEventTypes, BeforeEventTypes, EventListener, Interceptor, EntityPersistedEvent, EntityPersistingEvent } from '../events/types.js'; | ||
| */ | ||
| export declare class PlaceholderHandle<TEntity extends object = object, TSelected = TEntity> implements EntityRef<TEntity, TSelected> { | ||
| export declare class PlaceholderHandle<TEntity extends object = object, TSelected = TEntity> { | ||
| private readonly parentEntityType; | ||
@@ -24,22 +24,8 @@ private readonly parentEntityId; | ||
| readonly __brands?: Set<symbol>; | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| readonly __schema: Record<string, object>; | ||
| /** Placeholder ID for this handle */ | ||
| private readonly placeholderId; | ||
| readonly $fields: SelectedEntityFields<TEntity, TSelected>; | ||
| readonly $data: TSelected | null; | ||
| readonly $isDirty: boolean; | ||
| readonly $persistedId: null; | ||
| readonly $isNew: boolean; | ||
| readonly $errors: readonly FieldError[]; | ||
| readonly $hasError: boolean; | ||
| $addError: (error: ErrorInput) => void; | ||
| $clearErrors: () => void; | ||
| $clearAllErrors: () => void; | ||
| $on: <E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>) => Unsubscribe; | ||
| $intercept: <E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>) => Unsubscribe; | ||
| $onPersisted: (listener: EventListener<EntityPersistedEvent>) => Unsubscribe; | ||
| $interceptPersisting: (interceptor: Interceptor<EntityPersistingEvent>) => Unsubscribe; | ||
| private constructor(); | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, brands?: Set<symbol>): PlaceholderHandle<TEntity, TSelected>; | ||
| static create<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, brands?: Set<symbol>): EntityAccessor<TEntity, TSelected>; | ||
| static createRaw<TEntity extends object = object, TSelected = TEntity>(parentEntityType: string, parentEntityId: string, fieldName: string, targetType: string, store: SnapshotStore, dispatcher: ActionDispatcher, brands?: Set<symbol>): PlaceholderHandle<TEntity, TSelected>; | ||
| static wrapProxy<TEntity extends object, TSelected>(handle: PlaceholderHandle<TEntity, TSelected>): EntityAccessor<TEntity, TSelected>; | ||
| /** | ||
@@ -58,2 +44,6 @@ * Gets the placeholder ID. | ||
| /** | ||
| * Placeholder entities are never being persisted. | ||
| */ | ||
| get isPersisting(): boolean; | ||
| /** | ||
| * Placeholder entities are always new (not yet persisted). | ||
@@ -60,0 +50,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"PlaceholderHandle.d.ts","sourceRoot":"","sources":["../../src/handles/PlaceholderHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAEN,KAAK,SAAS,EACd,KAAK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OAEG;IACH,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,WAAW;IAIxE;;OAEG;IACH,mBAAmB,CAAC,YAAY,EAAE,WAAW,CAAC,qBAAqB,CAAC,GAAG,WAAW;CAIlF"} |
@@ -11,46 +11,18 @@ /** | ||
| * - `entity.$isDirty` → handle property | ||
| * - `entity.id` → entity ID (special case, always passes through) | ||
| */ | ||
| /** | ||
| * Known properties on EntityHandle that should NOT be treated as field access. | ||
| * Properties like `fields`, `data`, `errors` are NOT included - use $ prefix for those. | ||
| */ | ||
| export declare const ENTITY_HANDLE_PROPERTIES: Set<string | symbol>; | ||
| /** | ||
| * Known properties on HasOneHandle that should NOT be treated as field access. | ||
| * Properties like `fields`, `entity`, `errors`, `state` are NOT included - they require $ prefix. | ||
| */ | ||
| export declare const HAS_ONE_HANDLE_PROPERTIES: Set<string | symbol>; | ||
| /** | ||
| * All properties on FieldHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export declare const FIELD_HANDLE_PROPERTIES: Set<string | symbol>; | ||
| /** | ||
| * All properties on HasManyListHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export declare const HAS_MANY_HANDLE_PROPERTIES: Set<string | symbol>; | ||
| /** | ||
| * All properties on PlaceholderHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export declare const PLACEHOLDER_HANDLE_PROPERTIES: Set<string | symbol>; | ||
| /** | ||
| * Configuration for creating a handle proxy. | ||
| */ | ||
| export interface HandleProxyConfig<T extends object> { | ||
| /** Set of property names that should pass through to the handle */ | ||
| knownProperties: Set<string | symbol>; | ||
| /** Function to get the fields proxy from the handle */ | ||
| getFields: (target: T) => object; | ||
| } | ||
| /** | ||
| * Creates a proxy around a handle that supports direct field access. | ||
| * | ||
| * - `handle.fieldName` is equivalent to `handle.$fields.fieldName` | ||
| * - `handle.$propertyName` accesses handle properties with $ prefix stripped | ||
| * - Known properties pass through directly to the handle | ||
| * Resolution order: | ||
| * 1. Symbols → pass through to handle | ||
| * 2. `id` / FIELD_REF_META → pass through to handle | ||
| * 3. `$xxx` → strip `$`, access handle property | ||
| * 4. Everything else → field access (returns FieldHandle/HasOneHandle/HasManyListHandle) | ||
| * | ||
| * @param handle - The handle instance to wrap | ||
| * @param config - Configuration for the proxy | ||
| * @param getFields - Function to get the fields object from the handle | ||
| * @returns Proxied handle with direct field access support | ||
| */ | ||
| export declare function createHandleProxy<T extends object>(handle: T, config: HandleProxyConfig<T>): T; | ||
| export declare function createHandleProxy<T extends object, TResult = T>(handle: T, getFields: (target: T) => object): TResult; | ||
| /** | ||
@@ -66,3 +38,3 @@ * Creates a simple proxy that only handles $ prefix aliasing. | ||
| */ | ||
| export declare function createAliasProxy<T extends object>(handle: T): T; | ||
| export declare function createAliasProxy<T extends object, TResult = T>(handle: T): TResult; | ||
| //# sourceMappingURL=proxyFactory.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"proxyFactory.d.ts","sourceRoot":"","sources":["../../src/handles/proxyFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sBAUnC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,sBAOpC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,sBAWlC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,sBAcrC,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,sBAWxC,CAAA;AAEF;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM;IAClD,mEAAmE;IACnE,eAAe,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IACrC,uDAAuD;IACvD,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAA;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EACjD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC1B,CAAC,CA2CH;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CA2B/D"} | ||
| {"version":3,"file":"proxyFactory.d.ts","sourceRoot":"","sources":["../../src/handles/proxyFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,GAAG,CAAC,EAC9D,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,GAC9B,OAAO,CAqCT;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CA2BlF"} |
@@ -255,2 +255,4 @@ /** | ||
| readonly $isNew: boolean; | ||
| /** Whether entity is currently being persisted */ | ||
| readonly $isPersisting: boolean; | ||
| /** Server-assigned ID after persistence */ | ||
@@ -333,2 +335,4 @@ readonly $persistedId: string | null; | ||
| readonly $isDirty: boolean; | ||
| /** Whether entity is currently being persisted */ | ||
| readonly $isPersisting: boolean; | ||
| /** Server-assigned ID after persistence */ | ||
@@ -335,0 +339,0 @@ readonly $persistedId: string | null; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/handles/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAMnD;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC5B,WAAW,GACX,cAAc,GACd,SAAS,GACT,UAAU,CAAA;AAEb,OAAO,KAAK,EAAkB,QAAQ,EAAE,MA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CAAC,EACpD,OAAO,CACP;CACD,CAAA;AAMD;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC3B,CAAC,SAAS;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC7E,QAAQ,GACR,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE1B,MAAM,MAAM,uBAAuB,CAAC,CAAC,IACpC,CAAC,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,EAAE,GAAG,CAAC,GACvD,WAAW,GACX,CAAC,SAAS,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,EAAE,GAAG,CAAC,GAC7D,WAAW,GACX,KAAK,CAAA;AAEV,MAAM,MAAM,wBAAwB,CAAC,CAAC,IACrC,CAAC,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,EAAE,GAAG,CAAC,GACxD,WAAW,GACX,CAAC,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,WAAW,EAAE,GAAG,CAAC,GAC9D,WAAW,GACX,KAAK,CAAA"} |
+3
-2
@@ -32,3 +32,3 @@ /** | ||
| export { generateHasManyAlias } from './utils/aliasGenerator.js'; | ||
| export { MutationCollector, ContemberSchemaMutationAdapter } from './contember/index.js'; | ||
| export { MutationCollector, ContemberSchemaMutationAdapter, type SchemaNames } from './contember/index.js'; | ||
| export type { MutationSchemaProvider, EntityMutationResult } from './contember/index.js'; | ||
@@ -42,3 +42,4 @@ export { UndoManager } from './undo/index.js'; | ||
| export { ExecutionErrorTypes, isExecutionErrorType, classifyError, isRetryableCategory, createClientError, createServerError, createLoadError, isClientError, isServerError, isLoadError, filterErrorsBySource, filterStickyErrors, UnfetchedFieldError, resolveErrorPath, resolveAllErrors, } from './errors/index.js'; | ||
| export type { SchemaNames, SchemaEntityNames } from '@contember/client-content'; | ||
| export { ContentClient, type ContentClientOptions, type ContentQuery, type ContentMutation, ContentOperation, type MutationResult as ClientMutationResult, MutationFailedError, type QuerySpecContext, querySpecToGraphQl, buildGetArgs, buildListArgs, buildCreateArgs, buildUpdateArgs, buildDeleteArgs, buildMutationSelection, mutationFragments, unwrapPaginateResult, } from '@contember/bindx-client'; | ||
| export { qb } from '@contember/bindx-client'; | ||
| export type { TextFilterArtifact, NumberFilterArtifact, NumberRangeFilterArtifact, DateFilterArtifact, BooleanFilterArtifact, EnumFilterArtifact, EnumListFilterArtifact, RelationFilterArtifact, IsDefinedFilterArtifact, FilterArtifact, FilterHandler, ColumnType, ColumnDefinition, SortingDirections, SortingDirectionAction, SortingState, PagingState, PagingInfo, DataViewLayout, SelectionValues, SelectionState, } from './dataview/index.js'; | ||
@@ -45,0 +46,0 @@ export { createTextFilterHandler, createFullTextFilterHandler, createNumberFilterHandler, createNumberRangeFilterHandler, createDateFilterHandler, createBooleanFilterHandler, createEnumFilterHandler, createEnumListFilterHandler, createRelationFilterHandler, createIsDefinedFilterHandler, } from './dataview/index.js'; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,YAAY,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,GACd,MAAM,mBAAmB,CAAA;AAG1B,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EAEd,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,YAAY,GACZ,MAAM,sBAAsB,CAAA;AAG7B,YAAY,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;;;GAOG;AACH,OAAO,KAAK,UAAU,MAAM,eAAe,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,YAAY,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,cAAc,GACd,MAAM,mBAAmB,CAAA;AAG1B,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EAEd,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,YAAY,GACZ,MAAM,sBAAsB,CAAA;AAG7B,YAAY,EACX,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EAEZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,EAEd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAElB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,GACd,MAAM,oBAAoB,CAAA;AAG3B,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAG1D,YAAY,EACX,cAAc,EACd,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,IAAI,0BAA0B,EACjD,yBAAyB,IAAI,gCAAgC,EAC7D,iBAAiB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EACb,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,gBAAgB,EAChB,KAAK,cAAc,IAAI,oBAAoB,EAC3C,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAA;AAG5C,YAAY,EACX,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,eAAe,EACf,cAAc,GACd,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,GAC5B,MAAM,qBAAqB,CAAA;AAM5B;;;;;;;GAOG;AACH,OAAO,KAAK,UAAU,MAAM,eAAe,CAAA"} |
@@ -1,2 +0,25 @@ | ||
| import type { SchemaNames } from '@contember/client-content'; | ||
| /** | ||
| * Runtime schema names format (from Contember API / generated code). | ||
| */ | ||
| export interface SchemaNames { | ||
| readonly entities: { | ||
| readonly [entityName: string]: { | ||
| readonly name: string; | ||
| readonly scalars: readonly string[]; | ||
| readonly fields: { | ||
| readonly [fieldName: string]: { | ||
| readonly type: 'column'; | ||
| readonly enumName?: string; | ||
| readonly columnType?: string; | ||
| } | { | ||
| readonly type: 'many' | 'one'; | ||
| readonly entity: string; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| readonly enums?: { | ||
| readonly [enumName: string]: readonly string[]; | ||
| }; | ||
| } | ||
| import type { MutationSchemaProvider } from './MutationSchemaProvider.js'; | ||
@@ -3,0 +26,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ContemberSchemaMutationAdapter.d.ts","sourceRoot":"","sources":["../../src/persistence/ContemberSchemaMutationAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEzE;;;GAGG;AACH,qBAAa,8BAA+B,YAAW,sBAAsB;IAChE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAStD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IASxD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS;IAYxF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAa5E,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGtC"} | ||
| {"version":3,"file":"ContemberSchemaMutationAdapter.d.ts","sourceRoot":"","sources":["../../src/persistence/ContemberSchemaMutationAdapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAClB,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG;YAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;YACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;YACnC,QAAQ,CAAC,MAAM,EAAE;gBAChB,QAAQ,EAAE,SAAS,EAAE,MAAM,GACxB;oBAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;oBAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;oBAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;iBAAE,GACrF;oBAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;oBAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;iBAAE,CAAA;aAC7D,CAAA;SACD,CAAA;KACD,CAAA;IACD,QAAQ,CAAC,KAAK,CAAC,EAAE;QAChB,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;KAC9C,CAAA;CACD;AACD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEzE;;;GAGG;AACH,qBAAa,8BAA+B,YAAW,sBAAsB;IAChE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEhD,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAStD,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IASxD,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS;IAYxF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAa5E,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGtC"} |
@@ -1,98 +0,2 @@ | ||
| /** | ||
| * Types matching the Contember API schema introspection format. | ||
| * These types are compatible with binding-common's Schema. | ||
| */ | ||
| export type SchemaColumnType = 'Bool' | 'Date' | 'DateTime' | 'Double' | 'Enum' | 'Integer' | 'String' | 'Uuid' | 'Json' | string; | ||
| export interface SchemaColumn { | ||
| __typename: '_Column'; | ||
| name: string; | ||
| nullable: boolean; | ||
| type: SchemaColumnType; | ||
| enumName: string | null; | ||
| defaultValue: string | number | boolean | null; | ||
| } | ||
| export interface SchemaRelationOrderBy { | ||
| path: string[]; | ||
| direction: 'asc' | 'desc'; | ||
| } | ||
| interface BaseRelation { | ||
| __typename: '_Relation'; | ||
| name: string; | ||
| nullable: boolean | null; | ||
| onDelete: 'restrict' | 'cascade' | 'setNull' | null; | ||
| orderBy: SchemaRelationOrderBy[] | null; | ||
| orphanRemoval: boolean | null; | ||
| targetEntity: string; | ||
| type: 'OneHasOne' | 'OneHasMany' | 'ManyHasOne' | 'ManyHasMany'; | ||
| } | ||
| export interface OwningRelation extends BaseRelation { | ||
| side: 'owning'; | ||
| inversedBy: string | null; | ||
| ownedBy?: never; | ||
| } | ||
| export interface InverseRelation extends BaseRelation { | ||
| side: 'inverse'; | ||
| ownedBy: string; | ||
| inversedBy?: never; | ||
| } | ||
| export type SchemaRelation = OwningRelation | InverseRelation; | ||
| export type SchemaField = SchemaColumn | SchemaRelation; | ||
| export interface SchemaEntity { | ||
| name: string; | ||
| customPrimaryAllowed: boolean; | ||
| fields: Map<string, SchemaField>; | ||
| unique: { | ||
| fields: Set<string>; | ||
| }[]; | ||
| } | ||
| export interface SchemaEnum { | ||
| name: string; | ||
| values: string[]; | ||
| } | ||
| /** | ||
| * Processed schema store with Maps for efficient lookup. | ||
| * This is the format used internally after loading from API. | ||
| */ | ||
| export interface ContemberSchemaStore { | ||
| entities: Map<string, SchemaEntity>; | ||
| enums: Map<string, Set<string>>; | ||
| } | ||
| /** | ||
| * Raw schema format as returned by the Contember API. | ||
| */ | ||
| export interface RawContemberSchema { | ||
| enums: { | ||
| name: string; | ||
| values: string[]; | ||
| }[]; | ||
| entities: { | ||
| name: string; | ||
| customPrimaryAllowed: boolean; | ||
| fields: (SchemaColumn | (Omit<SchemaRelation, 'side'> & { | ||
| side: 'owning' | 'inverse'; | ||
| ownedBy?: string; | ||
| inversedBy?: string | null; | ||
| }))[]; | ||
| unique: { | ||
| fields: string[]; | ||
| }[]; | ||
| }[]; | ||
| } | ||
| /** | ||
| * Schema class compatible with binding-common's Schema. | ||
| * Can be used directly or created from API response. | ||
| */ | ||
| export declare class ContemberSchema { | ||
| private readonly store; | ||
| constructor(store: ContemberSchemaStore); | ||
| getEntity(entityName: string): SchemaEntity | undefined; | ||
| getEntityNames(): string[]; | ||
| getEntityField(entityName: string, fieldName: string): SchemaField | undefined; | ||
| getEnumValues(enumName: string): string[] | undefined; | ||
| /** | ||
| * Creates a ContemberSchema from raw API response. | ||
| */ | ||
| static fromRaw(raw: RawContemberSchema): ContemberSchema; | ||
| } | ||
| export {}; | ||
| export { ContemberSchema, type SchemaColumnType, type SchemaColumn, type SchemaRelationOrderBy, type OwningRelation, type InverseRelation, type SchemaRelation, type SchemaField, type SchemaEntity, type SchemaEnum, type ContemberSchemaStore, type RawContemberSchema, } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=ContemberSchema.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ContemberSchema.d.ts","sourceRoot":"","sources":["../../src/schema/ContemberSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEjI,MAAM,WAAW,YAAY;IAC5B,UAAU,EAAE,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,gBAAgB,CAAA;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;CAC9C;AAED,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,SAAS,EAA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Y,EACjB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACvB,MAAM,yBAAyB,CAAA"} |
@@ -1,62 +0,2 @@ | ||
| /** | ||
| * Role-aware type utilities for bindx. | ||
| * | ||
| * The role system allows per-role field access control at the type level. | ||
| * Default (no role) = narrowest scope (fields ALL roles can access). | ||
| * Specifying roles = expanding scope (union of capabilities for those roles). | ||
| */ | ||
| /** | ||
| * Converts a union type to an intersection type. | ||
| * Used to merge field sets from multiple roles. | ||
| * | ||
| * @example | ||
| * UnionToIntersection<{ a: 1 } | { b: 2 }> = { a: 1 } & { b: 2 } | ||
| */ | ||
| export type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never; | ||
| /** | ||
| * Extracts all role names from a role map. | ||
| */ | ||
| export type RoleNames<TRoleMap extends Record<string, object>> = keyof TRoleMap & string; | ||
| /** | ||
| * Default entity type — the narrowest scope. | ||
| * Returns a union of all role entity types, so only common fields are accessible via keyof. | ||
| * | ||
| * @example | ||
| * CommonEntity<{ admin: { id: string; secret: string }; public: { id: string } }> | ||
| * // = { id: string; secret: string } | { id: string } | ||
| * // Only `id` is accessible (common to all roles) | ||
| */ | ||
| export type CommonEntity<TRoleMap extends Record<string, object>> = TRoleMap[keyof TRoleMap]; | ||
| /** | ||
| * Entity type for specific roles — expanded scope. | ||
| * Returns an intersection of the specified roles' entity types, | ||
| * giving access to all fields from any of those roles. | ||
| * | ||
| * @example | ||
| * EntityForRoles<{ admin: { id: string; secret: string }; editor: { id: string; notes: string } }, 'admin'> | ||
| * // = { id: string; secret: string } | ||
| * | ||
| * EntityForRoles<{ admin: { id: string; secret: string }; editor: { id: string; notes: string } }, 'admin' | 'editor'> | ||
| * // = { id: string; secret: string } & { id: string; notes: string } | ||
| * // = { id: string; secret: string; notes: string } | ||
| */ | ||
| export type EntityForRoles<TRoleMap extends Record<string, object>, TRoles extends keyof TRoleMap> = UnionToIntersection<TRoleMap[TRoles]> & object; | ||
| /** | ||
| * Resolves the entity type based on whether roles are specified. | ||
| * - No roles (TRoles = never): returns CommonEntity (narrowest) | ||
| * - With roles: returns EntityForRoles (expanded) | ||
| */ | ||
| export type ResolveEntity<TRoleMap extends Record<string, object>, TRoles extends string> = [TRoles] extends [never] ? CommonEntity<TRoleMap> : EntityForRoles<TRoleMap, TRoles & keyof TRoleMap>; | ||
| /** | ||
| * Sentinel role name used when no ACL roles are defined. | ||
| * entityDef<Article>('Article') wraps as { _default: Article }. | ||
| */ | ||
| export declare const DEFAULT_ROLE: "_default"; | ||
| export type DefaultRole = typeof DEFAULT_ROLE; | ||
| /** | ||
| * Wraps a single entity type as a single-role map with the _default role. | ||
| */ | ||
| export type SingleRoleMap<TEntity extends object> = { | ||
| readonly [K in DefaultRole]: TEntity; | ||
| }; | ||
| export { type UnionToIntersection, type RoleNames, type CommonEntity, type EntityForRoles, type ResolveEntity, type SingleRoleMap, type DefaultRole, DEFAULT_ROLE, } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=roles.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/schema/roles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAChC,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,CAAA;AAMtF;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,MAAM,QAAQ,GAAG,MAAM,CAAA;AAExF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAA;AAE5F;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CACzB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,SAAS,MAAM,QAAQ,IAC1B,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAA;AAElD;;;;GAIG;AACH,MAAM,MAAM,aAAa,CACxB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACvC,MAAM,SAAS,MAAM,IAClB,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GACzB,YAAY,CAAC,QAAQ,CAAC,GACtB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,QAAQ,CAAC,CAAA;AAEpD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAG,UAAmB,CAAA;AAC/C,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,SAAS,MAAM,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,WAAW,GAAG,OAAO;CAAE,CAAA"} | ||
| {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/schema/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,YAAY,GACZ,MAAM,yBAAyB,CAAA"} |
@@ -1,28 +0,2 @@ | ||
| /** | ||
| * Loads schema from Contember Content API via GraphQL introspection. | ||
| */ | ||
| import { ContemberSchema } from './ContemberSchema.js'; | ||
| export interface SchemaLoaderClient { | ||
| execute<T>(query: string, options?: unknown): Promise<T>; | ||
| apiUrl?: string; | ||
| } | ||
| /** | ||
| * Loads and caches schema from Contember Content API. | ||
| * Instance-level cache avoids cross-tenant collisions and test pollution. | ||
| */ | ||
| export declare class SchemaLoader { | ||
| private readonly cache; | ||
| /** | ||
| * Loads schema from the API, with caching per API URL. | ||
| */ | ||
| loadSchema(client: SchemaLoaderClient, options?: unknown): Promise<ContemberSchema>; | ||
| /** | ||
| * Clears the schema cache. | ||
| */ | ||
| clearCache(): void; | ||
| /** | ||
| * Clears cache for a specific API URL. | ||
| */ | ||
| clearCacheFor(apiUrl: string): void; | ||
| } | ||
| export { SchemaLoader, type SchemaLoaderClient } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=SchemaLoader.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"SchemaLoader.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAA2B,MAAM,sBAAsB,CAAA;AAE/E,MAAM,WAAW,kBAAkB;IAClC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACxD,MAAM,CAAC,EAAE,MAAM,CAAA;CACf;AAwCD;;;GAGG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8C;IAEpE;;OAEG;IACG,UAAU,CACf,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,eAAe,CAAC;IAiB3B;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAGnC"} | ||
| {"version":3,"file":"SchemaLoader.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,95 +0,2 @@ | ||
| import type { ContemberSchema } from './ContemberSchema.js'; | ||
| import type { EntitySchemaDef, FieldDef, RelationType, SchemaDefinition } from './types.js'; | ||
| /** | ||
| * Runtime registry for entity schemas. | ||
| * Provides lookups for entity definitions, relation targets, and field types. | ||
| */ | ||
| export declare class SchemaRegistry<TModels extends Record<string, object> = Record<string, object>> { | ||
| private readonly entityDefs; | ||
| constructor(definition: SchemaDefinition<TModels>); | ||
| /** | ||
| * Creates a SchemaRegistry from a ContemberSchema (loaded from API or injected). | ||
| * This is the preferred way to create a SchemaRegistry at runtime. | ||
| */ | ||
| static fromContemberSchema(schema: ContemberSchema): SchemaRegistry; | ||
| /** | ||
| * Gets the entity names defined in the schema | ||
| */ | ||
| getEntityNames(): string[]; | ||
| /** | ||
| * Checks if an entity type exists in the schema | ||
| */ | ||
| hasEntity(entityType: string): boolean; | ||
| /** | ||
| * Gets the schema definition for an entity type | ||
| */ | ||
| getEntityDef(entityType: string): EntitySchemaDef | undefined; | ||
| /** | ||
| * Gets the field definition for a specific field on an entity | ||
| */ | ||
| getFieldDef(entityType: string, fieldName: string): FieldDef | undefined; | ||
| /** | ||
| * Gets the enum values for an enum field. | ||
| * Returns undefined if the field is not an enum or doesn't exist. | ||
| */ | ||
| getEnumValues(entityType: string, fieldName: string): readonly string[] | undefined; | ||
| /** | ||
| * Gets the enum name for an enum field. | ||
| * Returns undefined if the field is not an enum or doesn't exist. | ||
| */ | ||
| getEnumName(entityType: string, fieldName: string): string | undefined; | ||
| /** | ||
| * Gets the column type for a scalar field (e.g. 'String', 'Integer', 'Date'). | ||
| * Returns undefined if the field is not a scalar or doesn't exist. | ||
| */ | ||
| getColumnType(entityType: string, fieldName: string): string | undefined; | ||
| /** | ||
| * Gets the target entity type for a relation field. | ||
| * Returns undefined if the field is not a relation or doesn't exist. | ||
| */ | ||
| getRelationTarget(entityType: string, fieldName: string): string | undefined; | ||
| /** | ||
| * Gets the relation type for a field (hasOne or hasMany). | ||
| * Returns undefined if the field is not a relation. | ||
| */ | ||
| getRelationType(entityType: string, fieldName: string): RelationType | undefined; | ||
| /** | ||
| * Checks if a field is a relation (hasOne or hasMany) | ||
| */ | ||
| isRelation(entityType: string, fieldName: string): boolean; | ||
| /** | ||
| * Checks if a field is a has-one relation | ||
| */ | ||
| isHasOne(entityType: string, fieldName: string): boolean; | ||
| /** | ||
| * Checks if a field is a has-many relation | ||
| */ | ||
| isHasMany(entityType: string, fieldName: string): boolean; | ||
| /** | ||
| * Checks if a field is a scalar (non-relation) field | ||
| */ | ||
| isScalar(entityType: string, fieldName: string): boolean; | ||
| /** | ||
| * Gets the inverse field name for a relation. | ||
| * Returns undefined if no inverse is defined. | ||
| */ | ||
| getInverseField(entityType: string, fieldName: string): string | undefined; | ||
| /** | ||
| * Gets all scalar field names for an entity | ||
| */ | ||
| getScalarFields(entityType: string): string[]; | ||
| /** | ||
| * Gets all relation field names for an entity | ||
| */ | ||
| getRelationFields(entityType: string): string[]; | ||
| /** | ||
| * Gets all field names for an entity | ||
| */ | ||
| getAllFields(entityType: string): string[]; | ||
| /** | ||
| * Validates that all relation targets exist in the schema. | ||
| * Throws an error if any target is missing. | ||
| */ | ||
| validate(): void; | ||
| } | ||
| export { SchemaRegistry } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=SchemaRegistry.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"SchemaRegistry.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EACX,eAAe,EACf,QAAQ,EAGR,YAAY,EACZ,gBAAgB,EAChB,MAAM,YAAY,CAAA;AAEnB;;;GAGG;AACH,qBAAa,cAAc,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM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AAG,OAAO;IAIzD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAKxD;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ1E;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAS7C;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAS/C;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE;IAO1C;;;OAGG;IACH,QAAQ,IAAI,IAAI;CAchB"} | ||
| {"version":3,"file":"SchemaRegistry.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"} |
+1
-178
@@ -1,179 +0,2 @@ | ||
| /** | ||
| * Schema type definitions for bindx. | ||
| * Provides type-safe entity and relation definitions. | ||
| */ | ||
| import type { CommonEntity, SingleRoleMap } from './roles.js'; | ||
| /** | ||
| * Relation type discriminator | ||
| */ | ||
| export type RelationType = 'hasOne' | 'hasMany'; | ||
| /** | ||
| * Scalar field definition | ||
| */ | ||
| export interface ScalarFieldDef { | ||
| readonly type: 'scalar'; | ||
| readonly columnType?: string; | ||
| } | ||
| /** | ||
| * Enum scalar field definition — carries the allowed values at runtime | ||
| */ | ||
| export interface EnumFieldDef { | ||
| readonly type: 'enum'; | ||
| readonly enumName: string; | ||
| readonly values: readonly string[]; | ||
| } | ||
| /** | ||
| * Has-one relation definition | ||
| */ | ||
| export interface HasOneRelationDef<TTarget extends string = string> { | ||
| readonly type: 'hasOne'; | ||
| readonly target: TTarget; | ||
| /** Inverse field name on the target entity (for bidirectional relations) */ | ||
| readonly inverse?: string; | ||
| } | ||
| /** | ||
| * Has-many relation definition | ||
| */ | ||
| export interface HasManyRelationDef<TTarget extends string = string> { | ||
| readonly type: 'hasMany'; | ||
| readonly target: TTarget; | ||
| /** Inverse field name on the target entity (for bidirectional relations) */ | ||
| readonly inverse?: string; | ||
| } | ||
| /** | ||
| * Union of all field definition types | ||
| */ | ||
| export type FieldDef<TTarget extends string = string> = ScalarFieldDef | EnumFieldDef | HasOneRelationDef<TTarget> | HasManyRelationDef<TTarget>; | ||
| /** | ||
| * Entity schema definition - maps field names to their definitions | ||
| */ | ||
| export interface EntitySchemaDef<TEntityNames extends string = string> { | ||
| readonly fields: Record<string, FieldDef<TEntityNames>>; | ||
| } | ||
| /** | ||
| * Complete schema definition mapping entity names to their schemas. | ||
| * TModels provides the TypeScript types for each entity. | ||
| */ | ||
| export interface SchemaDefinition<TModels extends { | ||
| [K in keyof TModels]: object; | ||
| }, TEntityNames extends string = keyof TModels & string> { | ||
| readonly entities: { | ||
| [K in TEntityNames]: EntitySchemaDef<TEntityNames>; | ||
| }; | ||
| } | ||
| /** | ||
| * Helper function to create a scalar field definition | ||
| */ | ||
| export declare function scalar(): ScalarFieldDef; | ||
| /** | ||
| * Helper function to create an enum scalar field definition with allowed values. | ||
| */ | ||
| export declare function enumScalar<T extends string>(enumName: string, values: readonly T[]): EnumFieldDef; | ||
| /** | ||
| * Helper function to create a has-one relation definition | ||
| */ | ||
| export declare function hasOne<TTarget extends string>(target: TTarget, options?: { | ||
| inverse?: string; | ||
| }): HasOneRelationDef<TTarget>; | ||
| /** | ||
| * Helper function to create a has-many relation definition | ||
| */ | ||
| export declare function hasMany<TTarget extends string>(target: TTarget, options?: { | ||
| inverse?: string; | ||
| }): HasManyRelationDef<TTarget>; | ||
| /** | ||
| * Helper function to define a complete schema with full type inference. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * interface Author { | ||
| * id: string | ||
| * name: string | ||
| * articles: Article[] | ||
| * } | ||
| * | ||
| * interface Article { | ||
| * id: string | ||
| * title: string | ||
| * author: Author | ||
| * } | ||
| * | ||
| * const schema = defineSchema<{ | ||
| * Author: Author | ||
| * Article: Article | ||
| * }>({ | ||
| * entities: { | ||
| * Author: { | ||
| * fields: { | ||
| * id: scalar(), | ||
| * name: scalar(), | ||
| * articles: hasMany('Article', { inverse: 'author' }) | ||
| * } | ||
| * }, | ||
| * Article: { | ||
| * fields: { | ||
| * id: scalar(), | ||
| * title: scalar(), | ||
| * author: hasOne('Author', { inverse: 'articles' }) | ||
| * } | ||
| * } | ||
| * } | ||
| * }) | ||
| * ``` | ||
| */ | ||
| export declare function defineSchema<TModels extends { | ||
| [K in keyof TModels]: object; | ||
| }>(definition: SchemaDefinition<TModels>): SchemaDefinition<TModels>; | ||
| /** | ||
| * Infers the model type for a given entity name from a schema | ||
| */ | ||
| export type InferModel<TSchema extends SchemaDefinition<any>, TEntityName extends keyof TSchema['entities']> = TSchema extends SchemaDefinition<infer TModels> ? TEntityName extends keyof TModels ? TModels[TEntityName] : never : never; | ||
| /** | ||
| * Infers all entity names from a schema | ||
| */ | ||
| export type InferEntityNames<TSchema extends SchemaDefinition<any>> = keyof TSchema['entities'] & string; | ||
| /** | ||
| * A type-safe reference to an entity in the schema. | ||
| * Carries a role map as a phantom type parameter: Record<roleName, entityType>. | ||
| * | ||
| * For schemas without ACL, the role map is `{ _default: TEntity }`. | ||
| * For schemas with ACL, each role maps to a per-role entity type. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Without roles (convenience): | ||
| * const Article = entityDef<ArticleType>('Article') // → EntityDef<{ _default: ArticleType }> | ||
| * | ||
| * // With roles (generator): | ||
| * const Article = roleEntityDef<{ admin: Article$admin; public: Article$public }>('Article') | ||
| * ``` | ||
| */ | ||
| export interface EntityDef<TRoleMap extends Record<string, object> = Record<string, object>> { | ||
| readonly $name: string; | ||
| /** @internal phantom type for role map — not present at runtime */ | ||
| readonly $roleMap?: TRoleMap; | ||
| /** @internal reference to the schema definition for collection-time field lookups */ | ||
| readonly $schema?: SchemaDefinition<Record<string, object>>; | ||
| } | ||
| /** | ||
| * Infers the common (default) entity type from an EntityDef. | ||
| * Returns the union of all role entity types — only common fields are accessible. | ||
| */ | ||
| export type InferEntityDef<T> = T extends EntityDef<infer TRoleMap> ? CommonEntity<TRoleMap> : never; | ||
| /** | ||
| * Creates a type-safe entity definition reference. | ||
| * Wraps the entity type in a single-role map: `{ _default: TEntity }`. | ||
| * | ||
| * @param name - The entity name as used in the schema | ||
| * @param schema - Optional schema definition for collection-time field lookups | ||
| */ | ||
| export declare function entityDef<TEntity extends object>(name: string, schema?: SchemaDefinition<Record<string, object>>): EntityDef<SingleRoleMap<TEntity>>; | ||
| /** | ||
| * Creates a role-aware entity definition reference. | ||
| * Used by the generator when ACL roles are present. | ||
| * | ||
| * @param name - The entity name as used in the schema | ||
| * @param schema - Optional schema definition for collection-time field lookups | ||
| */ | ||
| export declare function roleEntityDef<TRoleMap extends Record<string, object>>(name: string, schema?: SchemaDefinition<Record<string, object>>): EntityDef<TRoleMap>; | ||
| export { type RelationType, type ScalarFieldDef, type HasOneRelationDef, type HasManyRelationDef, type FieldDef, type EntitySchemaDef, type SchemaDefinition, type InferModel, type InferEntityNames, type EntityDef, type InferEntityDef, type EnumFieldDef, scalar, enumScalar, hasOne, hasMany, defineSchema, entityDef, roleEntityDef, } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;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K,YAAY,EACjB,MAAM,EACN,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,SAAS,EACT,aAAa,GACb,MAAM,yBAAyB,CAAA"} |
@@ -1,45 +0,2 @@ | ||
| import type { SelectionMeta } from './types.js'; | ||
| /** | ||
| * Query specification for a single field | ||
| */ | ||
| export interface QueryFieldSpec { | ||
| /** Name of the field as it appears in the output */ | ||
| name: string; | ||
| /** Path to the field in the source entity */ | ||
| sourcePath: string[]; | ||
| /** For nested objects/entities */ | ||
| nested?: QuerySpec; | ||
| /** Whether this is an array/collection */ | ||
| isArray?: boolean; | ||
| /** For has-many: filter parameters */ | ||
| filter?: unknown; | ||
| /** For has-many: ordering parameters */ | ||
| orderBy?: unknown; | ||
| /** For has-many: limit */ | ||
| limit?: number; | ||
| /** For has-many: offset */ | ||
| offset?: number; | ||
| /** For has-many: request totalCount via paginateRelation */ | ||
| totalCount?: boolean; | ||
| } | ||
| /** | ||
| * Query specification for fetching data. | ||
| * Backend adapters use this to construct their queries. | ||
| */ | ||
| export interface QuerySpec { | ||
| /** List of fields to fetch */ | ||
| fields: QueryFieldSpec[]; | ||
| } | ||
| /** | ||
| * Builds a QuerySpec from SelectionMeta. | ||
| * This is what gets passed to the backend adapter. | ||
| * | ||
| * @param meta - The selection metadata | ||
| */ | ||
| export declare function buildQueryFromSelection(meta: SelectionMeta): QuerySpec; | ||
| /** | ||
| * Collects all unique paths that need to be fetched. | ||
| * Useful for debugging and optimization. | ||
| */ | ||
| export declare function collectPaths(meta: SelectionMeta, basePath?: string[]): string[][]; | ||
| export { buildQueryFromSelection, collectPaths, type QuerySpec, type QueryFieldSpec } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=buildQuery.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/selection/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAA;AAEnE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,kCAAkC;IAClC,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2BAA2B;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACzB,8BAA8B;IAC9B,MAAM,EAAE,cAAc,EAAE,CAAA;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAwBtE;AA2CD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,MAAM,EAAE,EAAE,CAqBrF"} | ||
| {"version":3,"file":"buildQuery.d.ts","sourceRoot":"","sources":["../../src/selection/buildQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,29 +0,2 @@ | ||
| import { type FluentFragment, type SelectionBuilder } from './types.js'; | ||
| /** | ||
| * Creates a reusable fragment using the fluent builder API. | ||
| * | ||
| * This is a curried function - first call provides the model type, | ||
| * second call provides the definer function. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a fragment | ||
| * const AuthorFragment = createFragment<Author>()(e => | ||
| * e.id().name().email() | ||
| * ) | ||
| * | ||
| * // Use in useEntity | ||
| * const article = useEntity('Article', { id }, e => | ||
| * e.title().author(AuthorFragment) | ||
| * ) | ||
| * | ||
| * // Or compose fragments | ||
| * const ArticleFragment = createFragment<Article>()(e => | ||
| * e.id().title() | ||
| * .author(AuthorFragment) | ||
| * .tags(TagFragment) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| export declare function createFragment<TModel>(): <TResult extends object>(definer: (builder: SelectionBuilder<TModel>) => SelectionBuilder<TModel, TResult, object>) => FluentFragment<TModel, TResult>; | ||
| export { createFragment } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=createFragment.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"createFragment.d.ts","sourceRoot":"","sources":["../../src/selection/createFragment.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,MAAM,MACnB,OAAO,SAAS,MAAM,EACtC,SAAS,CAAC,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAAK,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,KACvF,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBlC"} | ||
| {"version":3,"file":"createFragment.d.ts","sourceRoot":"","sources":["../../src/selection/createFragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,18 +0,2 @@ | ||
| import { type SelectionBuilder, type SelectionMeta } from './types.js'; | ||
| /** | ||
| * Creates a fluent selection builder for an entity type. | ||
| * Uses Proxy to intercept method calls and build selection metadata. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * const builder = createSelectionBuilder<Article>() | ||
| * const result = builder.id().title().author(a => a.name()) | ||
| * const meta = result[SELECTION_META] | ||
| * ``` | ||
| */ | ||
| export declare function createSelectionBuilder<TEntity, TSelected extends object = object, THasManyParams extends object = object>(initialMeta?: SelectionMeta): SelectionBuilder<TEntity, TSelected, THasManyParams>; | ||
| /** | ||
| * Extracts SelectionMeta from a builder | ||
| */ | ||
| export declare function getSelectionMeta(builder: SelectionBuilder<unknown, object, object>): SelectionMeta; | ||
| export { createSelectionBuilder, getSelectionMeta } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=createSelectionBuilder.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"createSelectionBuilder.d.ts","sourceRoot":"","sources":["../../src/selection/createSelectionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAElB,MAAM,YAAY,CAAA;AAInB;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,cAAc,SAAS,MAAM,GAAG,MAAM,EACxH,WAAW,GAAE,aAAqC,GAChD,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,CA8BtD;AA+ND;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAElG"} | ||
| {"version":3,"file":"createSelectionBuilder.d.ts","sourceRoot":"","sources":["../../src/selection/createSelectionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,84 +0,2 @@ | ||
| /** | ||
| * Typed query parameter types for filter, orderBy, etc. | ||
| * | ||
| * Uses Input.Condition and Input.OrderDirection from @contember/schema | ||
| * for scalar conditions, wrapped in entity-aware types that work with | ||
| * plain TypeScript interfaces. | ||
| */ | ||
| import { Input } from '@contember/schema'; | ||
| /** | ||
| * Condition operators for scalar values - re-exported from @contember/schema | ||
| */ | ||
| export type ScalarCondition<T> = Input.Condition<T>; | ||
| /** | ||
| * Order direction enum values - string literal union from Contember enum | ||
| */ | ||
| export type OrderDirection = `${Input.OrderDirection}`; | ||
| /** | ||
| * Base composed where with AND/OR/NOT logic | ||
| */ | ||
| export interface ComposedWhere<TEntity> { | ||
| readonly and?: readonly EntityWhere<TEntity>[]; | ||
| readonly or?: readonly EntityWhere<TEntity>[]; | ||
| readonly not?: EntityWhere<TEntity>; | ||
| } | ||
| /** | ||
| * Checks if a type is a "plain object" (entity) vs a scalar like Date | ||
| * Date and other built-in objects are not treated as relations | ||
| */ | ||
| type IsPlainObject<T> = T extends Date ? false : T extends Array<any> ? false : T extends Function ? false : T extends object ? true : false; | ||
| /** | ||
| * Field-level where clause for an entity | ||
| * Maps each field to its appropriate condition type using Input.Condition | ||
| */ | ||
| export type FieldsWhere<TEntity> = { | ||
| readonly [K in keyof TEntity]?: NonNullable<TEntity[K]> extends Array<infer U> ? IsPlainObject<U> extends true ? EntityWhere<U> | null : Input.Condition<NonNullable<TEntity[K]>> | null : IsPlainObject<NonNullable<TEntity[K]>> extends true ? EntityWhere<NonNullable<TEntity[K]>> | null : Input.Condition<NonNullable<TEntity[K]>> | null; | ||
| }; | ||
| /** | ||
| * Full where type for an entity - combines composed and field conditions | ||
| */ | ||
| export type EntityWhere<TEntity> = ComposedWhere<TEntity> & FieldsWhere<TEntity>; | ||
| /** | ||
| * Order by clause for an entity | ||
| * Each scalar field can have a direction, relations can have nested ordering | ||
| */ | ||
| export type EntityOrderBy<TEntity> = { | ||
| readonly [K in keyof TEntity]?: NonNullable<TEntity[K]> extends Array<any> ? never : IsPlainObject<NonNullable<TEntity[K]>> extends true ? EntityOrderBy<NonNullable<TEntity[K]>> | null : OrderDirection | null; | ||
| } & { | ||
| readonly _random?: boolean; | ||
| readonly _randomSeeded?: number; | ||
| }; | ||
| /** | ||
| * Options for has-many relation selection with typed filter/orderBy | ||
| * | ||
| * @typeParam TItem - The related entity type (array item type) | ||
| * @typeParam TAlias - Optional alias for the field | ||
| */ | ||
| export interface TypedHasManyOptions<TItem, TAlias extends string = string> { | ||
| readonly as?: TAlias; | ||
| readonly filter?: EntityWhere<TItem>; | ||
| readonly orderBy?: readonly EntityOrderBy<TItem>[]; | ||
| readonly limit?: number; | ||
| readonly offset?: number; | ||
| readonly totalCount?: boolean; | ||
| } | ||
| /** | ||
| * Alias-only options (for scalar or has-one with alias) | ||
| */ | ||
| export interface AliasOptions<TAlias extends string = string> { | ||
| readonly as?: TAlias; | ||
| } | ||
| /** | ||
| * Extracts the item type from an array type | ||
| */ | ||
| export type ArrayItemType<T> = T extends Array<infer U> ? U : never; | ||
| /** | ||
| * Checks if a type is an array | ||
| */ | ||
| export type IsArray<T> = T extends Array<any> ? true : false; | ||
| /** | ||
| * Extracts non-nullable type | ||
| */ | ||
| export type NonNullableType<T> = Exclude<T, null | undefined>; | ||
| export {}; | ||
| export { type EntityWhere, type EntityOrderBy, type ScalarCondition, type OrderDirection, type TypedHasManyOptions, type AliasOptions, } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=queryTypes.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"queryTypes.d.ts","sourceRoot":"","sources":["../../src/selection/queryTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAMzC;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AAEnD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,KAAK,CAAC,cAAc,EAAE,CAAA;AAMtD;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,WAAW,CAAC,OAAO,CAAC,EAAE,CAAA;IAC9C,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,WAAW,CAAC,OAAO,CAAC,EAAE,CAAA;IAC7C,QAAQ,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AA"} | ||
| {"version":3,"file":"queryTypes.d.ts","sourceRoot":"","sources":["../../src/selection/queryTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAA"} |
@@ -1,32 +0,2 @@ | ||
| import type { SelectionMeta, SelectionFieldMeta } from './types.js'; | ||
| /** | ||
| * Class for collecting field selection metadata during collection phase | ||
| */ | ||
| export declare class SelectionMetaCollector implements SelectionMeta { | ||
| readonly fields: Map<string, SelectionFieldMeta>; | ||
| /** | ||
| * Add a field to the selection. | ||
| * | ||
| * For has-many fields with parameters (filter, orderBy, limit, offset), | ||
| * uses alias as the key to allow multiple instances of the same field | ||
| * with different parameters. | ||
| */ | ||
| addField(fieldMeta: SelectionFieldMeta): void; | ||
| /** | ||
| * Get all root-level fields (not nested) | ||
| */ | ||
| getRootFields(): SelectionFieldMeta[]; | ||
| /** | ||
| * Convert to plain object for serialization | ||
| */ | ||
| toJSON(): SelectionMeta; | ||
| } | ||
| /** | ||
| * Merge two selections together | ||
| */ | ||
| export declare function mergeSelections(target: SelectionMeta, source: SelectionMeta): void; | ||
| /** | ||
| * Create empty selection metadata | ||
| */ | ||
| export declare function createEmptySelection(): SelectionMeta; | ||
| export { SelectionMetaCollector, mergeSelections, createEmptySelection } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=SelectionMetaCollector.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"SelectionMetaCollector.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionMetaCollector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGnE;;GAEG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC3D,QAAQ,CAAC,MAAM,kCAAwC;IAEvD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI;IA+C7C;;OAEG;IACH,aAAa,IAAI,kBAAkB,EAAE;IAUrC;;OAEG;IACH,MAAM,IAAI,aAAa;CAKvB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAyBlF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,CAEpD"} | ||
| {"version":3,"file":"SelectionMetaCollector.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionMetaCollector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,77 +0,2 @@ | ||
| import type { SelectionMeta } from './types.js'; | ||
| /** | ||
| * HasMany parameters for filtering, ordering, pagination | ||
| */ | ||
| export interface HasManyParams { | ||
| filter?: unknown; | ||
| orderBy?: unknown; | ||
| limit?: number; | ||
| offset?: number; | ||
| totalCount?: boolean; | ||
| } | ||
| /** | ||
| * Tree-based selection scope for collecting field selections. | ||
| * | ||
| * Unlike the flat path-based SelectionMetaCollector, SelectionScope | ||
| * maintains a hierarchical tree structure that naturally represents | ||
| * nested entity selections. | ||
| * | ||
| * Key benefits: | ||
| * - Natural tree structure matches entity relationships | ||
| * - No path string manipulation or collision risks | ||
| * - Scope carries its context - no need for symbol passing | ||
| * - Simple merge: just combine tree nodes | ||
| */ | ||
| export declare class SelectionScope { | ||
| private parent; | ||
| private children; | ||
| private scalarFields; | ||
| private relationMeta; | ||
| /** | ||
| * Create or get a child scope for a relation field. | ||
| * Automatically removes the field from scalars if it was there. | ||
| * New child scopes always include 'id' as a minimum selection. | ||
| */ | ||
| child(fieldName: string): SelectionScope; | ||
| /** | ||
| * Add a scalar field to this scope. | ||
| * If the field is already a relation, this is a no-op. | ||
| */ | ||
| addScalar(fieldName: string): void; | ||
| /** | ||
| * Mark a relation field as array (hasMany). | ||
| */ | ||
| markAsArray(fieldName: string): void; | ||
| /** | ||
| * Set hasMany parameters for a relation field. | ||
| */ | ||
| setHasManyParams(fieldName: string, params: HasManyParams): void; | ||
| /** | ||
| * Check if this scope has any fields (scalar or relation). | ||
| */ | ||
| hasFields(): boolean; | ||
| /** | ||
| * Merge another scope into this one. | ||
| * Scalar fields are added, relation children are recursively merged. | ||
| */ | ||
| merge(other: SelectionScope): void; | ||
| /** | ||
| * Merge fields from a SelectionMeta into this scope. | ||
| * Useful for integrating with existing fluent builder selections. | ||
| */ | ||
| mergeFromSelectionMeta(meta: SelectionMeta): void; | ||
| /** | ||
| * Convert this scope to SelectionMeta format for backwards compatibility. | ||
| * This allows the new SelectionScope to be used with existing query builders. | ||
| * | ||
| * For has-many fields with params, generates auto-alias to allow multiple | ||
| * HasMany components for the same field with different parameters. | ||
| */ | ||
| toSelectionMeta(): SelectionMeta; | ||
| /** | ||
| * Create a SelectionScope from an existing SelectionMeta. | ||
| * Useful for converting explicit selections to scope format. | ||
| */ | ||
| static fromSelectionMeta(meta: SelectionMeta): SelectionScope; | ||
| } | ||
| export { SelectionScope, type HasManyParams } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=SelectionScope.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"SelectionScope.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAA;AAGnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB;AAUD;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IAE1B,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,QAAQ,CAAyC;IAGzD,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,YAAY,CAAuC;IAE3D;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc;IAexC;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAMlC;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAOpC;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAOhE;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAyBlC;;;OAGG;IACH,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAoBjD;;;;;;OAMG;IACH,eAAe,IAAI,aAAa;IAqChC;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc;CAK7D"} | ||
| {"version":3,"file":"SelectionScope.d.ts","sourceRoot":"","sources":["../../src/selection/SelectionScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAA"} |
@@ -1,238 +0,2 @@ | ||
| import type { AnyBrand } from '../brand/ComponentBrand.js'; | ||
| import type { EntityWhere, EntityOrderBy } from './queryTypes.js'; | ||
| /** | ||
| * Symbol used to store selection metadata on builder objects | ||
| */ | ||
| export declare const SELECTION_META: unique symbol; | ||
| /** | ||
| * Options for has-many relation selection with typed filter/orderBy | ||
| * | ||
| * @typeParam TItem - The related entity type (array item type) | ||
| * @typeParam TAlias - Optional alias for the field | ||
| */ | ||
| export interface HasManyOptions<TItem = unknown, TAlias extends string = string> { | ||
| as?: TAlias; | ||
| filter?: EntityWhere<TItem>; | ||
| orderBy?: readonly EntityOrderBy<TItem>[]; | ||
| limit?: number; | ||
| offset?: number; | ||
| totalCount?: boolean; | ||
| } | ||
| /** | ||
| * Metadata for a selected field (runtime) | ||
| */ | ||
| export interface SelectionFieldMeta { | ||
| /** Original field name in the entity */ | ||
| fieldName: string; | ||
| /** Alias (output key) - defaults to fieldName */ | ||
| alias: string; | ||
| /** Full path to this field (for JSX components) */ | ||
| path: string[]; | ||
| /** Whether this is a relation (has nested fields) */ | ||
| isRelation: boolean; | ||
| /** Whether this is an array/has-many relation */ | ||
| isArray: boolean; | ||
| /** For relations: nested selection metadata */ | ||
| nested?: SelectionMeta; | ||
| /** For has-many: additional parameters */ | ||
| hasManyParams?: { | ||
| filter?: unknown; | ||
| orderBy?: unknown; | ||
| limit?: number; | ||
| offset?: number; | ||
| totalCount?: boolean; | ||
| }; | ||
| } | ||
| /** | ||
| * Runtime metadata for a complete selection | ||
| */ | ||
| export interface SelectionMeta { | ||
| fields: Map<string, SelectionFieldMeta>; | ||
| } | ||
| /** | ||
| * A fragment defined with the fluent builder | ||
| * | ||
| * @typeParam TModel - The entity model type | ||
| * @typeParam TResult - The selected fields result type | ||
| * @typeParam TBrand - Component brand type for validation (defaults to AnyBrand) | ||
| */ | ||
| export interface FluentFragment<TModel, TResult, TBrand extends AnyBrand = AnyBrand> { | ||
| /** Runtime metadata */ | ||
| readonly __meta: SelectionMeta; | ||
| /** Type brand for result type */ | ||
| readonly __resultType: TResult; | ||
| /** Type brand for model type */ | ||
| readonly __modelType: TModel; | ||
| /** Marker for type checking */ | ||
| readonly __isFragment: true; | ||
| /** Component brand for type-level tracking */ | ||
| readonly __brand?: TBrand; | ||
| /** Runtime brand symbols for validation */ | ||
| readonly __brands?: Set<symbol>; | ||
| /** Runtime roles for validation */ | ||
| readonly __roles?: readonly string[]; | ||
| } | ||
| /** | ||
| * Scalar method on selection builder - selects a scalar field | ||
| */ | ||
| export interface ScalarMethod<TEntity, K extends keyof TEntity, TSelected extends object, THasManyParams extends object> { | ||
| /** Select field with original name */ | ||
| (): SelectionBuilder<TEntity, TSelected & Pick<TEntity, K>, THasManyParams>; | ||
| /** Select field with alias */ | ||
| <TAlias extends string>(options: { | ||
| as: TAlias; | ||
| }): SelectionBuilder<TEntity, TSelected & { | ||
| [P in TAlias]: TEntity[K]; | ||
| }, THasManyParams>; | ||
| } | ||
| /** | ||
| * Has-one method on selection builder - selects a relation to single entity | ||
| */ | ||
| export interface HasOneMethod<TEntity, K extends keyof TEntity, TRelated, TSelected extends object, THasManyParams extends object> { | ||
| /** Select with inline callback */ | ||
| <TNestedSelected extends object>(selector: (builder: SelectionBuilder<TRelated>) => SelectionBuilder<TRelated, TNestedSelected, object>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: TNestedSelected; | ||
| }, THasManyParams>; | ||
| /** Select with fragment */ | ||
| <TFragmentResult extends object>(fragment: FluentFragment<TRelated, TFragmentResult>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: TFragmentResult; | ||
| }, THasManyParams>; | ||
| /** Select with multiple fragments (merged) - result type is intersection of all fragment result types */ | ||
| <T1 extends object, T2 extends object>(fragment1: FluentFragment<TRelated, T1>, fragment2: FluentFragment<TRelated, T2>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: T1 & T2; | ||
| }, THasManyParams>; | ||
| /** Select with three fragments (merged) */ | ||
| <T1 extends object, T2 extends object, T3 extends object>(fragment1: FluentFragment<TRelated, T1>, fragment2: FluentFragment<TRelated, T2>, fragment3: FluentFragment<TRelated, T3>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: T1 & T2 & T3; | ||
| }, THasManyParams>; | ||
| /** Select with alias and callback */ | ||
| <TAlias extends string, TNestedSelected extends object>(options: { | ||
| as: TAlias; | ||
| }, selector: (builder: SelectionBuilder<TRelated>) => SelectionBuilder<TRelated, TNestedSelected, object>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in TAlias]: TNestedSelected; | ||
| }, THasManyParams>; | ||
| /** Select with alias and fragment */ | ||
| <TAlias extends string, TFragmentResult extends object>(options: { | ||
| as: TAlias; | ||
| }, fragment: FluentFragment<TRelated, TFragmentResult>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in TAlias]: TFragmentResult; | ||
| }, THasManyParams>; | ||
| /** Select with alias and two fragments (merged) */ | ||
| <TAlias extends string, T1 extends object, T2 extends object>(options: { | ||
| as: TAlias; | ||
| }, fragment1: FluentFragment<TRelated, T1>, fragment2: FluentFragment<TRelated, T2>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in TAlias]: T1 & T2; | ||
| }, THasManyParams>; | ||
| /** Select with alias and three fragments (merged) */ | ||
| <TAlias extends string, T1 extends object, T2 extends object, T3 extends object>(options: { | ||
| as: TAlias; | ||
| }, fragment1: FluentFragment<TRelated, T1>, fragment2: FluentFragment<TRelated, T2>, fragment3: FluentFragment<TRelated, T3>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in TAlias]: T1 & T2 & T3; | ||
| }, THasManyParams>; | ||
| } | ||
| /** | ||
| * Resolve alias from options or fall back to field name | ||
| */ | ||
| type ResolveAlias<K, TOptions> = TOptions extends { | ||
| as: infer A extends string; | ||
| } ? A : K & string; | ||
| /** | ||
| * Has-many method on selection builder - selects a relation to multiple entities | ||
| */ | ||
| export interface HasManyMethod<TEntity, K extends keyof TEntity, TItem, TSelected extends object, THasManyParams extends object> { | ||
| /** Select with inline callback (no options) */ | ||
| <TNestedSelected extends object>(selector: (builder: SelectionBuilder<TItem>) => SelectionBuilder<TItem, TNestedSelected, object>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: TNestedSelected[]; | ||
| }, THasManyParams & { | ||
| [P in K & string]: object; | ||
| }>; | ||
| /** Select with fragment (no options) */ | ||
| <TFragmentResult extends object>(fragment: FluentFragment<TItem, TFragmentResult>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: TFragmentResult[]; | ||
| }, THasManyParams & { | ||
| [P in K & string]: object; | ||
| }>; | ||
| /** Select with two fragments (merged, no options) */ | ||
| <T1 extends object, T2 extends object>(fragment1: FluentFragment<TItem, T1>, fragment2: FluentFragment<TItem, T2>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: (T1 & T2)[]; | ||
| }, THasManyParams & { | ||
| [P in K & string]: object; | ||
| }>; | ||
| /** Select with three fragments (merged, no options) */ | ||
| <T1 extends object, T2 extends object, T3 extends object>(fragment1: FluentFragment<TItem, T1>, fragment2: FluentFragment<TItem, T2>, fragment3: FluentFragment<TItem, T3>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in K & string]: (T1 & T2 & T3)[]; | ||
| }, THasManyParams & { | ||
| [P in K & string]: object; | ||
| }>; | ||
| /** Select with options and callback */ | ||
| <TOptions extends HasManyOptions<TItem>, TNestedSelected extends object>(options: TOptions, selector: (builder: SelectionBuilder<TItem>) => SelectionBuilder<TItem, TNestedSelected, object>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in ResolveAlias<K, TOptions>]: TNestedSelected[]; | ||
| }, THasManyParams & { | ||
| [P in ResolveAlias<K, TOptions>]: TOptions; | ||
| }>; | ||
| /** Select with options and fragment */ | ||
| <TOptions extends HasManyOptions<TItem>, TFragmentResult extends object>(options: TOptions, fragment: FluentFragment<TItem, TFragmentResult>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in ResolveAlias<K, TOptions>]: TFragmentResult[]; | ||
| }, THasManyParams & { | ||
| [P in ResolveAlias<K, TOptions>]: TOptions; | ||
| }>; | ||
| /** Select with options and two fragments (merged) */ | ||
| <TOptions extends HasManyOptions<TItem>, T1 extends object, T2 extends object>(options: TOptions, fragment1: FluentFragment<TItem, T1>, fragment2: FluentFragment<TItem, T2>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in ResolveAlias<K, TOptions>]: (T1 & T2)[]; | ||
| }, THasManyParams & { | ||
| [P in ResolveAlias<K, TOptions>]: TOptions; | ||
| }>; | ||
| /** Select with options and three fragments (merged) */ | ||
| <TOptions extends HasManyOptions<TItem>, T1 extends object, T2 extends object, T3 extends object>(options: TOptions, fragment1: FluentFragment<TItem, T1>, fragment2: FluentFragment<TItem, T2>, fragment3: FluentFragment<TItem, T3>): SelectionBuilder<TEntity, TSelected & { | ||
| [P in ResolveAlias<K, TOptions>]: (T1 & T2 & T3)[]; | ||
| }, THasManyParams & { | ||
| [P in ResolveAlias<K, TOptions>]: TOptions; | ||
| }>; | ||
| } | ||
| /** | ||
| * Maps entity fields to their corresponding builder methods | ||
| */ | ||
| type SelectionBuilderMethods<TEntity, TSelected extends object, THasManyParams extends object> = { | ||
| [K in keyof TEntity]-?: TEntity[K] extends Array<infer U> ? HasManyMethod<TEntity, K, U, TSelected, THasManyParams> : NonNullable<TEntity[K]> extends object ? HasOneMethod<TEntity, K, NonNullable<TEntity[K]>, TSelected, THasManyParams> : ScalarMethod<TEntity, K, TSelected, THasManyParams>; | ||
| }; | ||
| /** | ||
| * The main fluent selection builder interface. | ||
| * | ||
| * @typeParam TEntity - The entity type being selected from | ||
| * @typeParam TSelected - Accumulated type of selected fields (grows with each selection) | ||
| * @typeParam THasManyParams - Record tracking has-many parameters for alias consistency | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Select scalar fields | ||
| * e.id().title().content() | ||
| * // Type: { id: string, title: string, content: string } | ||
| * | ||
| * // Select with alias | ||
| * e.title({ as: 'headline' }) | ||
| * // Type: { headline: string } | ||
| * | ||
| * // Select has-one relation | ||
| * e.author(a => a.name().email()) | ||
| * // Type: { author: { name: string, email: string } } | ||
| * | ||
| * // Select has-many with options | ||
| * e.tags({ filter: { active: true } }, t => t.name()) | ||
| * // Type: { tags: { name: string }[] } | ||
| * ``` | ||
| */ | ||
| export type SelectionBuilder<TEntity, TSelected extends object = object, THasManyParams extends object = object> = SelectionBuilderMethods<TEntity, TSelected, THasManyParams> & { | ||
| [SELECTION_META]: SelectionMeta; | ||
| /** Type brand for the selected result */ | ||
| readonly __selected: TSelected; | ||
| }; | ||
| /** | ||
| * Extracts the selected type from a SelectionBuilder | ||
| */ | ||
| export type InferSelection<T> = T extends SelectionBuilder<infer _E, infer S, infer _P> ? S : never; | ||
| /** | ||
| * Type for the fluent definer function used in useEntity/useEntityList | ||
| */ | ||
| export type FluentDefiner<TModel, TResult extends object> = (builder: SelectionBuilder<TModel>) => SelectionBuilder<TModel, TResult, object>; | ||
| export {}; | ||
| export { SELECTION_META, type SelectionBuilder, type SelectionMeta, type SelectionFieldMeta, type FluentFragment, type FluentDefiner, type HasManyOptions, type InferSelection, type ScalarMethod, type HasOneMethod, type HasManyMethod, } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/selection/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,cAAc,eAA2B,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAC9B,KAAK,GAAG,OAAO,EACf,MAAM,SAAS,MAAM,GAAG,MAAM;IAE9B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IAC3B,OAAO,CAAC,EAAE,SAAS,aAAa,CAAC,KAAK,CAAC,EAAE,CAAA;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAA;IACnB,iDAAiD;IACj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AE,CAAC,EAAE,SAAS,EAAE,cAAc,CAAC;CACvD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,cAAc,SAAS,MAAM,GAAG,MAAM,IAC9G,uBAAuB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,GAAG;IAC7D,CAAC,cAAc,CAAC,EAAE,aAAa,CAAA;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAA;CAC9B,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,gBAAgB,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEnG;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,SAAS,MAAM,IAAI,CAC3D,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,KAC7B,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA"} | ||
| {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/selection/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,GAClB,MAAM,yBAAyB,CAAA"} |
@@ -1,25 +0,2 @@ | ||
| import type { HasManyParams } from '../selection/SelectionScope.js'; | ||
| /** | ||
| * Generates an alias for a has-many relation based on field name and parameters. | ||
| * | ||
| * If no parameters are provided or all are undefined, returns the fieldName as-is. | ||
| * Otherwise, generates a deterministic alias by hashing the parameters. | ||
| * | ||
| * @param fieldName - The original field name | ||
| * @param params - Optional has-many parameters (filter, orderBy, limit, offset) | ||
| * @returns The alias to use for this has-many relation | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // No params - returns fieldName | ||
| * generateHasManyAlias('tags') // => 'tags' | ||
| * | ||
| * // With filter - generates unique alias | ||
| * generateHasManyAlias('tags', { filter: { active: true } }) // => 'tags_a7x9k2' | ||
| * | ||
| * // Different params - different aliases | ||
| * generateHasManyAlias('tags', { filter: { active: false } }) // => 'tags_b3m1p8' | ||
| * ``` | ||
| */ | ||
| export declare function generateHasManyAlias(fieldName: string, params?: HasManyParams): string; | ||
| export { generateHasManyAlias } from '@contember/bindx-client'; | ||
| //# sourceMappingURL=aliasGenerator.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"aliasGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/aliasGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,MAAM,CA+BtF"} | ||
| {"version":3,"file":"aliasGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/aliasGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA"} |
+4
-4
| { | ||
| "name": "@contember/bindx", | ||
| "version": "0.1.5", | ||
| "version": "0.1.8", | ||
| "description": "Type-safe data binding framework (core)", | ||
@@ -20,5 +20,5 @@ "type": "module", | ||
| "dependencies": { | ||
| "@contember/client-content": "^2.1.0-alpha.30", | ||
| "@contember/graphql-builder": "^2.1.0-alpha.30", | ||
| "@contember/graphql-client": "^2.1.0-alpha.30" | ||
| "@contember/bindx-client": "0.1.8", | ||
| "@contember/graphql-builder": "^2.1.0-beta.1", | ||
| "@contember/graphql-client": "^2.1.0-beta.1" | ||
| }, | ||
@@ -25,0 +25,0 @@ "repository": { |
+189
-119
@@ -1,17 +0,23 @@ | ||
| import { GraphQlClient } from '@contember/graphql-client' | ||
| import { | ||
| ContentClient, | ||
| ContentQueryBuilder, | ||
| ContentEntitySelection, | ||
| SchemaNames, | ||
| ContentQuery, | ||
| type EntitySelectionManyArgs, | ||
| type EntitySelectionOneArgs, | ||
| type EntitySelectionColumnArgs, | ||
| type ContentClientInput, | ||
| } from '@contember/client-content' | ||
| import { type Input } from '@contember/schema' | ||
| type ContentClientOptions, | ||
| ContentOperation, | ||
| type ContentQuery, | ||
| querySpecToGraphQl, | ||
| type QuerySpecContext, | ||
| buildGetArgs, | ||
| buildListArgs, | ||
| buildCreateArgs, | ||
| buildUpdateArgs, | ||
| buildDeleteArgs, | ||
| buildMutationSelection, | ||
| mutationFragments, | ||
| unwrapPaginateResult, | ||
| } from '@contember/bindx-client' | ||
| import type { GraphQlClient } from '@contember/graphql-client' | ||
| import type { QuerySpec, QueryFieldSpec } from '../selection/buildQuery.js' | ||
| import type { BackendAdapter, Query, QueryResult, QueryOptions, GetQuery, ListQuery, PersistResult, CreateResult, DeleteResult } from './types.js' | ||
| import type { ContemberMutationResult } from '../errors/pathMapper.js' | ||
| import type { SchemaRegistry } from '../schema/SchemaRegistry.js' | ||
| import { GraphQlField } from '@contember/graphql-builder' | ||
@@ -24,4 +30,4 @@ /** | ||
| client: GraphQlClient | ||
| /** Contember schema names for query building */ | ||
| schema: SchemaNames | ||
| /** Schema registry for relation target resolution */ | ||
| schemaRegistry: SchemaRegistry | ||
| } | ||
@@ -31,3 +37,3 @@ | ||
| * Backend adapter for Contember Content API. | ||
| * Uses @contember/client-content for type-safe GraphQL operations. | ||
| * Uses @contember/bindx-client for GraphQL operations. | ||
| */ | ||
@@ -38,3 +44,3 @@ export class ContemberAdapter implements BackendAdapter { | ||
| private readonly contentClient: ContentClient, | ||
| private readonly queryBuilder: ContentQueryBuilder, | ||
| private readonly schemaRegistry: SchemaRegistry, | ||
| ) { | ||
@@ -65,4 +71,3 @@ } | ||
| // Map results back to QueryResult array | ||
| // Content client transforms already unwrap paginateRelation → flat arrays | ||
| // Map results back to QueryResult array, unwrapping paginate format | ||
| return queries.map((q, i) => { | ||
@@ -73,5 +78,7 @@ const key = `q${i}` | ||
| if (q.type === 'get') { | ||
| return { type: 'get' as const, data: data as Record<string, unknown> | null } | ||
| const unwrapped = data ? unwrapPaginateFields(data as Record<string, unknown>, q.spec) : null | ||
| return { type: 'get' as const, data: unwrapped } | ||
| } else { | ||
| return { type: 'list' as const, data: (data ?? []) as readonly Record<string, unknown>[] } | ||
| const items = (data ?? []) as readonly Record<string, unknown>[] | ||
| return { type: 'list' as const, data: items.map(item => unwrapPaginateFields(item, q.spec)) } | ||
| } | ||
@@ -82,15 +89,32 @@ }) | ||
| private buildGetQuery(query: GetQuery): ContentQuery<unknown> { | ||
| const selection = this.buildEntitySelection(query.spec) | ||
| return this.queryBuilder.get(query.entityType, { by: query.by }, selection) | ||
| const context = this.createContext(query.entityType) | ||
| const selectionSet = querySpecToGraphQl(query.spec, context) | ||
| const args = buildGetArgs(query.entityType, { by: query.by }) | ||
| return new ContentOperation( | ||
| 'query', | ||
| `get${query.entityType}`, | ||
| args, | ||
| selectionSet, | ||
| value => value, | ||
| ) | ||
| } | ||
| private buildListQuery(query: ListQuery): ContentQuery<unknown> { | ||
| const selection = this.buildEntitySelection(query.spec) | ||
| const args: ContentClientInput.AnyListQueryInput = { | ||
| filter: query.filter as Input.OptionalWhere | undefined, | ||
| orderBy: query.orderBy as ContentClientInput.AnyOrderBy | undefined, | ||
| const context = this.createContext(query.entityType) | ||
| const selectionSet = querySpecToGraphQl(query.spec, context) | ||
| const args = buildListArgs(query.entityType, { | ||
| filter: query.filter, | ||
| orderBy: query.orderBy as unknown[], | ||
| limit: query.limit, | ||
| offset: query.offset, | ||
| } | ||
| return this.queryBuilder.list(query.entityType, args, selection) | ||
| }) | ||
| return new ContentOperation( | ||
| 'query', | ||
| `list${query.entityType}`, | ||
| args, | ||
| selectionSet, | ||
| value => value, | ||
| ) | ||
| } | ||
@@ -103,18 +127,27 @@ | ||
| ): Promise<PersistResult> { | ||
| const mutation = this.queryBuilder.update(entityType, { | ||
| by: { id }, | ||
| data: changes as Input.UpdateDataInput, | ||
| }) | ||
| const args = buildUpdateArgs(entityType, { by: { id }, data: changes }) | ||
| const selectionSet = buildMutationSelection('update') | ||
| const result = await this.contentClient.mutate(mutation) | ||
| const mutation = new ContentOperation( | ||
| 'mutation', | ||
| `update${entityType}`, | ||
| args, | ||
| selectionSet, | ||
| value => value as { ok: boolean; errorMessage: string | null; errors: unknown[]; validation: unknown }, | ||
| ) | ||
| if (!result.ok) { | ||
| return { | ||
| ok: false, | ||
| errorMessage: result.errorMessage ?? `Failed to update ${entityType}:${id}`, | ||
| mutationResult: this.toMutationResult(result), | ||
| try { | ||
| const result = await this.contentClient.mutate(mutation) | ||
| return { ok: true } | ||
| } catch (e) { | ||
| if (e instanceof Error && 'result' in e) { | ||
| const mutResult = (e as { result: Record<string, unknown> }).result | ||
| return { | ||
| ok: false, | ||
| errorMessage: (mutResult['errorMessage'] as string | null) ?? `Failed to update ${entityType}:${id}`, | ||
| mutationResult: this.toMutationResult(mutResult), | ||
| } | ||
| } | ||
| throw e | ||
| } | ||
| return { ok: true } | ||
| } | ||
@@ -126,51 +159,75 @@ | ||
| ): Promise<CreateResult> { | ||
| // Build selection to return created entity | ||
| const selection = (s: ContentEntitySelection) => s.$('id') | ||
| const args = buildCreateArgs(entityType, { data }) | ||
| // Select id on created node | ||
| const nodeSelection = [new GraphQlField(null, 'id')] | ||
| const selectionSet = buildMutationSelection('create', nodeSelection) | ||
| const mutation = this.queryBuilder.create(entityType, { data: data as Input.CreateDataInput }, selection) | ||
| const result = await this.contentClient.mutate(mutation) | ||
| const mutation = new ContentOperation( | ||
| 'mutation', | ||
| `create${entityType}`, | ||
| args, | ||
| selectionSet, | ||
| value => value as { ok: boolean; errorMessage: string | null; errors: unknown[]; validation: unknown; node: unknown }, | ||
| ) | ||
| if (!result.ok) { | ||
| try { | ||
| const result = await this.contentClient.mutate(mutation) | ||
| const typedResult = result as { node: Record<string, unknown> | null } | ||
| return { | ||
| ok: false, | ||
| errorMessage: result.errorMessage ?? `Failed to create ${entityType}`, | ||
| mutationResult: this.toMutationResult(result), | ||
| ok: true, | ||
| data: typedResult.node as Record<string, unknown>, | ||
| } | ||
| } catch (e) { | ||
| if (e instanceof Error && 'result' in e) { | ||
| const mutResult = (e as { result: Record<string, unknown> }).result | ||
| return { | ||
| ok: false, | ||
| errorMessage: (mutResult['errorMessage'] as string | null) ?? `Failed to create ${entityType}`, | ||
| mutationResult: this.toMutationResult(mutResult), | ||
| } | ||
| } | ||
| throw e | ||
| } | ||
| return { | ||
| ok: true, | ||
| data: result.node as Record<string, unknown>, | ||
| } | ||
| } | ||
| async delete(entityType: string, id: string): Promise<DeleteResult> { | ||
| const mutation = this.queryBuilder.delete(entityType, { by: { id } }) | ||
| const result = await this.contentClient.mutate(mutation) | ||
| const args = buildDeleteArgs(entityType, { by: { id } }) | ||
| const selectionSet = buildMutationSelection('delete') | ||
| if (!result.ok) { | ||
| return { | ||
| ok: false, | ||
| errorMessage: result.errorMessage ?? `Failed to delete ${entityType}:${id}`, | ||
| mutationResult: this.toMutationResult(result), | ||
| const mutation = new ContentOperation( | ||
| 'mutation', | ||
| `delete${entityType}`, | ||
| args, | ||
| selectionSet, | ||
| value => value as { ok: boolean; errorMessage: string | null; errors: unknown[] }, | ||
| ) | ||
| try { | ||
| const result = await this.contentClient.mutate(mutation) | ||
| return { ok: true } | ||
| } catch (e) { | ||
| if (e instanceof Error && 'result' in e) { | ||
| const mutResult = (e as { result: Record<string, unknown> }).result | ||
| return { | ||
| ok: false, | ||
| errorMessage: (mutResult['errorMessage'] as string | null) ?? `Failed to delete ${entityType}:${id}`, | ||
| mutationResult: this.toMutationResult(mutResult), | ||
| } | ||
| } | ||
| throw e | ||
| } | ||
| return { ok: true } | ||
| } | ||
| /** | ||
| * Converts Contember mutation result to our ContemberMutationResult type. | ||
| * Converts raw mutation result to ContemberMutationResult type. | ||
| */ | ||
| private toMutationResult(result: { | ||
| ok: boolean | ||
| errorMessage: string | null | ||
| errors: Array<{ paths: Array<Array<{ field: string } | { index: number; alias: string | null }>>; message: string; type: string }> | ||
| validation: { valid: boolean; errors: Array<{ path: Array<{ field: string } | { index: number; alias: string | null }>; message: { text: string } }> } | ||
| }): ContemberMutationResult { | ||
| private toMutationResult(result: Record<string, unknown>): ContemberMutationResult { | ||
| const errors = (result['errors'] as Array<{ paths: unknown; message: string; type: string }>) ?? [] | ||
| const validation = result['validation'] as { valid: boolean; errors: Array<{ path: unknown; message: { text: string } }> } | undefined | ||
| return { | ||
| ok: result.ok, | ||
| errorMessage: result.errorMessage, | ||
| errors: result.errors.map(e => ({ | ||
| paths: e.paths, | ||
| ok: result['ok'] as boolean, | ||
| errorMessage: result['errorMessage'] as string | null, | ||
| errors: errors.map(e => ({ | ||
| paths: e.paths as Array<Array<{ field: string } | { index: number; alias: string | null }>>, | ||
| message: e.message, | ||
@@ -180,5 +237,5 @@ type: e.type, | ||
| validation: { | ||
| valid: result.validation.valid, | ||
| errors: result.validation.errors.map(e => ({ | ||
| path: e.path, | ||
| valid: validation?.valid ?? true, | ||
| errors: (validation?.errors ?? []).map(e => ({ | ||
| path: e.path as Array<{ field: string } | { index: number; alias: string | null }>, | ||
| message: { text: e.message.text }, | ||
@@ -191,59 +248,72 @@ })), | ||
| /** | ||
| * Builds ContentEntitySelection from QuerySpec | ||
| * Creates a QuerySpecContext for an entity, wiring in SchemaRegistry for relation target resolution. | ||
| */ | ||
| private buildEntitySelection( | ||
| query: QuerySpec, | ||
| ): (selection: ContentEntitySelection) => ContentEntitySelection { | ||
| return (selection: ContentEntitySelection) => { | ||
| return this.applyFieldsToSelection(selection, query.fields) | ||
| private createContext(entityName: string): QuerySpecContext { | ||
| return { | ||
| entityName, | ||
| resolveRelationTarget: (entity, field) => this.schemaRegistry.getRelationTarget(entity, field), | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Recursively applies QueryFieldSpec[] to ContentEntitySelection | ||
| */ | ||
| private applyFieldsToSelection( | ||
| selection: ContentEntitySelection, | ||
| fields: QueryFieldSpec[], | ||
| ): ContentEntitySelection { | ||
| let result = selection | ||
| /** | ||
| * Recursively unwraps paginate connection format in entity data. | ||
| * | ||
| * The GraphQL layer uses `paginateFieldName { edges { node { ... } } }` for has-many relations, | ||
| * but the store expects flat arrays keyed by the original field name. | ||
| * This function uses the QuerySpec to identify which fields need unwrapping. | ||
| */ | ||
| function unwrapPaginateFields(data: Record<string, unknown>, spec: QuerySpec): Record<string, unknown> { | ||
| const result: Record<string, unknown> = {} | ||
| for (const field of fields) { | ||
| const fieldName = field.sourcePath[0] | ||
| if (!fieldName) continue | ||
| // Copy all fields from data first | ||
| const handledKeys = new Set<string>() | ||
| if (field.nested) { | ||
| // Relation field (has-one or has-many) | ||
| const nestedCallback = (s: ContentEntitySelection) => | ||
| this.applyFieldsToSelection(s, field.nested!.fields) | ||
| for (const field of spec.fields) { | ||
| const fieldName = field.sourcePath[0] | ||
| if (!fieldName) continue | ||
| if (field.isArray) { | ||
| // has-many relation — always uses paginateRelation | ||
| const manyArgs: EntitySelectionManyArgs = { | ||
| ...(field.name !== fieldName ? { as: field.name } : undefined), | ||
| ...(field.filter !== undefined ? { filter: field.filter as Input.OptionalWhere } : undefined), | ||
| ...(field.orderBy !== undefined ? { orderBy: field.orderBy as ContentClientInput.AnyOrderBy } : undefined), | ||
| ...(field.limit !== undefined ? { limit: field.limit } : undefined), | ||
| ...(field.offset !== undefined ? { offset: field.offset } : undefined), | ||
| ...(field.totalCount ? { totalCount: true } : undefined), | ||
| } | ||
| if (field.isArray && field.nested) { | ||
| // Has-many field — look for paginate key or alias | ||
| const paginateKey = `paginate${fieldName.charAt(0).toUpperCase()}${fieldName.slice(1)}` | ||
| const alias = field.name !== fieldName ? field.name : null | ||
| const lookupKey = alias ?? paginateKey | ||
| result = result.$(fieldName, manyArgs, nestedCallback) | ||
| } else { | ||
| // has-one relation | ||
| const oneArgs: EntitySelectionOneArgs = { | ||
| ...(field.name !== fieldName ? { as: field.name } : undefined), | ||
| } | ||
| result = result.$(fieldName, oneArgs, nestedCallback) | ||
| } | ||
| const value = data[lookupKey] | ||
| handledKeys.add(lookupKey) | ||
| if (value && typeof value === 'object' && 'edges' in value) { | ||
| const connection = value as { edges: { node: unknown }[]; pageInfo?: { totalCount: number } } | ||
| const items = unwrapPaginateResult(connection, !!field.totalCount) as Record<string, unknown>[] | ||
| result[field.name] = items.map(item => unwrapPaginateFields(item, field.nested!)) | ||
| } else { | ||
| // Scalar field | ||
| const columnArgs: EntitySelectionColumnArgs | undefined = | ||
| field.name !== fieldName ? { as: field.name } : undefined | ||
| result = result.$(fieldName, columnArgs) | ||
| result[field.name] = value | ||
| } | ||
| } else if (field.nested) { | ||
| // Has-one relation — recurse into nested | ||
| const lookupKey = field.name !== fieldName ? field.name : fieldName | ||
| const value = data[lookupKey] | ||
| handledKeys.add(lookupKey) | ||
| if (value && typeof value === 'object') { | ||
| result[field.name] = unwrapPaginateFields(value as Record<string, unknown>, field.nested) | ||
| } else { | ||
| result[field.name] = value | ||
| } | ||
| } else { | ||
| // Scalar field | ||
| const lookupKey = field.name !== fieldName ? field.name : fieldName | ||
| handledKeys.add(lookupKey) | ||
| result[field.name] = data[lookupKey] | ||
| } | ||
| } | ||
| return result | ||
| // Preserve any extra fields not in the spec (e.g. 'id' returned by API) | ||
| for (const key of Object.keys(data)) { | ||
| if (!handledKeys.has(key) && !(key in result)) { | ||
| result[key] = data[key] | ||
| } | ||
| } | ||
| return result | ||
| } |
@@ -1,28 +0,1 @@ | ||
| /** | ||
| * ComponentBrand provides unique identity for each component created with createComponent. | ||
| * Each instance has a unique runtime Symbol for brand validation. | ||
| * The class structure itself provides nominal typing in TypeScript. | ||
| */ | ||
| export class ComponentBrand { | ||
| /** | ||
| * Private property to ensure nominal typing. | ||
| * Each class instance is considered a unique type. | ||
| */ | ||
| private readonly __nominal = true | ||
| /** | ||
| * Runtime symbol for brand validation. | ||
| * Used to check that EntityRef includes required component brands. | ||
| */ | ||
| readonly brandSymbol: symbol | ||
| constructor(public readonly name: string) { | ||
| this.brandSymbol = Symbol(`component_${name}_${Math.random().toString(36).slice(2)}`) | ||
| } | ||
| } | ||
| /** | ||
| * Type alias for any ComponentBrand. | ||
| * Used as default/base type in generic constraints. | ||
| */ | ||
| export type AnyBrand = ComponentBrand | ||
| export { ComponentBrand, type AnyBrand } from '@contember/bindx-client' |
@@ -9,10 +9,3 @@ /** | ||
| export { MutationCollector, type EntityMutationResult } from '../persistence/MutationCollector.js' | ||
| export { ContemberSchemaMutationAdapter } from '../persistence/ContemberSchemaMutationAdapter.js' | ||
| export { ContemberSchemaMutationAdapter, type SchemaNames } from '../persistence/ContemberSchemaMutationAdapter.js' | ||
| export type { MutationSchemaProvider } from '../persistence/MutationSchemaProvider.js' | ||
| // Re-export commonly used types from @contember/client-content | ||
| export type { | ||
| SchemaNames, | ||
| SchemaEntityNames, | ||
| ContentClientInput, | ||
| } from '@contember/client-content' |
+131
-61
@@ -14,3 +14,3 @@ import { EntityRelatedHandle } from './BaseHandle.js' | ||
| } from '../core/actions.js' | ||
| import { type EntityRef, type SelectedEntityFields, type Unsubscribe, type EntityAccessor } from './types.js' | ||
| import { type FieldRef, type HasOneAccessor, type HasManyRef, type SelectedEntityFields, type Unsubscribe, type EntityAccessor } from './types.js' | ||
| import { deepEqual } from '../utils/deepEqual.js' | ||
@@ -29,9 +29,18 @@ import { createClientError, type ErrorInput, type FieldError } from '../errors/types.js' | ||
| import { HasManyListHandle } from './HasManyListHandle.js' | ||
| import { createHandleProxy, ENTITY_HANDLE_PROPERTIES } from './proxyFactory.js' | ||
| import { createHandleProxy } from './proxyFactory.js' | ||
| import type { SelectionMeta } from '../selection/types.js' | ||
| import { UnfetchedFieldError } from '../errors/UnfetchedFieldError.js' | ||
| // Type for relation handle cache | ||
| type RelationHandle = HasOneHandle<object> | HasManyListHandle<object> | ||
| interface CachedHandle<TRaw, TProxy> { | ||
| readonly raw: TRaw | ||
| readonly proxy: TProxy | ||
| } | ||
| /** Minimal internal interface for cached relation handles that need reset/dispose. | ||
| * At runtime, the proxied handles satisfy this through delegation, even if the public type doesn't expose dispose(). */ | ||
| interface RelationHandleRaw { | ||
| reset(): void | ||
| dispose(): void | ||
| } | ||
| /** | ||
@@ -54,8 +63,8 @@ * EntityHandle provides stable access to an entity. | ||
| */ | ||
| export class EntityHandle<T extends object = object, TSelected = T> extends EntityRelatedHandle implements EntityRef<T, TSelected> { | ||
| export class EntityHandle<T extends object = object, TSelected = T> extends EntityRelatedHandle { | ||
| /** Cache for field handles to ensure stable identity */ | ||
| private readonly fieldHandleCache = new Map<string, FieldHandle<unknown>>() | ||
| private readonly fieldHandleCache = new Map<string, CachedHandle<FieldHandle<unknown>, FieldRef<unknown>>>() | ||
| /** Cache for relation handles */ | ||
| private readonly relationHandleCache = new Map<string, RelationHandle>() | ||
| private readonly relationHandleCache = new Map<string, CachedHandle<RelationHandleRaw, HasOneAccessor<object> | HasManyRef<object>>>() | ||
@@ -65,21 +74,2 @@ /** Runtime brand symbols for validation */ | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| declare readonly __schema: Record<string, object> | ||
| // $ aliases - handled by proxy at runtime, declared for TypeScript | ||
| declare readonly $fields: SelectedEntityFields<T, TSelected> | ||
| declare readonly $data: TSelected | null | ||
| declare readonly $isDirty: boolean | ||
| declare readonly $persistedId: string | null | ||
| declare readonly $isNew: boolean | ||
| declare readonly $errors: readonly FieldError[] | ||
| declare readonly $hasError: boolean | ||
| declare $addError: (error: ErrorInput) => void | ||
| declare $clearErrors: () => void | ||
| declare $clearAllErrors: () => void | ||
| declare $on: <E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>) => Unsubscribe | ||
| declare $intercept: <E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>) => Unsubscribe | ||
| declare $onPersisted: (listener: EventListener<EntityPersistedEvent>) => Unsubscribe | ||
| declare $interceptPersisting: (interceptor: Interceptor<EntityPersistingEvent>) => Unsubscribe | ||
| private constructor( | ||
@@ -106,9 +96,22 @@ id: string, | ||
| selection?: SelectionMeta, | ||
| ): EntityAccessor<T, TSelected> { | ||
| return EntityHandle.wrapProxy(new EntityHandle<T, TSelected>(id, entityType, store, dispatcher, schema, brands, selection)) | ||
| } | ||
| static createRaw<T extends object = object, TSelected = T>( | ||
| id: string, | ||
| entityType: string, | ||
| store: SnapshotStore, | ||
| dispatcher: ActionDispatcher, | ||
| schema: SchemaRegistry, | ||
| brands?: Set<symbol>, | ||
| selection?: SelectionMeta, | ||
| ): EntityHandle<T, TSelected> { | ||
| return createHandleProxy(new EntityHandle<T, TSelected>(id, entityType, store, dispatcher, schema, brands, selection), { | ||
| knownProperties: ENTITY_HANDLE_PROPERTIES, | ||
| getFields: (target) => target.fields, | ||
| }) | ||
| return new EntityHandle<T, TSelected>(id, entityType, store, dispatcher, schema, brands, selection) | ||
| } | ||
| static wrapProxy<T extends object, TSelected>(handle: EntityHandle<T, TSelected>): EntityAccessor<T, TSelected> { | ||
| return createHandleProxy<EntityHandle<T, TSelected>, EntityAccessor<T, TSelected>>(handle, (target) => target.fields) | ||
| } | ||
| /** | ||
@@ -122,9 +125,2 @@ * Gets the entity ID. | ||
| /** | ||
| * Gets the entity type. | ||
| */ | ||
| get type(): string { | ||
| return this.entityType | ||
| } | ||
| /** | ||
| * Gets the current entity snapshot. | ||
@@ -210,14 +206,14 @@ */ | ||
| if (relationType === 'hasOne') { | ||
| const handle = this.hasOne(fieldName) | ||
| const rawHandle = this.getHasOneHandleRaw(fieldName) | ||
| // Check if the relation itself is dirty (connect/disconnect) | ||
| if (handle.$isDirty) { | ||
| if (rawHandle.isDirty) { | ||
| return true | ||
| } | ||
| // Check if the target entity has dirty fields | ||
| if (handle.$entity.$isDirty) { | ||
| if (rawHandle.entityRaw.isDirty) { | ||
| return true | ||
| } | ||
| } else if (relationType === 'hasMany') { | ||
| const handle = this.hasMany(fieldName) | ||
| if (handle.isDirty) { | ||
| const rawHandle = this.getHasManyHandleRaw(fieldName) | ||
| if (rawHandle.isDirty) { | ||
| return true | ||
@@ -250,3 +246,3 @@ } | ||
| */ | ||
| field<K extends keyof T>(fieldName: K): FieldHandle<T[K]> { | ||
| field<K extends keyof T>(fieldName: K): FieldRef<T[K]> { | ||
| const cacheKey = String(fieldName) | ||
@@ -256,3 +252,3 @@ const cached = this.fieldHandleCache.get(cacheKey) | ||
| if (cached) { | ||
| return cached as FieldHandle<T[K]> | ||
| return cached.proxy as FieldRef<T[K]> | ||
| } | ||
@@ -262,3 +258,3 @@ | ||
| const columnType = this.schema.getColumnType(this.entityType, cacheKey) | ||
| const handle = FieldHandle.create<T[K]>( | ||
| const raw = FieldHandle.createRaw<T[K]>( | ||
| this.entityType, | ||
@@ -272,5 +268,6 @@ this.entityId, | ||
| ) | ||
| this.fieldHandleCache.set(cacheKey, handle as FieldHandle<unknown>) | ||
| const proxy = FieldHandle.wrapProxy(raw) | ||
| this.fieldHandleCache.set(cacheKey, { raw, proxy } as CachedHandle<FieldHandle<unknown>, FieldRef<unknown>>) | ||
| return handle | ||
| return proxy | ||
| } | ||
@@ -281,3 +278,3 @@ | ||
| */ | ||
| hasOne<TRelated extends object>(fieldName: string, nestedSelection?: SelectionMeta): HasOneHandle<TRelated> { | ||
| hasOne<TRelated extends object>(fieldName: string, nestedSelection?: SelectionMeta): HasOneAccessor<TRelated> { | ||
| const cacheKey = `hasOne:${fieldName}` | ||
@@ -287,3 +284,3 @@ const cached = this.relationHandleCache.get(cacheKey) | ||
| if (cached) { | ||
| return cached as HasOneHandle<TRelated> | ||
| return cached.proxy as HasOneAccessor<TRelated> | ||
| } | ||
@@ -298,3 +295,3 @@ | ||
| const handle = HasOneHandle.create<TRelated>( | ||
| const raw = HasOneHandle.createRaw<TRelated>( | ||
| this.entityType, | ||
@@ -310,5 +307,6 @@ this.entityId, | ||
| ) | ||
| this.relationHandleCache.set(cacheKey, handle as RelationHandle) | ||
| const proxy = HasOneHandle.wrapProxy(raw) | ||
| this.relationHandleCache.set(cacheKey, { raw, proxy } as unknown as CachedHandle<RelationHandleRaw, HasOneAccessor<object> | HasManyRef<object>>) | ||
| return handle | ||
| return proxy | ||
| } | ||
@@ -322,3 +320,3 @@ | ||
| */ | ||
| hasMany<TItem extends object>(fieldName: string, alias?: string, nestedSelection?: SelectionMeta): HasManyListHandle<TItem> { | ||
| hasMany<TItem extends object>(fieldName: string, alias?: string, nestedSelection?: SelectionMeta): HasManyRef<TItem> { | ||
| const effectiveAlias = alias ?? fieldName | ||
@@ -329,3 +327,3 @@ const cacheKey = `hasMany:${effectiveAlias}` | ||
| if (cached) { | ||
| return cached as HasManyListHandle<TItem> | ||
| return cached.proxy as HasManyRef<TItem> | ||
| } | ||
@@ -352,3 +350,3 @@ | ||
| ) | ||
| this.relationHandleCache.set(cacheKey, handle as RelationHandle) | ||
| this.relationHandleCache.set(cacheKey, { raw: handle, proxy: handle } as unknown as CachedHandle<RelationHandleRaw, HasOneAccessor<object> | HasManyRef<object>>) | ||
@@ -359,2 +357,74 @@ return handle | ||
| /** | ||
| * Gets a raw (unproxied) has-one relation handle from cache. | ||
| * Creates the handle if not cached yet. | ||
| */ | ||
| private getHasOneHandleRaw(fieldName: string): HasOneHandle<object> { | ||
| const cacheKey = `hasOne:${fieldName}` | ||
| const cached = this.relationHandleCache.get(cacheKey) | ||
| if (cached) { | ||
| return cached.raw as HasOneHandle<object> | ||
| } | ||
| const targetType = this.schema.getRelationTarget(this.entityType, fieldName) | ||
| if (!targetType) { | ||
| throw new Error( | ||
| `Field "${fieldName}" is not a relation on entity "${this.entityType}"`, | ||
| ) | ||
| } | ||
| const raw = HasOneHandle.createRaw( | ||
| this.entityType, | ||
| this.entityId, | ||
| fieldName, | ||
| targetType, | ||
| this.store, | ||
| this.dispatcher, | ||
| this.schema, | ||
| undefined, | ||
| undefined, | ||
| ) | ||
| const proxy = HasOneHandle.wrapProxy(raw) | ||
| this.relationHandleCache.set(cacheKey, { raw, proxy } as unknown as CachedHandle<RelationHandleRaw, HasOneAccessor<object> | HasManyRef<object>>) | ||
| return raw | ||
| } | ||
| /** | ||
| * Gets a raw (unproxied) has-many relation handle from cache. | ||
| * Creates the handle if not cached yet. | ||
| */ | ||
| private getHasManyHandleRaw(fieldName: string): HasManyRef<object> { | ||
| const cacheKey = `hasMany:${fieldName}` | ||
| const cached = this.relationHandleCache.get(cacheKey) | ||
| if (cached) { | ||
| return cached.proxy as HasManyRef<object> | ||
| } | ||
| const targetType = this.schema.getRelationTarget(this.entityType, fieldName) | ||
| if (!targetType) { | ||
| throw new Error( | ||
| `Field "${fieldName}" is not a relation on entity "${this.entityType}"`, | ||
| ) | ||
| } | ||
| const handle = HasManyListHandle.create( | ||
| this.entityType, | ||
| this.entityId, | ||
| fieldName, | ||
| targetType, | ||
| this.store, | ||
| this.dispatcher, | ||
| this.schema, | ||
| this.__brands, | ||
| fieldName, | ||
| undefined, | ||
| ) | ||
| this.relationHandleCache.set(cacheKey, { raw: handle, proxy: handle } as unknown as CachedHandle<RelationHandleRaw, HasOneAccessor<object> | HasManyRef<object>>) | ||
| return handle | ||
| } | ||
| /** | ||
| * Resets the entity to server data. | ||
@@ -368,4 +438,4 @@ * Also resets all relation states (hasOne, hasMany). | ||
| // Reset all cached relation handles | ||
| for (const handle of this.relationHandleCache.values()) { | ||
| handle.reset() | ||
| for (const { raw } of this.relationHandleCache.values()) { | ||
| raw.reset() | ||
| } | ||
@@ -388,9 +458,9 @@ } | ||
| for (const handle of this.fieldHandleCache.values()) { | ||
| handle.dispose() | ||
| for (const { raw } of this.fieldHandleCache.values()) { | ||
| raw.dispose() | ||
| } | ||
| this.fieldHandleCache.clear() | ||
| for (const handle of this.relationHandleCache.values()) { | ||
| handle.dispose() | ||
| for (const { raw } of this.relationHandleCache.values()) { | ||
| raw.dispose() | ||
| } | ||
@@ -397,0 +467,0 @@ this.relationHandleCache.clear() |
@@ -26,3 +26,3 @@ import { EntityRelatedHandle } from './BaseHandle.js' | ||
| */ | ||
| export class FieldHandle<T = unknown> extends EntityRelatedHandle implements FieldRef<T> { | ||
| export class FieldHandle<T = unknown> extends EntityRelatedHandle { | ||
| private _cachedInputProps: InputProps<T> | null = null | ||
@@ -53,6 +53,22 @@ private _cachedInputPropsValue: T | null | undefined = undefined | ||
| columnType?: string, | ||
| ): FieldRef<T> { | ||
| return createAliasProxy<FieldHandle<T>, FieldRef<T>>(new FieldHandle<T>(entityType, entityId, fieldPath, store, dispatcher, enumName, columnType)) | ||
| } | ||
| static createRaw<T = unknown>( | ||
| entityType: string, | ||
| entityId: string, | ||
| fieldPath: string[], | ||
| store: SnapshotStore, | ||
| dispatcher: ActionDispatcher, | ||
| enumName?: string, | ||
| columnType?: string, | ||
| ): FieldHandle<T> { | ||
| return createAliasProxy(new FieldHandle<T>(entityType, entityId, fieldPath, store, dispatcher, enumName, columnType)) | ||
| return new FieldHandle<T>(entityType, entityId, fieldPath, store, dispatcher, enumName, columnType) | ||
| } | ||
| static wrapProxy<T>(handle: FieldHandle<T>): FieldRef<T> { | ||
| return createAliasProxy<FieldHandle<T>, FieldRef<T>>(handle) | ||
| } | ||
| /** | ||
@@ -209,3 +225,3 @@ * JSX field reference metadata for collection phase. | ||
| key: K, | ||
| ): FieldHandle<NonNullable<T>[K]> { | ||
| ): FieldRef<NonNullable<T>[K]> { | ||
| return FieldHandle.create<NonNullable<T>[K]>( | ||
@@ -212,0 +228,0 @@ this.entityType, |
@@ -30,4 +30,5 @@ import { EntityRelatedHandle } from './BaseHandle.js' | ||
| */ | ||
| export class HasManyListHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle implements HasManyRef<TEntity, TSelected> { | ||
| private itemHandleCache = new Map<string, EntityHandle<TEntity, TSelected>>() | ||
| export class HasManyListHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle { | ||
| private itemHandleCacheRaw = new Map<string, EntityHandle<TEntity, TSelected>>() | ||
| private itemHandleCacheProxy = new Map<string, EntityAccessor<TEntity, TSelected>>() | ||
@@ -88,4 +89,4 @@ /** Runtime brand symbols for validation */ | ||
| selection?: SelectionMeta, | ||
| ): HasManyListHandle<TEntity, TSelected> { | ||
| return createAliasProxy(new HasManyListHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, itemType, store, dispatcher, schema, brands, alias, selection)) | ||
| ): HasManyRef<TEntity, TSelected> { | ||
| return createAliasProxy<HasManyListHandle<TEntity, TSelected>, HasManyRef<TEntity, TSelected>>(new HasManyListHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, itemType, store, dispatcher, schema, brands, alias, selection)) | ||
| } | ||
@@ -226,6 +227,6 @@ | ||
| getItemHandle(itemId: string): EntityAccessor<TEntity, TSelected> { | ||
| let handle = this.itemHandleCache.get(itemId) | ||
| let proxy = this.itemHandleCacheProxy.get(itemId) | ||
| if (!handle) { | ||
| handle = EntityHandle.create<TEntity, TSelected>( | ||
| if (!proxy) { | ||
| const raw = EntityHandle.createRaw<TEntity, TSelected>( | ||
| itemId, | ||
@@ -239,7 +240,8 @@ this.itemType, | ||
| ) | ||
| this.itemHandleCache.set(itemId, handle) | ||
| proxy = EntityHandle.wrapProxy(raw) | ||
| this.itemHandleCacheRaw.set(itemId, raw) | ||
| this.itemHandleCacheProxy.set(itemId, proxy) | ||
| } | ||
| // EntityHandle constructor returns a Proxy that implements EntityAccessor | ||
| return handle as unknown as EntityAccessor<TEntity, TSelected> | ||
| return proxy | ||
| } | ||
@@ -398,6 +400,7 @@ | ||
| for (const handle of this.itemHandleCache.values()) { | ||
| for (const handle of this.itemHandleCacheRaw.values()) { | ||
| handle.dispose() | ||
| } | ||
| this.itemHandleCache.clear() | ||
| this.itemHandleCacheRaw.clear() | ||
| this.itemHandleCacheProxy.clear() | ||
| } | ||
@@ -404,0 +407,0 @@ |
@@ -15,3 +15,2 @@ import { EntityRelatedHandle } from './BaseHandle.js' | ||
| FIELD_REF_META, | ||
| type HasOneRef, | ||
| type FieldRefMeta, | ||
@@ -21,2 +20,3 @@ type SelectedEntityFields, | ||
| type EntityAccessor, | ||
| type HasOneAccessor, | ||
| } from './types.js' | ||
@@ -39,3 +39,3 @@ import { createClientError, type ErrorInput, type FieldError } from '../errors/types.js' | ||
| import { PlaceholderHandle } from './PlaceholderHandle.js' | ||
| import { createHandleProxy, HAS_ONE_HANDLE_PROPERTIES } from './proxyFactory.js' | ||
| import { createHandleProxy } from './proxyFactory.js' | ||
@@ -50,5 +50,7 @@ | ||
| */ | ||
| export class HasOneHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle implements HasOneRef<TEntity, TSelected> { | ||
| private entityHandleCache: EntityHandle<TEntity, TSelected> | null = null | ||
| private placeholderCache: PlaceholderHandle<TEntity, TSelected> | null = null | ||
| export class HasOneHandle<TEntity extends object = object, TSelected = TEntity> extends EntityRelatedHandle { | ||
| private entityHandleCacheRaw: EntityHandle<TEntity, TSelected> | null = null | ||
| private entityHandleCacheProxy: EntityAccessor<TEntity, TSelected> | null = null | ||
| private placeholderCacheRaw: PlaceholderHandle<TEntity, TSelected> | null = null | ||
| private placeholderCacheProxy: EntityAccessor<TEntity, TSelected> | null = null | ||
@@ -58,24 +60,2 @@ /** Runtime brand symbols for validation */ | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| declare readonly __schema: Record<string, object> | ||
| // $ aliases - handled by proxy at runtime, declared for TypeScript | ||
| declare readonly $id: string | ||
| declare readonly $isDirty: boolean | ||
| declare readonly $state: 'connected' | 'disconnected' | 'deleted' | 'creating' | ||
| declare readonly $fields: SelectedEntityFields<TEntity, TSelected> | ||
| declare readonly $entity: EntityAccessor<TEntity, TSelected> | ||
| declare readonly $errors: readonly FieldError[] | ||
| declare readonly $hasError: boolean | ||
| declare $connect: (id: string) => void | ||
| declare $disconnect: () => void | ||
| declare $delete: () => void | ||
| declare $reset: () => void | ||
| declare $addError: (error: ErrorInput) => void | ||
| declare $clearErrors: () => void | ||
| declare $onConnect: (listener: EventListener<RelationConnectedEvent>) => Unsubscribe | ||
| declare $onDisconnect: (listener: EventListener<RelationDisconnectedEvent>) => Unsubscribe | ||
| declare $interceptConnect: (interceptor: Interceptor<RelationConnectingEvent>) => Unsubscribe | ||
| declare $interceptDisconnect: (interceptor: Interceptor<RelationDisconnectingEvent>) => Unsubscribe | ||
| private constructor( | ||
@@ -106,9 +86,24 @@ parentEntityType: string, | ||
| selection?: SelectionMeta, | ||
| ): HasOneAccessor<TEntity, TSelected> { | ||
| return createHandleProxy<HasOneHandle<TEntity, TSelected>, HasOneAccessor<TEntity, TSelected>>(new HasOneHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, schema, brands, selection), (target) => target.entityRaw.fields) | ||
| } | ||
| static createRaw<TEntity extends object = object, TSelected = TEntity>( | ||
| parentEntityType: string, | ||
| parentEntityId: string, | ||
| fieldName: string, | ||
| targetType: string, | ||
| store: SnapshotStore, | ||
| dispatcher: ActionDispatcher, | ||
| schema: SchemaRegistry, | ||
| brands?: Set<symbol>, | ||
| selection?: SelectionMeta, | ||
| ): HasOneHandle<TEntity, TSelected> { | ||
| return createHandleProxy(new HasOneHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, schema, brands, selection), { | ||
| knownProperties: HAS_ONE_HANDLE_PROPERTIES, | ||
| getFields: (target) => target.entity.$fields, | ||
| }) | ||
| return new HasOneHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, schema, brands, selection) | ||
| } | ||
| static wrapProxy<TEntity extends object, TSelected>(handle: HasOneHandle<TEntity, TSelected>): HasOneAccessor<TEntity, TSelected> { | ||
| return createHandleProxy<HasOneHandle<TEntity, TSelected>, HasOneAccessor<TEntity, TSelected>>(handle, (target) => target.entityRaw.fields) | ||
| } | ||
| /** | ||
@@ -207,17 +202,14 @@ * JSX field reference metadata for collection phase. | ||
| /** | ||
| * Gets the related entity accessor with direct field access. | ||
| * Implements HasOneRef.$entity - returns EntityAccessor for the related entity. | ||
| * Returns PlaceholderHandle (with placeholder ID) if the relation is disconnected. | ||
| * Gets the raw (unproxied) related entity handle. | ||
| * Returns raw EntityHandle or raw PlaceholderHandle. | ||
| * Used internally to avoid going through the proxy layer. | ||
| */ | ||
| get entity(): EntityAccessor<TEntity, TSelected> { | ||
| get entityRaw(): EntityHandle<TEntity, TSelected> | PlaceholderHandle<TEntity, TSelected> { | ||
| const id = this.relatedId | ||
| if (id) { | ||
| // Ensure the related entity has a snapshot in the store | ||
| // (it may be embedded in the parent entity's data) | ||
| this.ensureRelatedEntitySnapshot(id) | ||
| // Connected - return real entity handle | ||
| if (!this.entityHandleCache || this.entityHandleCache.id !== id) { | ||
| this.entityHandleCache = EntityHandle.create<TEntity, TSelected>( | ||
| if (!this.entityHandleCacheRaw || this.entityHandleCacheRaw.id !== id) { | ||
| this.entityHandleCacheRaw = EntityHandle.createRaw<TEntity, TSelected>( | ||
| id, | ||
@@ -231,10 +223,9 @@ this.targetType, | ||
| ) | ||
| this.entityHandleCacheProxy = EntityHandle.wrapProxy(this.entityHandleCacheRaw) | ||
| } | ||
| // EntityHandle constructor returns a Proxy that implements EntityAccessor | ||
| return this.entityHandleCache as unknown as EntityAccessor<TEntity, TSelected> | ||
| return this.entityHandleCacheRaw | ||
| } | ||
| // Disconnected - return placeholder handle | ||
| if (!this.placeholderCache) { | ||
| this.placeholderCache = PlaceholderHandle.create<TEntity, TSelected>( | ||
| if (!this.placeholderCacheRaw) { | ||
| this.placeholderCacheRaw = PlaceholderHandle.createRaw<TEntity, TSelected>( | ||
| this.entityType, | ||
@@ -248,8 +239,37 @@ this.entityId, | ||
| ) | ||
| this.placeholderCacheProxy = PlaceholderHandle.wrapProxy(this.placeholderCacheRaw) | ||
| } | ||
| // PlaceholderHandle implements EntityRef but for API consistency return as EntityAccessor | ||
| return this.placeholderCache as unknown as EntityAccessor<TEntity, TSelected> | ||
| return this.placeholderCacheRaw | ||
| } | ||
| /** | ||
| * Gets the related entity accessor with direct field access. | ||
| * Implements HasOneRef.$entity - returns EntityAccessor for the related entity. | ||
| * Returns PlaceholderHandle (with placeholder ID) if the relation is disconnected. | ||
| */ | ||
| get entity(): EntityAccessor<TEntity, TSelected> { | ||
| const id = this.relatedId | ||
| if (id) { | ||
| // Ensure the related entity has a snapshot in the store | ||
| // (it may be embedded in the parent entity's data) | ||
| this.ensureRelatedEntitySnapshot(id) | ||
| // Connected - return real entity handle (populate raw cache via entityRaw if needed) | ||
| if (!this.entityHandleCacheRaw || this.entityHandleCacheRaw.id !== id) { | ||
| // entityRaw populates both raw and proxy caches | ||
| this.entityRaw | ||
| } | ||
| return this.entityHandleCacheProxy! | ||
| } | ||
| // Disconnected - return placeholder handle | ||
| if (!this.placeholderCacheRaw) { | ||
| // entityRaw populates both raw and proxy caches | ||
| this.entityRaw | ||
| } | ||
| return this.placeholderCacheProxy! | ||
| } | ||
| /** | ||
| * Ensures the related entity has a snapshot in the store. | ||
@@ -301,2 +321,11 @@ * If the related entity is embedded in the parent's data (not yet normalized), | ||
| /** | ||
| * Checks if the related entity is currently being persisted. | ||
| */ | ||
| get isPersisting(): boolean { | ||
| const id = this.relatedId | ||
| if (!id) return false | ||
| return this.store.isPersisting(this.targetType, id) | ||
| } | ||
| /** | ||
| * Checks if the relation is dirty. | ||
@@ -362,4 +391,7 @@ */ | ||
| super.dispose() | ||
| this.entityHandleCache?.dispose() | ||
| this.entityHandleCache = null | ||
| this.entityHandleCacheRaw?.dispose() | ||
| this.entityHandleCacheRaw = null | ||
| this.entityHandleCacheProxy = null | ||
| this.placeholderCacheRaw = null | ||
| this.placeholderCacheProxy = null | ||
| } | ||
@@ -468,12 +500,12 @@ | ||
| // ==================== EntityRef-compatible Properties ==================== | ||
| // These make HasOneAccessor structurally compatible with EntityAccessor | ||
| // These delegate to entityRaw so that proxy resolution ($data→data, $isNew→isNew, etc.) works correctly. | ||
| /** Raw data snapshot of the related entity - delegates to $entity */ | ||
| get $data(): TSelected | null { return this.entity.$data } | ||
| /** Raw data snapshot of the related entity - delegates to entityRaw */ | ||
| get data(): TSelected | null { return this.entityRaw.data } | ||
| /** Whether this entity is new - delegates to $entity */ | ||
| get $isNew(): boolean { return this.entity.$isNew } | ||
| /** Whether this entity is new - delegates to entityRaw */ | ||
| get isNew(): boolean { return this.entityRaw.isNew } | ||
| /** Server-assigned ID after persistence - delegates to $entity */ | ||
| get $persistedId(): string | null { return this.entity.$persistedId } | ||
| /** Server-assigned ID after persistence - delegates to entityRaw */ | ||
| get persistedId(): string | null { return this.entityRaw.persistedId } | ||
@@ -483,31 +515,31 @@ /** Type brand for entity name */ | ||
| /** Clear all errors - delegates to $entity */ | ||
| $clearAllErrors(): void { this.entity.$clearAllErrors() } | ||
| /** Clear all errors - delegates to entityRaw */ | ||
| clearAllErrors(): void { this.entityRaw.clearAllErrors() } | ||
| /** Subscribe to any event on the related entity */ | ||
| $on<E extends AfterEventTypes>( | ||
| on<E extends AfterEventTypes>( | ||
| eventType: E, | ||
| listener: EventListener<EventTypeMap[E]>, | ||
| ): Unsubscribe { | ||
| return this.entity.$on(eventType, listener) | ||
| return this.entityRaw.on(eventType, listener) | ||
| } | ||
| /** Intercept any before event on the related entity */ | ||
| $intercept<E extends BeforeEventTypes>( | ||
| intercept<E extends BeforeEventTypes>( | ||
| eventType: E, | ||
| interceptor: Interceptor<EventTypeMap[E]>, | ||
| ): Unsubscribe { | ||
| return this.entity.$intercept(eventType, interceptor) | ||
| return this.entityRaw.intercept(eventType, interceptor) | ||
| } | ||
| /** Subscribe to persist success events on the related entity */ | ||
| $onPersisted(listener: EventListener<EntityPersistedEvent>): Unsubscribe { | ||
| return this.entity.$onPersisted(listener) | ||
| onPersisted(listener: EventListener<EntityPersistedEvent>): Unsubscribe { | ||
| return this.entityRaw.onPersisted(listener) | ||
| } | ||
| /** Intercept persist on the related entity */ | ||
| $interceptPersisting(interceptor: Interceptor<EntityPersistingEvent>): Unsubscribe { | ||
| return this.entity.$interceptPersisting(interceptor) | ||
| interceptPersisting(interceptor: Interceptor<EntityPersistingEvent>): Unsubscribe { | ||
| return this.entityRaw.interceptPersisting(interceptor) | ||
| } | ||
| } |
@@ -6,6 +6,6 @@ import type { ActionDispatcher } from '../core/ActionDispatcher.js' | ||
| FIELD_REF_META, | ||
| type EntityRef, | ||
| type SelectedEntityFields, | ||
| type FieldRefMeta, | ||
| type Unsubscribe, | ||
| type EntityAccessor, | ||
| } from './types.js' | ||
@@ -32,30 +32,9 @@ import type { ErrorInput, FieldError } from '../errors/types.js' | ||
| */ | ||
| export class PlaceholderHandle<TEntity extends object = object, TSelected = TEntity> | ||
| implements EntityRef<TEntity, TSelected> | ||
| { | ||
| export class PlaceholderHandle<TEntity extends object = object, TSelected = TEntity> { | ||
| /** Runtime brand symbols for validation */ | ||
| readonly __brands?: Set<symbol> | ||
| /** Type brand for schema - placeholder at runtime */ | ||
| declare readonly __schema: Record<string, object> | ||
| /** Placeholder ID for this handle */ | ||
| private readonly placeholderId: string | ||
| // $ aliases - handled by proxy at runtime, declared for TypeScript | ||
| declare readonly $fields: SelectedEntityFields<TEntity, TSelected> | ||
| declare readonly $data: TSelected | null | ||
| declare readonly $isDirty: boolean | ||
| declare readonly $persistedId: null | ||
| declare readonly $isNew: boolean | ||
| declare readonly $errors: readonly FieldError[] | ||
| declare readonly $hasError: boolean | ||
| declare $addError: (error: ErrorInput) => void | ||
| declare $clearErrors: () => void | ||
| declare $clearAllErrors: () => void | ||
| declare $on: <E extends AfterEventTypes>(eventType: E, listener: EventListener<EventTypeMap[E]>) => Unsubscribe | ||
| declare $intercept: <E extends BeforeEventTypes>(eventType: E, interceptor: Interceptor<EventTypeMap[E]>) => Unsubscribe | ||
| declare $onPersisted: (listener: EventListener<EntityPersistedEvent>) => Unsubscribe | ||
| declare $interceptPersisting: (interceptor: Interceptor<EntityPersistingEvent>) => Unsubscribe | ||
| private constructor( | ||
@@ -82,6 +61,22 @@ private readonly parentEntityType: string, | ||
| brands?: Set<symbol>, | ||
| ): EntityAccessor<TEntity, TSelected> { | ||
| return PlaceholderHandle.wrapProxy(new PlaceholderHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, brands)) | ||
| } | ||
| static createRaw<TEntity extends object = object, TSelected = TEntity>( | ||
| parentEntityType: string, | ||
| parentEntityId: string, | ||
| fieldName: string, | ||
| targetType: string, | ||
| store: SnapshotStore, | ||
| dispatcher: ActionDispatcher, | ||
| brands?: Set<symbol>, | ||
| ): PlaceholderHandle<TEntity, TSelected> { | ||
| return createAliasProxy(new PlaceholderHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, brands)) | ||
| return new PlaceholderHandle<TEntity, TSelected>(parentEntityType, parentEntityId, fieldName, targetType, store, dispatcher, brands) | ||
| } | ||
| static wrapProxy<TEntity extends object, TSelected>(handle: PlaceholderHandle<TEntity, TSelected>): EntityAccessor<TEntity, TSelected> { | ||
| return createAliasProxy<PlaceholderHandle<TEntity, TSelected>, EntityAccessor<TEntity, TSelected>>(handle) | ||
| } | ||
| /** | ||
@@ -122,2 +117,9 @@ * Gets the placeholder ID. | ||
| /** | ||
| * Placeholder entities are never being persisted. | ||
| */ | ||
| get isPersisting(): boolean { | ||
| return false | ||
| } | ||
| /** | ||
| * Placeholder entities are always new (not yet persisted). | ||
@@ -124,0 +126,0 @@ */ |
+29
-128
@@ -11,2 +11,3 @@ /** | ||
| * - `entity.$isDirty` → handle property | ||
| * - `entity.id` → entity ID (special case, always passes through) | ||
| */ | ||
@@ -17,123 +18,30 @@ | ||
| /** | ||
| * Shared base properties for entity-like handles (EntityHandle, HasOneHandle). | ||
| * Extracting a common set prevents bugs from inconsistent maintenance (e.g. missing `id`). | ||
| * Properties that always pass through to the handle, never treated as field access. | ||
| * Kept minimal to avoid collisions with entity field names. | ||
| */ | ||
| const BASE_ENTITY_PROPERTIES: (string | symbol)[] = [ | ||
| // Entity identity — id is always the entity ID, not a field handle | ||
| const HANDLE_PASSTHROUGH_PROPERTIES = new Set<string | symbol>([ | ||
| // Entity identity — `entity.id` must return the entity ID string, not a FieldHandle | ||
| 'id', | ||
| // Type brands (phantom types) | ||
| '__entityType', '__entityName', '__brands', '__schema', | ||
| // Symbol | ||
| // Symbol for field reference metadata | ||
| FIELD_REF_META, | ||
| // Core internals shared by all entity-like handles | ||
| 'entityType', 'entityId', 'store', 'dispatcher', 'schema', | ||
| 'getEntityData', 'getServerData', 'assertNotDisposed', 'isDisposed', | ||
| 'dispose', 'subscribe', | ||
| ] | ||
| /** | ||
| * Known properties on EntityHandle that should NOT be treated as field access. | ||
| * Properties like `fields`, `data`, `errors` are NOT included - use $ prefix for those. | ||
| */ | ||
| export const ENTITY_HANDLE_PROPERTIES = new Set<string | symbol>([ | ||
| ...BASE_ENTITY_PROPERTIES, | ||
| // Entity-specific internals | ||
| 'type', 'fieldHandleCache', 'relationHandleCache', | ||
| // Internal methods (unlikely to be field names) | ||
| 'field', 'hasOne', 'hasMany', 'getSnapshot', | ||
| 'reset', 'commit', | ||
| 'getDirtyFields', 'getDirtyRelations', | ||
| // State properties (unlikely to be field names) | ||
| 'serverData', 'isLoaded', 'isLoading', 'isError', 'error', 'isPersisting', | ||
| ]) | ||
| /** | ||
| * Known properties on HasOneHandle that should NOT be treated as field access. | ||
| * Properties like `fields`, `entity`, `errors`, `state` are NOT included - they require $ prefix. | ||
| */ | ||
| export const HAS_ONE_HANDLE_PROPERTIES = new Set<string | symbol>([ | ||
| ...BASE_ENTITY_PROPERTIES, | ||
| // HasOne-specific internals | ||
| 'fieldName', 'targetType', | ||
| 'entityHandleCache', 'placeholderCache', 'ensureRelatedEntitySnapshot', 'relatedId', | ||
| // Methods that are unlikely to be field names | ||
| 'connect', 'disconnect', 'delete', 'reset', | ||
| ]) | ||
| /** | ||
| * All properties on FieldHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export const FIELD_HANDLE_PROPERTIES = new Set<string | symbol>([ | ||
| FIELD_REF_META, | ||
| // Core properties | ||
| 'value', 'serverValue', 'isDirty', 'inputProps', 'errors', 'hasError', | ||
| 'path', 'fieldName', | ||
| // Methods | ||
| 'setValue', 'addError', 'clearErrors', 'onChange', 'onChanging', 'nested', | ||
| // Internal | ||
| 'entityType', 'entityId', 'fieldPath', 'store', 'dispatcher', | ||
| 'getEntityData', 'getServerData', 'assertNotDisposed', 'isDisposed', | ||
| 'subscribe', 'dispose', | ||
| ]) | ||
| /** | ||
| * All properties on HasManyListHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export const HAS_MANY_HANDLE_PROPERTIES = new Set<string | symbol>([ | ||
| FIELD_REF_META, | ||
| // Type brands | ||
| '__entityType', '__brands', | ||
| // Core properties | ||
| 'items', 'length', 'isDirty', 'errors', 'hasError', | ||
| // Methods | ||
| 'map', 'add', 'remove', 'move', 'connect', 'disconnect', 'reset', | ||
| 'getItemHandle', 'addError', 'clearErrors', | ||
| 'onItemConnected', 'onItemDisconnected', 'interceptItemConnecting', 'interceptItemDisconnecting', | ||
| // Internal | ||
| 'entityType', 'entityId', 'fieldName', 'itemType', 'store', 'dispatcher', 'schema', | ||
| 'itemHandleCache', 'getEntityData', 'getServerData', 'assertNotDisposed', 'isDisposed', | ||
| 'subscribe', 'dispose', 'ensureItemSnapshots', | ||
| ]) | ||
| /** | ||
| * All properties on PlaceholderHandle (no field access proxy needed, just $ aliasing). | ||
| */ | ||
| export const PLACEHOLDER_HANDLE_PROPERTIES = new Set<string | symbol>([ | ||
| // Core properties | ||
| 'id', 'data', 'isDirty', 'persistedId', 'isNew', 'fields', 'errors', 'hasError', | ||
| // Type brands | ||
| '__entityType', '__entityName', '__brands', | ||
| // Methods | ||
| 'addError', 'clearErrors', 'clearAllErrors', | ||
| 'on', 'intercept', 'onPersisted', 'interceptPersisting', | ||
| // Internal | ||
| 'parentEntityType', 'parentEntityId', 'fieldName', 'targetType', 'store', 'dispatcher', | ||
| 'placeholderId', 'createPlaceholderFieldHandle', | ||
| ]) | ||
| /** | ||
| * Configuration for creating a handle proxy. | ||
| */ | ||
| export interface HandleProxyConfig<T extends object> { | ||
| /** Set of property names that should pass through to the handle */ | ||
| knownProperties: Set<string | symbol> | ||
| /** Function to get the fields proxy from the handle */ | ||
| getFields: (target: T) => object | ||
| } | ||
| /** | ||
| * Creates a proxy around a handle that supports direct field access. | ||
| * | ||
| * - `handle.fieldName` is equivalent to `handle.$fields.fieldName` | ||
| * - `handle.$propertyName` accesses handle properties with $ prefix stripped | ||
| * - Known properties pass through directly to the handle | ||
| * Resolution order: | ||
| * 1. Symbols → pass through to handle | ||
| * 2. `id` / FIELD_REF_META → pass through to handle | ||
| * 3. `$xxx` → strip `$`, access handle property | ||
| * 4. Everything else → field access (returns FieldHandle/HasOneHandle/HasManyListHandle) | ||
| * | ||
| * @param handle - The handle instance to wrap | ||
| * @param config - Configuration for the proxy | ||
| * @param getFields - Function to get the fields object from the handle | ||
| * @returns Proxied handle with direct field access support | ||
| */ | ||
| export function createHandleProxy<T extends object>( | ||
| export function createHandleProxy<T extends object, TResult = T>( | ||
| handle: T, | ||
| config: HandleProxyConfig<T>, | ||
| ): T { | ||
| getFields: (target: T) => object, | ||
| ): TResult { | ||
| // The proxy adds $ alias support and field access, making the handle satisfy the public type TResult at runtime | ||
| return new Proxy(handle, { | ||
@@ -146,8 +54,11 @@ get(target, prop, _receiver) { | ||
| // Special properties that always pass through | ||
| if (HANDLE_PASSTHROUGH_PROPERTIES.has(prop)) { | ||
| return Reflect.get(target, prop, target) | ||
| } | ||
| // $ prefixed - strip $ and access handle property | ||
| if (prop.startsWith('$')) { | ||
| const realProp = prop.slice(1) | ||
| // Use target as receiver so getters use target as `this`, not the Proxy | ||
| const value = Reflect.get(target, realProp, target) | ||
| // Bind methods to preserve `this` | ||
| if (typeof value === 'function') { | ||
@@ -159,13 +70,4 @@ return value.bind(target) | ||
| // Known handle properties - pass through for backwards compatibility | ||
| if (config.knownProperties.has(prop)) { | ||
| const value = Reflect.get(target, prop, target) | ||
| if (typeof value === 'function') { | ||
| return value.bind(target) | ||
| } | ||
| return value | ||
| } | ||
| // Otherwise, treat as field access | ||
| const fields = config.getFields(target) | ||
| // Everything else → field access | ||
| const fields = getFields(target) | ||
| return (fields as Record<string, unknown>)[prop] | ||
@@ -175,5 +77,4 @@ }, | ||
| has(target, prop) { | ||
| if (typeof prop === 'string' && !config.knownProperties.has(prop) && !prop.startsWith('$')) { | ||
| // Check if it's a field | ||
| const fields = config.getFields(target) | ||
| if (typeof prop === 'string' && !HANDLE_PASSTHROUGH_PROPERTIES.has(prop) && !prop.startsWith('$')) { | ||
| const fields = getFields(target) | ||
| return prop in fields | ||
@@ -183,3 +84,3 @@ } | ||
| }, | ||
| }) | ||
| }) as unknown as TResult | ||
| } | ||
@@ -197,3 +98,4 @@ | ||
| */ | ||
| export function createAliasProxy<T extends object>(handle: T): T { | ||
| export function createAliasProxy<T extends object, TResult = T>(handle: T): TResult { | ||
| // The proxy adds $ alias support, making the handle satisfy the public type TResult at runtime | ||
| return new Proxy(handle, { | ||
@@ -210,3 +112,2 @@ get(target, prop, _receiver) { | ||
| const value = Reflect.get(target, realProp, target) | ||
| // Bind methods to preserve `this` | ||
| if (typeof value === 'function') { | ||
@@ -225,3 +126,3 @@ return value.bind(target) | ||
| }, | ||
| }) | ||
| }) as unknown as TResult | ||
| } |
@@ -399,2 +399,5 @@ /** | ||
| /** Whether entity is currently being persisted */ | ||
| readonly $isPersisting: boolean | ||
| /** Server-assigned ID after persistence */ | ||
@@ -543,2 +546,5 @@ readonly $persistedId: string | null | ||
| /** Whether entity is currently being persisted */ | ||
| readonly $isPersisting: boolean | ||
| /** Server-assigned ID after persistence */ | ||
@@ -545,0 +551,0 @@ readonly $persistedId: string | null |
+22
-3
@@ -227,3 +227,3 @@ /** | ||
| // Contember integration | ||
| export { MutationCollector, ContemberSchemaMutationAdapter } from './contember/index.js' | ||
| export { MutationCollector, ContemberSchemaMutationAdapter, type SchemaNames } from './contember/index.js' | ||
| export type { MutationSchemaProvider, EntityMutationResult } from './contember/index.js' | ||
@@ -332,4 +332,23 @@ | ||
| // Re-export Contember types for convenience | ||
| export type { SchemaNames, SchemaEntityNames } from '@contember/client-content' | ||
| // Re-export bindx-client types | ||
| export { | ||
| ContentClient, | ||
| type ContentClientOptions, | ||
| type ContentQuery, | ||
| type ContentMutation, | ||
| ContentOperation, | ||
| type MutationResult as ClientMutationResult, | ||
| MutationFailedError, | ||
| type QuerySpecContext, | ||
| querySpecToGraphQl, | ||
| buildGetArgs, | ||
| buildListArgs, | ||
| buildCreateArgs, | ||
| buildUpdateArgs, | ||
| buildDeleteArgs, | ||
| buildMutationSelection, | ||
| mutationFragments, | ||
| unwrapPaginateResult, | ||
| } from '@contember/bindx-client' | ||
| export { qb } from '@contember/bindx-client' | ||
@@ -336,0 +355,0 @@ // DataView / DataGrid |
@@ -1,2 +0,20 @@ | ||
| import type { SchemaNames } from '@contember/client-content' | ||
| /** | ||
| * Runtime schema names format (from Contember API / generated code). | ||
| */ | ||
| export interface SchemaNames { | ||
| readonly entities: { | ||
| readonly [entityName: string]: { | ||
| readonly name: string | ||
| readonly scalars: readonly string[] | ||
| readonly fields: { | ||
| readonly [fieldName: string]: | ||
| | { readonly type: 'column'; readonly enumName?: string; readonly columnType?: string } | ||
| | { readonly type: 'many' | 'one'; readonly entity: string } | ||
| } | ||
| } | ||
| } | ||
| readonly enums?: { | ||
| readonly [enumName: string]: readonly string[] | ||
| } | ||
| } | ||
| import type { MutationSchemaProvider } from './MutationSchemaProvider.js' | ||
@@ -3,0 +21,0 @@ |
@@ -1,132 +0,14 @@ | ||
| /** | ||
| * Types matching the Contember API schema introspection format. | ||
| * These types are compatible with binding-common's Schema. | ||
| */ | ||
| export type SchemaColumnType = 'Bool' | 'Date' | 'DateTime' | 'Double' | 'Enum' | 'Integer' | 'String' | 'Uuid' | 'Json' | string | ||
| export interface SchemaColumn { | ||
| __typename: '_Column' | ||
| name: string | ||
| nullable: boolean | ||
| type: SchemaColumnType | ||
| enumName: string | null | ||
| defaultValue: string | number | boolean | null | ||
| } | ||
| export interface SchemaRelationOrderBy { | ||
| path: string[] | ||
| direction: 'asc' | 'desc' | ||
| } | ||
| interface BaseRelation { | ||
| __typename: '_Relation' | ||
| name: string | ||
| nullable: boolean | null | ||
| onDelete: 'restrict' | 'cascade' | 'setNull' | null | ||
| orderBy: SchemaRelationOrderBy[] | null | ||
| orphanRemoval: boolean | null | ||
| targetEntity: string | ||
| type: 'OneHasOne' | 'OneHasMany' | 'ManyHasOne' | 'ManyHasMany' | ||
| } | ||
| export interface OwningRelation extends BaseRelation { | ||
| side: 'owning' | ||
| inversedBy: string | null | ||
| ownedBy?: never | ||
| } | ||
| export interface InverseRelation extends BaseRelation { | ||
| side: 'inverse' | ||
| ownedBy: string | ||
| inversedBy?: never | ||
| } | ||
| export type SchemaRelation = OwningRelation | InverseRelation | ||
| export type SchemaField = SchemaColumn | SchemaRelation | ||
| export interface SchemaEntity { | ||
| name: string | ||
| customPrimaryAllowed: boolean | ||
| fields: Map<string, SchemaField> | ||
| unique: { fields: Set<string> }[] | ||
| } | ||
| export interface SchemaEnum { | ||
| name: string | ||
| values: string[] | ||
| } | ||
| /** | ||
| * Processed schema store with Maps for efficient lookup. | ||
| * This is the format used internally after loading from API. | ||
| */ | ||
| export interface ContemberSchemaStore { | ||
| entities: Map<string, SchemaEntity> | ||
| enums: Map<string, Set<string>> | ||
| } | ||
| /** | ||
| * Raw schema format as returned by the Contember API. | ||
| */ | ||
| export interface RawContemberSchema { | ||
| enums: { name: string; values: string[] }[] | ||
| entities: { | ||
| name: string | ||
| customPrimaryAllowed: boolean | ||
| fields: (SchemaColumn | (Omit<SchemaRelation, 'side'> & { side: 'owning' | 'inverse'; ownedBy?: string; inversedBy?: string | null }))[] | ||
| unique: { fields: string[] }[] | ||
| }[] | ||
| } | ||
| /** | ||
| * Schema class compatible with binding-common's Schema. | ||
| * Can be used directly or created from API response. | ||
| */ | ||
| export class ContemberSchema { | ||
| constructor(private readonly store: ContemberSchemaStore) {} | ||
| getEntity(entityName: string): SchemaEntity | undefined { | ||
| return this.store.entities.get(entityName) | ||
| } | ||
| getEntityNames(): string[] { | ||
| return Array.from(this.store.entities.keys()) | ||
| } | ||
| getEntityField(entityName: string, fieldName: string): SchemaField | undefined { | ||
| return this.store.entities.get(entityName)?.fields.get(fieldName) | ||
| } | ||
| getEnumValues(enumName: string): string[] | undefined { | ||
| const values = this.store.enums.get(enumName) | ||
| return values ? Array.from(values) : undefined | ||
| } | ||
| /** | ||
| * Creates a ContemberSchema from raw API response. | ||
| */ | ||
| static fromRaw(raw: RawContemberSchema): ContemberSchema { | ||
| const enums = new Map<string, Set<string>>() | ||
| for (const { name, values } of raw.enums) { | ||
| enums.set(name, new Set(values)) | ||
| } | ||
| const entities = new Map<string, SchemaEntity>() | ||
| for (const entity of raw.entities) { | ||
| const fields = new Map<string, SchemaField>() | ||
| for (const field of entity.fields) { | ||
| fields.set(field.name, field as SchemaField) | ||
| } | ||
| entities.set(entity.name, { | ||
| name: entity.name, | ||
| customPrimaryAllowed: entity.customPrimaryAllowed, | ||
| fields, | ||
| unique: entity.unique.map(u => ({ fields: new Set(u.fields) })), | ||
| }) | ||
| } | ||
| return new ContemberSchema({ entities, enums }) | ||
| } | ||
| } | ||
| export { | ||
| ContemberSchema, | ||
| type SchemaColumnType, | ||
| type SchemaColumn, | ||
| type SchemaRelationOrderBy, | ||
| type OwningRelation, | ||
| type InverseRelation, | ||
| type SchemaRelation, | ||
| type SchemaField, | ||
| type SchemaEntity, | ||
| type SchemaEnum, | ||
| type ContemberSchemaStore, | ||
| type RawContemberSchema, | ||
| } from '@contember/bindx-client' |
+10
-83
@@ -1,83 +0,10 @@ | ||
| /** | ||
| * Role-aware type utilities for bindx. | ||
| * | ||
| * The role system allows per-role field access control at the type level. | ||
| * Default (no role) = narrowest scope (fields ALL roles can access). | ||
| * Specifying roles = expanding scope (union of capabilities for those roles). | ||
| */ | ||
| // ============================================================================ | ||
| // Core Utility Types | ||
| // ============================================================================ | ||
| /** | ||
| * Converts a union type to an intersection type. | ||
| * Used to merge field sets from multiple roles. | ||
| * | ||
| * @example | ||
| * UnionToIntersection<{ a: 1 } | { b: 2 }> = { a: 1 } & { b: 2 } | ||
| */ | ||
| export type UnionToIntersection<U> = | ||
| (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never | ||
| // ============================================================================ | ||
| // Role Map Types | ||
| // ============================================================================ | ||
| /** | ||
| * Extracts all role names from a role map. | ||
| */ | ||
| export type RoleNames<TRoleMap extends Record<string, object>> = keyof TRoleMap & string | ||
| /** | ||
| * Default entity type — the narrowest scope. | ||
| * Returns a union of all role entity types, so only common fields are accessible via keyof. | ||
| * | ||
| * @example | ||
| * CommonEntity<{ admin: { id: string; secret: string }; public: { id: string } }> | ||
| * // = { id: string; secret: string } | { id: string } | ||
| * // Only `id` is accessible (common to all roles) | ||
| */ | ||
| export type CommonEntity<TRoleMap extends Record<string, object>> = TRoleMap[keyof TRoleMap] | ||
| /** | ||
| * Entity type for specific roles — expanded scope. | ||
| * Returns an intersection of the specified roles' entity types, | ||
| * giving access to all fields from any of those roles. | ||
| * | ||
| * @example | ||
| * EntityForRoles<{ admin: { id: string; secret: string }; editor: { id: string; notes: string } }, 'admin'> | ||
| * // = { id: string; secret: string } | ||
| * | ||
| * EntityForRoles<{ admin: { id: string; secret: string }; editor: { id: string; notes: string } }, 'admin' | 'editor'> | ||
| * // = { id: string; secret: string } & { id: string; notes: string } | ||
| * // = { id: string; secret: string; notes: string } | ||
| */ | ||
| export type EntityForRoles< | ||
| TRoleMap extends Record<string, object>, | ||
| TRoles extends keyof TRoleMap, | ||
| > = UnionToIntersection<TRoleMap[TRoles]> & object | ||
| /** | ||
| * Resolves the entity type based on whether roles are specified. | ||
| * - No roles (TRoles = never): returns CommonEntity (narrowest) | ||
| * - With roles: returns EntityForRoles (expanded) | ||
| */ | ||
| export type ResolveEntity< | ||
| TRoleMap extends Record<string, object>, | ||
| TRoles extends string, | ||
| > = [TRoles] extends [never] | ||
| ? CommonEntity<TRoleMap> | ||
| : EntityForRoles<TRoleMap, TRoles & keyof TRoleMap> | ||
| /** | ||
| * Sentinel role name used when no ACL roles are defined. | ||
| * entityDef<Article>('Article') wraps as { _default: Article }. | ||
| */ | ||
| export const DEFAULT_ROLE = '_default' as const | ||
| export type DefaultRole = typeof DEFAULT_ROLE | ||
| /** | ||
| * Wraps a single entity type as a single-role map with the _default role. | ||
| */ | ||
| export type SingleRoleMap<TEntity extends object> = { readonly [K in DefaultRole]: TEntity } | ||
| export { | ||
| type UnionToIntersection, | ||
| type RoleNames, | ||
| type CommonEntity, | ||
| type EntityForRoles, | ||
| type ResolveEntity, | ||
| type SingleRoleMap, | ||
| type DefaultRole, | ||
| DEFAULT_ROLE, | ||
| } from '@contember/bindx-client' |
@@ -1,93 +0,1 @@ | ||
| /** | ||
| * Loads schema from Contember Content API via GraphQL introspection. | ||
| */ | ||
| import { ContemberSchema, type RawContemberSchema } from './ContemberSchema.js' | ||
| export interface SchemaLoaderClient { | ||
| execute<T>(query: string, options?: unknown): Promise<T> | ||
| apiUrl?: string | ||
| } | ||
| const SCHEMA_QUERY = `query { | ||
| schema { | ||
| enums { | ||
| name | ||
| values | ||
| } | ||
| entities { | ||
| name | ||
| customPrimaryAllowed | ||
| unique { | ||
| fields | ||
| } | ||
| fields { | ||
| __typename | ||
| name | ||
| type | ||
| nullable | ||
| ... on _Column { | ||
| enumName | ||
| defaultValue | ||
| } | ||
| ... on _Relation { | ||
| side | ||
| targetEntity | ||
| ownedBy | ||
| inversedBy | ||
| onDelete | ||
| orphanRemoval | ||
| orderBy { | ||
| path | ||
| direction | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }` | ||
| /** | ||
| * Loads and caches schema from Contember Content API. | ||
| * Instance-level cache avoids cross-tenant collisions and test pollution. | ||
| */ | ||
| export class SchemaLoader { | ||
| private readonly cache = new Map<string, Promise<ContemberSchema>>() | ||
| /** | ||
| * Loads schema from the API, with caching per API URL. | ||
| */ | ||
| async loadSchema( | ||
| client: SchemaLoaderClient, | ||
| options?: unknown, | ||
| ): Promise<ContemberSchema> { | ||
| const cacheKey = client.apiUrl ?? 'default' | ||
| const existing = this.cache.get(cacheKey) | ||
| if (existing) { | ||
| return existing | ||
| } | ||
| const promise = (async () => { | ||
| const response = await client.execute<{ schema: RawContemberSchema }>(SCHEMA_QUERY, options) | ||
| return ContemberSchema.fromRaw(response.schema) | ||
| })() | ||
| this.cache.set(cacheKey, promise) | ||
| return promise | ||
| } | ||
| /** | ||
| * Clears the schema cache. | ||
| */ | ||
| clearCache(): void { | ||
| this.cache.clear() | ||
| } | ||
| /** | ||
| * Clears cache for a specific API URL. | ||
| */ | ||
| clearCacheFor(apiUrl: string): void { | ||
| this.cache.delete(apiUrl) | ||
| } | ||
| } | ||
| export { SchemaLoader, type SchemaLoaderClient } from '@contember/bindx-client' |
@@ -1,286 +0,1 @@ | ||
| import type { ContemberSchema } from './ContemberSchema.js' | ||
| import type { | ||
| EntitySchemaDef, | ||
| FieldDef, | ||
| HasManyRelationDef, | ||
| HasOneRelationDef, | ||
| RelationType, | ||
| SchemaDefinition, | ||
| } from './types.js' | ||
| /** | ||
| * Runtime registry for entity schemas. | ||
| * Provides lookups for entity definitions, relation targets, and field types. | ||
| */ | ||
| export class SchemaRegistry<TModels extends Record<string, object> = Record<string, object>> { | ||
| private readonly entityDefs: Map<string, EntitySchemaDef> | ||
| constructor(definition: SchemaDefinition<TModels>) { | ||
| this.entityDefs = new Map() | ||
| for (const [entityName, entityDef] of Object.entries(definition.entities)) { | ||
| this.entityDefs.set(entityName, normalizeEntityDef(entityDef as EntitySchemaDef)) | ||
| } | ||
| } | ||
| /** | ||
| * Creates a SchemaRegistry from a ContemberSchema (loaded from API or injected). | ||
| * This is the preferred way to create a SchemaRegistry at runtime. | ||
| */ | ||
| static fromContemberSchema(schema: ContemberSchema): SchemaRegistry { | ||
| const entities: Record<string, EntitySchemaDef> = {} | ||
| for (const entityName of schema.getEntityNames()) { | ||
| const entity = schema.getEntity(entityName) | ||
| if (!entity) continue | ||
| const fields: Record<string, FieldDef> = {} | ||
| for (const [fieldName, field] of entity.fields) { | ||
| if (field.__typename === '_Column') { | ||
| fields[fieldName] = { type: 'scalar' } | ||
| } else if (field.__typename === '_Relation') { | ||
| const isMany = field.type === 'OneHasMany' || field.type === 'ManyHasMany' | ||
| if (isMany) { | ||
| fields[fieldName] = { | ||
| type: 'hasMany', | ||
| target: field.targetEntity, | ||
| inverse: field.side === 'owning' ? field.inversedBy ?? undefined : field.ownedBy, | ||
| } | ||
| } else { | ||
| fields[fieldName] = { | ||
| type: 'hasOne', | ||
| target: field.targetEntity, | ||
| inverse: field.side === 'owning' ? field.inversedBy ?? undefined : field.ownedBy, | ||
| } | ||
| } | ||
| } | ||
| } | ||
| entities[entityName] = { fields } | ||
| } | ||
| return new SchemaRegistry({ entities } as SchemaDefinition<Record<string, object>>) | ||
| } | ||
| /** | ||
| * Gets the entity names defined in the schema | ||
| */ | ||
| getEntityNames(): string[] { | ||
| return Array.from(this.entityDefs.keys()) | ||
| } | ||
| /** | ||
| * Checks if an entity type exists in the schema | ||
| */ | ||
| hasEntity(entityType: string): boolean { | ||
| return this.entityDefs.has(entityType) | ||
| } | ||
| /** | ||
| * Gets the schema definition for an entity type | ||
| */ | ||
| getEntityDef(entityType: string): EntitySchemaDef | undefined { | ||
| return this.entityDefs.get(entityType) | ||
| } | ||
| /** | ||
| * Gets the field definition for a specific field on an entity | ||
| */ | ||
| getFieldDef(entityType: string, fieldName: string): FieldDef | undefined { | ||
| const entityDef = this.entityDefs.get(entityType) | ||
| if (!entityDef) return undefined | ||
| return entityDef.fields[fieldName] | ||
| } | ||
| /** | ||
| * Gets the enum values for an enum field. | ||
| * Returns undefined if the field is not an enum or doesn't exist. | ||
| */ | ||
| getEnumValues(entityType: string, fieldName: string): readonly string[] | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef || fieldDef.type !== 'enum') return undefined | ||
| return fieldDef.values | ||
| } | ||
| /** | ||
| * Gets the enum name for an enum field. | ||
| * Returns undefined if the field is not an enum or doesn't exist. | ||
| */ | ||
| getEnumName(entityType: string, fieldName: string): string | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef || fieldDef.type !== 'enum') return undefined | ||
| return fieldDef.enumName | ||
| } | ||
| /** | ||
| * Gets the column type for a scalar field (e.g. 'String', 'Integer', 'Date'). | ||
| * Returns undefined if the field is not a scalar or doesn't exist. | ||
| */ | ||
| getColumnType(entityType: string, fieldName: string): string | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef || fieldDef.type !== 'scalar') return undefined | ||
| return fieldDef.columnType | ||
| } | ||
| /** | ||
| * Gets the target entity type for a relation field. | ||
| * Returns undefined if the field is not a relation or doesn't exist. | ||
| */ | ||
| getRelationTarget(entityType: string, fieldName: string): string | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef) return undefined | ||
| if (fieldDef.type === 'hasOne' || fieldDef.type === 'hasMany') { | ||
| return fieldDef.target | ||
| } | ||
| return undefined | ||
| } | ||
| /** | ||
| * Gets the relation type for a field (hasOne or hasMany). | ||
| * Returns undefined if the field is not a relation. | ||
| */ | ||
| getRelationType(entityType: string, fieldName: string): RelationType | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef) return undefined | ||
| if (fieldDef.type === 'hasOne' || fieldDef.type === 'hasMany') { | ||
| return fieldDef.type | ||
| } | ||
| return undefined | ||
| } | ||
| /** | ||
| * Checks if a field is a relation (hasOne or hasMany) | ||
| */ | ||
| isRelation(entityType: string, fieldName: string): boolean { | ||
| return this.getRelationType(entityType, fieldName) !== undefined | ||
| } | ||
| /** | ||
| * Checks if a field is a has-one relation | ||
| */ | ||
| isHasOne(entityType: string, fieldName: string): boolean { | ||
| return this.getRelationType(entityType, fieldName) === 'hasOne' | ||
| } | ||
| /** | ||
| * Checks if a field is a has-many relation | ||
| */ | ||
| isHasMany(entityType: string, fieldName: string): boolean { | ||
| return this.getRelationType(entityType, fieldName) === 'hasMany' | ||
| } | ||
| /** | ||
| * Checks if a field is a scalar (non-relation) field | ||
| */ | ||
| isScalar(entityType: string, fieldName: string): boolean { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| return fieldDef?.type === 'scalar' | ||
| } | ||
| /** | ||
| * Gets the inverse field name for a relation. | ||
| * Returns undefined if no inverse is defined. | ||
| */ | ||
| getInverseField(entityType: string, fieldName: string): string | undefined { | ||
| const fieldDef = this.getFieldDef(entityType, fieldName) | ||
| if (!fieldDef) return undefined | ||
| if (fieldDef.type === 'scalar') return undefined | ||
| return (fieldDef as HasOneRelationDef | HasManyRelationDef).inverse | ||
| } | ||
| /** | ||
| * Gets all scalar field names for an entity | ||
| */ | ||
| getScalarFields(entityType: string): string[] { | ||
| const entityDef = this.entityDefs.get(entityType) | ||
| if (!entityDef) return [] | ||
| return Object.entries(entityDef.fields) | ||
| .filter(([_, def]) => def.type === 'scalar') | ||
| .map(([name]) => name) | ||
| } | ||
| /** | ||
| * Gets all relation field names for an entity | ||
| */ | ||
| getRelationFields(entityType: string): string[] { | ||
| const entityDef = this.entityDefs.get(entityType) | ||
| if (!entityDef) return [] | ||
| return Object.entries(entityDef.fields) | ||
| .filter(([_, def]) => def.type === 'hasOne' || def.type === 'hasMany') | ||
| .map(([name]) => name) | ||
| } | ||
| /** | ||
| * Gets all field names for an entity | ||
| */ | ||
| getAllFields(entityType: string): string[] { | ||
| const entityDef = this.entityDefs.get(entityType) | ||
| if (!entityDef) return [] | ||
| return Object.keys(entityDef.fields) | ||
| } | ||
| /** | ||
| * Validates that all relation targets exist in the schema. | ||
| * Throws an error if any target is missing. | ||
| */ | ||
| validate(): void { | ||
| for (const [entityName, entityDef] of this.entityDefs) { | ||
| for (const [fieldName, fieldDef] of Object.entries(entityDef.fields)) { | ||
| if (fieldDef.type === 'hasOne' || fieldDef.type === 'hasMany') { | ||
| if (!this.entityDefs.has(fieldDef.target)) { | ||
| throw new Error( | ||
| `Invalid schema: Entity "${entityName}" field "${fieldName}" references ` + | ||
| `unknown entity "${fieldDef.target}"`, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Normalizes field definitions from Contember SchemaNames format | ||
| * (column/one/many with entity) to bindx FieldDef format (scalar/hasOne/hasMany with target). | ||
| */ | ||
| function normalizeEntityDef(entityDef: EntitySchemaDef): EntitySchemaDef { | ||
| const fields: Record<string, FieldDef> = {} | ||
| let needsNormalization = false | ||
| for (const [fieldName, fieldDef] of Object.entries(entityDef.fields)) { | ||
| const raw = fieldDef as unknown as Record<string, unknown> | ||
| const type = raw['type'] as string | ||
| if (type === 'column') { | ||
| fields[fieldName] = { type: 'scalar' } | ||
| needsNormalization = true | ||
| } else if (type === 'one') { | ||
| fields[fieldName] = { | ||
| type: 'hasOne', | ||
| target: (raw['entity'] as string) ?? (raw['target'] as string), | ||
| inverse: raw['inverse'] as string | undefined, | ||
| } | ||
| needsNormalization = true | ||
| } else if (type === 'many') { | ||
| fields[fieldName] = { | ||
| type: 'hasMany', | ||
| target: (raw['entity'] as string) ?? (raw['target'] as string), | ||
| inverse: raw['inverse'] as string | undefined, | ||
| } | ||
| needsNormalization = true | ||
| } else { | ||
| fields[fieldName] = fieldDef | ||
| } | ||
| } | ||
| return needsNormalization ? { fields } : entityDef | ||
| } | ||
| export { SchemaRegistry } from '@contember/bindx-client' |
+21
-238
@@ -1,238 +0,21 @@ | ||
| /** | ||
| * Schema type definitions for bindx. | ||
| * Provides type-safe entity and relation definitions. | ||
| */ | ||
| import type { CommonEntity, SingleRoleMap } from './roles.js' | ||
| /** | ||
| * Relation type discriminator | ||
| */ | ||
| export type RelationType = 'hasOne' | 'hasMany' | ||
| /** | ||
| * Scalar field definition | ||
| */ | ||
| export interface ScalarFieldDef { | ||
| readonly type: 'scalar' | ||
| readonly columnType?: string | ||
| } | ||
| /** | ||
| * Enum scalar field definition — carries the allowed values at runtime | ||
| */ | ||
| export interface EnumFieldDef { | ||
| readonly type: 'enum' | ||
| readonly enumName: string | ||
| readonly values: readonly string[] | ||
| } | ||
| /** | ||
| * Has-one relation definition | ||
| */ | ||
| export interface HasOneRelationDef<TTarget extends string = string> { | ||
| readonly type: 'hasOne' | ||
| readonly target: TTarget | ||
| /** Inverse field name on the target entity (for bidirectional relations) */ | ||
| readonly inverse?: string | ||
| } | ||
| /** | ||
| * Has-many relation definition | ||
| */ | ||
| export interface HasManyRelationDef<TTarget extends string = string> { | ||
| readonly type: 'hasMany' | ||
| readonly target: TTarget | ||
| /** Inverse field name on the target entity (for bidirectional relations) */ | ||
| readonly inverse?: string | ||
| } | ||
| /** | ||
| * Union of all field definition types | ||
| */ | ||
| export type FieldDef<TTarget extends string = string> = | ||
| | ScalarFieldDef | ||
| | EnumFieldDef | ||
| | HasOneRelationDef<TTarget> | ||
| | HasManyRelationDef<TTarget> | ||
| /** | ||
| * Entity schema definition - maps field names to their definitions | ||
| */ | ||
| export interface EntitySchemaDef<TEntityNames extends string = string> { | ||
| readonly fields: Record<string, FieldDef<TEntityNames>> | ||
| } | ||
| /** | ||
| * Complete schema definition mapping entity names to their schemas. | ||
| * TModels provides the TypeScript types for each entity. | ||
| */ | ||
| export interface SchemaDefinition< | ||
| TModels extends { [K in keyof TModels]: object }, | ||
| TEntityNames extends string = keyof TModels & string, | ||
| > { | ||
| readonly entities: { | ||
| [K in TEntityNames]: EntitySchemaDef<TEntityNames> | ||
| } | ||
| } | ||
| /** | ||
| * Helper function to create a scalar field definition | ||
| */ | ||
| export function scalar(): ScalarFieldDef { | ||
| return { type: 'scalar' } | ||
| } | ||
| /** | ||
| * Helper function to create an enum scalar field definition with allowed values. | ||
| */ | ||
| export function enumScalar<T extends string>(enumName: string, values: readonly T[]): EnumFieldDef { | ||
| return { type: 'enum', enumName, values } | ||
| } | ||
| /** | ||
| * Helper function to create a has-one relation definition | ||
| */ | ||
| export function hasOne<TTarget extends string>( | ||
| target: TTarget, | ||
| options?: { inverse?: string }, | ||
| ): HasOneRelationDef<TTarget> { | ||
| return { | ||
| type: 'hasOne', | ||
| target, | ||
| inverse: options?.inverse, | ||
| } | ||
| } | ||
| /** | ||
| * Helper function to create a has-many relation definition | ||
| */ | ||
| export function hasMany<TTarget extends string>( | ||
| target: TTarget, | ||
| options?: { inverse?: string }, | ||
| ): HasManyRelationDef<TTarget> { | ||
| return { | ||
| type: 'hasMany', | ||
| target, | ||
| inverse: options?.inverse, | ||
| } | ||
| } | ||
| /** | ||
| * Helper function to define a complete schema with full type inference. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * interface Author { | ||
| * id: string | ||
| * name: string | ||
| * articles: Article[] | ||
| * } | ||
| * | ||
| * interface Article { | ||
| * id: string | ||
| * title: string | ||
| * author: Author | ||
| * } | ||
| * | ||
| * const schema = defineSchema<{ | ||
| * Author: Author | ||
| * Article: Article | ||
| * }>({ | ||
| * entities: { | ||
| * Author: { | ||
| * fields: { | ||
| * id: scalar(), | ||
| * name: scalar(), | ||
| * articles: hasMany('Article', { inverse: 'author' }) | ||
| * } | ||
| * }, | ||
| * Article: { | ||
| * fields: { | ||
| * id: scalar(), | ||
| * title: scalar(), | ||
| * author: hasOne('Author', { inverse: 'articles' }) | ||
| * } | ||
| * } | ||
| * } | ||
| * }) | ||
| * ``` | ||
| */ | ||
| export function defineSchema<TModels extends { [K in keyof TModels]: object }>( | ||
| definition: SchemaDefinition<TModels>, | ||
| ): SchemaDefinition<TModels> { | ||
| return definition | ||
| } | ||
| /** | ||
| * Infers the model type for a given entity name from a schema | ||
| */ | ||
| export type InferModel< | ||
| TSchema extends SchemaDefinition<any>, | ||
| TEntityName extends keyof TSchema['entities'], | ||
| > = TSchema extends SchemaDefinition<infer TModels> | ||
| ? TEntityName extends keyof TModels | ||
| ? TModels[TEntityName] | ||
| : never | ||
| : never | ||
| /** | ||
| * Infers all entity names from a schema | ||
| */ | ||
| export type InferEntityNames<TSchema extends SchemaDefinition<any>> = keyof TSchema['entities'] & string | ||
| // ============================================================================ | ||
| // Entity Definitions (type-safe entity references) | ||
| // ============================================================================ | ||
| /** | ||
| * A type-safe reference to an entity in the schema. | ||
| * Carries a role map as a phantom type parameter: Record<roleName, entityType>. | ||
| * | ||
| * For schemas without ACL, the role map is `{ _default: TEntity }`. | ||
| * For schemas with ACL, each role maps to a per-role entity type. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Without roles (convenience): | ||
| * const Article = entityDef<ArticleType>('Article') // → EntityDef<{ _default: ArticleType }> | ||
| * | ||
| * // With roles (generator): | ||
| * const Article = roleEntityDef<{ admin: Article$admin; public: Article$public }>('Article') | ||
| * ``` | ||
| */ | ||
| export interface EntityDef<TRoleMap extends Record<string, object> = Record<string, object>> { | ||
| readonly $name: string | ||
| /** @internal phantom type for role map — not present at runtime */ | ||
| readonly $roleMap?: TRoleMap | ||
| /** @internal reference to the schema definition for collection-time field lookups */ | ||
| readonly $schema?: SchemaDefinition<Record<string, object>> | ||
| } | ||
| /** | ||
| * Infers the common (default) entity type from an EntityDef. | ||
| * Returns the union of all role entity types — only common fields are accessible. | ||
| */ | ||
| export type InferEntityDef<T> = T extends EntityDef<infer TRoleMap> ? CommonEntity<TRoleMap> : never | ||
| /** | ||
| * Creates a type-safe entity definition reference. | ||
| * Wraps the entity type in a single-role map: `{ _default: TEntity }`. | ||
| * | ||
| * @param name - The entity name as used in the schema | ||
| * @param schema - Optional schema definition for collection-time field lookups | ||
| */ | ||
| export function entityDef<TEntity extends object>(name: string, schema?: SchemaDefinition<Record<string, object>>): EntityDef<SingleRoleMap<TEntity>> { | ||
| return schema ? { $name: name, $schema: schema } : { $name: name } | ||
| } | ||
| /** | ||
| * Creates a role-aware entity definition reference. | ||
| * Used by the generator when ACL roles are present. | ||
| * | ||
| * @param name - The entity name as used in the schema | ||
| * @param schema - Optional schema definition for collection-time field lookups | ||
| */ | ||
| export function roleEntityDef<TRoleMap extends Record<string, object>>(name: string, schema?: SchemaDefinition<Record<string, object>>): EntityDef<TRoleMap> { | ||
| return schema ? { $name: name, $schema: schema } : { $name: name } | ||
| } | ||
| export { | ||
| type RelationType, | ||
| type ScalarFieldDef, | ||
| type HasOneRelationDef, | ||
| type HasManyRelationDef, | ||
| type FieldDef, | ||
| type EntitySchemaDef, | ||
| type SchemaDefinition, | ||
| type InferModel, | ||
| type InferEntityNames, | ||
| type EntityDef, | ||
| type InferEntityDef, | ||
| type EnumFieldDef, | ||
| scalar, | ||
| enumScalar, | ||
| hasOne, | ||
| hasMany, | ||
| defineSchema, | ||
| entityDef, | ||
| roleEntityDef, | ||
| } from '@contember/bindx-client' |
@@ -1,134 +0,1 @@ | ||
| import type { SelectionMeta, SelectionFieldMeta } from './types.js' | ||
| /** | ||
| * Query specification for a single field | ||
| */ | ||
| export interface QueryFieldSpec { | ||
| /** Name of the field as it appears in the output */ | ||
| name: string | ||
| /** Path to the field in the source entity */ | ||
| sourcePath: string[] | ||
| /** For nested objects/entities */ | ||
| nested?: QuerySpec | ||
| /** Whether this is an array/collection */ | ||
| isArray?: boolean | ||
| /** For has-many: filter parameters */ | ||
| filter?: unknown | ||
| /** For has-many: ordering parameters */ | ||
| orderBy?: unknown | ||
| /** For has-many: limit */ | ||
| limit?: number | ||
| /** For has-many: offset */ | ||
| offset?: number | ||
| /** For has-many: request totalCount via paginateRelation */ | ||
| totalCount?: boolean | ||
| } | ||
| /** | ||
| * Query specification for fetching data. | ||
| * Backend adapters use this to construct their queries. | ||
| */ | ||
| export interface QuerySpec { | ||
| /** List of fields to fetch */ | ||
| fields: QueryFieldSpec[] | ||
| } | ||
| /** | ||
| * Builds a QuerySpec from SelectionMeta. | ||
| * This is what gets passed to the backend adapter. | ||
| * | ||
| * @param meta - The selection metadata | ||
| */ | ||
| export function buildQueryFromSelection(meta: SelectionMeta): QuerySpec { | ||
| const fields: QueryFieldSpec[] = [] | ||
| // Always include 'id' field if not already selected | ||
| // This is needed for entity identity and HasOneAccessor to detect if relation exists | ||
| if (!meta.fields.has('id')) { | ||
| fields.push({ | ||
| name: 'id', | ||
| sourcePath: ['id'], | ||
| }) | ||
| } | ||
| for (const [_alias, fieldMeta] of meta.fields) { | ||
| // Skip relation fields where no nested fields were selected. | ||
| // This occurs when a relation handle is passed as a prop (e.g., HasManyDataGrid's `field` prop) | ||
| // without any of its fields being read during JSX collection. The consuming component | ||
| // is expected to handle its own data fetching for that relation. | ||
| if (fieldMeta.isRelation && fieldMeta.nested && fieldMeta.nested.fields.size === 0) { | ||
| continue | ||
| } | ||
| fields.push(buildFieldSpecFromSelection(fieldMeta)) | ||
| } | ||
| return { fields } | ||
| } | ||
| /** | ||
| * Builds a QueryFieldSpec from SelectionFieldMeta | ||
| */ | ||
| function buildFieldSpecFromSelection(meta: SelectionFieldMeta): QueryFieldSpec { | ||
| const spec: QueryFieldSpec = { | ||
| name: meta.alias, | ||
| sourcePath: [meta.fieldName], | ||
| } | ||
| if (meta.isArray) { | ||
| spec.isArray = true | ||
| // Add has-many parameters | ||
| if (meta.hasManyParams) { | ||
| if (meta.hasManyParams.filter !== undefined) { | ||
| spec.filter = meta.hasManyParams.filter | ||
| } | ||
| if (meta.hasManyParams.orderBy !== undefined) { | ||
| spec.orderBy = meta.hasManyParams.orderBy | ||
| } | ||
| if (meta.hasManyParams.limit !== undefined) { | ||
| spec.limit = meta.hasManyParams.limit | ||
| } | ||
| if (meta.hasManyParams.offset !== undefined) { | ||
| spec.offset = meta.hasManyParams.offset | ||
| } | ||
| if (meta.hasManyParams.totalCount) { | ||
| spec.totalCount = true | ||
| } | ||
| } | ||
| if (meta.nested) { | ||
| spec.nested = buildQueryFromSelection(meta.nested) | ||
| } | ||
| } else if (meta.nested) { | ||
| spec.nested = buildQueryFromSelection(meta.nested) | ||
| } | ||
| return spec | ||
| } | ||
| /** | ||
| * Collects all unique paths that need to be fetched. | ||
| * Useful for debugging and optimization. | ||
| */ | ||
| export function collectPaths(meta: SelectionMeta, basePath: string[] = []): string[][] { | ||
| const paths: string[][] = [] | ||
| for (const [_alias, fieldMeta] of meta.fields) { | ||
| const fullPath = [...basePath, fieldMeta.fieldName] | ||
| if (fieldMeta.isArray && fieldMeta.nested) { | ||
| // For arrays, collect paths from nested metadata | ||
| const nestedPaths = collectPaths(fieldMeta.nested, fullPath) | ||
| paths.push(...nestedPaths) | ||
| } else if (fieldMeta.nested) { | ||
| // For nested objects, collect paths recursively | ||
| const nestedPaths = collectPaths(fieldMeta.nested, fullPath) | ||
| paths.push(...nestedPaths) | ||
| } else { | ||
| // Scalar field | ||
| paths.push(fullPath) | ||
| } | ||
| } | ||
| return paths | ||
| } | ||
| export { buildQueryFromSelection, collectPaths, type QuerySpec, type QueryFieldSpec } from '@contember/bindx-client' |
@@ -1,50 +0,1 @@ | ||
| import { createSelectionBuilder } from './createSelectionBuilder.js' | ||
| import { SELECTION_META, type FluentFragment, type SelectionBuilder } from './types.js' | ||
| /** | ||
| * Creates a reusable fragment using the fluent builder API. | ||
| * | ||
| * This is a curried function - first call provides the model type, | ||
| * second call provides the definer function. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Define a fragment | ||
| * const AuthorFragment = createFragment<Author>()(e => | ||
| * e.id().name().email() | ||
| * ) | ||
| * | ||
| * // Use in useEntity | ||
| * const article = useEntity('Article', { id }, e => | ||
| * e.title().author(AuthorFragment) | ||
| * ) | ||
| * | ||
| * // Or compose fragments | ||
| * const ArticleFragment = createFragment<Article>()(e => | ||
| * e.id().title() | ||
| * .author(AuthorFragment) | ||
| * .tags(TagFragment) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| export function createFragment<TModel>() { | ||
| return function <TResult extends object>( | ||
| definer: (builder: SelectionBuilder<TModel>) => SelectionBuilder<TModel, TResult, object>, | ||
| ): FluentFragment<TModel, TResult> { | ||
| // Create initial builder | ||
| const builder = createSelectionBuilder<TModel>() | ||
| // Execute definer to get final builder with accumulated selections | ||
| const resultBuilder = definer(builder) | ||
| // Extract metadata | ||
| const meta = resultBuilder[SELECTION_META] | ||
| return { | ||
| __meta: meta, | ||
| __resultType: undefined as unknown as TResult, | ||
| __modelType: undefined as unknown as TModel, | ||
| __isFragment: true, | ||
| } | ||
| } | ||
| } | ||
| export { createFragment } from '@contember/bindx-client' |
@@ -1,283 +0,1 @@ | ||
| import { | ||
| SELECTION_META, | ||
| type FluentFragment, | ||
| type SelectionBuilder, | ||
| type SelectionFieldMeta, | ||
| type SelectionMeta, | ||
| type HasManyOptions, | ||
| } from './types.js' | ||
| import { mergeSelections, SelectionMetaCollector } from './SelectionMetaCollector.js' | ||
| import { generateHasManyAlias } from '../utils/aliasGenerator.js' | ||
| /** | ||
| * Creates a fluent selection builder for an entity type. | ||
| * Uses Proxy to intercept method calls and build selection metadata. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * const builder = createSelectionBuilder<Article>() | ||
| * const result = builder.id().title().author(a => a.name()) | ||
| * const meta = result[SELECTION_META] | ||
| * ``` | ||
| */ | ||
| export function createSelectionBuilder<TEntity, TSelected extends object = object, THasManyParams extends object = object>( | ||
| initialMeta: SelectionMeta = { fields: new Map() }, | ||
| ): SelectionBuilder<TEntity, TSelected, THasManyParams> { | ||
| const handler: ProxyHandler<object> = { | ||
| get(_target, prop: string | symbol) { | ||
| // Return metadata for introspection | ||
| if (prop === SELECTION_META) { | ||
| return initialMeta | ||
| } | ||
| // Type brand accessor | ||
| if (prop === '__selected') { | ||
| return undefined | ||
| } | ||
| // Skip internal symbols | ||
| if (typeof prop === 'symbol') { | ||
| return undefined | ||
| } | ||
| // Return a function that handles the field selection | ||
| return createFieldMethod<TEntity, TSelected, THasManyParams>(prop, initialMeta) | ||
| }, | ||
| has(_target, prop: string | symbol) { | ||
| if (prop === SELECTION_META) { | ||
| return true | ||
| } | ||
| return false | ||
| }, | ||
| } | ||
| return new Proxy({}, handler) as SelectionBuilder<TEntity, TSelected, THasManyParams> | ||
| } | ||
| /** | ||
| * Creates a method for selecting a specific field. | ||
| * The method signature depends on the field type (scalar, has-one, has-many). | ||
| */ | ||
| function createFieldMethod<TEntity, TSelected extends object, THasManyParams extends object>( | ||
| fieldName: string, | ||
| currentMeta: SelectionMeta, | ||
| ) { | ||
| return function selectField(...args: unknown[]): SelectionBuilder<TEntity, object, object> { | ||
| // Parse arguments to determine what kind of selection this is | ||
| const { options, selector, fragment, fragments } = parseFieldArgs(args) | ||
| // Build field metadata | ||
| const fieldMeta: SelectionFieldMeta = { | ||
| fieldName, | ||
| alias: fieldName, // Will be updated below | ||
| path: [fieldName], | ||
| isRelation: false, | ||
| isArray: false, | ||
| nested: undefined, | ||
| hasManyParams: undefined, | ||
| } | ||
| // Handle relation with callback | ||
| if (typeof selector === 'function') { | ||
| const nestedBuilder = createSelectionBuilder<unknown>() | ||
| const resultBuilder = selector(nestedBuilder) as SelectionBuilder<unknown, object, object> | ||
| fieldMeta.nested = resultBuilder[SELECTION_META] | ||
| fieldMeta.isRelation = true | ||
| // Check if this looks like a has-many (options has filter/orderBy/limit) | ||
| if (options && isHasManyOptions(options)) { | ||
| fieldMeta.isArray = true | ||
| fieldMeta.hasManyParams = { | ||
| filter: (options as HasManyOptions).filter, | ||
| orderBy: (options as HasManyOptions).orderBy, | ||
| limit: (options as HasManyOptions).limit, | ||
| offset: (options as HasManyOptions).offset, | ||
| totalCount: (options as HasManyOptions).totalCount, | ||
| } | ||
| } | ||
| } | ||
| // Handle relation with single fragment | ||
| if (fragment && isFluentFragment(fragment)) { | ||
| fieldMeta.nested = fragment.__meta | ||
| fieldMeta.isRelation = true | ||
| // Check has-many params | ||
| if (options && isHasManyOptions(options)) { | ||
| fieldMeta.isArray = true | ||
| fieldMeta.hasManyParams = { | ||
| filter: (options as HasManyOptions).filter, | ||
| orderBy: (options as HasManyOptions).orderBy, | ||
| limit: (options as HasManyOptions).limit, | ||
| offset: (options as HasManyOptions).offset, | ||
| totalCount: (options as HasManyOptions).totalCount, | ||
| } | ||
| } | ||
| } | ||
| // Handle relation with multiple fragments (merged) | ||
| if (fragments && fragments.length > 0) { | ||
| // Merge all fragment selections into one | ||
| const mergedSelection = new SelectionMetaCollector() | ||
| for (const frag of fragments) { | ||
| mergeSelections(mergedSelection, frag.__meta) | ||
| } | ||
| fieldMeta.nested = mergedSelection | ||
| fieldMeta.isRelation = true | ||
| // Check has-many params | ||
| if (options && isHasManyOptions(options)) { | ||
| fieldMeta.isArray = true | ||
| fieldMeta.hasManyParams = { | ||
| filter: (options as HasManyOptions).filter, | ||
| orderBy: (options as HasManyOptions).orderBy, | ||
| limit: (options as HasManyOptions).limit, | ||
| offset: (options as HasManyOptions).offset, | ||
| totalCount: (options as HasManyOptions).totalCount, | ||
| } | ||
| } | ||
| } | ||
| // Determine alias: | ||
| // 1. Explicit alias from options takes priority | ||
| // 2. For has-many with params, auto-generate alias | ||
| // 3. Otherwise, use fieldName | ||
| const explicitAlias = (options as { as?: string } | undefined)?.as | ||
| if (explicitAlias) { | ||
| fieldMeta.alias = explicitAlias | ||
| } else if (fieldMeta.isArray && fieldMeta.hasManyParams) { | ||
| // Auto-generate alias for has-many with params | ||
| fieldMeta.alias = generateHasManyAlias(fieldName, fieldMeta.hasManyParams) | ||
| } | ||
| // else alias is already set to fieldName | ||
| // If it's a relation call without options but first arg is callback/fragment | ||
| // and there's no filter/orderBy, check if it's has-many by detecting array at runtime | ||
| // This is handled by the type system - if the field type is Array<T>, it will use HasManyMethod | ||
| // Create new metadata with this field added | ||
| const newMeta: SelectionMeta = { | ||
| fields: new Map(currentMeta.fields), | ||
| } | ||
| newMeta.fields.set(fieldMeta.alias, fieldMeta) | ||
| // Return new builder with accumulated selection | ||
| return createSelectionBuilder<TEntity, TSelected, THasManyParams>(newMeta) | ||
| } | ||
| } | ||
| /** | ||
| * Type guard for HasManyOptions | ||
| */ | ||
| function isHasManyOptions(value: unknown): value is HasManyOptions { | ||
| if (typeof value !== 'object' || value === null) { | ||
| return false | ||
| } | ||
| return 'filter' in value || 'orderBy' in value || 'limit' in value || 'offset' in value | ||
| } | ||
| /** | ||
| * Type guard for FluentFragment | ||
| */ | ||
| function isFluentFragment(value: unknown): value is FluentFragment<unknown, unknown> { | ||
| return ( | ||
| value !== null && | ||
| typeof value === 'object' && | ||
| '__isFragment' in value && | ||
| (value as FluentFragment<unknown, unknown>).__isFragment === true | ||
| ) | ||
| } | ||
| /** | ||
| * Parses the variable arguments to a field method. | ||
| * | ||
| * Possible call patterns: | ||
| * - e.title() -> scalar, no args | ||
| * - e.title({ as: 'x' }) -> scalar with alias | ||
| * - e.author(a => a.name()) -> has-one with callback | ||
| * - e.author(AuthorFragment) -> has-one with fragment | ||
| * - e.author(Frag1, Frag2, ...) -> has-one with multiple fragments (merged) | ||
| * - e.author({ as: 'x' }, a => a.name())-> has-one with alias + callback | ||
| * - e.author({ as: 'x' }, AuthorFrag) -> has-one with alias + fragment | ||
| * - e.author({ as: 'x' }, Frag1, Frag2) -> has-one with alias + multiple fragments | ||
| * - e.tags(t => t.name()) -> has-many with callback | ||
| * - e.tags(TagFragment) -> has-many with fragment | ||
| * - e.tags(Frag1, Frag2, ...) -> has-many with multiple fragments (merged) | ||
| * - e.tags({ filter: {} }, t => t.name()) -> has-many with options + callback | ||
| * - e.tags({ filter: {} }, TagFragment) -> has-many with options + fragment | ||
| * - e.tags({ filter: {} }, Frag1, Frag2) -> has-many with options + multiple fragments | ||
| */ | ||
| function parseFieldArgs(args: unknown[]): { | ||
| options?: Record<string, unknown> | ||
| selector?: (builder: SelectionBuilder<unknown>) => SelectionBuilder<unknown, object, object> | ||
| fragment?: FluentFragment<unknown, unknown> | ||
| fragments?: FluentFragment<unknown, unknown>[] | ||
| } { | ||
| if (args.length === 0) { | ||
| // Just field name, no args: e.title() | ||
| return {} | ||
| } | ||
| if (args.length === 1) { | ||
| const arg = args[0] | ||
| if (typeof arg === 'function') { | ||
| // Selector callback: e.author(a => a.name()) | ||
| return { selector: arg as (builder: SelectionBuilder<unknown>) => SelectionBuilder<unknown, object, object> } | ||
| } | ||
| if (typeof arg === 'object' && arg !== null) { | ||
| if (isFluentFragment(arg)) { | ||
| // Fragment: e.author(AuthorFragment) | ||
| return { fragment: arg } | ||
| } | ||
| // Options without selector: e.title({ as: 'caption' }) | ||
| return { options: arg as Record<string, unknown> } | ||
| } | ||
| } | ||
| // Check for multiple fragments: e.author(Frag1, Frag2, ...) | ||
| if (args.length >= 2 && args.every(isFluentFragment)) { | ||
| return { fragments: args as FluentFragment<unknown, unknown>[] } | ||
| } | ||
| if (args.length >= 2) { | ||
| const [first, ...rest] = args | ||
| // Check if first is options object | ||
| if (typeof first === 'object' && first !== null && !isFluentFragment(first)) { | ||
| const second = rest[0] | ||
| if (typeof second === 'function') { | ||
| // Options + selector: e.tags({ filter: {...} }, t => t.name()) | ||
| return { | ||
| options: first as Record<string, unknown>, | ||
| selector: second as (builder: SelectionBuilder<unknown>) => SelectionBuilder<unknown, object, object>, | ||
| } | ||
| } | ||
| // Check for options + multiple fragments | ||
| if (rest.every(isFluentFragment)) { | ||
| if (rest.length === 1) { | ||
| // Options + single fragment: e.tags({ filter: {...} }, TagFragment) | ||
| return { | ||
| options: first as Record<string, unknown>, | ||
| fragment: rest[0] as FluentFragment<unknown, unknown>, | ||
| } | ||
| } | ||
| // Options + multiple fragments: e.tags({ filter: {} }, Frag1, Frag2) | ||
| return { | ||
| options: first as Record<string, unknown>, | ||
| fragments: rest as FluentFragment<unknown, unknown>[], | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return {} | ||
| } | ||
| /** | ||
| * Extracts SelectionMeta from a builder | ||
| */ | ||
| export function getSelectionMeta(builder: SelectionBuilder<unknown, object, object>): SelectionMeta { | ||
| return builder[SELECTION_META] | ||
| } | ||
| export { createSelectionBuilder, getSelectionMeta } from '@contember/bindx-client' |
@@ -1,135 +0,8 @@ | ||
| /** | ||
| * Typed query parameter types for filter, orderBy, etc. | ||
| * | ||
| * Uses Input.Condition and Input.OrderDirection from @contember/schema | ||
| * for scalar conditions, wrapped in entity-aware types that work with | ||
| * plain TypeScript interfaces. | ||
| */ | ||
| import { Input } from '@contember/schema' | ||
| // ============================================================================ | ||
| // Re-export Contember types | ||
| // ============================================================================ | ||
| /** | ||
| * Condition operators for scalar values - re-exported from @contember/schema | ||
| */ | ||
| export type ScalarCondition<T> = Input.Condition<T> | ||
| /** | ||
| * Order direction enum values - string literal union from Contember enum | ||
| */ | ||
| export type OrderDirection = `${Input.OrderDirection}` | ||
| // ============================================================================ | ||
| // Where Types (for filtering) | ||
| // ============================================================================ | ||
| /** | ||
| * Base composed where with AND/OR/NOT logic | ||
| */ | ||
| export interface ComposedWhere<TEntity> { | ||
| readonly and?: readonly EntityWhere<TEntity>[] | ||
| readonly or?: readonly EntityWhere<TEntity>[] | ||
| readonly not?: EntityWhere<TEntity> | ||
| } | ||
| /** | ||
| * Checks if a type is a "plain object" (entity) vs a scalar like Date | ||
| * Date and other built-in objects are not treated as relations | ||
| */ | ||
| type IsPlainObject<T> = | ||
| T extends Date ? false : | ||
| T extends Array<any> ? false : | ||
| T extends Function ? false : | ||
| T extends object ? true : | ||
| false | ||
| /** | ||
| * Field-level where clause for an entity | ||
| * Maps each field to its appropriate condition type using Input.Condition | ||
| */ | ||
| export type FieldsWhere<TEntity> = { | ||
| readonly [K in keyof TEntity]?: | ||
| NonNullable<TEntity[K]> extends Array<infer U> | ||
| ? IsPlainObject<U> extends true | ||
| ? EntityWhere<U> | null // has-many: filter on related items (array of entities) | ||
| : Input.Condition<NonNullable<TEntity[K]>> | null // scalar array: use Input.Condition on the array (supports hasSome, contains, etc.) | ||
| : IsPlainObject<NonNullable<TEntity[K]>> extends true | ||
| ? EntityWhere<NonNullable<TEntity[K]>> | null // has-one: filter on related entity | ||
| : Input.Condition<NonNullable<TEntity[K]>> | null // scalar: use Input.Condition | ||
| } | ||
| /** | ||
| * Full where type for an entity - combines composed and field conditions | ||
| */ | ||
| export type EntityWhere<TEntity> = ComposedWhere<TEntity> & FieldsWhere<TEntity> | ||
| // ============================================================================ | ||
| // OrderBy Types (for sorting) | ||
| // ============================================================================ | ||
| /** | ||
| * Order by clause for an entity | ||
| * Each scalar field can have a direction, relations can have nested ordering | ||
| */ | ||
| export type EntityOrderBy<TEntity> = { | ||
| readonly [K in keyof TEntity]?: | ||
| NonNullable<TEntity[K]> extends Array<any> | ||
| ? never // has-many cannot be ordered by directly | ||
| : IsPlainObject<NonNullable<TEntity[K]>> extends true | ||
| ? EntityOrderBy<NonNullable<TEntity[K]>> | null // has-one: nested ordering | ||
| : OrderDirection | null // scalar: direction (including Date) | ||
| } & { | ||
| readonly _random?: boolean | ||
| readonly _randomSeeded?: number | ||
| } | ||
| // ============================================================================ | ||
| // HasMany Options with Typed Parameters | ||
| // ============================================================================ | ||
| /** | ||
| * Options for has-many relation selection with typed filter/orderBy | ||
| * | ||
| * @typeParam TItem - The related entity type (array item type) | ||
| * @typeParam TAlias - Optional alias for the field | ||
| */ | ||
| export interface TypedHasManyOptions< | ||
| TItem, | ||
| TAlias extends string = string, | ||
| > { | ||
| readonly as?: TAlias | ||
| readonly filter?: EntityWhere<TItem> | ||
| readonly orderBy?: readonly EntityOrderBy<TItem>[] | ||
| readonly limit?: number | ||
| readonly offset?: number | ||
| readonly totalCount?: boolean | ||
| } | ||
| /** | ||
| * Alias-only options (for scalar or has-one with alias) | ||
| */ | ||
| export interface AliasOptions<TAlias extends string = string> { | ||
| readonly as?: TAlias | ||
| } | ||
| // ============================================================================ | ||
| // Type Utilities | ||
| // ============================================================================ | ||
| /** | ||
| * Extracts the item type from an array type | ||
| */ | ||
| export type ArrayItemType<T> = T extends Array<infer U> ? U : never | ||
| /** | ||
| * Checks if a type is an array | ||
| */ | ||
| export type IsArray<T> = T extends Array<any> ? true : false | ||
| /** | ||
| * Extracts non-nullable type | ||
| */ | ||
| export type NonNullableType<T> = Exclude<T, null | undefined> | ||
| export { | ||
| type EntityWhere, | ||
| type EntityOrderBy, | ||
| type ScalarCondition, | ||
| type OrderDirection, | ||
| type TypedHasManyOptions, | ||
| type AliasOptions, | ||
| } from '@contember/bindx-client' |
@@ -1,122 +0,1 @@ | ||
| import type { SelectionMeta, SelectionFieldMeta } from './types.js' | ||
| import { generateHasManyAlias } from '../utils/aliasGenerator.js' | ||
| /** | ||
| * Class for collecting field selection metadata during collection phase | ||
| */ | ||
| export class SelectionMetaCollector implements SelectionMeta { | ||
| readonly fields = new Map<string, SelectionFieldMeta>() | ||
| /** | ||
| * Add a field to the selection. | ||
| * | ||
| * For has-many fields with parameters (filter, orderBy, limit, offset), | ||
| * uses alias as the key to allow multiple instances of the same field | ||
| * with different parameters. | ||
| */ | ||
| addField(fieldMeta: SelectionFieldMeta): void { | ||
| let key: string | ||
| // For has-many fields with parameters, use alias as the key | ||
| // This allows multiple HasMany for the same field with different params | ||
| if (fieldMeta.isArray && fieldMeta.hasManyParams) { | ||
| const hasParams = fieldMeta.hasManyParams.filter !== undefined || | ||
| fieldMeta.hasManyParams.orderBy !== undefined || | ||
| fieldMeta.hasManyParams.limit !== undefined || | ||
| fieldMeta.hasManyParams.offset !== undefined | ||
| if (hasParams) { | ||
| // Generate auto-alias if alias equals fieldName | ||
| if (fieldMeta.alias === fieldMeta.fieldName) { | ||
| fieldMeta.alias = generateHasManyAlias(fieldMeta.fieldName, fieldMeta.hasManyParams) | ||
| } | ||
| // Use alias-based key for has-many with params | ||
| const pathWithAlias = [...fieldMeta.path.slice(0, -1), fieldMeta.alias] | ||
| key = pathWithAlias.join('.') | ||
| } else { | ||
| key = fieldMeta.path.join('.') | ||
| } | ||
| } else { | ||
| key = fieldMeta.path.join('.') | ||
| } | ||
| const existing = this.fields.get(key) | ||
| if (existing) { | ||
| // Update relation/array flags if source has more specific info | ||
| if (fieldMeta.isRelation && !existing.isRelation) { | ||
| existing.isRelation = true | ||
| } | ||
| if (fieldMeta.isArray && !existing.isArray) { | ||
| existing.isArray = true | ||
| } | ||
| // Merge nested selections if both have them | ||
| if (fieldMeta.nested && existing.nested) { | ||
| mergeSelections(existing.nested, fieldMeta.nested) | ||
| } else if (fieldMeta.nested) { | ||
| existing.nested = fieldMeta.nested | ||
| } | ||
| } else { | ||
| this.fields.set(key, { ...fieldMeta }) | ||
| } | ||
| } | ||
| /** | ||
| * Get all root-level fields (not nested) | ||
| */ | ||
| getRootFields(): SelectionFieldMeta[] { | ||
| const result: SelectionFieldMeta[] = [] | ||
| for (const field of this.fields.values()) { | ||
| if (field.path.length === 1) { | ||
| result.push(field) | ||
| } | ||
| } | ||
| return result | ||
| } | ||
| /** | ||
| * Convert to plain object for serialization | ||
| */ | ||
| toJSON(): SelectionMeta { | ||
| return { | ||
| fields: new Map(this.fields), | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Merge two selections together | ||
| */ | ||
| export function mergeSelections(target: SelectionMeta, source: SelectionMeta): void { | ||
| for (const [key, field] of source.fields) { | ||
| const existing = target.fields.get(key) | ||
| if (existing) { | ||
| // Update relation/array flags if source has more specific info | ||
| if (field.isRelation && !existing.isRelation) { | ||
| existing.isRelation = true | ||
| } | ||
| if (field.isArray && !existing.isArray) { | ||
| existing.isArray = true | ||
| } | ||
| // Merge hasManyParams if source has them | ||
| if (field.hasManyParams && !existing.hasManyParams) { | ||
| existing.hasManyParams = field.hasManyParams | ||
| } | ||
| // Merge nested selections | ||
| if (field.nested && existing.nested) { | ||
| mergeSelections(existing.nested, field.nested) | ||
| } else if (field.nested) { | ||
| existing.nested = field.nested | ||
| } | ||
| } else { | ||
| target.fields.set(key, { ...field }) | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Create empty selection metadata | ||
| */ | ||
| export function createEmptySelection(): SelectionMeta { | ||
| return { fields: new Map() } | ||
| } | ||
| export { SelectionMetaCollector, mergeSelections, createEmptySelection } from '@contember/bindx-client' |
@@ -1,208 +0,1 @@ | ||
| import type { SelectionMeta, SelectionFieldMeta } from './types.js' | ||
| import { generateHasManyAlias } from '../utils/aliasGenerator.js' | ||
| /** | ||
| * HasMany parameters for filtering, ordering, pagination | ||
| */ | ||
| export interface HasManyParams { | ||
| filter?: unknown | ||
| orderBy?: unknown | ||
| limit?: number | ||
| offset?: number | ||
| totalCount?: boolean | ||
| } | ||
| /** | ||
| * Relation metadata stored at parent level | ||
| */ | ||
| interface RelationMeta { | ||
| isArray: boolean | ||
| params?: HasManyParams | ||
| } | ||
| /** | ||
| * Tree-based selection scope for collecting field selections. | ||
| * | ||
| * Unlike the flat path-based SelectionMetaCollector, SelectionScope | ||
| * maintains a hierarchical tree structure that naturally represents | ||
| * nested entity selections. | ||
| * | ||
| * Key benefits: | ||
| * - Natural tree structure matches entity relationships | ||
| * - No path string manipulation or collision risks | ||
| * - Scope carries its context - no need for symbol passing | ||
| * - Simple merge: just combine tree nodes | ||
| */ | ||
| export class SelectionScope { | ||
| // Tree structure | ||
| private parent: SelectionScope | null = null | ||
| private children: Map<string, SelectionScope> = new Map() | ||
| // Fields at this level | ||
| private scalarFields: Set<string> = new Set() | ||
| private relationMeta: Map<string, RelationMeta> = new Map() | ||
| /** | ||
| * Create or get a child scope for a relation field. | ||
| * Automatically removes the field from scalars if it was there. | ||
| * New child scopes always include 'id' as a minimum selection. | ||
| */ | ||
| child(fieldName: string): SelectionScope { | ||
| // Remove from scalars if it was added as scalar first | ||
| this.scalarFields.delete(fieldName) | ||
| let childScope = this.children.get(fieldName) | ||
| if (!childScope) { | ||
| childScope = new SelectionScope() | ||
| childScope.parent = this | ||
| childScope.addScalar('id') | ||
| this.children.set(fieldName, childScope) | ||
| this.relationMeta.set(fieldName, { isArray: false }) | ||
| } | ||
| return childScope | ||
| } | ||
| /** | ||
| * Add a scalar field to this scope. | ||
| * If the field is already a relation, this is a no-op. | ||
| */ | ||
| addScalar(fieldName: string): void { | ||
| if (!this.children.has(fieldName)) { | ||
| this.scalarFields.add(fieldName) | ||
| } | ||
| } | ||
| /** | ||
| * Mark a relation field as array (hasMany). | ||
| */ | ||
| markAsArray(fieldName: string): void { | ||
| const meta = this.relationMeta.get(fieldName) | ||
| if (meta) { | ||
| meta.isArray = true | ||
| } | ||
| } | ||
| /** | ||
| * Set hasMany parameters for a relation field. | ||
| */ | ||
| setHasManyParams(fieldName: string, params: HasManyParams): void { | ||
| const meta = this.relationMeta.get(fieldName) | ||
| if (meta) { | ||
| meta.params = params | ||
| } | ||
| } | ||
| /** | ||
| * Check if this scope has any fields (scalar or relation). | ||
| */ | ||
| hasFields(): boolean { | ||
| return this.scalarFields.size > 0 || this.children.size > 0 | ||
| } | ||
| /** | ||
| * Merge another scope into this one. | ||
| * Scalar fields are added, relation children are recursively merged. | ||
| */ | ||
| merge(other: SelectionScope): void { | ||
| // Merge scalar fields | ||
| for (const field of other.scalarFields) { | ||
| this.addScalar(field) | ||
| } | ||
| // Merge relation children | ||
| for (const [fieldName, otherChild] of other.children) { | ||
| const thisChild = this.child(fieldName) | ||
| thisChild.merge(otherChild) | ||
| // Merge relation metadata | ||
| const otherMeta = other.relationMeta.get(fieldName) | ||
| if (otherMeta) { | ||
| const thisMeta = this.relationMeta.get(fieldName)! | ||
| if (otherMeta.isArray) { | ||
| thisMeta.isArray = true | ||
| } | ||
| if (otherMeta.params && !thisMeta.params) { | ||
| thisMeta.params = otherMeta.params | ||
| } | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Merge fields from a SelectionMeta into this scope. | ||
| * Useful for integrating with existing fluent builder selections. | ||
| */ | ||
| mergeFromSelectionMeta(meta: SelectionMeta): void { | ||
| for (const [_key, field] of meta.fields) { | ||
| // Only process root-level fields | ||
| if (field.path.length !== 1) continue | ||
| if (field.isRelation && field.nested) { | ||
| const childScope = this.child(field.fieldName) | ||
| if (field.isArray) { | ||
| this.markAsArray(field.fieldName) | ||
| } | ||
| if (field.hasManyParams) { | ||
| this.setHasManyParams(field.fieldName, field.hasManyParams) | ||
| } | ||
| childScope.mergeFromSelectionMeta(field.nested) | ||
| } else { | ||
| this.addScalar(field.fieldName) | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Convert this scope to SelectionMeta format for backwards compatibility. | ||
| * This allows the new SelectionScope to be used with existing query builders. | ||
| * | ||
| * For has-many fields with params, generates auto-alias to allow multiple | ||
| * HasMany components for the same field with different parameters. | ||
| */ | ||
| toSelectionMeta(): SelectionMeta { | ||
| const fields = new Map<string, SelectionFieldMeta>() | ||
| // Add scalar fields | ||
| for (const fieldName of this.scalarFields) { | ||
| fields.set(fieldName, { | ||
| fieldName, | ||
| alias: fieldName, | ||
| path: [fieldName], | ||
| isRelation: false, | ||
| isArray: false, | ||
| }) | ||
| } | ||
| // Add relation fields with nested selections | ||
| for (const [fieldName, childScope] of this.children) { | ||
| const meta = this.relationMeta.get(fieldName)! | ||
| // Generate alias for has-many fields with params | ||
| const alias = meta.isArray && meta.params | ||
| ? generateHasManyAlias(fieldName, meta.params) | ||
| : fieldName | ||
| fields.set(alias, { | ||
| fieldName, | ||
| alias, | ||
| path: [fieldName], | ||
| isRelation: true, | ||
| isArray: meta.isArray, | ||
| nested: childScope.toSelectionMeta(), | ||
| hasManyParams: meta.params, | ||
| }) | ||
| } | ||
| return { fields } | ||
| } | ||
| /** | ||
| * Create a SelectionScope from an existing SelectionMeta. | ||
| * Useful for converting explicit selections to scope format. | ||
| */ | ||
| static fromSelectionMeta(meta: SelectionMeta): SelectionScope { | ||
| const scope = new SelectionScope() | ||
| scope.mergeFromSelectionMeta(meta) | ||
| return scope | ||
| } | ||
| } | ||
| export { SelectionScope, type HasManyParams } from '@contember/bindx-client' |
+13
-320
@@ -1,320 +0,13 @@ | ||
| import type { ComponentBrand, AnyBrand } from '../brand/ComponentBrand.js' | ||
| import type { EntityWhere, EntityOrderBy } from './queryTypes.js' | ||
| /** | ||
| * Symbol used to store selection metadata on builder objects | ||
| */ | ||
| export const SELECTION_META = Symbol('SELECTION_META') | ||
| /** | ||
| * Options for has-many relation selection with typed filter/orderBy | ||
| * | ||
| * @typeParam TItem - The related entity type (array item type) | ||
| * @typeParam TAlias - Optional alias for the field | ||
| */ | ||
| export interface HasManyOptions< | ||
| TItem = unknown, | ||
| TAlias extends string = string, | ||
| > { | ||
| as?: TAlias | ||
| filter?: EntityWhere<TItem> | ||
| orderBy?: readonly EntityOrderBy<TItem>[] | ||
| limit?: number | ||
| offset?: number | ||
| totalCount?: boolean | ||
| } | ||
| /** | ||
| * Metadata for a selected field (runtime) | ||
| */ | ||
| export interface SelectionFieldMeta { | ||
| /** Original field name in the entity */ | ||
| fieldName: string | ||
| /** Alias (output key) - defaults to fieldName */ | ||
| alias: string | ||
| /** Full path to this field (for JSX components) */ | ||
| path: string[] | ||
| /** Whether this is a relation (has nested fields) */ | ||
| isRelation: boolean | ||
| /** Whether this is an array/has-many relation */ | ||
| isArray: boolean | ||
| /** For relations: nested selection metadata */ | ||
| nested?: SelectionMeta | ||
| /** For has-many: additional parameters */ | ||
| hasManyParams?: { | ||
| filter?: unknown | ||
| orderBy?: unknown | ||
| limit?: number | ||
| offset?: number | ||
| totalCount?: boolean | ||
| } | ||
| } | ||
| /** | ||
| * Runtime metadata for a complete selection | ||
| */ | ||
| export interface SelectionMeta { | ||
| fields: Map<string, SelectionFieldMeta> | ||
| } | ||
| /** | ||
| * Extract item type from array | ||
| */ | ||
| type ArrayItemType<T> = T extends Array<infer U> ? U : never | ||
| /** | ||
| * A fragment defined with the fluent builder | ||
| * | ||
| * @typeParam TModel - The entity model type | ||
| * @typeParam TResult - The selected fields result type | ||
| * @typeParam TBrand - Component brand type for validation (defaults to AnyBrand) | ||
| */ | ||
| export interface FluentFragment< | ||
| TModel, | ||
| TResult, | ||
| TBrand extends AnyBrand = AnyBrand, | ||
| > { | ||
| /** Runtime metadata */ | ||
| readonly __meta: SelectionMeta | ||
| /** Type brand for result type */ | ||
| readonly __resultType: TResult | ||
| /** Type brand for model type */ | ||
| readonly __modelType: TModel | ||
| /** Marker for type checking */ | ||
| readonly __isFragment: true | ||
| /** Component brand for type-level tracking */ | ||
| readonly __brand?: TBrand | ||
| /** Runtime brand symbols for validation */ | ||
| readonly __brands?: Set<symbol> | ||
| /** Runtime roles for validation */ | ||
| readonly __roles?: readonly string[] | ||
| } | ||
| /** | ||
| * Scalar method on selection builder - selects a scalar field | ||
| */ | ||
| export interface ScalarMethod<TEntity, K extends keyof TEntity, TSelected extends object, THasManyParams extends object> { | ||
| /** Select field with original name */ | ||
| (): SelectionBuilder<TEntity, TSelected & Pick<TEntity, K>, THasManyParams> | ||
| /** Select field with alias */ | ||
| <TAlias extends string>(options: { as: TAlias }): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in TAlias]: TEntity[K] }, | ||
| THasManyParams | ||
| > | ||
| } | ||
| /** | ||
| * Has-one method on selection builder - selects a relation to single entity | ||
| */ | ||
| export interface HasOneMethod< | ||
| TEntity, | ||
| K extends keyof TEntity, | ||
| TRelated, | ||
| TSelected extends object, | ||
| THasManyParams extends object, | ||
| > { | ||
| /** Select with inline callback */ | ||
| <TNestedSelected extends object>( | ||
| selector: (builder: SelectionBuilder<TRelated>) => SelectionBuilder<TRelated, TNestedSelected, object>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in K & string]: TNestedSelected }, THasManyParams> | ||
| /** Select with fragment */ | ||
| <TFragmentResult extends object>( | ||
| fragment: FluentFragment<TRelated, TFragmentResult>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in K & string]: TFragmentResult }, THasManyParams> | ||
| /** Select with multiple fragments (merged) - result type is intersection of all fragment result types */ | ||
| <T1 extends object, T2 extends object>( | ||
| fragment1: FluentFragment<TRelated, T1>, | ||
| fragment2: FluentFragment<TRelated, T2>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in K & string]: T1 & T2 }, THasManyParams> | ||
| /** Select with three fragments (merged) */ | ||
| <T1 extends object, T2 extends object, T3 extends object>( | ||
| fragment1: FluentFragment<TRelated, T1>, | ||
| fragment2: FluentFragment<TRelated, T2>, | ||
| fragment3: FluentFragment<TRelated, T3>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in K & string]: T1 & T2 & T3 }, THasManyParams> | ||
| /** Select with alias and callback */ | ||
| <TAlias extends string, TNestedSelected extends object>( | ||
| options: { as: TAlias }, | ||
| selector: (builder: SelectionBuilder<TRelated>) => SelectionBuilder<TRelated, TNestedSelected, object>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in TAlias]: TNestedSelected }, THasManyParams> | ||
| /** Select with alias and fragment */ | ||
| <TAlias extends string, TFragmentResult extends object>( | ||
| options: { as: TAlias }, | ||
| fragment: FluentFragment<TRelated, TFragmentResult>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in TAlias]: TFragmentResult }, THasManyParams> | ||
| /** Select with alias and two fragments (merged) */ | ||
| <TAlias extends string, T1 extends object, T2 extends object>( | ||
| options: { as: TAlias }, | ||
| fragment1: FluentFragment<TRelated, T1>, | ||
| fragment2: FluentFragment<TRelated, T2>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in TAlias]: T1 & T2 }, THasManyParams> | ||
| /** Select with alias and three fragments (merged) */ | ||
| <TAlias extends string, T1 extends object, T2 extends object, T3 extends object>( | ||
| options: { as: TAlias }, | ||
| fragment1: FluentFragment<TRelated, T1>, | ||
| fragment2: FluentFragment<TRelated, T2>, | ||
| fragment3: FluentFragment<TRelated, T3>, | ||
| ): SelectionBuilder<TEntity, TSelected & { [P in TAlias]: T1 & T2 & T3 }, THasManyParams> | ||
| } | ||
| /** | ||
| * Resolve alias from options or fall back to field name | ||
| */ | ||
| type ResolveAlias<K, TOptions> = TOptions extends { as: infer A extends string } ? A : K & string | ||
| /** | ||
| * Has-many method on selection builder - selects a relation to multiple entities | ||
| */ | ||
| export interface HasManyMethod< | ||
| TEntity, | ||
| K extends keyof TEntity, | ||
| TItem, | ||
| TSelected extends object, | ||
| THasManyParams extends object, | ||
| > { | ||
| /** Select with inline callback (no options) */ | ||
| <TNestedSelected extends object>( | ||
| selector: (builder: SelectionBuilder<TItem>) => SelectionBuilder<TItem, TNestedSelected, object>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in K & string]: TNestedSelected[] }, | ||
| THasManyParams & { [P in K & string]: object } | ||
| > | ||
| /** Select with fragment (no options) */ | ||
| <TFragmentResult extends object>( | ||
| fragment: FluentFragment<TItem, TFragmentResult>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in K & string]: TFragmentResult[] }, | ||
| THasManyParams & { [P in K & string]: object } | ||
| > | ||
| /** Select with two fragments (merged, no options) */ | ||
| <T1 extends object, T2 extends object>( | ||
| fragment1: FluentFragment<TItem, T1>, | ||
| fragment2: FluentFragment<TItem, T2>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in K & string]: (T1 & T2)[] }, | ||
| THasManyParams & { [P in K & string]: object } | ||
| > | ||
| /** Select with three fragments (merged, no options) */ | ||
| <T1 extends object, T2 extends object, T3 extends object>( | ||
| fragment1: FluentFragment<TItem, T1>, | ||
| fragment2: FluentFragment<TItem, T2>, | ||
| fragment3: FluentFragment<TItem, T3>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in K & string]: (T1 & T2 & T3)[] }, | ||
| THasManyParams & { [P in K & string]: object } | ||
| > | ||
| /** Select with options and callback */ | ||
| <TOptions extends HasManyOptions<TItem>, TNestedSelected extends object>( | ||
| options: TOptions, | ||
| selector: (builder: SelectionBuilder<TItem>) => SelectionBuilder<TItem, TNestedSelected, object>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in ResolveAlias<K, TOptions>]: TNestedSelected[] }, | ||
| THasManyParams & { [P in ResolveAlias<K, TOptions>]: TOptions } | ||
| > | ||
| /** Select with options and fragment */ | ||
| <TOptions extends HasManyOptions<TItem>, TFragmentResult extends object>( | ||
| options: TOptions, | ||
| fragment: FluentFragment<TItem, TFragmentResult>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in ResolveAlias<K, TOptions>]: TFragmentResult[] }, | ||
| THasManyParams & { [P in ResolveAlias<K, TOptions>]: TOptions } | ||
| > | ||
| /** Select with options and two fragments (merged) */ | ||
| <TOptions extends HasManyOptions<TItem>, T1 extends object, T2 extends object>( | ||
| options: TOptions, | ||
| fragment1: FluentFragment<TItem, T1>, | ||
| fragment2: FluentFragment<TItem, T2>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in ResolveAlias<K, TOptions>]: (T1 & T2)[] }, | ||
| THasManyParams & { [P in ResolveAlias<K, TOptions>]: TOptions } | ||
| > | ||
| /** Select with options and three fragments (merged) */ | ||
| <TOptions extends HasManyOptions<TItem>, T1 extends object, T2 extends object, T3 extends object>( | ||
| options: TOptions, | ||
| fragment1: FluentFragment<TItem, T1>, | ||
| fragment2: FluentFragment<TItem, T2>, | ||
| fragment3: FluentFragment<TItem, T3>, | ||
| ): SelectionBuilder< | ||
| TEntity, | ||
| TSelected & { [P in ResolveAlias<K, TOptions>]: (T1 & T2 & T3)[] }, | ||
| THasManyParams & { [P in ResolveAlias<K, TOptions>]: TOptions } | ||
| > | ||
| } | ||
| /** | ||
| * Maps entity fields to their corresponding builder methods | ||
| */ | ||
| type SelectionBuilderMethods<TEntity, TSelected extends object, THasManyParams extends object> = { | ||
| [K in keyof TEntity]-?: TEntity[K] extends Array<infer U> | ||
| ? HasManyMethod<TEntity, K, U, TSelected, THasManyParams> | ||
| : NonNullable<TEntity[K]> extends object | ||
| ? HasOneMethod<TEntity, K, NonNullable<TEntity[K]>, TSelected, THasManyParams> | ||
| : ScalarMethod<TEntity, K, TSelected, THasManyParams> | ||
| } | ||
| /** | ||
| * The main fluent selection builder interface. | ||
| * | ||
| * @typeParam TEntity - The entity type being selected from | ||
| * @typeParam TSelected - Accumulated type of selected fields (grows with each selection) | ||
| * @typeParam THasManyParams - Record tracking has-many parameters for alias consistency | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // Select scalar fields | ||
| * e.id().title().content() | ||
| * // Type: { id: string, title: string, content: string } | ||
| * | ||
| * // Select with alias | ||
| * e.title({ as: 'headline' }) | ||
| * // Type: { headline: string } | ||
| * | ||
| * // Select has-one relation | ||
| * e.author(a => a.name().email()) | ||
| * // Type: { author: { name: string, email: string } } | ||
| * | ||
| * // Select has-many with options | ||
| * e.tags({ filter: { active: true } }, t => t.name()) | ||
| * // Type: { tags: { name: string }[] } | ||
| * ``` | ||
| */ | ||
| export type SelectionBuilder<TEntity, TSelected extends object = object, THasManyParams extends object = object> = | ||
| SelectionBuilderMethods<TEntity, TSelected, THasManyParams> & { | ||
| [SELECTION_META]: SelectionMeta | ||
| /** Type brand for the selected result */ | ||
| readonly __selected: TSelected | ||
| } | ||
| /** | ||
| * Extracts the selected type from a SelectionBuilder | ||
| */ | ||
| export type InferSelection<T> = T extends SelectionBuilder<infer _E, infer S, infer _P> ? S : never | ||
| /** | ||
| * Type for the fluent definer function used in useEntity/useEntityList | ||
| */ | ||
| export type FluentDefiner<TModel, TResult extends object> = ( | ||
| builder: SelectionBuilder<TModel>, | ||
| ) => SelectionBuilder<TModel, TResult, object> | ||
| export { | ||
| SELECTION_META, | ||
| type SelectionBuilder, | ||
| type SelectionMeta, | ||
| type SelectionFieldMeta, | ||
| type FluentFragment, | ||
| type FluentDefiner, | ||
| type HasManyOptions, | ||
| type InferSelection, | ||
| type ScalarMethod, | ||
| type HasOneMethod, | ||
| type HasManyMethod, | ||
| } from '@contember/bindx-client' |
@@ -1,56 +0,1 @@ | ||
| import type { HasManyParams } from '../selection/SelectionScope.js' | ||
| /** | ||
| * Generates an alias for a has-many relation based on field name and parameters. | ||
| * | ||
| * If no parameters are provided or all are undefined, returns the fieldName as-is. | ||
| * Otherwise, generates a deterministic alias by hashing the parameters. | ||
| * | ||
| * @param fieldName - The original field name | ||
| * @param params - Optional has-many parameters (filter, orderBy, limit, offset) | ||
| * @returns The alias to use for this has-many relation | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // No params - returns fieldName | ||
| * generateHasManyAlias('tags') // => 'tags' | ||
| * | ||
| * // With filter - generates unique alias | ||
| * generateHasManyAlias('tags', { filter: { active: true } }) // => 'tags_a7x9k2' | ||
| * | ||
| * // Different params - different aliases | ||
| * generateHasManyAlias('tags', { filter: { active: false } }) // => 'tags_b3m1p8' | ||
| * ``` | ||
| */ | ||
| export function generateHasManyAlias(fieldName: string, params?: HasManyParams): string { | ||
| if (!params) { | ||
| return fieldName | ||
| } | ||
| const { filter, orderBy, limit, offset } = params | ||
| // If all params are undefined, return fieldName | ||
| if (filter === undefined && orderBy === undefined && limit === undefined && offset === undefined) { | ||
| return fieldName | ||
| } | ||
| // Serialize parameters deterministically | ||
| const serialized = JSON.stringify({ | ||
| f: filter, | ||
| o: orderBy, | ||
| l: limit, | ||
| s: offset, | ||
| }) | ||
| // Simple djb2 hash algorithm | ||
| let hash = 5381 | ||
| for (let i = 0; i < serialized.length; i++) { | ||
| hash = ((hash << 5) + hash) + serialized.charCodeAt(i) | ||
| hash = hash & hash // Convert to 32-bit integer | ||
| } | ||
| // Convert to base36 and take first 6 characters for compact representation | ||
| const hashStr = Math.abs(hash).toString(36).slice(0, 6) | ||
| return `${fieldName}_${hashStr}` | ||
| } | ||
| export { generateHasManyAlias } from '@contember/bindx-client' |
716891
-14.25%17438
-13.73%+ Added
+ Added
- Removed
- Removed