@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,266 @@
1
+ declare const _default: {
2
+ sources: {
3
+ readonly id: "example-source";
4
+ readonly displayName: "Example Source";
5
+ readonly description: "";
6
+ readonly requestHandlers: [{
7
+ readonly id: "single-media";
8
+ readonly displayName: "Single media";
9
+ readonly description: "";
10
+ readonly requestSchema: import("zod").ZodObject<{
11
+ source: import("zod").ZodString;
12
+ queryType: import("zod").ZodString;
13
+ id: import("zod").ZodString;
14
+ }, "strict", import("zod").ZodTypeAny, {
15
+ source: string;
16
+ queryType: string;
17
+ id: string;
18
+ }, {
19
+ source: string;
20
+ queryType: string;
21
+ id: string;
22
+ }>;
23
+ readonly paginationType: "none";
24
+ readonly responses: [{
25
+ readonly schema: import("zod").ZodObject<Omit<{
26
+ page: import("zod").ZodObject<{
27
+ paginationType: import("zod").ZodLiteral<"offset">;
28
+ pageNumber: import("zod").ZodNumber;
29
+ isLastPage: import("zod").ZodBoolean;
30
+ pageFetchLimitReached: import("zod").ZodBoolean;
31
+ }, "strict", import("zod").ZodTypeAny, {
32
+ pageNumber: number;
33
+ paginationType: "offset";
34
+ pageFetchLimitReached: boolean;
35
+ isLastPage: boolean;
36
+ }, {
37
+ pageNumber: number;
38
+ paginationType: "offset";
39
+ pageFetchLimitReached: boolean;
40
+ isLastPage: boolean;
41
+ }>;
42
+ media: import("zod").ZodArray<import("zod").ZodObject<{
43
+ mediaFinderSource: import("zod").ZodLiteral<"example-source">;
44
+ id: import("zod").ZodString;
45
+ title: import("zod").ZodString;
46
+ files: import("zod").ZodArray<import("zod").ZodObject<{
47
+ type: import("zod").ZodLiteral<"full">;
48
+ url: import("zod").ZodString;
49
+ ext: import("zod").ZodString;
50
+ }, "strict", import("zod").ZodTypeAny, {
51
+ type: "full";
52
+ url: string;
53
+ ext: string;
54
+ }, {
55
+ type: "full";
56
+ url: string;
57
+ ext: string;
58
+ }>, "many">;
59
+ }, "strict", import("zod").ZodTypeAny, {
60
+ mediaFinderSource: "example-source";
61
+ id: string;
62
+ title: string;
63
+ files: {
64
+ type: "full";
65
+ url: string;
66
+ ext: string;
67
+ }[];
68
+ }, {
69
+ mediaFinderSource: "example-source";
70
+ id: string;
71
+ title: string;
72
+ files: {
73
+ type: "full";
74
+ url: string;
75
+ ext: string;
76
+ }[];
77
+ }>, "many">;
78
+ request: import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>;
79
+ }, "page">, "strict", import("zod").ZodTypeAny, {
80
+ request: {} & {
81
+ [k: string]: unknown;
82
+ };
83
+ media: {
84
+ mediaFinderSource: "example-source";
85
+ id: string;
86
+ title: string;
87
+ files: {
88
+ type: "full";
89
+ url: string;
90
+ ext: string;
91
+ }[];
92
+ }[];
93
+ }, {
94
+ request: {} & {
95
+ [k: string]: unknown;
96
+ };
97
+ media: {
98
+ mediaFinderSource: "example-source";
99
+ id: string;
100
+ title: string;
101
+ files: {
102
+ type: "full";
103
+ url: string;
104
+ ext: string;
105
+ }[];
106
+ }[];
107
+ }>;
108
+ readonly constructor: {
109
+ readonly _setup: ($: import("../../ActionContext.js").ActionContext) => Promise<{
110
+ statusCode: number;
111
+ headers: Record<string, string>;
112
+ cached: boolean;
113
+ cachedOn: Date | null;
114
+ request: {
115
+ headers: Record<string, string>;
116
+ };
117
+ } & {
118
+ root: import("../../DomSelection.js").DomSelection;
119
+ }>;
120
+ readonly media: [{
121
+ readonly mediaFinderSource: () => string;
122
+ readonly id: "1234";
123
+ readonly title: ($: import("../../ActionContext.js").ActionContext) => any;
124
+ readonly files: [];
125
+ }];
126
+ readonly request: ($: import("../../ActionContext.js").ActionContext) => Record<string, any>;
127
+ };
128
+ }];
129
+ }, {
130
+ readonly id: "search-media";
131
+ readonly displayName: "Search media";
132
+ readonly description: "";
133
+ readonly requestSchema: import("zod").ZodObject<{
134
+ source: import("zod").ZodString;
135
+ queryType: import("zod").ZodString;
136
+ searchText: import("zod").ZodString;
137
+ pageNumber: import("zod").ZodDefault<import("zod").ZodNumber>;
138
+ }, "strict", import("zod").ZodTypeAny, {
139
+ source: string;
140
+ queryType: string;
141
+ pageNumber: number;
142
+ searchText: string;
143
+ }, {
144
+ source: string;
145
+ queryType: string;
146
+ searchText: string;
147
+ pageNumber?: number | undefined;
148
+ }>;
149
+ readonly paginationType: "offset";
150
+ readonly responses: [{
151
+ readonly schema: import("zod").ZodObject<{
152
+ page: import("zod").ZodObject<{
153
+ paginationType: import("zod").ZodLiteral<"offset">;
154
+ pageNumber: import("zod").ZodNumber;
155
+ isLastPage: import("zod").ZodBoolean;
156
+ pageFetchLimitReached: import("zod").ZodBoolean;
157
+ }, "strict", import("zod").ZodTypeAny, {
158
+ pageNumber: number;
159
+ paginationType: "offset";
160
+ pageFetchLimitReached: boolean;
161
+ isLastPage: boolean;
162
+ }, {
163
+ pageNumber: number;
164
+ paginationType: "offset";
165
+ pageFetchLimitReached: boolean;
166
+ isLastPage: boolean;
167
+ }>;
168
+ media: import("zod").ZodArray<import("zod").ZodObject<{
169
+ mediaFinderSource: import("zod").ZodLiteral<"example-source">;
170
+ id: import("zod").ZodString;
171
+ title: import("zod").ZodString;
172
+ files: import("zod").ZodArray<import("zod").ZodObject<{
173
+ type: import("zod").ZodLiteral<"full">;
174
+ url: import("zod").ZodString;
175
+ ext: import("zod").ZodString;
176
+ }, "strict", import("zod").ZodTypeAny, {
177
+ type: "full";
178
+ url: string;
179
+ ext: string;
180
+ }, {
181
+ type: "full";
182
+ url: string;
183
+ ext: string;
184
+ }>, "many">;
185
+ }, "strict", import("zod").ZodTypeAny, {
186
+ mediaFinderSource: "example-source";
187
+ id: string;
188
+ title: string;
189
+ files: {
190
+ type: "full";
191
+ url: string;
192
+ ext: string;
193
+ }[];
194
+ }, {
195
+ mediaFinderSource: "example-source";
196
+ id: string;
197
+ title: string;
198
+ files: {
199
+ type: "full";
200
+ url: string;
201
+ ext: string;
202
+ }[];
203
+ }>, "many">;
204
+ request: import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>;
205
+ }, "strict", import("zod").ZodTypeAny, {
206
+ request: {} & {
207
+ [k: string]: unknown;
208
+ };
209
+ media: {
210
+ mediaFinderSource: "example-source";
211
+ id: string;
212
+ title: string;
213
+ files: {
214
+ type: "full";
215
+ url: string;
216
+ ext: string;
217
+ }[];
218
+ }[];
219
+ page: {
220
+ pageNumber: number;
221
+ paginationType: "offset";
222
+ pageFetchLimitReached: boolean;
223
+ isLastPage: boolean;
224
+ };
225
+ }, {
226
+ request: {} & {
227
+ [k: string]: unknown;
228
+ };
229
+ media: {
230
+ mediaFinderSource: "example-source";
231
+ id: string;
232
+ title: string;
233
+ files: {
234
+ type: "full";
235
+ url: string;
236
+ ext: string;
237
+ }[];
238
+ }[];
239
+ page: {
240
+ pageNumber: number;
241
+ paginationType: "offset";
242
+ pageFetchLimitReached: boolean;
243
+ isLastPage: boolean;
244
+ };
245
+ }>;
246
+ readonly constructor: {
247
+ readonly page: {
248
+ readonly paginationType: "offset";
249
+ readonly pageNumber: ($: import("../../ActionContext.js").ActionContext) => any;
250
+ readonly isLastPage: ($: import("../../ActionContext.js").ActionContext) => boolean;
251
+ readonly pageFetchLimitReached: ($: import("../../ActionContext.js").ActionContext) => boolean | undefined;
252
+ };
253
+ readonly media: [{
254
+ readonly mediaFinderSource: "example-source";
255
+ readonly id: ($: import("../../ActionContext.js").ActionContext) => string;
256
+ readonly title: "Media Title";
257
+ readonly files: [];
258
+ }];
259
+ readonly request: ($: import("../../ActionContext.js").ActionContext) => Record<string, any>;
260
+ };
261
+ }];
262
+ }];
263
+ }[];
264
+ };
265
+ export default _default;
266
+ //# sourceMappingURL=examplePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"examplePlugin.d.ts","sourceRoot":"","sources":["../../../test/fixtures/examplePlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAEmB"}
@@ -0,0 +1,4 @@
1
+ import exampleSource from "./exampleSource.js";
2
+ export default {
3
+ sources: [exampleSource],
4
+ };
@@ -0,0 +1,265 @@
1
+ import { z } from "zod";
2
+ declare const _default: {
3
+ readonly id: "example-source";
4
+ readonly displayName: "Example Source";
5
+ readonly description: "";
6
+ readonly requestHandlers: [{
7
+ readonly id: "single-media";
8
+ readonly displayName: "Single media";
9
+ readonly description: "";
10
+ readonly requestSchema: z.ZodObject<{
11
+ source: z.ZodString;
12
+ queryType: z.ZodString;
13
+ id: z.ZodString;
14
+ }, "strict", z.ZodTypeAny, {
15
+ source: string;
16
+ queryType: string;
17
+ id: string;
18
+ }, {
19
+ source: string;
20
+ queryType: string;
21
+ id: string;
22
+ }>;
23
+ readonly paginationType: "none";
24
+ readonly responses: [{
25
+ readonly schema: z.ZodObject<Omit<{
26
+ page: z.ZodObject<{
27
+ paginationType: z.ZodLiteral<"offset">;
28
+ pageNumber: z.ZodNumber;
29
+ isLastPage: z.ZodBoolean;
30
+ pageFetchLimitReached: z.ZodBoolean;
31
+ }, "strict", z.ZodTypeAny, {
32
+ pageNumber: number;
33
+ paginationType: "offset";
34
+ pageFetchLimitReached: boolean;
35
+ isLastPage: boolean;
36
+ }, {
37
+ pageNumber: number;
38
+ paginationType: "offset";
39
+ pageFetchLimitReached: boolean;
40
+ isLastPage: boolean;
41
+ }>;
42
+ media: z.ZodArray<z.ZodObject<{
43
+ mediaFinderSource: z.ZodLiteral<"example-source">;
44
+ id: z.ZodString;
45
+ title: z.ZodString;
46
+ files: z.ZodArray<z.ZodObject<{
47
+ type: z.ZodLiteral<"full">;
48
+ url: z.ZodString;
49
+ ext: z.ZodString;
50
+ }, "strict", z.ZodTypeAny, {
51
+ type: "full";
52
+ url: string;
53
+ ext: string;
54
+ }, {
55
+ type: "full";
56
+ url: string;
57
+ ext: string;
58
+ }>, "many">;
59
+ }, "strict", z.ZodTypeAny, {
60
+ mediaFinderSource: "example-source";
61
+ id: string;
62
+ title: string;
63
+ files: {
64
+ type: "full";
65
+ url: string;
66
+ ext: string;
67
+ }[];
68
+ }, {
69
+ mediaFinderSource: "example-source";
70
+ id: string;
71
+ title: string;
72
+ files: {
73
+ type: "full";
74
+ url: string;
75
+ ext: string;
76
+ }[];
77
+ }>, "many">;
78
+ request: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
79
+ }, "page">, "strict", z.ZodTypeAny, {
80
+ request: {} & {
81
+ [k: string]: unknown;
82
+ };
83
+ media: {
84
+ mediaFinderSource: "example-source";
85
+ id: string;
86
+ title: string;
87
+ files: {
88
+ type: "full";
89
+ url: string;
90
+ ext: string;
91
+ }[];
92
+ }[];
93
+ }, {
94
+ request: {} & {
95
+ [k: string]: unknown;
96
+ };
97
+ media: {
98
+ mediaFinderSource: "example-source";
99
+ id: string;
100
+ title: string;
101
+ files: {
102
+ type: "full";
103
+ url: string;
104
+ ext: string;
105
+ }[];
106
+ }[];
107
+ }>;
108
+ readonly constructor: {
109
+ readonly _setup: ($: import("../../ActionContext.js").ActionContext) => Promise<{
110
+ statusCode: number;
111
+ headers: Record<string, string>;
112
+ cached: boolean;
113
+ cachedOn: Date | null;
114
+ request: {
115
+ headers: Record<string, string>;
116
+ };
117
+ } & {
118
+ root: import("../../DomSelection.js").DomSelection;
119
+ }>;
120
+ readonly media: [{
121
+ readonly mediaFinderSource: () => string;
122
+ readonly id: "1234";
123
+ readonly title: ($: import("../../ActionContext.js").ActionContext) => any;
124
+ readonly files: [];
125
+ }];
126
+ readonly request: ($: import("../../ActionContext.js").ActionContext) => Record<string, any>;
127
+ };
128
+ }];
129
+ }, {
130
+ readonly id: "search-media";
131
+ readonly displayName: "Search media";
132
+ readonly description: "";
133
+ readonly requestSchema: z.ZodObject<{
134
+ source: z.ZodString;
135
+ queryType: z.ZodString;
136
+ searchText: z.ZodString;
137
+ pageNumber: z.ZodDefault<z.ZodNumber>;
138
+ }, "strict", z.ZodTypeAny, {
139
+ source: string;
140
+ queryType: string;
141
+ pageNumber: number;
142
+ searchText: string;
143
+ }, {
144
+ source: string;
145
+ queryType: string;
146
+ searchText: string;
147
+ pageNumber?: number | undefined;
148
+ }>;
149
+ readonly paginationType: "offset";
150
+ readonly responses: [{
151
+ readonly schema: z.ZodObject<{
152
+ page: z.ZodObject<{
153
+ paginationType: z.ZodLiteral<"offset">;
154
+ pageNumber: z.ZodNumber;
155
+ isLastPage: z.ZodBoolean;
156
+ pageFetchLimitReached: z.ZodBoolean;
157
+ }, "strict", z.ZodTypeAny, {
158
+ pageNumber: number;
159
+ paginationType: "offset";
160
+ pageFetchLimitReached: boolean;
161
+ isLastPage: boolean;
162
+ }, {
163
+ pageNumber: number;
164
+ paginationType: "offset";
165
+ pageFetchLimitReached: boolean;
166
+ isLastPage: boolean;
167
+ }>;
168
+ media: z.ZodArray<z.ZodObject<{
169
+ mediaFinderSource: z.ZodLiteral<"example-source">;
170
+ id: z.ZodString;
171
+ title: z.ZodString;
172
+ files: z.ZodArray<z.ZodObject<{
173
+ type: z.ZodLiteral<"full">;
174
+ url: z.ZodString;
175
+ ext: z.ZodString;
176
+ }, "strict", z.ZodTypeAny, {
177
+ type: "full";
178
+ url: string;
179
+ ext: string;
180
+ }, {
181
+ type: "full";
182
+ url: string;
183
+ ext: string;
184
+ }>, "many">;
185
+ }, "strict", z.ZodTypeAny, {
186
+ mediaFinderSource: "example-source";
187
+ id: string;
188
+ title: string;
189
+ files: {
190
+ type: "full";
191
+ url: string;
192
+ ext: string;
193
+ }[];
194
+ }, {
195
+ mediaFinderSource: "example-source";
196
+ id: string;
197
+ title: string;
198
+ files: {
199
+ type: "full";
200
+ url: string;
201
+ ext: string;
202
+ }[];
203
+ }>, "many">;
204
+ request: z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>;
205
+ }, "strict", z.ZodTypeAny, {
206
+ request: {} & {
207
+ [k: string]: unknown;
208
+ };
209
+ media: {
210
+ mediaFinderSource: "example-source";
211
+ id: string;
212
+ title: string;
213
+ files: {
214
+ type: "full";
215
+ url: string;
216
+ ext: string;
217
+ }[];
218
+ }[];
219
+ page: {
220
+ pageNumber: number;
221
+ paginationType: "offset";
222
+ pageFetchLimitReached: boolean;
223
+ isLastPage: boolean;
224
+ };
225
+ }, {
226
+ request: {} & {
227
+ [k: string]: unknown;
228
+ };
229
+ media: {
230
+ mediaFinderSource: "example-source";
231
+ id: string;
232
+ title: string;
233
+ files: {
234
+ type: "full";
235
+ url: string;
236
+ ext: string;
237
+ }[];
238
+ }[];
239
+ page: {
240
+ pageNumber: number;
241
+ paginationType: "offset";
242
+ pageFetchLimitReached: boolean;
243
+ isLastPage: boolean;
244
+ };
245
+ }>;
246
+ readonly constructor: {
247
+ readonly page: {
248
+ readonly paginationType: "offset";
249
+ readonly pageNumber: ($: import("../../ActionContext.js").ActionContext) => any;
250
+ readonly isLastPage: ($: import("../../ActionContext.js").ActionContext) => boolean;
251
+ readonly pageFetchLimitReached: ($: import("../../ActionContext.js").ActionContext) => boolean | undefined;
252
+ };
253
+ readonly media: [{
254
+ readonly mediaFinderSource: "example-source";
255
+ readonly id: ($: import("../../ActionContext.js").ActionContext) => string;
256
+ readonly title: "Media Title";
257
+ readonly files: [];
258
+ }];
259
+ readonly request: ($: import("../../ActionContext.js").ActionContext) => Record<string, any>;
260
+ };
261
+ }];
262
+ }];
263
+ };
264
+ export default _default;
265
+ //# sourceMappingURL=exampleSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exampleSource.d.ts","sourceRoot":"","sources":["../../../test/fixtures/exampleSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCxB,wBA2E4B"}
@@ -0,0 +1,107 @@
1
+ import { z } from "zod";
2
+ const sourceName = "Example Source";
3
+ const sourceId = "example-source";
4
+ const exampleFileSchema = z
5
+ .object({
6
+ type: z.literal("full"),
7
+ url: z.string().url(),
8
+ ext: z.string().regex(/^\w+$/),
9
+ })
10
+ .strict();
11
+ const exampleMediaSchema = z
12
+ .object({
13
+ mediaFinderSource: z.literal(sourceId),
14
+ id: z.string(),
15
+ title: z.string(),
16
+ files: z.array(exampleFileSchema),
17
+ })
18
+ .strict();
19
+ const exampleResponseSchema = z
20
+ .object({
21
+ page: z
22
+ .object({
23
+ paginationType: z.literal("offset"),
24
+ pageNumber: z.number().int(),
25
+ isLastPage: z.boolean(),
26
+ pageFetchLimitReached: z.boolean(),
27
+ })
28
+ .strict(),
29
+ media: z.array(exampleMediaSchema),
30
+ request: z.object({}).passthrough(),
31
+ })
32
+ .strict();
33
+ export default {
34
+ id: sourceId,
35
+ displayName: sourceName,
36
+ description: "",
37
+ requestHandlers: [
38
+ {
39
+ id: "single-media",
40
+ displayName: "Single media",
41
+ description: "",
42
+ requestSchema: z
43
+ .object({
44
+ source: z.string(),
45
+ queryType: z.string(),
46
+ id: z.string(),
47
+ })
48
+ .strict(),
49
+ paginationType: "none",
50
+ responses: [
51
+ {
52
+ schema: exampleResponseSchema.omit({ page: true }),
53
+ constructor: {
54
+ _setup: ($) => $.loadUrl("https://example.com/"),
55
+ media: [
56
+ {
57
+ mediaFinderSource: () => sourceId,
58
+ id: "1234",
59
+ title: ($) => $.request.id === "test-getWebpage"
60
+ ? $().root.select("h1")
61
+ : "Media Title",
62
+ files: [],
63
+ },
64
+ ],
65
+ request: ($) => $.request,
66
+ },
67
+ },
68
+ ],
69
+ },
70
+ {
71
+ id: "search-media",
72
+ displayName: "Search media",
73
+ description: "",
74
+ requestSchema: z
75
+ .object({
76
+ source: z.string(),
77
+ queryType: z.string(),
78
+ searchText: z.string(),
79
+ pageNumber: z.number().default(1),
80
+ })
81
+ .strict(),
82
+ paginationType: "offset",
83
+ responses: [
84
+ {
85
+ schema: exampleResponseSchema,
86
+ constructor: {
87
+ page: {
88
+ paginationType: "offset",
89
+ pageNumber: ($) => $.request.pageNumber ?? 1,
90
+ isLastPage: ($) => $.request.pageNumber >= 2,
91
+ pageFetchLimitReached: ($) => $.pageFetchLimitReached,
92
+ },
93
+ media: [
94
+ {
95
+ mediaFinderSource: sourceId,
96
+ id: ($) => `${$.request.pageNumber}-a`,
97
+ title: "Media Title",
98
+ files: [],
99
+ },
100
+ ],
101
+ request: ($) => $.request,
102
+ },
103
+ },
104
+ ],
105
+ },
106
+ ],
107
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=caching.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caching.test.d.ts","sourceRoot":"","sources":["../../../../test/testFiles/internal/caching.test.ts"],"names":[],"mappings":""}