@mx-space/cli 0.14.0 → 0.14.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.
package/dist/bin/mxs.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { t as run } from "../mxs-BUqt-N3N.mjs";
2
+ import { t as run } from "../mxs-CMX2yklg.mjs";
3
3
  export { run };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-BUqt-N3N.mjs";
1
+ import { a as defaultMessageFor, c as tagToCode, i as codeForTag, l as toErrorEnvelope, n as defaultGlobalFlags, o as exitCodeForError, r as parseGlobalFlags, s as exitCodeForTag, t as run } from "./mxs-CMX2yklg.mjs";
2
2
  export { codeForTag, defaultGlobalFlags, defaultMessageFor, exitCodeForError, exitCodeForTag, parseGlobalFlags, run, tagToCode, toErrorEnvelope };
@@ -35199,6 +35199,35 @@ const parseTypeSpecificData$1 = (raw) => {
35199
35199
  return {};
35200
35200
  }
35201
35201
  };
35202
+ /**
35203
+ * The response interceptor snake_cases keys at every depth, but the request
35204
+ * pipe only camelizes the body's top level — nested subtrees (like `meta`)
35205
+ * must be restored before being sent back, or `skillIds` round-trips into a
35206
+ * stored `skill_ids`. Best-effort inverse: keys that legitimately contained
35207
+ * underscores were already mangled by the response side.
35208
+ */
35209
+ const camelizeDeep = (value) => {
35210
+ if (Array.isArray(value)) return value.map(camelizeDeep);
35211
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([k, v]) => [k.replaceAll(/_([a-z0-9])/g, (_, c) => c.toUpperCase()), camelizeDeep(v)]));
35212
+ return value;
35213
+ };
35214
+ /** The server serializes response keys to snake_case; normalize back. */
35215
+ const normalizeDraftRow = (row) => {
35216
+ if (!row || typeof row !== "object") return {};
35217
+ const r = row;
35218
+ const pick = (camel, snake) => r[camel] ?? r[snake];
35219
+ return {
35220
+ id: pick("id", "id"),
35221
+ refType: pick("refType", "ref_type"),
35222
+ refId: pick("refId", "ref_id"),
35223
+ title: pick("title", "title"),
35224
+ text: pick("text", "text"),
35225
+ content: pick("content", "content"),
35226
+ contentFormat: pick("contentFormat", "content_format"),
35227
+ meta: pick("meta", "meta"),
35228
+ typeSpecificData: pick("typeSpecificData", "type_specific_data")
35229
+ };
35230
+ };
35202
35231
  /** Single-object responses may arrive wrapped in an outer `data` envelope. */
35203
35232
  const unwrapData = (res) => {
35204
35233
  if (res && typeof res === "object" && "data" in res) {
@@ -35282,7 +35311,7 @@ const publish$2 = make$14("publish", {
35282
35311
  }, ({ id, open, silent }) => gen(function* () {
35283
35312
  const api = yield* Api;
35284
35313
  const renderer = yield* Renderer;
35285
- const draft = unwrapData(yield* api.request(`/drafts/${encodeURIComponent(id)}`));
35314
+ const draft = normalizeDraftRow(unwrapData(yield* api.request(`/drafts/${encodeURIComponent(id)}`)));
35286
35315
  if (!draft?.id || !draft.refType) return yield* fail$2(new Generic({ message: `draft not found: ${id}` }));
35287
35316
  const resource = REF_TYPE_TO_RESOURCE[draft.refType];
35288
35317
  if (!resource) return yield* fail$2(new Generic({ message: `unsupported draft refType: ${draft.refType}` }));
@@ -35291,7 +35320,7 @@ const publish$2 = make$14("publish", {
35291
35320
  if (draft.text !== void 0) body.text = draft.text;
35292
35321
  if (draft.content !== void 0 && draft.content !== null) body.content = draft.content;
35293
35322
  if (draft.contentFormat !== void 0) body.contentFormat = draft.contentFormat;
35294
- if (draft.meta !== void 0 && draft.meta !== null) body.meta = draft.meta;
35323
+ if (draft.meta !== void 0 && draft.meta !== null) body.meta = camelizeDeep(draft.meta);
35295
35324
  body.draftId = draft.id;
35296
35325
  let res;
35297
35326
  if (draft.refId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/cli",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
5
5
  "keywords": [
6
6
  "mx-space",
@@ -72,8 +72,8 @@
72
72
  "tsx": "^4.22.4",
73
73
  "typescript": "6.0.3",
74
74
  "vitest": "4.1.9",
75
- "@mx-space/editor": "0.2.0",
76
- "@mx-space/api-client": "5.4.0"
75
+ "@mx-space/api-client": "5.4.0",
76
+ "@mx-space/editor": "0.2.0"
77
77
  },
78
78
  "scripts": {
79
79
  "package": "rm -rf dist && tsdown",