a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lex-cli): set a minimum constraint of 1 array items for XRPC parameters

Mary 30ccef36 9ef363fa

+61 -15
+9
.changeset/wise-hornets-chew.md
··· 1 + --- 2 + '@atcute/atproto': patch 3 + '@atcute/bluemoji': patch 4 + '@atcute/bluesky': patch 5 + '@atcute/ozone': patch 6 + '@atcute/lex-cli': patch 7 + --- 8 + 9 + set a minimum constraint of 1 array items for XRPC parameters
+3 -1
packages/definitions/atproto/lib/lexicons/types/com/atproto/admin/getAccountInfos.ts
··· 5 5 6 6 const _mainSchema = /*#__PURE__*/ v.query('com.atproto.admin.getAccountInfos', { 7 7 params: /*#__PURE__*/ v.object({ 8 - dids: /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), 8 + dids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), [ 9 + /*#__PURE__*/ v.arrayLength(1), 10 + ]), 9 11 }), 10 12 output: { 11 13 type: 'lex',
+3 -1
packages/definitions/atproto/lib/lexicons/types/com/atproto/label/queryLabels.ts
··· 11 11 50, 12 12 ), 13 13 sources: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString())), 14 - uriPatterns: /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), 14 + uriPatterns: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), [ 15 + /*#__PURE__*/ v.arrayLength(1), 16 + ]), 15 17 }), 16 18 output: { 17 19 type: 'lex',
+3 -1
packages/definitions/atproto/lib/lexicons/types/com/atproto/sync/getBlocks.ts
··· 4 4 5 5 const _mainSchema = /*#__PURE__*/ v.query('com.atproto.sync.getBlocks', { 6 6 params: /*#__PURE__*/ v.object({ 7 - cids: /*#__PURE__*/ v.array(/*#__PURE__*/ v.cidString()), 7 + cids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.cidString()), [ 8 + /*#__PURE__*/ v.arrayLength(1), 9 + ]), 8 10 did: /*#__PURE__*/ v.didString(), 9 11 }), 10 12 output: {
+1 -1
packages/definitions/bluemoji/lib/lexicons/types/blue/moji/packs/getPacks.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('blue.moji.packs.getPacks', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 uris: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 25), 9 + /*#__PURE__*/ v.arrayLength(1, 25), 10 10 ]), 11 11 }), 12 12 output: {
+1 -1
packages/definitions/bluesky/lib/lexicons/types/app/bsky/actor/getProfiles.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('app.bsky.actor.getProfiles', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 actors: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.actorIdentifierString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 25), 9 + /*#__PURE__*/ v.arrayLength(1, 25), 10 10 ]), 11 11 }), 12 12 output: {
+3 -1
packages/definitions/bluesky/lib/lexicons/types/app/bsky/feed/getFeedGenerators.ts
··· 5 5 6 6 const _mainSchema = /*#__PURE__*/ v.query('app.bsky.feed.getFeedGenerators', { 7 7 params: /*#__PURE__*/ v.object({ 8 - feeds: /*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), 8 + feeds: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), [ 9 + /*#__PURE__*/ v.arrayLength(1), 10 + ]), 9 11 }), 10 12 output: { 11 13 type: 'lex',
+1 -1
packages/definitions/bluesky/lib/lexicons/types/app/bsky/feed/getPosts.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('app.bsky.feed.getPosts', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 uris: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 25), 9 + /*#__PURE__*/ v.arrayLength(1, 25), 10 10 ]), 11 11 }), 12 12 output: {
+1 -1
packages/definitions/bluesky/lib/lexicons/types/app/bsky/graph/getStarterPacks.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('app.bsky.graph.getStarterPacks', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 uris: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 25), 9 + /*#__PURE__*/ v.arrayLength(1, 25), 10 10 ]), 11 11 }), 12 12 output: {
+3 -1
packages/definitions/bluesky/lib/lexicons/types/app/bsky/labeler/getServices.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('app.bsky.labeler.getServices', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 detailed: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean(), false), 9 - dids: /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), 9 + dids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), [ 10 + /*#__PURE__*/ v.arrayLength(1), 11 + ]), 10 12 }), 11 13 output: { 12 14 type: 'lex',
+1 -1
packages/definitions/ozone/lib/lexicons/types/tools/ozone/moderation/getRecords.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('tools.ozone.moderation.getRecords', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 uris: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.resourceUriString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 100), 9 + /*#__PURE__*/ v.arrayLength(1, 100), 10 10 ]), 11 11 }), 12 12 output: {
+1 -1
packages/definitions/ozone/lib/lexicons/types/tools/ozone/moderation/getReporterStats.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('tools.ozone.moderation.getReporterStats', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 dids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 100), 9 + /*#__PURE__*/ v.arrayLength(1, 100), 10 10 ]), 11 11 }), 12 12 output: {
+1 -1
packages/definitions/ozone/lib/lexicons/types/tools/ozone/moderation/getRepos.ts
··· 6 6 const _mainSchema = /*#__PURE__*/ v.query('tools.ozone.moderation.getRepos', { 7 7 params: /*#__PURE__*/ v.object({ 8 8 dids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), [ 9 - /*#__PURE__*/ v.arrayLength(0, 100), 9 + /*#__PURE__*/ v.arrayLength(1, 100), 10 10 ]), 11 11 }), 12 12 output: {
+3 -1
packages/definitions/ozone/lib/lexicons/types/tools/ozone/signature/findCorrelation.ts
··· 5 5 6 6 const _mainSchema = /*#__PURE__*/ v.query('tools.ozone.signature.findCorrelation', { 7 7 params: /*#__PURE__*/ v.object({ 8 - dids: /*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), 8 + dids: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.didString()), [ 9 + /*#__PURE__*/ v.arrayLength(1), 10 + ]), 9 11 }), 10 12 output: { 11 13 type: 'lex',
+3 -1
packages/definitions/ozone/lib/lexicons/types/tools/ozone/signature/searchAccounts.ts
··· 10 10 /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [/*#__PURE__*/ v.integerRange(1, 100)]), 11 11 50, 12 12 ), 13 - values: /*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), 13 + values: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(/*#__PURE__*/ v.string()), [ 14 + /*#__PURE__*/ v.arrayLength(1), 15 + ]), 14 16 }), 15 17 output: { 16 18 type: 'lex',
+24 -1
packages/lexicons/lex-cli/src/codegen.ts
··· 392 392 return `null`; 393 393 } 394 394 395 + const requiredProps = spec.required; 396 + const originalProperties = spec.properties; 397 + let transformedProperties: LexXrpcParameters['properties'] | undefined; 398 + 399 + if (originalProperties) { 400 + for (const [prop, propSpec] of Object.entries(originalProperties)) { 401 + if (propSpec.type === 'array') { 402 + if (!requiredProps?.includes(prop)) { 403 + continue; 404 + } 405 + 406 + if (transformedProperties === undefined) { 407 + transformedProperties = { ...originalProperties }; 408 + } 409 + 410 + transformedProperties[prop] = { 411 + ...propSpec, 412 + minLength: Math.max(propSpec.minLength ?? 0, 1), 413 + }; 414 + } 415 + } 416 + } 417 + 395 418 const mask: LexObject = { 396 419 type: 'object', 397 420 description: spec.description, 398 421 required: spec.required, 399 - properties: spec.properties, 422 + properties: transformedProperties ?? originalProperties, 400 423 }; 401 424 402 425 return generateObject(imports, defUri, mask, 'none');