@abraca/dabra 2.6.0 → 2.7.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/index.d.ts CHANGED
@@ -4985,8 +4985,13 @@ declare class ContentManager {
4985
4985
  constructor(dm: DocumentManager);
4986
4986
  /**
4987
4987
  * Read document content as markdown.
4988
- * Returns the title extracted from the TipTap documentHeader, the markdown
4989
- * body, tree metadata, and immediate children.
4988
+ *
4989
+ * Returns the markdown body, tree-derived label/type/meta, and immediate
4990
+ * children. `title` mirrors `label` (the tree entry's display name) — it
4991
+ * is *not* derived from a TipTap `documentHeader`, and the markdown body
4992
+ * does NOT include YAML frontmatter. Callers that want frontmatter-style
4993
+ * round-tripping should serialise `meta`/`type` themselves on top of the
4994
+ * returned markdown.
4990
4995
  */
4991
4996
  read(docId: string): Promise<DocumentContent>;
4992
4997
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -41,7 +41,7 @@
41
41
  "yjs": "^13.6.8"
42
42
  },
43
43
  "devDependencies": {
44
- "@abraca/schema": "2.6.0"
44
+ "@abraca/schema": "2.7.0"
45
45
  },
46
46
  "scripts": {
47
47
  "test": "node --no-warnings --conditions=source --experimental-transform-types --test 'tests/*.test.ts'"
@@ -14,6 +14,7 @@ import { StatelessMessage } from "./OutgoingMessages/StatelessMessage.ts";
14
14
  import { RpcClient } from "./RpcClient.ts";
15
15
  import { QueryClient } from "./QueryClient.ts";
16
16
  import type { QuerySpec, QuerySubscriptionHandlers, QuerySubscriptionHandle } from "./QueryClient.ts";
17
+ import { QueryAwarenessMessage } from "./OutgoingMessages/QueryAwarenessMessage.ts";
17
18
  import { SyncStepOneMessage } from "./OutgoingMessages/SyncStepOneMessage.ts";
18
19
  import { UpdateMessage } from "./OutgoingMessages/UpdateMessage.ts";
19
20
  import type {
@@ -516,6 +517,20 @@ export class AbracadabraBaseProvider extends EventEmitter {
516
517
  documentName: this.configuration.name,
517
518
  });
518
519
  }
520
+
521
+ // Pull existing peers' awareness on (re)connect. The server keeps no
522
+ // awareness cache and never replays presence to a fresh joiner, so without
523
+ // this a late-joining client only learns about a peer once that peer next
524
+ // *changes* its own awareness — producing asymmetric presence ("A sees B
525
+ // but B can't see A"). The server re-broadcasts this query to all peers,
526
+ // who answer with their full state (MessageReceiver.applyQueryAwareness),
527
+ // and those replies fan back to us. Matches stock y-websocket on-open
528
+ // behaviour. Only meaningful when an awareness instance exists.
529
+ if (this.awareness) {
530
+ this.send(QueryAwarenessMessage, {
531
+ documentName: this.configuration.name,
532
+ });
533
+ }
519
534
  }
520
535
 
521
536
  send(message: ConstructableOutgoingMessage, args: any) {
@@ -44,8 +44,13 @@ export class ContentManager {
44
44
 
45
45
  /**
46
46
  * Read document content as markdown.
47
- * Returns the title extracted from the TipTap documentHeader, the markdown
48
- * body, tree metadata, and immediate children.
47
+ *
48
+ * Returns the markdown body, tree-derived label/type/meta, and immediate
49
+ * children. `title` mirrors `label` (the tree entry's display name) — it
50
+ * is *not* derived from a TipTap `documentHeader`, and the markdown body
51
+ * does NOT include YAML frontmatter. Callers that want frontmatter-style
52
+ * round-tripping should serialise `meta`/`type` themselves on top of the
53
+ * returned markdown.
49
54
  */
50
55
  async read(docId: string): Promise<DocumentContent> {
51
56
  const provider = await this.dm.getChildProvider(docId);
@@ -95,10 +100,7 @@ export class ContentManager {
95
100
  meta,
96
101
  }));
97
102
 
98
- // yjsToMarkdown returns a string and takes the resolved label/meta/type
99
- // so frontmatter round-trips. (Older code destructured an object and
100
- // passed only the fragment — that silently produced `undefined`.)
101
- const markdown = yjsToMarkdown(fragment, label, meta, type);
103
+ const { markdown } = yjsToMarkdown(fragment);
102
104
  const title = label;
103
105
 
104
106
  return { label, type, meta, title, markdown, children };