···12import * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
13import * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
14import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
015import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
16import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
17import * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
···34export * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
35export * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
36export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
037export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
38export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
39export * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
···89 publication: PublicationRecord
90 blocks: PubLeafletBlocksNS
91 pages: PubLeafletPagesNS
092 richtext: PubLeafletRichtextNS
9394 constructor(client: XrpcClient) {
95 this._client = client
96 this.blocks = new PubLeafletBlocksNS(client)
97 this.pages = new PubLeafletPagesNS(client)
098 this.richtext = new PubLeafletRichtextNS(client)
99 this.document = new DocumentRecord(client)
100 this.publication = new PublicationRecord(client)
···114115 constructor(client: XrpcClient) {
116 this._client = client
000000000000000000000000000000000000000000000000000000000000000000000000000117 }
118}
119
···12import * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
13import * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
14import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
15+import * as PubLeafletPublicationSubscription from './types/pub/leaflet/publication/subscription'
16import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
17import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
18import * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
···35export * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
36export * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
37export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
38+export * as PubLeafletPublicationSubscription from './types/pub/leaflet/publication/subscription'
39export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
40export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
41export * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
···91 publication: PublicationRecord
92 blocks: PubLeafletBlocksNS
93 pages: PubLeafletPagesNS
94+ publication: PubLeafletPublicationNS
95 richtext: PubLeafletRichtextNS
9697 constructor(client: XrpcClient) {
98 this._client = client
99 this.blocks = new PubLeafletBlocksNS(client)
100 this.pages = new PubLeafletPagesNS(client)
101+ this.publication = new PubLeafletPublicationNS(client)
102 this.richtext = new PubLeafletRichtextNS(client)
103 this.document = new DocumentRecord(client)
104 this.publication = new PublicationRecord(client)
···118119 constructor(client: XrpcClient) {
120 this._client = client
121+ }
122+}
123+124+export class PubLeafletPublicationNS {
125+ _client: XrpcClient
126+ subscription: SubscriptionRecord
127+128+ constructor(client: XrpcClient) {
129+ this._client = client
130+ this.subscription = new SubscriptionRecord(client)
131+ }
132+}
133+134+export class SubscriptionRecord {
135+ _client: XrpcClient
136+137+ constructor(client: XrpcClient) {
138+ this._client = client
139+ }
140+141+ async list(
142+ params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
143+ ): Promise<{
144+ cursor?: string
145+ records: { uri: string; value: PubLeafletPublicationSubscription.Record }[]
146+ }> {
147+ const res = await this._client.call('com.atproto.repo.listRecords', {
148+ collection: 'pub.leaflet.publication.subscription',
149+ ...params,
150+ })
151+ return res.data
152+ }
153+154+ async get(
155+ params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
156+ ): Promise<{
157+ uri: string
158+ cid: string
159+ value: PubLeafletPublicationSubscription.Record
160+ }> {
161+ const res = await this._client.call('com.atproto.repo.getRecord', {
162+ collection: 'pub.leaflet.publication.subscription',
163+ ...params,
164+ })
165+ return res.data
166+ }
167+168+ async create(
169+ params: OmitKey<
170+ ComAtprotoRepoCreateRecord.InputSchema,
171+ 'collection' | 'record'
172+ >,
173+ record: Un$Typed<PubLeafletPublicationSubscription.Record>,
174+ headers?: Record<string, string>,
175+ ): Promise<{ uri: string; cid: string }> {
176+ const collection = 'pub.leaflet.publication.subscription'
177+ const res = await this._client.call(
178+ 'com.atproto.repo.createRecord',
179+ undefined,
180+ { collection, ...params, record: { ...record, $type: collection } },
181+ { encoding: 'application/json', headers },
182+ )
183+ return res.data
184+ }
185+186+ async delete(
187+ params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
188+ headers?: Record<string, string>,
189+ ): Promise<void> {
190+ await this._client.call(
191+ 'com.atproto.repo.deleteRecord',
192+ undefined,
193+ { collection: 'pub.leaflet.publication.subscription', ...params },
194+ { headers },
195+ )
196 }
197}
198
···1+create table "public"."publication_subscriptions" (
2+ "publication" text not null,
3+ "identity" text not null,
4+ "created_at" timestamp with time zone not null default now(),
5+ "record" jsonb not null,
6+ "uri" text
7+);
8+9+10+alter table "public"."publication_subscriptions" enable row level security;
11+12+CREATE UNIQUE INDEX publication_subscriptions_pkey ON public.publication_subscriptions USING btree (publication, identity);
13+14+CREATE UNIQUE INDEX publication_subscriptions_uri_key ON public.publication_subscriptions USING btree (uri);
15+16+alter table "public"."publication_subscriptions" add constraint "publication_subscriptions_pkey" PRIMARY KEY using index "publication_subscriptions_pkey";
17+18+alter table "public"."publication_subscriptions" add constraint "publication_subscriptions_publication_fkey" FOREIGN KEY (publication) REFERENCES publications(uri) ON DELETE CASCADE not valid;
19+20+alter table "public"."publication_subscriptions" validate constraint "publication_subscriptions_publication_fkey";
21+22+alter table "public"."publication_subscriptions" add constraint "publication_subscriptions_uri_key" UNIQUE using index "publication_subscriptions_uri_key";
23+24+grant delete on table "public"."publication_subscriptions" to "anon";
25+26+grant insert on table "public"."publication_subscriptions" to "anon";
27+28+grant references on table "public"."publication_subscriptions" to "anon";
29+30+grant select on table "public"."publication_subscriptions" to "anon";
31+32+grant trigger on table "public"."publication_subscriptions" to "anon";
33+34+grant truncate on table "public"."publication_subscriptions" to "anon";
35+36+grant update on table "public"."publication_subscriptions" to "anon";
37+38+grant delete on table "public"."publication_subscriptions" to "authenticated";
39+40+grant insert on table "public"."publication_subscriptions" to "authenticated";
41+42+grant references on table "public"."publication_subscriptions" to "authenticated";
43+44+grant select on table "public"."publication_subscriptions" to "authenticated";
45+46+grant trigger on table "public"."publication_subscriptions" to "authenticated";
47+48+grant truncate on table "public"."publication_subscriptions" to "authenticated";
49+50+grant update on table "public"."publication_subscriptions" to "authenticated";
51+52+grant delete on table "public"."publication_subscriptions" to "service_role";
53+54+grant insert on table "public"."publication_subscriptions" to "service_role";
55+56+grant references on table "public"."publication_subscriptions" to "service_role";
57+58+grant select on table "public"."publication_subscriptions" to "service_role";
59+60+grant trigger on table "public"."publication_subscriptions" to "service_role";
61+62+grant truncate on table "public"."publication_subscriptions" to "service_role";
63+64+grant update on table "public"."publication_subscriptions" to "service_role";