Skip to content

Commit

Permalink
add ver to labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Mar 8, 2024
1 parent 9623e50 commit 06c79c0
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lexicons/com/atproto/label/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"description": "Metadata tag on an atproto resource (eg, repo or record).",
"required": ["src", "uri", "val", "cts"],
"properties": {
"ver": {
"type": "integer",
"description": "The AT Protocol version of the label object."
},
"src": {
"type": "string",
"format": "did",
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,10 @@ export const schemaDict = {
'Metadata tag on an atproto resource (eg, repo or record).',
required: ['src', 'uri', 'val', 'cts'],
properties: {
ver: {
type: 'integer',
description: 'The AT Protocol version of the label object.',
},
src: {
type: 'string',
format: 'did',
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/client/types/com/atproto/label/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { CID } from 'multiformats/cid'

/** Metadata tag on an atproto resource (eg, repo or record). */
export interface Label {
/** The AT Protocol version of the label object. */
ver?: number
/** DID of the actor who created this label. */
src: string
/** AT URI of the record, repository (account), or other resource that this label applies to. */
Expand Down
4 changes: 4 additions & 0 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,10 @@ export const schemaDict = {
'Metadata tag on an atproto resource (eg, repo or record).',
required: ['src', 'uri', 'val', 'cts'],
properties: {
ver: {
type: 'integer',
description: 'The AT Protocol version of the label object.',
},
src: {
type: 'string',
format: 'did',
Expand Down
2 changes: 2 additions & 0 deletions packages/bsky/src/lexicon/types/com/atproto/label/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { CID } from 'multiformats/cid'

/** Metadata tag on an atproto resource (eg, repo or record). */
export interface Label {
/** The AT Protocol version of the label object. */
ver?: number
/** DID of the actor who created this label. */
src: string
/** AT URI of the record, repository (account), or other resource that this label applies to. */
Expand Down
4 changes: 4 additions & 0 deletions packages/ozone/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,10 @@ export const schemaDict = {
'Metadata tag on an atproto resource (eg, repo or record).',
required: ['src', 'uri', 'val', 'cts'],
properties: {
ver: {
type: 'integer',
description: 'The AT Protocol version of the label object.',
},
src: {
type: 'string',
format: 'did',
Expand Down
2 changes: 2 additions & 0 deletions packages/ozone/src/lexicon/types/com/atproto/label/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { CID } from 'multiformats/cid'

/** Metadata tag on an atproto resource (eg, repo or record). */
export interface Label {
/** The AT Protocol version of the label object. */
ver?: number
/** DID of the actor who created this label. */
src: string
/** AT URI of the record, repository (account), or other resource that this label applies to. */
Expand Down
4 changes: 3 additions & 1 deletion packages/ozone/src/mod-service/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type SignedLabel = Label & { sig: Uint8Array }

export const formatLabel = (row: LabelRow): Label => {
return noUndefinedVals({
ver: 1,
src: row.src,
uri: row.uri,
cid: row.cid === '' ? undefined : row.cid,
Expand Down Expand Up @@ -37,8 +38,9 @@ export const signLabel = async (
label: Label,
signingKey: Keypair,
): Promise<SignedLabel> => {
const { src, uri, cid, val, neg, cts } = label
const { ver, src, uri, cid, val, neg, cts } = label
const reformatted = noUndefinedVals({
ver: ver ?? 1,
src,
uri,
cid,
Expand Down
2 changes: 2 additions & 0 deletions packages/ozone/tests/__snapshots__/get-record.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Object {
"src": "user(2)",
"uri": "record(0)",
"val": "!unspecced-takedown",
"ver": 1,
},
Object {
"cid": "cids(0)",
Expand Down Expand Up @@ -117,6 +118,7 @@ Object {
"src": "user(2)",
"uri": "record(0)",
"val": "!unspecced-takedown",
"ver": 1,
},
Object {
"cid": "cids(0)",
Expand Down
1 change: 1 addition & 0 deletions packages/ozone/tests/__snapshots__/get-repo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Object {
"src": "user(2)",
"uri": "user(0)",
"val": "!unspecced-takedown",
"ver": 1,
},
],
"moderation": Object {
Expand Down
2 changes: 1 addition & 1 deletion packages/ozone/tests/sequencer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('sequencer', () => {
}

const evtToDbRow = (e: LabelsEvt) => {
const label = e.labels[0]
const { ver: _, ...label } = e.labels[0]
return {
id: e.seq,
...label,
Expand Down
4 changes: 4 additions & 0 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,10 @@ export const schemaDict = {
'Metadata tag on an atproto resource (eg, repo or record).',
required: ['src', 'uri', 'val', 'cts'],
properties: {
ver: {
type: 'integer',
description: 'The AT Protocol version of the label object.',
},
src: {
type: 'string',
format: 'did',
Expand Down
2 changes: 2 additions & 0 deletions packages/pds/src/lexicon/types/com/atproto/label/defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { CID } from 'multiformats/cid'

/** Metadata tag on an atproto resource (eg, repo or record). */
export interface Label {
/** The AT Protocol version of the label object. */
ver?: number
/** DID of the actor who created this label. */
src: string
/** AT URI of the record, repository (account), or other resource that this label applies to. */
Expand Down

0 comments on commit 06c79c0

Please sign in to comment.