@rebasepro/server-core 0.2.1 → 0.2.3
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/common/src/data/query_builder.d.ts +51 -0
- package/dist/common/src/index.d.ts +1 -0
- package/dist/index.es.js +174 -162
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +174 -162
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/data.d.ts +21 -0
- package/jest.config.cjs +4 -1
- package/package.json +6 -6
|
@@ -76,6 +76,21 @@ export interface FindResponse<M extends Record<string, unknown> = Record<string,
|
|
|
76
76
|
hasMore: boolean;
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
export type FilterOperator = WhereFilterOpShort;
|
|
80
|
+
/**
|
|
81
|
+
* Fluent Query Builder Interface supported on both client and server accessors.
|
|
82
|
+
* @group Data
|
|
83
|
+
*/
|
|
84
|
+
export interface QueryBuilderInterface<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
85
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): this;
|
|
86
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
|
|
87
|
+
limit(count: number): this;
|
|
88
|
+
offset(count: number): this;
|
|
89
|
+
search(searchString: string): this;
|
|
90
|
+
include(...relations: string[]): this;
|
|
91
|
+
find(): Promise<FindResponse<M>>;
|
|
92
|
+
listen(onUpdate: (data: FindResponse<M>) => void, onError?: (error: Error) => void): () => void;
|
|
93
|
+
}
|
|
79
94
|
/**
|
|
80
95
|
* A single collection's CRUD accessor.
|
|
81
96
|
*
|
|
@@ -124,6 +139,12 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
124
139
|
* Count the number of records matching the given filter.
|
|
125
140
|
*/
|
|
126
141
|
count?(params?: FindParams): Promise<number>;
|
|
142
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): QueryBuilderInterface<M>;
|
|
143
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilderInterface<M>;
|
|
144
|
+
limit(count: number): QueryBuilderInterface<M>;
|
|
145
|
+
offset(count: number): QueryBuilderInterface<M>;
|
|
146
|
+
search(searchString: string): QueryBuilderInterface<M>;
|
|
147
|
+
include(...relations: string[]): QueryBuilderInterface<M>;
|
|
127
148
|
}
|
|
128
149
|
/**
|
|
129
150
|
* The unified data access object.
|
package/jest.config.cjs
CHANGED
|
@@ -10,7 +10,10 @@ module.exports = {
|
|
|
10
10
|
],
|
|
11
11
|
// This helps Jest resolve monorepo packages
|
|
12
12
|
moduleNameMapper: {
|
|
13
|
-
"^@
|
|
13
|
+
"^@rebasepro/client$": "<rootDir>/../client/src/index.ts",
|
|
14
|
+
"^@rebasepro/common$": "<rootDir>/../common/src/index.ts",
|
|
15
|
+
"^@rebasepro/types$": "<rootDir>/../types/src/index.ts",
|
|
16
|
+
"^@rebasepro/utils$": "<rootDir>/../utils/src/index.ts",
|
|
14
17
|
"^(\\.{1,2}/.*)\\.js$": "$1"
|
|
15
18
|
}
|
|
16
19
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/server-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "Database-Agnostic Backend Core for Rebase",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/rebasepro/rebase.git",
|
|
14
|
-
"directory": "packages/
|
|
14
|
+
"directory": "packages/server-core"
|
|
15
15
|
},
|
|
16
16
|
"main": "./dist/index.umd.js",
|
|
17
17
|
"module": "./dist/index.es.js",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"ts-morph": "27.0.2",
|
|
54
54
|
"ws": "^8.20.1",
|
|
55
55
|
"zod": "^3.25.76",
|
|
56
|
-
"@rebasepro/common": "0.2.
|
|
57
|
-
"@rebasepro/client": "0.2.
|
|
58
|
-
"@rebasepro/types": "0.2.
|
|
59
|
-
"@rebasepro/utils": "0.2.
|
|
56
|
+
"@rebasepro/common": "0.2.3",
|
|
57
|
+
"@rebasepro/client": "0.2.3",
|
|
58
|
+
"@rebasepro/types": "0.2.3",
|
|
59
|
+
"@rebasepro/utils": "0.2.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/jest": "^29.5.14",
|