@blogmcp/sdk 0.9.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blogmcp/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Headless SDK for Knowledge Base blog — core client, Vue composables, Nuxt adapter",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -82,8 +82,8 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@blogmcp/mdx-schema": "^0.9.0",
86
- "@blogmcp/sanitize": "^0.9.0",
85
+ "@blogmcp/mdx-schema": "^0.9.1",
86
+ "@blogmcp/sanitize": "^0.9.1",
87
87
  "marked": "^15.0.7"
88
88
  },
89
89
  "optionalDependencies": {
@@ -85,6 +85,7 @@ export {
85
85
  isKnownNotificationCode,
86
86
  isCaseCategory,
87
87
  communityRulesOf,
88
+ communityLegalSectionsOf,
88
89
  } from './shapes'
89
90
  export type {
90
91
  KnownMessageState,
@@ -129,6 +130,7 @@ export type {
129
130
  ReportItem,
130
131
  CurrentLegalText,
131
132
  CommunityRule,
133
+ CommunityLegalSection,
132
134
  MemberExport,
133
135
  NoticeTarget,
134
136
  NoticeReceipt,
@@ -12,7 +12,11 @@
12
12
  * Browser-safe; readReceiptFromHash is the one function that touches `window` (on call, never on import).
13
13
  */
14
14
 
15
- /** The managed blog's community pages (router-relative; the blog prepends its own base). */
15
+ /**
16
+ * The managed blog's community pages (router-relative; the blog prepends its own base). The three legal pages —
17
+ * `rules`, `terms`, `privacy` — are each the tenant's current `legal/current` text of that kind, rendered by the blog's
18
+ * server without JavaScript, with `/community/<kind>.json` as the machine-readable alternate (DSA art. 14(1)).
19
+ */
16
20
  export const COMMUNITY_ROUTES = Object.freeze({
17
21
  /** The „Moje komunita" panel. */
18
22
  myCommunity: '/community',
@@ -24,6 +28,10 @@ export const COMMUNITY_ROUTES = Object.freeze({
24
28
  notices: '/community/notices',
25
29
  /** The rules, rendered on the server without JavaScript. */
26
30
  rules: '/community/rules',
31
+ /** The discussion terms (DSA art. 14), rendered on the server without JavaScript, as the rules. */
32
+ terms: '/community/terms',
33
+ /** The discussion privacy notice, rendered the same way. */
34
+ privacy: '/community/privacy',
27
35
  } as const)
28
36
 
29
37
  /** A decision's id (kb-api's UUIDs). */
@@ -366,7 +366,10 @@ export interface CurrentLegalText {
366
366
  * An element renders text only: it shows `communityRulesOf(bodyJson)` and links to that page.
367
367
  */
368
368
  readonly body: string
369
- /** The machine-readable form (DSA art. 14(1)); for `rules` `{ version, rules: [{ id, title, summary?, anchor }] }`. */
369
+ /**
370
+ * The machine-readable form (DSA art. 14(1)); for `rules` `{ version, rules: [{ id, title, summary?, anchor }] }`
371
+ * (communityRulesOf), for `terms` and `privacy` `{ sections: [{ id, title, anchor }] }` (communityLegalSectionsOf).
372
+ */
370
373
  readonly bodyJson: Readonly<Record<string, unknown>> | null
371
374
  readonly reconsentRequired: boolean
372
375
  readonly publishedAt: string | null
@@ -395,6 +398,31 @@ export function communityRulesOf(bodyJson: unknown): CommunityRule[] {
395
398
  return out
396
399
  }
397
400
 
401
+ /** One section of a `terms` or `privacy` text: what the page's contents list and link. */
402
+ export interface CommunityLegalSection {
403
+ readonly id: string
404
+ readonly title: string
405
+ /** The section's anchor on the page (`#<anchor>`). */
406
+ readonly anchor: string
407
+ }
408
+
409
+ /**
410
+ * The sections of a `terms` or `privacy` text's `bodyJson` (`{ sections: [{ id, title, anchor }] }`), in order; an
411
+ * entry without a string id, title and anchor is skipped. A `rules` text has none (its rules are communityRulesOf).
412
+ */
413
+ export function communityLegalSectionsOf(bodyJson: unknown): CommunityLegalSection[] {
414
+ const sections = typeof bodyJson === 'object' && bodyJson !== null ? (bodyJson as { sections?: unknown }).sections : undefined
415
+ if (!Array.isArray(sections)) return []
416
+ const out: CommunityLegalSection[] = []
417
+ for (const s of sections) {
418
+ if (typeof s !== 'object' || s === null) continue
419
+ const { id, title, anchor } = s as Record<string, unknown>
420
+ if (typeof id !== 'string' || typeof title !== 'string' || typeof anchor !== 'string') continue
421
+ out.push(Object.freeze({ id, title, anchor }))
422
+ }
423
+ return out
424
+ }
425
+
398
426
  /** `me/export`: every section, `providerEntity` on every row; offer it as a JSON download. */
399
427
  export interface MemberExport {
400
428
  readonly generatedAt: string