@atproto/ozone 0.0.17-next.1 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atproto/ozone
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`971d3e4c2`](https://github.com/bluesky-social/atproto/commit/971d3e4c26ecfda746e83d458391715752ea7064) Thanks [@devinivy](https://github.com/devinivy)! - Resign labels on overwrite, omit neg:false on labels
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`219480764`](https://github.com/bluesky-social/atproto/commit/2194807644cbdb0021e867437693300c1b0e55f5)]:
12
+ - @atproto/api@0.11.1
13
+
14
+ ## 0.0.17
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`4eaadc0ac`](https://github.com/bluesky-social/atproto/commit/4eaadc0acb6b73b9745dd7a2b929d02e58083ab0), [`4eaadc0ac`](https://github.com/bluesky-social/atproto/commit/4eaadc0acb6b73b9745dd7a2b929d02e58083ab0)]:
19
+ - @atproto/identity@0.3.3
20
+ - @atproto/api@0.11.0
21
+ - @atproto/common@0.3.4
22
+ - @atproto/lexicon@0.3.3
23
+ - @atproto/syntax@0.2.1
24
+ - @atproto/crypto@0.3.0
25
+ - @atproto/xrpc-server@0.4.4
26
+
3
27
  ## 0.0.16
4
28
 
5
29
  ### Patch Changes
package/dist/index.js CHANGED
@@ -104377,6 +104377,11 @@ var schemaDict = {
104377
104377
  description: "URLs of service policy documents.",
104378
104378
  ref: "lex:com.atproto.server.describeServer#links"
104379
104379
  },
104380
+ contact: {
104381
+ type: "ref",
104382
+ description: "Contact information",
104383
+ ref: "lex:com.atproto.server.describeServer#contact"
104384
+ },
104380
104385
  did: {
104381
104386
  type: "string",
104382
104387
  format: "did"
@@ -104395,6 +104400,14 @@ var schemaDict = {
104395
104400
  type: "string"
104396
104401
  }
104397
104402
  }
104403
+ },
104404
+ contact: {
104405
+ type: "object",
104406
+ properties: {
104407
+ email: {
104408
+ type: "string"
104409
+ }
104410
+ }
104398
104411
  }
104399
104412
  }
104400
104413
  },
@@ -119338,27 +119351,19 @@ function subscribeLabels_default(server, ctx) {
119338
119351
  }
119339
119352
  }
119340
119353
  for await (const evt of outbox.events(cursor, signal)) {
119341
- yield { $type: "com.atproto.label.subscribeLabels#labels", ...evt };
119354
+ yield { $type: "#labels", ...evt };
119342
119355
  }
119343
119356
  });
119344
119357
  }
119345
119358
 
119346
- // src/mod-service/types.ts
119347
- var UNSPECCED_TAKEDOWN_LABEL = "!unspecced-takedown";
119348
- var UNSPECCED_TAKEDOWN_BLOBS_LABEL = "!unspecced-takedown-blobs";
119349
-
119350
119359
  // src/api/label/fetchLabels.ts
