Comparing version 1.0.21 to 1.0.22
@@ -92,3 +92,3 @@ /** | ||
*/ | ||
type Prettify<T> = { | ||
type Prettify<T> = T extends Array<unknown> ? T : { | ||
[K in keyof T]: T[K]; | ||
@@ -147,4 +147,6 @@ } & {}; | ||
declare namespace RONIN { | ||
type RecursiveNullish<T> = T extends Array<infer U> ? Array<RecursiveNullish<U>> : T extends Record<string, unknown> | RONIN.RoninRecord ? { | ||
export type RecursiveNullish<T> = T extends Array<any> ? { | ||
[K in keyof T]?: RecursiveNullish<T[K]> | null; | ||
} | null | undefined : T extends Date ? T | null | undefined : T extends Record<string, any> | RONIN.RoninRecord ? { | ||
[K in keyof T]?: RecursiveNullish<T[K]> | null; | ||
} : T | null | undefined; | ||
@@ -382,5 +384,20 @@ interface RoninMetadata { | ||
/** | ||
* Execute queries on RONIN. | ||
* | ||
* @param config If a scratchpad is passed as the first argument, this can be optional config for it. | ||
* | ||
* @returns A function for running a scratchpad. | ||
*/ | ||
declare function handleScratchPadOrConfig(config?: RunScratchpadOptions): ScratchPadFactory; | ||
/** | ||
* Execute queries on RONIN. | ||
* | ||
* @param input A scratchpad containing queries, or config for creating a factory for running scratchpads. | ||
* @param config If a scratchpad is passed as the first argument, this can be optional config for it. | ||
* | ||
* @returns The results of the queries in the scratchpad. | ||
*/ | ||
declare function handleScratchPadOrConfig<T = [unknown]>(scratchPad: ScratchPad, config?: RunScratchpadOptions): Promise<QueryResult<T>>; | ||
export { AfterCountHook, AfterCreateHook, AfterDropHook, AfterGetHook, AfterHookHandler, AfterSetHook, BeforeCountHook, BeforeCreateHook, BeforeDropHook, BeforeGetHook, BeforeHookHandler, BeforeSetHook, CountHook, CreateHook, DropHook, DuringHookHandler, GetHook, Metrics, Query, QueryInstructions, QueryResult, QueryType, RONIN, Readable, ReadableValue, RunScratchpadOptions, ScratchPad, ScratchPadActions, SetHook, StoredReadable, handleScratchPadOrConfig as default, getQueriesFromScratchPad, processReadables, runQueries }; |
@@ -393,9 +393,8 @@ var __defProp = Object.defineProperty; | ||
}; | ||
function handleScratchPadOrConfig(input, config) { | ||
if (typeof input === "function") { | ||
return runScratchpad(input, config); | ||
} | ||
if (typeof input === "undefined" || typeof input === "object" && !Array.isArray(input) && input !== null) { | ||
return createScratchpadFactory(input); | ||
} | ||
function handleScratchPadOrConfig(...args) { | ||
const [scratchPadOrConfig, config] = args; | ||
if (typeof scratchPadOrConfig === "function") | ||
return runScratchpad(scratchPadOrConfig, config); | ||
if (typeof scratchPadOrConfig === "undefined" || typeof scratchPadOrConfig === "object" && !Array.isArray(scratchPadOrConfig) && scratchPadOrConfig !== null) | ||
return createScratchpadFactory(scratchPadOrConfig); | ||
let message = 'The function exported by the "ronin" package must receive either'; | ||
@@ -402,0 +401,0 @@ message += " a scratchpad (function) or an initial configuration (object)."; |
{ | ||
"version": "1.0.21", | ||
"version": "1.0.22", | ||
"name": "ronin", | ||
@@ -4,0 +4,0 @@ "scripts": { |
31659
793