@expandai/sdk 0.17.0 → 0.17.2

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 (360) hide show
  1. package/LICENSE +2 -1
  2. package/README.md +83 -307
  3. package/build/dts/Client.d.ts +61 -0
  4. package/build/dts/Client.d.ts.map +1 -0
  5. package/build/dts/Error.d.ts +90 -0
  6. package/build/dts/Error.d.ts.map +1 -0
  7. package/build/dts/FetchJson.d.ts +363 -0
  8. package/build/dts/FetchJson.d.ts.map +1 -0
  9. package/build/dts/Generated.d.ts +1896 -0
  10. package/build/dts/Generated.d.ts.map +1 -0
  11. package/build/dts/HttpClientHelpers.d.ts +5 -0
  12. package/build/dts/HttpClientHelpers.d.ts.map +1 -0
  13. package/build/dts/Internal.d.ts +49 -0
  14. package/build/dts/Internal.d.ts.map +1 -0
  15. package/build/dts/Playground.d.ts +24 -0
  16. package/build/dts/Playground.d.ts.map +1 -0
  17. package/build/dts/Service.d.ts +283 -0
  18. package/build/dts/Service.d.ts.map +1 -0
  19. package/build/dts/index.d.ts +6 -0
  20. package/build/dts/index.d.ts.map +1 -0
  21. package/build/esm/Client.js +87 -0
  22. package/build/esm/Client.js.map +1 -0
  23. package/build/esm/Error.js +91 -0
  24. package/build/esm/Error.js.map +1 -0
  25. package/build/esm/FetchJson.js +70 -0
  26. package/build/esm/FetchJson.js.map +1 -0
  27. package/build/esm/Generated.js +651 -0
  28. package/build/esm/Generated.js.map +1 -0
  29. package/build/esm/HttpClientHelpers.js +14 -0
  30. package/build/esm/HttpClientHelpers.js.map +1 -0
  31. package/build/esm/Internal.js +95 -0
  32. package/build/esm/Internal.js.map +1 -0
  33. package/build/esm/Playground.js +55 -0
  34. package/build/esm/Playground.js.map +1 -0
  35. package/build/esm/Service.js +174 -0
  36. package/build/esm/Service.js.map +1 -0
  37. package/build/esm/index.js +4 -0
  38. package/build/esm/index.js.map +1 -0
  39. package/package.json +72 -136
  40. package/src/Client.ts +128 -0
  41. package/src/Error.ts +105 -0
  42. package/src/FetchJson.ts +109 -0
  43. package/src/Generated.ts +960 -0
  44. package/src/HttpClientHelpers.ts +24 -0
  45. package/src/Internal.ts +246 -0
  46. package/src/Playground.ts +76 -0
  47. package/src/Service.ts +264 -0
  48. package/src/index.ts +27 -21
  49. package/CHANGELOG.md +0 -238
  50. package/api-promise.d.mts +0 -2
  51. package/api-promise.d.mts.map +0 -1
  52. package/api-promise.d.ts +0 -2
  53. package/api-promise.d.ts.map +0 -1
  54. package/api-promise.js +0 -6
  55. package/api-promise.js.map +0 -1
  56. package/api-promise.mjs +0 -2
  57. package/api-promise.mjs.map +0 -1
  58. package/client.d.mts +0 -184
  59. package/client.d.mts.map +0 -1
  60. package/client.d.ts +0 -184
  61. package/client.d.ts.map +0 -1
  62. package/client.js +0 -476
  63. package/client.js.map +0 -1
  64. package/client.mjs +0 -472
  65. package/client.mjs.map +0 -1
  66. package/core/api-promise.d.mts +0 -46
  67. package/core/api-promise.d.mts.map +0 -1
  68. package/core/api-promise.d.ts +0 -46
  69. package/core/api-promise.d.ts.map +0 -1
  70. package/core/api-promise.js +0 -74
  71. package/core/api-promise.js.map +0 -1
  72. package/core/api-promise.mjs +0 -70
  73. package/core/api-promise.mjs.map +0 -1
  74. package/core/error.d.mts +0 -46
  75. package/core/error.d.mts.map +0 -1
  76. package/core/error.d.ts +0 -46
  77. package/core/error.d.ts.map +0 -1
  78. package/core/error.js +0 -113
  79. package/core/error.js.map +0 -1
  80. package/core/error.mjs +0 -97
  81. package/core/error.mjs.map +0 -1
  82. package/core/resource.d.mts +0 -6
  83. package/core/resource.d.mts.map +0 -1
  84. package/core/resource.d.ts +0 -6
  85. package/core/resource.d.ts.map +0 -1
  86. package/core/resource.js +0 -11
  87. package/core/resource.js.map +0 -1
  88. package/core/resource.mjs +0 -7
  89. package/core/resource.mjs.map +0 -1
  90. package/core/uploads.d.mts +0 -3
  91. package/core/uploads.d.mts.map +0 -1
  92. package/core/uploads.d.ts +0 -3
  93. package/core/uploads.d.ts.map +0 -1
  94. package/core/uploads.js +0 -6
  95. package/core/uploads.js.map +0 -1
  96. package/core/uploads.mjs +0 -2
  97. package/core/uploads.mjs.map +0 -1
  98. package/error.d.mts +0 -2
  99. package/error.d.mts.map +0 -1
  100. package/error.d.ts +0 -2
  101. package/error.d.ts.map +0 -1
  102. package/error.js +0 -6
  103. package/error.js.map +0 -1
  104. package/error.mjs +0 -2
  105. package/error.mjs.map +0 -1
  106. package/index.d.mts +0 -6
  107. package/index.d.mts.map +0 -1
  108. package/index.d.ts +0 -6
  109. package/index.d.ts.map +0 -1
  110. package/index.js +0 -30
  111. package/index.js.map +0 -1
  112. package/index.mjs +0 -7
  113. package/index.mjs.map +0 -1
  114. package/internal/builtin-types.d.mts +0 -73
  115. package/internal/builtin-types.d.mts.map +0 -1
  116. package/internal/builtin-types.d.ts +0 -73
  117. package/internal/builtin-types.d.ts.map +0 -1
  118. package/internal/builtin-types.js +0 -4
  119. package/internal/builtin-types.js.map +0 -1
  120. package/internal/builtin-types.mjs +0 -3
  121. package/internal/builtin-types.mjs.map +0 -1
  122. package/internal/detect-platform.d.mts +0 -15
  123. package/internal/detect-platform.d.mts.map +0 -1
  124. package/internal/detect-platform.d.ts +0 -15
  125. package/internal/detect-platform.d.ts.map +0 -1
  126. package/internal/detect-platform.js +0 -162
  127. package/internal/detect-platform.js.map +0 -1
  128. package/internal/detect-platform.mjs +0 -157
  129. package/internal/detect-platform.mjs.map +0 -1
  130. package/internal/errors.d.mts +0 -3
  131. package/internal/errors.d.mts.map +0 -1
  132. package/internal/errors.d.ts +0 -3
  133. package/internal/errors.d.ts.map +0 -1
  134. package/internal/errors.js +0 -41
  135. package/internal/errors.js.map +0 -1
  136. package/internal/errors.mjs +0 -36
  137. package/internal/errors.mjs.map +0 -1
  138. package/internal/headers.d.mts +0 -20
  139. package/internal/headers.d.mts.map +0 -1
  140. package/internal/headers.d.ts +0 -20
  141. package/internal/headers.d.ts.map +0 -1
  142. package/internal/headers.js +0 -79
  143. package/internal/headers.js.map +0 -1
  144. package/internal/headers.mjs +0 -74
  145. package/internal/headers.mjs.map +0 -1
  146. package/internal/parse.d.mts +0 -12
  147. package/internal/parse.d.mts.map +0 -1
  148. package/internal/parse.d.ts +0 -12
  149. package/internal/parse.d.ts.map +0 -1
  150. package/internal/parse.js +0 -40
  151. package/internal/parse.js.map +0 -1
  152. package/internal/parse.mjs +0 -37
  153. package/internal/parse.mjs.map +0 -1
  154. package/internal/request-options.d.mts +0 -75
  155. package/internal/request-options.d.mts.map +0 -1
  156. package/internal/request-options.d.ts +0 -75
  157. package/internal/request-options.d.ts.map +0 -1
  158. package/internal/request-options.js +0 -14
  159. package/internal/request-options.js.map +0 -1
  160. package/internal/request-options.mjs +0 -10
  161. package/internal/request-options.mjs.map +0 -1
  162. package/internal/shim-types.d.mts +0 -17
  163. package/internal/shim-types.d.mts.map +0 -1
  164. package/internal/shim-types.d.ts +0 -17
  165. package/internal/shim-types.d.ts.map +0 -1
  166. package/internal/shim-types.js +0 -4
  167. package/internal/shim-types.js.map +0 -1
  168. package/internal/shim-types.mjs +0 -3
  169. package/internal/shim-types.mjs.map +0 -1
  170. package/internal/shims.d.mts +0 -20
  171. package/internal/shims.d.mts.map +0 -1
  172. package/internal/shims.d.ts +0 -20
  173. package/internal/shims.d.ts.map +0 -1
  174. package/internal/shims.js +0 -92
  175. package/internal/shims.js.map +0 -1
  176. package/internal/shims.mjs +0 -85
  177. package/internal/shims.mjs.map +0 -1
  178. package/internal/to-file.d.mts +0 -45
  179. package/internal/to-file.d.mts.map +0 -1
  180. package/internal/to-file.d.ts +0 -45
  181. package/internal/to-file.d.ts.map +0 -1
  182. package/internal/to-file.js +0 -91
  183. package/internal/to-file.js.map +0 -1
  184. package/internal/to-file.mjs +0 -88
  185. package/internal/to-file.mjs.map +0 -1
  186. package/internal/tslib.js +0 -81
  187. package/internal/tslib.mjs +0 -17
  188. package/internal/types.d.mts +0 -69
  189. package/internal/types.d.mts.map +0 -1
  190. package/internal/types.d.ts +0 -69
  191. package/internal/types.d.ts.map +0 -1
  192. package/internal/types.js +0 -4
  193. package/internal/types.js.map +0 -1
  194. package/internal/types.mjs +0 -3
  195. package/internal/types.mjs.map +0 -1
  196. package/internal/uploads.d.mts +0 -42
  197. package/internal/uploads.d.mts.map +0 -1
  198. package/internal/uploads.d.ts +0 -42
  199. package/internal/uploads.d.ts.map +0 -1
  200. package/internal/uploads.js +0 -141
  201. package/internal/uploads.js.map +0 -1
  202. package/internal/uploads.mjs +0 -131
  203. package/internal/uploads.mjs.map +0 -1
  204. package/internal/utils/base64.d.mts +0 -3
  205. package/internal/utils/base64.d.mts.map +0 -1
  206. package/internal/utils/base64.d.ts +0 -3
  207. package/internal/utils/base64.d.ts.map +0 -1
  208. package/internal/utils/base64.js +0 -38
  209. package/internal/utils/base64.js.map +0 -1
  210. package/internal/utils/base64.mjs +0 -33
  211. package/internal/utils/base64.mjs.map +0 -1
  212. package/internal/utils/bytes.d.mts +0 -4
  213. package/internal/utils/bytes.d.mts.map +0 -1
  214. package/internal/utils/bytes.d.ts +0 -4
  215. package/internal/utils/bytes.d.ts.map +0 -1
  216. package/internal/utils/bytes.js +0 -31
  217. package/internal/utils/bytes.js.map +0 -1
  218. package/internal/utils/bytes.mjs +0 -26
  219. package/internal/utils/bytes.mjs.map +0 -1
  220. package/internal/utils/env.d.mts +0 -9
  221. package/internal/utils/env.d.mts.map +0 -1
  222. package/internal/utils/env.d.ts +0 -9
  223. package/internal/utils/env.d.ts.map +0 -1
  224. package/internal/utils/env.js +0 -22
  225. package/internal/utils/env.js.map +0 -1
  226. package/internal/utils/env.mjs +0 -18
  227. package/internal/utils/env.mjs.map +0 -1
  228. package/internal/utils/log.d.mts +0 -37
  229. package/internal/utils/log.d.mts.map +0 -1
  230. package/internal/utils/log.d.ts +0 -37
  231. package/internal/utils/log.d.ts.map +0 -1
  232. package/internal/utils/log.js +0 -86
  233. package/internal/utils/log.js.map +0 -1
  234. package/internal/utils/log.mjs +0 -80
  235. package/internal/utils/log.mjs.map +0 -1
  236. package/internal/utils/path.d.mts +0 -15
  237. package/internal/utils/path.d.mts.map +0 -1
  238. package/internal/utils/path.d.ts +0 -15
  239. package/internal/utils/path.d.ts.map +0 -1
  240. package/internal/utils/path.js +0 -79
  241. package/internal/utils/path.js.map +0 -1
  242. package/internal/utils/path.mjs +0 -74
  243. package/internal/utils/path.mjs.map +0 -1
  244. package/internal/utils/sleep.d.mts +0 -2
  245. package/internal/utils/sleep.d.mts.map +0 -1
  246. package/internal/utils/sleep.d.ts +0 -2
  247. package/internal/utils/sleep.d.ts.map +0 -1
  248. package/internal/utils/sleep.js +0 -7
  249. package/internal/utils/sleep.js.map +0 -1
  250. package/internal/utils/sleep.mjs +0 -3
  251. package/internal/utils/sleep.mjs.map +0 -1
  252. package/internal/utils/uuid.d.mts +0 -5
  253. package/internal/utils/uuid.d.mts.map +0 -1
  254. package/internal/utils/uuid.d.ts +0 -5
  255. package/internal/utils/uuid.d.ts.map +0 -1
  256. package/internal/utils/uuid.js +0 -19
  257. package/internal/utils/uuid.js.map +0 -1
  258. package/internal/utils/uuid.mjs +0 -15
  259. package/internal/utils/uuid.mjs.map +0 -1
  260. package/internal/utils/values.d.mts +0 -18
  261. package/internal/utils/values.d.mts.map +0 -1
  262. package/internal/utils/values.d.ts +0 -18
  263. package/internal/utils/values.d.ts.map +0 -1
  264. package/internal/utils/values.js +0 -112
  265. package/internal/utils/values.js.map +0 -1
  266. package/internal/utils/values.mjs +0 -94
  267. package/internal/utils/values.mjs.map +0 -1
  268. package/internal/utils.d.mts +0 -7
  269. package/internal/utils.d.mts.map +0 -1
  270. package/internal/utils.d.ts +0 -7
  271. package/internal/utils.d.ts.map +0 -1
  272. package/internal/utils.js +0 -11
  273. package/internal/utils.js.map +0 -1
  274. package/internal/utils.mjs +0 -8
  275. package/internal/utils.mjs.map +0 -1
  276. package/resource.d.mts +0 -2
  277. package/resource.d.mts.map +0 -1
  278. package/resource.d.ts +0 -2
  279. package/resource.d.ts.map +0 -1
  280. package/resource.js +0 -6
  281. package/resource.js.map +0 -1
  282. package/resource.mjs +0 -2
  283. package/resource.mjs.map +0 -1
  284. package/resources/index.d.mts +0 -2
  285. package/resources/index.d.mts.map +0 -1
  286. package/resources/index.d.ts +0 -2
  287. package/resources/index.d.ts.map +0 -1
  288. package/resources/index.js +0 -4
  289. package/resources/index.js.map +0 -1
  290. package/resources/index.mjs +0 -3
  291. package/resources/index.mjs.map +0 -1
  292. package/resources/top-level.d.mts +0 -469
  293. package/resources/top-level.d.mts.map +0 -1
  294. package/resources/top-level.d.ts +0 -469
  295. package/resources/top-level.d.ts.map +0 -1
  296. package/resources/top-level.js +0 -4
  297. package/resources/top-level.js.map +0 -1
  298. package/resources/top-level.mjs +0 -3
  299. package/resources/top-level.mjs.map +0 -1
  300. package/resources.d.mts +0 -2
  301. package/resources.d.mts.map +0 -1
  302. package/resources.d.ts +0 -2
  303. package/resources.d.ts.map +0 -1
  304. package/resources.js +0 -5
  305. package/resources.js.map +0 -1
  306. package/resources.mjs +0 -2
  307. package/resources.mjs.map +0 -1
  308. package/src/api-promise.ts +0 -2
  309. package/src/client.ts +0 -744
  310. package/src/core/README.md +0 -3
  311. package/src/core/api-promise.ts +0 -92
  312. package/src/core/error.ts +0 -130
  313. package/src/core/resource.ts +0 -11
  314. package/src/core/uploads.ts +0 -2
  315. package/src/error.ts +0 -2
  316. package/src/internal/README.md +0 -3
  317. package/src/internal/builtin-types.ts +0 -93
  318. package/src/internal/detect-platform.ts +0 -196
  319. package/src/internal/errors.ts +0 -33
  320. package/src/internal/headers.ts +0 -97
  321. package/src/internal/parse.ts +0 -56
  322. package/src/internal/request-options.ts +0 -91
  323. package/src/internal/shim-types.ts +0 -26
  324. package/src/internal/shims.ts +0 -107
  325. package/src/internal/to-file.ts +0 -154
  326. package/src/internal/types.ts +0 -95
  327. package/src/internal/uploads.ts +0 -187
  328. package/src/internal/utils/base64.ts +0 -40
  329. package/src/internal/utils/bytes.ts +0 -32
  330. package/src/internal/utils/env.ts +0 -18
  331. package/src/internal/utils/log.ts +0 -127
  332. package/src/internal/utils/path.ts +0 -88
  333. package/src/internal/utils/sleep.ts +0 -3
  334. package/src/internal/utils/uuid.ts +0 -17
  335. package/src/internal/utils/values.ts +0 -105
  336. package/src/internal/utils.ts +0 -8
  337. package/src/lib/.keep +0 -4
  338. package/src/resource.ts +0 -2
  339. package/src/resources/index.ts +0 -3
  340. package/src/resources/top-level.ts +0 -552
  341. package/src/resources.ts +0 -1
  342. package/src/tsconfig.json +0 -11
  343. package/src/uploads.ts +0 -2
  344. package/src/version.ts +0 -1
  345. package/uploads.d.mts +0 -2
  346. package/uploads.d.mts.map +0 -1
  347. package/uploads.d.ts +0 -2
  348. package/uploads.d.ts.map +0 -1
  349. package/uploads.js +0 -6
  350. package/uploads.js.map +0 -1
  351. package/uploads.mjs +0 -2
  352. package/uploads.mjs.map +0 -1
  353. package/version.d.mts +0 -2
  354. package/version.d.mts.map +0 -1
  355. package/version.d.ts +0 -2
  356. package/version.d.ts.map +0 -1
  357. package/version.js +0 -5
  358. package/version.js.map +0 -1
  359. package/version.mjs +0 -2
  360. package/version.mjs.map +0 -1
