@expandai/sdk 0.17.0 → 0.17.1

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