@ucast/core
Version:
git@github.com:stalniy/ucast.git
1 lines • 20.2 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Condition.ts","../../src/utils.ts","../../src/builder.ts","../../src/interpreter.ts","../../src/parsers/defaultInstructionParsers.ts","../../src/parsers/ObjectQueryParser.ts","../../src/translator.ts"],"sourcesContent":["export interface Note<T> {\n type: string\n message?: string\n originalValue?: T\n}\n\nexport abstract class Condition<T = unknown> {\n private _notes!: Note<T>[];\n\n constructor(\n public readonly operator: string,\n public readonly value: T\n ) {\n Object.defineProperty(this, '_notes', {\n writable: true\n });\n }\n\n get notes(): readonly Note<T>[] | undefined {\n return this._notes;\n }\n\n addNote(note: Note<T>) {\n this._notes = this._notes || [];\n this._notes.push(note);\n }\n}\n\nexport class DocumentCondition<T> extends Condition<T> {\n}\n\nexport class CompoundCondition<T extends Condition = Condition> extends DocumentCondition<T[]> {\n constructor(operator: string, conditions: T[]) {\n if (!Array.isArray(conditions)) {\n throw new Error(`\"${operator}\" operator expects to receive an array of conditions`);\n }\n\n super(operator, conditions);\n }\n}\n\nexport const ITSELF = '__itself__';\nexport class FieldCondition<T = unknown> extends Condition<T> {\n public readonly field!: string | typeof ITSELF;\n\n constructor(operator: string, field: string | typeof ITSELF, value: T) {\n super(operator, value);\n this.field = field;\n }\n}\n\nexport const NULL_CONDITION = new DocumentCondition('__null__', null);\nexport type ConditionValue<T> = T extends Condition<infer V> ? V : unknown;\n","import { Condition, CompoundCondition, NULL_CONDITION } from './Condition';\n\nconst hasOwn: (object: object, key: PropertyKey) => boolean = (Object as {\n hasOwn?: (object: object, key: PropertyKey) => boolean\n}).hasOwn || ((object, key) => Object.prototype.hasOwnProperty.call(object, key));\n\nexport function isCompound(operator: string, condition: Condition): condition is CompoundCondition {\n return condition instanceof CompoundCondition && condition.operator === operator;\n}\n\nfunction flattenConditions<T extends Condition>(\n operator: string,\n conditions: T[]\n) {\n let flatConditions: T[] | undefined;\n\n for (let i = 0, length = conditions.length; i < length; i++) {\n const currentNode = conditions[i];\n\n if (currentNode instanceof CompoundCondition) {\n if (currentNode.operator !== operator) {\n if (flatConditions) flatConditions.push(currentNode);\n continue;\n }\n\n if (currentNode.value.length === 0) {\n continue;\n }\n\n if (!flatConditions) {\n flatConditions = conditions.slice(0, i);\n }\n\n const nestedConditions = currentNode.value as T[];\n for (let j = 0, nestedLength = nestedConditions.length; j < nestedLength; j++) {\n flatConditions.push(nestedConditions[j]);\n }\n } else if (flatConditions) {\n flatConditions.push(currentNode);\n }\n }\n\n return flatConditions || conditions;\n}\n\nexport function optimizedCompoundCondition<T extends Condition>(operator: string, conditions: T[]) {\n if (conditions.length === 1) return conditions[0];\n if (conditions.length === 0) return new CompoundCondition(operator, conditions);\n\n const optimized = flattenConditions(operator, conditions);\n if (optimized.length === 1) return optimized[0];\n if (optimized.length === 0) return new CompoundCondition(operator, optimized);\n return new CompoundCondition(operator, optimized);\n}\n\nexport const identity = <T>(x: T) => x;\nexport const object = () => Object.create(null);\n\nexport const ignoreValue: IgnoreValue = Object.defineProperty(object(), '__@type@__', {\n value: 'ignore value'\n});\nexport interface IgnoreValue {\n readonly ['__@type@__']: 'ignore value'\n}\n\nexport function hasOperators<T>(\n value: any,\n instructions: Record<string, unknown>,\n skipIgnore = false,\n): value is T {\n if (!value || value && value.constructor !== Object) {\n return false;\n }\n\n for (const prop in value) {\n const hasProp = hasOwn(value, prop) && hasOwn(instructions, prop);\n if (hasProp && (!skipIgnore || value[prop] !== ignoreValue)) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function objectKeysSkipIgnore(anyObject: Record<string, unknown>) {\n const keys: string[] = [];\n for (const key in anyObject) {\n if (hasOwn(anyObject, key) && anyObject[key] !== ignoreValue) {\n keys.push(key);\n }\n }\n\n return keys;\n}\n\nexport function pushIfNonNullCondition(conditions: Condition[], condition: Condition) {\n if (condition !== NULL_CONDITION) {\n conditions.push(condition);\n }\n}\n","import { Condition } from './Condition';\nimport { optimizedCompoundCondition } from './utils';\n\nexport const buildAnd = (conditions: Condition[]) => optimizedCompoundCondition('and', conditions);\nexport const buildOr = (conditions: Condition[]) => optimizedCompoundCondition('or', conditions);\n","import { Condition } from './Condition';\n\ntype ArgsExceptLast<F extends (...args: any[]) => any> =\n F extends (a: any, c: any) => any\n ? Parameters<(condition: Condition) => 0>\n : F extends (a: any, b: any, c: any) => any\n ? Parameters<(condition: Condition, value: Parameters<F>[1]) => 0>\n : Parameters<(\n condition: Condition,\n value: Parameters<F>[1],\n options: Parameters<F>[2],\n ...args: unknown[]\n ) => 0>;\n\nexport type Interpreter<T extends Condition, R> = (condition: T, ...args: any[]) => R;\nexport type AnyInterpreter = Interpreter<any, any>;\nexport interface InterpretationContext<T extends AnyInterpreter> {\n interpret(...args: ArgsExceptLast<T>): ReturnType<T>;\n}\n\nfunction getInterpreter<T extends Record<string, AnyInterpreter>>(\n interpreters: T,\n operator: keyof T\n) {\n const interpret = interpreters[operator];\n\n if (typeof interpret !== 'function') {\n throw new Error(`Unable to interpret \"${String(operator)}\" condition. Did you forget to register interpreter for it?`);\n }\n\n return interpret;\n}\n\nexport interface InterpreterOptions {\n numberOfArguments?: 1 | 2 | 3\n getInterpreterName?(condition: Condition, context: this): string\n}\n\nfunction defaultInterpreterName(condition: Condition) {\n return condition.operator;\n}\n\nexport function createInterpreter<T extends AnyInterpreter, U extends {} = {}>(\n interpreters: Record<string, T>,\n rawOptions?: U\n) {\n const options = rawOptions as U & InterpreterOptions;\n const getInterpreterName = options && options.getInterpreterName || defaultInterpreterName;\n let interpret: InterpretationContext<T>['interpret'];\n\n switch (options ? options.numberOfArguments : 0) {\n case 1:\n interpret = ((condition) => {\n const interpreterName = getInterpreterName(condition, options);\n const interpretOperator = getInterpreter(interpreters, interpreterName);\n return interpretOperator(condition, defaultContext); \n });\n break;\n case 3:\n interpret = ((\n condition: ArgsExceptLast<T>[0],\n value: ArgsExceptLast<T>[1],\n params: ArgsExceptLast<T>[2]\n ) => {\n const interpreterName = getInterpreterName(condition, options);\n const interpretOperator = getInterpreter(interpreters, interpreterName);\n return interpretOperator(condition, value, params, defaultContext); \n }) as unknown as InterpretationContext<T>['interpret'];\n break;\n default:\n interpret = ((condition, value) => {\n const interpreterName = getInterpreterName(condition, options);\n const interpretOperator = getInterpreter(interpreters, interpreterName);\n return interpretOperator(condition, value, defaultContext); \n }) as InterpretationContext<T>['interpret'];\n break;\n }\n\n const defaultContext = {\n ...options,\n interpret,\n } as InterpretationContext<T> & U;\n\n return defaultContext.interpret;\n}\n","import {\n FieldCondition,\n CompoundCondition,\n DocumentCondition,\n} from '../Condition';\nimport {\n DocumentInstruction,\n CompoundInstruction,\n FieldInstruction,\n} from '../types';\n\ninterface DefaultParsers {\n compound: Exclude<CompoundInstruction['parse'], undefined>,\n field: Exclude<FieldInstruction['parse'], undefined>,\n document: Exclude<DocumentInstruction['parse'], undefined>\n}\n\nexport const defaultInstructionParsers: DefaultParsers = {\n compound(instruction, value, context) {\n const queries = Array.isArray(value) ? value : [value];\n const conditions = queries.map(query => context.parse(query));\n return new CompoundCondition(instruction.name, conditions);\n },\n field(instruction, value, context) {\n return new FieldCondition(instruction.name, context.field, value);\n },\n document(instruction, value) {\n return new DocumentCondition(instruction.name, value);\n }\n};\n","import { Condition } from '../Condition';\nimport {\n NamedInstruction,\n ParsingInstruction,\n FieldParsingContext,\n ParsingContext,\n} from '../types';\nimport { buildAnd } from '../builder';\nimport { defaultInstructionParsers } from './defaultInstructionParsers';\nimport {\n identity,\n hasOperators,\n object,\n pushIfNonNullCondition,\n objectKeysSkipIgnore,\n} from '../utils';\n\nexport type FieldQueryOperators<T extends {}> = {\n [K in keyof T]: T[K] extends {} ? T[K] : never\n}[keyof T];\n\ntype ParsingInstructions = Record<string, NamedInstruction>;\n\nexport interface QueryOptions {\n operatorToConditionName?(name: string): string\n defaultOperatorName?: string\n fieldContext?: Record<string, unknown>\n documentContext?: Record<string, unknown>\n useIgnoreValue?: boolean\n mergeFinalConditions?(conditions: Condition[]): Condition\n}\n\nexport type ObjectQueryFieldParsingContext = ParsingContext<FieldParsingContext & {\n query: {},\n hasOperators<T>(value: unknown): value is T\n}>;\n\nexport class ObjectQueryParser<\n T extends Record<any, any>,\n U extends FieldQueryOperators<T> = FieldQueryOperators<T>\n> {\n private readonly _instructions: ParsingInstructions;\n private _fieldInstructionContext: ObjectQueryFieldParsingContext;\n private _documentInstructionContext: ParsingContext<{ query: {} }>;\n private readonly _options: Required<\n Pick<QueryOptions, 'operatorToConditionName' | 'defaultOperatorName' | 'mergeFinalConditions'>\n >;\n\n private readonly _objectKeys: typeof Object.keys;\n\n constructor(instructions: Record<string, ParsingInstruction>, options: QueryOptions = object()) {\n this.parse = this.parse.bind(this);\n this._options = {\n operatorToConditionName: options.operatorToConditionName || identity,\n defaultOperatorName: options.defaultOperatorName || 'eq',\n mergeFinalConditions: options.mergeFinalConditions || buildAnd,\n };\n this._instructions = Object.keys(instructions).reduce((all, name) => {\n all[name] = { name: this._options.operatorToConditionName(name), ...instructions[name] };\n return all;\n }, {} as ParsingInstructions);\n this._fieldInstructionContext = {\n ...options.fieldContext,\n field: '',\n query: {},\n parse: this.parse,\n hasOperators: <T>(value: unknown): value is T => hasOperators(\n value,\n this._instructions,\n options.useIgnoreValue\n ),\n };\n this._documentInstructionContext = {\n ...options.documentContext,\n parse: this.parse,\n query: {}\n };\n this._objectKeys = options.useIgnoreValue ? objectKeysSkipIgnore : Object.keys;\n }\n\n setParse(parse: this['parse']) {\n this.parse = parse;\n this._fieldInstructionContext.parse = parse;\n this._documentInstructionContext.parse = parse;\n }\n\n protected parseField(field: string, operator: string, value: unknown, parentQuery: {}) {\n const instruction = this._instructions[operator];\n\n if (!instruction) {\n throw new Error(`Unsupported operator \"${operator}\"`);\n }\n\n if (instruction.type !== 'field') {\n throw new Error(`Unexpected ${instruction.type} operator \"${operator}\" at field level`);\n }\n\n this._fieldInstructionContext.field = field;\n this._fieldInstructionContext.query = parentQuery;\n\n return this.parseInstruction(instruction, value, this._fieldInstructionContext);\n }\n\n protected parseInstruction(\n instruction: NamedInstruction,\n value: unknown,\n context: ParsingContext<{}>\n ) {\n if (typeof instruction.validate === 'function') {\n instruction.validate(instruction, value);\n }\n\n const parse: typeof instruction.parse = instruction.parse\n || defaultInstructionParsers[instruction.type as keyof typeof defaultInstructionParsers];\n return parse(instruction, value, context);\n }\n\n protected parseFieldOperators(field: string, value: U) {\n const conditions: Condition[] = [];\n const keys = this._objectKeys(value);\n\n for (let i = 0, length = keys.length; i < length; i++) {\n const op = keys[i];\n const instruction = this._instructions[op];\n\n if (!instruction) {\n throw new Error(`Field query for \"${field}\" may contain only operators or a plain object as a value`);\n }\n\n const condition = this.parseField(field, op, value[op as keyof U], value);\n pushIfNonNullCondition(conditions, condition);\n }\n\n return conditions;\n }\n\n parse<Q extends T>(query: Q): Condition {\n const conditions = [];\n const keys = this._objectKeys(query);\n\n this._documentInstructionContext.query = query;\n\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n const value = query[key];\n const instruction = this._instructions[key];\n\n if (instruction) {\n if (instruction.type !== 'document' && instruction.type !== 'compound') {\n throw new Error(`Cannot use parsing instruction for operator \"${key}\" in \"document\" context as it is supposed to be used in \"${instruction.type}\" context`);\n }\n\n pushIfNonNullCondition(\n conditions,\n this.parseInstruction(instruction, value, this._documentInstructionContext)\n );\n } else if (this._fieldInstructionContext.hasOperators<U>(value)) {\n conditions.push(...this.parseFieldOperators(key, value));\n } else {\n pushIfNonNullCondition(\n conditions,\n this.parseField(key, this._options.defaultOperatorName, value, query)\n );\n }\n }\n\n return this._options.mergeFinalConditions(conditions);\n }\n}\n","import { Condition } from './Condition';\nimport { Parse } from './types';\nimport { AnyInterpreter } from './interpreter';\n\ntype Bound<T> = T extends (first: Condition, ...args: infer A) => any\n ? { (...args: A): ReturnType<T>, ast: Condition; }\n : never;\n\nexport function createTranslatorFactory<Lang, Interpreter extends AnyInterpreter>(\n parse: Parse<Lang>,\n interpret: Interpreter\n) {\n return (query: Lang, ...args: unknown[]): Bound<Interpreter> => {\n const ast = parse(query, ...args);\n const translate = (interpret as any).bind(null, ast);\n Object.defineProperty(translate, 'ast', {\n value: ast\n });\n return translate;\n };\n}\n"],"mappings":"AAMA,IAAsB,EAAtB,KAA6C,CAG3C,YACE,EACA,EACA,CAFgB,KAAA,SAAA,EACA,KAAA,MAAA,EAEhB,OAAO,eAAe,KAAM,SAAU,CACpC,SAAU,GACX,CAAC,CAGJ,IAAI,OAAwC,CAC1C,OAAO,KAAK,OAGd,QAAQ,EAAe,CACrB,KAAK,OAAS,KAAK,QAAU,EAAE,CAC/B,KAAK,OAAO,KAAK,EAAK,GAIb,EAAb,cAA0C,CAAa,GAG1C,EAAb,cAAwE,CAAuB,CAC7F,YAAY,EAAkB,EAAiB,CAC7C,GAAI,CAAC,MAAM,QAAQ,EAAW,CAC5B,MAAU,MAAM,IAAI,EAAS,sDAAsD,CAGrF,MAAM,EAAU,EAAW,GAI/B,MAAa,EAAS,aACtB,IAAa,EAAb,cAAiD,CAAa,CAG5D,YAAY,EAAkB,EAA+B,EAAU,CACrE,MAAM,EAAU,EAAM,CACtB,KAAK,MAAQ,IAIjB,MAAa,EAAiB,IAAI,EAAkB,WAAY,KAAK,CCjD/D,EAAyD,OAE5D,UAAY,EAAQ,IAAQ,OAAO,UAAU,eAAe,KAAK,EAAQ,EAAI,EAEhF,SAAgB,EAAW,EAAkB,EAAsD,CACjG,OAAO,aAAqB,GAAqB,EAAU,WAAa,EAG1E,SAAS,EACP,EACA,EACA,CACA,IAAI,EAEJ,IAAK,IAAI,EAAI,EAAG,EAAS,EAAW,OAAQ,EAAI,EAAQ,IAAK,CAC3D,IAAM,EAAc,EAAW,GAE/B,GAAI,aAAuB,EAAmB,CAC5C,GAAI,EAAY,WAAa,EAAU,CACjC,GAAgB,EAAe,KAAK,EAAY,CACpD,SAGF,GAAI,EAAY,MAAM,SAAW,EAC/B,SAGG,IACH,EAAiB,EAAW,MAAM,EAAG,EAAE,EAGzC,IAAM,EAAmB,EAAY,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