+16
-3
packages/consumer/mod.ts
+16
-3
packages/consumer/mod.ts
···
1
import { produceRequirements } from "@cistern/shared";
2
import { generateKeys } from "@cistern/crypto";
3
import { generateRandomName } from "@puregarlic/randimal";
4
-
import { is, parse } from "@atcute/lexicons";
5
import { JetstreamSubscription } from "@atcute/jetstream";
6
import type { Did } from "@atcute/lexicons/syntax";
7
import type { Client, CredentialManager } from "@atcute/client";
···
157
158
/**
159
* Deletes an item from the user's PDS by record key.
160
-
* @todo Delete item from PDS
161
*/
162
-
async deleteItem() {}
163
}
···
1
import { produceRequirements } from "@cistern/shared";
2
import { generateKeys } from "@cistern/crypto";
3
import { generateRandomName } from "@puregarlic/randimal";
4
+
import { is, parse, type RecordKey } from "@atcute/lexicons";
5
import { JetstreamSubscription } from "@atcute/jetstream";
6
import type { Did } from "@atcute/lexicons/syntax";
7
import type { Client, CredentialManager } from "@atcute/client";
···
157
158
/**
159
* Deletes an item from the user's PDS by record key.
160
*/
161
+
async deleteItem(key: RecordKey) {
162
+
const res = await this.rpc.post("com.atproto.repo.deleteRecord", {
163
+
input: {
164
+
collection: "app.cistern.lexicon.item",
165
+
repo: this.did,
166
+
rkey: key,
167
+
},
168
+
});
169
+
170
+
if (!res.ok) {
171
+
throw new Error(
172
+
`failed to delete item ${key}: ${res.status} ${res.data.error}`,
173
+
);
174
+
}
175
+
}
176
}