@blogmcp/sdk 0.8.1 → 0.9.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/community/channels.d.ts +12 -0
- package/dist/community/channels.js +7 -0
- package/dist/community/client.d.ts +211 -0
- package/dist/community/client.js +188 -0
- package/dist/community/index.d.ts +34 -0
- package/dist/community/index.js +93 -0
- package/dist/community/links.d.ts +73 -0
- package/dist/community/links.js +85 -0
- package/dist/community/messages.cs.d.ts +331 -0
- package/dist/community/messages.cs.js +342 -0
- package/dist/community/messages.d.ts +40 -0
- package/dist/community/messages.en.d.ts +315 -0
- package/dist/community/messages.en.js +313 -0
- package/dist/community/messages.js +66 -0
- package/dist/community/outcome.d.ts +96 -0
- package/dist/community/outcome.js +211 -0
- package/dist/community/poll.d.ts +35 -0
- package/dist/community/poll.js +70 -0
- package/dist/community/routes.d.ts +110 -0
- package/dist/community/routes.js +66 -0
- package/dist/community/server/bff.d.ts +123 -0
- package/dist/community/server/bff.js +214 -0
- package/dist/community/server/env.d.ts +20 -0
- package/dist/community/server/env.js +16 -0
- package/dist/community/server/host-routes.d.ts +15 -0
- package/dist/community/server/host-routes.js +35 -0
- package/dist/community/server/http.d.ts +64 -0
- package/dist/community/server/http.js +90 -0
- package/dist/community/server/index.d.ts +45 -0
- package/dist/community/server/index.js +19 -0
- package/dist/community/server/route-decision.d.ts +70 -0
- package/dist/community/server/route-decision.js +89 -0
- package/dist/community/server/unknown-path.d.ts +21 -0
- package/dist/community/server/unknown-path.js +11 -0
- package/dist/community/shapes.d.ts +472 -0
- package/dist/community/shapes.js +63 -0
- package/dist/community/store.d.ts +183 -0
- package/dist/community/store.js +423 -0
- package/dist/community/transport.d.ts +42 -0
- package/dist/community/transport.js +59 -0
- package/dist/core/client.d.ts +17 -0
- package/dist/core/client.js +58 -55
- package/dist/core/comments-legacy.d.ts +19 -0
- package/dist/core/comments-legacy.js +18 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +107 -101
- package/dist/core/queries.d.ts +46 -0
- package/dist/core/queries.js +128 -84
- package/dist/core/seo.js +40 -39
- package/dist/core/translations/cs.json.js +6 -6
- package/dist/core/translations/en.json.js +1 -1
- package/dist/core/types.d.ts +23 -1
- package/dist/core/view-model.d.ts +7 -0
- package/dist/core/view-model.js +29 -25
- package/dist/packages/tripmap-core/dist/generated/maplibre-worker.bundle.js +1 -1
- package/dist/react/KbMdxContent.js +4 -3
- package/dist/vue/components/KbMdxContent.vue2.js +3 -2
- package/dist/vue/composables/useKbComments.d.ts +8 -0
- package/package.json +13 -4
- package/src/community/channels.ts +12 -0
- package/src/community/client.ts +437 -0
- package/src/community/index.ts +192 -0
- package/src/community/links.ts +174 -0
- package/src/community/messages.cs.ts +371 -0
- package/src/community/messages.en.ts +341 -0
- package/src/community/messages.ts +112 -0
- package/src/community/outcome.ts +317 -0
- package/src/community/poll.ts +154 -0
- package/src/community/routes.ts +139 -0
- package/src/community/server/bff.ts +530 -0
- package/src/community/server/env.ts +42 -0
- package/src/community/server/host-routes.ts +48 -0
- package/src/community/server/http.ts +175 -0
- package/src/community/server/index.ts +55 -0
- package/src/community/server/route-decision.ts +226 -0
- package/src/community/server/unknown-path.ts +32 -0
- package/src/community/shapes.ts +541 -0
- package/src/community/store.ts +786 -0
- package/src/community/transport.ts +111 -0
- package/src/core/client.ts +24 -1
- package/src/core/comments-legacy.ts +39 -0
- package/src/core/index.ts +8 -0
- package/src/core/queries.ts +93 -0
- package/src/core/seo.ts +5 -1
- package/src/core/translations/cs.json +3 -1
- package/src/core/translations/en.json +3 -1
- package/src/core/types.ts +19 -1
- package/src/core/view-model.ts +12 -1
- package/src/vue/composables/useKbComments.ts +8 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The replaceable layer under the community client (docs/internal/m1-contracts.md §10.2; community.md §3.7): one
|
|
3
|
+
* function that takes an operation and its JSON body and answers the HTTP status and the parsed body. The client
|
|
4
|
+
* never touches `fetch` itself, so a test injects a transport, and the private client of a later milestone plugs
|
|
5
|
+
* in one that signs its requests — the client and its outcomes do not change.
|
|
6
|
+
*
|
|
7
|
+
* The default, fetchTransport(base), POSTs to the HOST: a relative base such as `/api/community` that a managed
|
|
8
|
+
* blog's proxy or a headless site's BFF serves. Never kb-api's origin — its community namespaces answer no CORS and
|
|
9
|
+
* a browser never calls them directly — so an absolute or protocol-relative base is refused when the client is
|
|
10
|
+
* built, and every request is `mode: 'same-origin'` with the host's own cookies (`credentials: 'same-origin'`): the
|
|
11
|
+
* host turns its session into the member's credential on its server.
|
|
12
|
+
*/
|
|
13
|
+
import { type CommunityOp } from './routes.js';
|
|
14
|
+
/** What a transport answers: the HTTP status and the parsed JSON body (null when the body is not JSON). */
|
|
15
|
+
export interface CommunityTransportAnswer {
|
|
16
|
+
status: number;
|
|
17
|
+
body: unknown;
|
|
18
|
+
/** `Retry-After` in seconds, when the answer carried one. */
|
|
19
|
+
retryAfterS?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The layer the client calls for every operation. It rejects (with a CommunityTransportError, ideally) when the
|
|
23
|
+
* host could not be asked at all; any answer, a 4xx or 5xx included, resolves.
|
|
24
|
+
*/
|
|
25
|
+
export type CommunityTransport = (op: CommunityOp, body: unknown, signal: AbortSignal) => Promise<CommunityTransportAnswer>;
|
|
26
|
+
/** Whether `base` is a host base the client takes (see BASE_RE); `..` and `.` segments are refused too. */
|
|
27
|
+
export declare function isRelativeCommunityBase(base: unknown): base is string;
|
|
28
|
+
/** The base, checked: a TypeError for anything but a relative host base (a programming error, visible at once). */
|
|
29
|
+
export declare function assertCommunityBase(base: unknown): string;
|
|
30
|
+
/** The URL of an operation under a checked base: `${base}/v1/public/<resource>/<verb>`, `${base}/trust/v1/notices/<verb>`. */
|
|
31
|
+
export declare function communityOpUrl(base: string, o: Pick<CommunityOp, 'path' | 'surface'>): string;
|
|
32
|
+
export interface FetchTransportOptions {
|
|
33
|
+
/** The fetch to use; looked up on every call (default the page's `fetch`), so a test can stub it. */
|
|
34
|
+
fetch?: () => typeof fetch;
|
|
35
|
+
now?: () => number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The default transport: `POST ${base}<the operation's path>` with a JSON body. The base is checked here as in the
|
|
39
|
+
* client (a TypeError for an absolute one). A network failure, a timeout or an abort rejects with a
|
|
40
|
+
* CommunityTransportError; a body that is not JSON resolves as `body: null`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function fetchTransport(base: string, opts?: FetchTransportOptions): CommunityTransport;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CommunityTransportError as y } from "./outcome.js";
|
|
2
|
+
import { communityOpPath as p } from "./routes.js";
|
|
3
|
+
const l = /^(?:\/[A-Za-z0-9_~-][A-Za-z0-9._~-]*)*\/?$/;
|
|
4
|
+
function d(t) {
|
|
5
|
+
return typeof t == "string" && t.startsWith("/") && l.test(t) && !/(^|\/)\.\.?(\/|$)/.test(t);
|
|
6
|
+
}
|
|
7
|
+
function f(t) {
|
|
8
|
+
if (!d(t))
|
|
9
|
+
throw new TypeError(
|
|
10
|
+
'[blogmcp-sdk] the community client takes a relative base on the page’s own origin (e.g. "/api/community"), never an absolute URL: kb-api’s community routes are reached only through the host’s proxy or BFF'
|
|
11
|
+
);
|
|
12
|
+
return t.replace(/\/+$/, "");
|
|
13
|
+
}
|
|
14
|
+
function g(t, e) {
|
|
15
|
+
return `${t.replace(/\/+$/, "")}${p(e)}`;
|
|
16
|
+
}
|
|
17
|
+
function w(t, e) {
|
|
18
|
+
if (t === null || t.trim() === "") return;
|
|
19
|
+
const r = t.trim();
|
|
20
|
+
if (/^\d+$/.test(r)) return Number(r);
|
|
21
|
+
const n = Date.parse(r);
|
|
22
|
+
return Number.isFinite(n) ? Math.max(0, Math.ceil((n - e) / 1e3)) : void 0;
|
|
23
|
+
}
|
|
24
|
+
function $(t, e = {}) {
|
|
25
|
+
const r = f(t), n = e.now ?? Date.now, u = e.fetch ?? (() => globalThis.fetch);
|
|
26
|
+
return async (a, h, s) => {
|
|
27
|
+
let o;
|
|
28
|
+
try {
|
|
29
|
+
o = await u()(g(r, a), {
|
|
30
|
+
method: a.method,
|
|
31
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify(h ?? {}),
|
|
33
|
+
// The host's own origin only: its session cookie goes along, nothing leaves for another site.
|
|
34
|
+
mode: "same-origin",
|
|
35
|
+
credentials: "same-origin",
|
|
36
|
+
cache: "no-store",
|
|
37
|
+
redirect: "error",
|
|
38
|
+
signal: s
|
|
39
|
+
});
|
|
40
|
+
} catch {
|
|
41
|
+
throw new y(s.aborted ? "community request aborted or timed out" : "community request failed");
|
|
42
|
+
}
|
|
43
|
+
let i = null;
|
|
44
|
+
try {
|
|
45
|
+
const m = await o.text();
|
|
46
|
+
i = m === "" ? null : JSON.parse(m);
|
|
47
|
+
} catch {
|
|
48
|
+
i = null;
|
|
49
|
+
}
|
|
50
|
+
const c = w(o.headers.get("Retry-After"), n());
|
|
51
|
+
return c === void 0 ? { status: o.status, body: i } : { status: o.status, body: i, retryAfterS: c };
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
f as assertCommunityBase,
|
|
56
|
+
g as communityOpUrl,
|
|
57
|
+
$ as fetchTransport,
|
|
58
|
+
d as isRelativeCommunityBase
|
|
59
|
+
};
|
package/dist/core/client.d.ts
CHANGED
|
@@ -25,6 +25,15 @@ export interface KbClient {
|
|
|
25
25
|
* `locked` with its `access` tiers. Needs a KB API with the locked-article preview.
|
|
26
26
|
*/
|
|
27
27
|
includeLocked?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Localize the list: each article's title and description in this language (the
|
|
30
|
+
* page's locale). By default only articles translated into it are listed; each item
|
|
31
|
+
* carries `languageCode` and `isFallback`. Omit for the source language's text.
|
|
32
|
+
* Needs a KB API with localized lists (10. 10. 2026).
|
|
33
|
+
*/
|
|
34
|
+
languageCode?: string;
|
|
35
|
+
/** With `languageCode`: also list untranslated articles, `isFallback: true`, source text. */
|
|
36
|
+
includeUntranslated?: boolean;
|
|
28
37
|
}): Promise<{
|
|
29
38
|
accessibleKbArticles: {
|
|
30
39
|
articles: Article[];
|
|
@@ -141,6 +150,14 @@ export interface KbClient {
|
|
|
141
150
|
getTranslation: Translation;
|
|
142
151
|
}>;
|
|
143
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* The legacy comment API.
|
|
155
|
+
*
|
|
156
|
+
* @deprecated Since 0.9.0, removed in 1.0: discussions are Comments 2.0 — `@blogmcp/sdk/community`
|
|
157
|
+
* (`createCommunityClient`) and the `<blogmcp-discussion>` element of `@blogmcp/community`. The reads keep
|
|
158
|
+
* working through kb-api's compatible layer; the writes answer `COMMENTS_FROZEN` during a tenant's cutover and
|
|
159
|
+
* `COMMENTS_MOVED` after it (`commentErrorCode`, the `comments.frozen` / `comments.moved` texts).
|
|
160
|
+
*/
|
|
144
161
|
comments: {
|
|
145
162
|
list(articleId: string, languageCode: string): Promise<{
|
|
146
163
|
articleComments: CommentsConnection;
|
package/dist/core/client.js
CHANGED
|
@@ -1,94 +1,97 @@
|
|
|
1
|
-
import { UPDATE_MY_PROFILE as
|
|
2
|
-
import { createMemoryTokenStorage as
|
|
3
|
-
import { KbGraphQLError as
|
|
4
|
-
import { createConsultationSessionApi as
|
|
5
|
-
function
|
|
6
|
-
return async (
|
|
7
|
-
method:
|
|
8
|
-
headers:
|
|
9
|
-
body:
|
|
1
|
+
import { UPDATE_MY_PROFILE as S, ARTICLE_VERSION as _, ACCESSIBLE_ARTICLES_WITH_LOCKED_LOCALIZED as I, ACCESSIBLE_ARTICLES_LOCALIZED as C, UPDATE_MY_REPORT_SETTINGS as l, MY_REPORT_SETTINGS as L, CHANGE_PASSWORD as d, RESEND_VERIFICATION as R, RESET_PASSWORD as c, FORGOT_PASSWORD as u, VERIFY_EMAIL as O, REGISTER as p, LOGIN as N, DELETE_COMMENT as h, UPDATE_COMMENT as g, CREATE_COMMENT as m, GET_COMMENT as G, ARTICLE_COMMENTS as P, GET_TRANSLATION as D, ARTICLE_TRANSLATIONS as M, KB_NAVIGATION as y, KB_LANGUAGES as B, LOCALIZED_TAGS as f, ACCESSIBLE_TAGS as W, GET_KB_CONTEXT as v, SEARCH_KNOWLEDGE_BASE as w, ARTICLE_ALIAS_TARGET as K, ARTICLE_PREVIEW_BY_ID as V, ARTICLE_PREVIEW as k, ARTICLE_WITH_TRANSLATION_BY_ID as b, ARTICLE_WITH_TRANSLATION as x, ACCESSIBLE_ARTICLES_WITH_LOCKED as H, ACCESSIBLE_ARTICLES as U } from "./queries.js";
|
|
2
|
+
import { createMemoryTokenStorage as Y } from "./auth.js";
|
|
3
|
+
import { KbGraphQLError as F } from "./errors.js";
|
|
4
|
+
import { createConsultationSessionApi as Q, createConsultationsApi as Z } from "./consultations.js";
|
|
5
|
+
function j() {
|
|
6
|
+
return async (n, o) => (await fetch(n, {
|
|
7
|
+
method: o.method,
|
|
8
|
+
headers: o.headers,
|
|
9
|
+
body: o.body
|
|
10
10
|
})).json();
|
|
11
11
|
}
|
|
12
|
-
async function
|
|
13
|
-
const
|
|
14
|
-
...
|
|
12
|
+
async function z(n, o, E) {
|
|
13
|
+
const T = {
|
|
14
|
+
...n.headers ?? {},
|
|
15
15
|
"Content-Type": "application/json"
|
|
16
|
-
}, a =
|
|
17
|
-
a && (
|
|
18
|
-
const t = await
|
|
16
|
+
}, a = n.tokenStorage.getToken();
|
|
17
|
+
a && (T.Authorization = `Bearer ${a}`);
|
|
18
|
+
const t = await n.fetcher(n.endpoint, {
|
|
19
19
|
method: "POST",
|
|
20
|
-
headers:
|
|
21
|
-
body: JSON.stringify({ query:
|
|
20
|
+
headers: T,
|
|
21
|
+
body: JSON.stringify({ query: o, variables: E })
|
|
22
22
|
});
|
|
23
23
|
if (t.errors?.length)
|
|
24
|
-
throw new
|
|
24
|
+
throw new F(t.errors);
|
|
25
25
|
return t.data;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
27
|
+
function ee(n) {
|
|
28
|
+
const o = n.fetcher || j(), E = n.tokenStorage || Y(), a = { endpoint: n.isServer && n.serverEndpoint ? n.serverEndpoint : n.endpoint, fetcher: o, tokenStorage: E, headers: n.headers };
|
|
29
29
|
function t(e, r) {
|
|
30
|
-
return
|
|
30
|
+
return z(a, e, r);
|
|
31
31
|
}
|
|
32
32
|
return {
|
|
33
33
|
articles: {
|
|
34
34
|
list: (e) => {
|
|
35
|
-
const { includeLocked: r, ...
|
|
36
|
-
return
|
|
35
|
+
const { includeLocked: r, languageCode: s, includeUntranslated: A, ...i } = e ?? {};
|
|
36
|
+
return s ? t(
|
|
37
|
+
r ? I : C,
|
|
38
|
+
{ ...i, languageCode: s, includeUntranslated: A === !0 }
|
|
39
|
+
) : t(r ? H : U, i);
|
|
37
40
|
},
|
|
38
|
-
getWithTranslation: (e, r) => t(
|
|
39
|
-
getWithTranslationById: (e, r) => t(
|
|
40
|
-
getPreview: (e, r) => t(
|
|
41
|
-
getPreviewById: (e, r) => t(
|
|
42
|
-
resolveAlias: (e) => t(
|
|
43
|
-
getVersion: (e, r) => t(
|
|
41
|
+
getWithTranslation: (e, r) => t(x, { filename: e, languageCode: r }),
|
|
42
|
+
getWithTranslationById: (e, r) => t(b, { id: e, languageCode: r }),
|
|
43
|
+
getPreview: (e, r) => t(k, { filename: e, languageCode: r }),
|
|
44
|
+
getPreviewById: (e, r) => t(V, { id: e, languageCode: r }),
|
|
45
|
+
resolveAlias: (e) => t(K, { filename: e }),
|
|
46
|
+
getVersion: (e, r) => t(_, { versionId: e, previewKey: r?.previewKey ?? null })
|
|
44
47
|
},
|
|
45
48
|
search: {
|
|
46
|
-
query: (e) => t(
|
|
47
|
-
getContext: (e, r) => t(
|
|
49
|
+
query: (e) => t(w, e),
|
|
50
|
+
getContext: (e, r) => t(v, { query: e, maxChunks: r })
|
|
48
51
|
},
|
|
49
52
|
tags: {
|
|
50
|
-
list: () => t(
|
|
51
|
-
listLocalized: (e) => t(
|
|
53
|
+
list: () => t(W),
|
|
54
|
+
listLocalized: (e) => t(f, { languageCode: e })
|
|
52
55
|
},
|
|
53
56
|
languages: {
|
|
54
|
-
list: () => t(
|
|
57
|
+
list: () => t(B)
|
|
55
58
|
},
|
|
56
59
|
navigation: {
|
|
57
|
-
get: (e) => t(
|
|
60
|
+
get: (e) => t(y, e ?? {})
|
|
58
61
|
},
|
|
59
62
|
translations: {
|
|
60
|
-
list: (e) => t(
|
|
61
|
-
get: (e, r) => t(
|
|
63
|
+
list: (e) => t(M, { articleId: e }),
|
|
64
|
+
get: (e, r) => t(D, { sourceFilename: e, languageCode: r })
|
|
62
65
|
},
|
|
63
66
|
comments: {
|
|
64
|
-
list: (e, r) => t(
|
|
65
|
-
get: (e, r) => t(
|
|
66
|
-
create: (e) => t(
|
|
67
|
-
update: (e, r) => t(
|
|
68
|
-
delete: (e) => t(
|
|
67
|
+
list: (e, r) => t(P, { articleId: e, languageCode: r }),
|
|
68
|
+
get: (e, r) => t(G, { commentId: e, languageCode: r }),
|
|
69
|
+
create: (e) => t(m, e),
|
|
70
|
+
update: (e, r) => t(g, { commentId: e, content: r }),
|
|
71
|
+
delete: (e) => t(h, { commentId: e })
|
|
69
72
|
},
|
|
70
73
|
auth: {
|
|
71
|
-
login: (e, r) => t(
|
|
72
|
-
register: (e, r,
|
|
73
|
-
verifyEmail: (e) => t(
|
|
74
|
-
forgotPassword: (e) => t(
|
|
75
|
-
resetPassword: (e, r) => t(
|
|
76
|
-
resendVerification: (e) => t(
|
|
77
|
-
changePassword: (e, r) => t(
|
|
78
|
-
updateProfile: (e) => t(
|
|
74
|
+
login: (e, r) => t(N, { email: e, password: r }),
|
|
75
|
+
register: (e, r, s) => t(p, { email: e, password: r, name: s }),
|
|
76
|
+
verifyEmail: (e) => t(O, { token: e }),
|
|
77
|
+
forgotPassword: (e) => t(u, { email: e }),
|
|
78
|
+
resetPassword: (e, r) => t(c, { token: e, password: r }),
|
|
79
|
+
resendVerification: (e) => t(R, { email: e }),
|
|
80
|
+
changePassword: (e, r) => t(d, { currentPassword: e, newPassword: r }),
|
|
81
|
+
updateProfile: (e) => t(S, {
|
|
79
82
|
name: e.name ?? null,
|
|
80
83
|
email: e.email ?? null
|
|
81
84
|
})
|
|
82
85
|
},
|
|
83
86
|
reportSettings: {
|
|
84
|
-
get: () => t(
|
|
85
|
-
update: (e) => t(
|
|
87
|
+
get: () => t(L),
|
|
88
|
+
update: (e) => t(l, e)
|
|
86
89
|
},
|
|
87
|
-
consultations:
|
|
88
|
-
consultationSession:
|
|
90
|
+
consultations: Z(t),
|
|
91
|
+
consultationSession: Q(t),
|
|
89
92
|
executeGraphQL: t
|
|
90
93
|
};
|
|
91
94
|
}
|
|
92
95
|
export {
|
|
93
|
-
|
|
96
|
+
ee as createKbClient
|
|
94
97
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The legacy comment API's two cutover codes (docs/internal/m1-contracts.md §9.3, §10.5): while a tenant's comments
|
|
3
|
+
* move to Comments 2.0, `createComment` / `updateComment` / `deleteComment` answer
|
|
4
|
+
* `CommentResult { success: false, error: 'COMMENTS_FROZEN' }` during the freeze and `'COMMENTS_MOVED'` from the move
|
|
5
|
+
* on, and the `commentUpdates` subscription ends with a `KbGraphQLError` of code `COMMENTS_MOVED`. A blog's current
|
|
6
|
+
* panel tells the reader what happened with the `comments.frozen` / `comments.moved` texts until its host embeds
|
|
7
|
+
* the discussion element.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated With `client.comments.*`; removed in 1.0.
|
|
10
|
+
*/
|
|
11
|
+
/** The legacy comment API's cutover codes. */
|
|
12
|
+
export type LegacyCommentErrorCode = 'COMMENTS_FROZEN' | 'COMMENTS_MOVED';
|
|
13
|
+
/**
|
|
14
|
+
* The cutover code of a failed comment write (a `CommentResult` whose `error` is the code) or of a thrown
|
|
15
|
+
* `KbGraphQLError` — null for anything else (another error, a success, free text).
|
|
16
|
+
*/
|
|
17
|
+
export declare function commentErrorCode(result: unknown): LegacyCommentErrorCode | null;
|
|
18
|
+
/** The `core/translations` key that explains a cutover code to the reader. */
|
|
19
|
+
export declare function commentErrorMessageKey(code: LegacyCommentErrorCode): 'comments.frozen' | 'comments.moved';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isKbGraphQLError as t } from "./errors.js";
|
|
2
|
+
const E = /^(COMMENTS_FROZEN|COMMENTS_MOVED)(?![A-Z0-9_])/;
|
|
3
|
+
function c(r) {
|
|
4
|
+
if (t(r))
|
|
5
|
+
return r.code === "COMMENTS_FROZEN" ? "COMMENTS_FROZEN" : r.code === "COMMENTS_MOVED" ? "COMMENTS_MOVED" : null;
|
|
6
|
+
if (typeof r != "object" || r === null) return null;
|
|
7
|
+
const { success: e, error: n } = r;
|
|
8
|
+
if (e === !0 || typeof n != "string") return null;
|
|
9
|
+
const o = E.exec(n.trim());
|
|
10
|
+
return o ? o[1] : null;
|
|
11
|
+
}
|
|
12
|
+
function O(r) {
|
|
13
|
+
return r === "COMMENTS_FROZEN" ? "comments.frozen" : "comments.moved";
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
c as commentErrorCode,
|
|
17
|
+
O as commentErrorMessageKey
|
|
18
|
+
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export type { Article, ArticlePreview, LockedPreviewMode, ArticleWithTranslation
|
|
|
2
2
|
export { ACCESS_LEVEL_ORDER } from './types.js';
|
|
3
3
|
export { KbGraphQLError, isKbGraphQLError, CONSULTATION_ERROR_CODES, isConsultationErrorCode, } from './errors.js';
|
|
4
4
|
export type { KbErrorCode, ConsultationErrorCode, KbGraphQLErrorEntry, RawGraphQLError, } from './errors.js';
|
|
5
|
+
export { commentErrorCode, commentErrorMessageKey } from './comments-legacy.js';
|
|
6
|
+
export type { LegacyCommentErrorCode } from './comments-legacy.js';
|
|
5
7
|
export type { KbClientConfig, Fetcher, TokenStorage, ImageHtmlRenderer, SanitizeFn, } from './client-types.js';
|
|
6
8
|
export type { KbClient } from './client.js';
|
|
7
9
|
export { createKbClient } from './client.js';
|
|
@@ -29,6 +31,7 @@ export { csTranslations, enTranslations, mergeTranslations, createKbI18n, } from
|
|
|
29
31
|
export type { TranslateFn, TranslationMap } from './i18n.js';
|
|
30
32
|
export * as queries from './queries.js';
|
|
31
33
|
export { prepareProps } from '@blogmcp/mdx-schema/prepareProps';
|
|
34
|
+
export { inlineMarkdownToPlainText, extractTitleHeading } from '@blogmcp/mdx-schema/title';
|
|
32
35
|
export { getComponentMetadata, getComponentNames, componentMetadata, } from '@blogmcp/mdx-schema/metadata';
|
|
33
36
|
export type { ComponentMetadata, PropMetadata } from '@blogmcp/mdx-schema/metadata';
|
|
34
37
|
export * from './review/index.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,110 +1,116 @@
|
|
|
1
1
|
import { ACCESS_LEVEL_ORDER as t } from "./types.js";
|
|
2
|
-
import { CONSULTATION_ERROR_CODES as i, KbGraphQLError as n, isConsultationErrorCode as s, isKbGraphQLError as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
2
|
+
import { CONSULTATION_ERROR_CODES as i, KbGraphQLError as n, isConsultationErrorCode as s, isKbGraphQLError as m } from "./errors.js";
|
|
3
|
+
import { commentErrorCode as p, commentErrorMessageKey as f } from "./comments-legacy.js";
|
|
4
|
+
import { createKbClient as R } from "./client.js";
|
|
5
|
+
import { findNavNode as x, flattenNav as T, isNavigable as c, navBreadcrumbs as v, navNextPrev as g, navSiblings as A, navSubtree as S, navWalk as _ } from "./navigation.js";
|
|
6
|
+
import { createAuthManager as C, createLocalStorageTokenStorage as I, createMemoryTokenStorage as w, decodeJwtUser as b, hasAccessLevel as L } from "./auth.js";
|
|
7
|
+
import { DelegatedTokenError as k, createDelegatedTokenMinter as M } from "./delegated-identity.js";
|
|
8
|
+
import { ConsultationAdapterError as O, createConsultationAdapterClient as W, isConsultationAdapterError as D } from "./consultation-adapter.js";
|
|
9
|
+
import { generateDescription as P, stripLeadingH1 as V } from "./article-seo.js";
|
|
10
|
+
import { createMarkedInstance as K, defaultImageHtml as F, parseMarkdownSafe as G } from "./markdown.js";
|
|
11
|
+
import { deepMerge as B } from "./blog-config.js";
|
|
12
|
+
import { retryWithBackoff as z } from "./retry.js";
|
|
13
|
+
import { buildThemeCssVars as J, darkenColor as Y, hexToHsl as j, hexToRgb as X, hslToRgb as Z, lightenColor as $, rgbTriplet as ee } from "./theme.js";
|
|
14
|
+
import { buildArticleSeo as oe, buildHomeSeo as te, buildListPageSeo as ae, localizedHref as ie, pageUrl as ne, stripLocalePrefix as se } from "./seo.js";
|
|
15
|
+
import { buildArticleListItem as le, formatArticleDate as pe, lockedRequiredAccess as fe, resolveArticleAccessLevel as Ee, toIsoDate as Re } from "./view-model.js";
|
|
16
|
+
import { createKbI18n as xe, mergeTranslations as Te } from "./i18n.js";
|
|
16
17
|
import * as e from "./queries.js";
|
|
17
|
-
import { prepareProps as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { default as
|
|
18
|
+
import { prepareProps as ve } from "@blogmcp/mdx-schema/prepareProps";
|
|
19
|
+
import { extractTitleHeading as Ae, inlineMarkdownToPlainText as Se } from "@blogmcp/mdx-schema/title";
|
|
20
|
+
import { componentMetadata as ue, getComponentMetadata as Ce, getComponentNames as Ie } from "@blogmcp/mdx-schema/metadata";
|
|
21
|
+
import { REVIEW_PAGE_PATH as be, REVIEW_ROUTE_PATTERN as Le, isReviewTokenFormat as Ne } from "./review/types.js";
|
|
22
|
+
import { formatReviewForAgent as Me, formatReviewRound as he } from "./review/format.js";
|
|
23
|
+
import { REVIEW_REASON_STATUS as We, createReviewClient as De, getReviewSession as He } from "./review/client.js";
|
|
24
|
+
import { REVIEW_LAYER_SCRIPT_URL as Ve, REVIEW_SESSION_ELEMENT_ID as Ue, renderReviewStatusHtml as Ke, reviewBootstrapHtml as Fe, reviewContentWithMedia as Ge, reviewFieldAttrs as ye, reviewIgnoreAttrs as Be, reviewResponseHeaders as qe, reviewRootAttrs as ze, reviewStatusText as Qe } from "./review/page.js";
|
|
25
|
+
import { createReviewPlan as Ye, normalizeReviewText as je } from "./review/plan.js";
|
|
26
|
+
import { REVIEW_FIELD_ATTR as Ze, REVIEW_IGNORE_ATTR as $e, REVIEW_ROOT_ATTR as er, stampReviewDom as rr } from "./review/stamp.js";
|
|
27
|
+
import { default as tr } from "./translations/cs.json.js";
|
|
28
|
+
import { default as ir } from "./translations/en.json.js";
|
|
27
29
|
export {
|
|
28
30
|
t as ACCESS_LEVEL_ORDER,
|
|
29
31
|
i as CONSULTATION_ERROR_CODES,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
O as ConsultationAdapterError,
|
|
33
|
+
k as DelegatedTokenError,
|
|
32
34
|
n as KbGraphQLError,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
35
|
+
Ze as REVIEW_FIELD_ATTR,
|
|
36
|
+
$e as REVIEW_IGNORE_ATTR,
|
|
37
|
+
Ve as REVIEW_LAYER_SCRIPT_URL,
|
|
38
|
+
be as REVIEW_PAGE_PATH,
|
|
39
|
+
We as REVIEW_REASON_STATUS,
|
|
40
|
+
er as REVIEW_ROOT_ATTR,
|
|
41
|
+
Le as REVIEW_ROUTE_PATTERN,
|
|
42
|
+
Ue as REVIEW_SESSION_ELEMENT_ID,
|
|
43
|
+
le as buildArticleListItem,
|
|
44
|
+
oe as buildArticleSeo,
|
|
45
|
+
te as buildHomeSeo,
|
|
46
|
+
ae as buildListPageSeo,
|
|
47
|
+
J as buildThemeCssVars,
|
|
48
|
+
p as commentErrorCode,
|
|
49
|
+
f as commentErrorMessageKey,
|
|
50
|
+
ue as componentMetadata,
|
|
51
|
+
C as createAuthManager,
|
|
52
|
+
W as createConsultationAdapterClient,
|
|
53
|
+
M as createDelegatedTokenMinter,
|
|
54
|
+
R as createKbClient,
|
|
55
|
+
xe as createKbI18n,
|
|
56
|
+
I as createLocalStorageTokenStorage,
|
|
57
|
+
K as createMarkedInstance,
|
|
58
|
+
w as createMemoryTokenStorage,
|
|
59
|
+
De as createReviewClient,
|
|
60
|
+
Ye as createReviewPlan,
|
|
61
|
+
tr as csTranslations,
|
|
62
|
+
Y as darkenColor,
|
|
63
|
+
b as decodeJwtUser,
|
|
64
|
+
B as deepMerge,
|
|
65
|
+
F as defaultImageHtml,
|
|
66
|
+
ir as enTranslations,
|
|
67
|
+
Ae as extractTitleHeading,
|
|
68
|
+
x as findNavNode,
|
|
69
|
+
T as flattenNav,
|
|
70
|
+
pe as formatArticleDate,
|
|
71
|
+
Me as formatReviewForAgent,
|
|
72
|
+
he as formatReviewRound,
|
|
73
|
+
P as generateDescription,
|
|
74
|
+
Ce as getComponentMetadata,
|
|
75
|
+
Ie as getComponentNames,
|
|
76
|
+
He as getReviewSession,
|
|
77
|
+
L as hasAccessLevel,
|
|
78
|
+
j as hexToHsl,
|
|
79
|
+
X as hexToRgb,
|
|
80
|
+
Z as hslToRgb,
|
|
81
|
+
Se as inlineMarkdownToPlainText,
|
|
82
|
+
D as isConsultationAdapterError,
|
|
77
83
|
s as isConsultationErrorCode,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
m as isKbGraphQLError,
|
|
85
|
+
c as isNavigable,
|
|
86
|
+
Ne as isReviewTokenFormat,
|
|
87
|
+
$ as lightenColor,
|
|
88
|
+
ie as localizedHref,
|
|
89
|
+
fe as lockedRequiredAccess,
|
|
90
|
+
Te as mergeTranslations,
|
|
91
|
+
v as navBreadcrumbs,
|
|
92
|
+
g as navNextPrev,
|
|
93
|
+
A as navSiblings,
|
|
94
|
+
S as navSubtree,
|
|
95
|
+
_ as navWalk,
|
|
96
|
+
je as normalizeReviewText,
|
|
97
|
+
ne as pageUrl,
|
|
98
|
+
G as parseMarkdownSafe,
|
|
99
|
+
ve as prepareProps,
|
|
94
100
|
e as queries,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
Ke as renderReviewStatusHtml,
|
|
102
|
+
Ee as resolveArticleAccessLevel,
|
|
103
|
+
z as retryWithBackoff,
|
|
104
|
+
Fe as reviewBootstrapHtml,
|
|
105
|
+
Ge as reviewContentWithMedia,
|
|
106
|
+
ye as reviewFieldAttrs,
|
|
107
|
+
Be as reviewIgnoreAttrs,
|
|
108
|
+
qe as reviewResponseHeaders,
|
|
109
|
+
ze as reviewRootAttrs,
|
|
110
|
+
Qe as reviewStatusText,
|
|
111
|
+
ee as rgbTriplet,
|
|
112
|
+
rr as stampReviewDom,
|
|
113
|
+
V as stripLeadingH1,
|
|
114
|
+
se as stripLocalePrefix,
|
|
115
|
+
Re as toIsoDate
|
|
110
116
|
};
|