@atcute/bluesky 2.0.2 → 2.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/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lexicons.d.ts +8 -3
- package/dist/utilities/embeds.d.ts +49 -0
- package/dist/utilities/embeds.js +77 -0
- package/dist/utilities/embeds.js.map +1 -0
- package/lib/index.ts +3 -0
- package/lib/lexicons.ts +10 -2
- package/lib/utilities/embeds.ts +103 -0
- package/package.json +4 -3
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC"}
|
package/dist/lexicons.d.ts
CHANGED
|
@@ -1882,6 +1882,11 @@ declare module '@atcute/client/lexicons' {
|
|
|
1882
1882
|
subjectTypes?: ComAtprotoModerationDefs.SubjectType[];
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|
|
1885
|
+
namespace AppBskyNotificationDefs {
|
|
1886
|
+
interface RecordDeleted {
|
|
1887
|
+
[Brand.Type]?: 'app.bsky.notification.defs#recordDeleted';
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1885
1890
|
/** Count the number of unread notifications for the requesting account. Requires auth. */
|
|
1886
1891
|
namespace AppBskyNotificationGetUnreadCount {
|
|
1887
1892
|
interface Params {
|
|
@@ -1924,8 +1929,8 @@ declare module '@atcute/client/lexicons' {
|
|
|
1924
1929
|
cid: At.Cid;
|
|
1925
1930
|
indexedAt: string;
|
|
1926
1931
|
isRead: boolean;
|
|
1927
|
-
/** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote',
|
|
1928
|
-
reason: 'follow' | 'like' | 'mention' | 'quote' | 'reply' | 'repost' | 'starterpack-joined' | (string & {});
|
|
1932
|
+
/** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', 'starterpack-joined', 'verified', and 'unverified'. */
|
|
1933
|
+
reason: 'follow' | 'like' | 'mention' | 'quote' | 'reply' | 'repost' | 'starterpack-joined' | 'unverified' | 'verified' | (string & {});
|
|
1929
1934
|
record: unknown;
|
|
1930
1935
|
uri: At.ResourceUri;
|
|
1931
1936
|
labels?: ComAtprotoLabelDefs.Label[];
|
|
@@ -2427,7 +2432,7 @@ declare module '@atcute/client/lexicons' {
|
|
|
2427
2432
|
handle: At.Handle;
|
|
2428
2433
|
associated?: AppBskyActorDefs.ProfileAssociated;
|
|
2429
2434
|
avatar?: At.GenericUri;
|
|
2430
|
-
/** Set to true when the actor cannot actively participate in
|
|
2435
|
+
/** Set to true when the actor cannot actively participate in conversations */
|
|
2431
2436
|
chatDisabled?: boolean;
|
|
2432
2437
|
/**
|
|
2433
2438
|
* Maximum string length: 640 \
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AppBskyEmbedRecordWithMedia, AppBskyFeedDefs, AppBskyFeedPost } from '@atcute/client/lexicons';
|
|
2
|
+
export interface RawEmbeds {
|
|
3
|
+
media?: AppBskyEmbedRecordWithMedia.Main['media'];
|
|
4
|
+
record?: AppBskyEmbedRecordWithMedia.Main['record'];
|
|
5
|
+
}
|
|
6
|
+
export type RawMediaEmbed = NonNullable<RawEmbeds['media']>;
|
|
7
|
+
export type RawRecordEmbed = NonNullable<RawEmbeds['record']>;
|
|
8
|
+
/**
|
|
9
|
+
* extracts raw media embed from a post record embed
|
|
10
|
+
* @param embed the embed interface to extract from
|
|
11
|
+
* @returns the extracted raw media embed, if any
|
|
12
|
+
*/
|
|
13
|
+
export declare const unwrapRawMediaEmbed: (embed: AppBskyFeedPost.Record["embed"]) => RawEmbeds["media"];
|
|
14
|
+
/**
|
|
15
|
+
* extracts raw record embed from a post record embed
|
|
16
|
+
* @param embed the embed interface to extract from
|
|
17
|
+
* @returns the extracted raw record embed, if any
|
|
18
|
+
*/
|
|
19
|
+
export declare const unwrapRawRecordEmbed: (embed: AppBskyFeedPost.Record["embed"]) => RawEmbeds["record"];
|
|
20
|
+
/**
|
|
21
|
+
* extracts raw media and record embeds from a post record embed
|
|
22
|
+
* @param embed the embed interface to extract from
|
|
23
|
+
* @returns the extracted raw media and record embeds, if any
|
|
24
|
+
*/
|
|
25
|
+
export declare const unwrapRawEmbed: (embed: AppBskyFeedPost.Record["embed"]) => RawEmbeds;
|
|
26
|
+
export interface Embeds {
|
|
27
|
+
media?: AppBskyEmbedRecordWithMedia.View['media'];
|
|
28
|
+
record?: AppBskyEmbedRecordWithMedia.View['record']['record'];
|
|
29
|
+
}
|
|
30
|
+
export type MediaEmbed = NonNullable<Embeds['media']>;
|
|
31
|
+
export type RecordEmbed = NonNullable<Embeds['record']>;
|
|
32
|
+
/**
|
|
33
|
+
* extracts media embed from a post embed
|
|
34
|
+
* @param embed the embed interface to extract from
|
|
35
|
+
* @returns the extracted media embed, if any
|
|
36
|
+
*/
|
|
37
|
+
export declare const unwrapMediaEmbed: (embed: AppBskyFeedDefs.PostView["embed"]) => Embeds["media"];
|
|
38
|
+
/**
|
|
39
|
+
* extracts record embed from a post embed
|
|
40
|
+
* @param embed the embed interface to extract from
|
|
41
|
+
* @returns the extracted record embed, if any
|
|
42
|
+
*/
|
|
43
|
+
export declare const unwrapRecordEmbed: (embed: AppBskyFeedDefs.PostView["embed"]) => Embeds["record"];
|
|
44
|
+
/**
|
|
45
|
+
* extracts media and record embeds from a post embed
|
|
46
|
+
* @param embed the embed interface to extract from
|
|
47
|
+
* @returns the extracted media and record embeds, if any
|
|
48
|
+
*/
|
|
49
|
+
export declare const unwrapEmbed: (embed: AppBskyFeedDefs.PostView["embed"]) => Embeds;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* extracts raw media embed from a post record embed
|
|
3
|
+
* @param embed the embed interface to extract from
|
|
4
|
+
* @returns the extracted raw media embed, if any
|
|
5
|
+
*/
|
|
6
|
+
export const unwrapRawMediaEmbed = (embed) => {
|
|
7
|
+
switch (embed?.$type) {
|
|
8
|
+
case 'app.bsky.embed.recordWithMedia':
|
|
9
|
+
return embed.media;
|
|
10
|
+
case 'app.bsky.embed.record':
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return embed;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* extracts raw record embed from a post record embed
|
|
17
|
+
* @param embed the embed interface to extract from
|
|
18
|
+
* @returns the extracted raw record embed, if any
|
|
19
|
+
*/
|
|
20
|
+
export const unwrapRawRecordEmbed = (embed) => {
|
|
21
|
+
switch (embed?.$type) {
|
|
22
|
+
case 'app.bsky.embed.recordWithMedia':
|
|
23
|
+
return embed.record;
|
|
24
|
+
case 'app.bsky.embed.record':
|
|
25
|
+
return embed;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* extracts raw media and record embeds from a post record embed
|
|
30
|
+
* @param embed the embed interface to extract from
|
|
31
|
+
* @returns the extracted raw media and record embeds, if any
|
|
32
|
+
*/
|
|
33
|
+
export const unwrapRawEmbed = (embed) => {
|
|
34
|
+
return {
|
|
35
|
+
media: unwrapRawMediaEmbed(embed),
|
|
36
|
+
record: unwrapRawRecordEmbed(embed),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* extracts media embed from a post embed
|
|
41
|
+
* @param embed the embed interface to extract from
|
|
42
|
+
* @returns the extracted media embed, if any
|
|
43
|
+
*/
|
|
44
|
+
export const unwrapMediaEmbed = (embed) => {
|
|
45
|
+
switch (embed?.$type) {
|
|
46
|
+
case 'app.bsky.embed.recordWithMedia#view':
|
|
47
|
+
return embed.media;
|
|
48
|
+
case 'app.bsky.embed.record#view':
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
return embed;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* extracts record embed from a post embed
|
|
55
|
+
* @param embed the embed interface to extract from
|
|
56
|
+
* @returns the extracted record embed, if any
|
|
57
|
+
*/
|
|
58
|
+
export const unwrapRecordEmbed = (embed) => {
|
|
59
|
+
switch (embed?.$type) {
|
|
60
|
+
case 'app.bsky.embed.recordWithMedia#view':
|
|
61
|
+
return embed.record.record;
|
|
62
|
+
case 'app.bsky.embed.record#view':
|
|
63
|
+
return embed.record;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* extracts media and record embeds from a post embed
|
|
68
|
+
* @param embed the embed interface to extract from
|
|
69
|
+
* @returns the extracted media and record embeds, if any
|
|
70
|
+
*/
|
|
71
|
+
export const unwrapEmbed = (embed) => {
|
|
72
|
+
return {
|
|
73
|
+
media: unwrapMediaEmbed(embed),
|
|
74
|
+
record: unwrapRecordEmbed(embed),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=embeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeds.js","sourceRoot":"","sources":["../../lib/utilities/embeds.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAsC,EAAsB,EAAE;IACjG,QAAQ,KAAK,EAAE,KAAK,EAAE,CAAC;QACtB,KAAK,gCAAgC;YACpC,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,KAAK,uBAAuB;YAC3B,OAAO;IACT,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAsC,EAAuB,EAAE;IACnG,QAAQ,KAAK,EAAE,KAAK,EAAE,CAAC;QACtB,KAAK,gCAAgC;YACpC,OAAO,KAAK,CAAC,MAAM,CAAC;QAErB,KAAK,uBAAuB;YAC3B,OAAO,KAAK,CAAC;IACf,CAAC;AACF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAsC,EAAa,EAAE;IACnF,OAAO;QACN,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC;QACjC,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC;KACnC,CAAC;AACH,CAAC,CAAC;AAUF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAwC,EAAmB,EAAE;IAC7F,QAAQ,KAAK,EAAE,KAAK,EAAE,CAAC;QACtB,KAAK,qCAAqC;YACzC,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,KAAK,4BAA4B;YAChC,OAAO;IACT,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAwC,EAAoB,EAAE;IAC/F,QAAQ,KAAK,EAAE,KAAK,EAAE,CAAC;QACtB,KAAK,qCAAqC;YACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAE5B,KAAK,4BAA4B;YAChC,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;AACF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAwC,EAAU,EAAE;IAC/E,OAAO;QACN,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC;QAC9B,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC;KAChC,CAAC;AACH,CAAC,CAAC"}
|
package/lib/index.ts
ADDED
package/lib/lexicons.ts
CHANGED
|
@@ -2027,6 +2027,12 @@ declare module '@atcute/client/lexicons' {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
}
|
|
2029
2029
|
|
|
2030
|
+
namespace AppBskyNotificationDefs {
|
|
2031
|
+
interface RecordDeleted {
|
|
2032
|
+
[Brand.Type]?: 'app.bsky.notification.defs#recordDeleted';
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2030
2036
|
/** Count the number of unread notifications for the requesting account. Requires auth. */
|
|
2031
2037
|
namespace AppBskyNotificationGetUnreadCount {
|
|
2032
2038
|
interface Params {
|
|
@@ -2070,7 +2076,7 @@ declare module '@atcute/client/lexicons' {
|
|
|
2070
2076
|
cid: At.Cid;
|
|
2071
2077
|
indexedAt: string;
|
|
2072
2078
|
isRead: boolean;
|
|
2073
|
-
/** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote',
|
|
2079
|
+
/** Expected values are 'like', 'repost', 'follow', 'mention', 'reply', 'quote', 'starterpack-joined', 'verified', and 'unverified'. */
|
|
2074
2080
|
reason:
|
|
2075
2081
|
| 'follow'
|
|
2076
2082
|
| 'like'
|
|
@@ -2079,6 +2085,8 @@ declare module '@atcute/client/lexicons' {
|
|
|
2079
2085
|
| 'reply'
|
|
2080
2086
|
| 'repost'
|
|
2081
2087
|
| 'starterpack-joined'
|
|
2088
|
+
| 'unverified'
|
|
2089
|
+
| 'verified'
|
|
2082
2090
|
| (string & {});
|
|
2083
2091
|
record: unknown;
|
|
2084
2092
|
uri: At.ResourceUri;
|
|
@@ -2602,7 +2610,7 @@ declare module '@atcute/client/lexicons' {
|
|
|
2602
2610
|
handle: At.Handle;
|
|
2603
2611
|
associated?: AppBskyActorDefs.ProfileAssociated;
|
|
2604
2612
|
avatar?: At.GenericUri;
|
|
2605
|
-
/** Set to true when the actor cannot actively participate in
|
|
2613
|
+
/** Set to true when the actor cannot actively participate in conversations */
|
|
2606
2614
|
chatDisabled?: boolean;
|
|
2607
2615
|
/**
|
|
2608
2616
|
* Maximum string length: 640 \
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AppBskyEmbedRecordWithMedia, AppBskyFeedDefs, AppBskyFeedPost } from '@atcute/client/lexicons';
|
|
2
|
+
|
|
3
|
+
export interface RawEmbeds {
|
|
4
|
+
media?: AppBskyEmbedRecordWithMedia.Main['media'];
|
|
5
|
+
record?: AppBskyEmbedRecordWithMedia.Main['record'];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type RawMediaEmbed = NonNullable<RawEmbeds['media']>;
|
|
9
|
+
export type RawRecordEmbed = NonNullable<RawEmbeds['record']>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* extracts raw media embed from a post record embed
|
|
13
|
+
* @param embed the embed interface to extract from
|
|
14
|
+
* @returns the extracted raw media embed, if any
|
|
15
|
+
*/
|
|
16
|
+
export const unwrapRawMediaEmbed = (embed: AppBskyFeedPost.Record['embed']): RawEmbeds['media'] => {
|
|
17
|
+
switch (embed?.$type) {
|
|
18
|
+
case 'app.bsky.embed.recordWithMedia':
|
|
19
|
+
return embed.media;
|
|
20
|
+
case 'app.bsky.embed.record':
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return embed;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* extracts raw record embed from a post record embed
|
|
29
|
+
* @param embed the embed interface to extract from
|
|
30
|
+
* @returns the extracted raw record embed, if any
|
|
31
|
+
*/
|
|
32
|
+
export const unwrapRawRecordEmbed = (embed: AppBskyFeedPost.Record['embed']): RawEmbeds['record'] => {
|
|
33
|
+
switch (embed?.$type) {
|
|
34
|
+
case 'app.bsky.embed.recordWithMedia':
|
|
35
|
+
return embed.record;
|
|
36
|
+
|
|
37
|
+
case 'app.bsky.embed.record':
|
|
38
|
+
return embed;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* extracts raw media and record embeds from a post record embed
|
|
44
|
+
* @param embed the embed interface to extract from
|
|
45
|
+
* @returns the extracted raw media and record embeds, if any
|
|
46
|
+
*/
|
|
47
|
+
export const unwrapRawEmbed = (embed: AppBskyFeedPost.Record['embed']): RawEmbeds => {
|
|
48
|
+
return {
|
|
49
|
+
media: unwrapRawMediaEmbed(embed),
|
|
50
|
+
record: unwrapRawRecordEmbed(embed),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export interface Embeds {
|
|
55
|
+
media?: AppBskyEmbedRecordWithMedia.View['media'];
|
|
56
|
+
record?: AppBskyEmbedRecordWithMedia.View['record']['record'];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type MediaEmbed = NonNullable<Embeds['media']>;
|
|
60
|
+
export type RecordEmbed = NonNullable<Embeds['record']>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* extracts media embed from a post embed
|
|
64
|
+
* @param embed the embed interface to extract from
|
|
65
|
+
* @returns the extracted media embed, if any
|
|
66
|
+
*/
|
|
67
|
+
export const unwrapMediaEmbed = (embed: AppBskyFeedDefs.PostView['embed']): Embeds['media'] => {
|
|
68
|
+
switch (embed?.$type) {
|
|
69
|
+
case 'app.bsky.embed.recordWithMedia#view':
|
|
70
|
+
return embed.media;
|
|
71
|
+
case 'app.bsky.embed.record#view':
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return embed;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* extracts record embed from a post embed
|
|
80
|
+
* @param embed the embed interface to extract from
|
|
81
|
+
* @returns the extracted record embed, if any
|
|
82
|
+
*/
|
|
83
|
+
export const unwrapRecordEmbed = (embed: AppBskyFeedDefs.PostView['embed']): Embeds['record'] => {
|
|
84
|
+
switch (embed?.$type) {
|
|
85
|
+
case 'app.bsky.embed.recordWithMedia#view':
|
|
86
|
+
return embed.record.record;
|
|
87
|
+
|
|
88
|
+
case 'app.bsky.embed.record#view':
|
|
89
|
+
return embed.record;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* extracts media and record embeds from a post embed
|
|
95
|
+
* @param embed the embed interface to extract from
|
|
96
|
+
* @returns the extracted media and record embeds, if any
|
|
97
|
+
*/
|
|
98
|
+
export const unwrapEmbed = (embed: AppBskyFeedDefs.PostView['embed']): Embeds => {
|
|
99
|
+
return {
|
|
100
|
+
media: unwrapMediaEmbed(embed),
|
|
101
|
+
record: unwrapRecordEmbed(embed),
|
|
102
|
+
};
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@atcute/bluesky",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"description": "Bluesky type definitions for atcute",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
"!lib/**/*.test.ts"
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
18
|
+
".": "./dist/index.js",
|
|
18
19
|
"./lexicons": "./dist/lexicons.js"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"@atcute/client": "^3.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@atcute/
|
|
25
|
-
"@atcute/
|
|
25
|
+
"@atcute/client": "^3.0.1",
|
|
26
|
+
"@atcute/lex-cli": "^1.1.1"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
29
|
"build": "tsc",
|