@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.
Files changed (162) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +62 -0
  3. package/dist/ActionContext.d.ts +603 -0
  4. package/dist/ActionContext.d.ts.map +1 -0
  5. package/dist/ActionContext.js +227 -0
  6. package/dist/DomSelection.d.ts +30 -0
  7. package/dist/DomSelection.d.ts.map +1 -0
  8. package/dist/DomSelection.js +60 -0
  9. package/dist/Liase.d.ts +40 -0
  10. package/dist/Liase.d.ts.map +1 -0
  11. package/dist/Liase.js +105 -0
  12. package/dist/LiaseQuery.d.ts +593 -0
  13. package/dist/LiaseQuery.d.ts.map +1 -0
  14. package/dist/LiaseQuery.js +145 -0
  15. package/dist/actionHelpers.d.ts +30 -0
  16. package/dist/actionHelpers.d.ts.map +1 -0
  17. package/dist/actionHelpers.js +73 -0
  18. package/dist/constructorExecution.d.ts +7 -0
  19. package/dist/constructorExecution.d.ts.map +1 -0
  20. package/dist/constructorExecution.js +149 -0
  21. package/dist/generateResponse.d.ts +14 -0
  22. package/dist/generateResponse.d.ts.map +1 -0
  23. package/dist/generateResponse.js +88 -0
  24. package/dist/index.d.ts +13 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +6 -0
  27. package/dist/lib/fetch.d.ts +10 -0
  28. package/dist/lib/fetch.d.ts.map +1 -0
  29. package/dist/lib/fetch.js +68 -0
  30. package/dist/lib/hooks.d.ts +7 -0
  31. package/dist/lib/hooks.d.ts.map +1 -0
  32. package/dist/lib/hooks.js +13 -0
  33. package/dist/lib/networkRequestsCache.d.ts +23 -0
  34. package/dist/lib/networkRequestsCache.d.ts.map +1 -0
  35. package/dist/lib/networkRequestsCache.js +81 -0
  36. package/dist/lib/networkRequestsHistory.d.ts +21 -0
  37. package/dist/lib/networkRequestsHistory.d.ts.map +1 -0
  38. package/dist/lib/networkRequestsHistory.js +119 -0
  39. package/dist/lib/time.d.ts +2 -0
  40. package/dist/lib/time.d.ts.map +1 -0
  41. package/dist/lib/time.js +31 -0
  42. package/dist/lib/utils.d.ts +46 -0
  43. package/dist/lib/utils.d.ts.map +1 -0
  44. package/dist/lib/utils.js +208 -0
  45. package/dist/lib/zod.d.ts +35 -0
  46. package/dist/lib/zod.d.ts.map +1 -0
  47. package/dist/lib/zod.js +290 -0
  48. package/dist/loadUrl.d.ts +45 -0
  49. package/dist/loadUrl.d.ts.map +1 -0
  50. package/dist/loadUrl.js +111 -0
  51. package/dist/plugins/built-in-sources/bluesky/client.d.ts +11 -0
  52. package/dist/plugins/built-in-sources/bluesky/client.d.ts.map +1 -0
  53. package/dist/plugins/built-in-sources/bluesky/client.js +17 -0
  54. package/dist/plugins/built-in-sources/bluesky/index.d.ts +1115 -0
  55. package/dist/plugins/built-in-sources/bluesky/index.d.ts.map +1 -0
  56. package/dist/plugins/built-in-sources/bluesky/index.js +14 -0
  57. package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.d.ts +378 -0
  58. package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.d.ts.map +1 -0
  59. package/dist/plugins/built-in-sources/bluesky/requestHandlers/feed.js +77 -0
  60. package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.d.ts +390 -0
  61. package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.d.ts.map +1 -0
  62. package/dist/plugins/built-in-sources/bluesky/requestHandlers/mediaSearch.js +87 -0
  63. package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.d.ts +351 -0
  64. package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.d.ts.map +1 -0
  65. package/dist/plugins/built-in-sources/bluesky/requestHandlers/singleMedia.js +56 -0
  66. package/dist/plugins/built-in-sources/bluesky/shared.d.ts +53 -0
  67. package/dist/plugins/built-in-sources/bluesky/shared.d.ts.map +1 -0
  68. package/dist/plugins/built-in-sources/bluesky/shared.js +127 -0
  69. package/dist/plugins/built-in-sources/bluesky/types.d.ts +488 -0
  70. package/dist/plugins/built-in-sources/bluesky/types.d.ts.map +1 -0
  71. package/dist/plugins/built-in-sources/bluesky/types.js +48 -0
  72. package/dist/plugins/built-in-sources/giphy/index.d.ts +584 -0
  73. package/dist/plugins/built-in-sources/giphy/index.d.ts.map +1 -0
  74. package/dist/plugins/built-in-sources/giphy/index.js +9 -0
  75. package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.d.ts +310 -0
  76. package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.d.ts.map +1 -0
  77. package/dist/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.js +71 -0
  78. package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.d.ts +274 -0
  79. package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.d.ts.map +1 -0
  80. package/dist/plugins/built-in-sources/giphy/requestHandlers/singleMedia.js +43 -0
  81. package/dist/plugins/built-in-sources/giphy/shared.d.ts +24 -0
  82. package/dist/plugins/built-in-sources/giphy/shared.d.ts.map +1 -0
  83. package/dist/plugins/built-in-sources/giphy/shared.js +30 -0
  84. package/dist/plugins/built-in-sources/giphy/types.d.ts +398 -0
  85. package/dist/plugins/built-in-sources/giphy/types.d.ts.map +1 -0
  86. package/dist/plugins/built-in-sources/giphy/types.js +46 -0
  87. package/dist/plugins/built-in-sources/index.d.ts +1698 -0
  88. package/dist/plugins/built-in-sources/index.d.ts.map +1 -0
  89. package/dist/plugins/built-in-sources/index.js +5 -0
  90. package/dist/schemas/constructor.d.ts +14 -0
  91. package/dist/schemas/constructor.d.ts.map +1 -0
  92. package/dist/schemas/constructor.js +33 -0
  93. package/dist/schemas/file.d.ts +124 -0
  94. package/dist/schemas/file.d.ts.map +1 -0
  95. package/dist/schemas/file.js +28 -0
  96. package/dist/schemas/finderOptions.d.ts +389 -0
  97. package/dist/schemas/finderOptions.d.ts.map +1 -0
  98. package/dist/schemas/finderOptions.js +7 -0
  99. package/dist/schemas/media.d.ts +433 -0
  100. package/dist/schemas/media.d.ts.map +1 -0
  101. package/dist/schemas/media.js +81 -0
  102. package/dist/schemas/plugin.d.ts +298 -0
  103. package/dist/schemas/plugin.d.ts.map +1 -0
  104. package/dist/schemas/plugin.js +19 -0
  105. package/dist/schemas/primitives.d.ts +4 -0
  106. package/dist/schemas/primitives.d.ts.map +1 -0
  107. package/dist/schemas/primitives.js +11 -0
  108. package/dist/schemas/queryOptions.d.ts +19 -0
  109. package/dist/schemas/queryOptions.d.ts.map +1 -0
  110. package/dist/schemas/queryOptions.js +9 -0
  111. package/dist/schemas/request.d.ts +77 -0
  112. package/dist/schemas/request.d.ts.map +1 -0
  113. package/dist/schemas/request.js +21 -0
  114. package/dist/schemas/requestHandler.d.ts +126 -0
  115. package/dist/schemas/requestHandler.d.ts.map +1 -0
  116. package/dist/schemas/requestHandler.js +26 -0
  117. package/dist/schemas/response.d.ts +4673 -0
  118. package/dist/schemas/response.d.ts.map +1 -0
  119. package/dist/schemas/response.js +51 -0
  120. package/dist/schemas/secrets.d.ts +4 -0
  121. package/dist/schemas/secrets.d.ts.map +1 -0
  122. package/dist/schemas/secrets.js +2 -0
  123. package/dist/schemas/source.d.ts +202 -0
  124. package/dist/schemas/source.d.ts.map +1 -0
  125. package/dist/schemas/source.js +10 -0
  126. package/dist/test/fixtures/currentTimeSource.d.ts +53 -0
  127. package/dist/test/fixtures/currentTimeSource.d.ts.map +1 -0
  128. package/dist/test/fixtures/currentTimeSource.js +76 -0
  129. package/dist/test/fixtures/examplePlugin.d.ts +266 -0
  130. package/dist/test/fixtures/examplePlugin.d.ts.map +1 -0
  131. package/dist/test/fixtures/examplePlugin.js +4 -0
  132. package/dist/test/fixtures/exampleSource.d.ts +265 -0
  133. package/dist/test/fixtures/exampleSource.d.ts.map +1 -0
  134. package/dist/test/fixtures/exampleSource.js +107 -0
  135. package/dist/test/testFiles/internal/caching.test.d.ts +2 -0
  136. package/dist/test/testFiles/internal/caching.test.d.ts.map +1 -0
  137. package/dist/test/testFiles/internal/caching.test.js +116 -0
  138. package/dist/test/testFiles/internal/mediaTypeGuessing.test.d.ts +2 -0
  139. package/dist/test/testFiles/internal/mediaTypeGuessing.test.d.ts.map +1 -0
  140. package/dist/test/testFiles/internal/mediaTypeGuessing.test.js +86 -0
  141. package/dist/test/testFiles/sources/bluesky.test.d.ts +2 -0
  142. package/dist/test/testFiles/sources/bluesky.test.d.ts.map +1 -0
  143. package/dist/test/testFiles/sources/bluesky.test.js +40 -0
  144. package/dist/test/testFiles/sources/exampleSource.test.d.ts +2 -0
  145. package/dist/test/testFiles/sources/exampleSource.test.d.ts.map +1 -0
  146. package/dist/test/testFiles/sources/exampleSource.test.js +27 -0
  147. package/dist/test/testFiles/sources/giphy.test.d.ts +2 -0
  148. package/dist/test/testFiles/sources/giphy.test.d.ts.map +1 -0
  149. package/dist/test/testFiles/sources/giphy.test.js +17 -0
  150. package/dist/test/utils/general.d.ts +3 -0
  151. package/dist/test/utils/general.d.ts.map +1 -0
  152. package/dist/test/utils/general.js +24 -0
  153. package/dist/test/utils/globalSetup.d.ts +3 -0
  154. package/dist/test/utils/globalSetup.d.ts.map +1 -0
  155. package/dist/test/utils/globalSetup.js +12 -0
  156. package/dist/test/utils/vitest.d.ts +551 -0
  157. package/dist/test/utils/vitest.d.ts.map +1 -0
  158. package/dist/test/utils/vitest.js +166 -0
  159. package/dist/types.d.ts +16 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/dist/types.js +1 -0
  162. package/package.json +67 -0
