@objectstack/runtime 3.3.1 → 4.0.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/runtime@3.3.1 build /home/runner/work/spec/spec/packages/runtime
2
+ > @objectstack/runtime@4.0.1 build /home/runner/work/spec/spec/packages/runtime
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.js 87.23 KB
14
- ESM dist/index.js.map 187.79 KB
15
- ESM ⚡️ Build success in 248ms
16
- CJS dist/index.cjs 89.81 KB
17
- CJS dist/index.cjs.map 187.86 KB
18
- CJS ⚡️ Build success in 260ms
13
+ CJS dist/index.cjs 90.76 KB
14
+ CJS dist/index.cjs.map 190.74 KB
15
+ CJS ⚡️ Build success in 162ms
16
+ ESM dist/index.js 88.17 KB
17
+ ESM dist/index.js.map 190.67 KB
18
+ ESM ⚡️ Build success in 167ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 13170ms
20
+ DTS ⚡️ Build success in 5297ms
21
21
  DTS dist/index.d.ts 24.35 KB
22
22
  DTS dist/index.d.cts 24.35 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @objectstack/runtime
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - f08ffc3: Fix discovery API endpoint routing and protocol consistency.
8
+
9
+ **Discovery route standardization:**
10
+
11
+ - All adapters (Express, Fastify, Hono, NestJS, Next.js, Nuxt, SvelteKit) now mount the discovery endpoint at `{prefix}/discovery` instead of `{prefix}` root.
12
+ - `.well-known/objectstack` redirects now point to `{prefix}/discovery`.
13
+ - Client `connect()` fallback URL changed from `/api/v1` to `/api/v1/discovery`.
14
+ - Runtime dispatcher handles both `/discovery` (standard) and `/` (legacy) for backward compatibility.
15
+
16
+ **Schema & route alignment:**
17
+
18
+ - Added `storage` (service: `file-storage`) and `feed` (service: `data`) routes to `DEFAULT_DISPATCHER_ROUTES`.
19
+ - Added `feed` and `discovery` fields to `ApiRoutesSchema`.
20
+ - Unified `GetDiscoveryResponseSchema` with `DiscoverySchema` as single source of truth.
21
+ - Client `getRoute('feed')` fallback updated from `/api/v1/data` to `/api/v1/feed`.
22
+
23
+ **Type safety:**
24
+
25
+ - Extracted `ApiRouteType` from `ApiRoutes` keys for type-safe client route resolution.
26
+ - Removed `as any` type casting in client route access.
27
+
28
+ - e0b0a78: Deprecate DataEngineQueryOptions in favor of QueryAST-aligned EngineQueryOptions.
29
+
30
+ Engine, Protocol, and Client now use standard QueryAST parameter names:
31
+
32
+ - `filter` → `where`
33
+ - `select` → `fields`
34
+ - `sort` → `orderBy`
35
+ - `skip` → `offset`
36
+ - `populate` → `expand`
37
+ - `top` → `limit`
38
+
39
+ The old DataEngine\* schemas and types are preserved with `@deprecated` markers for backward compatibility.
40
+
41
+ - Updated dependencies [f08ffc3]
42
+ - Updated dependencies [e0b0a78]
43
+ - @objectstack/spec@4.0.0
44
+ - @objectstack/core@4.0.0
45
+ - @objectstack/rest@4.0.0
46
+ - @objectstack/types@4.0.0
47
+
3
48
  ## 3.3.1
4
49
 
5
50
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -342,8 +342,8 @@ var SeedLoaderService = class {
342
342
  async resolveFromDatabase(targetObject, targetField, value) {
343
343
  try {
344
344
  const records = await this.engine.find(targetObject, {
345
- filter: { [targetField]: value },
346
- select: ["id"],
345
+ where: { [targetField]: value },
346
+ fields: ["id"],
347
347
  limit: 1
348
348
  });
349
349
  if (records && records.length > 0) {
@@ -563,7 +563,7 @@ var SeedLoaderService = class {
563
563
  const map = /* @__PURE__ */ new Map();
564
564
  try {
565
565
  const records = await this.engine.find(objectName, {
566
- select: ["id", externalId]
566
+ fields: ["id", externalId]
567
567
  });
568
568
  for (const record of records || []) {
569
569
  const key = String(record[externalId] ?? "");
@@ -1286,7 +1286,29 @@ var HttpDispatcher = class {
1286
1286
  }
1287
1287
  } else {
1288
1288
  if (m === "GET") {
1289
- const result = await broker.call("data.query", { object: objectName, query }, { request: context.request });
1289
+ const normalized = { ...query };
1290
+ if (normalized.filter != null || normalized.filters != null) {
1291
+ normalized.where = normalized.where ?? normalized.filter ?? normalized.filters;
1292
+ delete normalized.filter;
1293
+ delete normalized.filters;
1294
+ }
1295
+ if (normalized.select != null && normalized.fields == null) {
1296
+ normalized.fields = normalized.select;
1297
+ delete normalized.select;
1298
+ }
1299
+ if (normalized.sort != null && normalized.orderBy == null) {
1300
+ normalized.orderBy = normalized.sort;
1301
+ delete normalized.sort;
1302
+ }
1303
+ if (normalized.top != null && normalized.limit == null) {
1304
+ normalized.limit = normalized.top;
1305
+ delete normalized.top;
1306
+ }
1307
+ if (normalized.skip != null && normalized.offset == null) {
1308
+ normalized.offset = normalized.skip;
1309
+ delete normalized.skip;
1310
+ }
1311
+ const result = await broker.call("data.query", { object: objectName, query: normalized }, { request: context.request });
1290
1312
  return { handled: true, response: this.success(result) };
1291
1313
  }
1292
1314
  if (m === "POST") {
@@ -1736,7 +1758,7 @@ var HttpDispatcher = class {
1736
1758
  */
1737
1759
  async dispatch(method, path, body, query, context) {
1738
1760
  const cleanPath = path.replace(/\/$/, "");
1739
- if (cleanPath === "" && method === "GET") {
1761
+ if ((cleanPath === "/discovery" || cleanPath === "") && method === "GET") {
1740
1762
  const info = await this.getDiscoveryInfo("");
1741
1763
  return {
1742
1764
  handled: true,