Skip to content

Commit 054afda

Browse files
authored
Merge branch 'main' into shuuji3/test/setup-bsky-appview
2 parents b97ecef + c236f4f commit 054afda

File tree

5 files changed

+169
-90
lines changed

5 files changed

+169
-90
lines changed

README.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/client/README.md

packages/client/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/tsky-dev/tsky/refs/heads/main/.github/assets/tsky-logo.png" width="200" height="200">
3+
</p>
4+
5+
<h1 align="center">tsky</h1>
6+
7+
<p align="center">
8+
A lightweight, fast, universal and typed Bluesky API wrapper for Apps & Bots.
9+
</p>
10+
11+
## ⚠️ tsky is still in development and is not ready for production use
12+
13+
tsky is still in active development and is not ready for production use. If you want to contribute to the project, please read the [CONTRIBUTING.md](../../CONTRIBUTING.md) file or join our [Discord Server](https://discord.gg/KPD7XPUZn3).
14+
15+
tsky is a lightweight, fast, universal and typed Bluesky API wrapper for Apps & Bots. It's designed to be easy to use, lightweight and straightforward to use. It's built with TypeScript and has full type support.
16+
17+
It was primarily built for the [Nimbus Client](https://github.com/nimbus-town/nimbus) but can be used in any other project that requires Bluesky API integration.
18+
19+
## Installation
20+
21+
```bash
22+
# NPM
23+
npm install tsky
24+
25+
# Yarn
26+
yarn add tsky
27+
28+
# PNPM
29+
pnpm add tsky
30+
31+
# Bun
32+
bun add tsky
33+
```
34+
35+
## Usage
36+
37+
Using a Public Agent
38+
39+
```ts
40+
import { createAgent } from '@tsky/client';
41+
42+
const agent = await createAgent({
43+
options: {
44+
service: 'https://public.api.bsky.app',
45+
},
46+
});
47+
48+
// Getting a user from their handle
49+
// First, we need to get the user's DID
50+
const did = await agent.resolveDIDFromHandle(handle);
51+
// Then, we can get the user's profile
52+
const profile = await agent.actor(did);
53+
```
54+
55+
Using an Authenticated Agent
56+
57+
```ts
58+
import { createAgent } from '@tsky/client';
59+
60+
const agent = await createAgent({
61+
credentials: {
62+
identifier: "handle",
63+
password: "password"
64+
}
65+
});
66+
67+
// Getting the profile of the authenticated user
68+
const user_profile = await agent.user.profile();
69+
```
70+
71+
## Links
72+
73+
- [📚 tsky Documentation](https://tsky.dev/)
74+
- [🦋 tsky on Bluesky](https://bsky.app/profile/tsky.dev)
75+
- [📣 tsky Discord Server](https://discord.gg/KPD7XPUZn3)
76+
- [🦋 Nimbus on Bluesky](https://bsky.app/profile/nimbus.town)
77+
78+
## Contributing
79+
80+
If you want to contribute to this project, please read the [CONTRIBUTING.md](../../CONTRIBUTING.md) file.
81+
82+
## License
83+
84+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/tsky-dev/tsky/blob/main/LICENSE) file for details.

packages/client/package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tsky/client",
33
"type": "module",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
55
"license": "MIT",
66
"publishConfig": {
77
"access": "public"
@@ -31,6 +31,15 @@
3131
"test:coverage": "bash ../internal/dev-infra/with-test-redis-and-db.sh vitest --coverage",
3232
"test:typescript": "tsc --noEmit"
3333
},
34+
"homepage": "https://tsky.dev",
35+
"repository": {
36+
"type": "git",
37+
"url": "git+https://github.com/tsky-dev/tsky.git",
38+
"directory": "packages/client"
39+
},
40+
"bugs": {
41+
"url": "https://github.com/tsky-dev/tsky/issues"
42+
},
3443
"dependencies": {
3544
"@atcute/client": "^2.0.6"
3645
},

packages/lex-cli/src/generator/schema.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,25 @@ export const userTypeSchema = t.isOneOf([
368368

369369
export type UserTypeSchema = t.InferType<typeof userTypeSchema>;
370370

371+
/**
372+
* represents a namespace identifier (NSID)
373+
*/
374+
export type Nsid = `${string}.${string}.${string}`;
375+
371376
const NSID_RE =
372-
/^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+\.[a-z]{1,63}$/i;
373-
const nsidType = t.cascade(t.isString(), (value) => NSID_RE.test(value));
377+
/^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\.[a-zA-Z][a-zA-Z0-9]{0,62}?$/;
378+
379+
// #__NO_SIDE_EFFECTS__
380+
export const isNsid = (input: unknown): input is Nsid => {
381+
return (
382+
typeof input === 'string' &&
383+
input.length >= 5 &&
384+
input.length <= 317 &&
385+
NSID_RE.test(input)
386+
);
387+
};
388+
389+
const nsidType = t.cascade(t.isString(), (value) => isNsid(value));
374390

375391
export const documentSchema = t.cascade(
376392
t.isObject({

packages/lexicons/src/lib/lexicons.ts

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* @module
66
* Contains type declarations for Bluesky lexicons
77
* @generated
8-
* Generated on: 2025-04-25T03:38:32.224Z
8+
* Generated on: 2025-05-21T07:58:36.895Z
99
* Version: main
10-
* Source: https://github.com/bluesky-social/atproto/tree/45354c84f898d79f58c14b5c0da3661beb7353f9/lexicons
10+
* Source: https://github.com/bluesky-social/atproto/tree/24e20b96c6d39100cfe016c549e2f4d9184fa770/lexicons
1111
*/
1212

1313
/** Base type with optional type field */
@@ -268,6 +268,7 @@ export declare namespace AppBskyActorDefs {
268268
displayName?: string;
269269
indexedAt?: string;
270270
labels?: ComAtprotoLabelDefs.Label[];
271+
status?: StatusView;
271272
verification?: VerificationState;
272273
viewer?: ViewerState;
273274
}
@@ -283,6 +284,7 @@ export declare namespace AppBskyActorDefs {
283284
*/
284285
displayName?: string;
285286
labels?: ComAtprotoLabelDefs.Label[];
287+
status?: StatusView;
286288
verification?: VerificationState;
287289
viewer?: ViewerState;
288290
}
@@ -310,6 +312,7 @@ export declare namespace AppBskyActorDefs {
310312
labels?: ComAtprotoLabelDefs.Label[];
311313
pinnedPost?: ComAtprotoRepoStrongRef.Main;
312314
postsCount?: number;
315+
status?: StatusView;
313316
verification?: VerificationState;
314317
viewer?: ViewerState;
315318
}
@@ -327,6 +330,17 @@ export declare namespace AppBskyActorDefs {
327330
interface SavedFeedsPrefV2 extends TypedBase {
328331
items: AppBskyActorDefs.SavedFeed[];
329332
}
333+
interface StatusView extends TypedBase {
334+
record: unknown;
335+
/** The status for the account. */
336+
status: "app.bsky.actor.status#live" | (string & {});
337+
/** An optional embed associated with the status. */
338+
embed?: TypeUnion<AppBskyEmbedExternal.View>;
339+
/** The date when this status will expire. The application might choose to no longer return the status after expiration. */
340+
expiresAt?: string;
341+
/** True if the status is not expired, false if it is expired. Only present if expiration was set. */
342+
isActive?: boolean;
343+
}
330344
interface ThreadViewPref extends TypedBase {
331345
/** Show followed users at the top of all replies. */
332346
prioritizeFollowedUsers?: boolean;
@@ -514,6 +528,24 @@ export declare namespace AppBskyActorSearchActorsTypeahead {
514528
}
515529
}
516530

531+
export declare namespace AppBskyActorStatus {
532+
/** A declaration of a Bluesky account status. */
533+
interface Record extends RecordBase {
534+
$type: "app.bsky.actor.status";
535+
createdAt: string;
536+
/** The status for the account. */
537+
status: "app.bsky.actor.status#live" | (string & {});
538+
/**
539+
* The duration of the status in minutes. Applications can choose to impose minimum and maximum limits.
540+
* Minimum: 1
541+
*/
542+
durationMinutes?: number;
543+
/** An optional embed associated with the status. */
544+
embed?: TypeUnion<AppBskyEmbedExternal.Main>;
545+
}
546+
type Live = "app.bsky.actor.status#live";
547+
}
548+
517549
export declare namespace AppBskyEmbedDefs {
518550
/** width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. */
519551
interface AspectRatio extends TypedBase {
@@ -698,6 +730,11 @@ export declare namespace AppBskyFeedDefs {
698730
feedContext?: string;
699731
reason?: TypeUnion<ReasonPin | ReasonRepost>;
700732
reply?: ReplyRef;
733+
/**
734+
* Unique identifier per request that may be passed back alongside interactions.
735+
* Maximum string length: 100
736+
*/
737+
reqId?: string;
701738
}
702739
interface GeneratorView extends TypedBase {
703740
cid: At.CID;
@@ -747,6 +784,11 @@ export declare namespace AppBskyFeedDefs {
747784
*/
748785
feedContext?: string;
749786
item?: At.Uri;
787+
/**
788+
* Unique identifier per request that may be passed back alongside interactions.
789+
* Maximum string length: 100
790+
*/
791+
reqId?: string;
750792
}
751793
type InteractionLike = "app.bsky.feed.defs#interactionLike";
752794
type InteractionQuote = "app.bsky.feed.defs#interactionQuote";
@@ -1023,6 +1065,11 @@ export declare namespace AppBskyFeedGetFeedSkeleton {
10231065
interface Output extends TypedBase {
10241066
feed: AppBskyFeedDefs.SkeletonFeedPost[];
10251067
cursor?: string;
1068+
/**
1069+
* Unique identifier per request that may be passed back alongside interactions.
1070+
* Maximum string length: 100
1071+
*/
1072+
reqId?: string;
10261073
}
10271074
interface Errors extends TypedBase {
10281075
UnknownFeed: {};
@@ -1324,7 +1371,7 @@ export declare namespace AppBskyFeedRepost {
13241371
}
13251372
}
13261373

1327-
/** Find posts matching search criteria, returning views of those posts. */
1374+
/** Find posts matching search criteria, returning views of those posts. Note that this API endpoint may require authentication (eg, not public) for some service providers and implementations. */
13281375
export declare namespace AppBskyFeedSearchPosts {
13291376
interface Params extends TypedBase {
13301377
/** Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. */
@@ -2195,6 +2242,11 @@ export declare namespace AppBskyUnspeccedGetConfig {
21952242
type Input = undefined;
21962243
interface Output extends TypedBase {
21972244
checkEmailConfirmed?: boolean;
2245+
liveNow?: LiveNowConfig[];
2246+
}
2247+
interface LiveNowConfig extends TypedBase {
2248+
did: At.DID;
2249+
domains: string[];
21982250
}
21992251
}
22002252

@@ -6089,6 +6141,7 @@ export declare namespace ToolsOzoneVerificationRevokeVerifications {
60896141

60906142
export declare interface Records extends RecordBase {
60916143
"app.bsky.actor.profile": AppBskyActorProfile.Record;
6144+
"app.bsky.actor.status": AppBskyActorStatus.Record;
60926145
"app.bsky.feed.generator": AppBskyFeedGenerator.Record;
60936146
"app.bsky.feed.like": AppBskyFeedLike.Record;
60946147
"app.bsky.feed.post": AppBskyFeedPost.Record;

0 commit comments

Comments
 (0)