Skip to content

Commit acf8e82

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-6vedk4
2 parents b905c57 + fa74b48 commit acf8e82

37 files changed

Lines changed: 1652 additions & 77 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/rest': minor
4+
'@objectstack/client': minor
5+
---
6+
7+
feat(rest): `GET /api/v1/meta/app/{appId}/bundle` answers an app's metadata in one request, per caller, with an ETag (#27627)
8+
9+
Clause-②: yes (widening: a new route and its response shape; no existing route, key or answer changes)
10+
Metadata-protocol: added
11+
12+
A console working inside one app used to read the app, then one `GET /meta/object/{name}` per object it opened, then the views, pages and dashboards those draw, each as its own request. The new route answers them together (`AppMetadataBundleResponseSchema`, `@objectstack/spec/api`):
13+
14+
- **What is in it**: the app with its navigation; every object its navigation reaches (top-level, area and nested entries) and every object with a lookup or master-detail field referencing one of those; the views the navigation names or that bind to a bundled object; the pages the navigation names or that bind to a bundled object; the dashboards the navigation names.
15+
- **Every member is the item read it replaces, as the same caller**: the app is `GET /meta/app/{appId}`, and each entry is `GET /meta/{type}/{name}`, envelope included. Audience gates, list-view and dashboard permissions, the field-visibility mask, the translation to the request locale and `sortability` apply exactly as they apply to those reads. An item the caller may not read is absent from the bundle. An app the caller may not read refuses the whole request with the app read's own answer.
16+
- **Cached per caller**: a weak `ETag` over the body served to this caller (the `/meta` reads' shared rule), `Cache-Control: private, no-cache`, `Vary: Accept-Language`, and `If-None-Match` answered `304`. Two callers share a validator only when they are served the same body. A member whose field visibility could not be determined serves the bundle `private, no-store` with no `ETag`.
17+
- **Server-Timing**: the bundle's metadata reads are timed as a `meta` span beside `db` and `total`, under the existing gate (`OS_SERVER_TIMING=true`, or `X-OS-Debug-Timing: 1` from an admin).
18+
- The query-parameter set is closed and empty.
19+
- `@objectstack/client` gains `meta.getAppBundle(appId, { ifNoneMatch })`, conditional in `meta.getCached`'s spelling: it answers `{ notModified: false, data, etag }` on a `200` and `{ notModified: true, etag }` on a `304`, and a `304` is not thrown as a failed request.
20+
- `meta.getCached` now answers a matching `If-None-Match` / `If-Modified-Since` with `{ notModified: true }` through the same opt-in. Before, the transport threw on the `304` before the method's own `304` branch could run.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/runtime': minor
4+
---
5+
6+
feat(spec,runtime): every served package row carries `disableable`, the disable door's own verdict, beside `writable`
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: added
10+
11+
- **New key.** `SERVED_ROW_VERDICTS` in `@objectstack/spec/api-assembled` declares `disableable: boolean` on both stage branches of `InstalledPackageAtEitherStageSchema`, so `GET /api/v1/packages` and `GET /api/v1/packages/:id` serve it on every row. It answers "may an org disable this package here?": `true` for a writable base and for a module of an installed app (a `type: 'module'` package that directly depends on an installed `type: 'app'` package, outside a `system` / `cloud` scope), `false` for every other read-only package.
12+
- **One predicate.** The runtime computes the served value with the same predicate `PATCH /api/v1/packages/:id/disable` asks before it switches a package off, so the row and the door cannot disagree. The caller's own permission and a catalog wall are still asked at the door; the verdict is about the package only.
13+
- **`writable` is unchanged.** A module of an installed app is `disableable: true` and `writable: false`: it may be switched off, never authored into. A client offers Disable / Enable from `disableable`, and authoring from `writable`.
14+
- **Who sees it.** A customer admin on the Packages page: once the Console reads this key, it can offer Disable on a suite module the server already accepts.

‎content/docs/references/api/app-bundle.mdx‎

Lines changed: 198 additions & 0 deletions
Large diffs are not rendered by default.

‎content/docs/references/api/index.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: API Protocol — complete schema reference
33
navTitle: API Protocol
4-
description: "The ObjectStack API Protocol in 33 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
4+
description: "The ObjectStack API Protocol in 34 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -10,6 +10,7 @@ This section contains all protocol schemas for the api layer of ObjectStack.
1010

1111
<Cards>
1212
<Card href="/docs/references/api/analytics" title="Analytics" description="Source: packages/spec/src/api/analytics.zod.ts" />
13+
<Card href="/docs/references/api/app-bundle" title="App Bundle" description="Source: packages/spec/src/api/app-bundle.zod.ts" />
1314
<Card href="/docs/references/api/auth" title="Auth" description="Source: packages/spec/src/api/auth.zod.ts" />
1415
<Card href="/docs/references/api/auth-endpoints" title="Auth Endpoints" description="Source: packages/spec/src/api/auth-endpoints.zod.ts" />
1516
<Card href="/docs/references/api/automation-api" title="Automation Api" description="Source: packages/spec/src/api/automation-api.zod.ts" />

‎content/docs/references/api/meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"plugin-rest-api",
3333
"storage",
3434
"---More---",
35+
"app-bundle",
3536
"error-code-ledger",
3637
"misc",
3738
"package-api-assembled",

‎content/docs/references/api/package-api-assembled.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Get installed package response
211211
| **upgradeHistory** | `{ fromVersion: string; toVersion: string; upgradedAt: string; status: Enum<'success' \| 'failed' \| 'rolled_back'>; … }[]` | optional | Version upgrade history |
212212
| **registeredNamespaces** | `string[]` | optional | Namespace prefixes registered by this package |
213213
| **writable** | `boolean` | ✅ | Whether this server lets an org author into and manage this package (a writable base); false for a read-only package. Computed per read by the server's own predicate, never stored |
214+
| **disableable** | `boolean` | ✅ | Whether this server lets an org disable this package: the disable door's own verdict, true for a writable base and for a module of an installed app, false for every other read-only package. A client offers Disable / Enable from it, never from writable. Computed per read by the server's own predicate, never stored |
214215

215216
### Nested Shape: `GetInstalledPackageResponse.data[option 2]`
216217

@@ -230,6 +231,7 @@ Get installed package response
230231
| **upgradeHistory** | `{ fromVersion: string; toVersion: string; upgradedAt: string; status: Enum<'success' \| 'failed' \| 'rolled_back'>; … }[]` | optional | Version upgrade history |
231232
| **registeredNamespaces** | `string[]` | optional | Namespace prefixes registered by this package |
232233
| **writable** | `boolean` | ✅ | Whether this server lets an org author into and manage this package (a writable base); false for a read-only package. Computed per read by the server's own predicate, never stored |
234+
| **disableable** | `boolean` | ✅ | Whether this server lets an org disable this package: the disable door's own verdict, true for a writable base and for a module of an installed app, false for every other read-only package. A client offers Disable / Enable from it, never from writable. Computed per read by the server's own predicate, never stored |
233235

234236

235237
---
@@ -262,6 +264,7 @@ This schema accepts one of the following structures:
262264
| **upgradeHistory** | `{ fromVersion: string; toVersion: string; upgradedAt: string; status: Enum<'success' \| 'failed' \| 'rolled_back'>; … }[]` | optional | Version upgrade history |
263265
| **registeredNamespaces** | `string[]` | optional | Namespace prefixes registered by this package |
264266
| **writable** | `boolean` | ✅ | Whether this server lets an org author into and manage this package (a writable base); false for a read-only package. Computed per read by the server's own predicate, never stored |
267+
| **disableable** | `boolean` | ✅ | Whether this server lets an org disable this package: the disable door's own verdict, true for a writable base and for a module of an installed app, false for every other read-only package. A client offers Disable / Enable from it, never from writable. Computed per read by the server's own predicate, never stored |
265268

266269
### Nested Shape: `InstalledPackageAtEitherStage[option 1].manifest`
267270

@@ -325,6 +328,7 @@ This schema accepts one of the following structures:
325328
| **upgradeHistory** | `{ fromVersion: string; toVersion: string; upgradedAt: string; status: Enum<'success' \| 'failed' \| 'rolled_back'>; … }[]` | optional | Version upgrade history |
326329
| **registeredNamespaces** | `string[]` | optional | Namespace prefixes registered by this package |
327330
| **writable** | `boolean` | ✅ | Whether this server lets an org author into and manage this package (a writable base); false for a read-only package. Computed per read by the server's own predicate, never stored |
331+
| **disableable** | `boolean` | ✅ | Whether this server lets an org disable this package: the disable door's own verdict, true for a writable base and for a module of an installed app, false for every other read-only package. A client offers Disable / Enable from it, never from writable. Computed per read by the server's own predicate, never stored |
328332

329333
### Nested Shape: `InstalledPackageAtEitherStage[option 2].manifest`
330334

‎content/docs/references/index.mdx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Protocol reference — every schema by module
33
navTitle: Protocol Reference
4-
description: Every schema published by @objectstack/spec — 1570 schemas across 14 protocol modules
4+
description: Every schema published by @objectstack/spec — 1571 schemas across 14 protocol modules
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -21,7 +21,7 @@ counts are sums of the rows they head. Regenerate with
2121
| Module | Pages | Schemas | Description |
2222
| :--- | ---: | ---: | :--- |
2323
| [AI Protocol](/docs/references/ai) | 12 | 68 | Agents, tools, skills, RAG and knowledge sources, model registry, conversations. |
24-
| [API Protocol](/docs/references/api) | 33 | 451 | REST contracts, endpoints, routing, realtime, batch, discovery. |
24+
| [API Protocol](/docs/references/api) | 34 | 452 | REST contracts, endpoints, routing, realtime, batch, discovery. |
2525
| [Automation Protocol](/docs/references/automation) | 15 | 77 | Flows and their nodes, approvals, ETL pipelines, webhooks, state machines, execution records. |
2626
| [Data Protocol](/docs/references/data) | 31 | 174 | Objects, fields, queries, filters, datasources and drivers — the ObjectQL layer. |
2727
| [Identity Protocol](/docs/references/identity) | 5 | 27 | Users and accounts, organizations, positions, SCIM provisioning. |
@@ -34,7 +34,7 @@ counts are sums of the rows they head. Regenerate with
3434
| [Studio Protocol](/docs/references/studio) | 3 | 35 | Studio designer metadata — the authoring surfaces for the protocols above. |
3535
| [System Protocol](/docs/references/system) | 37 | 287 | The runtime environment — logging, jobs, cache, metrics, notifications, i18n and compliance. |
3636
| [UI Protocol](/docs/references/ui) | 16 | 172 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. |
37-
| **Total** | **203** | **1570** | 14 protocol modules |
37+
| **Total** | **204** | **1571** | 14 protocol modules |
3838

3939
---
4040

@@ -63,13 +63,14 @@ Agents, tools, skills, RAG and knowledge sources, model registry, conversations.
6363

6464
## API Protocol
6565

66-
**Source:** `packages/spec/src/api/` · **Import:** `@objectstack/spec/api` · **33 pages, 451 schemas**
66+
**Source:** `packages/spec/src/api/` · **Import:** `@objectstack/spec/api` · **34 pages, 452 schemas**
6767

6868
REST contracts, endpoints, routing, realtime, batch, discovery.
6969

7070
| File | Schemas |
7171
| :--- | :--- |
7272
| [`analytics.zod.ts`](/docs/references/api/analytics) | `AnalyticsEndpoint`, `AnalyticsMetadataResponse`, `AnalyticsQueryRequest`, `AnalyticsResultResponse`, `AnalyticsSqlResponse`, `DatasetCompareTo`, `DatasetSelection`, `DatasetTotals`, `GetAnalyticsMetaRequest` |
73+
| [`app-bundle.zod.ts`](/docs/references/api/app-bundle) | `AppMetadataBundleResponse` |
7374
| [`auth.zod.ts`](/docs/references/api/auth) | `AuthProvider`, `LoginRequest`, `LoginType`, `RefreshTokenRequest`, `RegisterRequest`, `Session`, `SessionResponse`, `SessionUser`, `UserProfileResponse` |
7475
| [`auth-endpoints.zod.ts`](/docs/references/api/auth-endpoints) | `AuthEndpoint`, `AuthFeaturesConfig`, `AuthProviderInfo`, `DeviceRequestResponse`, `DeviceTokenResponse`, `EmailPasswordConfigPublic`, `GetAuthConfigResponse` |
7576
| [`automation-api.zod.ts`](/docs/references/api/automation-api) | `AutomationApiErrorCode`, `AutomationFlowPathParams`, `AutomationRunPathParams`, `CreateFlowRequest`, `CreateFlowResponse`, `DeleteFlowRequest`, `DeleteFlowResponse`, `FlowFailureDetails`, `FlowInnerRefusal`, `GetFlowRequest`, `GetFlowResponse`, `GetRunRequest`, `GetRunResponse`, `ListRunsRequest`, `ListRunsResponse`, `ResumeFailureDetails`, `ToggleFlowRequest`, `ToggleFlowResponse`, `TriggerFlowRequest`, `TriggerFlowResponse`, `UpdateFlowRequest`, `UpdateFlowResponse` |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/api.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `api/` | 460 |
22+
| `api/` | 461 |

‎packages/client/src/index.ts‎

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
GetRecordFieldAccessResponse,
88
RecordPageRequest,
99
RecordPageResponse,
10+
AppMetadataBundleResponse,
1011
UpdateManyRequest,
1112
DeleteManyRequest,
1213
BatchOptions,
@@ -252,6 +253,15 @@ export interface ClientConfig {
252253
*/
253254
export type DiscoveryResult = GetDiscoveryResponse;
254255

256+
/**
257+
* [#27627] `meta.getAppBundle`'s answer: the bundle and its validator, or
258+
* `notModified` when the `ifNoneMatch` sent still names what the server would
259+
* serve this caller.
260+
*/
261+
export type AppBundleCacheResponse =
262+
| { notModified: false; data: AppMetadataBundleResponse; etag?: { value: string; weak: boolean } }
263+
| { notModified: true; etag?: { value: string; weak: boolean } };
264+
255265
/**
256266
* @deprecated Use `data.query()` with standard QueryAST parameters instead.
257267
* This interface uses legacy parameter names (filter/sort/top/skip) that
@@ -2092,9 +2102,11 @@ export class ObjectStackClient {
20922102
headers['If-Modified-Since'] = cacheOptions.ifModifiedSince;
20932103
}
20942104

2105+
// [#27627] The 304 is admitted by the transport; without it `fetch` threw on the
2106+
// non-ok status and the branch below was unreachable.
20952107
const res = await this.fetch(`${this.baseUrl}${route}/object/${name}`, {
20962108
headers
2097-
});
2109+
}, { admitNotModified: true });
20982110

20992111
// Check for 304 Not Modified
21002112
if (res.status === 304) {
@@ -2262,6 +2274,33 @@ export class ObjectStackClient {
22622274
return this.unwrapResponse<FindReferencesToMetaResponse>(res);
22632275
},
22642276

2277+
/**
2278+
* [#27627] The app metadata bundle: the app and the objects, views, pages
2279+
* and dashboards its navigation reaches, each as its own
2280+
* `GET /meta/{type}/{name}` answers it to this caller, in one request
2281+
* (`GET /meta/app/{appId}/bundle`). An item the caller may not read is
2282+
* absent; an app the caller may not read rejects with the app read's own
2283+
* answer. The response carries a per-caller `ETag` under
2284+
* `Cache-Control: private, no-cache`, so the platform's HTTP cache
2285+
* revalidates it with `If-None-Match`.
2286+
*/
2287+
getAppBundle: async (appId: string, cacheOptions?: { ifNoneMatch?: string }): Promise<AppBundleCacheResponse> => {
2288+
// The conditional spelling is `getCached`'s (`MetadataCacheRequest.ifNoneMatch` in,
2289+
// `notModified` + `etag: { value, weak }` out), with the 304 admitted by the transport
2290+
// instead of thrown as a failed request.
2291+
const route = this.getRoute('metadata');
2292+
const res = await this.fetch(
2293+
`${this.baseUrl}${route}/app/${encodeURIComponent(appId)}/bundle`,
2294+
cacheOptions?.ifNoneMatch ? { headers: { 'If-None-Match': cacheOptions.ifNoneMatch } } : {},
2295+
{ admitNotModified: true },
2296+
);
2297+
const header = res.headers.get('ETag');
2298+
const etag = header ? { value: header.replace(/^W\/|"/g, ''), weak: header.startsWith('W/') } : undefined;
2299+
if (res.status === 304) return { notModified: true, ...(etag ? { etag } : {}) };
2300+
const data = await this.unwrapResponse<AppMetadataBundleResponse>(res);
2301+
return { notModified: false, data, ...(etag ? { etag } : {}) };
2302+
},
2303+
22652304
/**
22662305
* ADR-0046 §6: resolve a book spine against the docs that exist now.
22672306
* An unknown name is treated as a package id (implicit per-package book).
@@ -7599,7 +7638,11 @@ export class ObjectStackClient {
75997638
this.token = token;
76007639
}
76017640

7602-
private async fetch(url: string, options: RequestInit = {}): Promise<Response> {
7641+
/**
7642+
* `transport.admitNotModified` — [#27627] a conditional read's `304` is its
7643+
* answer, not a failure: returned to the caller instead of thrown.
7644+
*/
7645+
private async fetch(url: string, options: RequestInit = {}, transport: { admitNotModified?: boolean } = {}): Promise<Response> {
76037646
this.logger.debug('HTTP request', {
76047647
method: options.method || 'GET',
76057648
url,
@@ -7635,7 +7678,7 @@ export class ObjectStackClient {
76357678
ok: res.ok
76367679
});
76377680

7638-
if (!res.ok) {
7681+
if (!res.ok && !(transport.admitNotModified && res.status === 304)) {
76397682
let errorBody: any;
76407683
try {
76417684
errorBody = await res.json();

0 commit comments

Comments
 (0)