@objectstack/client 3.1.1 → 3.2.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/client@3.1.1 build /home/runner/work/spec/spec/packages/client
2
+ > @objectstack/client@3.2.1 build /home/runner/work/spec/spec/packages/client
3
3
  > tsup --config ../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 52.00 KB
14
- ESM dist/index.mjs.map 104.19 KB
15
- ESM ⚡️ Build success in 41ms
16
13
  CJS dist/index.js 53.17 KB
17
14
  CJS dist/index.js.map 104.24 KB
18
- CJS ⚡️ Build success in 43ms
15
+ CJS ⚡️ Build success in 60ms
16
+ ESM dist/index.mjs 52.00 KB
17
+ ESM dist/index.mjs.map 104.19 KB
18
+ ESM ⚡️ Build success in 61ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 5348ms
20
+ DTS ⚡️ Build success in 5708ms
21
21
  DTS dist/index.d.mts 30.61 KB
22
22
  DTS dist/index.d.ts 30.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @objectstack/client
2
2
 
3
+ ## 3.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [850b546]
8
+ - @objectstack/spec@3.2.1
9
+ - @objectstack/core@3.2.1
10
+
11
+ ## 3.2.0
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [5901c29]
16
+ - @objectstack/spec@3.2.0
17
+ - @objectstack/core@3.2.0
18
+
3
19
  ## 3.1.1
4
20
 
5
21
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectstack/client",
3
- "version": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Official Client SDK for ObjectStack Protocol",
6
6
  "main": "dist/index.js",
@@ -13,20 +13,20 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "@objectstack/core": "3.1.1",
17
- "@objectstack/spec": "3.1.1"
16
+ "@objectstack/core": "3.2.1",
17
+ "@objectstack/spec": "3.2.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@hono/node-server": "^1.2.0",
21
21
  "msw": "^2.12.10",
22
22
  "typescript": "^5.0.0",
23
23
  "vitest": "^4.0.18",
24
- "@objectstack/driver-memory": "3.1.1",
25
- "@objectstack/hono": "3.1.1",
26
- "@objectstack/objectql": "3.1.1",
27
- "@objectstack/plugin-hono-server": "3.1.1",
28
- "@objectstack/plugin-msw": "3.1.1",
29
- "@objectstack/runtime": "3.1.1"
24
+ "@objectstack/driver-memory": "3.2.1",
25
+ "@objectstack/hono": "3.2.1",
26
+ "@objectstack/objectql": "3.2.1",
27
+ "@objectstack/plugin-hono-server": "3.2.1",
28
+ "@objectstack/plugin-msw": "3.2.1",
29
+ "@objectstack/runtime": "3.2.1"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup --config ../../tsup.config.ts",
@@ -31,6 +31,9 @@ describe('ObjectStackClient (with Hono Server)', () => {
31
31
 
32
32
  if (service === 'data') {
33
33
  const ql = kernel.getService<any>('objectql'); // Use 'objectql' service name for clarity
34
+ // Delegate to protocol service when available for proper expand/populate support
35
+ let protocol: any;
36
+ try { protocol = kernel.getService<any>('protocol'); } catch { /* not registered */ }
34
37
  if (method === 'create') {
35
38
  const res = await ql.insert(params.object, params.data);
36
39
  const record = { ...params.data, ...res };
@@ -38,15 +41,24 @@ describe('ObjectStackClient (with Hono Server)', () => {
38
41
  }
39
42
  // Params from HttpDispatcher: { object, id, ...query }
40
43
  if (method === 'get') {
44
+ if (protocol) {
45
+ return await protocol.getData({ object: params.object, id: params.id, expand: params.expand, select: params.select });
46
+ }
41
47
  const record = await ql.findOne(params.object, { where: { id: params.id } });
42
48
  return record ? { object: params.object, id: params.id, record } : null;
43
49
  }
44
50
  // Params from HttpDispatcher: { object, filters }
45
51
  if (method === 'query') {
52
+ if (protocol) {
53
+ return await protocol.findData({ object: params.object, query: params.query || params.filters });
54
+ }
46
55
  const records = await ql.find(params.object, { filter: params.filters });
47
56
  return { object: params.object, records, total: records.length };
48
57
  }
49
58
  if (method === 'find') {
59
+ if (protocol) {
60
+ return await protocol.findData({ object: params.object, query: params.query || params.filters });
61
+ }
50
62
  const records = await ql.find(params.object, { filter: params.filters });
51
63
  return { object: params.object, records, total: records.length };
52
64
  }
@@ -37,22 +37,33 @@ describe('ObjectStackClient (with MSW Plugin)', () => {
37
37
 
38
38
  if (service === 'data') {
39
39
  const ql = kernel.getService<any>('objectql');
40
+ // Delegate to protocol service when available for proper expand/populate support
41
+ let protocol: any;
42
+ try { protocol = kernel.getService<any>('protocol'); } catch { /* not registered */ }
40
43
  if (method === 'create') {
41
44
  const res = await ql.insert(params.object, params.data);
42
45
  const record = { ...params.data, ...res };
43
46
  return { object: params.object, id: record.id || record._id, record };
44
47
  }
45
48
  if (method === 'get') {
46
- // Ensure we search by 'id' explicitly for InMemoryDriver
49
+ if (protocol) {
50
+ return await protocol.getData({ object: params.object, id: params.id, expand: params.expand, select: params.select });
51
+ }
47
52
  const record = await ql.findOne(params.object, { where: { id: params.id } });
48
53
  return record ? { object: params.object, id: params.id, record } : null;
49
54
  }
50
55
  if (method === 'query') {
56
+ if (protocol) {
57
+ return await protocol.findData({ object: params.object, query: params.query });
58
+ }
51
59
  const queryOpts = params.query || {};
52
60
  const records = await ql.find(params.object, { filter: queryOpts.filters || queryOpts.filter });
53
61
  return { object: params.object, records, total: records.length };
54
62
  }
55
63
  if (method === 'find') {
64
+ if (protocol) {
65
+ return await protocol.findData({ object: params.object, query: params.query });
66
+ }
56
67
  const queryOpts = params.query || {};
57
68
  const records = await ql.find(params.object, { filter: queryOpts.filters || queryOpts.filter });
58
69
  return { object: params.object, records, total: records.length };