@abraca/dabra 2.80.0 → 2.81.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
@@ -555,8 +555,8 @@ declare class AbracadabraClient {
555
555
  id?: string;
556
556
  label?: string;
557
557
  description?: string;
558
- kind?: string;
559
- public_access?: "none" | "observer" | "viewer" | "editor";
558
+ kind?: string; /** See {@link AbracadabraClient.setDocumentAccess} for what each value means. */
559
+ public_access?: "none" | "private" | "observer" | "viewer" | "editor";
560
560
  }): Promise<DocumentMeta>;
561
561
  /** Get document metadata. */
562
562
  getDoc(docId: string): Promise<DocumentMeta>;
@@ -720,8 +720,27 @@ declare class AbracadabraClient {
720
720
  revokeInvite(code: string): Promise<void>;
721
721
  /** Redeem an invite code for the currently authenticated user. */
722
722
  redeemInvite(code: string): Promise<void>;
723
- /** Set the public_access level for a document. Pass null to inherit from parent. */
724
- setDocumentAccess(docId: string, publicAccess: string | null): Promise<void>;
723
+ /**
724
+ * Set the public_access level for a document. Pass null to inherit from parent.
725
+ *
726
+ * The values, and the two that are easy to confuse:
727
+ *
728
+ * - `"observer"` / `"viewer"` / `"editor"` — a FLOOR. Raises whoever reaches
729
+ * this document to at least that role, cascading to descendants.
730
+ * - `"none"` — no floor from here. Blocks anonymous, but an authenticated
731
+ * principal still falls through to the server's `[access].authenticated`
732
+ * default, so on a server with a floor this does NOT make a document private.
733
+ * - `"private"` — no floor AND no ambient default. Only explicit grants,
734
+ * ownership, Admin and Service reach a sealed document. This is what makes
735
+ * a document private without reconfiguring the whole server.
736
+ *
737
+ * The cascade takes the NEAREST ancestor that sets a value, not the strongest,
738
+ * so a descendant can re-publish itself out of a private parent.
739
+ *
740
+ * `"private"` requires server ≥ the release that introduced it. An older
741
+ * server rejects it with 400 rather than silently storing it.
742
+ */
743
+ setDocumentAccess(docId: string, publicAccess: "none" | "private" | "observer" | "viewer" | "editor" | null): Promise<void>;
725
744
  /** Get the public_access info for a document. */
726
745
  getDocumentAccess(docId: string): Promise<{
727
746
  public_access: string | null;
@@ -794,10 +813,14 @@ declare class AbracadabraClient {
794
813
  * leak via a higher cascade grant.
795
814
  *
796
815
  * Note: when `[access].authenticated >= "viewer"` is set server-wide,
797
- * non-participants would still be able to *read* the DM via the
798
- * authenticated floor. That's the documented "private docs need
799
- * authenticated=none" caveat from REDESIGN.md §9 — operators wanting
800
- * sealed DMs configure the server accordingly.
816
+ * non-participants can still *read* the DM via the authenticated floor —
817
+ * `public_access = "none"` removes the floor but not the ambient default.
818
+ *
819
+ * Servers that support `public_access = "private"` can seal it properly:
820
+ * call `setDocumentAccess(dmId, "private")` after creating one. That is NOT
821
+ * done here, deliberately — this SDK talks to older servers too, and they
822
+ * reject the value with a 400. Callers that know their server version can
823
+ * opt in; a future major may make it the default.
801
824
  *
802
825
  * @param otherUserPk Base64url-encoded Ed25519 public key of the other party.
803
826
  * @returns The DM doc's id (existing or newly created).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "2.80.0",
3
+ "version": "2.81.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.80.0"
44
+ "@abraca/schema": "2.81.0"
45
45
  },
46
46
  "scripts": {
47
47
  "test": "node --no-warnings --conditions=source --experimental-transform-types --test 'tests/*.test.ts'"
@@ -615,7 +615,8 @@ export class AbracadabraClient {
615
615
  label?: string;
616
616
  description?: string;
617
617
  kind?: string;
618
- public_access?: "none" | "observer" | "viewer" | "editor";
618
+ /** See {@link AbracadabraClient.setDocumentAccess} for what each value means. */
619
+ public_access?: "none" | "private" | "observer" | "viewer" | "editor";
619
620
  }): Promise<DocumentMeta> {
620
621
  return this.request<DocumentMeta>("POST", "/docs", { body: opts ?? {} });
621
622
  }
@@ -1093,8 +1094,30 @@ export class AbracadabraClient {
1093
1094
 
1094
1095
  // ── Document Access & Discovery ──────────────────────────────────────────
1095
1096
 
1096
- /** Set the public_access level for a document. Pass null to inherit from parent. */
1097
- async setDocumentAccess(docId: string, publicAccess: string | null): Promise<void> {
1097
+ /**
1098
+ * Set the public_access level for a document. Pass null to inherit from parent.
1099
+ *
1100
+ * The values, and the two that are easy to confuse:
1101
+ *
1102
+ * - `"observer"` / `"viewer"` / `"editor"` — a FLOOR. Raises whoever reaches
1103
+ * this document to at least that role, cascading to descendants.
1104
+ * - `"none"` — no floor from here. Blocks anonymous, but an authenticated
1105
+ * principal still falls through to the server's `[access].authenticated`
1106
+ * default, so on a server with a floor this does NOT make a document private.
1107
+ * - `"private"` — no floor AND no ambient default. Only explicit grants,
1108
+ * ownership, Admin and Service reach a sealed document. This is what makes
1109
+ * a document private without reconfiguring the whole server.
1110
+ *
1111
+ * The cascade takes the NEAREST ancestor that sets a value, not the strongest,
1112
+ * so a descendant can re-publish itself out of a private parent.
1113
+ *
1114
+ * `"private"` requires server ≥ the release that introduced it. An older
1115
+ * server rejects it with 400 rather than silently storing it.
1116
+ */
1117
+ async setDocumentAccess(
1118
+ docId: string,
1119
+ publicAccess: "none" | "private" | "observer" | "viewer" | "editor" | null,
1120
+ ): Promise<void> {
1098
1121
  await this.request("PATCH", `/docs/${encodeURIComponent(docId)}/access`, {
1099
1122
  body: { public_access: publicAccess },
1100
1123
  });
@@ -1213,10 +1236,14 @@ export class AbracadabraClient {
1213
1236
  * leak via a higher cascade grant.
1214
1237
  *
1215
1238
  * Note: when `[access].authenticated >= "viewer"` is set server-wide,
1216
- * non-participants would still be able to *read* the DM via the
1217
- * authenticated floor. That's the documented "private docs need
1218
- * authenticated=none" caveat from REDESIGN.md §9 — operators wanting
1219
- * sealed DMs configure the server accordingly.
1239
+ * non-participants can still *read* the DM via the authenticated floor —
1240
+ * `public_access = "none"` removes the floor but not the ambient default.
1241
+ *
1242
+ * Servers that support `public_access = "private"` can seal it properly:
1243
+ * call `setDocumentAccess(dmId, "private")` after creating one. That is NOT
1244
+ * done here, deliberately — this SDK talks to older servers too, and they
1245
+ * reject the value with a 400. Callers that know their server version can
1246
+ * opt in; a future major may make it the default.
1220
1247
  *
1221
1248
  * @param otherUserPk Base64url-encoded Ed25519 public key of the other party.
1222
1249
  * @returns The DM doc's id (existing or newly created).