@madewithremy/admin 0.1.12 → 0.1.14
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 +103 -8
- package/dist/index.js +63 -16
- package/dist/index.js.map +1 -1
- package/dist/prod.js +190 -35
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1181,6 +1181,8 @@ interface DataSourceJob {
|
|
|
1181
1181
|
budgetCredits: number | null;
|
|
1182
1182
|
budgetDollars: number | null;
|
|
1183
1183
|
maxInflightBatches: number;
|
|
1184
|
+
/** Embedding at the provider's priority tier (1.5x the embedding price). */
|
|
1185
|
+
priority: boolean;
|
|
1184
1186
|
limitObjects: number | null;
|
|
1185
1187
|
enumerationDone: boolean;
|
|
1186
1188
|
counts: {
|
|
@@ -1871,7 +1873,8 @@ interface DataSourcesDocumentStatus {
|
|
|
1871
1873
|
}
|
|
1872
1874
|
/**
|
|
1873
1875
|
* GET /datasources/documents — one page of per-document ingest state for one
|
|
1874
|
-
* pipeline, oldest first
|
|
1876
|
+
* pipeline, oldest first unless `order=newest`; `status=error` is the failures,
|
|
1877
|
+
* newest failure first; `filename` a prefix.
|
|
1875
1878
|
*
|
|
1876
1879
|
* `pipelineVersion` is absent when the data source does not exist (returns `{ documents: [] }`).
|
|
1877
1880
|
* `candidate=true` watches a migration in progress. `nextCursor` is set when
|
|
@@ -2150,13 +2153,18 @@ interface DataSourcesPromoteResult {
|
|
|
2150
2153
|
interface DataSourcesDropResult {
|
|
2151
2154
|
dropped: number;
|
|
2152
2155
|
}
|
|
2153
|
-
/**
|
|
2156
|
+
/**
|
|
2157
|
+
* POST /datasources/delete — delete every version, document, and byte. The
|
|
2158
|
+
* source is gone to every reader when this returns; its rows and objects are
|
|
2159
|
+
* removed by a background job, which `purging` says.
|
|
2160
|
+
*/
|
|
2154
2161
|
interface DataSourcesDeleteResult {
|
|
2155
2162
|
deleted: true;
|
|
2156
|
-
/** Number of documents removed. */
|
|
2163
|
+
/** Number of documents being removed. */
|
|
2157
2164
|
documents: number;
|
|
2158
|
-
/** Number of pipeline versions dropped. */
|
|
2165
|
+
/** Number of pipeline versions being dropped. */
|
|
2159
2166
|
versions: number;
|
|
2167
|
+
purging: boolean;
|
|
2160
2168
|
}
|
|
2161
2169
|
/**
|
|
2162
2170
|
* POST /datasources/documents/delete — always responds 204 (empty body).
|
|
@@ -2314,13 +2322,20 @@ interface WaitForCandidateParams {
|
|
|
2314
2322
|
}
|
|
2315
2323
|
interface WaitForCandidateResult {
|
|
2316
2324
|
status: 'ready' | 'error' | 'timeout';
|
|
2325
|
+
/** The candidate's build counts when the wait ended; null when it had no candidate. */
|
|
2326
|
+
counts: DataSourcesBuildProgress | null;
|
|
2327
|
+
/** The failed documents, first page, when any failed. */
|
|
2317
2328
|
documents: SummarizedDocument[];
|
|
2318
2329
|
/** Present only on status === 'timeout'. */
|
|
2319
2330
|
error?: string;
|
|
2320
2331
|
}
|
|
2332
|
+
/** Failed documents fetched for a status or a candidate wait. */
|
|
2333
|
+
declare const FAILURES_PAGE = 50;
|
|
2321
2334
|
/**
|
|
2322
2335
|
* Poll a candidate version (`revectorize`) until every document has built.
|
|
2323
|
-
*
|
|
2336
|
+
* Reads the candidate's counts from the source list — one row, whatever the
|
|
2337
|
+
* corpus holds — and fetches the failures only at the end. `error` means at
|
|
2338
|
+
* least one failed; `promote` with `force` accepts that.
|
|
2324
2339
|
*/
|
|
2325
2340
|
declare function waitForCandidate(ctx: AdminContext, params: WaitForCandidateParams): Promise<WaitForCandidateResult>;
|
|
2326
2341
|
interface DocumentsParams {
|
|
@@ -2334,11 +2349,19 @@ interface DocumentsParams {
|
|
|
2334
2349
|
limit?: number;
|
|
2335
2350
|
/** `nextCursor` from the previous page. */
|
|
2336
2351
|
cursor?: string;
|
|
2352
|
+
/** By the time the document was added; oldest first unless said otherwise. */
|
|
2353
|
+
order?: 'oldest' | 'newest';
|
|
2354
|
+
/** The failed builds only, newest failure first. */
|
|
2355
|
+
status?: 'error';
|
|
2356
|
+
/** Filenames starting with this. */
|
|
2357
|
+
filename?: string;
|
|
2337
2358
|
}
|
|
2338
2359
|
/** The server's cap on `ids` per request; `allDocuments` chunks to it. */
|
|
2339
2360
|
declare const DOCUMENTS_IDS_MAX = 200;
|
|
2340
2361
|
/**
|
|
2341
|
-
* Fetch one page of per-document ingest state for one pipeline, oldest first
|
|
2362
|
+
* Fetch one page of per-document ingest state for one pipeline, oldest first
|
|
2363
|
+
* unless `order` says otherwise; `status: 'error'` narrows to the failures and
|
|
2364
|
+
* `filename` to a name prefix.
|
|
2342
2365
|
*
|
|
2343
2366
|
* Returns an empty document list when the data source does not exist yet.
|
|
2344
2367
|
* Pass `candidate: true` to watch a revectorization in progress. Follow
|
|
@@ -2346,6 +2369,7 @@ declare const DOCUMENTS_IDS_MAX = 200;
|
|
|
2346
2369
|
*
|
|
2347
2370
|
* @example
|
|
2348
2371
|
* const { documents, nextCursor } = await admin.dataSources.documents({ slug: 'policies' });
|
|
2372
|
+
* const failed = await admin.dataSources.documents({ slug: 'policies', status: 'error' });
|
|
2349
2373
|
*/
|
|
2350
2374
|
declare function documents(ctx: AdminContext, params: DocumentsParams): Promise<DataSourcesDocumentsResult>;
|
|
2351
2375
|
/**
|
|
@@ -2664,6 +2688,7 @@ type dataSources_CreateParams = CreateParams;
|
|
|
2664
2688
|
declare const dataSources_DOCUMENTS_IDS_MAX: typeof DOCUMENTS_IDS_MAX;
|
|
2665
2689
|
type dataSources_DocumentsParams = DocumentsParams;
|
|
2666
2690
|
type dataSources_DropParams = DropParams;
|
|
2691
|
+
declare const dataSources_FAILURES_PAGE: typeof FAILURES_PAGE;
|
|
2667
2692
|
type dataSources_MoveParams = MoveParams;
|
|
2668
2693
|
type dataSources_PromoteParams = PromoteParams;
|
|
2669
2694
|
type dataSources_RevectorizeParams = RevectorizeParams;
|
|
@@ -2696,7 +2721,7 @@ declare const dataSources_waitForCandidate: typeof waitForCandidate;
|
|
|
2696
2721
|
declare const dataSources_waitForIngest: typeof waitForIngest;
|
|
2697
2722
|
declare const dataSources_waitForMove: typeof waitForMove;
|
|
2698
2723
|
declare namespace dataSources {
|
|
2699
|
-
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$3 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_RmWhereParams as RmWhereParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForCandidateParams as WaitForCandidateParams, type dataSources_WaitForCandidateResult as WaitForCandidateResult, 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$8 as list, dataSources_move as move, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_rmWhere as rmWhere, dataSources_rmWhereAll as rmWhereAll, dataSources_search as search, dataSources_summarize as summarize, dataSources_waitForCandidate as waitForCandidate, dataSources_waitForIngest as waitForIngest, dataSources_waitForMove as waitForMove };
|
|
2724
|
+
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$3 as DEFAULT_WAIT_TIMEOUT_MS, dataSources_DOCUMENTS_IDS_MAX as DOCUMENTS_IDS_MAX, type dataSources_DocumentsParams as DocumentsParams, type dataSources_DropParams as DropParams, dataSources_FAILURES_PAGE as FAILURES_PAGE, type dataSources_MoveParams as MoveParams, type dataSources_PromoteParams as PromoteParams, type dataSources_RevectorizeParams as RevectorizeParams, type dataSources_RmParams as RmParams, type dataSources_RmWhereParams as RmWhereParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForCandidateParams as WaitForCandidateParams, type dataSources_WaitForCandidateResult as WaitForCandidateResult, 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$8 as list, dataSources_move as move, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_rmWhere as rmWhere, dataSources_rmWhereAll as rmWhereAll, dataSources_search as search, dataSources_summarize as summarize, dataSources_waitForCandidate as waitForCandidate, dataSources_waitForIngest as waitForIngest, dataSources_waitForMove as waitForMove };
|
|
2700
2725
|
}
|
|
2701
2726
|
|
|
2702
2727
|
/**
|
|
@@ -2720,6 +2745,11 @@ interface StartParams {
|
|
|
2720
2745
|
budgetDollars?: number;
|
|
2721
2746
|
/** Batches in flight at once (default 64, max 128). */
|
|
2722
2747
|
concurrency?: number;
|
|
2748
|
+
/**
|
|
2749
|
+
* Embed at the provider's priority tier: calls are admitted ahead of the
|
|
2750
|
+
* provider's queue at 1.5x the embedding price. Off by default.
|
|
2751
|
+
*/
|
|
2752
|
+
priority?: boolean;
|
|
2723
2753
|
/** Process only the first N objects — a sample of the corpus. */
|
|
2724
2754
|
limit?: number;
|
|
2725
2755
|
}
|
|
@@ -2771,6 +2801,8 @@ declare function get$7(ctx: AdminContext, params: JobIdParams): Promise<DataSour
|
|
|
2771
2801
|
declare function approve(ctx: AdminContext, params: JobIdParams & {
|
|
2772
2802
|
/** Batches in flight from here on (max 128); the plan was made at the job's current value. */
|
|
2773
2803
|
concurrency?: number;
|
|
2804
|
+
/** Embed at the provider's priority tier from here on (1.5x the embedding price). */
|
|
2805
|
+
priority?: boolean;
|
|
2774
2806
|
}): Promise<DataSourceJobResult>;
|
|
2775
2807
|
/** Stop dispatching batches; the ones in flight finish. */
|
|
2776
2808
|
declare function pause(ctx: AdminContext, params: JobIdParams): Promise<DataSourceJobResult>;
|
|
@@ -2778,6 +2810,8 @@ declare function pause(ctx: AdminContext, params: JobIdParams): Promise<DataSour
|
|
|
2778
2810
|
declare function resume$1(ctx: AdminContext, params: JobIdParams & {
|
|
2779
2811
|
/** Batches in flight from here on (max 128). */
|
|
2780
2812
|
concurrency?: number;
|
|
2813
|
+
/** Embed at the provider's priority tier from here on (1.5x the embedding price). */
|
|
2814
|
+
priority?: boolean;
|
|
2781
2815
|
}): Promise<DataSourceJobResult>;
|
|
2782
2816
|
/** End the job. Documents already indexed stay. */
|
|
2783
2817
|
declare function cancel(ctx: AdminContext, params: JobIdParams): Promise<DataSourceJobResult>;
|
|
@@ -2905,6 +2939,8 @@ interface SyncParams {
|
|
|
2905
2939
|
limit?: number;
|
|
2906
2940
|
/** Batches in flight (default 64, max 128). */
|
|
2907
2941
|
concurrency?: number;
|
|
2942
|
+
/** Embed at the provider's priority tier (1.5x the embedding price). Off by default. */
|
|
2943
|
+
priority?: boolean;
|
|
2908
2944
|
}
|
|
2909
2945
|
/**
|
|
2910
2946
|
* Start a sync: list the bucket, diff by ETag, run a job over what changed.
|
|
@@ -2937,9 +2973,15 @@ declare const DEFAULT_WAIT_TIMEOUT_MS$1: number;
|
|
|
2937
2973
|
* Warm a source's index if it is cold. A search on a large cold index answers
|
|
2938
2974
|
* `index_warming` until the reload lands; call this before a demo, or after an
|
|
2939
2975
|
* eviction you know about. Answers `resident: true` when nothing was needed.
|
|
2976
|
+
*
|
|
2977
|
+
* With `since`, refill instead: copy every document built at or after that
|
|
2978
|
+
* time into the index whether or not it is resident. What a dedicated
|
|
2979
|
+
* instance needs after restoring from a snapshot taken then; the platform
|
|
2980
|
+
* does this on its own when it sees the restore, this is the by-hand path.
|
|
2940
2981
|
*/
|
|
2941
2982
|
declare function hydrate(ctx: AdminContext, params: {
|
|
2942
2983
|
slug: string;
|
|
2984
|
+
since?: string;
|
|
2943
2985
|
}): Promise<DataSourcesHydrateResult>;
|
|
2944
2986
|
/**
|
|
2945
2987
|
* Recreate a dedicated source's collection with the platform's current shape
|
|
@@ -4542,6 +4584,16 @@ interface InfraResource {
|
|
|
4542
4584
|
resizingTo: InfraOffering | null;
|
|
4543
4585
|
/** When the last verified snapshot was taken; null if never. */
|
|
4544
4586
|
lastSnapshotAt: string | null;
|
|
4587
|
+
/**
|
|
4588
|
+
* What this resource has actually been charged, from the ledger's own
|
|
4589
|
+
* writes, with the hours at each rate beside it. Rates are on `offering`.
|
|
4590
|
+
*/
|
|
4591
|
+
billing: {
|
|
4592
|
+
activeHours: number;
|
|
4593
|
+
hibernatedHours: number;
|
|
4594
|
+
billedDollars: number;
|
|
4595
|
+
lastBilledAt: string | null;
|
|
4596
|
+
};
|
|
4545
4597
|
activatedAt: string | null;
|
|
4546
4598
|
hibernatedAt: string | null;
|
|
4547
4599
|
destroyedAt: string | null;
|
|
@@ -4558,6 +4610,23 @@ interface InfraEvent {
|
|
|
4558
4610
|
reason: string | null;
|
|
4559
4611
|
createdAt: string;
|
|
4560
4612
|
}
|
|
4613
|
+
/**
|
|
4614
|
+
* One line of the platform's narration of a resource: a step reported while
|
|
4615
|
+
* a transition ran ("Waiting for capacity", "Restoring collections 2/3"), a
|
|
4616
|
+
* failed attempt, or a failure with what Kubernetes said about the pod at the
|
|
4617
|
+
* time (`data`). Not the instance's own stdout.
|
|
4618
|
+
*/
|
|
4619
|
+
interface InfraLogLine {
|
|
4620
|
+
id: string;
|
|
4621
|
+
phase: InfraPhase;
|
|
4622
|
+
level: 'info' | 'warn' | 'error';
|
|
4623
|
+
message: string;
|
|
4624
|
+
data: {
|
|
4625
|
+
podEvents: string[];
|
|
4626
|
+
logTail: string[];
|
|
4627
|
+
} | null;
|
|
4628
|
+
createdAt: string;
|
|
4629
|
+
}
|
|
4561
4630
|
/** GET /infra */
|
|
4562
4631
|
interface InfraListResult {
|
|
4563
4632
|
resources: InfraResource[];
|
|
@@ -4569,12 +4638,19 @@ interface InfraListResult {
|
|
|
4569
4638
|
interface InfraGetResult {
|
|
4570
4639
|
resource: InfraResource;
|
|
4571
4640
|
events: InfraEvent[];
|
|
4641
|
+
/** The newest 200 narration lines, oldest first; `logs()` pages further. */
|
|
4642
|
+
logs: InfraLogLine[];
|
|
4572
4643
|
attachedSources: {
|
|
4573
4644
|
id: string;
|
|
4574
4645
|
slug: string;
|
|
4575
4646
|
name: string | null;
|
|
4576
4647
|
}[];
|
|
4577
4648
|
}
|
|
4649
|
+
/** GET /infra/:id/logs */
|
|
4650
|
+
interface InfraLogsResult {
|
|
4651
|
+
/** Oldest first. */
|
|
4652
|
+
logs: InfraLogLine[];
|
|
4653
|
+
}
|
|
4578
4654
|
/** POST /infra, /infra/:id/{hibernate,resume,destroy,rename,resize} */
|
|
4579
4655
|
interface InfraResourceResult {
|
|
4580
4656
|
resource: InfraResource;
|
|
@@ -4612,6 +4688,23 @@ interface GetParams {
|
|
|
4612
4688
|
* @throws AdminApiError `resource_not_found` (404).
|
|
4613
4689
|
*/
|
|
4614
4690
|
declare function get$4(ctx: AdminContext, params: GetParams): Promise<InfraGetResult>;
|
|
4691
|
+
interface LogsParams {
|
|
4692
|
+
/** Resource id. */
|
|
4693
|
+
id: string;
|
|
4694
|
+
/** Continue after this line id (the last line of a previous page). */
|
|
4695
|
+
after?: string;
|
|
4696
|
+
/** Lines per page; without `after`, the newest this many. Max 500. */
|
|
4697
|
+
limit?: number;
|
|
4698
|
+
}
|
|
4699
|
+
/**
|
|
4700
|
+
* The platform's narration of a resource, oldest first: the steps a
|
|
4701
|
+
* transition went through, failed attempts, and failures with the pod's
|
|
4702
|
+
* events and a warnings-and-errors tail of the instance log. Not the
|
|
4703
|
+
* instance's own stdout.
|
|
4704
|
+
*
|
|
4705
|
+
* @throws AdminApiError `resource_not_found` (404).
|
|
4706
|
+
*/
|
|
4707
|
+
declare function logs(ctx: AdminContext, params: LogsParams): Promise<InfraLogsResult>;
|
|
4615
4708
|
interface ProvisionParams {
|
|
4616
4709
|
/** Offering id from `list().offerings`, e.g. `retrieval.small`. */
|
|
4617
4710
|
offeringId: string;
|
|
@@ -4728,6 +4821,7 @@ declare function waitForPhase(ctx: AdminContext, params: WaitForPhaseParams): Pr
|
|
|
4728
4821
|
declare const infra_DEFAULT_WAIT_TIMEOUT_MS: typeof DEFAULT_WAIT_TIMEOUT_MS;
|
|
4729
4822
|
type infra_GetParams = GetParams;
|
|
4730
4823
|
type infra_ListParams = ListParams;
|
|
4824
|
+
type infra_LogsParams = LogsParams;
|
|
4731
4825
|
type infra_ProvisionParams = ProvisionParams;
|
|
4732
4826
|
type infra_RenameParams = RenameParams;
|
|
4733
4827
|
type infra_ResizeParams = ResizeParams;
|
|
@@ -4736,13 +4830,14 @@ type infra_WaitForPhaseParams = WaitForPhaseParams;
|
|
|
4736
4830
|
type infra_WaitForPhaseResult = WaitForPhaseResult;
|
|
4737
4831
|
declare const infra_destroy: typeof destroy;
|
|
4738
4832
|
declare const infra_hibernate: typeof hibernate;
|
|
4833
|
+
declare const infra_logs: typeof logs;
|
|
4739
4834
|
declare const infra_provision: typeof provision;
|
|
4740
4835
|
declare const infra_rename: typeof rename;
|
|
4741
4836
|
declare const infra_resize: typeof resize;
|
|
4742
4837
|
declare const infra_resume: typeof resume;
|
|
4743
4838
|
declare const infra_waitForPhase: typeof waitForPhase;
|
|
4744
4839
|
declare namespace infra {
|
|
4745
|
-
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 };
|
|
4840
|
+
export { infra_DEFAULT_WAIT_TIMEOUT_MS as DEFAULT_WAIT_TIMEOUT_MS, type infra_GetParams as GetParams, type infra_ListParams as ListParams, type infra_LogsParams as LogsParams, 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_logs as logs, infra_provision as provision, infra_rename as rename, infra_resize as resize, infra_resume as resume, infra_waitForPhase as waitForPhase };
|
|
4746
4841
|
}
|
|
4747
4842
|
|
|
4748
4843
|
/**
|
package/dist/index.js
CHANGED
|
@@ -361,6 +361,7 @@ var dataSources_exports = {};
|
|
|
361
361
|
__export(dataSources_exports, {
|
|
362
362
|
DEFAULT_WAIT_TIMEOUT_MS: () => DEFAULT_WAIT_TIMEOUT_MS,
|
|
363
363
|
DOCUMENTS_IDS_MAX: () => DOCUMENTS_IDS_MAX,
|
|
364
|
+
FAILURES_PAGE: () => FAILURES_PAGE,
|
|
364
365
|
addDocument: () => addDocument,
|
|
365
366
|
allDocuments: () => allDocuments,
|
|
366
367
|
configGet: () => configGet,
|
|
@@ -552,33 +553,48 @@ async function waitForIngest(ctx, params) {
|
|
|
552
553
|
documents: tracked.map(summarize)
|
|
553
554
|
};
|
|
554
555
|
}
|
|
556
|
+
var FAILURES_PAGE = 50;
|
|
555
557
|
async function waitForCandidate(ctx, params) {
|
|
556
558
|
const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
|
|
557
|
-
const pendingOf = (docs2) => docs2.filter((d) => d.status === "processing");
|
|
558
559
|
const outcome = await pollUntil(
|
|
559
|
-
() =>
|
|
560
|
-
|
|
560
|
+
async () => {
|
|
561
|
+
const { dataSources } = await list3(ctx);
|
|
562
|
+
const source = dataSources.find((s) => s.slug === params.slug);
|
|
563
|
+
if (!source) {
|
|
564
|
+
throw new Error(`Data source "${params.slug}" not found.`);
|
|
565
|
+
}
|
|
566
|
+
return source.candidate?.progress ?? null;
|
|
567
|
+
},
|
|
568
|
+
(progress) => progress === null || progress.processing === 0,
|
|
561
569
|
{
|
|
562
570
|
timeoutMs,
|
|
563
571
|
pollMs: POLL_MS,
|
|
564
|
-
describe: (
|
|
572
|
+
describe: (progress, start2) => progress ? `rebuilding\u2026 ${progress.done}/${progress.total} done (${elapsedSeconds(start2)}s)` : `rebuilding\u2026 (${elapsedSeconds(start2)}s)`,
|
|
565
573
|
onProgress: params.onProgress
|
|
566
574
|
}
|
|
567
575
|
);
|
|
568
|
-
const
|
|
576
|
+
const counts = outcome.value;
|
|
577
|
+
const failed = counts && counts.error > 0 ? (await documents(ctx, {
|
|
578
|
+
slug: params.slug,
|
|
579
|
+
candidate: true,
|
|
580
|
+
status: "error",
|
|
581
|
+
limit: FAILURES_PAGE
|
|
582
|
+
})).documents.map(summarize) : [];
|
|
569
583
|
if (!outcome.settled) {
|
|
570
584
|
return {
|
|
571
585
|
status: "timeout",
|
|
572
|
-
|
|
586
|
+
counts,
|
|
587
|
+
documents: failed,
|
|
573
588
|
error: timedOut(
|
|
574
589
|
timeoutMs,
|
|
575
|
-
`with ${
|
|
590
|
+
`with ${counts?.processing ?? 0} document(s) still building`
|
|
576
591
|
)
|
|
577
592
|
};
|
|
578
593
|
}
|
|
579
594
|
return {
|
|
580
|
-
status:
|
|
581
|
-
|
|
595
|
+
status: counts && counts.error > 0 ? "error" : "ready",
|
|
596
|
+
counts,
|
|
597
|
+
documents: failed
|
|
582
598
|
};
|
|
583
599
|
}
|
|
584
600
|
var DOCUMENTS_IDS_MAX = 200;
|
|
@@ -591,7 +607,10 @@ function documents(ctx, params) {
|
|
|
591
607
|
candidate: params.candidate || void 0,
|
|
592
608
|
ids: params.ids?.length ? params.ids.join(",") : void 0,
|
|
593
609
|
limit: params.limit,
|
|
594
|
-
cursor: params.cursor
|
|
610
|
+
cursor: params.cursor,
|
|
611
|
+
order: params.order,
|
|
612
|
+
status: params.status,
|
|
613
|
+
filename: params.filename
|
|
595
614
|
})}`
|
|
596
615
|
);
|
|
597
616
|
}
|
|
@@ -609,7 +628,10 @@ async function allDocuments(ctx, params) {
|
|
|
609
628
|
candidate: params.candidate,
|
|
610
629
|
ids,
|
|
611
630
|
limit: 1e3,
|
|
612
|
-
cursor
|
|
631
|
+
cursor,
|
|
632
|
+
order: params.order,
|
|
633
|
+
status: params.status,
|
|
634
|
+
filename: params.filename
|
|
613
635
|
});
|
|
614
636
|
out.push(...page.documents ?? []);
|
|
615
637
|
cursor = page.nextCursor ?? void 0;
|
|
@@ -818,13 +840,14 @@ function base2(appId) {
|
|
|
818
840
|
return `/_internal/v2/apps/${appId}/datasources/jobs`;
|
|
819
841
|
}
|
|
820
842
|
function start(ctx, params) {
|
|
821
|
-
const { slug, source, approve: approve2, budgetDollars, concurrency, limit } = params;
|
|
843
|
+
const { slug, source, approve: approve2, budgetDollars, concurrency, priority, limit } = params;
|
|
822
844
|
return call(ctx, "POST", base2(ctx.appId), {
|
|
823
845
|
slug,
|
|
824
846
|
source,
|
|
825
847
|
...approve2 ? { approve: true } : {},
|
|
826
848
|
...budgetDollars !== void 0 ? { budgetDollars } : {},
|
|
827
849
|
...concurrency !== void 0 ? { concurrency } : {},
|
|
850
|
+
...priority ? { priority: true } : {},
|
|
828
851
|
...limit !== void 0 ? { limit } : {}
|
|
829
852
|
});
|
|
830
853
|
}
|
|
@@ -857,9 +880,16 @@ function approve(ctx, params) {
|
|
|
857
880
|
ctx,
|
|
858
881
|
"POST",
|
|
859
882
|
`${base2(ctx.appId)}/${encodeURIComponent(params.id)}/approve`,
|
|
860
|
-
params
|
|
883
|
+
controlBody(params)
|
|
861
884
|
);
|
|
862
885
|
}
|
|
886
|
+
function controlBody(params) {
|
|
887
|
+
const body = {
|
|
888
|
+
...params.concurrency !== void 0 ? { concurrency: params.concurrency } : {},
|
|
889
|
+
...params.priority !== void 0 ? { priority: params.priority } : {}
|
|
890
|
+
};
|
|
891
|
+
return Object.keys(body).length > 0 ? body : void 0;
|
|
892
|
+
}
|
|
863
893
|
function pause(ctx, params) {
|
|
864
894
|
return call(
|
|
865
895
|
ctx,
|
|
@@ -872,7 +902,7 @@ function resume(ctx, params) {
|
|
|
872
902
|
ctx,
|
|
873
903
|
"POST",
|
|
874
904
|
`${base2(ctx.appId)}/${encodeURIComponent(params.id)}/resume`,
|
|
875
|
-
params
|
|
905
|
+
controlBody(params)
|
|
876
906
|
);
|
|
877
907
|
}
|
|
878
908
|
function cancel(ctx, params) {
|
|
@@ -1006,7 +1036,8 @@ function sync(ctx, params) {
|
|
|
1006
1036
|
slug: params.slug,
|
|
1007
1037
|
...params.budgetDollars !== void 0 ? { budgetDollars: params.budgetDollars } : {},
|
|
1008
1038
|
...params.limit !== void 0 ? { limit: params.limit } : {},
|
|
1009
|
-
...params.concurrency !== void 0 ? { concurrency: params.concurrency } : {}
|
|
1039
|
+
...params.concurrency !== void 0 ? { concurrency: params.concurrency } : {},
|
|
1040
|
+
...params.priority ? { priority: true } : {}
|
|
1010
1041
|
});
|
|
1011
1042
|
}
|
|
1012
1043
|
|
|
@@ -1042,7 +1073,7 @@ function hydrate(ctx, params) {
|
|
|
1042
1073
|
ctx,
|
|
1043
1074
|
"POST",
|
|
1044
1075
|
`${base4(ctx.appId)}/hydrate`,
|
|
1045
|
-
{ slug: params.slug }
|
|
1076
|
+
{ slug: params.slug, ...params.since ? { since: params.since } : {} }
|
|
1046
1077
|
);
|
|
1047
1078
|
}
|
|
1048
1079
|
function reindex(ctx, params) {
|
|
@@ -1853,6 +1884,7 @@ __export(infra_exports, {
|
|
|
1853
1884
|
get: () => get7,
|
|
1854
1885
|
hibernate: () => hibernate,
|
|
1855
1886
|
list: () => list7,
|
|
1887
|
+
logs: () => logs,
|
|
1856
1888
|
provision: () => provision,
|
|
1857
1889
|
rename: () => rename,
|
|
1858
1890
|
resize: () => resize,
|
|
@@ -1878,6 +1910,21 @@ function get7(ctx, params) {
|
|
|
1878
1910
|
`${base6(ctx.appId)}/${encodeURIComponent(params.id)}`
|
|
1879
1911
|
);
|
|
1880
1912
|
}
|
|
1913
|
+
function logs(ctx, params) {
|
|
1914
|
+
const query3 = new URLSearchParams();
|
|
1915
|
+
if (params.after) {
|
|
1916
|
+
query3.set("after", params.after);
|
|
1917
|
+
}
|
|
1918
|
+
if (params.limit) {
|
|
1919
|
+
query3.set("limit", String(params.limit));
|
|
1920
|
+
}
|
|
1921
|
+
const search2 = query3.toString();
|
|
1922
|
+
return call(
|
|
1923
|
+
ctx,
|
|
1924
|
+
"GET",
|
|
1925
|
+
`${base6(ctx.appId)}/${encodeURIComponent(params.id)}/logs${search2 ? `?${search2}` : ""}`
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1881
1928
|
function provision(ctx, params) {
|
|
1882
1929
|
return call(ctx, "POST", base6(ctx.appId), {
|
|
1883
1930
|
offeringId: params.offeringId,
|