import { Focus } from 'jsonata'; import { type MinimatchOptions } from 'minimatch'; import { AnyType } from '../types.js'; import { BNLike } from './bignumber.js'; export { MinimatchOptions as GlobOptions } from 'minimatch'; export type JsonEvaluator = ((input: AnyType, bindings?: Record) => Promise) & { query: string; variables?: Record; }; export type JsonQueryFunction = { implementation: (this: Focus, ...args: any[]) => any; signature?: string; }; /** * Trait type/value pair */ export type Trait = { trait_type: string; value: AnyType; }; /** * Filter to match a list of trait type/value pairs against an individual token * using `and` or `or` condition */ export type TraitFilterPerToken = { /** * Minimal count of unique tokens that match the traits */ minCount?: BNLike; /** * Maximal count of unique tokens that match the traits */ maxCount?: BNLike; /** * Use `and` or `or` logic. * - and: The token needs to have all trait type/value pairs * - or: The token needs to have at least one of the trait type/value pairs */ condition?: 'and' | 'or'; /** * A list of trait type/value pairs to match individual tokens */ traits: Trait[]; }; /** * Trait based filter for all tokens owned by an account */ export type TraitFilterForAllTokens = { /** * Asset uri */ asset?: string; /** * Token id(s) separated by `,`. It can include ranges and wildcards. */ tokenId?: string; /** * Use `and` or `or` logic * - and: All filters need to be satisfied by tokens owned by an account * - or: At least one of the filters need to be satisfied by tokens owned by * an account */ condition?: 'and' | 'or'; /** * A list of filters at per token level to qualify individual tokens */ filters: TraitFilterPerToken[]; }; /** * Quantity based balance filter */ export type BalanceFilter = { /** * Asset uri */ asset?: string; /** * Minimal count */ minCount?: BNLike; /** * Maximal count */ maxCount?: BNLike; /** * Token id patterns */ tokenId?: string; }; /** * Global jsonata functions */ export declare const globalJsonQueryFunctions: Record; /** * Create a jsonata query expression * @param query - JSONata query string * @param bindings - Optional bindings for variables * @returns */ export declare function jsonQuery(query: string, bindings?: Record): JsonEvaluator; /** * Parse a string as an array of ranges * @param ids - A string that lists items and/or item ranges, such as `1`, * `1,2,5`, or `1-2,4,6-8` * * @example * - '1' -> ['1'] * - '1,2' -> ['1','2'] * - '2-3' -> [['2','3']] * - '2-3,5' -> [['2','3'], '5'] * - '*,5' -> ['*', '5'] * - '5??' -> ['5??'] * - '-5' -> [['','5']] * - '5-' -> [['5','']] * @returns */ export declare function parseRanges(ids: string): ([string, string] | string)[]; export declare function isInRanges(value: unknown, ranges: string): boolean; export declare function isGlobPattern(str: string): boolean; /** * Convert a glob pattern to RegExp * @param pattern - Glob pattern * @param options - Options * @returns */ export declare function globToRegExp(pattern: string, options?: MinimatchOptions): false | import("minimatch").MMRegExp; /** * Convert a wildcard pattern to RegExp * @param pattern - A wildcard string with `*` and `?` as special characters. * - `*` matches zero or more characters except `.` and `:` * - `?` matches exactly one character except `.` and `:` */ export declare function wildcardToRegExp(pattern: string, excludes?: string): RegExp; /** * Parse token ids and ranges into a list of ids * @param ids - Token ids such as `1,3-4,100` * @returns */ export declare function expandTokenIds(ids: string, options?: { reportErrors?: boolean; }): string[] | undefined;