@objectstack/client 0.3.2 → 0.4.1
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/CHANGELOG.md +34 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -5
- package/package.json +2 -2
- package/src/index.ts +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @objectstack/client
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Version synchronization and dependency updates
|
|
8
|
+
|
|
9
|
+
- Synchronized plugin-msw version to 0.4.1
|
|
10
|
+
- Updated runtime peer dependency versions to ^0.4.1
|
|
11
|
+
- Fixed internal dependency version mismatches
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @objectstack/spec@0.4.1
|
|
15
|
+
|
|
16
|
+
## 0.4.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Release version 0.4.0
|
|
21
|
+
|
|
22
|
+
## 0.3.3
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Workflow and configuration improvements
|
|
27
|
+
|
|
28
|
+
- Enhanced GitHub workflows for CI, release, and PR automation
|
|
29
|
+
- Added comprehensive prompt templates for different protocol areas
|
|
30
|
+
- Improved project documentation and automation guides
|
|
31
|
+
- Updated changeset configuration
|
|
32
|
+
- Added cursor rules for better development experience
|
|
33
|
+
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @objectstack/spec@0.3.3
|
|
36
|
+
|
|
3
37
|
## 0.3.2
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryAST,
|
|
1
|
+
import { QueryAST, SortNode, AggregationNode } from '@objectstack/spec/data';
|
|
2
2
|
export interface ClientConfig {
|
|
3
3
|
baseUrl: string;
|
|
4
4
|
token?: string;
|
|
@@ -19,7 +19,7 @@ export interface DiscoveryResult {
|
|
|
19
19
|
}
|
|
20
20
|
export interface QueryOptions {
|
|
21
21
|
select?: string[];
|
|
22
|
-
filters?: Record<string, any
|
|
22
|
+
filters?: Record<string, any>;
|
|
23
23
|
sort?: string | string[] | SortNode[];
|
|
24
24
|
top?: number;
|
|
25
25
|
skip?: number;
|
|
@@ -61,11 +61,11 @@ export declare class ObjectStackClient {
|
|
|
61
61
|
create: <T = any>(object: string, data: Partial<T>) => Promise<T>;
|
|
62
62
|
createMany: <T = any>(object: string, data: Partial<T>[]) => Promise<T[]>;
|
|
63
63
|
update: <T = any>(object: string, id: string, data: Partial<T>) => Promise<T>;
|
|
64
|
-
updateMany: <T = any>(object: string,
|
|
64
|
+
updateMany: <T = any>(object: string, data: Partial<T>, filters?: Record<string, any> | any[]) => Promise<number>;
|
|
65
65
|
delete: (object: string, id: string) => Promise<{
|
|
66
66
|
success: boolean;
|
|
67
67
|
}>;
|
|
68
|
-
deleteMany: (object: string,
|
|
68
|
+
deleteMany: (object: string, filters?: Record<string, any> | any[]) => Promise<{
|
|
69
69
|
count: number;
|
|
70
70
|
}>;
|
|
71
71
|
};
|
package/dist/index.js
CHANGED
|
@@ -110,12 +110,11 @@ export class ObjectStackClient {
|
|
|
110
110
|
});
|
|
111
111
|
return res.json();
|
|
112
112
|
},
|
|
113
|
-
updateMany: async (object,
|
|
114
|
-
// Warning: This implies updating all IDs with the SAME data
|
|
113
|
+
updateMany: async (object, data, filters) => {
|
|
115
114
|
const route = this.getRoute('data');
|
|
116
115
|
const res = await this.fetch(`${this.baseUrl}${route}/${object}/batch`, {
|
|
117
116
|
method: 'PATCH',
|
|
118
|
-
body: JSON.stringify({
|
|
117
|
+
body: JSON.stringify({ data, filters })
|
|
119
118
|
});
|
|
120
119
|
return res.json(); // Returns count
|
|
121
120
|
},
|
|
@@ -126,11 +125,11 @@ export class ObjectStackClient {
|
|
|
126
125
|
});
|
|
127
126
|
return res.json();
|
|
128
127
|
},
|
|
129
|
-
deleteMany: async (object,
|
|
128
|
+
deleteMany: async (object, filters) => {
|
|
130
129
|
const route = this.getRoute('data');
|
|
131
130
|
const res = await this.fetch(`${this.baseUrl}${route}/${object}/batch`, {
|
|
132
131
|
method: 'DELETE',
|
|
133
|
-
body: JSON.stringify({
|
|
132
|
+
body: JSON.stringify({ filters })
|
|
134
133
|
});
|
|
135
134
|
return res.json();
|
|
136
135
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Official Client SDK for ObjectStack Protocol",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@objectstack/spec": "0.
|
|
8
|
+
"@objectstack/spec": "0.4.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"typescript": "^5.0.0"
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QueryAST,
|
|
1
|
+
import { QueryAST, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec/data';
|
|
2
2
|
|
|
3
3
|
export interface ClientConfig {
|
|
4
4
|
baseUrl: string;
|
|
@@ -22,7 +22,7 @@ export interface DiscoveryResult {
|
|
|
22
22
|
|
|
23
23
|
export interface QueryOptions {
|
|
24
24
|
select?: string[]; // Simplified Selection
|
|
25
|
-
filters?: Record<string, any
|
|
25
|
+
filters?: Record<string, any>; // Map or AST
|
|
26
26
|
sort?: string | string[] | SortNode[]; // 'name' or ['-created_at'] or AST
|
|
27
27
|
top?: number;
|
|
28
28
|
skip?: number;
|
|
@@ -186,12 +186,11 @@ export class ObjectStackClient {
|
|
|
186
186
|
return res.json();
|
|
187
187
|
},
|
|
188
188
|
|
|
189
|
-
updateMany: async <T = any>(object: string,
|
|
190
|
-
// Warning: This implies updating all IDs with the SAME data
|
|
189
|
+
updateMany: async <T = any>(object: string, data: Partial<T>, filters?: Record<string, any> | any[]): Promise<number> => {
|
|
191
190
|
const route = this.getRoute('data');
|
|
192
191
|
const res = await this.fetch(`${this.baseUrl}${route}/${object}/batch`, {
|
|
193
192
|
method: 'PATCH',
|
|
194
|
-
body: JSON.stringify({
|
|
193
|
+
body: JSON.stringify({ data, filters })
|
|
195
194
|
});
|
|
196
195
|
return res.json(); // Returns count
|
|
197
196
|
},
|
|
@@ -204,11 +203,11 @@ export class ObjectStackClient {
|
|
|
204
203
|
return res.json();
|
|
205
204
|
},
|
|
206
205
|
|
|
207
|
-
deleteMany: async(object: string,
|
|
206
|
+
deleteMany: async(object: string, filters?: Record<string, any> | any[]): Promise<{ count: number }> => {
|
|
208
207
|
const route = this.getRoute('data');
|
|
209
208
|
const res = await this.fetch(`${this.baseUrl}${route}/${object}/batch`, {
|
|
210
209
|
method: 'DELETE',
|
|
211
|
-
body: JSON.stringify({
|
|
210
|
+
body: JSON.stringify({ filters })
|
|
212
211
|
});
|
|
213
212
|
return res.json();
|
|
214
213
|
}
|