@blogmcp/sdk 0.11.0 → 0.13.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/community/client.d.ts +1 -1
- package/dist/community/client.js +2 -1
- package/dist/community/messages.cs.d.ts +5 -3
- package/dist/community/messages.cs.js +7 -3
- package/dist/community/messages.en.d.ts +5 -3
- package/dist/community/messages.en.js +7 -3
- package/dist/community/shapes.d.ts +15 -0
- package/dist/community/store.d.ts +12 -0
- package/dist/community/store.js +27 -27
- package/dist/core/client.d.ts +9 -0
- package/dist/core/client.js +54 -50
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +113 -103
- package/dist/core/queries.d.ts +1 -0
- package/dist/core/queries.js +76 -71
- package/dist/core/review/types.d.ts +7 -0
- package/dist/core/style-layers.d.ts +88 -0
- package/dist/core/style-layers.js +69 -0
- package/dist/nuxt/composables/useAsyncKb.d.ts +10 -4
- package/dist/packages/mdx-render-vue/dist/render/gallery/GalleryLightbox.vue.js +2 -2
- package/dist/packages/mdx-render-vue/dist/render/tripmap/TripMapDefault.vue.js +36 -36
- package/package.json +3 -3
- package/src/community/client.ts +3 -2
- package/src/community/messages.cs.ts +7 -3
- package/src/community/messages.en.ts +7 -3
- package/src/community/shapes.ts +15 -0
- package/src/community/store.ts +14 -2
- package/src/core/client.ts +12 -0
- package/src/core/index.ts +14 -0
- package/src/core/markdown.ts +1 -1
- package/src/core/queries.ts +8 -0
- package/src/core/review/types.ts +8 -0
- package/src/core/style-layers.ts +169 -0
- package/src/nuxt/composables/useAsyncKb.ts +11 -4
- package/src/nuxt/nuxt-imports.d.ts +2 -2
|
@@ -116,7 +116,7 @@ export interface CommunityClient {
|
|
|
116
116
|
me: {
|
|
117
117
|
/** Anonymous: `{ member: null, needs: ['sign_in'] }`. */
|
|
118
118
|
get: CallNoInput<MyState>;
|
|
119
|
-
/** The light onboarding: the age band, the rules (and the consent when asked), the profile. */
|
|
119
|
+
/** The light onboarding: the age band, the rules (and the terms on a first join, and the consent when asked), the profile. */
|
|
120
120
|
onboard: Call<OnboardInput, MyState>;
|
|
121
121
|
updateProfile: Call<ProfileUpdateInput, {
|
|
122
122
|
profile: OwnProfile;
|
package/dist/community/client.js
CHANGED
|
@@ -199,7 +199,8 @@ function ie(e) {
|
|
|
199
199
|
},
|
|
200
200
|
me: {
|
|
201
201
|
get: c("me.get"),
|
|
202
|
-
|
|
202
|
+
// O-16 / F-51: `termsTextId` goes only when the caller sets it (pick drops an absent key, so an older kb-api never sees it).
|
|
203
|
+
onboard: r("me.onboard", ["ageBand", "rulesTextId", "termsTextId", "art9TextId", "art9Refused", "displayName", "handle", "avatarPreset"]),
|
|
203
204
|
updateProfile: r("me.updateProfile", ["displayName", "handle", "avatarPreset", "bio"]),
|
|
204
205
|
notifications: {
|
|
205
206
|
list: r("me.notifications.list", ["cursor", "unreadOnly", "codes"]),
|
|
@@ -44,7 +44,7 @@ export declare const COMMUNITY_MESSAGES_CS: {
|
|
|
44
44
|
readonly 'error.followLimit': "Sledujete toho už hodně. Něco prosím přestaňte sledovat a zkuste to znovu.";
|
|
45
45
|
readonly 'error.submit': "Nepovedlo se to. Obnovte prosím stránku a zkuste to znovu.";
|
|
46
46
|
readonly 'need.sign_in': "Do diskuse můžete psát po přihlášení.";
|
|
47
|
-
readonly 'need.onboarding': "Před prvním komentářem si nastavte jméno a potvrďte pravidla diskuse.";
|
|
47
|
+
readonly 'need.onboarding': "Před prvním komentářem si nastavte jméno a potvrďte pravidla diskuse a podmínky.";
|
|
48
48
|
readonly 'need.reconsent_rules': "Pravidla diskuse se změnila. Potvrďte prosím novou verzi.";
|
|
49
49
|
readonly 'need.art9_consent': "Pro psaní do diskuse potřebujeme váš souhlas se zpracováním.";
|
|
50
50
|
readonly 'state.visible': "Zveřejněno";
|
|
@@ -169,6 +169,8 @@ export declare const COMMUNITY_MESSAGES_CS: {
|
|
|
169
169
|
readonly 'onboarding.rulesLede': "Přečtěte si prosím, jak to v diskusi chodí.";
|
|
170
170
|
readonly 'onboarding.rulesLink': "Celá pravidla";
|
|
171
171
|
readonly 'onboarding.rulesAccept': "Souhlasím s pravidly diskuse.";
|
|
172
|
+
readonly 'onboarding.rulesTermsAccept': "Souhlasím s pravidly diskuse a s podmínkami.";
|
|
173
|
+
readonly 'onboarding.termsLink': "Podmínky diskuse";
|
|
172
174
|
readonly 'onboarding.rulesChanged': "Pravidla diskuse se od vaší poslední návštěvy změnila. Přečtěte si prosím novou verzi a potvrďte ji.";
|
|
173
175
|
readonly 'onboarding.art9Title': "Souhlas se zpracováním";
|
|
174
176
|
readonly 'onboarding.art9Lede': "Pro psaní do diskuse potřebujeme váš souhlas podle textu níže.";
|
|
@@ -225,7 +227,7 @@ export declare const COMMUNITY_MESSAGES_CS: {
|
|
|
225
227
|
readonly 'panel.art9Refused': "Souhlas se zpracováním jste odmítli.";
|
|
226
228
|
readonly 'panel.art9Withdraw': "Odvolat souhlas";
|
|
227
229
|
readonly 'panel.art9WithdrawTitle': "Odvolat souhlas se zpracováním?";
|
|
228
|
-
readonly 'panel.art9WithdrawExplain': "Diskusi můžete dál číst.
|
|
230
|
+
readonly 'panel.art9WithdrawExplain': "Diskusi můžete dál číst. Příspěvky ve fóru, které jste napsali se souhlasem, smažeme za 7 dní — když souhlas do té doby znovu udělíte, zůstanou. Jestli půjde psát i bez souhlasu, záleží na nastavení webu; řekne vám to před dalším komentářem.";
|
|
229
231
|
readonly 'panel.art9WithdrawConfirm': "Ano, odvolat souhlas";
|
|
230
232
|
readonly 'panel.art9WithdrawCancel': "Ponechat souhlas";
|
|
231
233
|
readonly 'panel.art9Withdrawn': "Souhlas jste odvolali.";
|
|
@@ -448,7 +450,7 @@ export declare const COMMUNITY_MESSAGES_CS: {
|
|
|
448
450
|
readonly 'forumText.confirm.other': "Rozumím upozornění a chci příspěvek odeslat.";
|
|
449
451
|
readonly 'forumText.warning.identifier': "V příspěvku je nejspíš e-mail, telefon nebo číslo účtu. Pokud tam být nemá, příspěvek upravte.";
|
|
450
452
|
readonly 'forumText.warning.other': "Příspěvek je zveřejněný, ale pravidla diskuse u něj na něco upozorňují. Projděte si ho prosím.";
|
|
451
|
-
readonly 'forumText.need.onboarding': "Před prvním příspěvkem si nastavte jméno a potvrďte pravidla diskuse.";
|
|
453
|
+
readonly 'forumText.need.onboarding': "Před prvním příspěvkem si nastavte jméno a potvrďte pravidla diskuse a podmínky.";
|
|
452
454
|
readonly 'forumText.need.art9_consent': "Pro psaní ve fóru potřebujeme váš souhlas se zpracováním.";
|
|
453
455
|
readonly 'search.title': "Hledání ve fóru";
|
|
454
456
|
readonly 'search.label': "Co hledáte?";
|
|
@@ -36,7 +36,8 @@ const e = {
|
|
|
36
36
|
"error.submit": "Nepovedlo se to. Obnovte prosím stránku a zkuste to znovu.",
|
|
37
37
|
// ── what the composer waits for (need.<Need>) ──
|
|
38
38
|
"need.sign_in": "Do diskuse můžete psát po přihlášení.",
|
|
39
|
-
|
|
39
|
+
// O-16 / F-51: the first join confirms the rules and the terms in one go (the terms once, never again).
|
|
40
|
+
"need.onboarding": "Před prvním komentářem si nastavte jméno a potvrďte pravidla diskuse a podmínky.",
|
|
40
41
|
"need.reconsent_rules": "Pravidla diskuse se změnila. Potvrďte prosím novou verzi.",
|
|
41
42
|
"need.art9_consent": "Pro psaní do diskuse potřebujeme váš souhlas se zpracováním.",
|
|
42
43
|
// ── a message's state (state.<MessageState>) ──
|
|
@@ -172,6 +173,9 @@ const e = {
|
|
|
172
173
|
"onboarding.rulesLede": "Přečtěte si prosím, jak to v diskusi chodí.",
|
|
173
174
|
"onboarding.rulesLink": "Celá pravidla",
|
|
174
175
|
"onboarding.rulesAccept": "Souhlasím s pravidly diskuse.",
|
|
176
|
+
// O-16 / F-51: the one consent of a first join where the tenant has terms (the rules and the terms, each linked).
|
|
177
|
+
"onboarding.rulesTermsAccept": "Souhlasím s pravidly diskuse a s podmínkami.",
|
|
178
|
+
"onboarding.termsLink": "Podmínky diskuse",
|
|
175
179
|
"onboarding.rulesChanged": "Pravidla diskuse se od vaší poslední návštěvy změnila. Přečtěte si prosím novou verzi a potvrďte ji.",
|
|
176
180
|
"onboarding.art9Title": "Souhlas se zpracováním",
|
|
177
181
|
"onboarding.art9Lede": "Pro psaní do diskuse potřebujeme váš souhlas podle textu níže.",
|
|
@@ -231,7 +235,7 @@ const e = {
|
|
|
231
235
|
"panel.art9Refused": "Souhlas se zpracováním jste odmítli.",
|
|
232
236
|
"panel.art9Withdraw": "Odvolat souhlas",
|
|
233
237
|
"panel.art9WithdrawTitle": "Odvolat souhlas se zpracováním?",
|
|
234
|
-
"panel.art9WithdrawExplain": "Diskusi můžete dál číst.
|
|
238
|
+
"panel.art9WithdrawExplain": "Diskusi můžete dál číst. Příspěvky ve fóru, které jste napsali se souhlasem, smažeme za 7 dní — když souhlas do té doby znovu udělíte, zůstanou. Jestli půjde psát i bez souhlasu, záleží na nastavení webu; řekne vám to před dalším komentářem.",
|
|
235
239
|
"panel.art9WithdrawConfirm": "Ano, odvolat souhlas",
|
|
236
240
|
"panel.art9WithdrawCancel": "Ponechat souhlas",
|
|
237
241
|
"panel.art9Withdrawn": "Souhlas jste odvolali.",
|
|
@@ -477,7 +481,7 @@ const e = {
|
|
|
477
481
|
"forumText.confirm.other": "Rozumím upozornění a chci příspěvek odeslat.",
|
|
478
482
|
"forumText.warning.identifier": "V příspěvku je nejspíš e-mail, telefon nebo číslo účtu. Pokud tam být nemá, příspěvek upravte.",
|
|
479
483
|
"forumText.warning.other": "Příspěvek je zveřejněný, ale pravidla diskuse u něj na něco upozorňují. Projděte si ho prosím.",
|
|
480
|
-
"forumText.need.onboarding": "Před prvním příspěvkem si nastavte jméno a potvrďte pravidla diskuse.",
|
|
484
|
+
"forumText.need.onboarding": "Před prvním příspěvkem si nastavte jméno a potvrďte pravidla diskuse a podmínky.",
|
|
481
485
|
"forumText.need.art9_consent": "Pro psaní ve fóru potřebujeme váš souhlas se zpracováním.",
|
|
482
486
|
"search.title": "Hledání ve fóru",
|
|
483
487
|
"search.label": "Co hledáte?",
|
|
@@ -38,7 +38,7 @@ export declare const COMMUNITY_MESSAGES_EN: {
|
|
|
38
38
|
readonly 'error.followLimit': "You're already following a lot. Please unfollow something and try again.";
|
|
39
39
|
readonly 'error.submit': "That didn't work. Please reload the page and try again.";
|
|
40
40
|
readonly 'need.sign_in': "Sign in to write in the discussion.";
|
|
41
|
-
readonly 'need.onboarding': "Before your first comment, choose a name and confirm the discussion rules.";
|
|
41
|
+
readonly 'need.onboarding': "Before your first comment, choose a name and confirm the discussion rules and terms.";
|
|
42
42
|
readonly 'need.reconsent_rules': "The discussion rules have changed. Please confirm the new version.";
|
|
43
43
|
readonly 'need.art9_consent': "To write in the discussion, we need your consent to the processing.";
|
|
44
44
|
readonly 'state.visible': "Published";
|
|
@@ -155,6 +155,8 @@ export declare const COMMUNITY_MESSAGES_EN: {
|
|
|
155
155
|
readonly 'onboarding.rulesLede': "Please read how the discussion works.";
|
|
156
156
|
readonly 'onboarding.rulesLink': "The full rules";
|
|
157
157
|
readonly 'onboarding.rulesAccept': "I agree to the discussion rules.";
|
|
158
|
+
readonly 'onboarding.rulesTermsAccept': "I agree to the discussion rules and the terms.";
|
|
159
|
+
readonly 'onboarding.termsLink': "The discussion terms";
|
|
158
160
|
readonly 'onboarding.rulesChanged': "The discussion rules have changed since your last visit. Please read the new version and confirm it.";
|
|
159
161
|
readonly 'onboarding.art9Title': "Consent to processing";
|
|
160
162
|
readonly 'onboarding.art9Lede': "To write in the discussion, we need your consent as described below.";
|
|
@@ -209,7 +211,7 @@ export declare const COMMUNITY_MESSAGES_EN: {
|
|
|
209
211
|
readonly 'panel.art9Refused': "You declined the consent to the processing.";
|
|
210
212
|
readonly 'panel.art9Withdraw': "Withdraw consent";
|
|
211
213
|
readonly 'panel.art9WithdrawTitle': "Withdraw your consent to the processing?";
|
|
212
|
-
readonly 'panel.art9WithdrawExplain': "You can keep reading the discussion.
|
|
214
|
+
readonly 'panel.art9WithdrawExplain': "You can keep reading the discussion. The forum posts you wrote under the consent are erased after 7 days — give the consent again before then and they stay. Whether you can write without the consent depends on the website's settings; it tells you before your next comment.";
|
|
213
215
|
readonly 'panel.art9WithdrawConfirm': "Yes, withdraw consent";
|
|
214
216
|
readonly 'panel.art9WithdrawCancel': "Keep the consent";
|
|
215
217
|
readonly 'panel.art9Withdrawn': "You've withdrawn your consent.";
|
|
@@ -420,7 +422,7 @@ export declare const COMMUNITY_MESSAGES_EN: {
|
|
|
420
422
|
readonly 'forumText.confirm.other': "I understand the notice and want to send the post.";
|
|
421
423
|
readonly 'forumText.warning.identifier': "The post seems to contain an e-mail address, a phone number or an account number. If it shouldn't be there, edit the post.";
|
|
422
424
|
readonly 'forumText.warning.other': "The post is published, but the discussion rules flag something in it. Please look it over.";
|
|
423
|
-
readonly 'forumText.need.onboarding': "Before your first post, choose a name and confirm the discussion rules.";
|
|
425
|
+
readonly 'forumText.need.onboarding': "Before your first post, choose a name and confirm the discussion rules and terms.";
|
|
424
426
|
readonly 'forumText.need.art9_consent': "To write in the forum, we need your consent to the processing.";
|
|
425
427
|
readonly 'search.title': "Search the forum";
|
|
426
428
|
readonly 'search.label': "What are you looking for?";
|
|
@@ -33,7 +33,8 @@ const e = {
|
|
|
33
33
|
"error.followLimit": "You're already following a lot. Please unfollow something and try again.",
|
|
34
34
|
"error.submit": "That didn't work. Please reload the page and try again.",
|
|
35
35
|
"need.sign_in": "Sign in to write in the discussion.",
|
|
36
|
-
|
|
36
|
+
// O-16 / F-51: the first join confirms the rules and the terms in one go (the terms once, never again).
|
|
37
|
+
"need.onboarding": "Before your first comment, choose a name and confirm the discussion rules and terms.",
|
|
37
38
|
"need.reconsent_rules": "The discussion rules have changed. Please confirm the new version.",
|
|
38
39
|
"need.art9_consent": "To write in the discussion, we need your consent to the processing.",
|
|
39
40
|
"state.visible": "Published",
|
|
@@ -150,6 +151,9 @@ const e = {
|
|
|
150
151
|
"onboarding.rulesLede": "Please read how the discussion works.",
|
|
151
152
|
"onboarding.rulesLink": "The full rules",
|
|
152
153
|
"onboarding.rulesAccept": "I agree to the discussion rules.",
|
|
154
|
+
// O-16 / F-51: the one consent of a first join where the tenant has terms (the rules and the terms, each linked).
|
|
155
|
+
"onboarding.rulesTermsAccept": "I agree to the discussion rules and the terms.",
|
|
156
|
+
"onboarding.termsLink": "The discussion terms",
|
|
153
157
|
"onboarding.rulesChanged": "The discussion rules have changed since your last visit. Please read the new version and confirm it.",
|
|
154
158
|
"onboarding.art9Title": "Consent to processing",
|
|
155
159
|
"onboarding.art9Lede": "To write in the discussion, we need your consent as described below.",
|
|
@@ -205,7 +209,7 @@ const e = {
|
|
|
205
209
|
"panel.art9Refused": "You declined the consent to the processing.",
|
|
206
210
|
"panel.art9Withdraw": "Withdraw consent",
|
|
207
211
|
"panel.art9WithdrawTitle": "Withdraw your consent to the processing?",
|
|
208
|
-
"panel.art9WithdrawExplain": "You can keep reading the discussion.
|
|
212
|
+
"panel.art9WithdrawExplain": "You can keep reading the discussion. The forum posts you wrote under the consent are erased after 7 days — give the consent again before then and they stay. Whether you can write without the consent depends on the website's settings; it tells you before your next comment.",
|
|
209
213
|
"panel.art9WithdrawConfirm": "Yes, withdraw consent",
|
|
210
214
|
"panel.art9WithdrawCancel": "Keep the consent",
|
|
211
215
|
"panel.art9Withdrawn": "You've withdrawn your consent.",
|
|
@@ -425,7 +429,7 @@ const e = {
|
|
|
425
429
|
"forumText.confirm.other": "I understand the notice and want to send the post.",
|
|
426
430
|
"forumText.warning.identifier": "The post seems to contain an e-mail address, a phone number or an account number. If it shouldn't be there, edit the post.",
|
|
427
431
|
"forumText.warning.other": "The post is published, but the discussion rules flag something in it. Please look it over.",
|
|
428
|
-
"forumText.need.onboarding": "Before your first post, choose a name and confirm the discussion rules.",
|
|
432
|
+
"forumText.need.onboarding": "Before your first post, choose a name and confirm the discussion rules and terms.",
|
|
429
433
|
"forumText.need.art9_consent": "To write in the forum, we need your consent to the processing.",
|
|
430
434
|
"search.title": "Search the forum",
|
|
431
435
|
"search.label": "What are you looking for?",
|
|
@@ -360,6 +360,14 @@ export interface MyState {
|
|
|
360
360
|
readonly profile: OwnProfile | null;
|
|
361
361
|
readonly acceptances: {
|
|
362
362
|
readonly rules: AcceptanceState;
|
|
363
|
+
/**
|
|
364
|
+
* O-16 / F-51 (the owner, 9. 11. 2026: the terms are accepted once, at onboarding, and never asked again): null when
|
|
365
|
+
* the tenant publishes no terms text, `accepted` once the member accepted any terms text (for good — never
|
|
366
|
+
* `reconsent_required`), `never` otherwise. No `need` ever asks for the terms; a first onboarding sends
|
|
367
|
+
* `termsTextId` (viewerNeeds(me).terms). Absent from a kb-api older than O-16 — that kb-api does not take
|
|
368
|
+
* `termsTextId` either (its strict schema refuses the key), so nothing is sent then.
|
|
369
|
+
*/
|
|
370
|
+
readonly terms?: AcceptanceState | null;
|
|
363
371
|
readonly art9Consent: AcceptanceState | null;
|
|
364
372
|
/**
|
|
365
373
|
* M2 T9 (§3.8): the member refused the art. 9 consent under `art9Refusal = public_write` and has not given it
|
|
@@ -779,6 +787,13 @@ export interface OnboardInput {
|
|
|
779
787
|
ageBand: AgeBand;
|
|
780
788
|
/** The current `rules` text's id (`legal/current`). */
|
|
781
789
|
rulesTextId: string;
|
|
790
|
+
/**
|
|
791
|
+
* O-16 / F-51: the current `terms` text's id (`legal/current { kind: 'terms' }`) — required on a member's first
|
|
792
|
+
* onboarding while the tenant has a terms text (MyState.acceptances.terms `never`): the key absent, null or another
|
|
793
|
+
* id is VALIDATION on `termsTextId` then. Recorded once and never asked again. Send it only to a kb-api whose me/get
|
|
794
|
+
* answers `acceptances.terms` (viewerNeeds(me).terms): an older one refuses the key.
|
|
795
|
+
*/
|
|
796
|
+
termsTextId?: string | null;
|
|
782
797
|
/** The current `art9_consent` text's id, when the tenant asks for the consent. */
|
|
783
798
|
art9TextId?: string | null;
|
|
784
799
|
/**
|
|
@@ -167,11 +167,23 @@ export interface ViewerNeeds {
|
|
|
167
167
|
readonly rules: boolean;
|
|
168
168
|
/** The consent the tenant asks for before writing. */
|
|
169
169
|
readonly art9: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* O-16 / F-51 (the owner, 9. 11. 2026: the terms once, never again): the first join also accepts the tenant's terms,
|
|
172
|
+
* so its me/onboard sends `termsTextId` — read from a MyState: a first join (`onboarding`) whose `acceptances.terms`
|
|
173
|
+
* is `never` (the tenant has a terms text, none accepted). Presence of the field is the rollout guard: a kb-api
|
|
174
|
+
* older than O-16 answers no `terms` and refuses the key, so nothing is sent to it. Never true for a member already
|
|
175
|
+
* onboarded (they are never asked) nor from a discussion state (no acceptances there), and not a need of its own:
|
|
176
|
+
* `any` does not count it — it rides on the onboarding.
|
|
177
|
+
*/
|
|
178
|
+
readonly terms: boolean;
|
|
170
179
|
/** Any of these. */
|
|
171
180
|
readonly any: boolean;
|
|
172
181
|
}
|
|
173
182
|
export declare function viewerNeeds(state: Pick<DiscussionState, 'viewer'> | {
|
|
174
183
|
needs: readonly unknown[];
|
|
184
|
+
acceptances?: {
|
|
185
|
+
readonly terms?: unknown;
|
|
186
|
+
} | null;
|
|
175
187
|
}): ViewerNeeds;
|
|
176
188
|
/** A loaded message (top-level or reply) by its seq, or null. */
|
|
177
189
|
export declare function findMessage(state: Pick<DiscussionState, 'messages'>, seq: number): DiscussionMessage | null;
|
package/dist/community/store.js
CHANGED
|
@@ -40,7 +40,7 @@ function N(e, s) {
|
|
|
40
40
|
const M = N(y, !1);
|
|
41
41
|
M && g.push(M);
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const O = Z(e.notes);
|
|
44
44
|
return Object.freeze({
|
|
45
45
|
conversationId: r,
|
|
46
46
|
seq: e.seq,
|
|
@@ -60,7 +60,7 @@ function N(e, s) {
|
|
|
60
60
|
collapsed: e.collapsed === !0,
|
|
61
61
|
reactions: L(e.reactions),
|
|
62
62
|
translationVersionId: f(e.translationVersionId),
|
|
63
|
-
...
|
|
63
|
+
...O && O.length > 0 ? { notes: O } : {},
|
|
64
64
|
// Only as kb-api sends it: true, on a `held` message (the author's own, held back by the art. 9 policy).
|
|
65
65
|
...e.hiddenUntilConsent === !0 && e.state === "held" ? { hiddenUntilConsent: !0 } : {},
|
|
66
66
|
// M3 (§4.2): the author's own message waiting in pre-moderation — true on a `held` row only, as kb-api sends it.
|
|
@@ -134,7 +134,7 @@ function Ce() {
|
|
|
134
134
|
let e = V;
|
|
135
135
|
const s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
136
136
|
let c = 0, m = -1;
|
|
137
|
-
const g = /* @__PURE__ */ new Set(),
|
|
137
|
+
const g = /* @__PURE__ */ new Set(), O = () => {
|
|
138
138
|
c += 1, g.clear();
|
|
139
139
|
for (const t of n.keys())
|
|
140
140
|
r.delete(t), r.add(t);
|
|
@@ -156,7 +156,7 @@ function Ce() {
|
|
|
156
156
|
function M(t, o = {}) {
|
|
157
157
|
if (!C(t)) return;
|
|
158
158
|
const u = f(t.articleId)?.toLowerCase() ?? null, l = e.articleId !== null && u !== null && u !== e.articleId, i = l ? V : e;
|
|
159
|
-
l &&
|
|
159
|
+
l && O();
|
|
160
160
|
const b = typeof o.cursor == "number" && Number.isFinite(o.cursor) ? o.cursor : null, I = b ?? 0, q = typeof t.nextCursor == "number" && Number.isFinite(t.nextCursor) ? t.nextCursor : null, h = q ?? Number.POSITIVE_INFINITY, j = /* @__PURE__ */ new Map();
|
|
161
161
|
for (const d of Array.isArray(t.messages) ? t.messages : []) {
|
|
162
162
|
const a = N(d, !0);
|
|
@@ -172,18 +172,18 @@ function Ce() {
|
|
|
172
172
|
const a = [d, ...d.replies];
|
|
173
173
|
for (const S of a) S.pending && S.pending !== "post" && S.clientMsgId && p.set(S.seq, S);
|
|
174
174
|
}
|
|
175
|
-
const
|
|
175
|
+
const v = (d) => {
|
|
176
176
|
const a = p.get(d.seq);
|
|
177
177
|
if (!a) return d;
|
|
178
178
|
const S = a.clientMsgId ? n.get(a.clientMsgId) : void 0;
|
|
179
179
|
return S && (S.before = d), a.replyToSeq === null ? Object.freeze({ ...a, replies: d.replies }) : a;
|
|
180
|
-
},
|
|
180
|
+
}, z = i.messages.filter((d) => d.seq < 0 || d.seq <= I || d.seq > h), R = /* @__PURE__ */ new Map();
|
|
181
181
|
for (const d of i.messages)
|
|
182
182
|
for (const a of d.replies)
|
|
183
183
|
a.seq < 0 && a.replyToSeq !== null && R.set(a.replyToSeq, [...R.get(a.replyToSeq) ?? [], a]);
|
|
184
|
-
const A = [...
|
|
184
|
+
const A = [...z.filter((d) => !j.has(d.seq)), ...j.values()].map((d) => {
|
|
185
185
|
if (!j.has(d.seq)) return d;
|
|
186
|
-
const a =
|
|
186
|
+
const a = v(d), S = a.replies.map(v), H = R.get(d.seq) ?? [];
|
|
187
187
|
return S.some((fe, pe) => fe !== a.replies[pe]) || H.length > 0 ? Object.freeze({ ...a, replies: x([...S, ...H]) }) : a;
|
|
188
188
|
}), _ = i.loaded ? i.nextCursor : 0, de = _ === null ? null : I > _ ? _ : q === null ? null : Math.max(_, q);
|
|
189
189
|
y({
|
|
@@ -266,11 +266,11 @@ function Ce() {
|
|
|
266
266
|
const b = t.warnings ? Z(t.warnings) : void 0, I = b && b.length > 0 ? Object.freeze({ ...l, warnings: b }) : l, q = k(i, (p) => p.seq === I.seq);
|
|
267
267
|
let h, j = e.count;
|
|
268
268
|
if (I.state === "deleted" || o?.type === "delete") {
|
|
269
|
-
const p = q ?? null,
|
|
269
|
+
const p = q ?? null, v = p?.state === "visible" && p.body !== null;
|
|
270
270
|
h = T(
|
|
271
271
|
i,
|
|
272
|
-
(
|
|
273
|
-
),
|
|
272
|
+
(z) => z.seq !== I.seq ? z : Y(z) ? Object.freeze({ ...I, replies: z.replies }) : null
|
|
273
|
+
), v && (j = Math.max(0, j - 1));
|
|
274
274
|
} else
|
|
275
275
|
h = U(i, I), !q && I.state === "visible" && (j += 1);
|
|
276
276
|
y({
|
|
@@ -364,11 +364,11 @@ function Ce() {
|
|
|
364
364
|
return y({ ...e, articleReactions: Object.freeze({ counts: A.counts, mine: e.articleReactions.mine }) }), "applied";
|
|
365
365
|
}
|
|
366
366
|
if (!P(t.seq)) return "dropped";
|
|
367
|
-
const p = t.seq,
|
|
368
|
-
if (!
|
|
369
|
-
if (o >
|
|
370
|
-
const
|
|
371
|
-
return y({ ...e, messages: T(e.messages, (A) => A ===
|
|
367
|
+
const p = t.seq, v = k(e.messages, (A) => A.seq === p);
|
|
368
|
+
if (!v || v.pending || o < v.rev) return "dropped";
|
|
369
|
+
if (o > v.rev) return "resync";
|
|
370
|
+
const z = L(t.reactions), R = Object.freeze({ counts: z.counts, mine: v.reactions.mine });
|
|
371
|
+
return y({ ...e, messages: T(e.messages, (A) => A === v ? Object.freeze({ ...A, reactions: R }) : A) }), "applied";
|
|
372
372
|
}
|
|
373
373
|
if (t.kind !== "message" && t.kind !== "edit" && t.kind !== "delete") return "dropped";
|
|
374
374
|
const u = t.message, l = N(u, u?.replyToSeq === null || u?.replyToSeq === void 0);
|
|
@@ -378,11 +378,11 @@ function Ce() {
|
|
|
378
378
|
const b = i?.rev ?? 0;
|
|
379
379
|
if (t.kind === "delete") {
|
|
380
380
|
if (!i || o <= b) return "dropped";
|
|
381
|
-
const p = i.state === "visible" && i.body !== null,
|
|
381
|
+
const p = i.state === "visible" && i.body !== null, v = T(
|
|
382
382
|
e.messages,
|
|
383
|
-
(
|
|
383
|
+
(z) => z.seq !== l.seq ? z : Y(z) ? Object.freeze({ ...l, replies: z.replies }) : null
|
|
384
384
|
);
|
|
385
|
-
return y({ ...e, messages:
|
|
385
|
+
return y({ ...e, messages: v, count: p ? Math.max(0, e.count - 1) : e.count, lastSeq: Math.max(e.lastSeq, l.seq) }), "applied";
|
|
386
386
|
}
|
|
387
387
|
const I = l.author.kind === "member" && l.author.memberId !== null && l.author.memberId === e.viewer.memberId;
|
|
388
388
|
if (!i && I && [...n.values()].some((p) => p.type === "post") || o <= b) return "dropped";
|
|
@@ -404,7 +404,7 @@ function Ce() {
|
|
|
404
404
|
collapse: ce,
|
|
405
405
|
applyEvent: ae,
|
|
406
406
|
reset() {
|
|
407
|
-
|
|
407
|
+
O(), y(V);
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
return w.set(B, () => c), B;
|
|
@@ -414,8 +414,8 @@ function X(e) {
|
|
|
414
414
|
return Object.freeze(r);
|
|
415
415
|
}
|
|
416
416
|
function Te(e) {
|
|
417
|
-
const s = "viewer" in e ? e.viewer.needs : e.needs, n = new Set(s.filter($)), r = n.has("sign_in"), c = n.has("onboarding"), m = c || n.has("reconsent_rules"), g = n.has("art9_consent");
|
|
418
|
-
return Object.freeze({ signIn: r, onboarding: c, rules: m, art9: g, any: r || c || m || g });
|
|
417
|
+
const s = "viewer" in e ? e.viewer.needs : e.needs, n = new Set(s.filter($)), r = n.has("sign_in"), c = n.has("onboarding"), m = c || n.has("reconsent_rules"), g = n.has("art9_consent"), O = c && !("viewer" in e) && e.acceptances?.terms === "never";
|
|
418
|
+
return Object.freeze({ signIn: r, onboarding: c, rules: m, art9: g, terms: O, any: r || c || m || g });
|
|
419
419
|
}
|
|
420
420
|
function Me(e, s) {
|
|
421
421
|
return k(e.messages, (n) => n.seq === s);
|
|
@@ -450,15 +450,15 @@ function ee(e) {
|
|
|
450
450
|
const ze = (e) => typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
451
451
|
async function xe(e, s, n, r) {
|
|
452
452
|
const c = e.getState(), m = c.loaded ? c.nextCursor : 0, g = ee(e);
|
|
453
|
-
let
|
|
453
|
+
let O = null;
|
|
454
454
|
for (let y = 0; y < ve; y++) {
|
|
455
|
-
const M = await s.discussions.list({ articleId: n.articleId, languageCode: n.languageCode ?? null, cursor:
|
|
455
|
+
const M = await s.discussions.list({ articleId: n.articleId, languageCode: n.languageCode ?? null, cursor: O }, r);
|
|
456
456
|
if (!M.ok) return M;
|
|
457
457
|
if (g.moved()) break;
|
|
458
|
-
e.applyPage(M.value, { cursor:
|
|
458
|
+
e.applyPage(M.value, { cursor: O }), g.mark();
|
|
459
459
|
const E = ze(M.value.nextCursor);
|
|
460
|
-
if (E === null || m !== null && E >= m ||
|
|
461
|
-
|
|
460
|
+
if (E === null || m !== null && E >= m || O !== null && E <= O) break;
|
|
461
|
+
O = E;
|
|
462
462
|
}
|
|
463
463
|
return { ok: !0, value: e.getState() };
|
|
464
464
|
}
|
package/dist/core/client.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import type { KbClientConfig } from './client-types.js';
|
|
9
9
|
import type { Article, ArticlePreview, ArticleWithTranslation, ArticleVersionContent, Tag, LocalizedTag, Language, SearchResult, KBContextChunk, Translation, Comment, CommentsConnection, CommentResult, AuthResult, RegisterResult, UpdateProfileResult, ReportSettings, UpdateReportSettingsInput } from './types.js';
|
|
10
10
|
import type { NavNode } from './navigation.js';
|
|
11
|
+
import { type StyleLayer } from './style-layers.js';
|
|
11
12
|
import { type KbConsultationsApi, type KbConsultationSessionApi } from './consultations.js';
|
|
12
13
|
export interface KbClient {
|
|
13
14
|
articles: {
|
|
@@ -131,6 +132,14 @@ export interface KbClient {
|
|
|
131
132
|
kbNavigation: NavNode[];
|
|
132
133
|
}>;
|
|
133
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Style layers: the PUBLISHED layers of the site, in the order they apply (see `./style-layers`).
|
|
137
|
+
* Unlike the other groups this returns the parsed list, not the GraphQL field: an entry that is
|
|
138
|
+
* not a layer is dropped, so a caller can render what comes back.
|
|
139
|
+
*/
|
|
140
|
+
styleLayers: {
|
|
141
|
+
list(): Promise<StyleLayer[]>;
|
|
142
|
+
};
|
|
134
143
|
/**
|
|
135
144
|
* Editorial access to translation ROWS — INTERNAL tokens only (a server client holding a
|
|
136
145
|
* kb_* internal key). The server refuses every other caller: a translation row carries the
|
package/dist/core/client.js
CHANGED
|
@@ -1,97 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { parseStyleLayers as S } from "./style-layers.js";
|
|
2
|
+
import { UPDATE_MY_PROFILE as _, ARTICLE_VERSION as I, ACCESSIBLE_ARTICLES_WITH_LOCKED_LOCALIZED as l, ACCESSIBLE_ARTICLES_LOCALIZED as L, UPDATE_MY_REPORT_SETTINGS as C, MY_REPORT_SETTINGS as R, CHANGE_PASSWORD as d, RESEND_VERIFICATION as c, RESET_PASSWORD as u, FORGOT_PASSWORD as O, VERIFY_EMAIL as p, REGISTER as N, LOGIN as h, DELETE_COMMENT as m, UPDATE_COMMENT as y, CREATE_COMMENT as g, GET_COMMENT as G, ARTICLE_COMMENTS as P, GET_TRANSLATION as D, ARTICLE_TRANSLATIONS as B, KB_STYLE_LAYERS as M, KB_NAVIGATION as f, KB_LANGUAGES as w, LOCALIZED_TAGS as W, ACCESSIBLE_TAGS as v, GET_KB_CONTEXT as K, SEARCH_KNOWLEDGE_BASE as k, ARTICLE_ALIAS_TARGET as V, ARTICLE_PREVIEW_BY_ID as Y, ARTICLE_PREVIEW as b, ARTICLE_WITH_TRANSLATION_BY_ID as x, ARTICLE_WITH_TRANSLATION as H, ACCESSIBLE_ARTICLES_WITH_LOCKED as U, ACCESSIBLE_ARTICLES as F } from "./queries.js";
|
|
3
|
+
import { createMemoryTokenStorage as Q } from "./auth.js";
|
|
4
|
+
import { KbGraphQLError as Z } from "./errors.js";
|
|
5
|
+
import { createConsultationSessionApi as j, createConsultationsApi as z } from "./consultations.js";
|
|
6
|
+
function q() {
|
|
7
|
+
return async (n, a) => (await fetch(n, {
|
|
8
|
+
method: a.method,
|
|
9
|
+
headers: a.headers,
|
|
10
|
+
body: a.body
|
|
10
11
|
})).json();
|
|
11
12
|
}
|
|
12
|
-
async function
|
|
13
|
+
async function J(n, a, o) {
|
|
13
14
|
const T = {
|
|
14
15
|
...n.headers ?? {},
|
|
15
16
|
"Content-Type": "application/json"
|
|
16
|
-
},
|
|
17
|
-
|
|
17
|
+
}, s = n.tokenStorage.getToken();
|
|
18
|
+
s && (T.Authorization = `Bearer ${s}`);
|
|
18
19
|
const t = await n.fetcher(n.endpoint, {
|
|
19
20
|
method: "POST",
|
|
20
21
|
headers: T,
|
|
21
|
-
body: JSON.stringify({ query:
|
|
22
|
+
body: JSON.stringify({ query: a, variables: o })
|
|
22
23
|
});
|
|
23
24
|
if (t.errors?.length)
|
|
24
|
-
throw new
|
|
25
|
+
throw new Z(t.errors);
|
|
25
26
|
return t.data;
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
28
|
+
function ne(n) {
|
|
29
|
+
const a = n.fetcher || q(), o = n.tokenStorage || Q(), s = { endpoint: n.isServer && n.serverEndpoint ? n.serverEndpoint : n.endpoint, fetcher: a, tokenStorage: o, headers: n.headers };
|
|
29
30
|
function t(e, r) {
|
|
30
|
-
return
|
|
31
|
+
return J(s, e, r);
|
|
31
32
|
}
|
|
32
33
|
return {
|
|
33
34
|
articles: {
|
|
34
35
|
list: (e) => {
|
|
35
|
-
const { includeLocked: r, languageCode:
|
|
36
|
-
return
|
|
37
|
-
r ?
|
|
38
|
-
{ ...i, languageCode:
|
|
39
|
-
) : t(r ?
|
|
36
|
+
const { includeLocked: r, languageCode: E, includeUntranslated: A, ...i } = e ?? {};
|
|
37
|
+
return E ? t(
|
|
38
|
+
r ? l : L,
|
|
39
|
+
{ ...i, languageCode: E, includeUntranslated: A === !0 }
|
|
40
|
+
) : t(r ? U : F, i);
|
|
40
41
|
},
|
|
41
|
-
getWithTranslation: (e, r) => t(
|
|
42
|
-
getWithTranslationById: (e, r) => t(
|
|
43
|
-
getPreview: (e, r) => t(
|
|
44
|
-
getPreviewById: (e, r) => t(
|
|
45
|
-
resolveAlias: (e) => t(
|
|
46
|
-
getVersion: (e, r) => t(
|
|
42
|
+
getWithTranslation: (e, r) => t(H, { filename: e, languageCode: r }),
|
|
43
|
+
getWithTranslationById: (e, r) => t(x, { id: e, languageCode: r }),
|
|
44
|
+
getPreview: (e, r) => t(b, { filename: e, languageCode: r }),
|
|
45
|
+
getPreviewById: (e, r) => t(Y, { id: e, languageCode: r }),
|
|
46
|
+
resolveAlias: (e) => t(V, { filename: e }),
|
|
47
|
+
getVersion: (e, r) => t(I, { versionId: e, previewKey: r?.previewKey ?? null })
|
|
47
48
|
},
|
|
48
49
|
search: {
|
|
49
|
-
query: (e) => t(
|
|
50
|
-
getContext: (e, r) => t(
|
|
50
|
+
query: (e) => t(k, e),
|
|
51
|
+
getContext: (e, r) => t(K, { query: e, maxChunks: r })
|
|
51
52
|
},
|
|
52
53
|
tags: {
|
|
53
|
-
list: () => t(
|
|
54
|
-
listLocalized: (e) => t(
|
|
54
|
+
list: () => t(v),
|
|
55
|
+
listLocalized: (e) => t(W, { languageCode: e })
|
|
55
56
|
},
|
|
56
57
|
languages: {
|
|
57
|
-
list: () => t(
|
|
58
|
+
list: () => t(w)
|
|
58
59
|
},
|
|
59
60
|
navigation: {
|
|
60
|
-
get: (e) => t(
|
|
61
|
+
get: (e) => t(f, e ?? {})
|
|
62
|
+
},
|
|
63
|
+
styleLayers: {
|
|
64
|
+
list: async () => S((await t(M))?.kbStyleLayers)
|
|
61
65
|
},
|
|
62
66
|
translations: {
|
|
63
|
-
list: (e) => t(
|
|
67
|
+
list: (e) => t(B, { articleId: e }),
|
|
64
68
|
get: (e, r) => t(D, { sourceFilename: e, languageCode: r })
|
|
65
69
|
},
|
|
66
70
|
comments: {
|
|
67
71
|
list: (e, r) => t(P, { articleId: e, languageCode: r }),
|
|
68
72
|
get: (e, r) => t(G, { commentId: e, languageCode: r }),
|
|
69
|
-
create: (e) => t(
|
|
70
|
-
update: (e, r) => t(
|
|
71
|
-
delete: (e) => t(
|
|
73
|
+
create: (e) => t(g, e),
|
|
74
|
+
update: (e, r) => t(y, { commentId: e, content: r }),
|
|
75
|
+
delete: (e) => t(m, { commentId: e })
|
|
72
76
|
},
|
|
73
77
|
auth: {
|
|
74
|
-
login: (e, r) => t(
|
|
75
|
-
register: (e, r,
|
|
76
|
-
verifyEmail: (e) => t(
|
|
77
|
-
forgotPassword: (e) => t(
|
|
78
|
-
resetPassword: (e, r) => t(
|
|
79
|
-
resendVerification: (e) => t(
|
|
78
|
+
login: (e, r) => t(h, { email: e, password: r }),
|
|
79
|
+
register: (e, r, E) => t(N, { email: e, password: r, name: E }),
|
|
80
|
+
verifyEmail: (e) => t(p, { token: e }),
|
|
81
|
+
forgotPassword: (e) => t(O, { email: e }),
|
|
82
|
+
resetPassword: (e, r) => t(u, { token: e, password: r }),
|
|
83
|
+
resendVerification: (e) => t(c, { email: e }),
|
|
80
84
|
changePassword: (e, r) => t(d, { currentPassword: e, newPassword: r }),
|
|
81
|
-
updateProfile: (e) => t(
|
|
85
|
+
updateProfile: (e) => t(_, {
|
|
82
86
|
name: e.name ?? null,
|
|
83
87
|
email: e.email ?? null
|
|
84
88
|
})
|
|
85
89
|
},
|
|
86
90
|
reportSettings: {
|
|
87
|
-
get: () => t(
|
|
88
|
-
update: (e) => t(
|
|
91
|
+
get: () => t(R),
|
|
92
|
+
update: (e) => t(C, e)
|
|
89
93
|
},
|
|
90
|
-
consultations:
|
|
91
|
-
consultationSession:
|
|
94
|
+
consultations: z(t),
|
|
95
|
+
consultationSession: j(t),
|
|
92
96
|
executeGraphQL: t
|
|
93
97
|
};
|
|
94
98
|
}
|
|
95
99
|
export {
|
|
96
|
-
|
|
100
|
+
ne as createKbClient
|
|
97
101
|
};
|
package/dist/core/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type { KbClient } from './client.js';
|
|
|
9
9
|
export { createKbClient } from './client.js';
|
|
10
10
|
export type { NavNode, NavNodeType, NavBadge, NavGroupLink, NavNextPrev, FlatNavNode } from './navigation.js';
|
|
11
11
|
export { navWalk, findNavNode, navBreadcrumbs, navSiblings, navSubtree, navNextPrev, isNavigable, flattenNav, } from './navigation.js';
|
|
12
|
+
export type { StyleLayer, StyleLayerMatch } from './style-layers.js';
|
|
13
|
+
export { LAYER_SCOPE_TOKEN, parseStyleLayers, sortStyleLayers, layerMatches, matchLayers, mergePinnedLayers, layerScope, applyLayerScope, layerStyleText, } from './style-layers.js';
|
|
12
14
|
export type { AuthManager } from './auth.js';
|
|
13
15
|
export { createAuthManager, createMemoryTokenStorage, createLocalStorageTokenStorage, decodeJwtUser, hasAccessLevel, } from './auth.js';
|
|
14
16
|
export { createDelegatedTokenMinter, DelegatedTokenError, } from './delegated-identity.js';
|