import { LinkedQuery } from './SelectQuery.js'; import { NodeShape, PropertyShape } from '../shapes/SHACL.js'; import { Shape } from '../shapes/Shape.js'; import { ShapeSet } from '../collections/ShapeSet.js'; export type Prettify = T extends infer R ? { [K in keyof R]: R[K]; } : never; type WithId = U & { id: string; }; type IsPlainObject = T extends object ? T extends any[] ? false : T extends Function ? false : T extends Date ? false : T extends RegExp ? false : T extends Error ? false : T extends null ? false : T extends undefined ? false : T extends object ? true : false : false; type RecursiveTransform = T extends string | number | boolean | Date | null | undefined ? T : T extends Array ? UpdatedSet>, IsCreate> : IsSetModification extends true ? ModifiedSet : IsPlainObject extends true ? WithId<{ [K in keyof T]: Prettify>; }> : T; type UpdatedSet = IsCreate extends true ? U[] : { updatedTo: U[]; }; type IsSetModification = T extends { add?: any; remove?: any; } ? true : false; type AddedType = T extends { add: (infer U)[]; } ? U : T extends { add: infer U; } ? U : never; type RemovedType = T extends { remove: (infer U)[]; } ? U : T extends { remove: infer U; } ? U : never; type ModifiedSet = { added: AddId, IsCreate>[]; removed: AddId, IsCreate>[]; }; export type AddId = Prettify>; export type UpdatePartial = UpdateNodeDescription | NodeReferenceValue; type UpdateNodeDescription = Partial]: ShapePropValueToUpdatePartial; }, 'node' | 'nodeShape' | 'namedNode' | 'targetClass'>>; type KeysWithoutFunctions = { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]; type ShapePropValueToUpdatePartial = ShapeProperty extends Shape ? UpdatePartial : ShapeProperty extends ShapeSet ? SetUpdateValue : ShapeProperty; type SetUpdateValue = UpdatePartial[] | SetModification; export type SetModification = { add?: UpdatePartial[] | UpdatePartial; remove?: UpdatePartial[] | UpdatePartial; }; export type SetModificationValue = { $add?: UpdatePartial[]; $remove?: NodeReferenceValue[]; }; type UnsetValue = undefined; export type LiteralUpdateValue = string | number | boolean | Date; export type PropUpdateValue = SinglePropertyUpdateValue | SinglePropertyUpdateValue[] | SetModificationValue; export type SinglePropertyUpdateValue = NodeDescriptionValue | NodeReferenceValue | LiteralUpdateValue | UnsetValue; export type NodeDescriptionValue = { shape: NodeShape; fields: UpdateNodePropertyValue[]; /** * The id of the node to be created. * Optional, if not provided a new id will be generated. */ __id?: string; }; export type UpdateNodePropertyValue = { prop: PropertyShape; val: PropUpdateValue; }; export type NodeReferenceValue = { id: string; }; export type ShapeReferenceValue = { id: string; shape: NodeReferenceValue; }; export declare abstract class QueryFactory { getQueryObject(): LinkedQuery | Promise; } export declare function isSetModificationValue(value: any): value is SetModificationValue; /** * Checks if the new count of values for a property is within the min and max count of the property shape. * Throws an error if the count is not within the range. * @param propShape * @param numValues */ export declare function checkNewCount(propShape: PropertyShape, numValues: number): void; export {};