@type32/tauri-sqlite-orm 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -194,6 +194,31 @@ type InferInsert<T> = T extends {
|
|
|
194
194
|
type InferSelect<T> = T extends {
|
|
195
195
|
$inferSelect: infer S;
|
|
196
196
|
} ? S : never;
|
|
197
|
+
type WithSpec = Record<string, boolean | {
|
|
198
|
+
with?: WithSpec;
|
|
199
|
+
columns?: string[];
|
|
200
|
+
}>;
|
|
201
|
+
type FindManyOptions<TTable extends Table<any>> = {
|
|
202
|
+
with?: WithSpec;
|
|
203
|
+
join?: boolean;
|
|
204
|
+
columns?: (keyof InferSelect<TTable>)[] | Record<keyof InferSelect<TTable>, boolean>;
|
|
205
|
+
where?: SQL | Partial<InferSelect<TTable>> | ((table: TTable, ops: {
|
|
206
|
+
eq: typeof eq;
|
|
207
|
+
ne: typeof ne;
|
|
208
|
+
gt: typeof gt;
|
|
209
|
+
gte: typeof gte;
|
|
210
|
+
lt: typeof lt;
|
|
211
|
+
lte: typeof lte;
|
|
212
|
+
like: typeof like;
|
|
213
|
+
}) => SQL);
|
|
214
|
+
orderBy?: (keyof InferSelect<TTable>)[] | ((table: TTable, ops: {
|
|
215
|
+
asc: typeof asc;
|
|
216
|
+
desc: typeof desc;
|
|
217
|
+
}) => (string | SQL)[]);
|
|
218
|
+
limit?: number;
|
|
219
|
+
offset?: number;
|
|
220
|
+
};
|
|
221
|
+
type FindFirstOptions<TTable extends Table<any>> = Omit<FindManyOptions<TTable>, "limit" | "offset">;
|
|
197
222
|
declare class SelectQueryBuilder<T> {
|
|
198
223
|
private _table;
|
|
199
224
|
private _selectedColumns;
|
|
@@ -323,8 +348,8 @@ declare class TauriORM {
|
|
|
323
348
|
configure<TTables extends Record<string, Table<any>>, TRelDefs extends Record<string, Record<string, RelationConfig>> = Record<string, Record<string, RelationConfig>>>(tables: TTables, relDefs?: TRelDefs): this & {
|
|
324
349
|
query: {
|
|
325
350
|
[K in keyof TTables]: {
|
|
326
|
-
findMany: (opts?:
|
|
327
|
-
findFirst: (opts?:
|
|
351
|
+
findMany: (opts?: FindManyOptions<TTables[K]>) => Promise<Array<InferSelect<TTables[K]>>>;
|
|
352
|
+
findFirst: (opts?: FindFirstOptions<TTables[K]>) => Promise<InferSelect<TTables[K]> | null>;
|
|
328
353
|
};
|
|
329
354
|
};
|
|
330
355
|
};
|
|
@@ -414,10 +439,6 @@ type ManyRelation = {
|
|
|
414
439
|
};
|
|
415
440
|
declare function relations(baseTable: Table<any>, builder: (ctx: RelationBuilderCtx) => Record<string, OneRelation | ManyRelation>): Record<string, OneRelation | ManyRelation>;
|
|
416
441
|
type RelationConfig = OneRelation | ManyRelation;
|
|
417
|
-
type WithSpec = Record<string, boolean | {
|
|
418
|
-
with?: WithSpec;
|
|
419
|
-
columns?: string[];
|
|
420
|
-
}>;
|
|
421
442
|
declare function makeQueryAPI(tables: Record<string, Table<any>>, relDefs: Record<string, Record<string, RelationConfig>>, dbProvider: () => Promise<Database>): { [K in keyof typeof tables]: {
|
|
422
443
|
findMany: (opts?: {
|
|
423
444
|
with?: WithSpec;
|
package/dist/index.d.ts
CHANGED
|
@@ -194,6 +194,31 @@ type InferInsert<T> = T extends {
|
|
|
194
194
|
type InferSelect<T> = T extends {
|
|
195
195
|
$inferSelect: infer S;
|
|
196
196
|
} ? S : never;
|
|
197
|
+
type WithSpec = Record<string, boolean | {
|
|
198
|
+
with?: WithSpec;
|
|
199
|
+
columns?: string[];
|
|
200
|
+
}>;
|
|
201
|
+
type FindManyOptions<TTable extends Table<any>> = {
|
|
202
|
+
with?: WithSpec;
|
|
203
|
+
join?: boolean;
|
|
204
|
+
columns?: (keyof InferSelect<TTable>)[] | Record<keyof InferSelect<TTable>, boolean>;
|
|
205
|
+
where?: SQL | Partial<InferSelect<TTable>> | ((table: TTable, ops: {
|
|
206
|
+
eq: typeof eq;
|
|
207
|
+
ne: typeof ne;
|
|
208
|
+
gt: typeof gt;
|
|
209
|
+
gte: typeof gte;
|
|
210
|
+
lt: typeof lt;
|
|
211
|
+
lte: typeof lte;
|
|
212
|
+
like: typeof like;
|
|
213
|
+
}) => SQL);
|
|
214
|
+
orderBy?: (keyof InferSelect<TTable>)[] | ((table: TTable, ops: {
|
|
215
|
+
asc: typeof asc;
|
|
216
|
+
desc: typeof desc;
|
|
217
|
+
}) => (string | SQL)[]);
|
|
218
|
+
limit?: number;
|
|
219
|
+
offset?: number;
|
|
220
|
+
};
|
|
221
|
+
type FindFirstOptions<TTable extends Table<any>> = Omit<FindManyOptions<TTable>, "limit" | "offset">;
|
|
197
222
|
declare class SelectQueryBuilder<T> {
|
|
198
223
|
private _table;
|
|
199
224
|
private _selectedColumns;
|
|
@@ -323,8 +348,8 @@ declare class TauriORM {
|
|
|
323
348
|
configure<TTables extends Record<string, Table<any>>, TRelDefs extends Record<string, Record<string, RelationConfig>> = Record<string, Record<string, RelationConfig>>>(tables: TTables, relDefs?: TRelDefs): this & {
|
|
324
349
|
query: {
|
|
325
350
|
[K in keyof TTables]: {
|
|
326
|
-
findMany: (opts?:
|
|
327
|
-
findFirst: (opts?:
|
|
351
|
+
findMany: (opts?: FindManyOptions<TTables[K]>) => Promise<Array<InferSelect<TTables[K]>>>;
|
|
352
|
+
findFirst: (opts?: FindFirstOptions<TTables[K]>) => Promise<InferSelect<TTables[K]> | null>;
|
|
328
353
|
};
|
|
329
354
|
};
|
|
330
355
|
};
|
|
@@ -414,10 +439,6 @@ type ManyRelation = {
|
|
|
414
439
|
};
|
|
415
440
|
declare function relations(baseTable: Table<any>, builder: (ctx: RelationBuilderCtx) => Record<string, OneRelation | ManyRelation>): Record<string, OneRelation | ManyRelation>;
|
|
416
441
|
type RelationConfig = OneRelation | ManyRelation;
|
|
417
|
-
type WithSpec = Record<string, boolean | {
|
|
418
|
-
with?: WithSpec;
|
|
419
|
-
columns?: string[];
|
|
420
|
-
}>;
|
|
421
442
|
declare function makeQueryAPI(tables: Record<string, Table<any>>, relDefs: Record<string, Record<string, RelationConfig>>, dbProvider: () => Promise<Database>): { [K in keyof typeof tables]: {
|
|
422
443
|
findMany: (opts?: {
|
|
423
444
|
with?: WithSpec;
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED