convex-selections
Advanced tools
Comparing version 0.0.28 to 0.0.29
@@ -1,2 +0,2 @@ | ||
import { UnionToIntersection } from 'type-fest'; | ||
import { UnionToIntersection, Exact } from 'type-fest'; | ||
import { GenericId } from 'convex/values'; | ||
@@ -54,4 +54,4 @@ | ||
declare function expandSelections<SelectionMapping extends Record<string, Record<string, unknown>>>(selectionMapping: SelectionMapping): ExpandSelections<SelectionMapping>; | ||
declare function createSelectionFunction<Definition extends SelectionDefinition<any, any>>(selectionDefinition: Definition): <const Selections extends (Definition extends SelectionDefinition<infer Select, any> ? Select : never) & { [K in keyof (Definition extends SelectionDefinition<any, infer SelectionMappings extends Record<`$${string}`, unknown>> ? SelectionMappings : never)]?: boolean | undefined; }>(selections: Selections) => UnionToIntersection<{ [SelectionKey in keyof Selections]: SelectionKey extends `$${string}` ? ExpandSelections<Definition extends SelectionDefinition<any, infer SelectionMappings_1 extends Record<`$${string}`, unknown>> ? SelectionMappings_1 : never>[SelectionKey] : Record<SelectionKey, Selections[SelectionKey]>; }[keyof Selections]>; | ||
declare function expandSelections<$SelectionMapping extends Record<string, Record<string, unknown>>>(selectionMapping: $SelectionMapping): ExpandSelections<$SelectionMapping>; | ||
declare function createSelectionFunction<$SelectionDefinition extends SelectionDefinition<any, any>>(selectionDefinition: $SelectionDefinition): <const $Selections extends Exact<($SelectionDefinition extends SelectionDefinition<infer Select, any> ? Select : never) & { [K in keyof ($SelectionDefinition extends SelectionDefinition<any, infer SelectionMappings extends Record<`$${string}`, unknown>> ? SelectionMappings : never)]?: boolean | undefined; }, $Selections>>(selections: $Selections) => UnionToIntersection<{ [$SelectionKey in keyof $Selections]: $SelectionKey extends `$${string}` ? ExpandSelections<$SelectionDefinition extends SelectionDefinition<any, infer SelectionMappings_1 extends Record<`$${string}`, unknown>> ? SelectionMappings_1 : never>[$SelectionKey] : Record<$SelectionKey, $Selections[$SelectionKey]>; }[keyof $Selections]>; | ||
declare function unscopeSelections<Selections extends Record<string, () => any>>(selections: Selections): { | ||
@@ -62,3 +62,3 @@ [SelectionIdentifier in keyof Selections as SelectionIdentifier extends `${string}_${infer UnscopedIdentifier}` ? UnscopedIdentifier : never]: ReturnType<Selections[SelectionIdentifier]>; | ||
type ProcedureReturnType<ProcedureCallback extends (selection: any) => any> = Awaited<ReturnType<ProcedureCallback>>; | ||
type ProcedureReturnType<$ProcedureCallback extends (selection: any) => any> = Awaited<ReturnType<$ProcedureCallback>>; | ||
@@ -75,7 +75,7 @@ type TableNameFromProcedureCallback<$DataModel, $ProcedureCallback extends (selection: any) => any> = Exclude<ProcedureReturnType<$ProcedureCallback>, null> extends SelectOutputFromDataModel<$DataModel, any, any>[] ? NonNullable<Exclude<ProcedureReturnType<$ProcedureCallback>, null>[number]['__tableName']> : Exclude<ProcedureReturnType<$ProcedureCallback>, null> extends SelectOutputFromDataModel<$DataModel, any, any> ? NonNullable<Exclude<ProcedureReturnType<$ProcedureCallback>, null>['__tableName']> : never; | ||
declare function defineSelectionMappings<$DataModel, $TableName extends string>(): { | ||
set<SelectionMappings extends Record<`$${string}`, SelectInputFromDataModel<$DataModel, $TableName> & { | ||
[K in keyof SelectionMappings]?: boolean; | ||
}>>(mappings: () => SelectionMappings): () => SelectionDefinition<SelectInputFromDataModel<$DataModel, $TableName>, SelectionMappings>; | ||
set<$SelectionMappings extends Record<`$${string}`, SelectInputFromDataModel<$DataModel, $TableName> & { | ||
[K in keyof $SelectionMappings]?: boolean; | ||
}>>(mappings: () => $SelectionMappings): () => SelectionDefinition<SelectInputFromDataModel<$DataModel, $TableName>, $SelectionMappings>; | ||
}; | ||
export { type ExpandMapping, type ExpandSelections, type InferSelectionDefinition, type ProcedureReturnType, type RecursivelyExpandSelection, type SelectInputFromDataModel, type SelectOutputFromDataModel, type SelectionDefinition, type SelectionSelect, type Selections, type TableNameFromProcedureCallback, type Virtual, type VirtualArray, type WithOptions, combineSelections, createSelectionFunction, createWithSelection, defineSelectionMappings, expandSelections, unscopeSelections }; |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"exports": { | ||
@@ -8,0 +8,0 @@ ".": "./index.js", |
@@ -1,1 +0,1 @@ | ||
export type ProcedureReturnType<ProcedureCallback extends (selection: any) => any> = Awaited<ReturnType<ProcedureCallback>>; | ||
export type ProcedureReturnType<$ProcedureCallback extends (selection: any) => any> = Awaited<ReturnType<$ProcedureCallback>>; |
@@ -7,5 +7,5 @@ import type { SelectionDefinition } from '../types/selections.js'; | ||
export declare function defineSelectionMappings<$DataModel, $TableName extends string>(): { | ||
set<SelectionMappings extends Record<`$${string}`, SelectInputFromDataModel<$DataModel, $TableName> & { | ||
[K in keyof SelectionMappings]?: boolean; | ||
}>>(mappings: () => SelectionMappings): () => SelectionDefinition<SelectInputFromDataModel<$DataModel, $TableName>, SelectionMappings>; | ||
set<$SelectionMappings extends Record<`$${string}`, SelectInputFromDataModel<$DataModel, $TableName> & { | ||
[K in keyof $SelectionMappings]?: boolean; | ||
}>>(mappings: () => $SelectionMappings): () => SelectionDefinition<SelectInputFromDataModel<$DataModel, $TableName>, $SelectionMappings>; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import type { UnionToIntersection } from 'type-fest'; | ||
import type { Exact, UnionToIntersection } from 'type-fest'; | ||
import type { SelectionDefinition, ExpandSelections } from '../types/selections.js'; | ||
export declare function expandSelections<SelectionMapping extends Record<string, Record<string, unknown>>>(selectionMapping: SelectionMapping): ExpandSelections<SelectionMapping>; | ||
export declare function createSelectionFunction<Definition extends SelectionDefinition<any, any>>(selectionDefinition: Definition): <const Selections extends (Definition extends SelectionDefinition<infer Select, any> ? Select : never) & { [K in keyof (Definition extends SelectionDefinition<any, infer SelectionMappings extends Record<`$${string}`, unknown>> ? SelectionMappings : never)]?: boolean | undefined; }>(selections: Selections) => UnionToIntersection<{ [SelectionKey in keyof Selections]: SelectionKey extends `$${string}` ? ExpandSelections<Definition extends SelectionDefinition<any, infer SelectionMappings_1 extends Record<`$${string}`, unknown>> ? SelectionMappings_1 : never>[SelectionKey] : Record<SelectionKey, Selections[SelectionKey]>; }[keyof Selections]>; | ||
export declare function expandSelections<$SelectionMapping extends Record<string, Record<string, unknown>>>(selectionMapping: $SelectionMapping): ExpandSelections<$SelectionMapping>; | ||
export declare function createSelectionFunction<$SelectionDefinition extends SelectionDefinition<any, any>>(selectionDefinition: $SelectionDefinition): <const $Selections extends Exact<($SelectionDefinition extends SelectionDefinition<infer Select, any> ? Select : never) & { [K in keyof ($SelectionDefinition extends SelectionDefinition<any, infer SelectionMappings extends Record<`$${string}`, unknown>> ? SelectionMappings : never)]?: boolean | undefined; }, $Selections>>(selections: $Selections) => UnionToIntersection<{ [$SelectionKey in keyof $Selections]: $SelectionKey extends `$${string}` ? ExpandSelections<$SelectionDefinition extends SelectionDefinition<any, infer SelectionMappings_1 extends Record<`$${string}`, unknown>> ? SelectionMappings_1 : never>[$SelectionKey] : Record<$SelectionKey, $Selections[$SelectionKey]>; }[keyof $Selections]>; | ||
export declare function unscopeSelections<Selections extends Record<string, () => any>>(selections: Selections): { | ||
@@ -6,0 +6,0 @@ [SelectionIdentifier in keyof Selections as SelectionIdentifier extends `${string}_${infer UnscopedIdentifier}` ? UnscopedIdentifier : never]: ReturnType<Selections[SelectionIdentifier]>; |
33928
456