@objectstack/client 3.1.1 → 3.2.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +8 -0
- package/package.json +9 -9
- package/src/client.hono.test.ts +12 -0
- package/src/client.msw.test.ts +12 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @objectstack/client@3.
|
|
2
|
+
> @objectstack/client@3.2.0 build /home/runner/work/spec/spec/packages/client
|
|
3
3
|
> tsup --config ../../tsup.config.ts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m52.00 KB[39m
|
|
14
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m104.19 KB[39m
|
|
15
|
-
[32mESM[39m ⚡️ Build success in 41ms
|
|
16
13
|
[32mCJS[39m [1mdist/index.js [22m[32m53.17 KB[39m
|
|
17
14
|
[32mCJS[39m [1mdist/index.js.map [22m[32m104.24 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 53ms
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m52.00 KB[39m
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m104.19 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 53ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 5625ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m30.61 KB[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m30.61 KB[39m
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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.
|
|
17
|
-
"@objectstack/spec": "3.
|
|
16
|
+
"@objectstack/core": "3.2.0",
|
|
17
|
+
"@objectstack/spec": "3.2.0"
|
|
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.
|
|
25
|
-
"@objectstack/hono": "3.
|
|
26
|
-
"@objectstack/objectql": "3.
|
|
27
|
-
"@objectstack/plugin-hono-server": "3.
|
|
28
|
-
"@objectstack/plugin-msw": "3.
|
|
29
|
-
"@objectstack/runtime": "3.
|
|
24
|
+
"@objectstack/driver-memory": "3.2.0",
|
|
25
|
+
"@objectstack/hono": "3.2.0",
|
|
26
|
+
"@objectstack/objectql": "3.2.0",
|
|
27
|
+
"@objectstack/plugin-hono-server": "3.2.0",
|
|
28
|
+
"@objectstack/plugin-msw": "3.2.0",
|
|
29
|
+
"@objectstack/runtime": "3.2.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup --config ../../tsup.config.ts",
|
package/src/client.hono.test.ts
CHANGED
|
@@ -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
|
}
|
package/src/client.msw.test.ts
CHANGED
|
@@ -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
|
-
|
|
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 };
|