@@ -0,0 +1,310 @@
1
+ import { z } from "zod";
2
+ declare const _default: {
3
+ readonly id: "search";
4
+ readonly displayName: "Search";
5
+ readonly description: "Finds gifs that match the given search text";
6
+ readonly requestSchema: z.ZodObject<{
7
+ source: z.ZodString;
8
+ queryType: z.ZodString;
9
+ searchText: z.ZodString;
10
+ cursor: z.ZodOptional<z.ZodNumber>;
11
+ pageSize: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
12
+ contentRating: z.ZodOptional<z.ZodDefault<z.ZodEnum<["y", "g", "pg", "pg-13", "r"]>>>;
13
+ }, "strict", z.ZodTypeAny, {
14
+ source: string;
15
+ queryType: string;
16
+ pageSize: number;
17
+ searchText: string;
18
+ cursor?: number | undefined;
19
+ contentRating?: "g" | "r" | "y" | "pg" | "pg-13" | undefined;
20
+ }, {
21
+ source: string;
22
+ queryType: string;
23
+ searchText: string;
24
+ cursor?: number | undefined;
25
+ pageSize?: number | undefined;
26
+ contentRating?: "g" | "r" | "y" | "pg" | "pg-13" | undefined;
27
+ }>;
28
+ readonly secretsSchema: z.ZodObject<{
29
+ apiKey: z.ZodString;
30
+ }, "strict", z.ZodTypeAny, {
31
+ apiKey: string;
32
+ }, {
33
+ apiKey: string;
34
+ }>;
35
+ readonly paginationType: "cursor";
36
+ readonly responses: [{
37
+ readonly schema: z.ZodObject<{
38
+ page: z.ZodObject<{
39
+ paginationType: z.ZodLiteral<"cursor">;
40
+ cursor: z.ZodNumber;
41
+ nextCursor: z.ZodNumber;
42
+ totalMedia: z.ZodNumber;
43
+ isLastPage: z.ZodBoolean;
44
+ url: z.ZodString;
45
+ pageFetchLimitReached: z.ZodBoolean;
46
+ }, "strict", z.ZodTypeAny, {
47
+ url: string;
48
+ cursor: number;
49
+ paginationType: "cursor";
50
+ totalMedia: number;
51
+ isLastPage: boolean;
52
+ pageFetchLimitReached: boolean;
53
+ nextCursor: number;
54
+ }, {
55
+ url: string;
56
+ cursor: number;
57
+ paginationType: "cursor";
58
+ totalMedia: number;
59
+ isLastPage: boolean;
60
+ pageFetchLimitReached: boolean;
61
+ nextCursor: number;
62
+ }>;
63
+ media: z.ZodArray<z.ZodObject<{
64
+ mediaFinderSource: z.ZodLiteral<"giphy">;
65
+ id: z.ZodString;
66
+ title: z.ZodString;
67
+ url: z.ZodString;
68
+ dateUploaded: z.ZodDate;
69
+ usernameOfUploader: z.ZodString;
70
+ files: z.ZodTuple<[z.ZodObject<{
71
+ url: z.ZodString;
72
+ ext: z.ZodString;
73
+ mimeType: z.ZodString;
74
+ image: z.ZodBoolean;
75
+ video: z.ZodBoolean;
76
+ fileSize: z.ZodNumber;
77
+ width: z.ZodNumber;
78
+ height: z.ZodNumber;
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;
89
+ width: number;
90
+ height: number;
91
+ }, {
92
+ mimeType: string;
93
+ ext: string;
94
+ video: boolean;
95
+ image: boolean;
96
+ url: string;
97
+ type: "full";
98
+ fileSize: number;
99
+ width: number;
100
+ height: number;
101
+ }>, z.ZodObject<{
102
+ url: z.ZodString;
103
+ ext: z.ZodString;
104
+ mimeType: z.ZodString;
105
+ image: z.ZodBoolean;
106
+ video: z.ZodBoolean;
107
+ fileSize: z.ZodNumber;
108
+ width: z.ZodNumber;
109
+ height: z.ZodNumber;
110
+ } & {
111
+ type: z.ZodLiteral<"thumbnail">;
112
+ }, "strict", z.ZodTypeAny, {
113
+ mimeType: string;
114
+ ext: string;
115
+ video: boolean;
116
+ image: boolean;
117
+ url: string;
118
+ type: "thumbnail";
119
+ fileSize: number;
120
+ width: number;
121
+ height: number;
122
+ }, {
123
+ mimeType: string;
124
+ ext: string;
125
+ video: boolean;
126
+ image: boolean;
127
+ url: string;
128
+ type: "thumbnail";
129
+ fileSize: number;
130
+ width: number;
131
+ height: number;
132
+ }>], null>;
133
+ }, "strict", z.ZodTypeAny, {
134
+ url: string;
135
+ id: string;
136
+ mediaFinderSource: "giphy";
137
+ files: [{
138
+ mimeType: string;
139
+ ext: string;
140
+ video: boolean;
141
+ image: boolean;
142
+ url: string;
143
+ type: "full";
144
+ fileSize: number;
145
+ width: number;
146
+ height: number;
147
+ }, {
148
+ mimeType: string;
149
+ ext: string;
150
+ video: boolean;
151
+ image: boolean;
152
+ url: string;
153
+ type: "thumbnail";
154
+ fileSize: number;
155
+ width: number;
156
+ height: number;
157
+ }];
158
+ usernameOfUploader: string;
159
+ title: string;
160
+ dateUploaded: Date;
161
+ }, {
162
+ url: string;
163
+ id: string;
164
+ mediaFinderSource: "giphy";
165
+ files: [{
166
+ mimeType: string;
167
+ ext: string;
168
+ video: boolean;
169
+ image: boolean;
170
+ url: string;
171
+ type: "full";
172
+ fileSize: number;
173
+ width: number;
174
+ height: number;
175
+ }, {
176
+ mimeType: string;
177
+ ext: string;
178
+ video: boolean;
179
+ image: boolean;
180
+ url: string;
181
+ type: "thumbnail";
182
+ fileSize: number;
183
+ width: number;
184
+ height: number;
185
+ }];
186
+ usernameOfUploader: string;
187
+ title: string;
188
+ dateUploaded: Date;
189
+ }>, "many">;
190
+ request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
191
+ }, "strict", z.ZodTypeAny, {
192
+ page: {
193
+ url: string;
194
+ cursor: number;
195
+ paginationType: "cursor";
196
+ totalMedia: number;
197
+ isLastPage: boolean;
198
+ pageFetchLimitReached: boolean;
199
+ nextCursor: number;
200
+ };
201
+ media: {
202
+ url: string;
203
+ id: string;
204
+ mediaFinderSource: "giphy";
205
+ files: [{
206
+ mimeType: string;
207
+ ext: string;
208
+ video: boolean;
209
+ image: boolean;
210
+ url: string;
211
+ type: "full";
212
+ fileSize: number;
213
+ width: number;
214
+ height: number;
215
+ }, {
216
+ mimeType: string;
217
+ ext: string;
218
+ video: boolean;
219
+ image: boolean;
220
+ url: string;
221
+ type: "thumbnail";
222
+ fileSize: number;
223
+ width: number;
224
+ height: number;
225
+ }];
226
+ usernameOfUploader: string;
227
+ title: string;
228
+ dateUploaded: Date;
229
+ }[];
230
+ request: Record<string, unknown>;
231
+ }, {
232
+ page: {
233
+ url: string;
234
+ cursor: number;
235
+ paginationType: "cursor";
236
+ totalMedia: number;
237
+ isLastPage: boolean;
238
+ pageFetchLimitReached: boolean;
239
+ nextCursor: number;
240
+ };
241
+ media: {
242
+ url: string;
243
+ id: string;
244
+ mediaFinderSource: "giphy";
245
+ files: [{
246
+ mimeType: string;
247
+ ext: string;
248
+ video: boolean;
249
+ image: boolean;
250
+ url: string;
251
+ type: "full";
252
+ fileSize: number;
253
+ width: number;
254
+ height: number;
255
+ }, {
256
+ mimeType: string;
257
+ ext: string;
258
+ video: boolean;
259
+ image: boolean;
260
+ url: string;
261
+ type: "thumbnail";
262
+ fileSize: number;
263
+ width: number;
264
+ height: number;
265
+ }];
266
+ usernameOfUploader: string;
267
+ title: string;
268
+ dateUploaded: Date;
269
+ }[];
270
+ request: Record<string, unknown>;
271
+ }>;
272
+ readonly constructor: {
273
+ readonly _setup: ($: import("../../../../ActionContext.js").ActionContext) => Promise<unknown>;
274
+ readonly page: {
275
+ readonly paginationType: () => string;
276
+ readonly cursor: ($: import("../../../../ActionContext.js").ActionContext) => any;
277
+ readonly nextCursor: ($: import("../../../../ActionContext.js").ActionContext) => any;
278
+ readonly totalMedia: ($: import("../../../../ActionContext.js").ActionContext) => any;
279
+ readonly isLastPage: ($: import("../../../../ActionContext.js").ActionContext) => boolean;
280
+ readonly url: ($: import("../../../../ActionContext.js").ActionContext) => string;
281
+ readonly pageFetchLimitReached: ($: import("../../../../ActionContext.js").ActionContext) => boolean | undefined;
282
+ };
283
+ readonly media: {
284
+ _arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => any;
285
+ mediaFinderSource: string;
286
+ id: ($: import("../../../../ActionContext.js").ActionContext) => any;
287
+ title: ($: import("../../../../ActionContext.js").ActionContext) => any;
288
+ url: ($: import("../../../../ActionContext.js").ActionContext) => any;
289
+ dateUploaded: ($: import("../../../../ActionContext.js").ActionContext) => Date;
290
+ usernameOfUploader: ($: import("../../../../ActionContext.js").ActionContext) => any;
291
+ files: {
292
+ _arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => any[];
293
+ _setup: ($: import("../../../../ActionContext.js").ActionContext) => import("../../../../ActionContext.js").ActionContext;
294
+ type: ($: import("../../../../ActionContext.js").ActionContext) => any;
295
+ url: ($: import("../../../../ActionContext.js").ActionContext) => any;
296
+ ext: ($: import("../../../../ActionContext.js").ActionContext) => any;
297
+ mimeType: ($: import("../../../../ActionContext.js").ActionContext) => any;
298
+ image: ($: import("../../../../ActionContext.js").ActionContext) => any;
299
+ video: ($: import("../../../../ActionContext.js").ActionContext) => any;
300
+ fileSize: ($: import("../../../../ActionContext.js").ActionContext) => number;
301
+ width: ($: import("../../../../ActionContext.js").ActionContext) => number;
302
+ height: ($: import("../../../../ActionContext.js").ActionContext) => number;
303
+ }[];
304
+ }[];
305
+ readonly request: ($: import("../../../../ActionContext.js").ActionContext) => Record<string, any>;
306
+ };
307
+ }];
308
+ };
309
+ export default _default;
310
+ //# sourceMappingURL=mediaSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaSearch.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/built-in-sources/giphy/requestHandlers/mediaSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQxB,wBAwEoC"}
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { mediaResponseConstructor } from "../shared.js";
3
+ import { responseSchema } from "../types.js";
4
+ const giphyRatings = ["y", "g", "pg", "pg-13", "r"];
5
+ export default {
6
+ id: "search",
7
+ displayName: "Search",
8
+ description: "Finds gifs that match the given search text",
9
+ requestSchema: z
10
+ .object({
11
+ source: z.string(),
12
+ queryType: z.string(),
13
+ searchText: z.string(),
14
+ cursor: z.number().optional().describe("The page cursor"),
15
+ pageSize: z
16
+ .number()
17
+ .optional()
18
+ .default(10)
19
+ .describe("The max number of items to be returned in a page"),
20
+ contentRating: z
21
+ .enum(giphyRatings)
22
+ .default("g")
23
+ .optional()
24
+ .describe("Highest allowed content rating: https://developers.giphy.com/docs/optional-settings/#rating"),
25
+ })
26
+ .strict(),
27
+ secretsSchema: z
28
+ .object({
29
+ apiKey: z.string(),
30
+ })
31
+ .strict(),
32
+ paginationType: "cursor",
33
+ responses: [
34
+ {
35
+ schema: responseSchema,
36
+ constructor: {
37
+ // We use $.fetch rather than the giphy-api library because giphy-api uses Node's
38
+ // native http/https modules, which bypass the $.fetch caching wrapper. Without
39
+ // caching, Giphy's dynamic ranking causes duplicate GIFs to appear across pages.
40
+ _setup: async ($) => {
41
+ const params = new URLSearchParams({
42
+ api_key: $.secrets.apiKey,
43
+ q: $.request.searchText,
44
+ limit: String($.request.pageSize),
45
+ rating: $.request.contentRating ?? "g",
46
+ ...($.request.cursor !== undefined
47
+ ? { offset: String($.request.cursor) }
48
+ : {}),
49
+ });
50
+ const res = await $.fetch(`https://api.giphy.com/v1/gifs/search?${params}`);
51
+ if (!res.ok) {
52
+ throw new Error(`Giphy API error: ${res.status}`);
53
+ }
54
+ return res.json();
55
+ },
56
+ page: {
57
+ paginationType: () => "cursor",
58
+ cursor: ($) => $().pagination.offset,
59
+ nextCursor: ($) => $().pagination.offset + $().pagination.count,
60
+ totalMedia: ($) => $().pagination.total_count,
61
+ isLastPage: ($) => $().pagination.count + $().pagination.offset >=
62
+ $().pagination.total_count,
63
+ url: ($) => `https://giphy.com/search/${encodeURIComponent($.request.searchText)}`,
64
+ pageFetchLimitReached: ($) => $.pageFetchLimitReached,
65
+ },
66
+ media: mediaResponseConstructor,
67
+ request: ($) => $.request,
68
+ },
69
+ },
70
+ ],
71
+ };
@@ -0,0 +1,274 @@
1
+ import { z } from "zod";
2
+ declare const _default: {
3
+ readonly id: "single-media";
4
+ readonly displayName: "Single media";
5
+ readonly description: "Find gif with given id";
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
+ apiKey: z.ZodString;
21
+ }, "strict", z.ZodTypeAny, {
22
+ apiKey: string;
23
+ }, {
24
+ apiKey: string;
25
+ }>;
26
+ readonly paginationType: "none";
27
+ readonly responses: [{
28
+ readonly schema: z.ZodObject<Omit<{
29
+ page: z.ZodObject<{
30
+ paginationType: z.ZodLiteral<"cursor">;
31
+ cursor: z.ZodNumber;
32
+ nextCursor: z.ZodNumber;
33
+ totalMedia: z.ZodNumber;
34
+ isLastPage: z.ZodBoolean;
35
+ url: z.ZodString;
36
+ pageFetchLimitReached: z.ZodBoolean;
37
+ }, "strict", z.ZodTypeAny, {
38
+ url: string;
39
+ cursor: number;
40
+ paginationType: "cursor";
41
+ totalMedia: number;
42
+ isLastPage: boolean;
43
+ pageFetchLimitReached: boolean;
44
+ nextCursor: number;
45
+ }, {
46
+ url: string;
47
+ cursor: number;
48
+ paginationType: "cursor";
49
+ totalMedia: number;
50
+ isLastPage: boolean;
51
+ pageFetchLimitReached: boolean;
52
+ nextCursor: number;
53
+ }>;
54
+ media: z.ZodArray<z.ZodObject<{
55
+ mediaFinderSource: z.ZodLiteral<"giphy">;
56
+ id: z.ZodString;
57
+ title: z.ZodString;
58
+ url: z.ZodString;
59
+ dateUploaded: z.ZodDate;
60
+ usernameOfUploader: z.ZodString;
61
+ files: z.ZodTuple<[z.ZodObject<{
62
+ url: z.ZodString;
63
+ ext: z.ZodString;
64
+ mimeType: z.ZodString;
65
+ image: z.ZodBoolean;
66
+ video: z.ZodBoolean;
67
+ fileSize: z.ZodNumber;
68
+ width: z.ZodNumber;
69
+ height: z.ZodNumber;
70
+ } & {
71
+ type: z.ZodLiteral<"full">;
72
+ }, "strict", z.ZodTypeAny, {
73
+ mimeType: string;
74
+ ext: string;
75
+ video: boolean;
76
+ image: boolean;
77
+ url: string;
78
+ type: "full";
79
+ fileSize: number;
80
+ width: number;
81
+ height: number;
82
+ }, {
83
+ mimeType: string;
84
+ ext: string;
85
+ video: boolean;
86
+ image: boolean;
87
+ url: string;
88
+ type: "full";
89
+ fileSize: number;
90
+ width: number;
91
+ height: number;
92
+ }>, z.ZodObject<{
93
+ url: z.ZodString;
94
+ ext: z.ZodString;
95
+ mimeType: z.ZodString;
96
+ image: z.ZodBoolean;
97
+ video: z.ZodBoolean;
98
+ fileSize: z.ZodNumber;
99
+ width: z.ZodNumber;
100
+ height: z.ZodNumber;
101
+ } & {
102
+ type: z.ZodLiteral<"thumbnail">;
103
+ }, "strict", z.ZodTypeAny, {
104
+ mimeType: string;
105
+ ext: string;
106
+ video: boolean;
107
+ image: boolean;
108
+ url: string;
109
+ type: "thumbnail";
110
+ fileSize: number;
111
+ width: number;
112
+ height: number;
113
+ }, {
114
+ mimeType: string;
115
+ ext: string;
116
+ video: boolean;
117
+ image: boolean;
118
+ url: string;
119
+ type: "thumbnail";
120
+ fileSize: number;
121
+ width: number;
122
+ height: number;
123
+ }>], null>;
124
+ }, "strict", z.ZodTypeAny, {
125
+ url: string;
126
+ id: string;
127
+ mediaFinderSource: "giphy";
128
+ files: [{
129
+ mimeType: string;
130
+ ext: string;
131
+ video: boolean;
132
+ image: boolean;
133
+ url: string;
134
+ type: "full";
135
+ fileSize: number;
136
+ width: number;
137
+ height: number;
138
+ }, {
139
+ mimeType: string;
140
+ ext: string;
141
+ video: boolean;
142
+ image: boolean;
143
+ url: string;
144
+ type: "thumbnail";
145
+ fileSize: number;
146
+ width: number;
147
+ height: number;
148
+ }];
149
+ usernameOfUploader: string;
150
+ title: string;
151
+ dateUploaded: Date;
152
+ }, {
153
+ url: string;
154
+ id: string;
155
+ mediaFinderSource: "giphy";
156
+ files: [{
157
+ mimeType: string;
158
+ ext: string;
159
+ video: boolean;
160
+ image: boolean;
161
+ url: string;
162
+ type: "full";
163
+ fileSize: number;
164
+ width: number;
165
+ height: number;
166
+ }, {
167
+ mimeType: string;
168
+ ext: string;
169
+ video: boolean;
170
+ image: boolean;
171
+ url: string;
172
+ type: "thumbnail";
173
+ fileSize: number;
174
+ width: number;
175
+ height: number;
176
+ }];
177
+ usernameOfUploader: string;
178
+ title: string;
179
+ dateUploaded: Date;
180
+ }>, "many">;
181
+ request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
182
+ }, "page">, "strict", z.ZodTypeAny, {
183
+ media: {
184
+ url: string;
185
+ id: string;
186
+ mediaFinderSource: "giphy";
187
+ files: [{
188
+ mimeType: string;
189
+ ext: string;
190
+ video: boolean;
191
+ image: boolean;
192
+ url: string;
193
+ type: "full";
194
+ fileSize: number;
195
+ width: number;
196
+ height: number;
197
+ }, {
198
+ mimeType: string;
199
+ ext: string;
200
+ video: boolean;
201
+ image: boolean;
202
+ url: string;
203
+ type: "thumbnail";
204
+ fileSize: number;
205
+ width: number;
206
+ height: number;
207
+ }];
208
+ usernameOfUploader: string;
209
+ title: string;
210
+ dateUploaded: Date;
211
+ }[];
212
+ request: Record<string, unknown>;
213
+ }, {
214
+ media: {
215
+ url: string;
216
+ id: string;
217
+ mediaFinderSource: "giphy";
218
+ files: [{
219
+ mimeType: string;
220
+ ext: string;
221
+ video: boolean;
222
+ image: boolean;
223
+ url: string;
224
+ type: "full";
225
+ fileSize: number;
226
+ width: number;
227
+ height: number;
228
+ }, {
229
+ mimeType: string;
230
+ ext: string;
231
+ video: boolean;
232
+ image: boolean;
233
+ url: string;
234
+ type: "thumbnail";
235
+ fileSize: number;
236
+ width: number;
237
+ height: number;
238
+ }];
239
+ usernameOfUploader: string;
240
+ title: string;
241
+ dateUploaded: Date;
242
+ }[];
243
+ request: Record<string, unknown>;
244
+ }>;
245
+ readonly constructor: {
246
+ readonly _setup: ($: import("../../../../ActionContext.js").ActionContext) => Promise<unknown>;
247
+ readonly media: {
248
+ _arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => any;
249
+ mediaFinderSource: string;
250
+ id: ($: import("../../../../ActionContext.js").ActionContext) => any;
251
+ title: ($: import("../../../../ActionContext.js").ActionContext) => any;
252
+ url: ($: import("../../../../ActionContext.js").ActionContext) => any;
253
+ dateUploaded: ($: import("../../../../ActionContext.js").ActionContext) => Date;
254
+ usernameOfUploader: ($: import("../../../../ActionContext.js").ActionContext) => any;
255
+ files: {
256
+ _arrayMap: ($: import("../../../../ActionContext.js").ActionContext) => any[];
257
+ _setup: ($: import("../../../../ActionContext.js").ActionContext) => import("../../../../ActionContext.js").ActionContext;
258
+ type: ($: import("../../../../ActionContext.js").ActionContext) => any;
259
+ url: ($: import("../../../../ActionContext.js").ActionContext) => any;
260
+ ext: ($: import("../../../../ActionContext.js").ActionContext) => any;
261
+ mimeType: ($: import("../../../../ActionContext.js").ActionContext) => any;
262
+ image: ($: import("../../../../ActionContext.js").ActionContext) => any;
263
+ video: ($: import("../../../../ActionContext.js").ActionContext) => any;
264
+ fileSize: ($: import("../../../../ActionContext.js").ActionContext) => number;
265
+ width: ($: import("../../../../ActionContext.js").ActionContext) => number;
266
+ height: ($: import("../../../../ActionContext.js").ActionContext) => number;
267
+ }[];
268
+ }[];
269
+ readonly request: ($: import("../../../../ActionContext.js").ActionContext) => Record<string, any>;
270
+ };
271
+ }];
272
+ };
273
+ export default _default;
274
+ //# sourceMappingURL=singleMedia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleMedia.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/built-in-sources/giphy/requestHandlers/singleMedia.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMxB,wBAuCoC"}