@lichen-wiki/client 0.2.0 → 0.3.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/writes.d.ts CHANGED
@@ -51,6 +51,12 @@ export type MembershipRecordFields = Omit<WikiLichenMembership.Main, "$type" | "
51
51
  role: MemberRole;
52
52
  };
53
53
  export declare function membershipWrite(repo: Did, rkey: string, membership: MembershipRecordFields): RecordWrite;
54
+ /** A wiki and its owner's admin grant, which a client publishes in one commit. */
55
+ export interface NewWikiWrites {
56
+ wiki: RecordWrite;
57
+ grant: RecordWrite;
58
+ }
59
+ export declare function newWikiWrites(repo: Did, slug: string, wiki: WikiRecordFields): NewWikiWrites;
54
60
  export type BookmarkRecordFields = Pick<CommunityLexiconBookmarksBookmark.Main, "subject" | "createdAt">;
55
61
  export declare function bookmarkWrite(repo: Did, rkey: string, bookmark: BookmarkRecordFields): RecordWrite;
56
62
  export {};
package/dist/writes.js CHANGED
@@ -110,6 +110,18 @@ export function membershipWrite(repo, rkey, membership) {
110
110
  createdAt: membership.createdAt,
111
111
  });
112
112
  }
113
+ export function newWikiWrites(repo, slug, wiki) {
114
+ const record = wikiWrite(repo, slug, wiki);
115
+ return {
116
+ wiki: record,
117
+ grant: membershipWrite(repo, TID.now(), {
118
+ memberDid: repo,
119
+ wikiRef: record.uri,
120
+ role: "admin",
121
+ createdAt: wiki.createdAt,
122
+ }),
123
+ };
124
+ }
113
125
  export function bookmarkWrite(repo, rkey, bookmark) {
114
126
  return recordWrite(repo, rkey, {
115
127
  $type: COLLECTIONS.bookmark,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lichen-wiki/client",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Read and write Lichen wikis on AT Protocol: record types and limits, validation, slugs and PDS writes.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "diff-match-patch": "^1.0.5"
37
37
  },
38
38
  "devDependencies": {
39
- "@atcute/atproto": "^4.0.4",
39
+ "@atcute/atproto": "^4.0.5",
40
40
  "@types/diff-match-patch": "^1.0.36"
41
41
  }
42
42
  }