@ascorbic/pds 0.2.0 → 0.2.1
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/cli.js +25 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -981,6 +981,21 @@ var PDSClient = class {
|
|
|
981
981
|
return this.xrpc("GET", "com.atproto.sync.listBlobs", { params });
|
|
982
982
|
}
|
|
983
983
|
/**
|
|
984
|
+
* Get user preferences
|
|
985
|
+
*/
|
|
986
|
+
async getPreferences() {
|
|
987
|
+
return (await this.xrpc("GET", "app.bsky.actor.getPreferences", { auth: true })).preferences;
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Update user preferences
|
|
991
|
+
*/
|
|
992
|
+
async putPreferences(preferences) {
|
|
993
|
+
await this.xrpc("POST", "app.bsky.actor.putPreferences", {
|
|
994
|
+
body: { preferences },
|
|
995
|
+
auth: true
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
984
999
|
* Get account status including migration progress
|
|
985
1000
|
*/
|
|
986
1001
|
async getAccountStatus() {
|
|
@@ -1347,6 +1362,16 @@ const migrateCommand = defineCommand({
|
|
|
1347
1362
|
}
|
|
1348
1363
|
status = await targetClient.getAccountStatus();
|
|
1349
1364
|
}
|
|
1365
|
+
spinner.start("Migrating your preferences...");
|
|
1366
|
+
try {
|
|
1367
|
+
const preferences = await sourceClient.getPreferences();
|
|
1368
|
+
if (preferences.length > 0) {
|
|
1369
|
+
await targetClient.putPreferences(preferences);
|
|
1370
|
+
spinner.stop(`Migrated ${preferences.length} preference${preferences.length === 1 ? "" : "s"}`);
|
|
1371
|
+
} else spinner.stop("No preferences to migrate");
|
|
1372
|
+
} catch (err) {
|
|
1373
|
+
spinner.stop("Skipped preferences (not available)");
|
|
1374
|
+
}
|
|
1350
1375
|
if (status.expectedBlobs - status.importedBlobs > 0) {
|
|
1351
1376
|
let synced = 0;
|
|
1352
1377
|
let totalBlobs = 0;
|
package/dist/index.js
CHANGED