export interface FunctionLibrary { [name: string]: (...args: any[]) => any } interface Looper {} type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never interface AbstractGraph { $isCarmiGraph: true } export interface GraphBase extends AbstractGraph { $value: NativeType } export type AsNative = T extends GraphBase ? N : T export type Argument = AsNative | GraphBase | T type AsNativeRecursive = AsNative extends any[] ? AsNative : AsNative extends object ? { [k in keyof AsNative]: AsNative[k]> } : AsNative type BoundFunction = unknown extends A ? (F extends (...args: infer Args) => infer R ? F : never) : unknown extends B ? (F extends (a: A, ...args: infer Args) => infer R ? (...args: Args) => R : never) : unknown extends C ? (F extends (a: A, b: B, ...args: infer Args) => infer R ? (...args: Args) => R : never) : unknown extends D ? (F extends (a: A, b: B, c: C, ...args: infer Args) => infer R ? (...args: Args) => R : never) : unknown extends E ? (F extends (a: A, b: B, c: C, d: D, ...args: infer Args) => infer R ? (...args: Args) => R : never) : never export interface BoolGraph extends GraphImpl {} export interface FunctionGraph extends GraphImpl {} /** * Graph */ interface GraphImpl extends GraphBase { /** * Returns a graph that resolves to the return type of a named function from the function library. * * @param func A function name from the function library * @param args Args to pass, in addition to the value resolved from "" */ call< FunctionName extends keyof F, Arguments extends F[FunctionName] extends (firstArg: NativeType, ...args: infer Args) => any ? Args : never >( func: FunctionName, ...args: Arguments extends (infer A)[] ? Argument[] : never ): Graph, F> /** * Like call but will exectue even if the parameters mutation resulted in the same values. * **Please note**: `effect(func, args)` is a leaf and ends the chain, and its return value cannot be used. */ effect< FunctionName extends keyof F, Arguments extends F[FunctionName] extends (firstArg: NativeType, ...args: infer Args) => any ? Args : never >( func: FunctionName, ...args: Arguments extends (infer A)[] ? Argument[] : never ): void /** * Creates a function that invokes functionName from the function library with args prepended to the arguments it receives. */ bind(func: FunctionName): FunctionGraph, F> bind( func: FunctionName, a: A ): FunctionGraph, F> bind( func: FunctionName, a: A, b: B ): FunctionGraph, F> bind( func: FunctionName, a: A, b: B, c: C ): FunctionGraph, F> bind( func: FunctionName, a: A, b: B, c: C, d: D ): FunctionGraph, F> /** * Generates a breakpoint (debugger clause), continuing the graph. */ breakpoint(): this /** * Generates a console statement, continuing the chain. * @param label if provided, label is printed alongside the trace info */ trace(label?: string): this /** * Generates a console statement, continuing the chain if condition resolves to true. * @param condition * @sugar */ conditionalTrace(condition: FunctionName): this /** * Triggers a breakpoint if the condition resolves to true. * @param condition * @sugar */ conditionalBreakpoint(condition: FunctionName): this /** * Lets you tap into the value and traces the result of tapFn. * @param tapFn * @sugar */ tapTrace(tapFn: FunctionName): this /** * Resolves to `!NativeType`. */ not(): BoolGraph /** * Resolves to either consequence or alternate, based on the value of NativeType. * Note that both options will be evaluated, even if one of them is not semantically possible. * * @param consequence graph if NativeType value is truthy * @param alternate graph is NativeType value is falsey */ ternary( consequence: Consequence, alternate: Alternate ): Graph< AsNative extends AsNative ? Consequence : AsNative extends AsNative ? Alternate : Consequence extends null ? Alternate : Alternate extends null ? Consequence : Alternate | Consequence, F > /** * Resolves to the case that matches equals to the boxed value. * * @param caseTuples An array of pairs between a value and a consequent * @param defaultCase The graph to return in case no given case matches the boxed value * @sugar */ switch, any]>( caseTuples: Array, defaultCase: DefaultCase ): Graph | Graph, infer Result] ? Result : never, F> /** * Returns a boolean graph that resolves to the value of (NativeType === other). * @param other */ eq(other: Argument): BoolGraph /** * When run on a key inside a recursiveMap/recursiveMapValues functor, * will return the resolved value for a given key. NativeType allows returning values for indicies of a map based on other values. * @param loop passed to the functor of recursiveMap/recursiveMapValues */ recur(loop: Looper): ValueType /** * Returns true if the context is of type `Array`. */ isArray(): BoolGraph /** * Returns true if the context is `undefined`. */ isUndefined(): BoolGraph /** * Returns true if the context is of type `boolean`. */ isBoolean(): BoolGraph /** * Returns true if the context is of type `number`. */ isNumber(): BoolGraph /** * Returns true if the context is of type `string`. */ isString(): BoolGraph } /** * Number */ export interface NumberGraph extends GraphImpl { /** * Resolves to (NativeType > other). * @param other */ gt(other: Argument): BoolGraph /** * Resolves to (NativeType >= other). * @param other */ gte(other: Argument): BoolGraph /** * Resolves to (NativeType < other). * @param other */ lt(other: Argument): BoolGraph /** * Resolves to (NativeType <= other). * @param other */ lte(other: Argument): BoolGraph /** * Resolves to (NativeType - other). * @param other */ minus(value: Argument): NumberGraph /** * Resolves to (NativeType * other). * @param other * @example * const { root } = require('carmi') * const instance = createInstance({ * output: root.mult(2) * }, 2) * instance.output //4 */ mult(value: Argument): NumberGraph /** * Resolves to (NativeType + other). * @param other */ plus(num: Argument): NumberGraph plus(str: Argument): StringGraph /** * Resolves to (NativeType / other). * @param other */ div(value: Argument): NumberGraph /** * Resolves to (NativeType % other). * @param other */ mod(value: Argument): NumberGraph /** * Creates a number array graph. * * @param start number to start from * @param skip number to skip between values * @returns a number array graph, with size equal to resolved "NativeType" */ range(start?: Argument, skip?: Argument): NumberGraph[] /** * Resolves to Math.floor(NativeType). */ floor(): NumberGraph /** * Resolves to Math.ceil(NativeType). */ ceil(): NumberGraph /** * Resolves to Math.round(NativeType). */ round(): NumberGraph } /** * String */ export interface StringGraph extends GraphImpl { /** * Resolves to (NativeType.startsWith(s)). * @param s other string */ startsWith(s: Argument): BoolGraph /** * Resolves to (NativeType.endsWith(s)). * @param s other string */ endsWith(s: Argument): BoolGraph /** * Resolves to (NativeType + s). * @param other other string */ plus(other: Argument): StringGraph /** * Resolves to an array graph, like NativeType.split(separator). * @param separator */ split(separator: Argument): ArrayGraph /** * Resolves to NativeType.toUpperCase(). */ toUpperCase(): StringGraph /** * Resolves to NativeType.toLowerCase(). */ toLowerCase(): StringGraph /** * Returns the string length. */ stringLength(): NumberGraph /** * Resolves `String.substring`. * @param start * @param end * * Resolves String.substring */ substring(start: Argument, end: Argument): StringGraph /** * Resolves to parseInt(NativeType, radix). * @param radix base (10, 16 etc) */ parseInt(radix?: number): NumberGraph /** * Resolves to parseFloat(NativeType). */ parseFloat(): NumberGraph } /** * Array or Object */ interface ArrayOrObjectGraphImpl extends GraphImpl { /** * Returns the specific key/index from the object/array. */ get( key: K | AbstractGraph ): K extends AbstractGraph ? Graph : Graph /** * Checks if the object or array graph is empty. @sugar */ isEmpty(): BoolGraph /** * Resolves to the deep value provided by the path. * @param path * @sugar */ getIn(path: [Argument]): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, V0 = NonNullable >( path: [Argument, Argument] ): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, K2 extends keyof V1, V0 = NonNullable, V1 = NonNullable >( path: [Argument, Argument, Argument] ): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, K2 extends keyof V1, K3 extends keyof V2, V0 = NonNullable, V1 = NonNullable, V2 = NonNullable >( path: [Argument, Argument, Argument, Argument] ): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, K2 extends keyof V1, K3 extends keyof V2, K4 extends keyof V3, V0 = NonNullable, V1 = NonNullable, V2 = NonNullable, V3 = NonNullable >( path: [Argument, Argument, Argument, Argument, Argument] ): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, K2 extends keyof V1, K3 extends keyof V2, K4 extends keyof V3, K5 extends keyof V4, V0 = NonNullable, V1 = NonNullable, V2 = NonNullable, V3 = NonNullable, V4 = NonNullable >( path: [Argument, Argument, Argument, Argument, Argument, Argument] ): Graph getIn< K0 extends keyof NativeType, K1 extends keyof V0, K2 extends keyof V1, K3 extends keyof V2, K4 extends keyof V3, K5 extends keyof V4, K6 extends keyof V5, V0 = NonNullable, V1 = NonNullable, V2 = NonNullable, V3 = NonNullable, V4 = NonNullable, V5 = NonNullable >( path: [Argument, Argument, Argument, Argument, Argument, Argument, Argument] ): Graph /** * Returns true if the key/index exists on the object/array. */ has(key: Argument | Argument): BoolGraph } /** * Array */ interface ArrayGraphImpl< NativeType extends any[], F extends FunctionLibrary, Value = NativeType extends (infer V)[] ? AsNative : never, Key = keyof NativeType, ValueGraph = Graph, KeyGraph = NumberGraph > extends ArrayOrObjectGraphImpl { /** * Resolves to NativeType.length */ size(): NumberGraph /** * Combines all array values of the object. Like: `_.reduce(NativeType, _.assign, {})` */ assign(): ObjectGraph< // @ts-ignore AsNativeRecursive>, F > /** * Combines all array values of the object, in reverse order. Like: `_.reduce(NativeType, _.defaults, {})` */ defaults(): ObjectGraph< // @ts-ignore AsNativeRecursive>, F > /** * Resolves to the first item in an array. * @sugar */ head(): ValueGraph /** * Resolves to the last item in an array. * @sugar */ last(): ValueGraph /** * Resolves to the sum of numbers in a number array. * */ sum(): Value extends number ? NumberGraph : never /** * Reverses the order of a given array. * @sugar */ reverse(): ArrayGraph /** * Runs the functor for every item in an array. Returns a graph that resolves to an array with the returned values. * * @param functor A function to run for every item of the array * @param scope A variable to pass to the functor if inside another functor. * @example * const { root } = require('carmi') * const instance = createInstance({ * output: root.map( item => item.mult(2)) * }, [3, 2, 1]) * instance.output //[6, 4, 2] */ map any>( functor: T, scope?: Scope ): ArrayGraph>>, F> /** * Returns a graph that resolves to an array with the value at propName of each corresponding entry. * * @param propName The property name * @example * const { root } = require('carmi') * const input = [{age: 3}, {age: 2}, {age: 1}] * const instance = createInstance({ * output: root.map('age') * }, input) * instance.output //[3, 2, 1] */ map(propName: K): ArrayGraph, F> /** * Returns a boolean graph that resolves to *true* if at least one element in the array * passes the test implemented by the provided functor. * * @param functor A function to run for every item of the array, returning boolean * @param scope A variable to pass to the functor if inside another functor. * @example * const { root } = require('carmi') * const instance = createInstance({ * output: root.any((value, index) => value.eq(2)) * }, [3, 2, 1]) * instance.output //true */ any( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): BoolGraph /** * Returns a boolean graph that resolves to true if running the functor on all of the array's items resolved to true. * * @param functor A function to run for every item of the array, returning boolean * @param scope A variable to pass to the functor if inside another functor. * @sugar */ every( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): BoolGraph /** * Returns an object graph that resolves to an object containing keys returned by functor, pointing to their first found corresponding value. * * @param functor A function to run for every item of the array, returning a string as a new key * @param scope A variable to pass to the functor if inside another functor. * @example * const { root, chain } = require('carmi'); * const instance = createInstance({ * output: root * .keyBy(item => item.get('items').size()) * .mapValues(item => item.get('items')) * }, [{items: [1]}, {items: [1, 2]}, {items: [1, 2, 3]}, {items: [1, 2, 3, 4]}]); * instance.output // {1: [1], 2: [1, 2], 3: [1, 2, 3], 4: [1, 2, 3, 4]} **/ keyBy>( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): ObjectGraph /** * Returns an array graph containing only the values for which the functor resolved to `true`. * * @param functor A function to run for every item of the array, returning a boolean * @param scope A variable to pass to the functor if inside another functor. * @example * const { root } = require('carmi') * const instance = createInstance({ * output: root.filter( item => item.mod(2)) * }, [3, 2, 1]) * instance.output //[3, 1] */ filter(functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => any, scope?: Scope): ArrayGraph /** * Resolved to the index of the first value for which the functor resolved to true, or -1 if not found. * * @param functor A function to run for every item of the array, returning a boolean * @param scope A variable to pass to the functor if inside another functor. * @sugar */ findIndex( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): KeyGraph /** * Returns a value that is a result of running functor on all the items of the array in order, each time with the previous result of functor. * * @param functor A function to run for every item of the array, with the previous value as aggregate * @param initialValue The aggregate to pass to the first argument. * @sugar */ reduce( functor: (aggregate: Argument, value: ValueGraph, key: KeyGraph) => Argument, initialValue?: Ret ): NativeType extends any[] ? Ret : never /** * Resolves to an array which is a concatenated results of NativeType and one or more additional arrays. * @param arrays * @sugar */ concat(...arrays: Argument[]): ArrayGraph<(Value | T)[], F> /** * Resolves to an array of unique values that are included in given arrays. * @param arrays * @sugar */ intersection(...arrays: Argument[]): ArrayGraph<(Value | T)[], F> /** * Resolves to the first value for which the functor resolves to `true`. * * @param functor A function to run for every item of the array, returning a boolean * @param scope A variable to pass to the functor if inside another functor. * @sugar */ find(functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope): ValueGraph /** * Joins an array of strings to a single string, like `NativeType.join(separator)`. * @param separator * @sugar */ join(separator: Argument): Value extends string ? StringGraph : never /** * Returns an array graph with an additional element (value) at the end. * * @param value A value to add to the array, or a graph resolving to that value * @sugar */ append(value: Argument): ArrayGraph<(Value | T)[], F> /** * Flattens inner arrays into an array. */ flatten(): ValueGraph /** * Resolves to true if the array contains an argument equal to value. * @param value * @sugar */ includes(value: Argument): BoolGraph /** * Resolves to the same array, with only `true` values * @sugar */ compact(): this /** * Resolves to a duplicate-free version of an array * @sugar */ uniq(): this /** * Resolves to an array with size identical to NativeType, with each element resolving to the result of functor on the equivalent element in NativeType. * The functor is given a "loop" parameter, which can be used to retrieve the functor's result on a different key. For example: * * // Will resolve to [1, 2, 4, 8, ...] * recursiveMap((loop, value, key) => key.eq(0).ternary(1, key.minus(1).recur(loop).multiply(2))) * * @param functor * @param scope */ recursiveMap( functor: (loop: Looper, value: Value, key: Key, scope: Scope) => Argument, scope?: Scope ): ArrayGraph } /** * Object */ interface ObjectGraphImpl< NativeType extends { [key: string]: any }, F extends FunctionLibrary, Key = keyof NativeType & string, Value = AsNative, ValueGraph = Graph, KeyGraph = Graph > extends ArrayOrObjectGraphImpl<{ [key in keyof NativeType]: AsNative }, F> { /** * Resolves to the number of keys in the object */ size(): NumberGraph /** * Resolves to true if NativeType has the given key as a key * @param key A potential key of NativeType */ has(key: Argument): BoolGraph /** * Resolves to true if NativeType object has a value equal to the value argument. * * @param value * @sugar */ includesValue(value: Argument): BoolGraph /** * Resolves to a new object with the entries for which the functor has resolved to true. * * @param functor * @param scope */ filterBy(functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => any, scope?: Scope): this /** * Resolves to a new object with only the keys passed as argument * * @param keys * @sugar */ pick>(keys: Keys): ObjectGraph, F> /** * Resolves to an object with the same keys, with each value resolves to the return value of functor on the corresponding entry. * * @param functor * @param scope */ mapValues any>( functor: T, scope?: Scope ): ObjectGraph<{ [name in keyof NativeType]: AsNativeRecursive> }, F> /** * Resolves to an object with the same keys, with each value resolves to the value at propName of the corresponding entry. * This is equivalent to x => x.get(propName) * * @param propName property name */ mapValues( propName: Argument ): ObjectGraph<{ [name in keyof NativeType]: AsNativeRecursive }, F> /** * Resolves to an object with the same values, with each key resolves to the return value of functor on the corresponding entry. * * @param functor * @param scope */ mapKeys any>( functor: T, scope?: Scope ): ObjectGraph<{ [key in ReturnType extends string ? ReturnType : string]: Value }, F> /** * Resolves to an object with the same values, with each key resolves to the value at propName of the corresponding entry. * * @param propName property name */ mapKeys(propName: Argument): ObjectGraph<{ [key: string]: Value }, F> /** * Resolves to a boolean representing whether the object contains any value for which the functor has resolved to true * * @param functor * @param scope */ anyValues( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): BoolGraph /** * Returns a new object with the keys returned by the functor, and the values resolves to arrays with all the elements which returned that key. */ groupBy( functor: (value: ValueGraph, key: KeyGraph, scope: Scope) => Argument, scope?: Scope ): ObjectGraph<{ [key: string]: NativeType }, F> /** * Returns a new object which resolves to `_.assign(NativeType, value)`. * * @param value * @sugar */ assignIn(value: Argument[]): ObjectGraph, F> /** * Sets value for given key. * * @param key The property name * @param value The value to set * @sugar */ simpleSet(key: Key, value: Argument): ObjectGraph /** * Sets value for given path. * * @param path[] Array * @param value * @sugar */ setIn(path: string[], value: any): ObjectGraph /** * Resolves to an object with keys identical to NativeType, with each element resolving to the result of functor on the equivalent element in NativeType. * The functor is given a "loop" parameter, which can be used to retrieve the functor's result on a different key. For example: * * @param functor * @param scope */ recursiveMapValues< Scope, Functor extends (looper: Looper, value: ValueGraph, key: KeyGraph, scope: Scope) => any >( functor: Functor, scope?: Scope ): ObjectGraph<{ [name in keyof NativeType]: AsNativeRecursive> }, F> /** * Resolves to an array representing the keys of the object. * */ keys(): ArrayGraph /** * Resolves to an array representing the values of the object. * */ values(): ArrayGraph } interface Expression {} export interface Token { $type: string } type PathSegment = Token | string | number type SetterExpression = {} type SpliceExpression = {} type PushExpression = {} export interface ArrayGraph extends ArrayGraphImpl {} export interface ObjectGraph extends ObjectGraphImpl, F> {} export type Graph = N extends AbstractGraph ? N : N extends any[] ? ArrayGraph : N extends Function ? FunctionGraph : N extends string ? StringGraph : N extends number ? NumberGraph : N extends boolean ? BoolGraph : N extends object ? ObjectGraph : never /** * External */ export interface CarmiAPI { $schema: Schema $functions: F root: ObjectGraph /** * Wraps a native JS object with the declarative APIs. * * @example * const { root, chain } = require('carmi'); * const instance = createInstance({ * output: chain([{ * shelf: root.get(0).get('shelf'), * books: [ root.get(1).get(root.get(0).get('shelf')).get(0) ] * }]) * .assign() * }, [{shelf: 'scifi'}, {scifi: ['a scanner darkly']}]); * instance.output //{books: ["a scanner darkly"], shelf: "scifi"} */ chain(t: T): Graph, F> /** * Logical operand or. */ or(a: A, b: never[] | {}): Graph or(a: A, b: B, c: never[] | {}): Graph | Graph or(a: A, b: B, c: C, d: never[] | {}): Graph | Graph | Graph or(a: A, b: B, c: C, d: D, e: never[] | {}): Graph | Graph | Graph | Graph or(a: A, b: B): Graph | Graph or(a: A, b: B, c: C): Graph | Graph | Graph or(a: A, b: B, c: C, d: D): Graph | Graph | Graph | Graph or(a: A, b: B, c: C, d: D, e: E): Graph | Graph | Graph | Graph | Graph or( a: A, b: B, c: C, d: D, e: E, f: FF ): Graph | Graph | Graph | Graph | Graph | Graph or(...args: A[]): Graph /** * Logical operand and. */ and(a: A): Graph and(a: A, b: B): Graph and(a: A, b: B, c: C): Graph and(a: A, b: B, c: C, d: D): Graph and(a: A, b: B, c: C, d: D, e: E): Graph and(a: A, b: B, c: C, d: D, e: E, f: FF): Graph and(...args: A[]): Graph /** * Declare actions which can be triggered on your state to change it (use arg0/arg1/arg2 - to define placeholders in the path). * @example * const { root, setter, arg0 } = require('carmi') * const instance = createInstance({ * setItem: setter(arg0), * output: root.any((value, index) => value.eq(2)) * }, [3, 2, 1]); * console.log(instance.output) //true * instance.setItem(1, 3) * instance.output //false */ setter(...path: Path): SetterExpression /** * Declare actions which can be triggered on your state to change it (use arg0/arg1/arg2 - to define placeholders in the path). */ splice(...path: Path): SpliceExpression /** * Declare a setter that adds an element to the end of an array. The setter will create the array if one doesn't exist. */ push(...path: Path): PushExpression /** * Calls the function name passed from the function library while passing current value as the first argument, and then the provided args. */ call( func: FunctionName, ...args: Argument[number]>[] ): Graph, F> /** * See the docs for [`effect(func, args)`](api.html#effectfunc-args-1) in the **Graph** section of this API reference. */ effect( func: FunctionName, ...args: Argument[number]>[] ): Graph, F> /** * Creates a function that invokes `functionName` from the function library with args prepended to the arguments it receives. */ bind(func: FunctionName): FunctionGraph, F> bind(func: FunctionName, a: A): FunctionGraph, F> bind[0], B = Parameters[1]>( func: FunctionName, a: A, b: B ): FunctionGraph, F> bind< FunctionName extends keyof F, A = Parameters[0], B = Parameters[1], C = Parameters[2] >( func: FunctionName, a: A, b: B, c: C ): FunctionGraph, F> bind< FunctionName extends keyof F, A = Parameters[0], B = Parameters[1], C = Parameters[2], D = Parameters[3] >( func: FunctionName, a: A, b: B, c: C, d: D ): FunctionGraph, F> bind< FunctionName extends keyof F, A = Parameters[0], B = Parameters[1], C = Parameters[2], D = Parameters[3], E = Parameters[4] >( func: FunctionName, a: A, b: B, c: C, d: D, e: E ): FunctionGraph, F> /** * Defines a projection to be implemented later in the code using the [`implement(iface, name)`](api.html#implementiface-name) method. * @param name used for debug only */ abstract(name: string): Graph /** * Uses a previously declared abstract clause and assigns an actual value to the named abstract. */ implement(iface: Graph, name: string): void /** * A debug feature that allows to name the actual projection functions on the carmi root. */ withName(name: string, g: T): T /** * This api creates a string using carmi models and the template string method. * @example * const { root, template } = require('carmi'); * const instance = createInstance({ * output: template`Second array item is:${root.get(1)}.` * }, [3, 2, 1]); * instance.output //Second array item is:2. */ template(template: TemplateStringsArray, ...placeholders: any[]): StringGraph arg0: Token arg1: Token arg2: Token } export const bind: CarmiAPI['bind'] export const or: CarmiAPI['or'] export const and: CarmiAPI['and'] export const setter: CarmiAPI['setter'] export const splice: CarmiAPI['splice'] export const push: CarmiAPI['push'] export const abstract: CarmiAPI['abstract'] export const implement: CarmiAPI['implement'] export const effect: CarmiAPI['effect'] export const call: CarmiAPI['call'] export const chain: CarmiAPI['chain'] export const root: CarmiAPI['root'] export const template: CarmiAPI['template'] export const arg0: CarmiAPI['arg0'] export const arg1: CarmiAPI['arg1'] export const arg2: CarmiAPI['arg2'] declare const carmiDefaultAPI: CarmiAPI export default carmiDefaultAPI export function withSchema( model?: Schema, functions?: F ): CarmiAPI export function compile(transformations: object, options?: object): string