@mx-space/cli 0.5.1 → 0.6.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/README.md
CHANGED
|
@@ -243,7 +243,7 @@ URL follows the admin-vue3 hash-router convention
|
|
|
243
243
|
|
|
244
244
|
| Flag | Field |
|
|
245
245
|
| ---------------------- | ---------------------------------------------------------------------- |
|
|
246
|
-
| `--title <text>` | `title`; defaults to `无题` for create payloads.
|
|
246
|
+
| `--title <text>` | `title`; defaults to `无题` ("Untitled") for create payloads. |
|
|
247
247
|
| `--slug <slug>` | `slug` |
|
|
248
248
|
| `--topic <id-or-name>` | Resolved to `topicId` by id, slug, or name. |
|
|
249
249
|
| `--content <spec>` | Body source. |
|
package/dist/bin/mxs.mjs
CHANGED
|
@@ -37649,4 +37649,4 @@ const unsafeAdd = /* @__PURE__ */ dual((args) => isFiberSet(args[0]), (self, fib
|
|
|
37649
37649
|
*/
|
|
37650
37650
|
const join = (self) => _await(self.deferred);
|
|
37651
37651
|
//#endregion
|
|
37652
|
-
export {
|
|
37652
|
+
export { drain as $, identity as $a, reduce$7 as $i, try_ as $n, get$9 as $r, either$1 as $t, compose as A, pipeArguments as Aa, empty$26 as Ai, orElse$3 as An, Scope as Ar, encodeSync as At, ensuring as B, cached$1 as Ba, head$2 as Bi, scope as Bn, set$2 as Br, async as Bt, Number$ as C, some$1 as Ca, isConfigError as Ci, match$2 as Cn, Equivalence$2 as Cr, currentContext as Ct, String$ as D, left as Da, appendAll$2 as Di, onError as Dn, taggedEnum as Dr, unsafeMake$3 as Dt, Schema_exports as E, string$2 as Ea, append$2 as Ei, negate as En, tagged as Er, get$3 as Et, transform as F, redact as Fa, findFirstIndex as Fi, retry as Fn, isFailure as Fr, addFinalizer as Ft, mapError as G, hasProperty as Ga, join$3 as Gi, suspend$6 as Gn, updateAs as Gr, catchIf as Gt, fromChannel as H, hash as Ha, isArray as Hi, serviceFunctions as Hn, updateAndGet as Hr, catchAll as Ht, make$5 as I, symbolRedactable as Ia, findLast as Ii, runFork$1 as In, void_$2 as Ir, all as It, splitLines as J, globalValue as Ja, match$8 as Ji, tapError as Jn, cons as Jr, catchTags as Jt, run as K, isObject as Ka, make$48 as Ki, sync$1 as Kn, CommitPrototype as Kr, catchSome as Kt, isConfig as L, toStringUnknown as La, flatMap$8 as Li, runPromise as Ln, ParentSpan as Lr, annotateLogs as Lt, decodeUnknown as M, Class$5 as Ma, filter$4 as Mi, provide$1 as Mn, isInterrupted as Mr, _void as Mt, int as N, NodeInspectSymbol as Na, filterMap as Ni, provideService as Nn, isInterruptedOnly as Nr, acquireRelease as Nt, TaggedError as O, merge$3 as Oa, contains as Oi, onInterrupt as On, error as Or, nominal as Ot, optional as P, format$4 as Pa, findFirst$1 as Pi, repeatN as Pn, fail$7 as Pr, acquireUseRelease$2 as Pt, unwrapScoped as Q, dual as Qa, prepend$2 as Qi, tryPromise as Qn, fromIterable$5 as Qr, dieMessage as Qt, asyncScoped as R, equals$3 as Ra, fromIterable$10 as Ri, runSync as Rn, get$5 as Rr, as as Rt, Literal as S, orElse$5 as Sa, omit$3 as Si, mapInputContext as Sn, unsafeDone as Sr, succeed$1 as St, Record as T, mapInput as Ta, allocate as Ti, matchEffect as Tn, TaggedError$1 as Tr, currentTracerEnabled as Tt, fromReadableStream as U, string$3 as Ua, isEmptyReadonlyArray as Ui, serviceOption as Un, allLevels as Ur, catchAllCause$1 as Ut, fail as V, combine$7 as Va, headNonEmpty$2 as Vi, scoped$3 as Vn, update$1 as Vr, cached as Vt, mapChunks as W, symbol$1 as Wa, isNonEmptyReadonlyArray as Wi, succeed$3 as Wn, getOrDefault as Wr, catchAllDefect as Wt, transduce as X, constUndefined as Xa, matchRight as Xi, timeout as Xn, of as Xr, contextWithEffect as Xt, suspend$1 as Y, constFalse as Ya, matchLeft as Yi, tapErrorCause as Yn, isNil as Yr, context as Yt, unwrap as Z, constVoid as Za, of$2 as Zi, tryMap as Zn, empty$19 as Zr, die as Zt, fromString as _, isOption as _a, Reference as _i, logError as _n, failCause$3 as _r, effect$1 as _t, make$1 as a, tailNonEmpty$1 as aa, add as ai, filterOrDieMessage as an, useSpan as ar, embedInput as at, Defect as b, match$9 as ba, getOption$1 as bi, mapBoth$1 as bn, make$15 as br, provideMerge as bt, make$3 as c, getEquivalence$5 as ca, remove$1 as ci, fnUntraced as cn, withParentSpan as cr, fromEffect as ct, defaultLogger as d, flatMap$9 as da, map$11 as di, forkScoped as dn, zipRight$1 as dr, write as dt, reduceRight as ea, has$4 as ei, ensuring$4 as en, pipe as eo, uninterruptible as er, foldLeftChunks as et, prettyLoggerDefault as f, fromNullable as fa, of$1 as fi, gen as fn, zipWith as fr, spaced as ft, when as g, isNone as ga, GenericTag as gi, locally as gn, fail$5 as gr, make$10 as gt, value as h, getOrUndefined as ha, unsafeFromArray as hi, isEffect as hn, complete as hr, get$1 as ht, isMailbox as i, splitAt as ia, make$39 as ii, filter$1 as in, __toESM as io, unsafeMakeSemaphore as ir, acquireUseRelease as it, declare as j, BaseProto as ja, every$1 as ji, orElseFail as jn, addFinalizer$1 as jr, is as jt, Union as k, right as ka, drop$1 as ki, orDie as kn, log as kr, decodeSync as kt, updateEffect as l, map$13 as la, seconds as li, forEach$2 as ln, zip$1 as lr, suspend$2 as lt, orElse as m, getOrThrow as ma, toArray$1 as mi, interruptible as mn, _await as mr, updateContext as mt, make as n, sort as na, make$36 as ni, failCause$2 as nn, __exportAll as no, unlessEffect as nr, fromChannel$1 as nt, toChannel as o, take$3 as oa, fromIterable$6 as oi, flatMap$4 as on, when$2 as or, ensuring$1 as ot, withMinimumLogLevel as p, getOrElse as pa, reduce$6 as pi, ignore as pn, DeferredTypeId as pr, runFork as pt, runCollect as q, isTagged as qa, map$12 as qi, tap as qn, round as qr, catchTag as qt, unsafeAdd as r, span as ra, set$4 as ri, failSync as rn, __require as ro, unsafeMakeLatch as rr, unwrapScoped$1 as rt, get as s, unsafeGet$3 as sa, has$5 as si, flatten$3 as sn, withFiberRuntime as sr, flatMap as st, join as t, some as ta, isEmpty$5 as ti, fail$4 as tn, __commonJSMin as to, uninterruptibleMask as tr, forEach as tt, unify as u, filter$5 as ua, appendAll$1 as ui, forkDaemon as un, zipLeft as ur, void_ as ut, Cause as v, isSome as va, Tag as vi, logWarning as vn, interrupt$1 as vr, mergeAll$1 as vt, NumberFromString as w, boolean as wa, isMissingDataOnly as wi, matchCauseEffect as wn, Error$1 as wr, currentLoggers as wt, Int as x, none$4 as xa, merge$1 as xi, mapError$4 as xn, succeed$4 as xr, scoped$2 as xt, Date$ as y, map$14 as ya, get$13 as yi, map$3 as yn, isDone as yr, provide as yt, bufferChunks as z, symbol as za, getSomes as zi, runtime as zn, make$27 as zr, asVoid as zt };
|
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-
|
|
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-DmOnpQrK.mjs";
|
|
2
2
|
export { codeForTag, defaultGlobalFlags, defaultMessageFor, exitCodeForError, exitCodeForTag, parseGlobalFlags, run, tagToCode, toErrorEnvelope };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as drain, $a as identity, $i as reduce$1, $n as try_, $r as get$10, $t as either, A as compose, Aa as pipeArguments, Ai as empty$11, An as orElse$3, Ar as Scope, At as encodeSync, B as ensuring$1, Ba as cached, Bi as head$2, Bn as scope, Br as set$3, Bt as async, C as Number$, Ca as some, Ci as isConfigError, Cn as match$2, Ct as currentContext, D as String$, Da as left, Di as appendAll, Dn as onError, Dr as taggedEnum, Dt as unsafeMake, Ea as string$1, Ei as append$2, En as negate, Er as tagged, Et as get$14, Fa as redact$1, Fi as findFirstIndex, Fn as retry, Fr as isFailure, Ft as addFinalizer, G as mapError$1, Gi as join$1, Gn as suspend, Gr as updateAs, Gt as catchIf, H as fromChannel, Ha as hash, Hi as isArray$1, Hn as serviceFunctions, Hr as updateAndGet, Ht as catchAll, I as make$20, Ia as symbolRedactable, Ii as findLast, In as runFork$1, Ir as void_$1, It as all$4, J as splitLines, Ja as globalValue, Ji as match$1, Jn as tapError, Jr as cons$1, Jt as catchTags, K as run$5, Ka as isObject, Ki as make$21, Kn as sync, Kr as CommitPrototype, Kt as catchSome, L as isConfig, La as toStringUnknown, Li as flatMap$4, Ln as runPromise, Lr as ParentSpan, Lt as annotateLogs, M as decodeUnknown, Ma as Class, Mi as filter$2, Mn as provide$1, Mr as isInterrupted, Mt as _void, N as int, Na as NodeInspectSymbol, Ni as filterMap, Nn as provideService, Nr as isInterruptedOnly, Nt as acquireRelease, O as TaggedError, Oa as merge$1, Oi as contains, On as onInterrupt, Or as error$1, Ot as nominal, P as optional$7, Pa as format$3, Pi as findFirst, Pn as repeatN, Pr as fail$5, Pt as acquireUseRelease$1, Q as unwrapScoped, Qa as dual, Qi as prepend$1, Qn as tryPromise, Qr as fromIterable$2, Qt as dieMessage, R as asyncScoped, Ra as equals, Ri as fromIterable$1, Rn as runSync, Rr as get$9, Rt as as, S as Literal, Sa as orElse$2, Si as omit, Sn as mapInputContext, Sr as unsafeDone, St as succeed$3, Ta as mapInput, Ti as allocate, Tn as matchEffect, Tr as TaggedError$1, Tt as currentTracerEnabled, Ua as string, Ui as isEmptyReadonlyArray, Un as serviceOption, Ur as allLevels, Ut as catchAllCause, Va as combine$2, Vi as headNonEmpty, Vn as scoped, Vr as update$6, Vt as cached$1, W as mapChunks, Wa as symbol, Wi as isNonEmptyReadonlyArray, Wn as succeed$1, Wr as getOrDefault, Wt as catchAllDefect, X as transduce, Xa as constUndefined, Xi as matchRight, Xn as timeout, Xr as of$3, Xt as contextWithEffect, Y as suspend$1, Ya as constFalse, Yi as matchLeft, Yn as tapErrorCause, Yr as isNil, Yt as context, Z as unwrap$5, Za as constVoid, Zi as of$2, Zn as tryMap, Zr as empty$12, Zt as die, _ as fromString, _a as isOption, _i as Reference, _n as logError, _r as failCause$1, _t as effect, a as make$26, aa as tailNonEmpty, ai as add$1, an as filterOrDieMessage, ar as useSpan, at as embedInput, b as Defect, ba as match, bi as getOption, bn as mapBoth, br as make$25, bt as provideMerge, c as make$24, ci as remove$3, cn as fnUntraced, cr as withParentSpan, ct as fromEffect, d as defaultLogger, da as flatMap$3, di as map$10, dn as forkScoped, dr as zipRight, dt as write, ea as reduceRight, ei as has, en as ensuring, eo as pipe, er as uninterruptible, et as foldLeftChunks, f as prettyLoggerDefault, fa as fromNullable, fi as of$1, fn as gen, fr as zipWith, ft as spaced, g as when, ga as isNone, gi as GenericTag, gn as locally, gr as fail$4, gt as make$29, h as value$1, ha as getOrUndefined, hi as unsafeFromArray, hn as isEffect, hr as complete, ht as get$13, i as isMailbox, ia as splitAt, ii as make$28, in as filter$1, io as __toESM, ir as unsafeMakeSemaphore, it as acquireUseRelease, ja as BaseProto, ji as every, jn as orElseFail, jr as addFinalizer$1, jt as is$2, k as Union, ka as right, ki as drop, kn as orDie, kr as log, kt as decodeSync, l as updateEffect, la as map$9, li as seconds, ln as forEach$1, lr as zip, lt as suspend$2, m as orElse$1, ma as getOrThrow, mi as toArray, mn as interruptible, mr as _await, mt as updateContext, n as make$27, na as sort$2, ni as make$23, nn as failCause, no as __exportAll, nr as unlessEffect, nt as fromChannel$1, o as toChannel, oa as take, oi as fromIterable$3, on as flatMap$1, or as when$1, ot as ensuring$2, p as withMinimumLogLevel, pa as getOrElse, pi as reduce$2, pn as ignore, pr as DeferredTypeId, pt as runFork, q as runCollect, qa as isTagged, qi as map$7, qn as tap, qr as round, qt as catchTag, r as unsafeAdd, ra as span, ri as set$2, rn as failSync, ro as __require, rr as unsafeMakeLatch, rt as unwrapScoped$1, s as get$11, sa as unsafeGet, si as has$1, sn as flatten$3, sr as withFiberRuntime, st as flatMap$2, t as join$2, ta as some$1, ti as isEmpty$5, tn as fail$2, to as __commonJSMin, tr as uninterruptibleMask, tt as forEach, u as unify, ua as filter$3, ui as appendAll$1, un as forkDaemon, ur as zipLeft, ut as void_, v as Cause, va as isSome, vi as Tag$2, vn as logWarning, vr as interrupt, vt as mergeAll, w as NumberFromString, wa as boolean$3, wi as isMissingDataOnly, wn as matchCauseEffect, wr as Error$1, wt as currentLoggers, x as Int, xa as none$3, xi as merge$2, xn as mapError, xr as succeed$2, xt as scoped$1, y as Date$, ya as map$8, yi as get$12, yn as map$6, yr as isDone, yt as provide, z as bufferChunks, za as symbol$1, zi as getSomes, zn as runtime, zr as make$22, zt as asVoid } from "./esm-CK9m5JKX.mjs";
|
|
2
2
|
import { _ as LinkNode, a as HeadingNode, b as CodeHighlightNode, d as ListItemNode, f as ListNode, g as AutoLinkNode, o as QuoteNode, x as CodeNode } from "./LexicalRichText.node-DDpwfE-P.mjs";
|
|
3
3
|
import { t as HorizontalRuleNode } from "./LexicalExtension.node-CF3EAPN7.mjs";
|
|
4
4
|
import { Ht as ElementNode, Vt as DecoratorNode } from "./Lexical.node-BUsI9gWr.mjs";
|
|
@@ -24,7 +24,7 @@ import * as ChildProcess from "node:child_process";
|
|
|
24
24
|
import childProcess, { execFile, spawn } from "node:child_process";
|
|
25
25
|
import * as readline from "node:readline";
|
|
26
26
|
import E from "node:readline";
|
|
27
|
-
import
|
|
27
|
+
import V, { stdin, stdout } from "node:process";
|
|
28
28
|
import "node:tty";
|
|
29
29
|
//#region ../../node_modules/.pnpm/@effect+platform@0.96.1_effect@3.21.2/node_modules/@effect/platform/dist/esm/Error.js
|
|
30
30
|
/**
|
|
@@ -9042,7 +9042,7 @@ function isInsideContainer() {
|
|
|
9042
9042
|
//#endregion
|
|
9043
9043
|
//#region ../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
|
|
9044
9044
|
const isWsl = () => {
|
|
9045
|
-
if (
|
|
9045
|
+
if (V.platform !== "linux") return false;
|
|
9046
9046
|
if (os.release().toLowerCase().includes("microsoft")) {
|
|
9047
9047
|
if (isInsideContainer()) return false;
|
|
9048
9048
|
return true;
|
|
@@ -9053,11 +9053,11 @@ const isWsl = () => {
|
|
|
9053
9053
|
if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) return !isInsideContainer();
|
|
9054
9054
|
return false;
|
|
9055
9055
|
};
|
|
9056
|
-
var is_wsl_default =
|
|
9056
|
+
var is_wsl_default = V.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
9057
9057
|
//#endregion
|
|
9058
9058
|
//#region ../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js
|
|
9059
9059
|
const execFile$2 = promisify(childProcess.execFile);
|
|
9060
|
-
const powerShellPath$1 = () => `${
|
|
9060
|
+
const powerShellPath$1 = () => `${V.env.SYSTEMROOT || V.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
9061
9061
|
const executePowerShell = async (command, options = {}) => {
|
|
9062
9062
|
const { powerShellPath: psPath, ...execFileOptions } = options;
|
|
9063
9063
|
const encodedCommand = executePowerShell.encodeCommand(command);
|
|
@@ -9164,7 +9164,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
|
|
|
9164
9164
|
//#region ../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
|
|
9165
9165
|
const execFileAsync$3 = promisify(execFile);
|
|
9166
9166
|
async function defaultBrowserId() {
|
|
9167
|
-
if (
|
|
9167
|
+
if (V.platform !== "darwin") throw new Error("macOS only");
|
|
9168
9168
|
const { stdout } = await execFileAsync$3("defaults", [
|
|
9169
9169
|
"read",
|
|
9170
9170
|
"com.apple.LaunchServices/com.apple.launchservices.secure",
|
|
@@ -9178,7 +9178,7 @@ async function defaultBrowserId() {
|
|
|
9178
9178
|
//#region ../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
|
|
9179
9179
|
const execFileAsync$2 = promisify(execFile);
|
|
9180
9180
|
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
9181
|
-
if (
|
|
9181
|
+
if (V.platform !== "darwin") throw new Error("macOS only");
|
|
9182
9182
|
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
9183
9183
|
const execOptions = {};
|
|
9184
9184
|
if (signal) execOptions.signal = signal;
|
|
@@ -9289,14 +9289,14 @@ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
|
|
|
9289
9289
|
const execFileAsync = promisify(execFile);
|
|
9290
9290
|
const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
9291
9291
|
async function defaultBrowser() {
|
|
9292
|
-
if (
|
|
9292
|
+
if (V.platform === "darwin") {
|
|
9293
9293
|
const id = await defaultBrowserId();
|
|
9294
9294
|
return {
|
|
9295
9295
|
name: await bundleName(id),
|
|
9296
9296
|
id
|
|
9297
9297
|
};
|
|
9298
9298
|
}
|
|
9299
|
-
if (
|
|
9299
|
+
if (V.platform === "linux") {
|
|
9300
9300
|
const { stdout } = await execFileAsync("xdg-mime", [
|
|
9301
9301
|
"query",
|
|
9302
9302
|
"default",
|
|
@@ -9308,18 +9308,18 @@ async function defaultBrowser() {
|
|
|
9308
9308
|
id
|
|
9309
9309
|
};
|
|
9310
9310
|
}
|
|
9311
|
-
if (
|
|
9311
|
+
if (V.platform === "win32") return defaultBrowser$1();
|
|
9312
9312
|
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
9313
9313
|
}
|
|
9314
9314
|
//#endregion
|
|
9315
9315
|
//#region ../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
|
|
9316
|
-
const isInSsh = Boolean(
|
|
9316
|
+
const isInSsh = Boolean(V.env.SSH_CONNECTION || V.env.SSH_CLIENT || V.env.SSH_TTY);
|
|
9317
9317
|
//#endregion
|
|
9318
9318
|
//#region ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
|
|
9319
9319
|
const fallbackAttemptSymbol = Symbol("fallbackAttempt");
|
|
9320
9320
|
const __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
|
|
9321
9321
|
const localXdgOpenPath = path.join(__dirname, "xdg-open");
|
|
9322
|
-
const { platform: platform$1, arch: arch$1 } =
|
|
9322
|
+
const { platform: platform$1, arch: arch$1 } = V;
|
|
9323
9323
|
const tryEachApp = async (apps, opener) => {
|
|
9324
9324
|
if (apps.length === 0) return;
|
|
9325
9325
|
const errors = [];
|
|
@@ -9432,7 +9432,7 @@ const baseOpen = async (options) => {
|
|
|
9432
9432
|
await fs$1.access(localXdgOpenPath, constants.X_OK);
|
|
9433
9433
|
exeLocalXdgOpen = true;
|
|
9434
9434
|
} catch {}
|
|
9435
|
-
command =
|
|
9435
|
+
command = V.versions.electron ?? (platform$1 === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
|
|
9436
9436
|
}
|
|
9437
9437
|
if (appArguments.length > 0) cliArguments.push(...appArguments);
|
|
9438
9438
|
if (!options.wait) {
|
|
@@ -10882,7 +10882,7 @@ var ht$1 = class extends m {
|
|
|
10882
10882
|
//#endregion
|
|
10883
10883
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.4.0/node_modules/@clack/prompts/dist/index.mjs
|
|
10884
10884
|
function ee() {
|
|
10885
|
-
return
|
|
10885
|
+
return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
10886
10886
|
}
|
|
10887
10887
|
const tt = ee(), w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o");
|
|
10888
10888
|
const $ = w("│", "|"), x = w("└", "—");
|
|
@@ -24777,6 +24777,15 @@ const unwrapDocument = (data) => {
|
|
|
24777
24777
|
if (nested && typeof nested === "object" && !Array.isArray(nested)) return nested;
|
|
24778
24778
|
return data;
|
|
24779
24779
|
};
|
|
24780
|
+
const pickArticleTranslationMeta = (payload, docId) => {
|
|
24781
|
+
const translation = asRecord(asRecord(asRecord(payload).meta).translation);
|
|
24782
|
+
if (Object.keys(translation).length === 0) return void 0;
|
|
24783
|
+
const direct = asRecord(translation.article);
|
|
24784
|
+
if (Object.keys(direct).length > 0) return direct;
|
|
24785
|
+
if (docId === void 0 || docId === null) return void 0;
|
|
24786
|
+
const article = asRecord(asRecord(translation[String(docId)]).article);
|
|
24787
|
+
return Object.keys(article).length > 0 ? article : void 0;
|
|
24788
|
+
};
|
|
24780
24789
|
let cachedRegistry$1 = null;
|
|
24781
24790
|
const getRegistry$1 = () => {
|
|
24782
24791
|
if (!cachedRegistry$1) cachedRegistry$1 = createDefaultRegistry();
|
|
@@ -27553,6 +27562,90 @@ const authCmd = make$12("auth").pipe(withDescription(help$8.description), withSu
|
|
|
27553
27562
|
status
|
|
27554
27563
|
]));
|
|
27555
27564
|
//#endregion
|
|
27565
|
+
//#region src/domain/envelope-compat.ts
|
|
27566
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27567
|
+
/**
|
|
27568
|
+
* Sniff the wire version from a parsed response body. Returns `null` if the
|
|
27569
|
+
* body is too small (raw scalar, FormData echo, dry-run synthetic) to decide.
|
|
27570
|
+
* Callers must tolerate `null`.
|
|
27571
|
+
*
|
|
27572
|
+
* V3 markers (any one suffices):
|
|
27573
|
+
* - object has a `meta` key, OR
|
|
27574
|
+
* - object has `error.code` (string) or `error.message` (string).
|
|
27575
|
+
*
|
|
27576
|
+
* V2 markers (any one):
|
|
27577
|
+
* - object has a root-level `pagination` key, OR
|
|
27578
|
+
* - object has a root-level `message: string | string[]` and no `error` key.
|
|
27579
|
+
*
|
|
27580
|
+
* When both V2 and V3 markers are present, V3 wins.
|
|
27581
|
+
*/
|
|
27582
|
+
const detectWireVersion = (body) => {
|
|
27583
|
+
if (!isRecord(body)) return null;
|
|
27584
|
+
if ("meta" in body) return "v3";
|
|
27585
|
+
if (isRecord(body.error)) {
|
|
27586
|
+
const err = body.error;
|
|
27587
|
+
if (typeof err.code === "string" || typeof err.message === "string") return "v3";
|
|
27588
|
+
}
|
|
27589
|
+
if ("pagination" in body) return "v2";
|
|
27590
|
+
if (!("error" in body) && (typeof body.message === "string" || Array.isArray(body.message) && body.message.every((m) => typeof m === "string"))) return "v2";
|
|
27591
|
+
return null;
|
|
27592
|
+
};
|
|
27593
|
+
/**
|
|
27594
|
+
* Normalize a 2xx response body to the V3 shape `{ data, meta? }`.
|
|
27595
|
+
*
|
|
27596
|
+
* - V3 (`{ data, meta? }`) → returned as-is
|
|
27597
|
+
* - V2 paginated (`{ data, pagination }`) → `{ data, meta: { pagination } }`
|
|
27598
|
+
* - V2 bare (`{ data }`) → returned as-is
|
|
27599
|
+
* - Anything else (arrays, scalars, non-object, already-unwrapped doc) → unchanged
|
|
27600
|
+
*
|
|
27601
|
+
* Shape-tolerant: unrecognized inputs pass through unchanged. Never mutates
|
|
27602
|
+
* the input.
|
|
27603
|
+
*/
|
|
27604
|
+
const normalizeSuccessBody = (body) => {
|
|
27605
|
+
if (!isRecord(body)) return body;
|
|
27606
|
+
if ("meta" in body) return body;
|
|
27607
|
+
if ("data" in body && "pagination" in body) {
|
|
27608
|
+
const { pagination, ...rest } = body;
|
|
27609
|
+
return {
|
|
27610
|
+
...rest,
|
|
27611
|
+
meta: { pagination }
|
|
27612
|
+
};
|
|
27613
|
+
}
|
|
27614
|
+
return body;
|
|
27615
|
+
};
|
|
27616
|
+
/**
|
|
27617
|
+
* Normalize a non-2xx response body to a flat `{ code?, message?, details? }`
|
|
27618
|
+
* tuple.
|
|
27619
|
+
*
|
|
27620
|
+
* - V3 (`{ error: { code, message, details? } }`) → unwrapped
|
|
27621
|
+
* - V2 (`{ message: string | string[], code?, details? }`) → flattened.
|
|
27622
|
+
* Array messages join with `'; '` to match the legacy `extractMessage`
|
|
27623
|
+
* helper in `api-envelope.ts`.
|
|
27624
|
+
* - Non-object body → `{}`
|
|
27625
|
+
*
|
|
27626
|
+
* Never throws, never mutates.
|
|
27627
|
+
*/
|
|
27628
|
+
const normalizeErrorBody = (body) => {
|
|
27629
|
+
if (!isRecord(body)) return {};
|
|
27630
|
+
if (isRecord(body.error)) {
|
|
27631
|
+
const err = body.error;
|
|
27632
|
+
return {
|
|
27633
|
+
code: typeof err.code === "string" ? err.code : void 0,
|
|
27634
|
+
message: typeof err.message === "string" ? err.message : void 0,
|
|
27635
|
+
details: err.details
|
|
27636
|
+
};
|
|
27637
|
+
}
|
|
27638
|
+
const rawMsg = body.message;
|
|
27639
|
+
let message;
|
|
27640
|
+
if (typeof rawMsg === "string") message = rawMsg;
|
|
27641
|
+
else if (Array.isArray(rawMsg) && rawMsg.every((m) => typeof m === "string")) message = rawMsg.join("; ");
|
|
27642
|
+
return {
|
|
27643
|
+
code: typeof body.code === "string" ? body.code : void 0,
|
|
27644
|
+
message,
|
|
27645
|
+
details: body.details
|
|
27646
|
+
};
|
|
27647
|
+
};
|
|
27648
|
+
//#endregion
|
|
27556
27649
|
//#region src/domain/gate.ts
|
|
27557
27650
|
const SAFE_METHODS = new Set([
|
|
27558
27651
|
"GET",
|
|
@@ -27571,38 +27664,6 @@ const decideWriteGate = (resolved, method) => {
|
|
|
27571
27664
|
hint: `active profile '${name}' is production; retry with --profile ${name} or MXS_PROFILE=${name}`
|
|
27572
27665
|
};
|
|
27573
27666
|
};
|
|
27574
|
-
Struct({
|
|
27575
|
-
ok: Literal(false),
|
|
27576
|
-
code: String$,
|
|
27577
|
-
message: String$,
|
|
27578
|
-
details: optional$7(Unknown),
|
|
27579
|
-
hint: optional$7(String$)
|
|
27580
|
-
});
|
|
27581
|
-
Struct({
|
|
27582
|
-
page: optional$7(Number$),
|
|
27583
|
-
size: optional$7(Number$),
|
|
27584
|
-
total: optional$7(Number$),
|
|
27585
|
-
totalPage: optional$7(Number$),
|
|
27586
|
-
currentPage: optional$7(Number$),
|
|
27587
|
-
pageSize: optional$7(Number$),
|
|
27588
|
-
totalCount: optional$7(Number$)
|
|
27589
|
-
});
|
|
27590
|
-
Struct({
|
|
27591
|
-
message: optional$7(Union(String$, Array$(String$))),
|
|
27592
|
-
code: optional$7(String$),
|
|
27593
|
-
details: optional$7(Unknown)
|
|
27594
|
-
});
|
|
27595
|
-
/**
|
|
27596
|
-
* Extract a flattened `message` string from an arbitrary error body,
|
|
27597
|
-
* matching the legacy `extractMessage` helper in `api-client.ts`.
|
|
27598
|
-
*/
|
|
27599
|
-
const extractServerMessage = (body) => {
|
|
27600
|
-
if (!body || typeof body !== "object") return null;
|
|
27601
|
-
const msg = body.message;
|
|
27602
|
-
if (typeof msg === "string") return msg;
|
|
27603
|
-
if (Array.isArray(msg) && typeof msg[0] === "string") return msg.join("; ");
|
|
27604
|
-
return null;
|
|
27605
|
-
};
|
|
27606
27667
|
//#endregion
|
|
27607
27668
|
//#region src/domain/version.ts
|
|
27608
27669
|
const requireFrom$2 = createRequire(import.meta.url);
|
|
@@ -27648,6 +27709,7 @@ var Api = class Api extends Tag$2("Api")() {
|
|
|
27648
27709
|
function makeApiService(http, config, auth, opts) {
|
|
27649
27710
|
return gen(function* () {
|
|
27650
27711
|
const bannerEmitted = yield* make$22(false);
|
|
27712
|
+
const detectedWire = yield* make$22(null);
|
|
27651
27713
|
/**
|
|
27652
27714
|
* Resolved config is cached per `ApiService` instance. This matches
|
|
27653
27715
|
* today's `ApiClient` which is constructed once per command run.
|
|
@@ -27749,9 +27811,19 @@ function makeApiService(http, config, auth, opts) {
|
|
|
27749
27811
|
}
|
|
27750
27812
|
}
|
|
27751
27813
|
const body = yield* parseBody(res);
|
|
27814
|
+
if (opts.verbose) {
|
|
27815
|
+
if (!(yield* get$9(detectedWire))) {
|
|
27816
|
+
const sniffed = detectWireVersion(body);
|
|
27817
|
+
if (sniffed) {
|
|
27818
|
+
yield* set$3(detectedWire, sniffed);
|
|
27819
|
+
process.stderr.write(`mxs: detected wire version: ${sniffed}\n`);
|
|
27820
|
+
}
|
|
27821
|
+
}
|
|
27822
|
+
}
|
|
27752
27823
|
if (res.status >= 200 && res.status < 300) {
|
|
27753
|
-
|
|
27754
|
-
|
|
27824
|
+
const normalized = normalizeSuccessBody(body);
|
|
27825
|
+
if (!options.schema) return normalized;
|
|
27826
|
+
return yield* decodeWithSchema(options.schema, normalized);
|
|
27755
27827
|
}
|
|
27756
27828
|
return yield* fail$2(mapHttpStatusToError(res.status, body));
|
|
27757
27829
|
});
|
|
@@ -27777,7 +27849,7 @@ function parseBody(res) {
|
|
|
27777
27849
|
function decodeWithSchema(schema, body) {
|
|
27778
27850
|
return tryPromise({
|
|
27779
27851
|
try: async () => {
|
|
27780
|
-
const { Schema: SchemaMod } = await import("./esm-
|
|
27852
|
+
const { Schema: SchemaMod } = await import("./esm-DRbkkY3r.mjs");
|
|
27781
27853
|
return SchemaMod.decodeUnknownPromise(schema)(body);
|
|
27782
27854
|
},
|
|
27783
27855
|
catch: (err) => new ServerError({
|
|
@@ -27795,31 +27867,41 @@ function serializeParseError(err) {
|
|
|
27795
27867
|
return err;
|
|
27796
27868
|
}
|
|
27797
27869
|
function mapHttpStatusToError(status, body) {
|
|
27870
|
+
const { code, message: serverMsg, details: serverDetails } = normalizeErrorBody(body);
|
|
27871
|
+
const details = serverDetails ?? body;
|
|
27872
|
+
if (code === "NOT_FOUND" || code?.endsWith("_NOT_FOUND")) return new ResourceNotFound({
|
|
27873
|
+
message: serverMsg ?? "resource not found",
|
|
27874
|
+
details
|
|
27875
|
+
});
|
|
27876
|
+
if (code === "VALIDATION_FAILED") return new ValidationFailed({
|
|
27877
|
+
message: serverMsg ?? "validation failed",
|
|
27878
|
+
details
|
|
27879
|
+
});
|
|
27798
27880
|
if (status === 401) return new AuthExpired({
|
|
27799
|
-
message: "authentication required",
|
|
27881
|
+
message: serverMsg ?? "authentication required",
|
|
27800
27882
|
hint: "run `mxs auth login`",
|
|
27801
|
-
details
|
|
27883
|
+
details
|
|
27802
27884
|
});
|
|
27803
27885
|
if (status === 403) return new AuthDenied({
|
|
27804
|
-
message: "permission denied",
|
|
27805
|
-
details
|
|
27886
|
+
message: serverMsg ?? "permission denied",
|
|
27887
|
+
details
|
|
27806
27888
|
});
|
|
27807
27889
|
if (status === 404) return new ResourceNotFound({
|
|
27808
|
-
message: "resource not found",
|
|
27809
|
-
details
|
|
27890
|
+
message: serverMsg ?? "resource not found",
|
|
27891
|
+
details
|
|
27810
27892
|
});
|
|
27811
27893
|
if (status === 400 || status === 422) return new ValidationFailed({
|
|
27812
|
-
message:
|
|
27813
|
-
details
|
|
27894
|
+
message: serverMsg ?? "validation failed",
|
|
27895
|
+
details
|
|
27814
27896
|
});
|
|
27815
27897
|
if (status >= 500) return new ServerError({
|
|
27816
27898
|
status,
|
|
27817
|
-
message:
|
|
27818
|
-
details
|
|
27899
|
+
message: serverMsg ?? `server error (${status})`,
|
|
27900
|
+
details
|
|
27819
27901
|
});
|
|
27820
27902
|
return new Generic({
|
|
27821
|
-
message:
|
|
27822
|
-
details
|
|
27903
|
+
message: serverMsg ?? `request failed (${status})`,
|
|
27904
|
+
details
|
|
27823
27905
|
});
|
|
27824
27906
|
}
|
|
27825
27907
|
function mapTransportError(err, url) {
|
|
@@ -28424,17 +28506,17 @@ const commentView = {
|
|
|
28424
28506
|
llm: (data) => renderCommentLlm(data)
|
|
28425
28507
|
};
|
|
28426
28508
|
const renderListHeader = (payload, rowCount, color) => {
|
|
28427
|
-
const pagination = asRecord(first(payload, "pagination"));
|
|
28509
|
+
const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
|
|
28428
28510
|
const page = first(pagination, "page", "currentPage");
|
|
28429
28511
|
const size = first(pagination, "size", "pageSize");
|
|
28430
|
-
const total = first(pagination, "total", "totalCount");
|
|
28431
|
-
const
|
|
28432
|
-
if (page !== void 0)
|
|
28433
|
-
if (size !== void 0)
|
|
28434
|
-
if (total !== void 0)
|
|
28512
|
+
const total = first(pagination, "total", "totalCount", "total_count");
|
|
28513
|
+
const headerParts = [`count: ${rowCount}`];
|
|
28514
|
+
if (page !== void 0) headerParts.push(`page: ${formatScalar(page)}`);
|
|
28515
|
+
if (size !== void 0) headerParts.push(`size: ${formatScalar(size)}`);
|
|
28516
|
+
if (total !== void 0) headerParts.push(`total: ${formatScalar(total)}`);
|
|
28435
28517
|
const heading = wrap(ANSI.bold, "Comments", color);
|
|
28436
28518
|
const ruleLen = Math.min(Math.max(visibleLen("Comments"), 24), 64);
|
|
28437
|
-
return `${heading}\n${wrap(ANSI.dim, "─".repeat(ruleLen), color)}\n${wrap(ANSI.dim,
|
|
28519
|
+
return `${heading}\n${wrap(ANSI.dim, "─".repeat(ruleLen), color)}\n${wrap(ANSI.dim, headerParts.join(" · "), color)}`;
|
|
28438
28520
|
};
|
|
28439
28521
|
const renderListItem = (doc, index, color) => {
|
|
28440
28522
|
const author = authorOf(doc);
|
|
@@ -30691,7 +30773,8 @@ const edit$2 = make$12("edit", {
|
|
|
30691
30773
|
//#endregion
|
|
30692
30774
|
//#region src/cli/note/view.ts
|
|
30693
30775
|
const normalize$2 = (data) => asRecord(unwrapDocument(data));
|
|
30694
|
-
const collectFields$2 = (doc) => {
|
|
30776
|
+
const collectFields$2 = (doc, articleMeta) => {
|
|
30777
|
+
const meta = articleMeta ?? {};
|
|
30695
30778
|
return [
|
|
30696
30779
|
["id", first(doc, "id")],
|
|
30697
30780
|
["slug", first(doc, "slug")],
|
|
@@ -30704,8 +30787,8 @@ const collectFields$2 = (doc) => {
|
|
|
30704
30787
|
["bookmark", first(doc, "bookmark")],
|
|
30705
30788
|
["created_at", first(doc, "created_at", "createdAt")],
|
|
30706
30789
|
["modified_at", first(doc, "modified_at", "modifiedAt")],
|
|
30707
|
-
["source_lang", first(doc, "source_lang", "sourceLang")],
|
|
30708
|
-
["translated", first(doc, "is_translated", "isTranslated")]
|
|
30790
|
+
["source_lang", first(doc, "source_lang", "sourceLang") ?? first(meta, "source_lang", "sourceLang")],
|
|
30791
|
+
["translated", first(doc, "is_translated", "isTranslated") ?? first(meta, "is_translated", "isTranslated")]
|
|
30709
30792
|
].filter(([key, value]) => value !== void 0 && value !== null && value !== "" && !(key === "translated" && value === false));
|
|
30710
30793
|
};
|
|
30711
30794
|
const collectEnvelopeMeta$2 = (doc) => [
|
|
@@ -30734,11 +30817,12 @@ const noteView = {
|
|
|
30734
30817
|
]),
|
|
30735
30818
|
readable: (data, ctx) => {
|
|
30736
30819
|
const doc = normalize$2(data);
|
|
30820
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
30737
30821
|
const content = renderContent(doc);
|
|
30738
30822
|
return renderMetadataBlock({
|
|
30739
30823
|
title: firstString(doc, "title") || void 0,
|
|
30740
30824
|
kind: "note",
|
|
30741
|
-
fields: collectFields$2(doc),
|
|
30825
|
+
fields: collectFields$2(doc, articleMeta),
|
|
30742
30826
|
summary: pickSummary$2(doc),
|
|
30743
30827
|
body: content.body || void 0,
|
|
30744
30828
|
bodyFormat: content.format
|
|
@@ -30746,10 +30830,11 @@ const noteView = {
|
|
|
30746
30830
|
},
|
|
30747
30831
|
llm: (data) => {
|
|
30748
30832
|
const doc = normalize$2(data);
|
|
30833
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
30749
30834
|
const content = renderContent(doc, true);
|
|
30750
30835
|
const fm = frontmatter({
|
|
30751
30836
|
title: firstString(doc, "title") || void 0,
|
|
30752
|
-
fields: collectFields$2(doc),
|
|
30837
|
+
fields: collectFields$2(doc, articleMeta),
|
|
30753
30838
|
summary: pickSummary$2(doc)
|
|
30754
30839
|
});
|
|
30755
30840
|
return content.body ? `${fm}\n\n${content.body}` : fm;
|
|
@@ -31081,7 +31166,8 @@ const edit$1 = make$12("edit", {
|
|
|
31081
31166
|
//#endregion
|
|
31082
31167
|
//#region src/cli/page/view.ts
|
|
31083
31168
|
const normalize$1 = (data) => asRecord(unwrapDocument(data));
|
|
31084
|
-
const collectFields$1 = (doc) => {
|
|
31169
|
+
const collectFields$1 = (doc, articleMeta) => {
|
|
31170
|
+
const meta = articleMeta ?? {};
|
|
31085
31171
|
return [
|
|
31086
31172
|
["id", first(doc, "id")],
|
|
31087
31173
|
["slug", first(doc, "slug")],
|
|
@@ -31089,8 +31175,8 @@ const collectFields$1 = (doc) => {
|
|
|
31089
31175
|
["order", first(doc, "order")],
|
|
31090
31176
|
["created_at", first(doc, "created_at", "createdAt")],
|
|
31091
31177
|
["modified_at", first(doc, "modified_at", "modifiedAt")],
|
|
31092
|
-
["source_lang", first(doc, "source_lang", "sourceLang")],
|
|
31093
|
-
["translated", first(doc, "is_translated", "isTranslated")]
|
|
31178
|
+
["source_lang", first(doc, "source_lang", "sourceLang") ?? first(meta, "source_lang", "sourceLang")],
|
|
31179
|
+
["translated", first(doc, "is_translated", "isTranslated") ?? first(meta, "is_translated", "isTranslated")]
|
|
31094
31180
|
].filter(([key, value]) => value !== void 0 && value !== null && value !== "" && !(key === "translated" && value === false));
|
|
31095
31181
|
};
|
|
31096
31182
|
const collectEnvelopeMeta$1 = (doc) => [
|
|
@@ -31114,11 +31200,12 @@ const pageView = {
|
|
|
31114
31200
|
]),
|
|
31115
31201
|
readable: (data, ctx) => {
|
|
31116
31202
|
const doc = normalize$1(data);
|
|
31203
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
31117
31204
|
const content = renderContent(doc);
|
|
31118
31205
|
return renderMetadataBlock({
|
|
31119
31206
|
title: firstString(doc, "title") || void 0,
|
|
31120
31207
|
kind: "page",
|
|
31121
|
-
fields: collectFields$1(doc),
|
|
31208
|
+
fields: collectFields$1(doc, articleMeta),
|
|
31122
31209
|
summary: pickSummary$1(doc),
|
|
31123
31210
|
body: content.body || void 0,
|
|
31124
31211
|
bodyFormat: content.format
|
|
@@ -31126,10 +31213,11 @@ const pageView = {
|
|
|
31126
31213
|
},
|
|
31127
31214
|
llm: (data) => {
|
|
31128
31215
|
const doc = normalize$1(data);
|
|
31216
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
31129
31217
|
const content = renderContent(doc, true);
|
|
31130
31218
|
const fm = frontmatter({
|
|
31131
31219
|
title: firstString(doc, "title") || void 0,
|
|
31132
|
-
fields: collectFields$1(doc),
|
|
31220
|
+
fields: collectFields$1(doc, articleMeta),
|
|
31133
31221
|
summary: pickSummary$1(doc)
|
|
31134
31222
|
});
|
|
31135
31223
|
return content.body ? `${fm}\n\n${content.body}` : fm;
|
|
@@ -31375,7 +31463,8 @@ const edit = make$12("edit", {
|
|
|
31375
31463
|
//#endregion
|
|
31376
31464
|
//#region src/cli/post/view.ts
|
|
31377
31465
|
const normalize = (data) => asRecord(unwrapDocument(data));
|
|
31378
|
-
const collectFields = (doc) => {
|
|
31466
|
+
const collectFields = (doc, articleMeta) => {
|
|
31467
|
+
const meta = articleMeta ?? {};
|
|
31379
31468
|
return [
|
|
31380
31469
|
["id", first(doc, "id")],
|
|
31381
31470
|
["slug", first(doc, "slug")],
|
|
@@ -31385,8 +31474,8 @@ const collectFields = (doc) => {
|
|
|
31385
31474
|
["pin", first(doc, "pin")],
|
|
31386
31475
|
["created_at", first(doc, "created_at", "createdAt")],
|
|
31387
31476
|
["modified_at", first(doc, "modified_at", "modifiedAt")],
|
|
31388
|
-
["source_lang", first(doc, "source_lang", "sourceLang")],
|
|
31389
|
-
["translated", first(doc, "is_translated", "isTranslated")]
|
|
31477
|
+
["source_lang", first(doc, "source_lang", "sourceLang") ?? first(meta, "source_lang", "sourceLang")],
|
|
31478
|
+
["translated", first(doc, "is_translated", "isTranslated") ?? first(meta, "is_translated", "isTranslated")]
|
|
31390
31479
|
].filter(([key, value]) => value !== void 0 && value !== null && value !== "" && !(key === "translated" && value === false));
|
|
31391
31480
|
};
|
|
31392
31481
|
const collectEnvelopeMeta = (doc) => [
|
|
@@ -31412,11 +31501,12 @@ const postView = {
|
|
|
31412
31501
|
]),
|
|
31413
31502
|
readable: (data, ctx) => {
|
|
31414
31503
|
const doc = normalize(data);
|
|
31504
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
31415
31505
|
const content = renderContent(doc);
|
|
31416
31506
|
return renderMetadataBlock({
|
|
31417
31507
|
title: firstString(doc, "title") || void 0,
|
|
31418
31508
|
kind: "post",
|
|
31419
|
-
fields: collectFields(doc),
|
|
31509
|
+
fields: collectFields(doc, articleMeta),
|
|
31420
31510
|
summary: pickSummary(doc),
|
|
31421
31511
|
body: content.body || void 0,
|
|
31422
31512
|
bodyFormat: content.format
|
|
@@ -31424,10 +31514,11 @@ const postView = {
|
|
|
31424
31514
|
},
|
|
31425
31515
|
llm: (data) => {
|
|
31426
31516
|
const doc = normalize(data);
|
|
31517
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
31427
31518
|
const content = renderContent(doc, true);
|
|
31428
31519
|
const fm = frontmatter({
|
|
31429
31520
|
title: firstString(doc, "title") || void 0,
|
|
31430
|
-
fields: collectFields(doc),
|
|
31521
|
+
fields: collectFields(doc, articleMeta),
|
|
31431
31522
|
summary: pickSummary(doc)
|
|
31432
31523
|
});
|
|
31433
31524
|
return content.body ? `${fm}\n\n${content.body}` : fm;
|
|
@@ -31442,36 +31533,40 @@ const postView = {
|
|
|
31442
31533
|
});
|
|
31443
31534
|
}
|
|
31444
31535
|
};
|
|
31445
|
-
const collectListItemFields = (doc) =>
|
|
31446
|
-
|
|
31447
|
-
[
|
|
31448
|
-
|
|
31449
|
-
|
|
31450
|
-
|
|
31451
|
-
|
|
31452
|
-
|
|
31453
|
-
|
|
31454
|
-
|
|
31455
|
-
|
|
31456
|
-
|
|
31457
|
-
]
|
|
31536
|
+
const collectListItemFields = (doc, articleMeta) => {
|
|
31537
|
+
const meta = articleMeta ?? {};
|
|
31538
|
+
return [
|
|
31539
|
+
["id", first(doc, "id")],
|
|
31540
|
+
["title", first(doc, "title")],
|
|
31541
|
+
["slug", first(doc, "slug")],
|
|
31542
|
+
["state", publishState(doc)],
|
|
31543
|
+
["category", relationLabel(first(doc, "category"))],
|
|
31544
|
+
["tags", first(doc, "tags")],
|
|
31545
|
+
["summary", first(doc, "summary")],
|
|
31546
|
+
["created_at", first(doc, "created_at", "createdAt")],
|
|
31547
|
+
["modified_at", first(doc, "modified_at", "modifiedAt")],
|
|
31548
|
+
["source_lang", first(doc, "source_lang", "sourceLang") ?? first(meta, "source_lang", "sourceLang")],
|
|
31549
|
+
["translated", first(doc, "is_translated", "isTranslated") ?? first(meta, "is_translated", "isTranslated")]
|
|
31550
|
+
];
|
|
31551
|
+
};
|
|
31458
31552
|
const renderPostListReadable = (data) => {
|
|
31459
31553
|
const payload = asRecord(data);
|
|
31460
31554
|
const rows = Array.isArray(payload.data) ? payload.data : Array.isArray(data) ? data : [];
|
|
31461
|
-
const pagination = asRecord(first(payload, "pagination"));
|
|
31555
|
+
const pagination = asRecord(first(asRecord(first(payload, "meta")), "pagination"));
|
|
31462
31556
|
const lines = ["posts"];
|
|
31463
31557
|
if (rows.length > 0) lines.push(`count: ${rows.length}`);
|
|
31464
31558
|
else lines.push("count: 0");
|
|
31465
31559
|
const page = first(pagination, "page", "currentPage");
|
|
31466
31560
|
const size = first(pagination, "size", "pageSize");
|
|
31467
|
-
const total = first(pagination, "total", "totalCount");
|
|
31561
|
+
const total = first(pagination, "total", "totalCount", "total_count");
|
|
31468
31562
|
if (page !== void 0) lines.push(`page: ${formatScalar(page)}`);
|
|
31469
31563
|
if (size !== void 0) lines.push(`size: ${formatScalar(size)}`);
|
|
31470
31564
|
if (total !== void 0) lines.push(`total: ${formatScalar(total)}`);
|
|
31471
31565
|
rows.forEach((row, index) => {
|
|
31472
31566
|
const doc = asRecord(row);
|
|
31567
|
+
const articleMeta = pickArticleTranslationMeta(data, first(doc, "id"));
|
|
31473
31568
|
lines.push("", `post ${index + 1}:`);
|
|
31474
|
-
const fields = collectListItemFields(doc);
|
|
31569
|
+
const fields = collectListItemFields(doc, articleMeta);
|
|
31475
31570
|
for (const [key, value] of fields) {
|
|
31476
31571
|
if (value === void 0 || value === null || value === "") continue;
|
|
31477
31572
|
const rendered = tryFormatTimestamp(value, { style: "rel" }) ?? formatScalar(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mx-space",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"lexical": "^0.44.0",
|
|
62
62
|
"open": "^11.0.0",
|
|
63
63
|
"semver": "7.8.0",
|
|
64
|
-
"@mx-space/api-client": "
|
|
64
|
+
"@mx-space/api-client": "5.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@effect/vitest": "0.29.0",
|
package/dist/esm-BKxzBG1f.mjs
DELETED