@madewithremy/admin 0.1.19 → 0.1.21
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 +73 -5
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/prod.js +80 -12
- package/package.json +1 -1
package/dist/prod.js
CHANGED
|
@@ -420,11 +420,15 @@ function describeEta(eta, now = Date.now()) {
|
|
|
420
420
|
return `about ${hours} h left`;
|
|
421
421
|
}
|
|
422
422
|
function renderProgress(p, start2, extra) {
|
|
423
|
-
const
|
|
423
|
+
const count2 = p.total !== null ? `${p.done.toLocaleString()}/${p.total.toLocaleString()} ${p.unit}` : p.done > 0 ? `${p.done.toLocaleString()} ${p.unit}` : null;
|
|
424
424
|
const rate = p.ratePerMinute !== null && p.ratePerMinute > 0 ? `${Math.round(p.ratePerMinute).toLocaleString()}/min` : null;
|
|
425
425
|
const parts = [
|
|
426
426
|
`${p.phase}\u2026`,
|
|
427
|
-
count
|
|
427
|
+
// The operation's own word on what it is doing when the count does not
|
|
428
|
+
// say (a settle building its full-text index); a failure's note is its
|
|
429
|
+
// error and prints on its own line instead.
|
|
430
|
+
p.phase !== "failed" ? p.note : null,
|
|
431
|
+
count2,
|
|
428
432
|
rate,
|
|
429
433
|
describeEta(p.etaAt),
|
|
430
434
|
extra ?? null,
|
|
@@ -3169,6 +3173,14 @@ function search(ctx, params) {
|
|
|
3169
3173
|
}
|
|
3170
3174
|
);
|
|
3171
3175
|
}
|
|
3176
|
+
function count(ctx, params) {
|
|
3177
|
+
const { slug, filter, candidate } = params;
|
|
3178
|
+
return call(ctx, "POST", `${base(ctx.appId)}/count`, {
|
|
3179
|
+
slug,
|
|
3180
|
+
...filter ? { filter } : {},
|
|
3181
|
+
...candidate ? { candidate: true } : {}
|
|
3182
|
+
});
|
|
3183
|
+
}
|
|
3172
3184
|
function configGet(ctx, slug) {
|
|
3173
3185
|
return call(
|
|
3174
3186
|
ctx,
|
|
@@ -3199,6 +3211,14 @@ function create2(ctx, params) {
|
|
|
3199
3211
|
...placement !== void 0 ? { placement } : {}
|
|
3200
3212
|
});
|
|
3201
3213
|
}
|
|
3214
|
+
function stopMove(ctx, params) {
|
|
3215
|
+
return call(
|
|
3216
|
+
ctx,
|
|
3217
|
+
"POST",
|
|
3218
|
+
`${base(ctx.appId)}/move/stop`,
|
|
3219
|
+
{ slug: params.slug }
|
|
3220
|
+
);
|
|
3221
|
+
}
|
|
3202
3222
|
function move(ctx, params) {
|
|
3203
3223
|
return call(ctx, "POST", `${base(ctx.appId)}/move`, {
|
|
3204
3224
|
slug: params.slug,
|
|
@@ -3224,8 +3244,10 @@ async function waitForMove(ctx, params) {
|
|
|
3224
3244
|
pollMs: POLL_MS2,
|
|
3225
3245
|
describe: (source2, start2) => renderProgress(source2.migration.progress, start2),
|
|
3226
3246
|
// A corpus of any size moves as long as it keeps moving; the timeout
|
|
3227
|
-
// bounds silence.
|
|
3228
|
-
|
|
3247
|
+
// bounds silence. The settle moves without copying — it builds the
|
|
3248
|
+
// target's full-text index and reports coverage — so its sample time
|
|
3249
|
+
// counts as movement too.
|
|
3250
|
+
progressKey: (source2) => source2.migration ? `${source2.migration.copied}|${source2.migration.progress.updatedAt ?? ""}` : null,
|
|
3229
3251
|
onProgress: params.onProgress
|
|
3230
3252
|
}
|
|
3231
3253
|
);
|
|
@@ -5232,19 +5254,30 @@ var dataSourcesSpecs = {
|
|
|
5232
5254
|
...CONFIG_FLAGS
|
|
5233
5255
|
}
|
|
5234
5256
|
},
|
|
5257
|
+
"datasources count": {
|
|
5258
|
+
usage: "Usage: remy-admin datasources count [--source <slug>] [--filter <k=v,...|json>] [--contains <words>] [--phrase <text>] [--candidate]",
|
|
5259
|
+
flags: {
|
|
5260
|
+
source: { type: "string" },
|
|
5261
|
+
filter: { type: "string" },
|
|
5262
|
+
contains: { type: "string" },
|
|
5263
|
+
phrase: { type: "string" },
|
|
5264
|
+
candidate: { type: "boolean" }
|
|
5265
|
+
}
|
|
5266
|
+
},
|
|
5235
5267
|
"datasources move": {
|
|
5236
|
-
usage: "Usage: remy-admin datasources move [--source <slug>] --to <resource-id|shared> [--chains <n>] [--restart] [--wait] [--timeout <sec>]",
|
|
5268
|
+
usage: "Usage: remy-admin datasources move [--source <slug>] --to <resource-id|shared> [--chains <n>] [--restart] [--wait] [--timeout <sec>] | --stop",
|
|
5237
5269
|
flags: {
|
|
5238
5270
|
source: { type: "string" },
|
|
5239
5271
|
to: { type: "string" },
|
|
5240
5272
|
chains: { type: "number", min: 1 },
|
|
5241
5273
|
restart: { type: "boolean" },
|
|
5274
|
+
stop: { type: "boolean" },
|
|
5242
5275
|
wait: { type: "boolean" },
|
|
5243
5276
|
timeout: { type: "string" }
|
|
5244
5277
|
},
|
|
5245
5278
|
requireAnyOf: {
|
|
5246
|
-
flags: ["to"],
|
|
5247
|
-
message: "--to is required: a resource id from `infra list`, or `shared`."
|
|
5279
|
+
flags: ["to", "stop"],
|
|
5280
|
+
message: "--to is required: a resource id from `infra list`, or `shared`. Or --stop to halt a move under way."
|
|
5248
5281
|
}
|
|
5249
5282
|
},
|
|
5250
5283
|
"datasources revectorize": {
|
|
@@ -5428,6 +5461,16 @@ async function dataSourcesSearch(ctx, a) {
|
|
|
5428
5461
|
})
|
|
5429
5462
|
);
|
|
5430
5463
|
}
|
|
5464
|
+
async function dataSourcesCount(ctx, a) {
|
|
5465
|
+
const filter = filterFromFlags(a);
|
|
5466
|
+
out(
|
|
5467
|
+
await count(ctx, {
|
|
5468
|
+
slug: sourceOf(a),
|
|
5469
|
+
...filter ? { filter } : {},
|
|
5470
|
+
...a.bool("candidate") ? { candidate: true } : {}
|
|
5471
|
+
})
|
|
5472
|
+
);
|
|
5473
|
+
}
|
|
5431
5474
|
function filterFromFlags(a) {
|
|
5432
5475
|
let filter = {};
|
|
5433
5476
|
const raw = a.str("filter");
|
|
@@ -5600,6 +5643,14 @@ async function dataSourcesConfig(ctx, a) {
|
|
|
5600
5643
|
}
|
|
5601
5644
|
async function dataSourcesMove(ctx, a) {
|
|
5602
5645
|
const slug = sourceOf(a);
|
|
5646
|
+
if (a.bool("stop")) {
|
|
5647
|
+
out({
|
|
5648
|
+
dataSource: slug,
|
|
5649
|
+
...await stopMove(ctx, { slug }),
|
|
5650
|
+
note: "Stopped; the chains halt at their next checkpoint. Re-run `datasources move --to <same target>` to resume from where they were."
|
|
5651
|
+
});
|
|
5652
|
+
return;
|
|
5653
|
+
}
|
|
5603
5654
|
const to = a.str("to");
|
|
5604
5655
|
const placement = to === "shared" ? "shared" : { resourceId: to };
|
|
5605
5656
|
const chains = a.num("chains");
|
|
@@ -5695,6 +5746,7 @@ var dataSourcesHandlers = {
|
|
|
5695
5746
|
"datasources search": dataSourcesSearch,
|
|
5696
5747
|
"datasources create": dataSourcesCreate,
|
|
5697
5748
|
"datasources config": dataSourcesConfig,
|
|
5749
|
+
"datasources count": dataSourcesCount,
|
|
5698
5750
|
"datasources move": dataSourcesMove,
|
|
5699
5751
|
"datasources revectorize": dataSourcesRevectorize,
|
|
5700
5752
|
"datasources promote": dataSourcesPromote,
|
|
@@ -5739,6 +5791,7 @@ Usage:
|
|
|
5739
5791
|
remy-admin datasources status [--source <slug>] [--status error] [--all]
|
|
5740
5792
|
remy-admin datasources rm [--source <slug>] (--document <id> | --filter <k=v,...|json>)
|
|
5741
5793
|
remy-admin datasources search [--source <slug>] [search options] <query>
|
|
5794
|
+
remy-admin datasources count [--source <slug>] [--filter <k=v,...|json>] [--contains <words>] [--phrase <text>] [--candidate]
|
|
5742
5795
|
remy-admin datasources create --source <slug> [--name <name>] [--placement <resource-id|shared>] [rebuild settings...]
|
|
5743
5796
|
remy-admin datasources config [--source <slug>] [--placement <resource-id|shared>] [settings...]
|
|
5744
5797
|
remy-admin datasources move [--source <slug>] --to <resource-id|shared> [--chains <n>] [--restart] [--wait] [--timeout <sec>]
|
|
@@ -5751,6 +5804,14 @@ Usage:
|
|
|
5751
5804
|
remy-admin datasources drop [--source <slug>] [--version <n>]
|
|
5752
5805
|
remy-admin datasources delete --source <slug>
|
|
5753
5806
|
|
|
5807
|
+
Count:
|
|
5808
|
+
\`count\` answers how many chunks match a filter, exactly, over the whole
|
|
5809
|
+
corpus, in the same grammar search narrows by: --contains for passages that
|
|
5810
|
+
hold all the words, --phrase for an exact sequence, --filter for metadata. No
|
|
5811
|
+
flags counts the whole corpus. It is a containment count, not a relevance
|
|
5812
|
+
count (none exists), and not the set search returns. The SDK's
|
|
5813
|
+
\`Source.count(filter)\` is the same call for an app.
|
|
5814
|
+
|
|
5754
5815
|
Search options:
|
|
5755
5816
|
--top-k <n> Results to return (default 5, max 50)
|
|
5756
5817
|
--mode <m> hybrid (default) | semantic | lexical. Lexical is
|
|
@@ -5833,11 +5894,18 @@ Placement (shared pool vs dedicated capacity, see \`infra --help\`):
|
|
|
5833
5894
|
(capacity_<phase>), or when it would not fit (capacity_exceeded).
|
|
5834
5895
|
The copy runs as parallel chains, each a window of the corpus; the target
|
|
5835
5896
|
size sets the default (XL 32, Large 16, Medium 8, Small 4) and --chains <n>
|
|
5836
|
-
overrides it, up to 128.
|
|
5837
|
-
count times
|
|
5838
|
-
Re-running \`move\` to the same target
|
|
5839
|
-
|
|
5840
|
-
|
|
5897
|
+
overrides it, up to 128. Four chains run per worker, so this is the worker
|
|
5898
|
+
count times four; the --wait line's documents/min shows what it bought.
|
|
5899
|
+
Re-running \`move\` to the same target attaches to a running copy (--wait
|
|
5900
|
+
picks the watch back up), resumes a failed one from its chains' cursors,
|
|
5901
|
+
and queues the chains again for one that has made no progress for 30
|
|
5902
|
+
minutes; --restart cuts fresh windows instead (the count takes effect
|
|
5903
|
+
then), discarding progress so far. --stop halts a running copy at its
|
|
5904
|
+
chains' next checkpoint; a plain re-run resumes it.
|
|
5905
|
+
The copy paces itself to the target's optimizer: it waits while the target
|
|
5906
|
+
holds more unconverted points than its memory allows, so a large corpus
|
|
5907
|
+
lands at the rate the instance can index, and the target's full-text
|
|
5908
|
+
index is built once at the end rather than per page.
|
|
5841
5909
|
|
|
5842
5910
|
Notes:
|
|
5843
5911
|
--wait blocks until processing finishes, so you can search immediately after.
|