@objectstack/runtime 9.2.0 → 9.3.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/dist/index.cjs +48 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +48 -3
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
package/dist/index.cjs
CHANGED
|
@@ -1230,7 +1230,8 @@ var init_app_plugin = __esm({
|
|
|
1230
1230
|
"sharingRules",
|
|
1231
1231
|
"ragPipelines",
|
|
1232
1232
|
"data",
|
|
1233
|
-
"emailTemplates"
|
|
1233
|
+
"emailTemplates",
|
|
1234
|
+
"docs"
|
|
1234
1235
|
];
|
|
1235
1236
|
const hasAppPayload = APP_CATEGORY_KEYS.some((k) => {
|
|
1236
1237
|
const v = (bundle && bundle[k]) ?? (sys && sys[k]);
|
|
@@ -2172,6 +2173,23 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
2172
2173
|
body: { success: false, error: { message, code, details } }
|
|
2173
2174
|
};
|
|
2174
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* ADR-0046: `doc` list responses omit `content` by default — manuals
|
|
2178
|
+
* are the one metadata payload that grows unbounded, and the list
|
|
2179
|
+
* surface only needs `name` + `label`. `?include=content` opts back in
|
|
2180
|
+
* (single-item GET /metadata/doc/:name always returns the full body).
|
|
2181
|
+
*/
|
|
2182
|
+
slimDocList(type, data, query) {
|
|
2183
|
+
if (type !== "doc" || query?.include === "content") return data;
|
|
2184
|
+
const strip = (items) => items.map((i) => {
|
|
2185
|
+
if (!i || typeof i !== "object") return i;
|
|
2186
|
+
const { content: _content, ...rest } = i;
|
|
2187
|
+
return rest;
|
|
2188
|
+
});
|
|
2189
|
+
if (Array.isArray(data)) return strip(data);
|
|
2190
|
+
if (data && Array.isArray(data.items)) return { ...data, items: strip(data.items) };
|
|
2191
|
+
return data;
|
|
2192
|
+
}
|
|
2175
2193
|
/**
|
|
2176
2194
|
* 404 Route Not Found — no route is registered for this path.
|
|
2177
2195
|
*/
|
|
@@ -3003,7 +3021,7 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
3003
3021
|
const previewDrafts = query?.preview === "draft";
|
|
3004
3022
|
const data = await protocol.getMetaItems({ type: typeOrName, packageId, organizationId, previewDrafts });
|
|
3005
3023
|
if (data && (data.items !== void 0 || Array.isArray(data))) {
|
|
3006
|
-
return { handled: true, response: this.success(data) };
|
|
3024
|
+
return { handled: true, response: this.success(this.slimDocList(typeOrName, data, query)) };
|
|
3007
3025
|
}
|
|
3008
3026
|
} catch {
|
|
3009
3027
|
}
|
|
@@ -3016,7 +3034,7 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
3016
3034
|
items = items.filter((item) => item?._packageId === packageId);
|
|
3017
3035
|
}
|
|
3018
3036
|
if (items && items.length > 0) {
|
|
3019
|
-
return { handled: true, response: this.success({ type: typeOrName, items }) };
|
|
3037
|
+
return { handled: true, response: this.success({ type: typeOrName, items: this.slimDocList(typeOrName, items, query) }) };
|
|
3020
3038
|
}
|
|
3021
3039
|
} catch (e) {
|
|
3022
3040
|
const sanitizedType = String(typeOrName).replace(/[\r\n\t]/g, "");
|
|
@@ -3362,6 +3380,33 @@ var _HttpDispatcher = class _HttpDispatcher {
|
|
|
3362
3380
|
result.seedApplied = { success: false, error: e?.message ?? "seed apply failed" };
|
|
3363
3381
|
}
|
|
3364
3382
|
}
|
|
3383
|
+
try {
|
|
3384
|
+
if (typeof protocol.getMetaItems === "function" && typeof protocol.saveMetaItem === "function") {
|
|
3385
|
+
const appsRes = await protocol.getMetaItems({
|
|
3386
|
+
type: "app",
|
|
3387
|
+
packageId: id,
|
|
3388
|
+
...organizationId ? { organizationId } : {}
|
|
3389
|
+
});
|
|
3390
|
+
const apps = Array.isArray(appsRes) ? appsRes : Array.isArray(appsRes?.items) ? appsRes.items : [];
|
|
3391
|
+
const unhidden = [];
|
|
3392
|
+
for (const app of apps) {
|
|
3393
|
+
if (app && typeof app === "object" && app.hidden === true && typeof app.name === "string") {
|
|
3394
|
+
await protocol.saveMetaItem({
|
|
3395
|
+
type: "app",
|
|
3396
|
+
name: app.name,
|
|
3397
|
+
item: { ...app, hidden: false },
|
|
3398
|
+
packageId: id,
|
|
3399
|
+
...organizationId ? { organizationId } : {},
|
|
3400
|
+
...body?.actor ? { actor: body.actor } : {}
|
|
3401
|
+
});
|
|
3402
|
+
unhidden.push(app.name);
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
if (unhidden.length > 0) result.unhiddenApps = unhidden;
|
|
3406
|
+
}
|
|
3407
|
+
} catch (e) {
|
|
3408
|
+
result.unhideError = e?.message ?? "visibility flip failed";
|
|
3409
|
+
}
|
|
3365
3410
|
return { handled: true, response: this.success(result) };
|
|
3366
3411
|
} catch (e) {
|
|
3367
3412
|
return { handled: true, response: this.error(e.message, e.statusCode || 500) };
|