@objectstack/runtime 9.1.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.d.cts CHANGED
@@ -971,6 +971,13 @@ declare class HttpDispatcher {
971
971
  private resolveDefaultProject;
972
972
  private success;
973
973
  private error;
974
+ /**
975
+ * ADR-0046: `doc` list responses omit `content` by default — manuals
976
+ * are the one metadata payload that grows unbounded, and the list
977
+ * surface only needs `name` + `label`. `?include=content` opts back in
978
+ * (single-item GET /metadata/doc/:name always returns the full body).
979
+ */
980
+ private slimDocList;
974
981
  /**
975
982
  * 404 Route Not Found — no route is registered for this path.
976
983
  */
package/dist/index.d.ts CHANGED
@@ -971,6 +971,13 @@ declare class HttpDispatcher {
971
971
  private resolveDefaultProject;
972
972
  private success;
973
973
  private error;
974
+ /**
975
+ * ADR-0046: `doc` list responses omit `content` by default — manuals
976
+ * are the one metadata payload that grows unbounded, and the list
977
+ * surface only needs `name` + `label`. `?include=content` opts back in
978
+ * (single-item GET /metadata/doc/:name always returns the full body).
979
+ */
980
+ private slimDocList;
974
981
  /**
975
982
  * 404 Route Not Found — no route is registered for this path.
976
983
  */
package/dist/index.js CHANGED
@@ -1206,7 +1206,8 @@ var init_app_plugin = __esm({
1206
1206
  "sharingRules",
1207
1207
  "ragPipelines",
1208
1208
  "data",
1209
- "emailTemplates"
1209
+ "emailTemplates",
1210
+ "docs"
1210
1211
  ];
1211
1212
  const hasAppPayload = APP_CATEGORY_KEYS.some((k) => {
1212
1213
  const v = (bundle && bundle[k]) ?? (sys && sys[k]);
@@ -2104,6 +2105,23 @@ var _HttpDispatcher = class _HttpDispatcher {
2104
2105
  body: { success: false, error: { message, code, details } }
2105
2106
  };
2106
2107
  }
2108
+ /**
2109
+ * ADR-0046: `doc` list responses omit `content` by default — manuals
2110
+ * are the one metadata payload that grows unbounded, and the list
2111
+ * surface only needs `name` + `label`. `?include=content` opts back in
2112
+ * (single-item GET /metadata/doc/:name always returns the full body).
2113
+ */
2114
+ slimDocList(type, data, query) {
2115
+ if (type !== "doc" || query?.include === "content") return data;
2116
+ const strip = (items) => items.map((i) => {
2117
+ if (!i || typeof i !== "object") return i;
2118
+ const { content: _content, ...rest } = i;
2119
+ return rest;
2120
+ });
2121
+ if (Array.isArray(data)) return strip(data);
2122
+ if (data && Array.isArray(data.items)) return { ...data, items: strip(data.items) };
2123
+ return data;
2124
+ }
2107
2125
  /**
2108
2126
  * 404 Route Not Found — no route is registered for this path.
2109
2127
  */
@@ -2935,7 +2953,7 @@ var _HttpDispatcher = class _HttpDispatcher {
2935
2953
  const previewDrafts = query?.preview === "draft";
2936
2954
  const data = await protocol.getMetaItems({ type: typeOrName, packageId, organizationId, previewDrafts });
2937
2955
  if (data && (data.items !== void 0 || Array.isArray(data))) {
2938
- return { handled: true, response: this.success(data) };
2956
+ return { handled: true, response: this.success(this.slimDocList(typeOrName, data, query)) };
2939
2957
  }
2940
2958
  } catch {
2941
2959
  }
@@ -2948,7 +2966,7 @@ var _HttpDispatcher = class _HttpDispatcher {
2948
2966
  items = items.filter((item) => item?._packageId === packageId);
2949
2967
  }
2950
2968
  if (items && items.length > 0) {
2951
- return { handled: true, response: this.success({ type: typeOrName, items }) };
2969
+ return { handled: true, response: this.success({ type: typeOrName, items: this.slimDocList(typeOrName, items, query) }) };
2952
2970
  }
2953
2971
  } catch (e) {
2954
2972
  const sanitizedType = String(typeOrName).replace(/[\r\n\t]/g, "");
@@ -3294,6 +3312,33 @@ var _HttpDispatcher = class _HttpDispatcher {
3294
3312
  result.seedApplied = { success: false, error: e?.message ?? "seed apply failed" };
3295
3313
  }
3296
3314
  }
3315
+ try {
3316
+ if (typeof protocol.getMetaItems === "function" && typeof protocol.saveMetaItem === "function") {
3317
+ const appsRes = await protocol.getMetaItems({
3318
+ type: "app",
3319
+ packageId: id,
3320
+ ...organizationId ? { organizationId } : {}
3321
+ });
3322
+ const apps = Array.isArray(appsRes) ? appsRes : Array.isArray(appsRes?.items) ? appsRes.items : [];
3323
+ const unhidden = [];
3324
+ for (const app of apps) {
3325
+ if (app && typeof app === "object" && app.hidden === true && typeof app.name === "string") {
3326
+ await protocol.saveMetaItem({
3327
+ type: "app",
3328
+ name: app.name,
3329
+ item: { ...app, hidden: false },
3330
+ packageId: id,
3331
+ ...organizationId ? { organizationId } : {},
3332
+ ...body?.actor ? { actor: body.actor } : {}
3333
+ });
3334
+ unhidden.push(app.name);
3335
+ }
3336
+ }
3337
+ if (unhidden.length > 0) result.unhiddenApps = unhidden;
3338
+ }
3339
+ } catch (e) {
3340
+ result.unhideError = e?.message ?? "visibility flip failed";
3341
+ }
3297
3342
  return { handled: true, response: this.success(result) };
3298
3343
  } catch (e) {
3299
3344
  return { handled: true, response: this.error(e.message, e.statusCode || 500) };