diff --git a/src/api/labelmerge/index.ts b/src/api/labelmerge/index.ts index 4895756..b8dce02 100644 --- a/src/api/labelmerge/index.ts +++ b/src/api/labelmerge/index.ts @@ -7,55 +7,55 @@ import { XrpcClient, type FetchHandler, type FetchHandlerOptions, -} from '@atproto/xrpc' -import { schemas } from './lexicons.js' +} from "@atproto/xrpc"; +import { schemas } from "./lexicons.js"; // import { CID } from 'multiformats/cid' -import { type OmitKey, type Un$Typed } from './util.js' -import * as AppReddwarfLabelmergeQueryLabels from './types/app/reddwarf/labelmerge/queryLabels.js' -import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs.js' +import { type OmitKey, type Un$Typed } from "./util.js"; +import * as AppReddwarfLabelmergeQueryLabels from "./types/app/reddwarf/labelmerge/queryLabels.js"; +import * as ComAtprotoLabelDefs from "./types/com/atproto/label/defs.js"; -export * as AppReddwarfLabelmergeQueryLabels from './types/app/reddwarf/labelmerge/queryLabels.js' -export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs.js' +export * as AppReddwarfLabelmergeQueryLabels from "./types/app/reddwarf/labelmerge/queryLabels.js"; +export * as ComAtprotoLabelDefs from "./types/com/atproto/label/defs.js"; export class AtpBaseClient extends XrpcClient { - app: AppNS + app: AppNS; constructor(options: FetchHandler | FetchHandlerOptions) { - super(options, schemas) - this.app = new AppNS(this) + super(options, schemas); + this.app = new AppNS(this); } /** @deprecated use `this` instead */ get xrpc(): XrpcClient { - return this + return this; } } export class AppNS { - _client: XrpcClient - reddwarf: AppReddwarfNS + _client: XrpcClient; + reddwarf: AppReddwarfNS; constructor(client: XrpcClient) { - this._client = client - this.reddwarf = new AppReddwarfNS(client) + this._client = client; + this.reddwarf = new AppReddwarfNS(client); } } export class AppReddwarfNS { - _client: XrpcClient - labelmerge: AppReddwarfLabelmergeNS + _client: XrpcClient; + labelmerge: AppReddwarfLabelmergeNS; constructor(client: XrpcClient) { - this._client = client - this.labelmerge = new AppReddwarfLabelmergeNS(client) + this._client = client; + this.labelmerge = new AppReddwarfLabelmergeNS(client); } } export class AppReddwarfLabelmergeNS { - _client: XrpcClient + _client: XrpcClient; constructor(client: XrpcClient) { - this._client = client + this._client = client; } queryLabels( @@ -63,10 +63,10 @@ export class AppReddwarfLabelmergeNS { opts?: AppReddwarfLabelmergeQueryLabels.CallOptions, ): Promise { return this._client.call( - 'app.reddwarf.labelmerge.queryLabels', + "app.reddwarf.labelmerge.queryLabels", params, undefined, opts, - ) + ); } } diff --git a/src/api/labelmerge/lexicons.ts b/src/api/labelmerge/lexicons.ts index 73500c2..fdbc2b6 100644 --- a/src/api/labelmerge/lexicons.ts +++ b/src/api/labelmerge/lexicons.ts @@ -8,278 +8,278 @@ import { Lexicons, ValidationError, type ValidationResult, -} from '@atproto/lexicon' -import { type $Typed, is$typed, maybe$typed } from './util.js' +} from "@atproto/lexicon"; +import { type $Typed, is$typed, maybe$typed } from "./util.js"; export const schemaDict = { AppReddwarfLabelmergeQueryLabels: { lexicon: 1, - id: 'app.reddwarf.labelmerge.queryLabels', + id: "app.reddwarf.labelmerge.queryLabels", defs: { main: { - type: 'query', + type: "query", description: - 'Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth.', + "Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth.", parameters: { - type: 'params', + type: "params", properties: { s: { - type: 'array', + type: "array", items: { - type: 'string', + type: "string", }, - description: 'List of label subjects (strings).', + description: "List of label subjects (strings).", }, l: { - type: 'array', + type: "array", items: { - type: 'string', - format: 'did', + type: "string", + format: "did", }, - description: 'List of label sources (labeler DIDs) to filter on.', + description: "List of label sources (labeler DIDs) to filter on.", }, strict: { - type: 'boolean', + type: "boolean", description: - 'If true then any errors will throw the entire query', + "If true then any errors will throw the entire query", }, }, - required: ['s', 'l'], + required: ["s", "l"], }, output: { - encoding: 'application/json', + encoding: "application/json", schema: { - type: 'object', + type: "object", properties: { labels: { - type: 'array', + type: "array", items: { - type: 'ref', - ref: 'lex:com.atproto.label.defs#label', + type: "ref", + ref: "lex:com.atproto.label.defs#label", }, }, error: { - type: 'array', + type: "array", items: { - type: 'ref', - ref: 'lex:app.reddwarf.labelmerge.queryLabels#error', + type: "ref", + ref: "lex:app.reddwarf.labelmerge.queryLabels#error", }, }, }, - required: ['labels'], + required: ["labels"], }, }, }, error: { - type: 'object', + type: "object", properties: { s: { - type: 'string', - format: 'did', + type: "string", + format: "did", }, e: { - type: 'string', + type: "string", }, }, - required: ['s'], + required: ["s"], }, }, }, ComAtprotoLabelDefs: { - id: 'com.atproto.label.defs', + id: "com.atproto.label.defs", defs: { label: { - type: 'object', - required: ['src', 'uri', 'val', 'cts'], + type: "object", + required: ["src", "uri", "val", "cts"], properties: { cid: { - type: 'string', - format: 'cid', + type: "string", + format: "cid", description: "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", }, cts: { - type: 'string', - format: 'datetime', - description: 'Timestamp when this label was created.', + type: "string", + format: "datetime", + description: "Timestamp when this label was created.", }, exp: { - type: 'string', - format: 'datetime', + type: "string", + format: "datetime", description: - 'Timestamp at which this label expires (no longer applies).', + "Timestamp at which this label expires (no longer applies).", }, neg: { - type: 'boolean', + type: "boolean", description: - 'If true, this is a negation label, overwriting a previous label.', + "If true, this is a negation label, overwriting a previous label.", }, sig: { - type: 'bytes', - description: 'Signature of dag-cbor encoded label.', + type: "bytes", + description: "Signature of dag-cbor encoded label.", }, src: { - type: 'string', - format: 'did', - description: 'DID of the actor who created this label.', + type: "string", + format: "did", + description: "DID of the actor who created this label.", }, uri: { - type: 'string', - format: 'uri', + type: "string", + format: "uri", description: - 'AT URI of the record, repository (account), or other resource that this label applies to.', + "AT URI of the record, repository (account), or other resource that this label applies to.", }, val: { - type: 'string', + type: "string", maxLength: 128, description: - 'The short string name of the value or type of this label.', + "The short string name of the value or type of this label.", }, ver: { - type: 'integer', - description: 'The AT Protocol version of the label object.', + type: "integer", + description: "The AT Protocol version of the label object.", }, }, description: - 'Metadata tag on an atproto resource (eg, repo or record).', + "Metadata tag on an atproto resource (eg, repo or record).", }, selfLabel: { - type: 'object', - required: ['val'], + type: "object", + required: ["val"], properties: { val: { - type: 'string', + type: "string", maxLength: 128, description: - 'The short string name of the value or type of this label.', + "The short string name of the value or type of this label.", }, }, description: - 'Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.', + "Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.", }, labelValue: { - type: 'string', + type: "string", knownValues: [ - '!hide', - '!no-promote', - '!warn', - '!no-unauthenticated', - 'dmca-violation', - 'doxxing', - 'porn', - 'sexual', - 'nudity', - 'nsfl', - 'gore', + "!hide", + "!no-promote", + "!warn", + "!no-unauthenticated", + "dmca-violation", + "doxxing", + "porn", + "sexual", + "nudity", + "nsfl", + "gore", ], }, selfLabels: { - type: 'object', - required: ['values'], + type: "object", + required: ["values"], properties: { values: { - type: 'array', + type: "array", items: { - ref: 'lex:com.atproto.label.defs#selfLabel', - type: 'ref', + ref: "lex:com.atproto.label.defs#selfLabel", + type: "ref", }, maxLength: 10, }, }, description: - 'Metadata tags on an atproto record, published by the author within the record.', + "Metadata tags on an atproto record, published by the author within the record.", }, labelValueDefinition: { - type: 'object', - required: ['identifier', 'severity', 'blurs', 'locales'], + type: "object", + required: ["identifier", "severity", "blurs", "locales"], properties: { blurs: { - type: 'string', + type: "string", description: "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.", - knownValues: ['content', 'media', 'none'], + knownValues: ["content", "media", "none"], }, locales: { - type: 'array', + type: "array", items: { - ref: 'lex:com.atproto.label.defs#labelValueDefinitionStrings', - type: 'ref', + ref: "lex:com.atproto.label.defs#labelValueDefinitionStrings", + type: "ref", }, }, severity: { - type: 'string', + type: "string", description: "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.", - knownValues: ['inform', 'alert', 'none'], + knownValues: ["inform", "alert", "none"], }, adultOnly: { - type: 'boolean', + type: "boolean", description: - 'Does the user need to have adult content enabled in order to configure this label?', + "Does the user need to have adult content enabled in order to configure this label?", }, identifier: { - type: 'string', + type: "string", maxLength: 100, description: "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", maxGraphemes: 100, }, defaultSetting: { - type: 'string', - default: 'warn', - description: 'The default setting for this label.', - knownValues: ['ignore', 'warn', 'hide'], + type: "string", + default: "warn", + description: "The default setting for this label.", + knownValues: ["ignore", "warn", "hide"], }, }, description: - 'Declares a label value and its expected interpretations and behaviors.', + "Declares a label value and its expected interpretations and behaviors.", }, labelValueDefinitionStrings: { - type: 'object', - required: ['lang', 'name', 'description'], + type: "object", + required: ["lang", "name", "description"], properties: { lang: { - type: 'string', - format: 'language', + type: "string", + format: "language", description: - 'The code of the language these strings are written in.', + "The code of the language these strings are written in.", }, name: { - type: 'string', + type: "string", maxLength: 640, - description: 'A short human-readable name for the label.', + description: "A short human-readable name for the label.", maxGraphemes: 64, }, description: { - type: 'string', + type: "string", maxLength: 100000, description: - 'A longer description of what the label means and why it might be applied.', + "A longer description of what the label means and why it might be applied.", maxGraphemes: 10000, }, }, description: - 'Strings which describe the label in the UI, localized into a specific language.', + "Strings which describe the label in the UI, localized into a specific language.", }, }, lexicon: 1, }, -} as const satisfies Record -export const schemas = Object.values(schemaDict) satisfies LexiconDoc[] -export const lexicons: Lexicons = new Lexicons(schemas) +} as const satisfies Record; +export const schemas = Object.values(schemaDict) satisfies LexiconDoc[]; +export const lexicons: Lexicons = new Lexicons(schemas); export function validate( v: unknown, id: string, hash: string, requiredType: true, -): ValidationResult +): ValidationResult; export function validate( v: unknown, id: string, hash: string, requiredType?: false, -): ValidationResult +): ValidationResult; export function validate( v: unknown, id: string, @@ -291,12 +291,12 @@ export function validate( : { success: false, error: new ValidationError( - `Must be an object with "${hash === 'main' ? id : `${id}#${hash}`}" $type property`, + `Must be an object with "${hash === "main" ? id : `${id}#${hash}`}" $type property`, ), - } + }; } export const ids = { - AppReddwarfLabelmergeQueryLabels: 'app.reddwarf.labelmerge.queryLabels', - ComAtprotoLabelDefs: 'com.atproto.label.defs', -} as const + AppReddwarfLabelmergeQueryLabels: "app.reddwarf.labelmerge.queryLabels", + ComAtprotoLabelDefs: "com.atproto.label.defs", +} as const; diff --git a/src/api/labelmerge/types/app/reddwarf/labelmerge/queryLabels.ts b/src/api/labelmerge/types/app/reddwarf/labelmerge/queryLabels.ts index ee24f61..342148d 100644 --- a/src/api/labelmerge/types/app/reddwarf/labelmerge/queryLabels.ts +++ b/src/api/labelmerge/types/app/reddwarf/labelmerge/queryLabels.ts @@ -3,63 +3,63 @@ /** * GENERATED CODE - DO NOT MODIFY */ -import { type HeadersMap, XRPCError } from '@atproto/xrpc' -import { type ValidationResult, BlobRef } from '@atproto/lexicon' +import { type HeadersMap, XRPCError } from "@atproto/xrpc"; +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; // import { CID } from 'multiformats/cid' -import { validate as _validate } from '../../../../lexicons' +import { validate as _validate } from "../../../../lexicons"; import { type $Typed, is$typed as _is$typed, type OmitKey, -} from '../../../../util' -import type * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs.js' +} from "../../../../util"; +import type * as ComAtprotoLabelDefs from "../../../com/atproto/label/defs.js"; const is$typed = _is$typed, - validate = _validate -const id = 'app.reddwarf.labelmerge.queryLabels' + validate = _validate; +const id = "app.reddwarf.labelmerge.queryLabels"; export type QueryParams = { /** List of label subjects (strings). */ - s: string[] + s: string[]; /** List of label sources (labeler DIDs) to filter on. */ - l: string[] + l: string[]; /** If true then any errors will throw the entire query */ - strict?: boolean -} -export type InputSchema = undefined + strict?: boolean; +}; +export type InputSchema = undefined; export interface OutputSchema { - labels: ComAtprotoLabelDefs.Label[] - error?: Error[] + labels: ComAtprotoLabelDefs.Label[]; + error?: Error[]; } export interface CallOptions { - signal?: AbortSignal - headers?: HeadersMap + signal?: AbortSignal; + headers?: HeadersMap; } export interface Response { - success: boolean - headers: HeadersMap - data: OutputSchema + success: boolean; + headers: HeadersMap; + data: OutputSchema; } export function toKnownErr(e: any) { - return e + return e; } export interface Error { - $type?: 'app.reddwarf.labelmerge.queryLabels#error' - s: string - e?: string + $type?: "app.reddwarf.labelmerge.queryLabels#error"; + s: string; + e?: string; } -const hashError = 'error' +const hashError = "error"; export function isError(v: V) { - return is$typed(v, id, hashError) + return is$typed(v, id, hashError); } export function validateError(v: V) { - return validate(v, id, hashError) + return validate(v, id, hashError); } diff --git a/src/api/labelmerge/types/com/atproto/label/defs.ts b/src/api/labelmerge/types/com/atproto/label/defs.ts index 5311209..726b317 100644 --- a/src/api/labelmerge/types/com/atproto/label/defs.ts +++ b/src/api/labelmerge/types/com/atproto/label/defs.ts @@ -3,140 +3,140 @@ /** * GENERATED CODE - DO NOT MODIFY */ -import { type ValidationResult, BlobRef } from '@atproto/lexicon' +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; // import { CID } from 'multiformats/cid' -import { validate as _validate } from '../../../../lexicons' +import { validate as _validate } from "../../../../lexicons"; import { type $Typed, is$typed as _is$typed, type OmitKey, -} from '../../../../util' +} from "../../../../util"; const is$typed = _is$typed, - validate = _validate -const id = 'com.atproto.label.defs' + validate = _validate; +const id = "com.atproto.label.defs"; /** Metadata tag on an atproto resource (eg, repo or record). */ export interface Label { - $type?: 'com.atproto.label.defs#label' + $type?: "com.atproto.label.defs#label"; /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */ - cid?: string + cid?: string; /** Timestamp when this label was created. */ - cts: string + cts: string; /** Timestamp at which this label expires (no longer applies). */ - exp?: string + exp?: string; /** If true, this is a negation label, overwriting a previous label. */ - neg?: boolean + neg?: boolean; /** Signature of dag-cbor encoded label. */ - sig?: Uint8Array + sig?: Uint8Array; /** DID of the actor who created this label. */ - src: string + src: string; /** AT URI of the record, repository (account), or other resource that this label applies to. */ - uri: string + uri: string; /** The short string name of the value or type of this label. */ - val: string + val: string; /** The AT Protocol version of the label object. */ - ver?: number + ver?: number; } -const hashLabel = 'label' +const hashLabel = "label"; export function isLabel(v: V) { - return is$typed(v, id, hashLabel) + return is$typed(v, id, hashLabel); } export function validateLabel(v: V) { - return validate