@ragestudio/scylla-odm 0.16.0 → 0.17.0
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/model/index.d.ts +5 -5
- package/operations/find.d.ts +2 -2
- package/operations/find.js +1 -1
- package/operations/findOne.d.ts +2 -2
- package/operations/findOne.js +1 -1
- package/package.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +15 -16
package/model/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mapping } from "../driver/lib/mapping/index.js";
|
|
|
2
2
|
import { Schema } from "../schema/index.js";
|
|
3
3
|
import export_default from "../operations/tableExists.js";
|
|
4
4
|
import syncOP from "../operations/sync.js";
|
|
5
|
-
import { Doc, InferDoc, Query
|
|
5
|
+
import { Doc, FindQueryOptions, InferDoc, Query } from "../types.js";
|
|
6
6
|
import { Client } from "../client.js";
|
|
7
7
|
|
|
8
8
|
//#region src/model/index.d.ts
|
|
@@ -15,16 +15,16 @@ declare class Model<TSchema extends Schema<any> = Schema<any>, TDoc = InferDoc<T
|
|
|
15
15
|
create: (data: Partial<TDoc>) => Doc<TDoc>;
|
|
16
16
|
obj: (data: Partial<TDoc>) => Doc<TDoc>;
|
|
17
17
|
find: {
|
|
18
|
-
(query: Query<TDoc>, options:
|
|
18
|
+
(query: Query<TDoc>, options: FindQueryOptions<TDoc> & {
|
|
19
19
|
raw: true;
|
|
20
20
|
}): Promise<TDoc[]>;
|
|
21
|
-
(query?: Query<TDoc>, options?:
|
|
21
|
+
(query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<Doc<TDoc>[]>;
|
|
22
22
|
};
|
|
23
23
|
findOne: {
|
|
24
|
-
(query: Query<TDoc>, options:
|
|
24
|
+
(query: Query<TDoc>, options: FindQueryOptions<TDoc> & {
|
|
25
25
|
raw: true;
|
|
26
26
|
}): Promise<TDoc | null>;
|
|
27
|
-
(query?: Query<TDoc>, options?:
|
|
27
|
+
(query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<Doc<TDoc> | null>;
|
|
28
28
|
};
|
|
29
29
|
update: (query: Query<TDoc>) => Promise<Doc<TDoc>>;
|
|
30
30
|
delete: (query: Query<TDoc>) => Promise<mapping.Result>;
|
package/operations/find.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Model } from "../model/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FindQueryOptions, Query } from "../types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/operations/find.d.ts
|
|
5
|
-
declare function findOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?:
|
|
5
|
+
declare function findOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any[]>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { findOP as default };
|
package/operations/find.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../utils/queryParser.js";async function t(t={},n){
|
|
1
|
+
import e from"../utils/queryParser.js";async function t(t={},n){return t=e(this,t),this.client.executeWithRetry(async()=>{let e=(await this.mapper.find(t,n)).toArray();return n?.raw===!0?e:e.map(e=>this._wrap(e))},`find on ${this.name}`)}export{t as default};
|
package/operations/findOne.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Model } from "../model/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FindQueryOptions, Query } from "../types.js";
|
|
3
3
|
|
|
4
4
|
//#region src/operations/findOne.d.ts
|
|
5
|
-
declare function findOneOP<TDoc>(this: Model<any, TDoc>, query
|
|
5
|
+
declare function findOneOP<TDoc>(this: Model<any, TDoc>, query?: Query<TDoc>, options?: FindQueryOptions<TDoc>): Promise<any>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { findOneOP as default };
|
package/operations/findOne.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../utils/queryParser.js";async function t(t,n){return t=e(this,t),this.client.executeWithRetry(async()=>{let e=await this.mapper.get(t);return e?
|
|
1
|
+
import e from"../utils/queryParser.js";async function t(t={},n){return t=e(this,t),this.client.executeWithRetry(async()=>{let e=await this.mapper.get(t,n);return e?n?.raw===!0?e.toRaw():this._wrap(e):null},`findOne on ${this.name}`)}export{t as default};
|
package/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.
|
|
1
|
+
var e=`0.17.0`,t=`An ODM for ScyllaDB/Cassandra`;export{t as description,e as version};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mapping } from "./driver/lib/mapping/index.js";
|
|
1
2
|
import { ClientOptions } from "./driver/index.js";
|
|
2
3
|
import { Schema } from "./schema/index.js";
|
|
3
4
|
import { Document } from "./document/index.js";
|
|
@@ -44,29 +45,27 @@ declare enum ColumnTypes {
|
|
|
44
45
|
Varchar = "varchar",
|
|
45
46
|
Varint = "varint"
|
|
46
47
|
}
|
|
47
|
-
type QueryOperators<TValue> = {
|
|
48
|
-
$eq?: TValue;
|
|
49
|
-
$ne?: TValue;
|
|
50
|
-
$in?: TValue[];
|
|
51
|
-
$gt?: TValue;
|
|
52
|
-
$gte?: TValue;
|
|
53
|
-
$lt?: TValue;
|
|
54
|
-
$lte?: TValue;
|
|
55
|
-
};
|
|
56
48
|
type TableKeys = (string | TableKeys)[];
|
|
57
49
|
interface Column<T> {
|
|
58
50
|
type?: ColumnTypes | string;
|
|
59
51
|
required?: boolean;
|
|
60
52
|
}
|
|
61
|
-
type
|
|
62
|
-
$
|
|
63
|
-
$
|
|
64
|
-
$
|
|
53
|
+
type QueryOperators<T> = {
|
|
54
|
+
$eq?: T;
|
|
55
|
+
$ne?: T;
|
|
56
|
+
$in?: T[];
|
|
57
|
+
$gt?: T;
|
|
58
|
+
$gte?: T;
|
|
59
|
+
$lt?: T;
|
|
60
|
+
$lte?: T;
|
|
61
|
+
$and?: Query<T>[];
|
|
65
62
|
};
|
|
66
|
-
type
|
|
63
|
+
type Query<T> = { [K in keyof T]?: T[K] | QueryOperators<T[K]> };
|
|
64
|
+
type FindQueryOptions<T> = {
|
|
67
65
|
raw?: boolean;
|
|
68
|
-
};
|
|
66
|
+
orderBy?: { [K in keyof T]?: "asc" | "desc" };
|
|
67
|
+
} & mapping.FindDocInfo;
|
|
69
68
|
type Doc<TDoc = any> = Document<TDoc> & TDoc;
|
|
70
69
|
type InferDoc<S> = S extends Schema<infer T> ? { [K in keyof T as K extends `$${string}` ? never : K]: T[K] extends Column<infer U> ? U : T[K] } : any;
|
|
71
70
|
//#endregion
|
|
72
|
-
export { ClientConfig, Column, ColumnTypes, Doc, InferDoc, Query, QueryOperators,
|
|
71
|
+
export { ClientConfig, Column, ColumnTypes, Doc, FindQueryOptions, InferDoc, Query, QueryOperators, TableKeys };
|