@expandai/sdk 0.20.4 → 0.21.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/src/Generated.ts CHANGED
@@ -169,8 +169,8 @@ export class FetchBlocked extends S.Struct({
169
169
 
170
170
  export class FetchFetch403 extends S.Union(
171
171
  S.Struct({
172
- organizationId: S.String.pipe(S.minLength(1)),
173
172
  blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
173
+ retryable: S.optionalWith(S.Literal(false), { default: () => false }),
174
174
  _tag: S.Literal('AccessBlocked'),
175
175
  }),
176
176
  FetchBlocked,
@@ -326,12 +326,6 @@ export class FetchOriginHttpError extends S.Struct({
326
326
 
327
327
  export class FetchFetch502 extends S.Union(FetchCaptureFailed, FetchNavigationFailed, FetchOriginHttpError) {}
328
328
 
329
- export class ServiceUnavailableDispatchOutcome extends S.Literal(
330
- 'cancelled_before_start',
331
- 'cancelled_after_start',
332
- 'unknown',
333
- ) {}
334
-
335
329
  export class ServiceUnavailableRetryable extends S.Literal(true) {}
336
330
 
337
331
  export class ServiceUnavailableTag extends S.Literal('ServiceUnavailable') {}
@@ -339,7 +333,6 @@ export class ServiceUnavailableTag extends S.Literal('ServiceUnavailable') {}
339
333
  export class ServiceUnavailable extends S.Struct({
340
334
  message: S.optionalWith(S.String, { nullable: true }),
341
335
  requestId: S.optionalWith(S.String, { nullable: true }),
342
- dispatchOutcome: S.optionalWith(ServiceUnavailableDispatchOutcome, { nullable: true }),
343
336
  retryable: S.optionalWith(ServiceUnavailableRetryable, { default: () => true }),
344
337
  _tag: ServiceUnavailableTag,
345
338
  }) {}
@@ -579,7 +572,8 @@ export class FetchAssetReference extends S.Struct({
579
572
  id: S.String,
580
573
  kind: FetchAssetReferenceKind,
581
574
  placeholder: S.String,
582
- archiveKey: S.String,
575
+ /** @deprecated An opaque identifier equal to `sha256`. It will become optional and then be removed; use `id` or `sha256` instead. */
576
+ archiveKey: S.optionalWith(S.String, { nullable: true }),
583
577
  mimeType: S.String,
584
578
  sha256: S.String,
585
579
  bytes: S.Number,
@@ -813,8 +807,8 @@ export class FetchFetchJson400 extends S.Union(HttpApiDecodeError, BadRequest) {
813
807
 
814
808
  export class FetchFetchJson403 extends S.Union(
815
809
  S.Struct({
816
- organizationId: S.String.pipe(S.minLength(1)),
817
810
  blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
811
+ retryable: S.optionalWith(S.Literal(false), { default: () => false }),
818
812
  _tag: S.Literal('AccessBlocked'),
819
813
  }),
820
814
  FetchBlocked,
@@ -903,11 +897,13 @@ export class BatchedRun extends S.Class<BatchedRun>('BatchedRun')({
903
897
 
904
898
  export class FetchBatched400 extends S.Union(HttpApiDecodeError, BadRequest) {}
905
899
 
900
+ export class FetchBatched403Retryable extends S.Literal(false) {}
901
+
906
902
  export class FetchBatched403Tag extends S.Literal('AccessBlocked') {}
907
903
 
908
904
  export class FetchBatched403 extends S.Struct({
909
- organizationId: S.String.pipe(S.minLength(1)),
910
905
  blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
906
+ retryable: S.optionalWith(FetchBatched403Retryable, { default: () => false }),
911
907
  _tag: FetchBatched403Tag,
912
908
  }) {}
913
909
 
@@ -1183,6 +1179,32 @@ export class BatchedCancellationConflict extends S.Class<BatchedCancellationConf
1183
1179
  _tag: BatchedCancellationConflictTag,
1184
1180
  }) {}
1185
1181
 
1182
+ export class SearchSearchRequest extends S.Class<SearchSearchRequest>('SearchSearchRequest')({
1183
+ query: S.String,
1184
+ maxResults: S.optionalWith(Int, { nullable: true }),
1185
+ }) {}
1186
+
1187
+ export class SearchResult extends S.Struct({
1188
+ url: S.String.pipe(S.minLength(1)),
1189
+ title: S.String,
1190
+ excerpt: S.String,
1191
+ score: S.Number,
1192
+ }) {}
1193
+
1194
+ export class SearchResponse extends S.Class<SearchResponse>('SearchResponse')({
1195
+ results: S.Array(SearchResult),
1196
+ }) {}
1197
+
1198
+ export class SearchSearch403Retryable extends S.Literal(false) {}
1199
+
1200
+ export class SearchSearch403Tag extends S.Literal('AccessBlocked') {}
1201
+
1202
+ export class SearchSearch403 extends S.Struct({
1203
+ blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
1204
+ retryable: S.optionalWith(SearchSearch403Retryable, { default: () => false }),
1205
+ _tag: SearchSearch403Tag,
1206
+ }) {}
1207
+
1186
1208
  export class SnapshotHighlightsInputIncludeAppendixMarkers extends S.Literal('off', 'compact', 'detailed') {}
1187
1209
 
1188
1210
  export class SnapshotHighlightsInput extends S.Class<SnapshotHighlightsInput>('SnapshotHighlightsInput')({
@@ -1251,11 +1273,13 @@ export class FetchSnapshotHighlightsResult extends S.Class<FetchSnapshotHighligh
1251
1273
 
1252
1274
  export class SnapshotsHighlights400 extends S.Union(HttpApiDecodeError, BadRequest) {}
1253
1275
 
1276
+ export class SnapshotsHighlights403Retryable extends S.Literal(false) {}
1277
+
1254
1278
  export class SnapshotsHighlights403Tag extends S.Literal('AccessBlocked') {}
1255
1279
 
1256
1280
  export class SnapshotsHighlights403 extends S.Struct({
1257
- organizationId: S.String.pipe(S.minLength(1)),
1258
1281
  blockedUntil: S.optionalWith(S.Union(DateTimeUtc, S.Null), { nullable: true }),
1282
+ retryable: S.optionalWith(SnapshotsHighlights403Retryable, { default: () => false }),
1259
1283
  _tag: SnapshotsHighlights403Tag,
1260
1284
  }) {}
1261
1285
 
@@ -1308,6 +1332,140 @@ export class SnapshotNotFound extends S.Class<SnapshotNotFound>('SnapshotNotFoun
1308
1332
  _tag: SnapshotNotFoundTag,
1309
1333
  }) {}
1310
1334
 
1335
+ export class PublicSnapshotsGetNetworkParamsBodies extends S.Literal('none', 'inline') {}
1336
+
1337
+ export class PublicSnapshotsGetNetworkParamsDetail extends S.Literal('summary', 'full') {}
1338
+
1339
+ export class PublicSnapshotsGetNetworkParams extends S.Struct({
1340
+ q: S.optionalWith(S.String.pipe(S.minLength(1), S.maxLength(2048)), { nullable: true }),
1341
+ urlContains: S.optionalWith(S.String.pipe(S.minLength(1), S.maxLength(2048)), { nullable: true }),
1342
+ mime: S.optionalWith(S.String, { nullable: true }),
1343
+ type: S.optionalWith(S.String, { nullable: true }),
1344
+ status: S.optionalWith(S.String, { nullable: true }),
1345
+ bodies: S.optionalWith(PublicSnapshotsGetNetworkParamsBodies, { nullable: true }),
1346
+ detail: S.optionalWith(PublicSnapshotsGetNetworkParamsDetail, { nullable: true }),
1347
+ limit: S.optionalWith(S.String, { nullable: true }),
1348
+ cursor: S.optionalWith(S.String, { nullable: true }),
1349
+ }) {}
1350
+
1351
+ export class SnapshotNetworkEntryResourceType extends S.Literal(
1352
+ 'document',
1353
+ 'fetch',
1354
+ 'script',
1355
+ 'stylesheet',
1356
+ 'image',
1357
+ 'font',
1358
+ 'media',
1359
+ 'other',
1360
+ ) {}
1361
+
1362
+ export class SnapshotNetworkHeader extends S.Struct({
1363
+ name: S.String,
1364
+ value: S.String,
1365
+ }) {}
1366
+
1367
+ export class SnapshotNetworkQueryParam extends S.Struct({
1368
+ name: S.String,
1369
+ value: S.String,
1370
+ }) {}
1371
+
1372
+ export class SnapshotNetworkCookie extends S.Struct({
1373
+ name: S.String,
1374
+ value: S.String,
1375
+ }) {}
1376
+
1377
+ export class SnapshotNetworkRequest extends S.Struct({
1378
+ method: S.String,
1379
+ url: S.String,
1380
+ httpVersion: S.String,
1381
+ headers: S.Array(SnapshotNetworkHeader),
1382
+ queryString: S.Array(SnapshotNetworkQueryParam),
1383
+ cookies: S.Array(SnapshotNetworkCookie),
1384
+ headersSize: S.Number,
1385
+ bodySize: S.Number,
1386
+ postData: S.optionalWith(
1387
+ S.Struct({
1388
+ mimeType: S.String,
1389
+ text: S.String,
1390
+ }),
1391
+ { nullable: true },
1392
+ ),
1393
+ }) {}
1394
+
1395
+ export class SnapshotNetworkContent extends S.Struct({
1396
+ size: S.Number,
1397
+ mimeType: S.String,
1398
+ text: S.optionalWith(S.String, { nullable: true }),
1399
+ encoding: S.optionalWith(S.String, { nullable: true }),
1400
+ }) {}
1401
+
1402
+ export class SnapshotNetworkResponse extends S.Struct({
1403
+ status: S.Number,
1404
+ statusText: S.String,
1405
+ httpVersion: S.String,
1406
+ headers: S.Array(SnapshotNetworkHeader),
1407
+ cookies: S.Array(SnapshotNetworkCookie),
1408
+ content: SnapshotNetworkContent,
1409
+ redirectURL: S.String,
1410
+ headersSize: S.Number,
1411
+ bodySize: S.Number,
1412
+ }) {}
1413
+
1414
+ export class SnapshotNetworkTimings extends S.Struct({
1415
+ blocked: S.Number,
1416
+ dns: S.Number,
1417
+ connect: S.Number,
1418
+ send: S.Number,
1419
+ wait: S.Number,
1420
+ receive: S.Number,
1421
+ ssl: S.Number,
1422
+ }) {}
1423
+
1424
+ export class SnapshotNetworkEntry extends S.Struct({
1425
+ id: S.String,
1426
+ method: S.String,
1427
+ url: S.String,
1428
+ status: S.Number,
1429
+ mimeType: S.String,
1430
+ resourceType: SnapshotNetworkEntryResourceType,
1431
+ size: S.Number,
1432
+ startedDateTime: S.String,
1433
+ time: S.Number,
1434
+ content: S.String,
1435
+ body: S.optionalWith(
1436
+ S.Struct({
1437
+ text: S.String,
1438
+ encoding: S.optionalWith(S.String, { nullable: true }),
1439
+ }),
1440
+ { nullable: true },
1441
+ ),
1442
+ request: S.optionalWith(SnapshotNetworkRequest, { nullable: true }),
1443
+ response: S.optionalWith(SnapshotNetworkResponse, { nullable: true }),
1444
+ requestHeaders: S.optionalWith(S.Array(SnapshotNetworkHeader), { nullable: true }),
1445
+ requestCookies: S.optionalWith(S.Array(SnapshotNetworkCookie), { nullable: true }),
1446
+ responseHeaders: S.optionalWith(S.Array(SnapshotNetworkHeader), { nullable: true }),
1447
+ timings: S.optionalWith(SnapshotNetworkTimings, { nullable: true }),
1448
+ artifact: S.optionalWith(S.String, { nullable: true }),
1449
+ }) {}
1450
+
1451
+ export class SnapshotNetworkPage extends S.Class<SnapshotNetworkPage>('SnapshotNetworkPage')({
1452
+ items: S.Array(SnapshotNetworkEntry),
1453
+ next: S.optionalWith(S.String, { nullable: true }),
1454
+ }) {}
1455
+
1456
+ export class PublicSnapshotsGetNetwork400 extends S.Union(HttpApiDecodeError, BadRequest) {}
1457
+
1458
+ export class ArtifactUnavailableReason extends S.Literal('archive_missing', 'document_not_archived', 'not_html') {}
1459
+
1460
+ export class ArtifactUnavailableTag extends S.Literal('ArtifactUnavailable') {}
1461
+
1462
+ export class ArtifactUnavailable extends S.Struct({
1463
+ reason: ArtifactUnavailableReason,
1464
+ _tag: ArtifactUnavailableTag,
1465
+ }) {}
1466
+
1467
+ export class PublicSnapshotsGetNetwork404 extends S.Union(SnapshotNotFound, ArtifactUnavailable) {}
1468
+
1311
1469
  export const make = (
1312
1470
  httpClient: HttpClient.HttpClient,
1313
1471
  options: {
@@ -1472,6 +1630,28 @@ export const make = (
1472
1630
  ),
1473
1631
  ),
1474
1632
  ),
1633
+ searchSearch: (options) =>
1634
+ HttpClientRequest.make('POST')(`/v1/search`).pipe(
1635
+ (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
1636
+ Effect.flatMap((request) =>
1637
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
1638
+ Effect.flatMap(
1639
+ httpClient.execute(request),
1640
+ HttpClientResponse.matchStatus({
1641
+ '200': (r) => HttpClientResponse.schemaBodyJson(SearchResponse)(r),
1642
+ '400': (r) => decodeError(r, HttpApiDecodeError),
1643
+ '401': (r) => decodeError(r, AuthFailed),
1644
+ '403': (r) => decodeError(r, SearchSearch403),
1645
+ '413': (r) => decodeError(r, PayloadTooLarge),
1646
+ '429': (r) => decodeError(r, TooManyRequests),
1647
+ '500': (r) => decodeError(r, InternalError),
1648
+ '503': (r) => decodeError(r, ServiceUnavailable),
1649
+ orElse: (response) => unexpectedStatus(request, response),
1650
+ }),
1651
+ ),
1652
+ ),
1653
+ ),
1654
+ ),
1475
1655
  snapshotsHighlights: (snapshotId, options) =>
1476
1656
  HttpClientRequest.make('POST')(`/v1/snapshots/${snapshotId}/highlights`).pipe(
1477
1657
  (req) => Effect.orDie(HttpClientRequest.bodyJson(req, options)),
@@ -1517,6 +1697,38 @@ export const make = (
1517
1697
  ),
1518
1698
  ),
1519
1699
  ),
1700
+ publicSnapshotsGetNetwork: (snapshotId, options) =>
1701
+ HttpClientRequest.make('GET')(`/v1/public/snapshots/${snapshotId}/network`).pipe(
1702
+ HttpClientRequest.setUrlParams({
1703
+ q: options['q'] as UrlParams.Coercible,
1704
+ urlContains: options['urlContains'] as UrlParams.Coercible,
1705
+ mime: options['mime'] as UrlParams.Coercible,
1706
+ type: options['type'] as UrlParams.Coercible,
1707
+ status: options['status'] as UrlParams.Coercible,
1708
+ bodies: options['bodies'] as UrlParams.Coercible,
1709
+ detail: options['detail'] as UrlParams.Coercible,
1710
+ limit: options['limit'] as UrlParams.Coercible,
1711
+ cursor: options['cursor'] as UrlParams.Coercible,
1712
+ }),
1713
+ Effect.succeed,
1714
+ Effect.flatMap((request) =>
1715
+ Effect.flatMap(applyClientTransform(httpClient), (httpClient) =>
1716
+ Effect.flatMap(
1717
+ httpClient.execute(request),
1718
+ HttpClientResponse.matchStatus({
1719
+ '200': (r) => HttpClientResponse.schemaBodyJson(SnapshotNetworkPage)(r),
1720
+ '400': (r) => decodeError(r, PublicSnapshotsGetNetwork400),
1721
+ '404': (r) => decodeError(r, PublicSnapshotsGetNetwork404),
1722
+ '413': (r) => decodeError(r, PayloadTooLarge),
1723
+ '429': (r) => decodeError(r, TooManyRequests),
1724
+ '500': (r) => decodeError(r, InternalError),
1725
+ '503': (r) => decodeError(r, ServiceUnavailable),
1726
+ orElse: (response) => unexpectedStatus(request, response),
1727
+ }),
1728
+ ),
1729
+ ),
1730
+ ),
1731
+ ),
1520
1732
  }
1521
1733
  }
1522
1734
 
@@ -1609,6 +1821,20 @@ export interface Client {
1609
1821
  | typeof InternalError.Type
1610
1822
  | typeof ServiceUnavailable.Type
1611
1823
  >
1824
+ readonly searchSearch: (
1825
+ options: typeof SearchSearchRequest.Encoded,
1826
+ ) => Effect.Effect<
1827
+ typeof SearchResponse.Type,
1828
+ | HttpClientError.HttpClientError
1829
+ | ParseError
1830
+ | typeof HttpApiDecodeError.Type
1831
+ | typeof AuthFailed.Type
1832
+ | typeof SearchSearch403.Type
1833
+ | typeof PayloadTooLarge.Type
1834
+ | typeof TooManyRequests.Type
1835
+ | typeof InternalError.Type
1836
+ | typeof ServiceUnavailable.Type
1837
+ >
1612
1838
  readonly snapshotsHighlights: (
1613
1839
  snapshotId: string,
1614
1840
  options: typeof SnapshotHighlightsInput.Encoded,
@@ -1639,4 +1865,18 @@ export interface Client {
1639
1865
  | typeof InternalError.Type
1640
1866
  | typeof ServiceUnavailable.Type
1641
1867
  >
1868
+ readonly publicSnapshotsGetNetwork: (
1869
+ snapshotId: string,
1870
+ options: typeof PublicSnapshotsGetNetworkParams.Encoded,
1871
+ ) => Effect.Effect<
1872
+ typeof SnapshotNetworkPage.Type,
1873
+ | HttpClientError.HttpClientError
1874
+ | ParseError
1875
+ | typeof PublicSnapshotsGetNetwork400.Type
1876
+ | typeof PublicSnapshotsGetNetwork404.Type
1877
+ | typeof PayloadTooLarge.Type
1878
+ | typeof TooManyRequests.Type
1879
+ | typeof InternalError.Type
1880
+ | typeof ServiceUnavailable.Type
1881
+ >
1642
1882
  }
package/src/Internal.ts CHANGED
@@ -29,9 +29,13 @@ import {
29
29
  type GetBatchedParams,
30
30
  type GetBatchedResponse,
31
31
  type RequestOptions,
32
+ type SearchParams,
33
+ type SearchResponse,
32
34
  type SnapshotCatalog,
33
35
  type SnapshotGetParams,
34
36
  type SnapshotHighlightsResponse,
37
+ type SnapshotNetworkPage,
38
+ type SnapshotNetworkParams,
35
39
  } from './Service.js'
36
40
 
37
41
  const RETRYABLE_STATUS_CODES = HashSet.make(408, 409, 429, 500, 502, 503, 504, 529)
@@ -302,12 +306,24 @@ export class InternalClient extends Effect.Service<InternalClient>()('@expandai/
302
306
  ): Effect.Effect<FetchJsonResponse, ExpandClientError> =>
303
307
  service.fetchJson(params, options).pipe(Effect.mapError((error) => error.toPublicError()))
304
308
 
309
+ const search = (
310
+ params: SearchParams,
311
+ options: RequestOptions = {},
312
+ ): Effect.Effect<SearchResponse, ExpandClientError> =>
313
+ service.search(params, options).pipe(Effect.mapError((error) => error.toPublicError()))
314
+
305
315
  const getSnapshot = (
306
316
  params: SnapshotGetParams,
307
317
  options: RequestOptions = {},
308
318
  ): Effect.Effect<SnapshotCatalog | SnapshotHighlightsResponse, ExpandClientError> =>
309
319
  service.snapshots.get(params, options).pipe(Effect.mapError((error) => error.toPublicError()))
310
320
 
321
+ const getSnapshotNetwork = (
322
+ params: SnapshotNetworkParams,
323
+ options: RequestOptions = {},
324
+ ): Effect.Effect<SnapshotNetworkPage, ExpandClientError> =>
325
+ service.snapshots.network(params, options).pipe(Effect.mapError((error) => error.toPublicError()))
326
+
311
327
  const batched = (
312
328
  params: BatchedParams,
313
329
  options: BatchedRequestOptions,
@@ -326,7 +342,7 @@ export class InternalClient extends Effect.Service<InternalClient>()('@expandai/
326
342
  ): Effect.Effect<CancelBatchedResponse, ExpandClientError> =>
327
343
  service.cancelBatched(id, options).pipe(Effect.mapError((error) => error.toPublicError()))
328
344
 
329
- return { fetch, fetchJson, getSnapshot, batched, getBatched, cancelBatched } as const
345
+ return { fetch, fetchJson, search, getSnapshot, getSnapshotNetwork, batched, getBatched, cancelBatched } as const
330
346
  }),
331
347
  }) {
332
348
  /**
package/src/Service.ts CHANGED
@@ -88,6 +88,9 @@ interface LocalOptions {
88
88
  readonly local?: boolean
89
89
  }
90
90
 
91
+ export type SearchParams = typeof Generated.SearchSearchRequest.Encoded
92
+ export type SearchResponse = typeof Generated.SearchResponse.Type
93
+
91
94
  export type FetchParams = typeof Generated.FetchFetchRequest.Encoded
92
95
  export type FetchResponse = string
93
96
  export type FetchRequestOptions = RequestOptions & typeof Generated.FetchFetchParams.Encoded & LocalOptions
@@ -110,6 +113,47 @@ export interface SnapshotGetParams {
110
113
  readonly include?: SnapshotHighlightsParams['include']
111
114
  }
112
115
  export type SnapshotCatalog = typeof Generated.SnapshotCatalog.Type
116
+ /**
117
+ * `json`, `csv`, `html` and `file` match the response content; the rest match how the browser
118
+ * requested the resource. `xhr` is the same as `fetch`.
119
+ */
120
+ export type SnapshotNetworkType =
121
+ | 'json'
122
+ | 'csv'
123
+ | 'html'
124
+ | 'file'
125
+ | 'document'
126
+ | 'fetch'
127
+ | 'xhr'
128
+ | 'script'
129
+ | 'stylesheet'
130
+ | 'image'
131
+ | 'font'
132
+ | 'media'
133
+ | 'other'
134
+ /** Filters and paging for a Snapshot's captured network requests. Lists combine with OR, fields with AND. */
135
+ export interface SnapshotNetworkParams {
136
+ readonly snapshotId: string
137
+ /** Case-insensitive substring of the request URL. */
138
+ readonly q?: string
139
+ /** Case-insensitive substring of the request URL; with `q`, both must match. */
140
+ readonly urlContains?: string
141
+ /** Case-insensitive substrings of the response MIME type, such as `json` or `text/csv`. */
142
+ readonly mime?: string | readonly string[]
143
+ readonly type?: SnapshotNetworkType | readonly SnapshotNetworkType[]
144
+ /** Status codes or classes, such as `200` or `'4xx'`. `0` is a request that got no response. */
145
+ readonly status?: number | string | ReadonlyArray<number | string>
146
+ /** `inline` (default) returns the response bodies the capture kept; `none` omits them. Request payloads stay in `detail: 'full'`. */
147
+ readonly bodies?: 'none' | 'inline'
148
+ /** `full` (default) adds HAR request and response detail; `summary` keeps each entry small. */
149
+ readonly detail?: 'summary' | 'full'
150
+ /** Entries per page, 1 to 1000. Without it the server returns every matching entry and no `next`. */
151
+ readonly limit?: number
152
+ /** The previous page's `next`, with the same filters. Without `limit`, returns the rest of the listing. */
153
+ readonly cursor?: string
154
+ }
155
+ export type SnapshotNetworkPage = typeof Generated.SnapshotNetworkPage.Type
156
+ export type SnapshotNetworkEntry = typeof Generated.SnapshotNetworkEntry.Type
113
157
  export type SnapshotHighlightsResponse = FetchSnapshotHighlightsResultWithJson
114
158
  export type BatchedParams = typeof Generated.FetchBatchedRequest.Encoded
115
159
  export type BatchedResponse = typeof Generated.BatchedRun.Type
@@ -329,6 +373,13 @@ export class ExpandService extends Effect.Service<ExpandService>()('@expandai/sd
329
373
  )
330
374
  })
331
375
 
376
+ const search = Effect.fn('ExpandService.search')(function* (
377
+ params: SearchParams,
378
+ requestOptions: RequestOptions = {},
379
+ ) {
380
+ return yield* withRetries(generated.searchSearch(params), requestOptions)
381
+ })
382
+
332
383
  const publicClient = httpClient.pipe(
333
384
  HttpClient.mapRequest(HttpClientRequest.prependUrl(config.baseUrl)),
334
385
  recordRetryAfter,
@@ -363,6 +414,25 @@ export class ExpandService extends Effect.Service<ExpandService>()('@expandai/sd
363
414
  )
364
415
  }
365
416
 
417
+ const commaList = (value: string | number | ReadonlyArray<string | number> | undefined) =>
418
+ value === undefined ? undefined : typeof value === 'object' ? value.join(',') : String(value)
419
+ const listSnapshotNetwork = (
420
+ params: SnapshotNetworkParams,
421
+ options: RequestOptions = {},
422
+ ): Effect.Effect<SnapshotNetworkPage, ExpandError> => {
423
+ const { snapshotId, mime, type, status, limit, ...filters } = params
424
+ return withRetries(
425
+ Generated.make(publicClient).publicSnapshotsGetNetwork(encodeURIComponent(snapshotId), {
426
+ ...filters,
427
+ mime: commaList(mime),
428
+ type: commaList(type),
429
+ status: commaList(status),
430
+ limit: commaList(limit),
431
+ }),
432
+ options,
433
+ )
434
+ }
435
+
366
436
  const batched = Effect.fn('ExpandService.batched')(function* (
367
437
  params: BatchedParams,
368
438
  requestOptions: BatchedRequestOptions = {},
@@ -524,7 +594,16 @@ export class ExpandService extends Effect.Service<ExpandService>()('@expandai/sd
524
594
  Effect.map((created) => created.map(({ id }) => crawlById(id))),
525
595
  ),
526
596
  })
527
- return { fetch, fetchJson, snapshots: { get: getSnapshot }, batched, getBatched, cancelBatched, crawls } as const
597
+ return {
598
+ fetch,
599
+ fetchJson,
600
+ search,
601
+ snapshots: { get: getSnapshot, network: listSnapshotNetwork },
602
+ batched,
603
+ getBatched,
604
+ cancelBatched,
605
+ crawls,
606
+ } as const
528
607
  }),
529
608
  }) {
530
609
  /**
package/src/index.ts CHANGED
@@ -22,11 +22,17 @@ export type {
22
22
  FetchResponse,
23
23
  GetBatchedParams,
24
24
  GetBatchedResponse,
25
+ SearchParams,
26
+ SearchResponse,
25
27
  SnapshotCatalog,
26
28
  SnapshotCatalogParams,
27
29
  SnapshotGetParams,
28
30
  SnapshotHighlightsParams,
29
31
  SnapshotHighlightsResponse,
32
+ SnapshotNetworkEntry,
33
+ SnapshotNetworkPage,
34
+ SnapshotNetworkParams,
35
+ SnapshotNetworkType,
30
36
  } from './Client.js'
31
37
  export { Expand, ExpandClient } from './Client.js'
32
38
  export * from './Crawls.js'