@ragestudio/scylla-odm 0.20.3 → 0.21.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/package.js +1 -1
- package/package.json +5 -3
- package/schema/index.d.ts +10 -5
- package/schema/index.js +1 -1
- package/types.d.ts +3 -2
package/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.
|
|
1
|
+
var e=`0.21.0`,t=`An ODM for ScyllaDB/Cassandra`;export{t as description,e as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ragestudio/scylla-odm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "An ODM for ScyllaDB/Cassandra",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "RageStudio",
|
|
@@ -30,11 +30,13 @@
|
|
|
30
30
|
"long": "^5.3.2"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "tsdown && cp package.json dist/package.json && cp README.md dist/README.md"
|
|
33
|
+
"build": "tsdown && cp package.json dist/package.json && cp README.md dist/README.md",
|
|
34
|
+
"test": "vitest run"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^25.6.0",
|
|
37
38
|
"tsdown": "^0.21.10",
|
|
38
|
-
"typescript": "^6.0.3"
|
|
39
|
+
"typescript": "^6.0.3",
|
|
40
|
+
"vitest": "^4.1.5"
|
|
39
41
|
}
|
|
40
42
|
}
|
package/schema/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { TableKeys } from "../types.js";
|
|
1
|
+
import { TableClusteringOrder, TableKeys } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/schema/index.d.ts
|
|
4
|
+
interface SchemaParams<T> {
|
|
5
|
+
table_name: string;
|
|
6
|
+
keys: TableKeys<T>;
|
|
7
|
+
clustering_order?: TableClusteringOrder<T>;
|
|
8
|
+
}
|
|
4
9
|
declare class Schema<T> {
|
|
5
10
|
readonly table_name: string;
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
11
|
+
readonly keys: TableKeys<T>;
|
|
12
|
+
readonly clustering_order: TableClusteringOrder<T> | undefined;
|
|
8
13
|
readonly fields: T;
|
|
9
|
-
constructor(params:
|
|
14
|
+
constructor(params: SchemaParams<T>, fields: T);
|
|
10
15
|
}
|
|
11
16
|
//#endregion
|
|
12
|
-
export { Schema, Schema as default };
|
|
17
|
+
export { Schema, Schema as default, SchemaParams };
|
package/schema/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Schema=class{table_name;clustering_order;
|
|
1
|
+
var Schema=class{table_name;keys;clustering_order;fields;constructor(e,t){if(typeof e!=`object`)throw Error(`params must be an object`);if(typeof e.table_name!=`string`)throw Error(`table_name is required`);if(!Array.isArray(e.keys))throw Error(`keys is required to be an array`);this.table_name=e.table_name,this.clustering_order=e.clustering_order,this.keys=e.keys,this.fields=t}};export{Schema,Schema as default};
|
package/types.d.ts
CHANGED
|
@@ -45,7 +45,8 @@ declare enum ColumnTypes {
|
|
|
45
45
|
Varchar = "varchar",
|
|
46
46
|
Varint = "varint"
|
|
47
47
|
}
|
|
48
|
-
type TableKeys = (
|
|
48
|
+
type TableKeys<T> = (keyof T | TableKeys<T>)[];
|
|
49
|
+
type TableClusteringOrder<T> = Partial<Record<keyof T, "asc" | "desc">>;
|
|
49
50
|
interface Column<T> {
|
|
50
51
|
type?: ColumnTypes | string;
|
|
51
52
|
required?: boolean;
|
|
@@ -84,4 +85,4 @@ type DeleteQueryOptions<T> = {
|
|
|
84
85
|
type Doc<TDoc = any> = Document<TDoc> & TDoc;
|
|
85
86
|
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;
|
|
86
87
|
//#endregion
|
|
87
|
-
export { ClientConfig, Column, ColumnTypes, DeleteQueryOptions, Doc, FindQueryOptions, InferDoc, InsertQueryOptions, Query, QueryOperators, TableKeys, UpdateQueryOptions };
|
|
88
|
+
export { ClientConfig, Column, ColumnTypes, DeleteQueryOptions, Doc, FindQueryOptions, InferDoc, InsertQueryOptions, Query, QueryOperators, TableClusteringOrder, TableKeys, UpdateQueryOptions };
|