@@ -0,0 +1,960 @@
1
+ /** @effect-diagnostics schemaStructWithTag:skip-file */
2
+ import type * as HttpClient from '@effect/platform/HttpClient'
3
+ import * as HttpClientError from '@effect/platform/HttpClientError'
4
+ import * as HttpClientRequest from '@effect/platform/HttpClientRequest'
5
+ import * as HttpClientResponse from '@effect/platform/HttpClientResponse'
6
+ import * as UrlParams from '@effect/platform/UrlParams'
7
+ import * as Effect from 'effect/Effect'
8
+ import type { ParseError } from 'effect/ParseResult'
9
+ import * as S from 'effect/Schema'
10
+
11
+ export class FetchFetchParams extends S.Struct({
12
+ include: S.optionalWith(S.String, { nullable: true }),
13
+ }) {}
14
+
15
+ export class FetchFetchRequest extends S.Class<FetchFetchRequest>('FetchFetchRequest')({
16
+ url: S.String,
17
+ include: S.optionalWith(
18
+ S.Struct({
19
+ html: S.optionalWith(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Unknown })), { nullable: true }),
20
+ markdown: S.optionalWith(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Unknown })), { nullable: true }),
21
+ screenshot: S.optionalWith(
22
+ S.Union(
23
+ S.Boolean,
24
+ S.Struct({
25
+ fullPage: S.optionalWith(S.Boolean, { nullable: true }),
26
+ }),
27
+ ),
28
+ { nullable: true },
29
+ ),
30
+ summary: S.optionalWith(
31
+ S.Union(
32
+ S.Boolean,
33
+ S.Struct({
34
+ prompt: S.optionalWith(S.String.pipe(S.maxLength(5000)), { nullable: true }),
35
+ }),
36
+ ),
37
+ { nullable: true },
38
+ ),
39
+ links: S.optionalWith(
40
+ S.Union(
41
+ S.Boolean,
42
+ S.Struct({
43
+ sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
44
+ includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
45
+ excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
46
+ }),
47
+ ),
48
+ { nullable: true },
49
+ ),
50
+ meta: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
51
+ response: S.optionalWith(
52
+ S.Struct({
53
+ includeHeaders: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
54
+ }),
55
+ { nullable: true },
56
+ ),
57
+ json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
58
+ appendix: S.optionalWith(S.Boolean, { nullable: true }),
59
+ }),
60
+ { nullable: true },
61
+ ),
62
+ search: S.optionalWith(
63
+ S.Struct({
64
+ query: S.String,
65
+ maxResults: S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50)), {
66
+ nullable: true,
67
+ default: () => 5 as const,
68
+ }),
69
+ minScore: S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), {
70
+ nullable: true,
71
+ default: () => 0.6 as const,
72
+ }),
73
+ }),
74
+ { nullable: true },
75
+ ),
76
+ browserConfig: S.optionalWith(
77
+ S.Struct({
78
+ scrollFullPage: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
79
+ }),
80
+ { nullable: true },
81
+ ),
82
+ }) {}
83
+
84
+ export class IssueTag extends S.Literal(
85
+ 'Pointer',
86
+ 'Unexpected',
87
+ 'Missing',
88
+ 'Composite',
89
+ 'Refinement',
90
+ 'Transformation',
91
+ 'Type',
92
+ 'Forbidden',
93
+ ) {}
94
+
95
+ export class PropertyKeyEnumTag extends S.Literal('symbol') {}
96
+
97
+ export class PropertyKey extends S.Union(
98
+ S.String,
99
+ S.Number,
100
+ S.Struct({
101
+ _tag: PropertyKeyEnumTag,
102
+ key: S.String,
103
+ }),
104
+ ) {}
105
+
106
+ export class Issue extends S.Struct({
107
+ _tag: IssueTag,
108
+ path: S.Array(PropertyKey),
109
+ message: S.String,
110
+ }) {}
111
+
112
+ export class HttpApiDecodeErrorTag extends S.Literal('HttpApiDecodeError') {}
113
+
114
+ export class HttpApiDecodeError extends S.Struct({
115
+ issues: S.Array(Issue),
116
+ message: S.String,
117
+ _tag: HttpApiDecodeErrorTag,
118
+ }) {}
119
+
120
+ export class BadRequestTag extends S.Literal('BadRequest') {}
121
+
122
+ export class BadRequest extends S.Struct({
123
+ message: S.String,
124
+ _tag: BadRequestTag,
125
+ }) {}
126
+
127
+ export class FetchFetch400 extends S.Union(HttpApiDecodeError, BadRequest) {}
128
+
129
+ export class AuthFailedReason extends S.Literal('InvalidApiKey', 'InvalidToken', 'InvalidSession', 'InvalidTenant') {}
130
+
131
+ export class AuthFailedTag extends S.Literal('AuthFailed') {}
132
+
133
+ export class AuthFailed extends S.Class<AuthFailed>('AuthFailed')({
134
+ reason: AuthFailedReason,
135
+ description: S.optionalWith(
136
+ S.Union(
137
+ S.String,
138
+ S.Struct({
139
+ message: S.String,
140
+ }),
141
+ ),
142
+ { nullable: true },
143
+ ),
144
+ _tag: AuthFailedTag,
145
+ }) {}
146
+
147
+ export class DateTimeUtc extends S.String {}
148
+
149
+ export class FetchBlockedTag extends S.Literal('FetchBlocked') {}
150
+
151
+ export class FetchBlocked extends S.Struct({
152
+ url: S.String,
153
+ blockedType: S.optionalWith(S.String, { nullable: true }),
154
+ _tag: FetchBlockedTag,
155
+ }) {}
156
+
157
+ export class FetchFetch403 extends S.Union(
158
+ S.Struct({
159
+ organizationId: S.String.pipe(S.minLength(1)),
160
+ blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
161
+ _tag: S.Literal('AccessBlocked'),
162
+ }),
163
+ FetchBlocked,
164
+ ) {}
165
+
166
+ export class PayloadTooLargeTag extends S.Literal('PayloadTooLarge') {}
167
+
168
+ export class PayloadTooLarge extends S.Class<PayloadTooLarge>('PayloadTooLarge')({
169
+ _tag: PayloadTooLargeTag,
170
+ }) {}
171
+
172
+ export class TooManyRequestsTag extends S.Literal('TooManyRequests') {}
173
+
174
+ export class TooManyRequests extends S.Class<TooManyRequests>('TooManyRequests')({
175
+ _tag: TooManyRequestsTag,
176
+ }) {}
177
+
178
+ export class InternalErrorTag extends S.Literal('InternalError') {}
179
+
180
+ export class InternalError extends S.Class<InternalError>('InternalError')({
181
+ _tag: InternalErrorTag,
182
+ }) {}
183
+
184
+ export class ServiceUnavailableTag extends S.Literal('ServiceUnavailable') {}
185
+
186
+ export class ServiceUnavailable extends S.Class<ServiceUnavailable>('ServiceUnavailable')({
187
+ _tag: ServiceUnavailableTag,
188
+ }) {}
189
+
190
+ export class FetchFetchJsonParams extends S.Struct({
191
+ include: S.optionalWith(S.String, { nullable: true }),
192
+ }) {}
193
+
194
+ export class FetchFetchJsonRequest extends S.Class<FetchFetchJsonRequest>('FetchFetchJsonRequest')({
195
+ url: S.String,
196
+ include: S.optionalWith(
197
+ S.Struct({
198
+ html: S.optionalWith(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Unknown })), { nullable: true }),
199
+ markdown: S.optionalWith(S.Union(S.Boolean, S.Record({ key: S.String, value: S.Unknown })), { nullable: true }),
200
+ screenshot: S.optionalWith(
201
+ S.Union(
202
+ S.Boolean,
203
+ S.Struct({
204
+ fullPage: S.optionalWith(S.Boolean, { nullable: true }),
205
+ }),
206
+ ),
207
+ { nullable: true },
208
+ ),
209
+ summary: S.optionalWith(
210
+ S.Union(
211
+ S.Boolean,
212
+ S.Struct({
213
+ prompt: S.optionalWith(S.String.pipe(S.maxLength(5000)), { nullable: true }),
214
+ }),
215
+ ),
216
+ { nullable: true },
217
+ ),
218
+ links: S.optionalWith(
219
+ S.Union(
220
+ S.Boolean,
221
+ S.Struct({
222
+ sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
223
+ includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
224
+ excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
225
+ }),
226
+ ),
227
+ { nullable: true },
228
+ ),
229
+ meta: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
230
+ response: S.optionalWith(
231
+ S.Struct({
232
+ includeHeaders: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
233
+ }),
234
+ { nullable: true },
235
+ ),
236
+ json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
237
+ appendix: S.optionalWith(S.Boolean, { nullable: true }),
238
+ }),
239
+ { nullable: true },
240
+ ),
241
+ search: S.optionalWith(
242
+ S.Struct({
243
+ query: S.String,
244
+ maxResults: S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50)), {
245
+ nullable: true,
246
+ default: () => 5 as const,
247
+ }),
248
+ minScore: S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), {
249
+ nullable: true,
250
+ default: () => 0.6 as const,
251
+ }),
252
+ }),
253
+ { nullable: true },
254
+ ),
255
+ browserConfig: S.optionalWith(
256
+ S.Struct({
257
+ scrollFullPage: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
258
+ }),
259
+ { nullable: true },
260
+ ),
261
+ }) {}
262
+
263
+ export class FetchObjectModeMetaVersion extends S.Literal(1) {}
264
+
265
+ export class FetchObjectModeAppendixLinks extends S.Struct({
266
+ sameDomain: S.Number,
267
+ external: S.Number,
268
+ }) {}
269
+
270
+ export class FetchObjectModeAppendixHint extends S.Struct({
271
+ url: S.String,
272
+ links: FetchObjectModeAppendixLinks,
273
+ }) {}
274
+
275
+ export class FetchObjectModeStateJsonHint extends S.Struct({
276
+ moreTokens: S.Number,
277
+ }) {}
278
+
279
+ export class FetchObjectModeMarkdownHint extends S.Struct({
280
+ url: S.String,
281
+ moreTokens: S.Number,
282
+ }) {}
283
+
284
+ export class FetchObjectModeMeta extends S.Struct({
285
+ version: FetchObjectModeMetaVersion,
286
+ url: S.String,
287
+ capturedAt: S.String,
288
+ snapshotId: S.String,
289
+ lang: S.String,
290
+ pageType: S.String,
291
+ playground: S.String,
292
+ title: S.optionalWith(S.String, { nullable: true }),
293
+ finalUrl: S.optionalWith(S.String, { nullable: true }),
294
+ canonical: S.optionalWith(S.String, { nullable: true }),
295
+ description: S.optionalWith(S.String, { nullable: true }),
296
+ author: S.optionalWith(S.String, { nullable: true }),
297
+ createdAt: S.optionalWith(S.String, { nullable: true }),
298
+ updatedAt: S.optionalWith(S.String, { nullable: true }),
299
+ image: S.optionalWith(S.String, { nullable: true }),
300
+ paginationNext: S.optionalWith(S.String, { nullable: true }),
301
+ appendix: S.optionalWith(FetchObjectModeAppendixHint, { nullable: true }),
302
+ stateJson: S.optionalWith(FetchObjectModeStateJsonHint, { nullable: true }),
303
+ markdown: S.optionalWith(FetchObjectModeMarkdownHint, { nullable: true }),
304
+ blocked: S.optionalWith(S.String, { nullable: true }),
305
+ loadingStatus: S.optionalWith(S.String, { nullable: true }),
306
+ }) {}
307
+
308
+ export class FetchObjectModeEvidenceKind extends S.Literal('inline', 'network') {}
309
+
310
+ export class FetchObjectModeEvidenceRole extends S.Literal(
311
+ 'ld+json',
312
+ 'next-data',
313
+ 'nuxt',
314
+ 'apollo-state',
315
+ 'initial-state',
316
+ 'application-json',
317
+ 'script-tag',
318
+ 'data-attribute',
319
+ 'network-json',
320
+ 'network-response',
321
+ 'other',
322
+ ) {}
323
+
324
+ export class FetchObjectModeEvidence extends S.Struct({
325
+ id: S.Number,
326
+ kind: FetchObjectModeEvidenceKind,
327
+ role: FetchObjectModeEvidenceRole,
328
+ score: S.Number,
329
+ url: S.optionalWith(S.String, { nullable: true }),
330
+ method: S.optionalWith(S.String, { nullable: true }),
331
+ moreTokens: S.optionalWith(S.Number, { nullable: true }),
332
+ keys: S.optionalWith(S.Array(S.String), { nullable: true }),
333
+ }) {}
334
+
335
+ export class FetchAssetReferenceKind extends S.Literal('data-url') {}
336
+
337
+ export class FetchAssetReference extends S.Struct({
338
+ id: S.String,
339
+ kind: FetchAssetReferenceKind,
340
+ placeholder: S.String,
341
+ archiveKey: S.String,
342
+ mimeType: S.String,
343
+ sha256: S.String,
344
+ bytes: S.Number,
345
+ }) {}
346
+
347
+ export class CaptureTelemetryInfoRequestedStyleMode extends S.Literal('compat_full', 'native_default') {}
348
+
349
+ export class CaptureTelemetryInfoSelected extends S.Literal('rust') {}
350
+
351
+ export class CaptureTelemetryInfoActual extends S.Literal('rust') {}
352
+
353
+ export class CaptureTelemetryInfoActualStyleMode extends S.Literal('compat_full', 'native_default') {}
354
+
355
+ export class CaptureTelemetryInfoIconBackendDecision extends S.Literal('cpu', 'remote_gpu') {}
356
+
357
+ export class CaptureTelemetryInfo extends S.Struct({
358
+ requestedStyleMode: S.optionalWith(CaptureTelemetryInfoRequestedStyleMode, { nullable: true }),
359
+ selected: CaptureTelemetryInfoSelected,
360
+ actual: CaptureTelemetryInfoActual,
361
+ actualStyleMode: S.optionalWith(CaptureTelemetryInfoActualStyleMode, { nullable: true }),
362
+ rolloutApplied: S.Boolean,
363
+ preparedSessionHit: S.optionalWith(S.Boolean, { nullable: true }),
364
+ nativePoolHit: S.optionalWith(S.Boolean, { nullable: true }),
365
+ nativePoolCapacity: S.optionalWith(S.Number, { nullable: true }),
366
+ nativePoolProfile: S.optionalWith(S.String, { nullable: true }),
367
+ poolHit: S.optionalWith(S.Boolean, { nullable: true }),
368
+ connectMs: S.optionalWith(S.Number, { nullable: true }),
369
+ warmConnectionAgeMs: S.optionalWith(S.Number, { nullable: true }),
370
+ iconBackendDecision: S.optionalWith(CaptureTelemetryInfoIconBackendDecision, { nullable: true }),
371
+ }) {}
372
+
373
+ export class FetchSearchSnippetLocation extends S.Struct({
374
+ markdownBlockId: S.optionalWith(S.String, { nullable: true }),
375
+ nodeIds: S.optionalWith(S.Array(S.Number), { nullable: true }),
376
+ stateJsonSourceId: S.optionalWith(S.Number, { nullable: true }),
377
+ jsonPath: S.optionalWith(S.String, { nullable: true }),
378
+ }) {}
379
+
380
+ export class FetchSearchSourceMetaSource extends S.Literal('markdown', 'appendix', 'statejson') {}
381
+
382
+ export class FetchSearchSourceMetaRanker extends S.Literal('zeroentropy', 'local_lexical') {}
383
+
384
+ export class FetchSearchSourceMetaFallbackReason extends S.Literal('timeout', 'error') {}
385
+
386
+ export class FetchSearchSourceMeta extends S.Struct({
387
+ source: FetchSearchSourceMetaSource,
388
+ chunkCount: S.Int.pipe(S.greaterThanOrEqualTo(0)),
389
+ batchCount: S.Int.pipe(S.greaterThanOrEqualTo(0)),
390
+ ranker: FetchSearchSourceMetaRanker,
391
+ fallback: S.Boolean,
392
+ fallbackReason: S.optionalWith(FetchSearchSourceMetaFallbackReason, { nullable: true }),
393
+ durationMs: S.Number.pipe(S.greaterThanOrEqualTo(0)),
394
+ }) {}
395
+
396
+ export class FetchSearchMeta extends S.Struct({
397
+ durationMs: S.Number.pipe(S.greaterThanOrEqualTo(0)),
398
+ sources: S.Array(FetchSearchSourceMeta),
399
+ }) {}
400
+
401
+ export class FetchSearchResult extends S.Struct({
402
+ query: S.String,
403
+ snippets: S.Array(
404
+ S.Struct({
405
+ type: S.optionalWith(S.Literal('text'), { nullable: true, default: () => 'text' as const }),
406
+ source: S.Literal('markdown', 'appendix', 'statejson'),
407
+ text: S.String,
408
+ score: S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)),
409
+ location: S.optionalWith(FetchSearchSnippetLocation, { nullable: true }),
410
+ }),
411
+ ),
412
+ meta: S.optionalWith(FetchSearchMeta, { nullable: true }),
413
+ }) {}
414
+
415
+ export class FetchObjectModeResult extends S.Class<FetchObjectModeResult>('FetchObjectModeResult')({
416
+ meta: FetchObjectModeMeta,
417
+ markdown: S.String,
418
+ json: S.Array(FetchObjectModeEvidence),
419
+ data: S.optionalWith(
420
+ S.Struct({
421
+ assets: S.optionalWith(S.Array(FetchAssetReference), { nullable: true }),
422
+ captureTelemetry: S.optionalWith(CaptureTelemetryInfo, { nullable: true }),
423
+ search: S.optionalWith(FetchSearchResult, { nullable: true }),
424
+ screenshot: S.optionalWith(
425
+ S.Struct({
426
+ url: S.String,
427
+ fullPage: S.Boolean,
428
+ }),
429
+ { nullable: true },
430
+ ),
431
+ }),
432
+ { nullable: true },
433
+ ),
434
+ }) {}
435
+
436
+ export class FetchFetchJson400 extends S.Union(HttpApiDecodeError, BadRequest) {}
437
+
438
+ export class FetchFetchJson403 extends S.Union(
439
+ S.Struct({
440
+ organizationId: S.String.pipe(S.minLength(1)),
441
+ blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
442
+ _tag: S.Literal('AccessBlocked'),
443
+ }),
444
+ FetchBlocked,
445
+ ) {}
446
+
447
+ export class IncludeHtmlConfig extends S.Record({ key: S.String, value: S.Unknown }) {}
448
+
449
+ export class IncludeMarkdownConfig extends S.Record({ key: S.String, value: S.Unknown }) {}
450
+
451
+ export class IncludeScreenshotConfig extends S.Struct({
452
+ fullPage: S.optionalWith(S.Boolean, { nullable: true }),
453
+ }) {}
454
+
455
+ export class FetchFetchSearchRequest extends S.Class<FetchFetchSearchRequest>('FetchFetchSearchRequest')({
456
+ snapshotId: S.String.pipe(S.minLength(1)),
457
+ search: S.Struct({
458
+ query: S.String,
459
+ maxResults: S.optionalWith(S.Int.pipe(S.greaterThanOrEqualTo(1), S.lessThanOrEqualTo(50)), {
460
+ nullable: true,
461
+ default: () => 5 as const,
462
+ }),
463
+ minScore: S.optionalWith(S.Number.pipe(S.greaterThanOrEqualTo(0), S.lessThanOrEqualTo(1)), {
464
+ nullable: true,
465
+ default: () => 0.6 as const,
466
+ }),
467
+ }),
468
+ include: S.optionalWith(
469
+ S.Struct({
470
+ html: S.optionalWith(S.Union(S.Boolean, IncludeHtmlConfig), { nullable: true }),
471
+ markdown: S.optionalWith(S.Union(S.Boolean, IncludeMarkdownConfig), { nullable: true }),
472
+ screenshot: S.optionalWith(S.Union(S.Boolean, IncludeScreenshotConfig), { nullable: true }),
473
+ summary: S.optionalWith(
474
+ S.Union(
475
+ S.Boolean,
476
+ S.Struct({
477
+ prompt: S.optionalWith(S.String.pipe(S.maxLength(5000)), {
478
+ nullable: true,
479
+ default: () =>
480
+ 'You are a helpful assistant that summarizes web page content.\nGiven the markdown content of a web page, provide a clear and concise summary.\nFocus on the main points and key information.\nKeep the summary informative but brief.' as const,
481
+ }),
482
+ }),
483
+ ),
484
+ { nullable: true },
485
+ ),
486
+ links: S.optionalWith(
487
+ S.Union(
488
+ S.Boolean,
489
+ S.Struct({
490
+ sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
491
+ includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
492
+ excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
493
+ }),
494
+ ),
495
+ { nullable: true },
496
+ ),
497
+ meta: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
498
+ response: S.optionalWith(
499
+ S.Struct({
500
+ includeHeaders: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
501
+ }),
502
+ { nullable: true },
503
+ ),
504
+ json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
505
+ appendix: S.optionalWith(S.Boolean, { nullable: true }),
506
+ }),
507
+ { nullable: true },
508
+ ),
509
+ }) {}
510
+
511
+ export class URL extends S.String {}
512
+
513
+ export class ResponseInfo extends S.Struct({
514
+ url: S.String,
515
+ requestedUrl: S.optionalWith(URL, { nullable: true }),
516
+ originStatusCode: S.optionalWith(S.Number, { nullable: true }),
517
+ redirectStatusCode: S.optionalWith(S.Number, { nullable: true }),
518
+ headers: S.optionalWith(S.Struct({}), { nullable: true }),
519
+ }) {}
520
+
521
+ export class FetchSnapshotSearchResult extends S.Class<FetchSnapshotSearchResult>('FetchSnapshotSearchResult')({
522
+ snapshotId: S.String.pipe(S.minLength(1)),
523
+ response: ResponseInfo,
524
+ search: FetchSearchResult,
525
+ durationMs: S.Number.pipe(S.greaterThanOrEqualTo(0)),
526
+ }) {}
527
+
528
+ export class FetchFetchSearch400 extends S.Union(HttpApiDecodeError, BadRequest) {}
529
+
530
+ export class FetchFetchSearch403Tag extends S.Literal('AccessBlocked') {}
531
+
532
+ export class FetchFetchSearch403 extends S.Struct({
533
+ organizationId: S.String.pipe(S.minLength(1)),
534
+ blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
535
+ _tag: FetchFetchSearch403Tag,
536
+ }) {}
537
+
538
+ export class NonEmptyString extends S.String.pipe(S.minLength(1)) {}
539
+
540
+ export class FetchSnapshotSearchNotFoundTag extends S.Literal('FetchSnapshotSearchNotFound') {}
541
+
542
+ export class FetchSnapshotSearchNotFound extends S.Class<FetchSnapshotSearchNotFound>('FetchSnapshotSearchNotFound')({
543
+ snapshotId: NonEmptyString,
544
+ _tag: FetchSnapshotSearchNotFoundTag,
545
+ }) {}
546
+
547
+ export class FetchBatchedRequest extends S.Class<FetchBatchedRequest>('FetchBatchedRequest')({
548
+ urls: S.NonEmptyArray(S.String),
549
+ include: S.optionalWith(
550
+ S.Struct({
551
+ html: S.optionalWith(S.Union(S.Boolean, IncludeHtmlConfig), { nullable: true }),
552
+ markdown: S.optionalWith(S.Union(S.Boolean, IncludeMarkdownConfig), { nullable: true }),
553
+ screenshot: S.optionalWith(S.Union(S.Boolean, IncludeScreenshotConfig), { nullable: true }),
554
+ summary: S.optionalWith(
555
+ S.Union(
556
+ S.Boolean,
557
+ S.Struct({
558
+ prompt: S.optionalWith(S.String.pipe(S.maxLength(5000)), {
559
+ nullable: true,
560
+ default: () =>
561
+ 'You are a helpful assistant that summarizes web page content.\nGiven the markdown content of a web page, provide a clear and concise summary.\nFocus on the main points and key information.\nKeep the summary informative but brief.' as const,
562
+ }),
563
+ }),
564
+ ),
565
+ { nullable: true },
566
+ ),
567
+ links: S.optionalWith(
568
+ S.Union(
569
+ S.Boolean,
570
+ S.Struct({
571
+ sameDomainOnly: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
572
+ includePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
573
+ excludePatterns: S.optionalWith(S.Array(S.String), { nullable: true }),
574
+ }),
575
+ ),
576
+ { nullable: true },
577
+ ),
578
+ meta: S.optionalWith(S.Boolean, { nullable: true, default: () => true as const }),
579
+ response: S.optionalWith(
580
+ S.Struct({
581
+ includeHeaders: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
582
+ }),
583
+ { nullable: true },
584
+ ),
585
+ json: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
586
+ appendix: S.optionalWith(S.Boolean, { nullable: true }),
587
+ }),
588
+ { nullable: true },
589
+ ),
590
+ browserConfig: S.optionalWith(
591
+ S.Struct({
592
+ scrollFullPage: S.optionalWith(S.Boolean, { nullable: true, default: () => false as const }),
593
+ }),
594
+ { nullable: true },
595
+ ),
596
+ }) {}
597
+
598
+ export class BatchedRun extends S.Class<BatchedRun>('BatchedRun')({
599
+ id: S.String,
600
+ }) {}
601
+
602
+ export class FetchBatched400 extends S.Union(HttpApiDecodeError, BadRequest) {}
603
+
604
+ export class FetchBatched403Tag extends S.Literal('AccessBlocked') {}
605
+
606
+ export class FetchBatched403 extends S.Struct({
607
+ organizationId: S.String.pipe(S.minLength(1)),
608
+ blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
609
+ _tag: FetchBatched403Tag,
610
+ }) {}
611
+
612
+ export class FetchGetBatchedParams extends S.Struct({
613
+ limit: S.optionalWith(S.String, { nullable: true }),
614
+ offset: S.optionalWith(S.String, { nullable: true }),
615
+ include: S.optionalWith(S.String, { nullable: true }),
616
+ }) {}
617
+
618
+ export class BatchedStatusStatus extends S.Literal('QUEUED', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLED') {}
619
+
620
+ export class BatchedStatusBatchedStatus extends S.Literal('QUEUED', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLED') {}
621
+
622
+ export class IconMeta extends S.Struct({
623
+ href: S.String.pipe(S.minLength(1)),
624
+ rel: S.String.pipe(S.minLength(1)),
625
+ type: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
626
+ sizes: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
627
+ }) {}
628
+
629
+ export class OgImage extends S.Struct({
630
+ url: S.String.pipe(S.minLength(1)),
631
+ width: S.optionalWith(S.Number, { nullable: true }),
632
+ height: S.optionalWith(S.Number, { nullable: true }),
633
+ alt: S.optionalWith(S.String, { nullable: true }),
634
+ }) {}
635
+
636
+ export class OpenGraphMeta extends S.Struct({
637
+ title: S.optionalWith(S.String, { nullable: true }),
638
+ description: S.optionalWith(S.String, { nullable: true }),
639
+ type: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
640
+ url: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
641
+ siteName: S.optionalWith(S.String, { nullable: true }),
642
+ locale: S.optionalWith(S.String, { nullable: true }),
643
+ images: S.optionalWith(S.Array(OgImage), { nullable: true }),
644
+ }) {}
645
+
646
+ export class TwitterCardMeta extends S.Struct({
647
+ card: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
648
+ site: S.optionalWith(S.String, { nullable: true }),
649
+ creator: S.optionalWith(S.String, { nullable: true }),
650
+ title: S.optionalWith(S.String, { nullable: true }),
651
+ description: S.optionalWith(S.String, { nullable: true }),
652
+ image: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
653
+ }) {}
654
+
655
+ export class PageMeta extends S.Struct({
656
+ title: S.optionalWith(S.String, { nullable: true }),
657
+ description: S.optionalWith(S.String, { nullable: true }),
658
+ canonicalUrl: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
659
+ language: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
660
+ charset: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
661
+ favicon: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
662
+ icons: S.optionalWith(S.Array(IconMeta), { nullable: true }),
663
+ openGraph: S.optionalWith(OpenGraphMeta, { nullable: true }),
664
+ twitter: S.optionalWith(TwitterCardMeta, { nullable: true }),
665
+ }) {}
666
+
667
+ export class FetchLink extends S.Struct({
668
+ url: S.String,
669
+ text: S.optionalWith(S.String, { nullable: true }),
670
+ }) {}
671
+
672
+ export class RenderEnginesInfoCapture extends S.Literal('rust') {}
673
+
674
+ export class RenderEnginesInfoMarkdown extends S.Literal('rust') {}
675
+
676
+ export class RenderEnginesInfoTree extends S.Literal('rust') {}
677
+
678
+ export class RenderEnginesInfo extends S.Struct({
679
+ capture: S.optionalWith(RenderEnginesInfoCapture, { nullable: true }),
680
+ markdown: S.optionalWith(RenderEnginesInfoMarkdown, { nullable: true }),
681
+ tree: S.optionalWith(RenderEnginesInfoTree, { nullable: true }),
682
+ }) {}
683
+
684
+ export class PaginationMeta extends S.Struct({
685
+ total: S.Number,
686
+ limit: S.Number,
687
+ offset: S.Number,
688
+ hasMore: S.Boolean,
689
+ }) {}
690
+
691
+ export class BatchedStatus extends S.Class<BatchedStatus>('BatchedStatus')({
692
+ id: S.String,
693
+ status: BatchedStatusStatus,
694
+ batchedStatus: BatchedStatusBatchedStatus,
695
+ totalUrls: S.Number,
696
+ results: S.Array(
697
+ S.Struct({
698
+ data: S.Struct({
699
+ response: ResponseInfo,
700
+ meta: S.optionalWith(PageMeta, { nullable: true }),
701
+ json: S.optionalWith(S.Array(S.Struct({})), { nullable: true }),
702
+ snapshotId: S.optionalWith(NonEmptyString, { nullable: true }),
703
+ html: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
704
+ markdown: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
705
+ screenshot: S.optionalWith(
706
+ S.Struct({
707
+ url: S.String,
708
+ fullPage: S.Boolean,
709
+ }),
710
+ { nullable: true },
711
+ ),
712
+ summary: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
713
+ search: S.optionalWith(FetchSearchResult, { nullable: true }),
714
+ links: S.optionalWith(S.Array(FetchLink), { nullable: true }),
715
+ appendix: S.optionalWith(S.String.pipe(S.minLength(1)), { nullable: true }),
716
+ renderEngines: S.optionalWith(RenderEnginesInfo, { nullable: true }),
717
+ captureTelemetry: S.optionalWith(CaptureTelemetryInfo, { nullable: true }),
718
+ assets: S.optionalWith(S.Array(FetchAssetReference), { nullable: true }),
719
+ blocked: S.optionalWith(
720
+ S.Struct({
721
+ blockedType: S.optionalWith(S.String, { nullable: true }),
722
+ }),
723
+ { nullable: true },
724
+ ),
725
+ }),
726
+ }),
727
+ ),
728
+ pagination: PaginationMeta,
729
+ }) {}
730
+
731
+ export class BatchedIncludeUnsupportedTag extends S.Literal('BatchedIncludeUnsupported') {}
732
+
733
+ export class BatchedIncludeUnsupported extends S.Struct({
734
+ unsupportedFields: S.Array(S.String),
735
+ _tag: BatchedIncludeUnsupportedTag,
736
+ }) {}
737
+
738
+ export class FetchGetBatched400 extends S.Union(HttpApiDecodeError, BatchedIncludeUnsupported) {}
739
+
740
+ export const make = (
741
+ httpClient: HttpClient.HttpClient,
742
+ options: {
743
+ readonly transformClient?: ((client: HttpClient.HttpClient) => Effect.Effect<HttpClient.HttpClient>) | undefined
744
+ } = {},
745
+ ): Client => {
746
+ const unexpectedStatus = (
747
+ request: HttpClientRequest.HttpClientRequest,
748
+ response: HttpClientResponse.HttpClientResponse,
749
+ ) =>
750
+ Effect.flatMap(
751
+ Effect.orElseSucceed(response.text, () => 'Unexpected status code'),
752
+ (description) =>
753
+ Effect.fail(
754
+ new HttpClientError.ResponseError({
755
+ request,
756
+ response,
757
+ reason: 'StatusCode',
758
+ description,
759
+ }),
760
+ ),
761
+ )
762
+ const applyClientTransform = (client: HttpClient.HttpClient): Effect.Effect<HttpClient.HttpClient> =>
763
+ options.transformClient ? options.transformClient(client) : Effect.succeed(client)
764
+ const decodeError = <A, I, R>(response: HttpClientResponse.HttpClientResponse, schema: S.Schema<A, I, R>) =>
765
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)(response), Effect.fail)
766
+ return {
767
+ fetchFetch: (options) =>
768
+ HttpClientRequest.make('POST')(`/v1/fetch`).pipe(
769
+ HttpClientRequest.setUrlParams({ include: options.params['include'] as UrlParams.Coercible }),
770
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
771
+ Effect.flatMap((request) =>
772
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
773
+ Effect.flatMap(
774
+ httpClient.execute(request),
775
+ HttpClientResponse.matchStatus({
776
+ '400': (r) => decodeError(r, FetchFetch400),
777
+ '401': (r) => decodeError(r, AuthFailed),
778
+ '403': (r) => decodeError(r, FetchFetch403),
779
+ '413': (r) => decodeError(r, PayloadTooLarge),
780
+ '429': (r) => decodeError(r, TooManyRequests),
781
+ '500': (r) => decodeError(r, InternalError),
782
+ '503': (r) => decodeError(r, ServiceUnavailable),
783
+ orElse: (response) => unexpectedStatus(request, response),
784
+ }),
785
+ ),
786
+ ),
787
+ ),
788
+ ),
789
+ fetchFetchJson: (options) =>
790
+ HttpClientRequest.make('POST')(`/v1/fetch/json`).pipe(
791
+ HttpClientRequest.setUrlParams({ include: options.params['include'] as UrlParams.Coercible }),
792
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options.payload)),
793
+ Effect.flatMap((request) =>
794
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
795
+ Effect.flatMap(
796
+ httpClient.execute(request),
797
+ HttpClientResponse.matchStatus({
798
+ '200': (r) => HttpClientResponse.schemaBodyJson(FetchObjectModeResult)(r),
799
+ '400': (r) => decodeError(r, FetchFetchJson400),
800
+ '401': (r) => decodeError(r, AuthFailed),
801
+ '403': (r) => decodeError(r, FetchFetchJson403),
802
+ '413': (r) => decodeError(r, PayloadTooLarge),
803
+ '429': (r) => decodeError(r, TooManyRequests),
804
+ '500': (r) => decodeError(r, InternalError),
805
+ '503': (r) => decodeError(r, ServiceUnavailable),
806
+ orElse: (response) => unexpectedStatus(request, response),
807
+ }),
808
+ ),
809
+ ),
810
+ ),
811
+ ),
812
+ fetchFetchSearch: (options) =>
813
+ HttpClientRequest.make('POST')(`/v1/fetch/search`).pipe(
814
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
815
+ Effect.flatMap((request) =>
816
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
817
+ Effect.flatMap(
818
+ httpClient.execute(request),
819
+ HttpClientResponse.matchStatus({
820
+ '200': (r) => HttpClientResponse.schemaBodyJson(FetchSnapshotSearchResult)(r),
821
+ '400': (r) => decodeError(r, FetchFetchSearch400),
822
+ '401': (r) => decodeError(r, AuthFailed),
823
+ '403': (r) => decodeError(r, FetchFetchSearch403),
824
+ '404': (r) => decodeError(r, FetchSnapshotSearchNotFound),
825
+ '413': (r) => decodeError(r, PayloadTooLarge),
826
+ '429': (r) => decodeError(r, TooManyRequests),
827
+ '500': (r) => decodeError(r, InternalError),
828
+ '503': (r) => decodeError(r, ServiceUnavailable),
829
+ orElse: (response) => unexpectedStatus(request, response),
830
+ }),
831
+ ),
832
+ ),
833
+ ),
834
+ ),
835
+ fetchBatched: (options) =>
836
+ HttpClientRequest.make('POST')(`/v1/fetch/batched`).pipe(
837
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
838
+ Effect.flatMap((request) =>
839
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
840
+ Effect.flatMap(
841
+ httpClient.execute(request),
842
+ HttpClientResponse.matchStatus({
843
+ '200': (r) => HttpClientResponse.schemaBodyJson(BatchedRun)(r),
844
+ '400': (r) => decodeError(r, FetchBatched400),
845
+ '401': (r) => decodeError(r, AuthFailed),
846
+ '403': (r) => decodeError(r, FetchBatched403),
847
+ '413': (r) => decodeError(r, PayloadTooLarge),
848
+ '429': (r) => decodeError(r, TooManyRequests),
849
+ '500': (r) => decodeError(r, InternalError),
850
+ '503': (r) => decodeError(r, ServiceUnavailable),
851
+ orElse: (response) => unexpectedStatus(request, response),
852
+ }),
853
+ ),
854
+ ),
855
+ ),
856
+ ),
857
+ fetchGetBatched: (id, options) =>
858
+ HttpClientRequest.make('GET')(`/v1/fetch/batched/${id}`).pipe(
859
+ HttpClientRequest.setUrlParams({
860
+ limit: options['limit'] as UrlParams.Coercible,
861
+ offset: options['offset'] as UrlParams.Coercible,
862
+ include: options['include'] as UrlParams.Coercible,
863
+ }),
864
+ Effect.succeed,
865
+ Effect.flatMap((request) =>
866
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
867
+ Effect.flatMap(
868
+ httpClient.execute(request),
869
+ HttpClientResponse.matchStatus({
870
+ '200': (r) => HttpClientResponse.schemaBodyJson(BatchedStatus)(r),
871
+ '400': (r) => decodeError(r, FetchGetBatched400),
872
+ '401': (r) => decodeError(r, AuthFailed),
873
+ '413': (r) => decodeError(r, PayloadTooLarge),
874
+ '429': (r) => decodeError(r, TooManyRequests),
875
+ '500': (r) => decodeError(r, InternalError),
876
+ '503': (r) => decodeError(r, ServiceUnavailable),
877
+ orElse: (response) => unexpectedStatus(request, response),
878
+ }),
879
+ ),
880
+ ),
881
+ ),
882
+ ),
883
+ }
884
+ }
885
+
886
+ export interface Client {
887
+ readonly fetchFetch: (options: {
888
+ readonly params: typeof FetchFetchParams.Encoded
889
+ readonly payload: typeof FetchFetchRequest.Encoded
890
+ }) => Effect.Effect<
891
+ void,
892
+ | HttpClientError.HttpClientError
893
+ | ParseError
894
+ | typeof FetchFetch400.Type
895
+ | typeof AuthFailed.Type
896
+ | typeof FetchFetch403.Type
897
+ | typeof PayloadTooLarge.Type
898
+ | typeof TooManyRequests.Type
899
+ | typeof InternalError.Type
900
+ | typeof ServiceUnavailable.Type
901
+ >
902
+ readonly fetchFetchJson: (options: {
903
+ readonly params: typeof FetchFetchJsonParams.Encoded
904
+ readonly payload: typeof FetchFetchJsonRequest.Encoded
905
+ }) => Effect.Effect<
906
+ typeof FetchObjectModeResult.Type,
907
+ | HttpClientError.HttpClientError
908
+ | ParseError
909
+ | typeof FetchFetchJson400.Type
910
+ | typeof AuthFailed.Type
911
+ | typeof FetchFetchJson403.Type
912
+ | typeof PayloadTooLarge.Type
913
+ | typeof TooManyRequests.Type
914
+ | typeof InternalError.Type
915
+ | typeof ServiceUnavailable.Type
916
+ >
917
+ readonly fetchFetchSearch: (
918
+ options: typeof FetchFetchSearchRequest.Encoded,
919
+ ) => Effect.Effect<
920
+ typeof FetchSnapshotSearchResult.Type,
921
+ | HttpClientError.HttpClientError
922
+ | ParseError
923
+ | typeof FetchFetchSearch400.Type
924
+ | typeof AuthFailed.Type
925
+ | typeof FetchFetchSearch403.Type
926
+ | typeof FetchSnapshotSearchNotFound.Type
927
+ | typeof PayloadTooLarge.Type
928
+ | typeof TooManyRequests.Type
929
+ | typeof InternalError.Type
930
+ | typeof ServiceUnavailable.Type
931
+ >
932
+ readonly fetchBatched: (
933
+ options: typeof FetchBatchedRequest.Encoded,
934
+ ) => Effect.Effect<
935
+ typeof BatchedRun.Type,
936
+ | HttpClientError.HttpClientError
937
+ | ParseError
938
+ | typeof FetchBatched400.Type
939
+ | typeof AuthFailed.Type
940
+ | typeof FetchBatched403.Type
941
+ | typeof PayloadTooLarge.Type
942
+ | typeof TooManyRequests.Type
943
+ | typeof InternalError.Type
944
+ | typeof ServiceUnavailable.Type
945
+ >
946
+ readonly fetchGetBatched: (
947
+ id: string,
948
+ options: typeof FetchGetBatchedParams.Encoded,
949
+ ) => Effect.Effect<
950
+ typeof BatchedStatus.Type,
951
+ | HttpClientError.HttpClientError
952
+ | ParseError
953
+ | typeof FetchGetBatched400.Type
954
+ | typeof AuthFailed.Type
955
+ | typeof PayloadTooLarge.Type
956
+ | typeof TooManyRequests.Type
957
+ | typeof InternalError.Type
958
+ | typeof ServiceUnavailable.Type
959
+ >
960
+ }