@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 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, FilterNode, SortNode, AggregationNode } from '@objectstack/spec/data';
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> | FilterNode;
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, ids: string[], data: Partial<T>) => Promise<number>;
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, ids: string[]) => Promise<{
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, ids, data) => {
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({ ids, data })
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, ids) => {
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({ ids })
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.2",
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.3.2"
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, FilterNode, SortNode, AggregationNode, WindowFunctionNode } from '@objectstack/spec/data';
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> | FilterNode; // Map or AST
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, ids: string[], data: Partial<T>): Promise<number> => {
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({ ids, data })
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, ids: string[]): Promise<{ count: number }> => {
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({ ids })
210
+ body: JSON.stringify({ filters })
212
211
  });
213
212
  return res.json();
214
213
  }