Comparing version 6.0.18 to 6.0.19
@@ -1,7 +0,49 @@ | ||
import { Q as QueryHandlerOptions, R as RONIN, P as PromiseTuple } from './index-C18_plll.js'; | ||
import { R as ReducedFunction, Q as QueryHandlerOptions, P as PromiseTuple } from './utils-DIZyYZQi.js'; | ||
import { ResultRecord as ResultRecord$1, GetQuery, SetQuery, AddQuery, RemoveQuery, CountQuery, CreateQuery, Model, AlterQuery, ModelField, ModelIndex, ModelTrigger, ModelPreset, DropQuery } from '@ronin/compiler'; | ||
import 'node:async_hooks'; | ||
import '@ronin/compiler'; | ||
import 'ronin'; | ||
type ResultRecord = Omit<ResultRecord$1, 'ronin'> & { | ||
ronin: Omit<ResultRecord$1['ronin'], 'createdAt' | 'updatedAt'> & { | ||
createdAt: Date; | ||
updatedAt: Date; | ||
}; | ||
}; | ||
/** | ||
* A recursive type making every property callable and chainable. | ||
* | ||
* - If `Query` (minus null/undefined) is an object: | ||
* -- The call signature is `(arg?: Partial<NonNullable<Query>>) => Promise<Result> & DeepCallable<Query>`. | ||
* -- Each key in `Query` is also a `DeepCallable`, excluding null/undefined from the | ||
* sub-type so that calls to optional properties do not raise "possibly undefined" errors. | ||
* | ||
* - Otherwise (if it's a primitive like string/number/etc, or strictly null/undefined): | ||
* -- The call signature is `(arg?: Query) => Promise<Result> & DeepCallable<Query>`. | ||
* -- Can call it with an optional argument, and it returns a promise & chainable methods. | ||
* | ||
* This approach means you can do e.g. `get.spaces.orderedBy.descending(['handle'])` | ||
* without TS complaining about `descending` being possibly undefined, and every call | ||
* remains `await`able (returning `Result`) as well as chainable. | ||
*/ | ||
type DeepCallable<Query, Result = ResultRecord> = [NonNullable<Query>] extends [ | ||
object | ||
] ? /** | ||
* Calls the object with an optional partial argument, returning a promise that | ||
* resolves to `Result` and also remains a DeepCallable for further nested calls. | ||
*/ ObjectCall<Query, Result, Partial<NonNullable<Query>>> & { | ||
[K in keyof NonNullable<Query>]-?: DeepCallable<Exclude<NonNullable<Query>[K], null | undefined>, Result>; | ||
} : ObjectCall<Query, Result, Query>; | ||
/** | ||
* A helper function type used by `DeepCallable`. | ||
* | ||
* @typeParam Query - The `Query` type for recursion. | ||
* @typeParam DefaultResult - The default result if no generic is specified. | ||
* @typeParam Arg - The type of the call's optional argument. | ||
* | ||
* The call returns a `Promise<FinalResult>`, with `FinalResult` defaulting to | ||
* `DefaultResult` if no generic is provided. It also remains chainable by returning | ||
* `DeepCallable<Query, FinalResult>`. | ||
*/ | ||
type ObjectCall<Query, DefaultResult, Arg> = (<FinalResult = DefaultResult>(arg?: Arg) => Promise<FinalResult> & DeepCallable<Query, FinalResult>) & ReducedFunction; | ||
/** | ||
* Creates a syntax factory for generating and executing queries. | ||
@@ -49,23 +91,21 @@ * | ||
declare const createSyntaxFactory: (options: QueryHandlerOptions | (() => QueryHandlerOptions)) => { | ||
get: RONIN.Getter; | ||
set: RONIN.Setter; | ||
add: RONIN.Adder; | ||
remove: RONIN.Remover; | ||
count: RONIN.Counter; | ||
create: RONIN.Creator; | ||
alter: RONIN.Alterer; | ||
drop: RONIN.Dropper; | ||
get: DeepCallable<GetQuery>; | ||
set: DeepCallable<SetQuery>; | ||
add: DeepCallable<AddQuery>; | ||
remove: DeepCallable<RemoveQuery>; | ||
count: DeepCallable<CountQuery, number>; | ||
create: DeepCallable<CreateQuery, Model>; | ||
alter: DeepCallable<AlterQuery, Model | ModelField | ModelIndex | ModelTrigger | ModelPreset>; | ||
drop: DeepCallable<DropQuery, Model>; | ||
batch: <T extends [Promise<any>, ...Array<Promise<any>>] | Array<Promise<any>>>(operations: () => T, queryOptions?: Record<string, unknown>) => Promise<PromiseTuple<T>>; | ||
}; | ||
declare const get: DeepCallable<GetQuery>; | ||
declare const set: DeepCallable<SetQuery>; | ||
declare const add: DeepCallable<AddQuery>; | ||
declare const remove: DeepCallable<RemoveQuery>; | ||
declare const count: DeepCallable<CountQuery, number>; | ||
declare const create: DeepCallable<CreateQuery, Model>; | ||
declare const alter: DeepCallable<AlterQuery, Model | ModelField | ModelIndex | ModelTrigger | ModelPreset>; | ||
declare const drop: DeepCallable<DropQuery, Model>; | ||
declare const get: RONIN.Getter<undefined>; | ||
declare const set: RONIN.Setter<undefined>; | ||
declare const add: RONIN.Adder<undefined>; | ||
declare const remove: RONIN.Remover<undefined>; | ||
declare const count: RONIN.Counter<undefined>; | ||
declare const create: RONIN.Creator<undefined>; | ||
declare const alter: RONIN.Alterer<undefined>; | ||
declare const drop: RONIN.Dropper<undefined>; | ||
declare const batch: <T extends [Promise<any>, ...Array<Promise<any>>] | Array<Promise<any>>>(operations: () => T, queryOptions?: Record<string, unknown>) => Promise<PromiseTuple<T>>; | ||
export { RONIN, add, alter, batch, count, create, createSyntaxFactory as default, drop, get, remove, set }; | ||
export { add, alter, count, create, createSyntaxFactory, createSyntaxFactory as default, drop, get, remove, set }; |
import { | ||
mergeOptions, | ||
runQueriesWithStorageAndHooks | ||
} from "./chunk-QRXG5LTU.js"; | ||
} from "./chunk-BZGMJ4AM.js"; | ||
// src/syntax/handlers.ts | ||
// src/utils/handlers.ts | ||
var queriesHandler = async (queries, options = {}) => { | ||
@@ -29,3 +29,3 @@ if (!options.token && typeof process !== "undefined") { | ||
// src/syntax/index.ts | ||
// src/index.ts | ||
import { getBatchProxy, getSyntaxProxy } from "@ronin/syntax/queries"; | ||
@@ -39,7 +39,19 @@ var createSyntaxFactory = (options) => { | ||
add: getSyntaxProxy({ rootProperty: "add", callback }), | ||
remove: getSyntaxProxy({ rootProperty: "remove", callback }), | ||
count: getSyntaxProxy({ rootProperty: "count", callback }), | ||
remove: getSyntaxProxy({ | ||
rootProperty: "remove", | ||
callback | ||
}), | ||
count: getSyntaxProxy({ | ||
rootProperty: "count", | ||
callback | ||
}), | ||
// Query types for interacting with the database schema. | ||
create: getSyntaxProxy({ rootProperty: "create", callback }), | ||
alter: getSyntaxProxy({ rootProperty: "alter", callback }), | ||
create: getSyntaxProxy({ | ||
rootProperty: "create", | ||
callback | ||
}), | ||
alter: getSyntaxProxy({ | ||
rootProperty: "alter", | ||
callback | ||
}), | ||
drop: getSyntaxProxy({ rootProperty: "drop", callback }), | ||
@@ -55,7 +67,11 @@ // Function for executing a transaction containing multiple queries. | ||
}; | ||
// src/index.ts | ||
var { get, set, add, remove, count, create, alter, drop, batch } = createSyntaxFactory( | ||
{} | ||
); | ||
var factory = createSyntaxFactory({}); | ||
var get = factory.get; | ||
var set = factory.set; | ||
var add = factory.add; | ||
var remove = factory.remove; | ||
var count = factory.count; | ||
var create = factory.create; | ||
var alter = factory.alter; | ||
var drop = factory.drop; | ||
var index_default = createSyntaxFactory; | ||
@@ -65,5 +81,5 @@ export { | ||
alter, | ||
batch, | ||
count, | ||
create, | ||
createSyntaxFactory, | ||
index_default as default, | ||
@@ -70,0 +86,0 @@ drop, |
@@ -1,4 +0,4 @@ | ||
export { A as AddHook, c as AfterAddHook, s as AfterAlterHook, m as AfterCountHook, p as AfterCreateHook, u as AfterDropHook, e as AfterGetHook, w as AfterHookHandler, k as AfterRemoveHook, h as AfterSetHook, q as AlterHook, B as BeforeAddHook, r as BeforeAlterHook, l as BeforeCountHook, o as BeforeCreateHook, t as BeforeDropHook, d as BeforeGetHook, v as BeforeHookHandler, j as BeforeRemoveHook, g as BeforeSetHook, C as CountHook, n as CreateHook, D as DropHook, x as DuringHookHandler, G as GetHook, H as HookContext, P as PromiseTuple, Q as QueryHandlerOptions, i as RemoveHook, a as Results, f as SetHook, y as StorableObjectValue, b as StoredObject } from '../index-C18_plll.js'; | ||
export { AddInstructions, AddQuery, AddInstructions as AddQueryInstructions, CountInstructions, CountQuery, CountInstructions as CountQueryInstructions, GetInstructions, GetQuery, GetInstructions as GetQueryInstructions, Query, QueryInstruction, QueryType, RemoveInstructions, RemoveQuery, RemoveInstructions as RemoveQueryInstructions, SetInstructions, SetQuery, SetInstructions as SetQueryInstructions, WithInstruction } from '@ronin/compiler'; | ||
export { A as AddHook, b as AfterAddHook, q as AfterAlterHook, k as AfterCountHook, n as AfterCreateHook, s as AfterDropHook, d as AfterGetHook, u as AfterHookHandler, i as AfterRemoveHook, f as AfterSetHook, o as AlterHook, B as BeforeAddHook, p as BeforeAlterHook, j as BeforeCountHook, m as BeforeCreateHook, r as BeforeDropHook, c as BeforeGetHook, t as BeforeHookHandler, h as BeforeRemoveHook, e as BeforeSetHook, C as CountHook, l as CreateHook, D as DropHook, v as DuringHookHandler, G as GetHook, H as HookContext, P as PromiseTuple, Q as QueryHandlerOptions, g as RemoveHook, a as Results, S as SetHook } from '../utils-DIZyYZQi.js'; | ||
export { AddInstructions, AddQuery, AddInstructions as AddQueryInstructions, CountInstructions, CountQuery, CountInstructions as CountQueryInstructions, GetInstructions, GetQuery, GetInstructions as GetQueryInstructions, Query, QueryInstruction, QueryType, RemoveInstructions, RemoveQuery, RemoveInstructions as RemoveQueryInstructions, SetInstructions, SetQuery, SetInstructions as SetQueryInstructions, StoredObject, WithInstruction } from '@ronin/compiler'; | ||
export { a as StorableObjectValue } from '../index-q0y6xKOy.js'; | ||
import 'node:async_hooks'; | ||
import 'ronin'; |
@@ -1,5 +0,5 @@ | ||
import { Q as QueryHandlerOptions, a as Results, S as StorableObject, b as StoredObject } from '../index-C18_plll.js'; | ||
import { Query } from '@ronin/compiler'; | ||
import { Q as QueryHandlerOptions, a as Results } from '../utils-DIZyYZQi.js'; | ||
import { Query, StoredObject } from '@ronin/compiler'; | ||
import { S as StorableObject } from '../index-q0y6xKOy.js'; | ||
import 'node:async_hooks'; | ||
import 'ronin'; | ||
@@ -6,0 +6,0 @@ /** |
@@ -6,3 +6,3 @@ import { | ||
runQueriesWithStorageAndHooks | ||
} from "../chunk-QRXG5LTU.js"; | ||
} from "../chunk-BZGMJ4AM.js"; | ||
export { | ||
@@ -9,0 +9,0 @@ InvalidQueryError, |
{ | ||
"name": "ronin", | ||
"version": "6.0.18", | ||
"version": "6.0.19", | ||
"type": "module", | ||
@@ -71,4 +71,4 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@ronin/cli": "0.2.22", | ||
"@ronin/compiler": "0.14.8", | ||
"@ronin/cli": "0.2.23", | ||
"@ronin/compiler": "0.14.9", | ||
"@ronin/syntax": "0.2.5" | ||
@@ -75,0 +75,0 @@ }, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14
53723
908
3
+ Added@ronin/cli@0.2.23(transitive)
+ Added@ronin/compiler@0.14.9(transitive)
- Removed@ronin/cli@0.2.22(transitive)
- Removed@ronin/compiler@0.14.8(transitive)
Updated@ronin/cli@0.2.23
Updated@ronin/compiler@0.14.9