@liase/core 1.0.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/LICENSE +9 -0
- package/README.md +62 -0
- package/dist/ActionContext.d.ts +603 -0
- package/dist/ActionContext.d.ts.map +1 -0
- package/dist/ActionContext.js +227 -0
- package/dist/DomSelection.d.ts +30 -0
- package/dist/DomSelection.d.ts.map +1 -0
- package/dist/DomSelection.js +60 -0
- package/dist/Liase.d.ts +40 -0
- package/dist/Liase.d.ts.map +1 -0
- package/dist/Liase.js +105 -0
- package/dist/LiaseQuery.d.ts +593 -0
- package/dist/LiaseQuery.d.ts.map +1 -0
- package/dist/LiaseQuery.js +145 -0
- package/dist/actionHelpers.d.ts +30 -0
- package/dist/actionHelpers.d.ts.map +1 -0
- package/dist/actionHelpers.js +73 -0
- package/dist/constructorExecution.d.ts +7 -0
- package/dist/constructorExecution.d.ts.map +1 -0
- package/dist/constructorExecution.js +149 -0
- package/dist/generateResponse.d.ts +14 -0
- package/dist/generateResponse.d.ts.map +1 -0
- package/dist/generateResponse.js +88 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/lib/fetch.d.ts +10 -0
- package/dist/lib/fetch.d.ts.map +1 -0
- package/dist/lib/fetch.js +68 -0
- package/dist/lib/hooks.d.ts +7 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +13 -0
- package/dist/lib/networkRequestsCache.d.ts +23 -0
- package/dist/lib/networkRequestsCache.d.ts.map +1 -0
- package/dist/lib/networkRequestsCache.js +81 -0
- package/dist/lib/networkRequestsHistory.d.ts +21 -0
- package/dist/lib/networkRequestsHistory.d.ts.map +1 -0
- package/dist/lib/networkRequestsHistory.js +119 -0
- package/dist/lib/time.d.ts +2 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +31 -0
- package/dist/lib/utils.d.ts +46 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +208 -0
- package/dist/lib/zod.d.ts +35 -0
- package/dist/lib/zod.d.ts.map +1 -0
- package/dist/lib/zod.js +290 -0
- package/dist/loadUrl.d.ts +45 -0
- package/dist/loadUrl.d.ts.map +1 -0
- package/dist/loadUrl.js +111 -0
- package/dist/plugins/built-in-sources/bluesky/client.d.ts +11 -0
- package/dist/plugins/built-in-sources/bluesky/client.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/client.js +17 -0
- package/dist/plugins/built-in-sources/bluesky/index.d.ts +1115 -0
- package/dist/plugins/built-in-sources/bluesky/index.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/index.js +14 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.d.ts +378 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.js +77 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.d.ts +390 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.js +87 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.d.ts +351 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.js +56 -0
- package/dist/plugins/built-in-sources/bluesky/shared.d.ts +53 -0
- package/dist/plugins/built-in-sources/bluesky/shared.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/shared.js +127 -0
- package/dist/plugins/built-in-sources/bluesky/types.d.ts +488 -0
- package/dist/plugins/built-in-sources/bluesky/types.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/bluesky/types.js +48 -0
- package/dist/plugins/built-in-sources/giphy/index.d.ts +584 -0
- package/dist/plugins/built-in-sources/giphy/index.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/giphy/index.js +9 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.d.ts +310 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.js +71 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.d.ts +274 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.js +43 -0
- package/dist/plugins/built-in-sources/giphy/shared.d.ts +24 -0
- package/dist/plugins/built-in-sources/giphy/shared.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/giphy/shared.js +30 -0
- package/dist/plugins/built-in-sources/giphy/types.d.ts +398 -0
- package/dist/plugins/built-in-sources/giphy/types.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/giphy/types.js +46 -0
- package/dist/plugins/built-in-sources/index.d.ts +1698 -0
- package/dist/plugins/built-in-sources/index.d.ts.map +1 -0
- package/dist/plugins/built-in-sources/index.js +5 -0
- package/dist/schemas/constructor.d.ts +14 -0
- package/dist/schemas/constructor.d.ts.map +1 -0
- package/dist/schemas/constructor.js +33 -0
- package/dist/schemas/file.d.ts +124 -0
- package/dist/schemas/file.d.ts.map +1 -0
- package/dist/schemas/file.js +28 -0
- package/dist/schemas/finderOptions.d.ts +389 -0
- package/dist/schemas/finderOptions.d.ts.map +1 -0
- package/dist/schemas/finderOptions.js +7 -0
- package/dist/schemas/media.d.ts +433 -0
- package/dist/schemas/media.d.ts.map +1 -0
- package/dist/schemas/media.js +81 -0
- package/dist/schemas/plugin.d.ts +298 -0
- package/dist/schemas/plugin.d.ts.map +1 -0
- package/dist/schemas/plugin.js +19 -0
- package/dist/schemas/primitives.d.ts +4 -0
- package/dist/schemas/primitives.d.ts.map +1 -0
- package/dist/schemas/primitives.js +11 -0
- package/dist/schemas/queryOptions.d.ts +19 -0
- package/dist/schemas/queryOptions.d.ts.map +1 -0
- package/dist/schemas/queryOptions.js +9 -0
- package/dist/schemas/request.d.ts +77 -0
- package/dist/schemas/request.d.ts.map +1 -0
- package/dist/schemas/request.js +21 -0
- package/dist/schemas/requestHandler.d.ts +126 -0
- package/dist/schemas/requestHandler.d.ts.map +1 -0
- package/dist/schemas/requestHandler.js +26 -0
- package/dist/schemas/response.d.ts +4673 -0
- package/dist/schemas/response.d.ts.map +1 -0
- package/dist/schemas/response.js +51 -0
- package/dist/schemas/secrets.d.ts +4 -0
- package/dist/schemas/secrets.d.ts.map +1 -0
- package/dist/schemas/secrets.js +2 -0
- package/dist/schemas/source.d.ts +202 -0
- package/dist/schemas/source.d.ts.map +1 -0
- package/dist/schemas/source.js +10 -0
- package/dist/test/fixtures/currentTimeSource.d.ts +53 -0
- package/dist/test/fixtures/currentTimeSource.d.ts.map +1 -0
- package/dist/test/fixtures/currentTimeSource.js +76 -0
- package/dist/test/fixtures/examplePlugin.d.ts +266 -0
- package/dist/test/fixtures/examplePlugin.d.ts.map +1 -0
- package/dist/test/fixtures/examplePlugin.js +4 -0
- package/dist/test/fixtures/exampleSource.d.ts +265 -0
- package/dist/test/fixtures/exampleSource.d.ts.map +1 -0
- package/dist/test/fixtures/exampleSource.js +107 -0
- package/dist/test/testFiles/internal/caching.test.d.ts +2 -0
- package/dist/test/testFiles/internal/caching.test.d.ts.map +1 -0
- package/dist/test/testFiles/internal/caching.test.js +116 -0
- package/dist/test/testFiles/internal/mediaTypeGuessing.test.d.ts +2 -0
- package/dist/test/testFiles/internal/mediaTypeGuessing.test.d.ts.map +1 -0
- package/dist/test/testFiles/internal/mediaTypeGuessing.test.js +86 -0
- package/dist/test/testFiles/sources/bluesky.test.d.ts +2 -0
- package/dist/test/testFiles/sources/bluesky.test.d.ts.map +1 -0
- package/dist/test/testFiles/sources/bluesky.test.js +40 -0
- package/dist/test/testFiles/sources/exampleSource.test.d.ts +2 -0
- package/dist/test/testFiles/sources/exampleSource.test.d.ts.map +1 -0
- package/dist/test/testFiles/sources/exampleSource.test.js +27 -0
- package/dist/test/testFiles/sources/giphy.test.d.ts +2 -0
- package/dist/test/testFiles/sources/giphy.test.d.ts.map +1 -0
- package/dist/test/testFiles/sources/giphy.test.js +17 -0
- package/dist/test/utils/general.d.ts +3 -0
- package/dist/test/utils/general.d.ts.map +1 -0
- package/dist/test/utils/general.js +24 -0
- package/dist/test/utils/globalSetup.d.ts +3 -0
- package/dist/test/utils/globalSetup.d.ts.map +1 -0
- package/dist/test/utils/globalSetup.js +12 -0
- package/dist/test/utils/vitest.d.ts +551 -0
- package/dist/test/utils/vitest.d.ts.map +1 -0
- package/dist/test/utils/vitest.js +166 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
readonly id: "single-media";
|
|
4
|
+
readonly displayName: "Single media";
|
|
5
|
+
readonly description: "Find a specific media included in a post";
|
|
6
|
+
readonly requestSchema: z.ZodObject<{
|
|
7
|
+
source: z.ZodString;
|
|
8
|
+
queryType: z.ZodString;
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
source: string;
|
|
12
|
+
queryType: string;
|
|
13
|
+
id: string;
|
|
14
|
+
}, {
|
|
15
|
+
source: string;
|
|
16
|
+
queryType: string;
|
|
17
|
+
id: string;
|
|
18
|
+
}>;
|
|
19
|
+
readonly secretsSchema: z.ZodObject<{
|
|
20
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
21
|
+
password: z.ZodOptional<z.ZodString>;
|
|
22
|
+
serviceUrl: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, "strict", z.ZodTypeAny, {
|
|
24
|
+
password?: string | undefined;
|
|
25
|
+
handle?: string | undefined;
|
|
26
|
+
serviceUrl?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
password?: string | undefined;
|
|
29
|
+
handle?: string | undefined;
|
|
30
|
+
serviceUrl?: string | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
readonly paginationType: "none";
|
|
33
|
+
readonly responses: [{
|
|
34
|
+
readonly schema: z.ZodObject<Omit<{
|
|
35
|
+
page: z.ZodObject<{
|
|
36
|
+
paginationType: z.ZodLiteral<"cursor">;
|
|
37
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
38
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
39
|
+
isLastPage: z.ZodBoolean;
|
|
40
|
+
pageFetchLimitReached: z.ZodBoolean;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
paginationType: "cursor";
|
|
43
|
+
isLastPage: boolean;
|
|
44
|
+
pageFetchLimitReached: boolean;
|
|
45
|
+
nextCursor: string | null;
|
|
46
|
+
cursor?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
paginationType: "cursor";
|
|
49
|
+
isLastPage: boolean;
|
|
50
|
+
pageFetchLimitReached: boolean;
|
|
51
|
+
nextCursor: string | null;
|
|
52
|
+
cursor?: string | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
media: z.ZodArray<z.ZodObject<{
|
|
55
|
+
mediaFinderSource: z.ZodLiteral<"bluesky">;
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
title: z.ZodString;
|
|
58
|
+
url: z.ZodString;
|
|
59
|
+
dateUploaded: z.ZodDate;
|
|
60
|
+
usernameOfUploader: z.ZodString;
|
|
61
|
+
nameOfUploader: z.ZodString;
|
|
62
|
+
files: z.ZodTuple<[z.ZodObject<{
|
|
63
|
+
url: z.ZodString;
|
|
64
|
+
ext: z.ZodString;
|
|
65
|
+
mimeType: z.ZodString;
|
|
66
|
+
image: z.ZodBoolean;
|
|
67
|
+
video: z.ZodBoolean;
|
|
68
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
aspectRatio: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
height: z.ZodNumber;
|
|
71
|
+
width: z.ZodNumber;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
}, {
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
}>>;
|
|
79
|
+
} & {
|
|
80
|
+
type: z.ZodLiteral<"full">;
|
|
81
|
+
}, "strict", z.ZodTypeAny, {
|
|
82
|
+
mimeType: string;
|
|
83
|
+
ext: string;
|
|
84
|
+
video: boolean;
|
|
85
|
+
image: boolean;
|
|
86
|
+
url: string;
|
|
87
|
+
type: "full";
|
|
88
|
+
fileSize?: number | undefined;
|
|
89
|
+
aspectRatio?: {
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
mimeType: string;
|
|
95
|
+
ext: string;
|
|
96
|
+
video: boolean;
|
|
97
|
+
image: boolean;
|
|
98
|
+
url: string;
|
|
99
|
+
type: "full";
|
|
100
|
+
fileSize?: number | undefined;
|
|
101
|
+
aspectRatio?: {
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
} | undefined;
|
|
105
|
+
}>, z.ZodObject<{
|
|
106
|
+
url: z.ZodString;
|
|
107
|
+
ext: z.ZodString;
|
|
108
|
+
mimeType: z.ZodString;
|
|
109
|
+
image: z.ZodBoolean;
|
|
110
|
+
video: z.ZodBoolean;
|
|
111
|
+
fileSize: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
aspectRatio: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
height: z.ZodNumber;
|
|
114
|
+
width: z.ZodNumber;
|
|
115
|
+
}, "strict", z.ZodTypeAny, {
|
|
116
|
+
width: number;
|
|
117
|
+
height: number;
|
|
118
|
+
}, {
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
}>>;
|
|
122
|
+
} & {
|
|
123
|
+
type: z.ZodLiteral<"thumbnail">;
|
|
124
|
+
}, "strict", z.ZodTypeAny, {
|
|
125
|
+
mimeType: string;
|
|
126
|
+
ext: string;
|
|
127
|
+
video: boolean;
|
|
128
|
+
image: boolean;
|
|
129
|
+
url: string;
|
|
130
|
+
type: "thumbnail";
|
|
131
|
+
fileSize?: number | undefined;
|
|
132
|
+
aspectRatio?: {
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
} | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
mimeType: string;
|
|
138
|
+
ext: string;
|
|
139
|
+
video: boolean;
|
|
140
|
+
image: boolean;
|
|
141
|
+
url: string;
|
|
142
|
+
type: "thumbnail";
|
|
143
|
+
fileSize?: number | undefined;
|
|
144
|
+
aspectRatio?: {
|
|
145
|
+
width: number;
|
|
146
|
+
height: number;
|
|
147
|
+
} | undefined;
|
|
148
|
+
}>], null>;
|
|
149
|
+
contentHash: z.ZodString;
|
|
150
|
+
}, "strict", z.ZodTypeAny, {
|
|
151
|
+
url: string;
|
|
152
|
+
id: string;
|
|
153
|
+
contentHash: string;
|
|
154
|
+
mediaFinderSource: "bluesky";
|
|
155
|
+
files: [{
|
|
156
|
+
mimeType: string;
|
|
157
|
+
ext: string;
|
|
158
|
+
video: boolean;
|
|
159
|
+
image: boolean;
|
|
160
|
+
url: string;
|
|
161
|
+
type: "full";
|
|
162
|
+
fileSize?: number | undefined;
|
|
163
|
+
aspectRatio?: {
|
|
164
|
+
width: number;
|
|
165
|
+
height: number;
|
|
166
|
+
} | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
mimeType: string;
|
|
169
|
+
ext: string;
|
|
170
|
+
video: boolean;
|
|
171
|
+
image: boolean;
|
|
172
|
+
url: string;
|
|
173
|
+
type: "thumbnail";
|
|
174
|
+
fileSize?: number | undefined;
|
|
175
|
+
aspectRatio?: {
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
} | undefined;
|
|
179
|
+
}];
|
|
180
|
+
nameOfUploader: string;
|
|
181
|
+
usernameOfUploader: string;
|
|
182
|
+
title: string;
|
|
183
|
+
dateUploaded: Date;
|
|
184
|
+
}, {
|
|
185
|
+
url: string;
|
|
186
|
+
id: string;
|
|
187
|
+
contentHash: string;
|
|
188
|
+
mediaFinderSource: "bluesky";
|
|
189
|
+
files: [{
|
|
190
|
+
mimeType: string;
|
|
191
|
+
ext: string;
|
|
192
|
+
video: boolean;
|
|
193
|
+
image: boolean;
|
|
194
|
+
url: string;
|
|
195
|
+
type: "full";
|
|
196
|
+
fileSize?: number | undefined;
|
|
197
|
+
aspectRatio?: {
|
|
198
|
+
width: number;
|
|
199
|
+
height: number;
|
|
200
|
+
} | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
mimeType: string;
|
|
203
|
+
ext: string;
|
|
204
|
+
video: boolean;
|
|
205
|
+
image: boolean;
|
|
206
|
+
url: string;
|
|
207
|
+
type: "thumbnail";
|
|
208
|
+
fileSize?: number | undefined;
|
|
209
|
+
aspectRatio?: {
|
|
210
|
+
width: number;
|
|
211
|
+
height: number;
|
|
212
|
+
} | undefined;
|
|
213
|
+
}];
|
|
214
|
+
nameOfUploader: string;
|
|
215
|
+
usernameOfUploader: string;
|
|
216
|
+
title: string;
|
|
217
|
+
dateUploaded: Date;
|
|
218
|
+
}>, "many">;
|
|
219
|
+
request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
220
|
+
}, "page">, "strict", z.ZodTypeAny, {
|
|
221
|
+
media: {
|
|
222
|
+
url: string;
|
|
223
|
+
id: string;
|
|
224
|
+
contentHash: string;
|
|
225
|
+
mediaFinderSource: "bluesky";
|
|
226
|
+
files: [{
|
|
227
|
+
mimeType: string;
|
|
228
|
+
ext: string;
|
|
229
|
+
video: boolean;
|
|
230
|
+
image: boolean;
|
|
231
|
+
url: string;
|
|
232
|
+
type: "full";
|
|
233
|
+
fileSize?: number | undefined;
|
|
234
|
+
aspectRatio?: {
|
|
235
|
+
width: number;
|
|
236
|
+
height: number;
|
|
237
|
+
} | undefined;
|
|
238
|
+
}, {
|
|
239
|
+
mimeType: string;
|
|
240
|
+
ext: string;
|
|
241
|
+
video: boolean;
|
|
242
|
+
image: boolean;
|
|
243
|
+
url: string;
|
|
244
|
+
type: "thumbnail";
|
|
245
|
+
fileSize?: number | undefined;
|
|
246
|
+
aspectRatio?: {
|
|
247
|
+
width: number;
|
|
248
|
+
height: number;
|
|
249
|
+
} | undefined;
|
|
250
|
+
}];
|
|
251
|
+
nameOfUploader: string;
|
|
252
|
+
usernameOfUploader: string;
|
|
253
|
+
title: string;
|
|
254
|
+
dateUploaded: Date;
|
|
255
|
+
}[];
|
|
256
|
+
request: Record<string, unknown>;
|
|
257
|
+
}, {
|
|
258
|
+
media: {
|
|
259
|
+
url: string;
|
|
260
|
+
id: string;
|
|
261
|
+
contentHash: string;
|
|
262
|
+
mediaFinderSource: "bluesky";
|
|
263
|
+
files: [{
|
|
264
|
+
mimeType: string;
|
|
265
|
+
ext: string;
|
|
266
|
+
video: boolean;
|
|
267
|
+
image: boolean;
|
|
268
|
+
url: string;
|
|
269
|
+
type: "full";
|
|
270
|
+
fileSize?: number | undefined;
|
|
271
|
+
aspectRatio?: {
|
|
272
|
+
width: number;
|
|
273
|
+
height: number;
|
|
274
|
+
} | undefined;
|
|
275
|
+
}, {
|
|
276
|
+
mimeType: string;
|
|
277
|
+
ext: string;
|
|
278
|
+
video: boolean;
|
|
279
|
+
image: boolean;
|
|
280
|
+
url: string;
|
|
281
|
+
type: "thumbnail";
|
|
282
|
+
fileSize?: number | undefined;
|
|
283
|
+
aspectRatio?: {
|
|
284
|
+
width: number;
|
|
285
|
+
height: number;
|
|
286
|
+
} | undefined;
|
|
287
|
+
}];
|
|
288
|
+
nameOfUploader: string;
|
|
289
|
+
usernameOfUploader: string;
|
|
290
|
+
title: string;
|
|
291
|
+
dateUploaded: Date;
|
|
292
|
+
}[];
|
|
293
|
+
request: Record<string, unknown>;
|
|
294
|
+
}>;
|
|
295
|
+
readonly constructor: {
|
|
296
|
+
readonly _setup: ($: import("../../../../ActionContext.js").ActionContext) => Promise<import("@atproto/api/dist/client/types/app/bsky/feed/getPosts.js").OutputSchema>;
|
|
297
|
+
readonly media: {
|
|
298
|
+
_arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => {
|
|
299
|
+
id: string;
|
|
300
|
+
postCid: string;
|
|
301
|
+
postUri: string;
|
|
302
|
+
postUrl: string;
|
|
303
|
+
postTextContents: string;
|
|
304
|
+
fileCid: string;
|
|
305
|
+
altText: string;
|
|
306
|
+
mimeType: string;
|
|
307
|
+
filesize: number;
|
|
308
|
+
playlistUrl?: string;
|
|
309
|
+
thumbnailUrl: string;
|
|
310
|
+
fullsizeUrl?: string;
|
|
311
|
+
aspectRatio: {
|
|
312
|
+
width: number;
|
|
313
|
+
height: number;
|
|
314
|
+
};
|
|
315
|
+
author: {
|
|
316
|
+
did: string;
|
|
317
|
+
handle: string;
|
|
318
|
+
displayName: string;
|
|
319
|
+
avatarUrl: string;
|
|
320
|
+
createdAt: string;
|
|
321
|
+
};
|
|
322
|
+
languages: string[];
|
|
323
|
+
createdAt: string;
|
|
324
|
+
}[];
|
|
325
|
+
mediaFinderSource: string;
|
|
326
|
+
id: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
327
|
+
contentHash: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
328
|
+
title: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
329
|
+
url: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
330
|
+
dateUploaded: ($: import("../../../../ActionContext.js").ActionContext) => Date;
|
|
331
|
+
usernameOfUploader: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
332
|
+
nameOfUploader: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
333
|
+
files: {
|
|
334
|
+
_arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => any[];
|
|
335
|
+
_setup: ($: import("../../../../ActionContext.js").ActionContext) => import("../../../../ActionContext.js").ActionContext;
|
|
336
|
+
type: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
337
|
+
url: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
338
|
+
ext: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
339
|
+
mimeType: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
340
|
+
image: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
341
|
+
video: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
342
|
+
fileSize: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
343
|
+
aspectRatio: ($: import("../../../../ActionContext.js").ActionContext) => any;
|
|
344
|
+
}[];
|
|
345
|
+
}[];
|
|
346
|
+
readonly request: ($: import("../../../../ActionContext.js").ActionContext) => Record<string, any>;
|
|
347
|
+
};
|
|
348
|
+
}];
|
|
349
|
+
};
|
|
350
|
+
export default _default;
|
|
351
|
+
//# sourceMappingURL=singleMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleMedia.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOxB,wBAkDoC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getAgent } from "../client.js";
|
|
3
|
+
import { postsToMediaResponseConstructor } from "../shared.js";
|
|
4
|
+
import { responseSchema } from "../types.js";
|
|
5
|
+
export default {
|
|
6
|
+
id: "single-media",
|
|
7
|
+
displayName: "Single media",
|
|
8
|
+
description: "Find a specific media included in a post",
|
|
9
|
+
requestSchema: z
|
|
10
|
+
.object({
|
|
11
|
+
source: z.string(),
|
|
12
|
+
queryType: z.string(),
|
|
13
|
+
id: z.string(),
|
|
14
|
+
})
|
|
15
|
+
.strict(),
|
|
16
|
+
secretsSchema: z
|
|
17
|
+
.object({
|
|
18
|
+
handle: z.string().optional(),
|
|
19
|
+
password: z.string().optional(),
|
|
20
|
+
serviceUrl: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
.strict(),
|
|
23
|
+
paginationType: "none",
|
|
24
|
+
responses: [
|
|
25
|
+
{
|
|
26
|
+
schema: responseSchema.omit({ page: true }),
|
|
27
|
+
constructor: {
|
|
28
|
+
_setup: async ($) => {
|
|
29
|
+
let res;
|
|
30
|
+
try {
|
|
31
|
+
const agent = await getAgent({
|
|
32
|
+
$,
|
|
33
|
+
handle: $.secrets.handle,
|
|
34
|
+
password: $.secrets.password,
|
|
35
|
+
serviceUrl: $.secrets.serviceUrl,
|
|
36
|
+
});
|
|
37
|
+
const apiRes = await agent.app.bsky.feed.getPosts({
|
|
38
|
+
uris: [$.request.id.replace(/#\w+$/, "")],
|
|
39
|
+
});
|
|
40
|
+
res = apiRes;
|
|
41
|
+
if (!apiRes.success) {
|
|
42
|
+
throw Error("Unsuccessful request to Bluesky");
|
|
43
|
+
}
|
|
44
|
+
return apiRes.data;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.info("Response:", res);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
media: postsToMediaResponseConstructor,
|
|
52
|
+
request: ($) => $.request,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const sourceId = "bluesky";
|
|
2
|
+
export declare const postsToMediaResponseConstructor: {
|
|
3
|
+
_arrayMap: ($: import("../../../ActionContext.js").ActionContext) => BlueskyMedia[];
|
|
4
|
+
mediaFinderSource: string;
|
|
5
|
+
id: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
6
|
+
contentHash: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
7
|
+
title: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
8
|
+
url: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
9
|
+
dateUploaded: ($: import("../../../ActionContext.js").ActionContext) => Date;
|
|
10
|
+
usernameOfUploader: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
11
|
+
nameOfUploader: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
12
|
+
files: {
|
|
13
|
+
_arrayMap: ($: import("../../../ActionContext.js").ActionContext) => any[];
|
|
14
|
+
_setup: ($: import("../../../ActionContext.js").ActionContext) => import("../../../ActionContext.js").ActionContext;
|
|
15
|
+
type: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
16
|
+
url: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
17
|
+
ext: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
18
|
+
mimeType: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
19
|
+
image: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
20
|
+
video: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
21
|
+
fileSize: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
22
|
+
aspectRatio: ($: import("../../../ActionContext.js").ActionContext) => any;
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
type BlueskyMedia = {
|
|
26
|
+
id: string;
|
|
27
|
+
postCid: string;
|
|
28
|
+
postUri: string;
|
|
29
|
+
postUrl: string;
|
|
30
|
+
postTextContents: string;
|
|
31
|
+
fileCid: string;
|
|
32
|
+
altText: string;
|
|
33
|
+
mimeType: string;
|
|
34
|
+
filesize: number;
|
|
35
|
+
playlistUrl?: string;
|
|
36
|
+
thumbnailUrl: string;
|
|
37
|
+
fullsizeUrl?: string;
|
|
38
|
+
aspectRatio: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
author: {
|
|
43
|
+
did: string;
|
|
44
|
+
handle: string;
|
|
45
|
+
displayName: string;
|
|
46
|
+
avatarUrl: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
};
|
|
49
|
+
languages: string[];
|
|
50
|
+
createdAt: string;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/plugins/built-in-sources/bluesky/shared.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,YAAY,CAAC;AAElC,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;GAgErB,CAAC;AAExB,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export const sourceId = "bluesky";
|
|
2
|
+
export const postsToMediaResponseConstructor = [
|
|
3
|
+
{
|
|
4
|
+
_arrayMap: ($) => postsToMedia(
|
|
5
|
+
// biome-ignore lint/suspicious/noExplicitAny: bluesky API response is untyped
|
|
6
|
+
$().posts ?? $().feed?.map((item) => item.post) ?? []).filter((bskyMedia) => $.request.id ? bskyMedia.id === $.request.id : true),
|
|
7
|
+
mediaFinderSource: sourceId,
|
|
8
|
+
id: ($) => $().id,
|
|
9
|
+
contentHash: ($) => $().fileCid,
|
|
10
|
+
title: ($) => $().postTextContents,
|
|
11
|
+
url: ($) => $().postUrl,
|
|
12
|
+
dateUploaded: ($) => new Date($().createdAt),
|
|
13
|
+
usernameOfUploader: ($) => $().author.handle,
|
|
14
|
+
nameOfUploader: ($) => $().author.displayName,
|
|
15
|
+
files: [
|
|
16
|
+
{
|
|
17
|
+
_arrayMap: ($) => [
|
|
18
|
+
...($().fullsizeUrl
|
|
19
|
+
? [{ ...$(), url: $().fullsizeUrl, mediaFinderType: "full" }]
|
|
20
|
+
: []),
|
|
21
|
+
...($().playlistUrl
|
|
22
|
+
? [{ ...$(), url: $().playlistUrl, mediaFinderType: "full" }]
|
|
23
|
+
: []),
|
|
24
|
+
...($().thumbnailUrl
|
|
25
|
+
? [
|
|
26
|
+
{
|
|
27
|
+
url: $().thumbnailUrl,
|
|
28
|
+
mediaFinderType: "thumbnail",
|
|
29
|
+
// For image posts use the image mimeType; for video posts the
|
|
30
|
+
// thumbnail is always a JPEG image regardless of video format
|
|
31
|
+
mimeType: $().fullsizeUrl ? $().mimeType : "image/jpeg",
|
|
32
|
+
},
|
|
33
|
+
]
|
|
34
|
+
: []),
|
|
35
|
+
],
|
|
36
|
+
_setup: ($) => $.set("mediaInfo", $.guessMediaInfoFromUrl(
|
|
37
|
+
// Bluesky CDN URLs previously had a @format suffix (e.g. @jpeg).
|
|
38
|
+
// Keep this replacement for backward-compat with cached responses.
|
|
39
|
+
$().url.replace(/@(\w+)$/, (_, match) => `.${match}`),
|
|
40
|
+
// Fall back to the mimeType stored on the entry when the URL has
|
|
41
|
+
// no file extension (current Bluesky CDN image URL format).
|
|
42
|
+
{ mimeType: $().mimeType })),
|
|
43
|
+
type: ($) => $().mediaFinderType,
|
|
44
|
+
url: ($) => $().url,
|
|
45
|
+
ext: ($) => $("mediaInfo").ext,
|
|
46
|
+
mimeType: ($) => $("mediaInfo").mimeType,
|
|
47
|
+
image: ($) => $("mediaInfo").image,
|
|
48
|
+
video: ($) => $("mediaInfo").video,
|
|
49
|
+
fileSize: ($) => $().filesize,
|
|
50
|
+
aspectRatio: ($) => $().aspectRatio,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
// biome-ignore lint/suspicious/noExplicitAny: bluesky API response is untyped
|
|
56
|
+
function postsToMedia(posts) {
|
|
57
|
+
const mediaPosts = [];
|
|
58
|
+
for (const post of posts) {
|
|
59
|
+
const media = [];
|
|
60
|
+
const postUrl = `https://bsky.app/profile/${post.uri.split("/").at(2)}/post/${post.uri.split("/").at(-1)}`;
|
|
61
|
+
if (post.record.embed?.images && post.embed?.images) {
|
|
62
|
+
if (post.record.embed.images.length !== post.embed.images.length) {
|
|
63
|
+
throw Error();
|
|
64
|
+
}
|
|
65
|
+
for (let i = 0; i < post.embed.images.length; i++) {
|
|
66
|
+
const fileCid = post.record.embed.images[i].image.ref.toString();
|
|
67
|
+
media.push({
|
|
68
|
+
id: `${post.uri}#${fileCid}`,
|
|
69
|
+
languages: post.record.langs,
|
|
70
|
+
createdAt: post.record.createdAt,
|
|
71
|
+
author: {
|
|
72
|
+
did: post.author.did,
|
|
73
|
+
handle: post.author.handle,
|
|
74
|
+
displayName: post.author.displayName,
|
|
75
|
+
avatarUrl: post.author.avatar,
|
|
76
|
+
createdAt: post.author.createdAt,
|
|
77
|
+
},
|
|
78
|
+
altText: post.embed.images[i].alt,
|
|
79
|
+
fileCid,
|
|
80
|
+
postCid: post.cid,
|
|
81
|
+
postUri: post.uri,
|
|
82
|
+
postTextContents: post.record.text,
|
|
83
|
+
mimeType: post.record.embed.images[i].image.mimeType,
|
|
84
|
+
filesize: post.record.embed.images[i].image.size,
|
|
85
|
+
fullsizeUrl: post.embed.images[i].fullsize,
|
|
86
|
+
thumbnailUrl: post.embed.images[i].thumb,
|
|
87
|
+
aspectRatio: post.embed.images[i].aspectRatio && {
|
|
88
|
+
width: post.embed.images[i].aspectRatio.width,
|
|
89
|
+
height: post.embed.images[i].aspectRatio.height,
|
|
90
|
+
},
|
|
91
|
+
postUrl,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else if (post.record.embed?.video) {
|
|
96
|
+
const fileCid = post.record.embed.video.ref.toString();
|
|
97
|
+
media.push({
|
|
98
|
+
id: `${post.uri}#${fileCid}`,
|
|
99
|
+
languages: post.record.langs,
|
|
100
|
+
createdAt: post.record.createdAt,
|
|
101
|
+
fileCid,
|
|
102
|
+
postCid: post.cid,
|
|
103
|
+
postUri: post.uri,
|
|
104
|
+
postTextContents: post.record.text,
|
|
105
|
+
mimeType: post.record.embed.video.mimeType,
|
|
106
|
+
filesize: post.record.embed.video.size,
|
|
107
|
+
playlistUrl: post.embed?.playlist,
|
|
108
|
+
thumbnailUrl: post.embed?.thumbnail,
|
|
109
|
+
aspectRatio: post.embed?.aspectRatio && {
|
|
110
|
+
width: post.embed?.aspectRatio.width,
|
|
111
|
+
height: post.embed?.aspectRatio.height,
|
|
112
|
+
},
|
|
113
|
+
author: {
|
|
114
|
+
did: post.author.did,
|
|
115
|
+
handle: post.author.handle,
|
|
116
|
+
displayName: post.author.displayName,
|
|
117
|
+
avatarUrl: post.author.avatar,
|
|
118
|
+
createdAt: post.author.createdAt,
|
|
119
|
+
},
|
|
120
|
+
altText: post.embed?.alt,
|
|
121
|
+
postUrl,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
mediaPosts.push(media);
|
|
125
|
+
}
|
|
126
|
+
return mediaPosts.flat();
|
|
127
|
+
}
|