@expandai/sdk 0.17.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -109,6 +109,8 @@ while (status.batchedStatus === 'RUNNING' || status.batchedStatus === 'QUEUED')
109
109
  console.log(status.results)
110
110
  ```
111
111
 
112
+ Each result has a persisted `status` (`QUEUED`, `RUNNING`, `SUCCEEDED`, `FAILED`, or `CANCELLED`) alongside its `data`.
113
+
112
114
  ### Effect service
113
115
 
114
116
  ```ts
@@ -132,6 +134,8 @@ const program = Effect.gen(function* () {
132
134
  NodeRuntime.runMain(program.pipe(Effect.provide(ExpandService.layer({ apiKey: process.env.EXPAND_API_KEY }))))
133
135
  ```
134
136
 
137
+ The SDK generates an idempotency key and reuses it for automatic retries when one is omitted. Supply a stable `idempotencyKey` to deduplicate separate calls or calls made after a process restart. Reusing a key with a different payload returns `409 BatchedIdempotencyConflict`.
138
+
135
139
  ## License
136
140
 
137
141
  [Apache 2.0](./LICENSE)
@@ -1,5 +1,5 @@
1
- import { type BatchedParams, type BatchedResponse, type ExpandServiceOptions, type FetchJsonParams, type FetchJsonRequestOptions, type FetchJsonResponse, type FetchParams, type FetchRequestOptions, type FetchResponse, type FetchSearchParams, type FetchSearchResponse, type GetBatchedParams, type GetBatchedResponse, type RequestOptions } from './Service.js';
2
- export type { BatchedParams, BatchedResponse, FetchJsonParams, FetchJsonRequestOptions, FetchJsonResponse, FetchParams, FetchRequestOptions, FetchResponse, FetchSearchParams, FetchSearchResponse, GetBatchedParams, GetBatchedResponse, } from './Service.js';
1
+ import { type BatchedParams, type BatchedRequestOptions, type BatchedResponse, type CancelBatchedResponse, type ExpandServiceOptions, type FetchJsonParams, type FetchJsonRequestOptions, type FetchJsonResponse, type FetchParams, type FetchRequestOptions, type FetchResponse, type FetchSearchParams, type FetchSearchResponse, type GetBatchedParams, type GetBatchedResponse, type RequestOptions } from './Service.js';
2
+ export type { BatchedParams, BatchedRequestOptions, BatchedResponse, CancelBatchedResponse, FetchJsonParams, FetchJsonRequestOptions, FetchJsonResponse, FetchParams, FetchRequestOptions, FetchResponse, FetchSearchParams, FetchSearchResponse, GetBatchedParams, GetBatchedResponse, } from './Service.js';
3
3
  /** Options for constructing an {@link ExpandClient}. Same shape as `ExpandServiceOptions`. */
4
4
  export type ExpandClientOptions = ExpandServiceOptions;
5
5
  /**
@@ -39,14 +39,16 @@ export declare class ExpandClient {
39
39
  * Kick off an asynchronous batched fetch over one or more URLs. Returns a batched-run ID that can
40
40
  * be polled via {@link getBatched}.
41
41
  *
42
- * Retries are disabled by default. Pass `{ maxRetries: N }` to opt in.
42
+ * When `idempotencyKey` is omitted, the client generates one and reuses it for automatic retries.
43
+ * Provide a stable key to deduplicate separate calls or calls made after a process restart. Reusing
44
+ * a key with a different payload surfaces an idempotency conflict.
43
45
  *
44
46
  * @throws {ExpandClientApiError} on 4xx/5xx responses
45
47
  * @throws {ExpandClientTimeoutError} when the request exceeds `timeoutMs`
46
48
  * @throws {ExpandClientConnectionError} on network failures
47
49
  * @throws {ExpandClientError} for any other failure
48
50
  */
49
- batched(params: BatchedParams, options?: RequestOptions): Promise<BatchedResponse>;
51
+ batched(params: BatchedParams, options?: BatchedRequestOptions): Promise<BatchedResponse>;
50
52
  /**
51
53
  * Fetch the status and accumulated results for a batched run previously started by {@link batched}.
52
54
  *
@@ -56,6 +58,10 @@ export declare class ExpandClient {
56
58
  * @throws {ExpandClientError} for any other failure
57
59
  */
58
60
  getBatched(id: string, options?: GetBatchedParams & RequestOptions): Promise<GetBatchedResponse>;
61
+ /**
62
+ * Request cancellation of a batched run. The command is idempotent and uses the configured retry policy.
63
+ */
64
+ cancelBatched(id: string, options?: RequestOptions): Promise<CancelBatchedResponse>;
59
65
  private run;
60
66
  }
61
67
  //# sourceMappingURL=Client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AA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MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAKxG;CACD;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,iBAAiB;IACjE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,EAGtD;CACD;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,2BAA2B;IACxE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAIlF;CACD"}
@@ -9,16 +9,19 @@ export declare const FetchSearchSnippetWithJson: S.Struct<{
9
9
  }>;
10
10
  source: S.Literal<["markdown", "appendix", "statejson"]>;
11
11
  text: typeof S.String;
12
- json: S.optionalWith<typeof S.Unknown, {
13
- nullable: true;
14
- }>;
15
12
  score: S.filter<S.filter<typeof S.Number>>;
16
13
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
17
14
  nullable: true;
18
15
  }>;
16
+ json: S.optionalWith<typeof S.Unknown, {
17
+ nullable: true;
18
+ }>;
19
19
  }>;
20
20
  export declare const FetchSearchResultWithJson: S.Struct<{
21
21
  query: typeof S.String;
22
+ meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
23
+ nullable: true;
24
+ }>;
22
25
  snippets: S.Array$<S.Struct<{
23
26
  type: S.optionalWith<S.Literal<["text"]>, {
24
27
  nullable: true;
@@ -26,17 +29,14 @@ export declare const FetchSearchResultWithJson: S.Struct<{
26
29
  }>;
27
30
  source: S.Literal<["markdown", "appendix", "statejson"]>;
28
31
  text: typeof S.String;
29
- json: S.optionalWith<typeof S.Unknown, {
30
- nullable: true;
31
- }>;
32
32
  score: S.filter<S.filter<typeof S.Number>>;
33
33
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
34
34
  nullable: true;
35
35
  }>;
36
+ json: S.optionalWith<typeof S.Unknown, {
37
+ nullable: true;
38
+ }>;
36
39
  }>>;
37
- meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
38
- nullable: true;
39
- }>;
40
40
  }>;
41
41
  declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultWithJson, {
42
42
  meta: typeof Generated.FetchObjectModeMeta;
@@ -46,11 +46,20 @@ declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultW
46
46
  assets: S.optionalWith<S.Array$<typeof Generated.FetchAssetReference>, {
47
47
  nullable: true;
48
48
  }>;
49
- captureTelemetry: S.optionalWith<typeof Generated.CaptureTelemetryInfo, {
49
+ degraded: S.optionalWith<typeof Generated.FetchDegradedInfo, {
50
+ nullable: true;
51
+ }>;
52
+ screenshot: S.optionalWith<S.Struct<{
53
+ url: typeof S.String;
54
+ fullPage: typeof S.Boolean;
55
+ }>, {
50
56
  nullable: true;
51
57
  }>;
52
58
  search: S.optionalWith<S.Struct<{
53
59
  query: typeof S.String;
60
+ meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
61
+ nullable: true;
62
+ }>;
54
63
  snippets: S.Array$<S.Struct<{
55
64
  type: S.optionalWith<S.Literal<["text"]>, {
56
65
  nullable: true;
@@ -58,17 +67,14 @@ declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultW
58
67
  }>;
59
68
  source: S.Literal<["markdown", "appendix", "statejson"]>;
60
69
  text: typeof S.String;
61
- json: S.optionalWith<typeof S.Unknown, {
62
- nullable: true;
63
- }>;
64
70
  score: S.filter<S.filter<typeof S.Number>>;
65
71
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
66
72
  nullable: true;
67
73
  }>;
74
+ json: S.optionalWith<typeof S.Unknown, {
75
+ nullable: true;
76
+ }>;
68
77
  }>>;
69
- meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
70
- nullable: true;
71
- }>;
72
78
  }>, {
73
79
  nullable: true;
74
80
  }>;
@@ -83,11 +89,20 @@ declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultW
83
89
  assets: S.optionalWith<S.Array$<typeof Generated.FetchAssetReference>, {
84
90
  nullable: true;
85
91
  }>;
86
- captureTelemetry: S.optionalWith<typeof Generated.CaptureTelemetryInfo, {
92
+ degraded: S.optionalWith<typeof Generated.FetchDegradedInfo, {
93
+ nullable: true;
94
+ }>;
95
+ screenshot: S.optionalWith<S.Struct<{
96
+ url: typeof S.String;
97
+ fullPage: typeof S.Boolean;
98
+ }>, {
87
99
  nullable: true;
88
100
  }>;
89
101
  search: S.optionalWith<S.Struct<{
90
102
  query: typeof S.String;
103
+ meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
104
+ nullable: true;
105
+ }>;
91
106
  snippets: S.Array$<S.Struct<{
92
107
  type: S.optionalWith<S.Literal<["text"]>, {
93
108
  nullable: true;
@@ -95,17 +110,14 @@ declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultW
95
110
  }>;
96
111
  source: S.Literal<["markdown", "appendix", "statejson"]>;
97
112
  text: typeof S.String;
98
- json: S.optionalWith<typeof S.Unknown, {
99
- nullable: true;
100
- }>;
101
113
  score: S.filter<S.filter<typeof S.Number>>;
102
114
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
103
115
  nullable: true;
104
116
  }>;
117
+ json: S.optionalWith<typeof S.Unknown, {
118
+ nullable: true;
119
+ }>;
105
120
  }>>;
106
- meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
107
- nullable: true;
108
- }>;
109
121
  }>, {
110
122
  nullable: true;
111
123
  }>;
@@ -113,108 +125,109 @@ declare const FetchObjectModeResultWithJson_base: S.Class<FetchObjectModeResultW
113
125
  nullable: true;
114
126
  }>;
115
127
  }>, never, {
116
- readonly markdown: string;
117
- } & {
118
- readonly meta: {
119
- readonly url: string;
120
- readonly markdown?: {
121
- readonly url: string;
122
- readonly moreTokens: number;
128
+ readonly data?: {
129
+ readonly assets?: readonly {
130
+ readonly id: string;
131
+ readonly kind: "data-url";
132
+ readonly placeholder: string;
133
+ readonly archiveKey: string;
134
+ readonly mimeType: string;
135
+ readonly sha256: string;
136
+ readonly bytes: number;
137
+ }[] | undefined;
138
+ readonly degraded?: {
139
+ readonly reason: "modelInputTooLarge" | "pageTooLarge";
140
+ readonly skipped: readonly "hfc"[];
141
+ readonly limitKind: "ast_bytes" | "domsnapshot_bytes" | "hfc_tokens";
142
+ readonly measuredBytes?: number | undefined;
143
+ readonly thresholdBytes?: number | undefined;
144
+ readonly measuredTokens?: number | undefined;
145
+ readonly thresholdTokens?: number | undefined;
123
146
  } | undefined;
124
- readonly appendix?: {
147
+ readonly screenshot?: {
125
148
  readonly url: string;
126
- readonly links: {
127
- readonly sameDomain: number;
128
- readonly external: number;
129
- };
149
+ readonly fullPage: boolean;
130
150
  } | undefined;
131
- readonly description?: string | undefined;
132
- readonly version: 1;
133
- readonly capturedAt: string;
134
- readonly snapshotId: string;
135
- readonly lang: string;
136
- readonly pageType: string;
137
- readonly playground: string;
138
- readonly title?: string | undefined;
139
- readonly finalUrl?: string | undefined;
140
- readonly canonical?: string | undefined;
141
- readonly author?: string | undefined;
142
- readonly createdAt?: string | undefined;
143
- readonly updatedAt?: string | undefined;
144
- readonly image?: string | undefined;
145
- readonly paginationNext?: string | undefined;
146
- readonly stateJson?: {
147
- readonly moreTokens: number;
148
- } | undefined;
149
- readonly blocked?: string | undefined;
150
- readonly loadingStatus?: string | undefined;
151
- };
152
- } & {
153
- readonly json: readonly {
154
- readonly keys?: readonly string[] | undefined;
155
- readonly url?: string | undefined;
156
- readonly moreTokens?: number | undefined;
157
- readonly id: number;
158
- readonly kind: "inline" | "network";
159
- readonly role: "ld+json" | "next-data" | "nuxt" | "apollo-state" | "initial-state" | "application-json" | "script-tag" | "data-attribute" | "network-json" | "network-response" | "other";
160
- readonly score: number;
161
- readonly method?: string | undefined;
162
- }[];
163
- } & {
164
- readonly data?: {
165
151
  readonly search?: {
152
+ readonly query: string;
166
153
  readonly meta?: {
167
154
  readonly durationMs: number;
168
155
  readonly sources: readonly {
169
- readonly source: "markdown" | "appendix" | "statejson";
156
+ readonly source: "appendix" | "markdown" | "statejson";
170
157
  readonly chunkCount: number;
171
158
  readonly batchCount: number;
172
- readonly ranker: "zeroentropy" | "local_lexical";
159
+ readonly ranker: "local_lexical" | "mixedbread" | "zeroentropy";
173
160
  readonly fallback: boolean;
174
- readonly fallbackReason?: "timeout" | "error" | undefined;
161
+ readonly fallbackReason?: "error" | "timeout" | undefined;
175
162
  readonly durationMs: number;
176
163
  }[];
177
164
  } | undefined;
178
- readonly query: string;
179
165
  readonly snippets: readonly {
180
- readonly json?: unknown;
181
- readonly score: number;
182
- readonly source: "markdown" | "appendix" | "statejson";
183
166
  readonly type: "text";
167
+ readonly source: "appendix" | "markdown" | "statejson";
184
168
  readonly text: string;
169
+ readonly score: number;
185
170
  readonly location?: {
171
+ readonly evidenceId?: number | undefined;
186
172
  readonly markdownBlockId?: string | undefined;
187
173
  readonly nodeIds?: readonly number[] | undefined;
188
174
  readonly stateJsonSourceId?: number | undefined;
189
175
  readonly jsonPath?: string | undefined;
190
176
  } | undefined;
177
+ readonly json?: unknown;
191
178
  }[];
192
179
  } | undefined;
193
- readonly assets?: readonly {
194
- readonly id: string;
195
- readonly kind: "data-url";
196
- readonly placeholder: string;
197
- readonly archiveKey: string;
198
- readonly mimeType: string;
199
- readonly sha256: string;
200
- readonly bytes: number;
201
- }[] | undefined;
202
- readonly captureTelemetry?: {
203
- readonly requestedStyleMode?: "compat_full" | "native_default" | undefined;
204
- readonly selected: "rust";
205
- readonly actual: "rust";
206
- readonly actualStyleMode?: "compat_full" | "native_default" | undefined;
207
- readonly rolloutApplied: boolean;
208
- readonly preparedSessionHit?: boolean | undefined;
209
- readonly nativePoolHit?: boolean | undefined;
210
- readonly nativePoolCapacity?: number | undefined;
211
- readonly nativePoolProfile?: string | undefined;
212
- readonly poolHit?: boolean | undefined;
213
- readonly connectMs?: number | undefined;
214
- readonly warmConnectionAgeMs?: number | undefined;
215
- readonly iconBackendDecision?: "cpu" | "remote_gpu" | undefined;
216
- } | undefined;
217
180
  } | undefined;
181
+ } & {
182
+ readonly json: readonly {
183
+ readonly id: number;
184
+ readonly kind: "inline" | "network";
185
+ readonly role: "apollo-state" | "application-json" | "data-attribute" | "initial-state" | "ld+json" | "network-json" | "network-response" | "next-data" | "nuxt" | "other" | "script-tag";
186
+ readonly score: number;
187
+ readonly url?: string | undefined;
188
+ readonly method?: string | undefined;
189
+ readonly moreTokens?: number | undefined;
190
+ readonly keys?: readonly string[] | undefined;
191
+ readonly urlRedacted?: true | undefined;
192
+ readonly urlOmitted?: "invalid" | "too-long" | "unsafe" | undefined;
193
+ }[];
194
+ } & {
195
+ readonly markdown: string;
196
+ } & {
197
+ readonly meta: {
198
+ readonly version: 1;
199
+ readonly url: string;
200
+ readonly capturedAt: string;
201
+ readonly snapshotId: string;
202
+ readonly lang: string;
203
+ readonly pageType: string;
204
+ readonly playground: string;
205
+ readonly title?: string | undefined;
206
+ readonly finalUrl?: string | undefined;
207
+ readonly canonical?: string | undefined;
208
+ readonly description?: string | undefined;
209
+ readonly author?: string | undefined;
210
+ readonly createdAt?: string | undefined;
211
+ readonly updatedAt?: string | undefined;
212
+ readonly image?: string | undefined;
213
+ readonly paginationNext?: string | undefined;
214
+ readonly appendix?: {
215
+ readonly url: string;
216
+ readonly links: {
217
+ readonly sameDomain: number;
218
+ readonly external: number;
219
+ };
220
+ } | undefined;
221
+ readonly stateJson?: {
222
+ readonly moreTokens: number;
223
+ } | undefined;
224
+ readonly markdown?: {
225
+ readonly url: string;
226
+ readonly moreTokens?: number | undefined;
227
+ } | undefined;
228
+ readonly blocked?: string | undefined;
229
+ readonly loadingStatus?: string | undefined;
230
+ };
218
231
  }, {}, {}>;
219
232
  export declare class FetchObjectModeResultWithJson extends FetchObjectModeResultWithJson_base {
220
233
  }
@@ -223,6 +236,9 @@ declare const FetchSnapshotSearchResultWithJson_base: S.Class<FetchSnapshotSearc
223
236
  response: typeof Generated.ResponseInfo;
224
237
  search: S.Struct<{
225
238
  query: typeof S.String;
239
+ meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
240
+ nullable: true;
241
+ }>;
226
242
  snippets: S.Array$<S.Struct<{
227
243
  type: S.optionalWith<S.Literal<["text"]>, {
228
244
  nullable: true;
@@ -230,24 +246,25 @@ declare const FetchSnapshotSearchResultWithJson_base: S.Class<FetchSnapshotSearc
230
246
  }>;
231
247
  source: S.Literal<["markdown", "appendix", "statejson"]>;
232
248
  text: typeof S.String;
233
- json: S.optionalWith<typeof S.Unknown, {
234
- nullable: true;
235
- }>;
236
249
  score: S.filter<S.filter<typeof S.Number>>;
237
250
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
238
251
  nullable: true;
239
252
  }>;
253
+ json: S.optionalWith<typeof S.Unknown, {
254
+ nullable: true;
255
+ }>;
240
256
  }>>;
241
- meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
242
- nullable: true;
243
- }>;
244
257
  }>;
245
258
  durationMs: S.filter<typeof S.Number>;
259
+ playground: typeof S.String;
246
260
  }, S.Struct.Encoded<{
247
261
  snapshotId: S.filter<typeof S.String>;
248
262
  response: typeof Generated.ResponseInfo;
249
263
  search: S.Struct<{
250
264
  query: typeof S.String;
265
+ meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
266
+ nullable: true;
267
+ }>;
251
268
  snippets: S.Array$<S.Struct<{
252
269
  type: S.optionalWith<S.Literal<["text"]>, {
253
270
  nullable: true;
@@ -255,60 +272,61 @@ declare const FetchSnapshotSearchResultWithJson_base: S.Class<FetchSnapshotSearc
255
272
  }>;
256
273
  source: S.Literal<["markdown", "appendix", "statejson"]>;
257
274
  text: typeof S.String;
258
- json: S.optionalWith<typeof S.Unknown, {
259
- nullable: true;
260
- }>;
261
275
  score: S.filter<S.filter<typeof S.Number>>;
262
276
  location: S.optionalWith<typeof Generated.FetchSearchSnippetLocation, {
263
277
  nullable: true;
264
278
  }>;
279
+ json: S.optionalWith<typeof S.Unknown, {
280
+ nullable: true;
281
+ }>;
265
282
  }>>;
266
- meta: S.optionalWith<typeof Generated.FetchSearchMeta, {
267
- nullable: true;
268
- }>;
269
283
  }>;
270
284
  durationMs: S.filter<typeof S.Number>;
285
+ playground: typeof S.String;
271
286
  }>, never, {
287
+ readonly durationMs: number;
288
+ } & {
289
+ readonly playground: string;
290
+ } & {
291
+ readonly response: {
292
+ readonly url: string;
293
+ readonly requestedUrl?: string | undefined;
294
+ readonly originStatusCode?: number | undefined;
295
+ readonly redirectStatusCode?: number | undefined;
296
+ readonly headers?: {} | undefined;
297
+ };
298
+ } & {
272
299
  readonly search: {
300
+ readonly query: string;
273
301
  readonly meta?: {
274
302
  readonly durationMs: number;
275
303
  readonly sources: readonly {
276
- readonly source: "markdown" | "appendix" | "statejson";
304
+ readonly source: "appendix" | "markdown" | "statejson";
277
305
  readonly chunkCount: number;
278
306
  readonly batchCount: number;
279
- readonly ranker: "zeroentropy" | "local_lexical";
307
+ readonly ranker: "local_lexical" | "mixedbread" | "zeroentropy";
280
308
  readonly fallback: boolean;
281
- readonly fallbackReason?: "timeout" | "error" | undefined;
309
+ readonly fallbackReason?: "error" | "timeout" | undefined;
282
310
  readonly durationMs: number;
283
311
  }[];
284
312
  } | undefined;
285
- readonly query: string;
286
313
  readonly snippets: readonly {
287
- readonly json?: unknown;
288
- readonly score: number;
289
- readonly source: "markdown" | "appendix" | "statejson";
290
314
  readonly type: "text";
315
+ readonly source: "appendix" | "markdown" | "statejson";
291
316
  readonly text: string;
317
+ readonly score: number;
292
318
  readonly location?: {
319
+ readonly evidenceId?: number | undefined;
293
320
  readonly markdownBlockId?: string | undefined;
294
321
  readonly nodeIds?: readonly number[] | undefined;
295
322
  readonly stateJsonSourceId?: number | undefined;
296
323
  readonly jsonPath?: string | undefined;
297
324
  } | undefined;
325
+ readonly json?: unknown;
298
326
  }[];
299
327
  };
300
- } & {
301
- readonly response: {
302
- readonly url: string;
303
- readonly requestedUrl?: string | undefined;
304
- readonly originStatusCode?: number | undefined;
305
- readonly redirectStatusCode?: number | undefined;
306
- readonly headers?: {} | undefined;
307
- };
308
328
  } & {
309
329
  readonly snapshotId: string;
310
- } & {
311
- readonly durationMs: number;
312
330
  }, {}, {}>;
313
331
  export declare class FetchSnapshotSearchResultWithJson extends FetchSnapshotSearchResultWithJson_base {
314
332
  }
@@ -316,48 +334,52 @@ export declare class FetchSnapshotSearchResultWithJson extends FetchSnapshotSear
316
334
  export declare const fetchObjectModeJson: (httpClient: HttpClient.HttpClient, options: {
317
335
  readonly params: typeof Generated.FetchFetchJsonParams.Encoded;
318
336
  readonly payload: typeof Generated.FetchFetchJsonRequest.Encoded;
319
- }) => Effect.Effect<FetchObjectModeResultWithJson, {
320
- readonly message: string;
321
- readonly _tag: "HttpApiDecodeError";
337
+ }) => Effect.Effect<FetchObjectModeResultWithJson, Generated.AuthFailed | Generated.FetchCapacityTimeout | Generated.FetchCaptureTimeout | Generated.FetchNavigationFailed | Generated.InternalError | import("effect/ParseResult").ParseError | Generated.ServiceUnavailable | Generated.TooManyRequests | {
322
338
  readonly issues: readonly {
323
- readonly message: string;
324
- readonly _tag: "Type" | "Pointer" | "Unexpected" | "Missing" | "Composite" | "Refinement" | "Transformation" | "Forbidden";
339
+ readonly _tag: "Composite" | "Forbidden" | "Missing" | "Pointer" | "Refinement" | "Transformation" | "Type" | "Unexpected";
325
340
  readonly path: readonly (string | number | {
326
341
  readonly _tag: "symbol";
327
342
  readonly key: string;
328
343
  })[];
344
+ readonly message: string;
329
345
  }[];
346
+ readonly message: string;
347
+ readonly _tag: "HttpApiDecodeError";
330
348
  } | {
331
349
  readonly message: string;
332
350
  readonly _tag: "BadRequest";
333
- } | Generated.AuthFailed | {
334
- readonly _tag: "FetchBlocked";
335
- readonly url: string;
336
- readonly blockedType?: string | undefined;
337
- } | Generated.PayloadTooLarge | Generated.TooManyRequests | Generated.InternalError | Generated.ServiceUnavailable | {
338
- readonly _tag: "AccessBlocked";
351
+ } | {
339
352
  readonly organizationId: string;
340
353
  readonly blockedUntil?: string | null | undefined;
341
- } | import("@effect/platform/HttpClientError").HttpClientError | import("effect/ParseResult").ParseError, never>;
354
+ readonly _tag: "AccessBlocked";
355
+ } | {
356
+ readonly url: string;
357
+ readonly blockedType?: string | undefined;
358
+ readonly _tag: "FetchBlocked";
359
+ } | {
360
+ readonly _tag: "PayloadTooLarge";
361
+ } | import("@effect/platform/HttpClientError").HttpClientError, never>;
342
362
  /** Mirrors `Generated.Client['fetchFetchSearch']` but decodes the 200 body with `json` preserved. */
343
- export declare const fetchSnapshotSearch: (httpClient: HttpClient.HttpClient, options: typeof Generated.FetchFetchSearchRequest.Encoded) => Effect.Effect<FetchSnapshotSearchResultWithJson, {
344
- readonly message: string;
345
- readonly _tag: "HttpApiDecodeError";
363
+ export declare const fetchSnapshotSearch: (httpClient: HttpClient.HttpClient, options: typeof Generated.FetchFetchSearchRequest.Encoded) => Effect.Effect<FetchSnapshotSearchResultWithJson, Generated.AuthFailed | Generated.FetchSnapshotSearchNotFound | Generated.InternalError | import("effect/ParseResult").ParseError | Generated.ServiceUnavailable | Generated.TooManyRequests | {
346
364
  readonly issues: readonly {
347
- readonly message: string;
348
- readonly _tag: "Type" | "Pointer" | "Unexpected" | "Missing" | "Composite" | "Refinement" | "Transformation" | "Forbidden";
365
+ readonly _tag: "Composite" | "Forbidden" | "Missing" | "Pointer" | "Refinement" | "Transformation" | "Type" | "Unexpected";
349
366
  readonly path: readonly (string | number | {
350
367
  readonly _tag: "symbol";
351
368
  readonly key: string;
352
369
  })[];
370
+ readonly message: string;
353
371
  }[];
372
+ readonly message: string;
373
+ readonly _tag: "HttpApiDecodeError";
354
374
  } | {
355
375
  readonly message: string;
356
376
  readonly _tag: "BadRequest";
357
- } | Generated.AuthFailed | Generated.PayloadTooLarge | Generated.TooManyRequests | Generated.InternalError | Generated.ServiceUnavailable | {
358
- readonly _tag: "AccessBlocked";
377
+ } | {
378
+ readonly _tag: "PayloadTooLarge";
379
+ } | {
359
380
  readonly organizationId: string;
360
381
  readonly blockedUntil?: string | null | undefined;
361
- } | Generated.FetchSnapshotSearchNotFound | import("@effect/platform/HttpClientError").HttpClientError | import("effect/ParseResult").ParseError, never>;
382
+ readonly _tag: "AccessBlocked";
383
+ } | import("@effect/platform/HttpClientError").HttpClientError, never>;
362
384
  export {};
363
385
  //# sourceMappingURL=FetchJson.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FetchJson.d.ts","sourceRoot":"","sources":["../../src/FetchJson.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAyC,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAG3C,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;EAOrC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;EAIpC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,qBAAa,6BAA8B,SAAQ,kCAcjD;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,iCAAkC,SAAQ,sCAOrD;CAAG;AAEL,mGAAmG;AACnG,eAAO,MAAM,mBAAmB,GAC/B,YAAY,UAAU,CAAC,UAAU,EACjC,SAAS;IACR,QAAQ,CAAC,MAAM,EAAE,OAAO,SAAS,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAC9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