@madewithremy/admin 0.1.6 → 0.1.7

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/dist/index.d.ts CHANGED
@@ -1273,6 +1273,25 @@ interface DataSourcesPlacement {
1273
1273
  offeringLabel: string | null;
1274
1274
  phase: string;
1275
1275
  }
1276
+ /**
1277
+ * A placement move in flight on the active version, or the last one's
1278
+ * failure; null when idle. The points are copied from durable storage onto
1279
+ * the target in the background (no re-embedding); the source flips when
1280
+ * `copied` reaches `total`. While it runs, writes to the source are refused
1281
+ * with `data_source_migrating`; search keeps serving from the old placement.
1282
+ * A sibling of `placement` because a source on the shared pool (placement
1283
+ * null) can be moving too.
1284
+ */
1285
+ interface DataSourcesMigration {
1286
+ /** Where it is going; null is the shared pool. */
1287
+ toResourceId: string | null;
1288
+ toName: string | null;
1289
+ copied: number;
1290
+ total: number;
1291
+ startedAt: string;
1292
+ /** Set when the move failed; the source is unfrozen and a new move may start. */
1293
+ error: string | null;
1294
+ }
1276
1295
  /** One data source in the GET /datasources listing. */
1277
1296
  interface DataSourcesListEntry {
1278
1297
  id: string;
@@ -1296,6 +1315,8 @@ interface DataSourcesListEntry {
1296
1315
  } | null;
1297
1316
  /** Dedicated placement, or null for the shared pool. */
1298
1317
  placement: DataSourcesPlacement | null;
1318
+ /** A move in flight, or its last failure. */
1319
+ migration: DataSourcesMigration | null;
1299
1320
  createdAt: string;
1300
1321
  }
1301
1322
  /** GET /datasources — all data sources for the app. */
@@ -1380,13 +1401,19 @@ interface DataSourcesConfigResult {
1380
1401
  config: DataSourcesIngestConfig;
1381
1402
  } | null;
1382
1403
  }
1383
- /** POST /datasources/config — response after updating configuration. */
1404
+ /**
1405
+ * POST /datasources/config — response after updating configuration.
1406
+ *
1407
+ * `placementChanged` with `migration` set means a populated source started a
1408
+ * background move rather than moving on the spot.
1409
+ */
1384
1410
  interface DataSourcesConfigUpdateResult {
1385
1411
  ingestChanged: boolean;
1386
1412
  placementChanged: boolean;
1387
1413
  ingest: DataSourcesIngestConfig;
1388
1414
  retrieval: Partial<DataSourcesRetrievalConfig>;
1389
1415
  placement: DataSourcesPlacement | null;
1416
+ migration: DataSourcesMigration | null;
1390
1417
  }
1391
1418
  /** POST /datasources — an empty source, on the requested placement. */
1392
1419
  interface DataSourcesCreateResult {
@@ -1403,6 +1430,13 @@ interface DataSourcesCreateResult {
1403
1430
  config: DataSourcesIngestConfig;
1404
1431
  };
1405
1432
  placement: DataSourcesPlacement | null;
1433
+ migration: DataSourcesMigration | null;
1434
+ }
1435
+ /** POST /datasources/move — the move as started (or applied, for an empty source). */
1436
+ interface DataSourcesMoveResult {
1437
+ placement: DataSourcesPlacement | null;
1438
+ /** Null when the source was empty and moved on the spot. */
1439
+ migration: DataSourcesMigration | null;
1406
1440
  }
1407
1441
  /**
1408
1442
  * POST /datasources/revectorize — starts a new candidate pipeline alongside the live one.
@@ -1661,9 +1695,8 @@ interface ConfigSetParams {
1661
1695
  retrieval?: DataSourcesRetrievalUpdate;
1662
1696
  /**
1663
1697
  * Where the corpus lives: a dedicated resource (see `admin.infra`) or the
1664
- * shared pool. Accepted only while the source has no built documents —
1665
- * moving a populated source is refused with
1666
- * `placement_change_requires_migration`.
1698
+ * shared pool. An empty source moves on the spot; a populated one starts a
1699
+ * background move (see `move`) and the response carries its `migration`.
1667
1700
  */