119351
119360
  function fetchLabels_default(server, ctx) {
119352
119361
  server.com.atproto.temp.fetchLabels({
119353
119362
  auth: ctx.authVerifier.standardOptionalOrAdminToken,
119354
- handler: async ({ auth, params: params2 }) => {
119363
+ handler: async ({ params: params2 }) => {
119355
119364
  const { limit } = params2;
119356
119365
  const since = params2.since !== void 0 ? new Date(params2.since).toISOString() : "";
119357
- const includeUnspeccedTakedowns = auth.credentials.type === "none" ? false : auth.credentials.isAdmin;
119358
- const labelRes = await ctx.db.db.selectFrom("label").selectAll().orderBy("label.cts", "asc").where("cts", ">", since).if(!includeUnspeccedTakedowns, (q) => q.where("label.val", "not in", [
119359
- UNSPECCED_TAKEDOWN_LABEL,
119360
- UNSPECCED_TAKEDOWN_BLOBS_LABEL
119361
- ])).limit(limit).execute();
119366
+ const labelRes = await ctx.db.db.selectFrom("label").selectAll().orderBy("label.cts", "asc").where("cts", ">", since).limit(limit).execute();
119362
119367
  const modSrvc = ctx.modService(ctx.db);
119363
119368
  const labels = await Promise.all(labelRes.map((l) => modSrvc.views.formatLabelAndEnsureSig(l)));
119364
119369
  return {
@@ -122988,6 +122993,11 @@ var schemaDict2 = {
122988
122993
  description: "URLs of service policy documents.",
122989
122994
  ref: "lex:com.atproto.server.describeServer#links"
122990
122995
  },
122996
+ contact: {
122997
+ type: "ref",
122998
+ description: "Contact information",
122999
+ ref: "lex:com.atproto.server.describeServer#contact"
123000
+ },
122991
123001
  did: {
122992
123002
  type: "string",
122993
123003
  format: "did"
@@ -123006,6 +123016,14 @@ var schemaDict2 = {
123006
123016
  type: "string"
123007
123017
  }
123008
123018
  }
123019
+ },
123020
+ contact: {
123021
+ type: "object",
123022
+ properties: {
123023
+ email: {
123024
+ type: "string"
123025
+ }
123026
+ }
123009
123027
  }
123010
123028
  }
123011
123029
  },
@@ -131932,6 +131950,7 @@ var _AtpAgent = class {
131932
131950
  inst.labelersHeader = this.labelersHeader;
131933
131951
  inst.proxyHeader = this.proxyHeader;
131934
131952
  inst.pdsUrl = this.pdsUrl;
131953
+ inst.api.xrpc.uri = this.pdsUrl || this.service;
131935
131954
  }
131936
131955
  withProxy(serviceType, did2) {
131937
131956
  const inst = this.clone();
@@ -132415,7 +132434,7 @@ var formatLabel = (row) => {
132415
132434
  uri: row.uri,
132416
132435
  cid: row.cid === "" ? void 0 : row.cid,
132417
132436
  val: row.val,
132418
- neg: row.neg,
132437
+ neg: row.neg === true ? true : void 0,
132419
132438
  cts: row.cts,
132420
132439
  exp: row.exp ?? void 0,
132421
132440
  sig: row.sig ? new Uint8Array(row.sig) : void 0
@@ -132860,7 +132879,7 @@ function getSelfLabels(details) {
132860
132879
  const src3 = new AtUri(uri2).host;
132861
132880
  const cts = typeof record.createdAt === "string" ? normalizeDatetimeAlways(record.createdAt) : new Date(0).toISOString();
132862
132881
  return record.labels.values.map(({ val }) => {
132863
- return { src: src3, uri: uri2, cid: cid2, val, cts, neg: false };
132882
+ return { src: src3, uri: uri2, cid: cid2, val, cts };
132864
132883
  });
132865
132884
  }
132866
132885
 
@@ -133435,8 +133454,9 @@ var ModerationService = class {
133435
133454
  attempts: 0,
133436
133455
  lastAttempted: null
133437
133456
  })).returning("id").execute();
133457
+ const takedownLabel = isSuspend ? SUSPEND_LABEL : TAKEDOWN_LABEL;
133438
133458
  await this.formatAndCreateLabels(subject.did, null, {
133439
- create: [UNSPECCED_TAKEDOWN_LABEL]
133459
+ create: [takedownLabel]
133440
133460
  });
133441
133461
  this.db.onCommit(() => {
133442
133462
  this.backgroundQueue.add(async () => {
@@ -133451,8 +133471,10 @@ var ModerationService = class {
133451
133471
  attempts: 0,
133452
133472
  lastAttempted: null
133453
133473
  }).returning("id").execute();
133474
+ const existingTakedownLabels = await this.db.db.selectFrom("label").where("label.uri", "=", subject.did).where("label.val", "in", [TAKEDOWN_LABEL, SUSPEND_LABEL]).where("neg", "=", false).selectAll().execute();
133475
+ const takedownVals = existingTakedownLabels.map((row) => row.val);
133454
133476
  await this.formatAndCreateLabels(subject.did, null, {
133455
- negate: [UNSPECCED_TAKEDOWN_LABEL]
133477
+ negate: takedownVals
133456
133478
  });
133457
133479
  this.db.onCommit(() => {
133458
133480
  this.backgroundQueue.add(async () => {
@@ -133462,33 +133484,11 @@ var ModerationService = class {
133462
133484
  }
133463
133485
  async takedownRecord(subject, takedownId) {
133464
133486
  this.db.assertTransaction();
133465
- const takedownRef = `BSKY-TAKEDOWN-${takedownId}`;
133466
- const values = this.eventPusher.takedowns.map((eventType) => ({
133467
- eventType,
133468
- subjectDid: subject.did,
133469
- subjectUri: subject.uri,
133470
- subjectCid: subject.cid,
133471
- takedownRef
133472
- }));
133473
- const blobCids = subject.blobCids;
133474
- const labels = [UNSPECCED_TAKEDOWN_LABEL];
133475
- if (blobCids && blobCids.length > 0) {
133476
- labels.push(UNSPECCED_TAKEDOWN_BLOBS_LABEL);
133477
- }
133478
- const recordEvts = await this.db.db.insertInto("record_push_event").values(values).onConflict((oc) => oc.columns(["subjectUri", "eventType"]).doUpdateSet({
133479
- takedownRef,
133480
- confirmedAt: null,
133481
- attempts: 0,
133482
- lastAttempted: null
133483
- })).returning("id").execute();
133484
133487
  await this.formatAndCreateLabels(subject.uri, subject.cid, {
133485
- create: labels
133486
- });
133487
- this.db.onCommit(() => {
133488
- this.backgroundQueue.add(async () => {
133489
- await Promise.all(recordEvts.map((evt) => this.eventPusher.attemptRecordEvent(evt.id)));
133490
- });
133488
+ create: [TAKEDOWN_LABEL]
133491
133489
  });
133490
+ const takedownRef = `BSKY-TAKEDOWN-${takedownId}`;
133491
+ const blobCids = subject.blobCids;
133492
133492
  if (blobCids && blobCids.length > 0) {
133493
133493
  const blobValues = [];
133494
133494
  for (const eventType of this.eventPusher.takedowns) {
@@ -133518,24 +133518,10 @@ var ModerationService = class {
133518
133518
  }
133519
133519
  async reverseTakedownRecord(subject) {
133520
133520
  this.db.assertTransaction();
133521
- const labels = [UNSPECCED_TAKEDOWN_LABEL];
133522
- const blobCids = subject.blobCids;
133523
- if (blobCids && blobCids.length > 0) {
133524
- labels.push(UNSPECCED_TAKEDOWN_BLOBS_LABEL);
133525
- }
133526
- const recordEvts = await this.db.db.updateTable("record_push_event").where("eventType", "in", TAKEDOWNS).where("subjectDid", "=", subject.did).where("subjectUri", "=", subject.uri).set({
133527
- takedownRef: null,
133528
- confirmedAt: null,
133529
- attempts: 0,
133530
- lastAttempted: null
133531
- }).returning("id").execute();
133532
133521
  await this.formatAndCreateLabels(subject.uri, subject.cid, {
133533
- negate: labels
133534
- }), this.db.onCommit(() => {
133535
- this.backgroundQueue.add(async () => {
133536
- await Promise.all(recordEvts.map((evt) => this.eventPusher.attemptRecordEvent(evt.id)));
133537
- });
133522
+ negate: [TAKEDOWN_LABEL]
133538
133523
  });
133524
+ const blobCids = subject.blobCids;
133539
133525
  if (blobCids && blobCids.length > 0) {
133540
133526
  const blobEvts = await this.db.db.updateTable("blob_push_event").where("eventType", "in", TAKEDOWNS).where("subjectDid", "=", subject.did).where("subjectBlobCid", "in", blobCids.map((c) => c.toString())).set({
133541
133527
  takedownRef: null,
@@ -133687,7 +133673,10 @@ var ModerationService = class {
133687
133673
  const res = await this.db.db.insertInto("label").values(dbVals).onConflict((oc) => oc.columns(["src", "uri", "cid", "val"]).doUpdateSet({
133688
133674
  id: sql`${excluded("id")}`,
133689
133675
  neg: sql`${excluded("neg")}`,
133690
- cts: sql`${excluded("cts")}`
133676
+ cts: sql`${excluded("cts")}`,
133677
+ exp: sql`${excluded("exp")}`,
133678
+ sig: sql`${excluded("sig")}`,
133679
+ signingKeyId: sql`${excluded("signingKeyId")}`
133691
133680
  })).returningAll().execute();
133692
133681
  return res.map((row) => formatLabel(row));
133693
133682
  }
@@ -133727,6 +133716,8 @@ var isSafeUrl = (url) => {
133727
133716
  return true;
133728
133717
  };
133729
133718
  var TAKEDOWNS = ["pds_takedown", "appview_takedown"];
133719
+ var TAKEDOWN_LABEL = "!takedown";
133720
+ var SUSPEND_LABEL = "!suspend";
133730
133721
 
133731
133722
  // src/background.ts
133732
133723
  var import_p_queue = __toESM(require_dist5());