Comparing version 1.0.5 to 1.0.6
@@ -21,6 +21,6 @@ type RecursivePartial<T> = { | ||
type Query = Record<QueryType, QuerySchema>; | ||
type QueryResultList<T> = T[] & { | ||
interface QueryListOptions { | ||
moreAfter?: number; | ||
}; | ||
type QueryResult<T> = T extends never ? null | number | unknown | QueryResultList<unknown> : T extends Array<infer T> ? QueryResultList<T> : T; | ||
} | ||
type QueryResult<T> = T extends [] ? [] : T extends [infer First, ...infer Rest] ? Rest extends unknown ? First extends Promise<infer U> ? [U] : BindToArray<T, QueryListOptions> : Array<First> : T extends Promise<infer U> ? [U] : [T]; | ||
type ReadableValue = File | ReadableStream; | ||
@@ -81,2 +81,5 @@ type Reference = { | ||
} & {}; | ||
type BindToArray<T, R> = { | ||
[K in keyof T]: T[K] extends Array<infer U> ? Array<U> & R : T[K]; | ||
}; | ||
@@ -174,3 +177,3 @@ type Fetcher = typeof fetch; | ||
}; | ||
type AllFields = 'createdAt' | 'updatedAt' | 'name' | 'slug' | 'amount'; | ||
type AllFields = `ronin.${keyof RoninMetadata}`; | ||
type RecordFields = 'views' | 'accounts' | 'spaces'; | ||
@@ -196,2 +199,8 @@ interface OrderedBy { | ||
including: Array<Partial<RecordFields>>; | ||
/** | ||
* Set the maximum number of records to be retrieved before a subsequent page must be requested. | ||
* | ||
* The default is `20` and the maximum is `1000`. | ||
*/ | ||
limitedTo: number; | ||
} | ||
@@ -202,11 +211,11 @@ export interface FilterAndMutate<TSchema extends Record<string, any> & RoninRecord> extends Filter<TSchema> { | ||
} | ||
export interface Counter extends Record<string, Filter<Record<string, any> & RoninRecord>> { | ||
export interface Counter extends Record<string, Partial<Filter<Record<string, any> & RoninRecord>>> { | ||
} | ||
export interface Creator extends Record<string, Filter<Record<string, any> & RoninRecord>> { | ||
export interface Creator extends Record<string, Partial<Filter<Record<string, any> & RoninRecord>>> { | ||
} | ||
export interface Dropper extends Record<string, Filter<Record<string, any> & RoninRecord>> { | ||
export interface Dropper extends Record<string, Partial<Filter<Record<string, any> & RoninRecord>>> { | ||
} | ||
export interface Getter extends Record<string, Filter<Record<string, any> & RoninRecord>> { | ||
export interface Getter extends Record<string, Partial<Filter<Record<string, any> & RoninRecord>>> { | ||
} | ||
export interface Setter extends Record<string, FilterAndMutate<Record<string, any> & RoninRecord>> { | ||
export interface Setter extends Record<string, Partial<FilterAndMutate<Record<string, any> & RoninRecord>>> { | ||
} | ||
@@ -326,3 +335,4 @@ export {}; | ||
type ScratchPad = (actions: ScratchPadActions) => void; | ||
type RunQueriesResponse<T> = QueryResult<T>[] & { | ||
type ScratchPadFactory = <T>(scratchPad: ScratchPad) => Promise<QueryResultWithMetrics<T>>; | ||
type QueryResultWithMetrics<T> = QueryResult<T> & { | ||
metrics?: Metrics; | ||
@@ -342,8 +352,7 @@ }; | ||
declare const runQueries: <T>(queries: Query[], options?: RunScratchpadOptions) => Promise<RunQueriesResponse<T>>; | ||
declare const runQueries: <T>(queries: Query[], options?: RunScratchpadOptions) => Promise<QueryResultWithMetrics<T>>; | ||
type ScratchPadFactory = <T>(scratchPad: ScratchPad) => Promise<RunQueriesResponse<T>>; | ||
declare function handleScratchPadOrConfig(config?: RunScratchpadOptions): ScratchPadFactory; | ||
declare function handleScratchPadOrConfig<T extends object | Array<unknown> = [unknown]>(scratchPad: ScratchPad, config?: RunScratchpadOptions): Promise<T extends [] ? [] : T extends [infer First, ...infer Rest] ? (Rest extends unknown ? T : Array<First>) : [T]>; | ||
declare function handleScratchPadOrConfig<T = [unknown]>(scratchPad: ScratchPad, config?: RunScratchpadOptions): Promise<QueryResult<T>>; | ||
export { AfterHook, BeforeHook, DuringHook, Query, QueryResult, RONIN, Readable, ReadableValue, RunScratchpadOptions, ScratchPad, ScratchPadActions, StoredReadable, handleScratchPadOrConfig as default, getQueriesFromScratchPad, processReadables, runQueries }; |
@@ -325,3 +325,3 @@ var __defProp = Object.defineProperty; | ||
let modifiableQueries = Array.from(queries); | ||
const modifiableResults = []; | ||
const modifiableResults = new Array(); | ||
const { hooks, waitUntil } = options || {}; | ||
@@ -328,0 +328,0 @@ if (typeof process === "undefined" && hooks && !waitUntil) { |
{ | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"name": "ronin", | ||
@@ -8,3 +8,5 @@ "scripts": { | ||
"prepare": "npm run build", | ||
"test": "npm run build && vitest run --coverage", | ||
"test": "npm run build && npm run test:coverage && npm run test:typecheck", | ||
"test:coverage": "vitest run --coverage", | ||
"test:typecheck": "vitest typecheck", | ||
"deploy": "npm run build && npm publish" | ||
@@ -11,0 +13,0 @@ }, |
27118
743