1668
1701
  placement?: {
1669
1702
  resourceId: string;
@@ -1677,7 +1710,8 @@ interface ConfigSetParams {
1677
1710
  * instead, which builds a new version alongside the live one so search never
1678
1711
  * degrades.
1679
1712
  *
1680
- * @throws AdminApiError `data_source_not_found` (404).
1713
+ * @throws AdminApiError `data_source_not_found` (404),
1714
+ * `data_source_migrating` (422) while a move is in flight.
1681
1715
  * @example
1682
1716
  * await admin.dataSources.configSet({
1683
1717
  * slug: 'policies',
@@ -1704,18 +1738,74 @@ interface CreateParams {
1704
1738
  * Create an empty data source, optionally on dedicated capacity.
1705
1739
  *
1706
1740
  * The one-step way to start a corpus on a resource. `add` also creates a
1707
- * source on first use, but on the shared pool, and a source with built
1708
- * documents cannot move, so a corpus meant for dedicated capacity starts here.
1709
- * Calling this for a source that already exists returns it; a placement given
1710
- * then follows `configSet`'s rule and moves it only while it is empty.
1741
+ * source on first use, but on the shared pool. Calling this for a source that
1742
+ * already exists returns it; a placement given then follows `configSet`'s
1743
+ * rule — an empty source moves on the spot, a populated one starts a move.
1711
1744
  *
1712
1745
  * @throws AdminApiError `invalid_data_source` (400), `data_source_limit` (422),
1713
1746
  * `resource_not_found` (404), `resource_destroyed` (422),
1714
- * `placement_change_requires_migration` (422).
1747
+ * `data_source_migrating` (422), `capacity_exceeded` (422).
1715
1748
  * @example
1716
1749
  * await admin.dataSources.create({ slug: 'archive', placement: { resourceId } });
1717
1750
  */
1718
1751
  declare function create$1(ctx: AdminContext, params: CreateParams): Promise<DataSourcesCreateResult>;
1752
+ interface MoveParams {
1753
+ /** Data source slug. */
1754
+ slug: string;
1755
+ /** A dedicated resource (see `admin.infra`) or the shared pool. */
1756
+ placement: {
1757
+ resourceId: string;
1758
+ } | 'shared';
1759
+ }
1760
+ /**
1761
+ * Move a data source between placements: shared → dedicated, dedicated →
1762
+ * shared, or one resource to another.
1763
+ *
1764
+ * A populated source is copied onto the target in the background from its
1765
+ * stored vectors — nothing is re-extracted or re-embedded — and flips when the
1766
+ * copy lands. Search keeps serving from the old placement meanwhile. Adding,
1767
+ * removing or reconfiguring documents is refused with `data_source_migrating`
1768
+ * until it finishes; `waitForMove` blocks on that. Moving to `'shared'` is how
1769
+ * a source leaves a resource that is about to be destroyed.
1770
+ *
1771
+ * @throws AdminApiError `data_source_not_found` (404), `same_placement` (400),
1772
+ * `data_source_busy` (422) while documents are still building or a
1773
+ * candidate version exists, `data_source_migrating` (422), `capacity_<phase>`
1774
+ * (422) when the target resource is not active, `capacity_exceeded` (422)
1775
+ * when the target is too small, `resource_not_found` (404).
1776
+ * @example
1777
+ * await admin.dataSources.move({ slug: 'archive', placement: { resourceId } });
1778
+ * const result = await admin.dataSources.waitForMove({ slug: 'archive' });
1779
+ */
1780
+ declare function move(ctx: AdminContext, params: MoveParams): Promise<DataSourcesMoveResult>;
1781
+ interface WaitForMoveParams {
1782
+ slug: string;
1783
+ /** Defaults to DEFAULT_WAIT_TIMEOUT_MS (15 min). */
1784
+ timeoutMs?: number;
1785
+ /** Receives `moving… X/Y documents (Ns)`. */
1786
+ onProgress?: (message: string) => void;
1787
+ }
1788
+ type WaitForMoveResult = {
1789
+ status: 'done';
1790
+ source: DataSourcesListEntry;
1791
+ } | {
1792
+ status: 'failed';
1793
+ source: DataSourcesListEntry;
1794
+ error: string;
1795
+ } | {
1796
+ status: 'timeout';
1797
+ source: DataSourcesListEntry;
1798
+ error: string;
1799
+ };
1800
+ /**
1801
+ * Poll until a source's move has landed, failed, or the timeout elapses.
1802
+ *
1803
+ * Reads the source from `list` each poll; done when no move is in flight. A
1804
+ * failed move returns immediately with the platform's error.
1805
+ *
1806
+ * @throws AdminApiError `data_source_not_found` (404).
1807
+ */
1808
+ declare function waitForMove(ctx: AdminContext, params: WaitForMoveParams): Promise<WaitForMoveResult>;
1719
1809
  interface RevectorizeParams {
1720
1810
  /** Data source slug. */
1721
1811
  slug: string;
@@ -1815,6 +1905,7 @@ type dataSources_CreateParams = CreateParams;
1815
1905
  declare const dataSources_DOCUMENTS_IDS_MAX: typeof DOCUMENTS_IDS_MAX;
1816
1906
  type dataSources_DocumentsParams = DocumentsParams;
1817
1907
  type dataSources_DropParams = DropParams;
1908
+ type dataSources_MoveParams = MoveParams;
1818
1909
  type dataSources_PromoteParams = PromoteParams;
1819
1910
  type dataSources_RevectorizeParams = RevectorizeParams;
1820
1911
  type dataSources_RmParams = RmParams;
@@ -1822,6 +1913,8 @@ type dataSources_SearchParams = SearchParams;
1822
1913
  type dataSources_SummarizedDocument = SummarizedDocument;
1823
1914
  type dataSources_WaitForIngestParams = WaitForIngestParams;
1824
1915
  type dataSources_WaitForIngestResult = WaitForIngestResult;
1916
+ type dataSources_WaitForMoveParams = WaitForMoveParams;
1917
+ type dataSources_WaitForMoveResult = WaitForMoveResult;
1825
1918
  declare const dataSources_addDocument: typeof addDocument;
1826
1919
  declare const dataSources_allDocuments: typeof allDocuments;
1827
1920
  declare const dataSources_configGet: typeof configGet;
@@ -1829,14 +1922,16 @@ declare const dataSources_configSet: typeof configSet;
1829
1922
  declare const dataSources_deleteSource: typeof deleteSource;
1830
1923
  declare const dataSources_documents: typeof documents;
1831
1924
  declare const dataSources_drop: typeof drop;
1925
+ declare const dataSources_move: typeof move;
1832
1926
  declare const dataSources_promote: typeof promote;
1833
1927
  declare const dataSources_revectorize: typeof revectorize;
1834
1928
  declare const dataSources_rm: typeof rm;
1835
1929
  declare const dataSources_search: typeof search;
1836
1930
  declare const dataSources_summarize: typeof summarize;
1837
1931
  declare const dataSources_waitForIngest: typeof waitForIngest;
1932
+ declare const dataSources_waitForMove: typeof waitForMove;
1838
1933
  declare namespace dataSources {
1839
- export { type dataSources_AddDocumentParams as AddDocumentParams, type dataSources_AddDocumentResult as AddDocumentResult, type dataSources_ConfigSetParams as ConfigSetParams, type dataSources_CreateParams as CreateParams, DEFAULT_WAIT_TIMEOUT_MS$1 as DEFAULT_WAIT_TIMEOUT_MS, dataSources_DOCUMENTS_IDS_MAX as DOCUMENTS_IDS_MAX, type dataSources_DocumentsParams as DocumentsParams, type dataSources_DropParams as DropParams, type dataSources_PromoteParams as PromoteParams, type dataSources_RevectorizeParams as RevectorizeParams, type dataSources_RmParams as RmParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForIngestParams as WaitForIngestParams, type dataSources_WaitForIngestResult as WaitForIngestResult, dataSources_addDocument as addDocument, dataSources_allDocuments as allDocuments, dataSources_configGet as configGet, dataSources_configSet as configSet, create$1 as create, dataSources_deleteSource as deleteSource, dataSources_documents as documents, dataSources_drop as drop, list$7 as list, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_search as search, dataSources_summarize as summarize, dataSources_waitForIngest as waitForIngest };
1934
+ export { type dataSources_AddDocumentParams as AddDocumentParams, type dataSources_AddDocumentResult as AddDocumentResult, type dataSources_ConfigSetParams as ConfigSetParams, type dataSources_CreateParams as CreateParams, DEFAULT_WAIT_TIMEOUT_MS$1 as DEFAULT_WAIT_TIMEOUT_MS, dataSources_DOCUMENTS_IDS_MAX as DOCUMENTS_IDS_MAX, type dataSources_DocumentsParams as DocumentsParams, type dataSources_DropParams as DropParams, type dataSources_MoveParams as MoveParams, type dataSources_PromoteParams as PromoteParams, type dataSources_RevectorizeParams as RevectorizeParams, type dataSources_RmParams as RmParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForIngestParams as WaitForIngestParams, type dataSources_WaitForIngestResult as WaitForIngestResult, type dataSources_WaitForMoveParams as WaitForMoveParams, type dataSources_WaitForMoveResult as WaitForMoveResult, dataSources_addDocument as addDocument, dataSources_allDocuments as allDocuments, dataSources_configGet as configGet, dataSources_configSet as configSet, create$1 as create, dataSources_deleteSource as deleteSource, dataSources_documents as documents, dataSources_drop as drop, list$7 as list, dataSources_move as move, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_search as search, dataSources_summarize as summarize, dataSources_waitForIngest as waitForIngest, dataSources_waitForMove as waitForMove };
1840
1935
  }
1841
1936
 
1842
1937
  /**
@@ -3076,9 +3171,15 @@ interface InfraResource {
3076
3171
  health: InfraHealth | null;
3077
3172
  /**
3078
3173
  * What the instance is doing right now, while a transition is under way
3079
- * ("Waiting for capacity", "Snapshotting ds_x (1/2)"); null when nothing is.
3174
+ * ("Waiting for capacity", "Snapshotting collection 1/2"); null when nothing is.
3080
3175
  */
3081
3176
  detail: string | null;
3177
+ /**
3178
+ * The size this resource is being resized to, while a resize is under way;
3179
+ * null otherwise. A resize passes through `hibernated` and back to the phase
3180
+ * it started from.
3181
+ */
3182
+ resizingTo: InfraOffering | null;
3082
3183
  /** When the last verified snapshot was taken; null if never. */
3083
3184
  lastSnapshotAt: string | null;
3084
3185
  activatedAt: string | null;
@@ -3114,7 +3215,7 @@ interface InfraGetResult {
3114
3215
  name: string | null;
3115
3216
  }[];
3116
3217
  }
3117
- /** POST /infra, /infra/:id/{hibernate,resume,destroy,rename} */
3218
+ /** POST /infra, /infra/:id/{hibernate,resume,destroy,rename,resize} */
3118
3219
  interface InfraResourceResult {
3119
3220
  resource: InfraResource;
3120
3221
  }
@@ -3191,13 +3292,39 @@ declare function hibernate(ctx: AdminContext, params: ResourceIdParams): Promise
3191
3292
  declare function resume(ctx: AdminContext, params: ResourceIdParams): Promise<InfraResourceResult>;
3192
3293
  /**
3193
3294
  * Delete a resource. Refused while any data source is placed on it — move
3194
- * those to shared capacity (`datasources config --placement shared`) or
3195
- * delete them first. Billing stops when the phase reaches `destroyed`.
3295
+ * those to shared capacity (`admin.dataSources.move({ placement: 'shared' })`,
3296
+ * data intact) or delete them first. Billing stops when the phase reaches
3297
+ * `destroyed`.
3196
3298
  *
3197
3299
  * @throws AdminApiError `resource_not_found` (404),
3198
3300
  * `resource_has_attachments` (422), `invalid_transition` (422).
3199
3301
  */
3200
3302
  declare function destroy(ctx: AdminContext, params: ResourceIdParams): Promise<InfraResourceResult>;
3303
+ interface ResizeParams {
3304
+ id: string;
3305
+ /** Offering id from `list().offerings`, e.g. `retrieval.medium`. */
3306
+ offeringId: string;
3307
+ }
3308
+ /**
3309
+ * Change a resource's size, keeping its data.
3310
+ *
3311
+ * The platform parks the resource (a fresh snapshot), swaps its spec, and
3312
+ * brings it back up restored from that snapshot, so a resize passes through
3313
+ * `hibernated` and searches on its sources pause for the few minutes it
3314
+ * takes. A resource that is already hibernated swaps in place and stays
3315
+ * parked. Growing is gated on a month of credits at the new rate like a
3316
+ * provision; shrinking is refused below what the resource holds. The response
3317
+ * carries `resizingTo` until the swap has happened; `waitForPhase` with
3318
+ * `until: (r) => r.resizingTo === null` blocks on the whole thing.
3319
+ *
3320
+ * @throws AdminApiError `resource_not_found` (404), `offering_not_found`
3321
+ * (400), `offering_retired` (422), `same_offering` (400),
3322
+ * `offering_kind_mismatch` (400), `resize_pending` (422), `resize_too_small`
3323
+ * (422), `insufficient_credits` (402), `invalid_transition` (422).
3324
+ * @example
3325
+ * await admin.infra.resize({ id, offeringId: 'retrieval.medium' });
3326
+ */
3327
+ declare function resize(ctx: AdminContext, params: ResizeParams): Promise<InfraResourceResult>;
3201
3328
  interface RenameParams {
3202
3329
  id: string;
3203
3330
  name: string;
@@ -3208,6 +3335,11 @@ interface WaitForPhaseParams {
3208
3335
  id: string;
3209
3336
  /** The phase(s) that count as done. */
3210
3337
  phases: InfraPhase[];
3338
+ /**
3339
+ * An extra condition on top of the phase — a resize, for one, ends in the
3340
+ * phase it started from and is done only once `resizingTo` has cleared.
3341
+ */
3342
+ until?: (resource: InfraResource) => boolean;
3211
3343
  /** Default 10 minutes. */
3212
3344
  timeoutMs?: number;
3213
3345
  onProgress?: (message: string) => void;
@@ -3238,6 +3370,7 @@ type infra_GetParams = GetParams;
3238
3370
  type infra_ListParams = ListParams;
3239
3371
  type infra_ProvisionParams = ProvisionParams;
3240
3372
  type infra_RenameParams = RenameParams;
3373
+ type infra_ResizeParams = ResizeParams;
3241
3374
  type infra_ResourceIdParams = ResourceIdParams;
3242
3375
  type infra_WaitForPhaseParams = WaitForPhaseParams;
3243
3376
  type infra_WaitForPhaseResult = WaitForPhaseResult;
@@ -3245,10 +3378,11 @@ declare const infra_destroy: typeof destroy;
3245
3378
  declare const infra_hibernate: typeof hibernate;
3246
3379
  declare const infra_provision: typeof provision;
3247
3380
  declare const infra_rename: typeof rename;
3381
+ declare const infra_resize: typeof resize;
3248
3382
  declare const infra_resume: typeof resume;
3249
3383
  declare const infra_waitForPhase: typeof waitForPhase;
3250
3384
  declare namespace infra {
3251
- export { infra_DEFAULT_WAIT_TIMEOUT_MS as DEFAULT_WAIT_TIMEOUT_MS, type infra_GetParams as GetParams, type infra_ListParams as ListParams, type infra_ProvisionParams as ProvisionParams, type infra_RenameParams as RenameParams, type infra_ResourceIdParams as ResourceIdParams, type infra_WaitForPhaseParams as WaitForPhaseParams, type infra_WaitForPhaseResult as WaitForPhaseResult, infra_destroy as destroy, get$4 as get, infra_hibernate as hibernate, list$6 as list, infra_provision as provision, infra_rename as rename, infra_resume as resume, infra_waitForPhase as waitForPhase };
3385
+ export { infra_DEFAULT_WAIT_TIMEOUT_MS as DEFAULT_WAIT_TIMEOUT_MS, type infra_GetParams as GetParams, type infra_ListParams as ListParams, type infra_ProvisionParams as ProvisionParams, type infra_RenameParams as RenameParams, type infra_ResizeParams as ResizeParams, type infra_ResourceIdParams as ResourceIdParams, type infra_WaitForPhaseParams as WaitForPhaseParams, type infra_WaitForPhaseResult as WaitForPhaseResult, infra_destroy as destroy, get$4 as get, infra_hibernate as hibernate, list$6 as list, infra_provision as provision, infra_rename as rename, infra_resize as resize, infra_resume as resume, infra_waitForPhase as waitForPhase };
3252
3386
  }
3253
3387
 
3254
3388
  /**
@@ -5777,4 +5911,4 @@ declare class AdminTimeoutError extends Error {
5777
5911
 
5778
5912
  declare const admin: AdminClient;
5779
5913
 
5780
- export { AdminApiError, type AdminClient, type AdminClientOptions, type AdminContext, AdminTimeoutError, type AgentThreadDetail, type AgentThreadListItem, type AgentThreadsGetResult, type AgentThreadsListResult, type AgentToolCall, type AgentTranscriptMessage, type AgentTurnError, type AnalyticsAiHostRow, type AnalyticsAiSourcesResult, type AnalyticsAiVendorRow, type AnalyticsBatchResult, type AnalyticsCrawlersOverviewResult, type AnalyticsCrawlersRecentResult, type AnalyticsCrawlersRecentRow, type AnalyticsCrawlersResult, type AnalyticsCrawlersTimeseriesBucket, type AnalyticsCrawlersTimeseriesResult, type AnalyticsLiveResult, type AnalyticsMapPoint, type AnalyticsMapResult, type AnalyticsMetric, type AnalyticsQueryResult, type AnalyticsQueryResultRow, type AnalyticsSourceRow, type AnalyticsSourcesResult, type AppCronJobStatus, type AppCronJobStatusReason, type AppCronRunState, type AppEmailSuppression, type AppSecretRow, type CrashGroup, type CrashOccurrenceRow, type CrashesGetResult, type CrashesListResult, type CrashesOccurrencesResult, type CrashesStatsBucket, type CrashesStatsResult, type CronJobDecorated, type CronOverviewResult, type CronRunResult, type CronRunSummary, type DashboardLiveRelease, type DashboardReleaseMethod, type DashboardResult, type DataLiftFromDevResult, type DataLiftFromLiveResult, type DataSourcesBuildProgress, type DataSourcesChunkingConfig, type DataSourcesChunkingStrategy, type DataSourcesConfigResult, type DataSourcesConfigUpdateResult, type DataSourcesCreateResult, type DataSourcesDeleteResult, type DataSourcesDocument, type DataSourcesDocumentConfirmResult, type DataSourcesDocumentDeleteResult, type DataSourcesDocumentStatus, type DataSourcesDocumentsResult, type DataSourcesDropResult, type DataSourcesIngestConfig, type DataSourcesIngestUpdate, type DataSourcesListEntry, type DataSourcesListResult, type DataSourcesPlacement, type DataSourcesPromoteResult, type DataSourcesRetrievalConfig, type DataSourcesRetrievalUpdate, type DataSourcesRevectorizeResult, type DataSourcesSearchCitation, type DataSourcesSearchResult, type DataSourcesSearchResultItem, type DataSourcesUploadTokenResult, type DatasetFile, type DbQueryResult, type DiagnosticsAuditEnvironment, type DiagnosticsDashboardResult, type DiagnosticsFinding, type DiagnosticsLighthouseScores, type DiagnosticsPayload, type DiagnosticsReleaseResult, type DiagnosticsRuntimeFindings, type DomainsCheckResult, type DomainsCustomAddResult, type DomainsCustomCheckResult, type DomainsCustomHostnameUiStatus, type DomainsCustomHostnameView, type DomainsCustomListResult, type DomainsCustomRemoveResult, type DomainsCustomRetryResult, type DomainsDnsInstructions, type DomainsGetResult, type DomainsSetResult, type EmailBatchLifecycle, type EmailBatchResult, type EmailBatchSummary, type EmailBatchesResult, type EmailDomainBase, type EmailEffectiveSender, type EmailInboxResult, type EmailListResult, type EmailMessageKind, type EmailMessageResult, type EmailMessageStatus, type EmailSenderTier, type EmailSendingStatusResult, type EmailStatsResult, type EmailSummary, type EmailSuppressResult, type EmailSuppressionsResult, type EmailUnsuppressResult, type EventChannelActivity, type EventsChannelsListResult, type EventsPublishResult, type EventsTailFrame, type FilesDeleteResult, type FilesFileMeta, type FilesListEntry, type FilesListResult, type FilesLsResult, type FilesScanBadge, type FilesScanFlagged, type FilesScanStore, type FilesStatResult, type FilesStoreSummaryEntry, type FilesUploadUrlResult, type FilesUrlResult, type FrontendErrorType, type InboundDnsInstructions, type InboundEmailDomainAddResult, type InboundEmailDomainCheckResult, type InboundEmailDomainDeleteResult, type InboundEmailDomainUiStatus, type InboundEmailDomainVerifyResult, type InboundEmailDomainView, type InboundEmailDomainsListResult, type InboxEmailPreview, type IssueAuthorKind, type IssueCommentRow, type IssueEventType, type IssueKind, type IssueRow, type IssueStatus, type IssuesCommentResult, type IssuesCreateResult, type IssuesDeleteResult, type IssuesGetResult, type IssuesListResult, type IssuesUpdateResult, type JewelPairRow, type JewelPairSummaryRow, type JewelVerdict, type JewelsDatasetSummary, type JewelsDryrunResult, type JewelsExportResult, type JewelsGradeResult, type JewelsGrading, type JewelsOverviewResult, type JewelsPairResult, type JewelsPairsResult, type JewelsQueueResult, type JewelsResolveResult, type JewelsRunResult, type JewelsRunsResult, type JewelsTimeseriesBucket, type JewelsTimeseriesResult, type JewelsTrainResult, type LiftedDatabase, type MethodsInvokeResult, type OutboundDnsInstructions, type OutboundEmailDomainAddResult, type OutboundEmailDomainCheckResult, type OutboundEmailDomainDeleteResult, type OutboundEmailDomainUiStatus, type OutboundEmailDomainVerifyResult, type OutboundEmailDomainView, type OutboundEmailDomainsListResult, type PlatformSuppression, type PrerenderGetResult, type PrerenderInvalidateResult, type PrerenderPage, type PrerenderPagesResult, type PrerenderViewResult, type ReleaseFailureFields, type ReleaseFragment, type ReleasesByCommitResult, type ReleasesGetResult, type ReleasesListResult, type RequestsGetResult, type RequestsListResult, type RequestsListRow, type RequestsStatsMethodBucket, type RequestsStatsMethodResult, type RequestsStatsSummaryBucket, type RequestsStatsSummaryResult, type SecretsDeleteResult, type SecretsGetResult, type SecretsListResult, type SecretsSetResult, type SettingsResult, type SuppressionSource, type TrainingLogEntry, type TrainingRunRow, type TrainingRunStatus, type UserAuthProvider, type UserListItem, type UserRecord, type UsersCreateApiKeyResult, type UsersListResult, type UsersRevokeApiKeyResult, type UsersSetRoleResult, type V2AppSettings, type V2BuildLogEntry, type V2BuildStats, type V2CommitInfo, type V2EmailMessage, type V2ReleaseStatus, type VoiceAvailableNumber, type VoiceNumbersBuyResult, type VoiceNumbersListResult, type VoiceNumbersReleaseResult, type VoiceNumbersSearchResult, type VoiceNumbersSetNameResult, type VoicePhoneNumberStatus, type VoicePhoneNumberView, type VoiceResolvedPolicy, type VoiceSessionChannel, type VoiceSessionCost, type VoiceSessionCostLine, type VoiceSessionDetail, type VoiceSessionGetResult, type VoiceSessionListItem, type VoiceSessionSip, type VoiceSessionSpeechEntry, type VoiceSessionStatus, type VoiceSessionToolEntry, type VoiceSessionTranscriptEntry, type VoiceSessionsListResult, type VoiceSettingsCeilings, type VoiceSettingsGetResult, type VoiceSettingsOverrides, type VoiceSettingsSetResult, admin, createAdminClient, admin as default };
5914
+ export { AdminApiError, type AdminClient, type AdminClientOptions, type AdminContext, AdminTimeoutError, type AgentThreadDetail, type AgentThreadListItem, type AgentThreadsGetResult, type AgentThreadsListResult, type AgentToolCall, type AgentTranscriptMessage, type AgentTurnError, type AnalyticsAiHostRow, type AnalyticsAiSourcesResult, type AnalyticsAiVendorRow, type AnalyticsBatchResult, type AnalyticsCrawlersOverviewResult, type AnalyticsCrawlersRecentResult, type AnalyticsCrawlersRecentRow, type AnalyticsCrawlersResult, type AnalyticsCrawlersTimeseriesBucket, type AnalyticsCrawlersTimeseriesResult, type AnalyticsLiveResult, type AnalyticsMapPoint, type AnalyticsMapResult, type AnalyticsMetric, type AnalyticsQueryResult, type AnalyticsQueryResultRow, type AnalyticsSourceRow, type AnalyticsSourcesResult, type AppCronJobStatus, type AppCronJobStatusReason, type AppCronRunState, type AppEmailSuppression, type AppSecretRow, type CrashGroup, type CrashOccurrenceRow, type CrashesGetResult, type CrashesListResult, type CrashesOccurrencesResult, type CrashesStatsBucket, type CrashesStatsResult, type CronJobDecorated, type CronOverviewResult, type CronRunResult, type CronRunSummary, type DashboardLiveRelease, type DashboardReleaseMethod, type DashboardResult, type DataLiftFromDevResult, type DataLiftFromLiveResult, type DataSourcesBuildProgress, type DataSourcesChunkingConfig, type DataSourcesChunkingStrategy, type DataSourcesConfigResult, type DataSourcesConfigUpdateResult, type DataSourcesCreateResult, type DataSourcesDeleteResult, type DataSourcesDocument, type DataSourcesDocumentConfirmResult, type DataSourcesDocumentDeleteResult, type DataSourcesDocumentStatus, type DataSourcesDocumentsResult, type DataSourcesDropResult, type DataSourcesIngestConfig, type DataSourcesIngestUpdate, type DataSourcesListEntry, type DataSourcesListResult, type DataSourcesMigration, type DataSourcesMoveResult, type DataSourcesPlacement, type DataSourcesPromoteResult, type DataSourcesRetrievalConfig, type DataSourcesRetrievalUpdate, type DataSourcesRevectorizeResult, type DataSourcesSearchCitation, type DataSourcesSearchResult, type DataSourcesSearchResultItem, type DataSourcesUploadTokenResult, type DatasetFile, type DbQueryResult, type DiagnosticsAuditEnvironment, type DiagnosticsDashboardResult, type DiagnosticsFinding, type DiagnosticsLighthouseScores, type DiagnosticsPayload, type DiagnosticsReleaseResult, type DiagnosticsRuntimeFindings, type DomainsCheckResult, type DomainsCustomAddResult, type DomainsCustomCheckResult, type DomainsCustomHostnameUiStatus, type DomainsCustomHostnameView, type DomainsCustomListResult, type DomainsCustomRemoveResult, type DomainsCustomRetryResult, type DomainsDnsInstructions, type DomainsGetResult, type DomainsSetResult, type EmailBatchLifecycle, type EmailBatchResult, type EmailBatchSummary, type EmailBatchesResult, type EmailDomainBase, type EmailEffectiveSender, type EmailInboxResult, type EmailListResult, type EmailMessageKind, type EmailMessageResult, type EmailMessageStatus, type EmailSenderTier, type EmailSendingStatusResult, type EmailStatsResult, type EmailSummary, type EmailSuppressResult, type EmailSuppressionsResult, type EmailUnsuppressResult, type EventChannelActivity, type EventsChannelsListResult, type EventsPublishResult, type EventsTailFrame, type FilesDeleteResult, type FilesFileMeta, type FilesListEntry, type FilesListResult, type FilesLsResult, type FilesScanBadge, type FilesScanFlagged, type FilesScanStore, type FilesStatResult, type FilesStoreSummaryEntry, type FilesUploadUrlResult, type FilesUrlResult, type FrontendErrorType, type InboundDnsInstructions, type InboundEmailDomainAddResult, type InboundEmailDomainCheckResult, type InboundEmailDomainDeleteResult, type InboundEmailDomainUiStatus, type InboundEmailDomainVerifyResult, type InboundEmailDomainView, type InboundEmailDomainsListResult, type InboxEmailPreview, type IssueAuthorKind, type IssueCommentRow, type IssueEventType, type IssueKind, type IssueRow, type IssueStatus, type IssuesCommentResult, type IssuesCreateResult, type IssuesDeleteResult, type IssuesGetResult, type IssuesListResult, type IssuesUpdateResult, type JewelPairRow, type JewelPairSummaryRow, type JewelVerdict, type JewelsDatasetSummary, type JewelsDryrunResult, type JewelsExportResult, type JewelsGradeResult, type JewelsGrading, type JewelsOverviewResult, type JewelsPairResult, type JewelsPairsResult, type JewelsQueueResult, type JewelsResolveResult, type JewelsRunResult, type JewelsRunsResult, type JewelsTimeseriesBucket, type JewelsTimeseriesResult, type JewelsTrainResult, type LiftedDatabase, type MethodsInvokeResult, type OutboundDnsInstructions, type OutboundEmailDomainAddResult, type OutboundEmailDomainCheckResult, type OutboundEmailDomainDeleteResult, type OutboundEmailDomainUiStatus, type OutboundEmailDomainVerifyResult, type OutboundEmailDomainView, type OutboundEmailDomainsListResult, type PlatformSuppression, type PrerenderGetResult, type PrerenderInvalidateResult, type PrerenderPage, type PrerenderPagesResult, type PrerenderViewResult, type ReleaseFailureFields, type ReleaseFragment, type ReleasesByCommitResult, type ReleasesGetResult, type ReleasesListResult, type RequestsGetResult, type RequestsListResult, type RequestsListRow, type RequestsStatsMethodBucket, type RequestsStatsMethodResult, type RequestsStatsSummaryBucket, type RequestsStatsSummaryResult, type SecretsDeleteResult, type SecretsGetResult, type SecretsListResult, type SecretsSetResult, type SettingsResult, type SuppressionSource, type TrainingLogEntry, type TrainingRunRow, type TrainingRunStatus, type UserAuthProvider, type UserListItem, type UserRecord, type UsersCreateApiKeyResult, type UsersListResult, type UsersRevokeApiKeyResult, type UsersSetRoleResult, type V2AppSettings, type V2BuildLogEntry, type V2BuildStats, type V2CommitInfo, type V2EmailMessage, type V2ReleaseStatus, type VoiceAvailableNumber, type VoiceNumbersBuyResult, type VoiceNumbersListResult, type VoiceNumbersReleaseResult, type VoiceNumbersSearchResult, type VoiceNumbersSetNameResult, type VoicePhoneNumberStatus, type VoicePhoneNumberView, type VoiceResolvedPolicy, type VoiceSessionChannel, type VoiceSessionCost, type VoiceSessionCostLine, type VoiceSessionDetail, type VoiceSessionGetResult, type VoiceSessionListItem, type VoiceSessionSip, type VoiceSessionSpeechEntry, type VoiceSessionStatus, type VoiceSessionToolEntry, type VoiceSessionTranscriptEntry, type VoiceSessionsListResult, type VoiceSettingsCeilings, type VoiceSettingsGetResult, type VoiceSettingsOverrides, type VoiceSettingsSetResult, admin, createAdminClient, admin as default };
package/dist/index.js CHANGED
@@ -370,12 +370,14 @@ __export(dataSources_exports, {
370
370
  documents: () => documents,
371
371
  drop: () => drop,
372
372
  list: () => list3,
373
+ move: () => move,
373
374
  promote: () => promote,
374
375
  revectorize: () => revectorize,
375
376
  rm: () => rm,
376
377
  search: () => search,
377
378
  summarize: () => summarize,
378
- waitForIngest: () => waitForIngest
379
+ waitForIngest: () => waitForIngest,
380
+ waitForMove: () => waitForMove
379
381
  });
380
382
  import { createHash } from "crypto";
381
383
 
@@ -611,6 +613,61 @@ function create(ctx, params) {
611
613
  ...placement !== void 0 ? { placement } : {}
612
614
  });
613
615
  }
616
+ function move(ctx, params) {
617
+ return call(ctx, "POST", `${base(ctx.appId)}/move`, {
618
+ slug: params.slug,
619
+ placement: params.placement
620
+ });
621
+ }
622
+ async function waitForMove(ctx, params) {
623
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
624
+ const start = Date.now();
625
+ let transientSince = null;
626
+ for (; ; ) {
627
+ let source;
628
+ try {
629
+ const { dataSources } = await list3(ctx);
630
+ source = dataSources.find((s) => s.slug === params.slug);
631
+ transientSince = null;
632
+ } catch (err) {
633
+ if (!isTransientError(err)) {
634
+ throw err;
635
+ }
636
+ transientSince ??= Date.now();
637
+ if (Date.now() - transientSince > TRANSIENT_GRACE_MS) {
638
+ throw err;
639
+ }
640
+ params.onProgress?.(
641
+ `retrying after a gateway error\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
642
+ );
643
+ await sleep(POLL_MS);
644
+ continue;
645
+ }
646
+ if (!source) {
647
+ throw new Error(`Data source "${params.slug}" not found.`);
648
+ }
649
+ const migration = source.migration;
650
+ if (!migration) {
651
+ return { status: "done", source };
652
+ }
653
+ if (migration.error) {
654
+ return { status: "failed", source, error: migration.error };
655
+ }
656
+ if (Date.now() - start > timeoutMs) {
657
+ return {
658
+ status: "timeout",
659
+ source,
660
+ error: `Timed out after ${Math.round(timeoutMs / 1e3)}s with ${migration.copied}/${migration.total} documents copied`
661
+ };
662
+ }
663
+ params.onProgress?.(
664
+ `moving\u2026 ${migration.copied}/${migration.total} documents (${Math.round(
665
+ (Date.now() - start) / 1e3
666
+ )}s)`
667
+ );
668
+ await sleep(POLL_MS);
669
+ }
670
+ }
614
671
  function revectorize(ctx, params) {
615
672
  const { slug, ingest } = params;
616
673
  return call(
@@ -1179,6 +1236,7 @@ __export(infra_exports, {
1179
1236
  list: () => list6,
1180
1237
  provision: () => provision,
1181
1238
  rename: () => rename,
1239
+ resize: () => resize,
1182
1240
  resume: () => resume,
1183
1241
  waitForPhase: () => waitForPhase
1184
1242
  });
@@ -1228,6 +1286,14 @@ function destroy(ctx, params) {
1228
1286
  `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/destroy`
1229
1287
  );
1230
1288
  }
1289
+ function resize(ctx, params) {
1290
+ return call(
1291
+ ctx,
1292
+ "POST",
1293
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/resize`,
1294
+ { offeringId: params.offeringId }
1295
+ );
1296
+ }
1231
1297
  function rename(ctx, params) {
1232
1298
  return call(
1233
1299
  ctx,
@@ -1260,7 +1326,7 @@ async function waitForPhase(ctx, params) {
1260
1326
  await sleep(POLL_MS3);
1261
1327
  continue;
1262
1328
  }
1263
- if (wanted.has(resource.phase)) {
1329
+ if (wanted.has(resource.phase) && (params.until?.(resource) ?? true)) {
1264
1330
  return { status: "done", resource };
1265
1331
  }
1266
1332
  if (resource.phase === "failed") {
@@ -1278,7 +1344,7 @@ async function waitForPhase(ctx, params) {
1278
1344
  };
1279
1345
  }
1280
1346
  params.onProgress?.(
1281
- `${resource.phase}${resource.detail ? ` \xB7 ${resource.detail}` : ""}\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
1347
+ `${resource.phase}${resource.detail ? ` \xB7 ${resource.detail}` : ""}${resource.resizingTo ? ` \xB7 resizing to ${resource.resizingTo.label}` : ""}\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
1282
1348
  );
1283
1349
  await sleep(POLL_MS3);
1284
1350
  }