@warmhub/cli 0.44.0 → 0.44.1
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/wh.js +219 -23
- package/package.json +1 -1
package/dist/wh.js
CHANGED
|
@@ -19358,7 +19358,7 @@ function findSystemComponent(componentId) {
|
|
|
19358
19358
|
// ../../packages/sdk-ts/package.json
|
|
19359
19359
|
var package_default = {
|
|
19360
19360
|
name: "@warmhub/sdk-ts",
|
|
19361
|
-
version: "0.
|
|
19361
|
+
version: "0.44.0",
|
|
19362
19362
|
private: false,
|
|
19363
19363
|
type: "module",
|
|
19364
19364
|
homepage: "https://docs.warmhub.ai",
|
|
@@ -20547,6 +20547,18 @@ class WarmHubClient {
|
|
|
20547
20547
|
} catch (error) {
|
|
20548
20548
|
throw toWarmHubError(error);
|
|
20549
20549
|
}
|
|
20550
|
+
},
|
|
20551
|
+
index: {
|
|
20552
|
+
describe: async (orgName, repoName) => {
|
|
20553
|
+
try {
|
|
20554
|
+
return await this.trpc.repo.index.describe.query({
|
|
20555
|
+
orgName,
|
|
20556
|
+
repoName
|
|
20557
|
+
});
|
|
20558
|
+
} catch (error) {
|
|
20559
|
+
throw toWarmHubError(error);
|
|
20560
|
+
}
|
|
20561
|
+
}
|
|
20550
20562
|
}
|
|
20551
20563
|
};
|
|
20552
20564
|
shape = {
|
|
@@ -20869,7 +20881,8 @@ class WarmHubClient {
|
|
|
20869
20881
|
cursor: opts?.cursor,
|
|
20870
20882
|
componentId: opts?.componentId,
|
|
20871
20883
|
excludeComponents: opts?.excludeComponents,
|
|
20872
|
-
excludeInfraShapes: opts?.excludeInfraShapes
|
|
20884
|
+
excludeInfraShapes: opts?.excludeInfraShapes,
|
|
20885
|
+
where: opts?.where
|
|
20873
20886
|
});
|
|
20874
20887
|
} catch (error) {
|
|
20875
20888
|
throw toWarmHubError(error);
|
|
@@ -21002,7 +21015,8 @@ class WarmHubClient {
|
|
|
21002
21015
|
depth: opts?.depth,
|
|
21003
21016
|
resolveCollections: opts?.resolveCollections,
|
|
21004
21017
|
limit: opts?.limit,
|
|
21005
|
-
cursor: opts?.cursor
|
|
21018
|
+
cursor: opts?.cursor,
|
|
21019
|
+
where: opts?.where
|
|
21006
21020
|
});
|
|
21007
21021
|
} catch (error) {
|
|
21008
21022
|
throw toWarmHubError(error);
|
|
@@ -21031,7 +21045,8 @@ class WarmHubClient {
|
|
|
21031
21045
|
cursor: opts?.cursor,
|
|
21032
21046
|
componentId: opts?.componentId,
|
|
21033
21047
|
excludeComponents: opts?.excludeComponents,
|
|
21034
|
-
excludeInfraShapes: opts?.excludeInfraShapes
|
|
21048
|
+
excludeInfraShapes: opts?.excludeInfraShapes,
|
|
21049
|
+
where: opts?.where
|
|
21035
21050
|
});
|
|
21036
21051
|
} catch (error) {
|
|
21037
21052
|
throw toWarmHubError(error);
|
|
@@ -21082,7 +21097,8 @@ class WarmHubClient {
|
|
|
21082
21097
|
resolveCollections: opts?.resolveCollections,
|
|
21083
21098
|
componentId: opts?.componentId,
|
|
21084
21099
|
excludeComponents: opts?.excludeComponents,
|
|
21085
|
-
excludeInfraShapes: opts?.excludeInfraShapes
|
|
21100
|
+
excludeInfraShapes: opts?.excludeInfraShapes,
|
|
21101
|
+
where: opts?.where
|
|
21086
21102
|
});
|
|
21087
21103
|
} catch (error) {
|
|
21088
21104
|
throw toWarmHubError(error);
|
|
@@ -21120,7 +21136,8 @@ class WarmHubClient {
|
|
|
21120
21136
|
dataMode: opts?.dataMode,
|
|
21121
21137
|
limit: opts?.limit,
|
|
21122
21138
|
cursor: opts?.cursor,
|
|
21123
|
-
includeRetracted: opts?.includeRetracted
|
|
21139
|
+
includeRetracted: opts?.includeRetracted,
|
|
21140
|
+
where: opts?.where
|
|
21124
21141
|
}), onUpdate);
|
|
21125
21142
|
},
|
|
21126
21143
|
thingHistory: async (orgName, repoName, opts, onUpdate) => {
|
|
@@ -21624,6 +21641,9 @@ function conflictHint(message) {
|
|
|
21624
21641
|
}
|
|
21625
21642
|
return "Resolve the conflicting existing state and try again.";
|
|
21626
21643
|
}
|
|
21644
|
+
function isFieldIndexErrorCode(code) {
|
|
21645
|
+
return code === "FIELD_INDEX_UNAVAILABLE" || code === "FIELD_NOT_INDEXABLE" || code === "FIELD_TYPE_AMBIGUOUS";
|
|
21646
|
+
}
|
|
21627
21647
|
function toCliError(err) {
|
|
21628
21648
|
if (err instanceof CliError)
|
|
21629
21649
|
return err;
|
|
@@ -21635,6 +21655,9 @@ function toCliError(err) {
|
|
|
21635
21655
|
const hint = err.hint ?? unauthenticatedHint(err.message);
|
|
21636
21656
|
return new CliError(3 /* Config */, "AUTH", err.message, err, hint);
|
|
21637
21657
|
}
|
|
21658
|
+
if (isFieldIndexErrorCode(err.code)) {
|
|
21659
|
+
return new CliError(err.code === "FIELD_NOT_INDEXABLE" ? 2 /* UserInput */ : 4 /* Backend */, err.code, err.message, err, err.hint);
|
|
21660
|
+
}
|
|
21638
21661
|
if ((err.code === "CONFLICT" || err.code === "ARCHIVED") && err.status === undefined) {
|
|
21639
21662
|
return new CliError(2 /* UserInput */, "CONFLICT", err.message, err, err.hint ?? conflictHint(err.message));
|
|
21640
21663
|
}
|
|
@@ -21738,6 +21761,30 @@ function generateSuggestions(code, message, context) {
|
|
|
21738
21761
|
});
|
|
21739
21762
|
}
|
|
21740
21763
|
}
|
|
21764
|
+
if (code === "FIELD_NOT_INDEXABLE") {
|
|
21765
|
+
suggestions.push({
|
|
21766
|
+
action: "Inspect indexed field state for the repo",
|
|
21767
|
+
command: "wh repo describe --indexed-fields"
|
|
21768
|
+
});
|
|
21769
|
+
suggestions.push({
|
|
21770
|
+
action: "Use a shape-declared, indexable scalar field in --where"
|
|
21771
|
+
});
|
|
21772
|
+
}
|
|
21773
|
+
if (code === "FIELD_INDEX_UNAVAILABLE") {
|
|
21774
|
+
suggestions.push({
|
|
21775
|
+
action: "Retry after the field index finishes building"
|
|
21776
|
+
});
|
|
21777
|
+
suggestions.push({
|
|
21778
|
+
action: "Inspect indexed field state for the repo",
|
|
21779
|
+
command: "wh repo describe --indexed-fields"
|
|
21780
|
+
});
|
|
21781
|
+
}
|
|
21782
|
+
if (code === "FIELD_TYPE_AMBIGUOUS") {
|
|
21783
|
+
suggestions.push({
|
|
21784
|
+
action: "Inspect indexed field state for heterogeneous field types",
|
|
21785
|
+
command: "wh repo describe --indexed-fields"
|
|
21786
|
+
});
|
|
21787
|
+
}
|
|
21741
21788
|
if (code === "AUTH") {
|
|
21742
21789
|
suggestions.push({
|
|
21743
21790
|
action: "Re-authenticate",
|
|
@@ -21771,6 +21818,11 @@ function shouldLogToErrorTier(err) {
|
|
|
21771
21818
|
case "AUTH":
|
|
21772
21819
|
case "UNKNOWN":
|
|
21773
21820
|
return true;
|
|
21821
|
+
case "FIELD_NOT_INDEXABLE":
|
|
21822
|
+
return false;
|
|
21823
|
+
case "FIELD_INDEX_UNAVAILABLE":
|
|
21824
|
+
case "FIELD_TYPE_AMBIGUOUS":
|
|
21825
|
+
return true;
|
|
21774
21826
|
case "BACKEND": {
|
|
21775
21827
|
const status = err.cause?.status;
|
|
21776
21828
|
if (typeof status === "number" && status >= 400 && status < 500) {
|
|
@@ -24533,10 +24585,64 @@ async function readContentInput(filePath, inline, stdinStream) {
|
|
|
24533
24585
|
function usageError(usage, example) {
|
|
24534
24586
|
throw new CliError(2 /* UserInput */, "USER_INPUT", usage, undefined, `Example: ${example}`);
|
|
24535
24587
|
}
|
|
24588
|
+
var WHERE_USAGE_HINT = 'Example: --where state=NC --where "employees>=100" --where "state?"';
|
|
24589
|
+
function requireWhereFieldPath(raw, fieldPath) {
|
|
24590
|
+
const normalized = fieldPath.trim();
|
|
24591
|
+
if (!normalized) {
|
|
24592
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `Malformed --where predicate: "${raw}". Field path cannot be empty.`, undefined, WHERE_USAGE_HINT);
|
|
24593
|
+
}
|
|
24594
|
+
return normalized;
|
|
24595
|
+
}
|
|
24596
|
+
function parseWhereFlag(raw) {
|
|
24597
|
+
const opMatch = raw.match(/^(.+?)\s*(>=|<=|!=|=|>|<)\s*(.*)$/);
|
|
24598
|
+
if (opMatch) {
|
|
24599
|
+
const fieldPath = requireWhereFieldPath(raw, opMatch[1]);
|
|
24600
|
+
const opStr = opMatch[2];
|
|
24601
|
+
const rhsStr = (opMatch[3] ?? "").trim();
|
|
24602
|
+
const op = opStr === "=" ? "eq" : opStr === "!=" ? "ne" : opStr === ">=" ? "gte" : opStr === "<=" ? "lte" : opStr === ">" ? "gt" : "lt";
|
|
24603
|
+
const rhs = coerceValue(rhsStr);
|
|
24604
|
+
return { fieldPath, op, rhs };
|
|
24605
|
+
}
|
|
24606
|
+
const inMatch = raw.match(/^(.+?)\s+in:\[(.*)?\]$/);
|
|
24607
|
+
if (inMatch) {
|
|
24608
|
+
const fieldPath = requireWhereFieldPath(raw, inMatch[1]);
|
|
24609
|
+
const valueStr = inMatch[2] ?? "";
|
|
24610
|
+
if (valueStr.trim() === "") {
|
|
24611
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --where "${raw}": in:[] requires at least one value`, undefined, 'Example: --where "state in:[NC,VA]"');
|
|
24612
|
+
}
|
|
24613
|
+
const rhs = valueStr.split(",").map((v) => coerceValue(v.trim()));
|
|
24614
|
+
if (rhs.length > MAX_WHERE_IN_VALUES) {
|
|
24615
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `Invalid --where "${raw}": in:[...] supports at most ${MAX_WHERE_IN_VALUES} values`, undefined, `Split the query into smaller batches of at most ${MAX_WHERE_IN_VALUES} values.`);
|
|
24616
|
+
}
|
|
24617
|
+
return { fieldPath, op: "in", rhs };
|
|
24618
|
+
}
|
|
24619
|
+
const prefixMatch = raw.match(/^(.+?)~(.+)$/);
|
|
24620
|
+
if (prefixMatch) {
|
|
24621
|
+
const fieldPath = requireWhereFieldPath(raw, prefixMatch[1]);
|
|
24622
|
+
const rhs = coerceValue(prefixMatch[2].replace(/\*$/, ""));
|
|
24623
|
+
return { fieldPath, op: "prefix", rhs };
|
|
24624
|
+
}
|
|
24625
|
+
if (raw.endsWith("?")) {
|
|
24626
|
+
const fieldPath = requireWhereFieldPath(raw, raw.slice(0, -1));
|
|
24627
|
+
return { fieldPath, op: "exists" };
|
|
24628
|
+
}
|
|
24629
|
+
throw new CliError(2 /* UserInput */, "USER_INPUT", `Malformed --where predicate: "${raw}". Supported operators: =, !=, >, >=, <, <=, ~, in:[...], ?`, undefined, WHERE_USAGE_HINT);
|
|
24630
|
+
}
|
|
24631
|
+
function coerceValue(s) {
|
|
24632
|
+
if (s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'")) {
|
|
24633
|
+
return s.slice(1, -1);
|
|
24634
|
+
}
|
|
24635
|
+
if (s === "true")
|
|
24636
|
+
return true;
|
|
24637
|
+
if (s === "false")
|
|
24638
|
+
return false;
|
|
24639
|
+
return s;
|
|
24640
|
+
}
|
|
24536
24641
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
24537
24642
|
var DEFAULT_SEARCH_LIMIT = 25;
|
|
24538
24643
|
var MAX_PAGE_LIMIT = 500;
|
|
24539
24644
|
var AUTO_PAGE_LIMIT = MAX_PAGE_LIMIT;
|
|
24645
|
+
var MAX_WHERE_IN_VALUES = 1000;
|
|
24540
24646
|
async function handleCount(ctx, org, repo, opts) {
|
|
24541
24647
|
const result = await ctx.client.thing.count(org, repo, opts);
|
|
24542
24648
|
writeOutput(ctx, result, () => ctx.out(`${result.count}`));
|
|
@@ -24778,6 +24884,10 @@ var headFlags = {
|
|
|
24778
24884
|
}),
|
|
24779
24885
|
"exclude-components": flag.boolean({
|
|
24780
24886
|
description: "Exclude component-owned things from results"
|
|
24887
|
+
}),
|
|
24888
|
+
where: flag.string({
|
|
24889
|
+
multiple: true,
|
|
24890
|
+
description: `Field-value WHERE predicate (repeatable). Syntax: field=val, field>=val, field~prefix*, field in:[a,b] (max ${MAX_WHERE_IN_VALUES} values), field? (exists). Predicates are served by the typed field index; unservable fields return a machine-readable field-index error instead of scanning JSONB bodies.`
|
|
24781
24891
|
})
|
|
24782
24892
|
};
|
|
24783
24893
|
var handleHead = async (ctx, { flags, args }) => {
|
|
@@ -24790,6 +24900,8 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
24790
24900
|
const match = flags.match;
|
|
24791
24901
|
const count = flags.count;
|
|
24792
24902
|
const includeRetracted = flags["include-retracted"];
|
|
24903
|
+
const whereRaw = flags.where ?? [];
|
|
24904
|
+
const where = whereRaw.map(parseWhereFlag);
|
|
24793
24905
|
if (count) {
|
|
24794
24906
|
if (cursor || all || limit || ctx.liveMode) {
|
|
24795
24907
|
usageError("Usage: wh thing list --count [--shape SHAPE] [--kind KIND] [--match PATTERN]", "wh thing list --shape Player --count");
|
|
@@ -24804,7 +24916,8 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
24804
24916
|
includeRetracted,
|
|
24805
24917
|
componentId: componentId2,
|
|
24806
24918
|
excludeComponents: strictExclude2,
|
|
24807
|
-
excludeInfraShapes: !strictExclude2 && !shape
|
|
24919
|
+
excludeInfraShapes: !strictExclude2 && !shape,
|
|
24920
|
+
where: where.length > 0 ? where : undefined
|
|
24808
24921
|
});
|
|
24809
24922
|
}
|
|
24810
24923
|
if (cursor && !limit) {
|
|
@@ -24830,7 +24943,8 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
24830
24943
|
cursor,
|
|
24831
24944
|
componentId,
|
|
24832
24945
|
excludeComponents,
|
|
24833
|
-
excludeInfraShapes
|
|
24946
|
+
excludeInfraShapes,
|
|
24947
|
+
where: where.length > 0 ? where : undefined
|
|
24834
24948
|
};
|
|
24835
24949
|
if (ctx.liveMode) {
|
|
24836
24950
|
await runLive({
|
|
@@ -24860,7 +24974,8 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
24860
24974
|
cursor,
|
|
24861
24975
|
componentId,
|
|
24862
24976
|
excludeComponents,
|
|
24863
|
-
excludeInfraShapes
|
|
24977
|
+
excludeInfraShapes,
|
|
24978
|
+
where: where.length > 0 ? where : undefined
|
|
24864
24979
|
}) : await ctx.client.thing.head(org, repo, {
|
|
24865
24980
|
shape,
|
|
24866
24981
|
kind,
|
|
@@ -24870,7 +24985,8 @@ var handleHead = async (ctx, { flags, args }) => {
|
|
|
24870
24985
|
cursor,
|
|
24871
24986
|
componentId,
|
|
24872
24987
|
excludeComponents,
|
|
24873
|
-
excludeInfraShapes
|
|
24988
|
+
excludeInfraShapes,
|
|
24989
|
+
where: where.length > 0 ? where : undefined
|
|
24874
24990
|
});
|
|
24875
24991
|
writeOutput(ctx, result, () => renderHead(ctx.out, ctx.colors, ctx.chars, result, org, repo, shape, kind));
|
|
24876
24992
|
};
|
|
@@ -24887,7 +25003,8 @@ async function fetchAllHeadPages(ctx, org, repo, opts) {
|
|
|
24887
25003
|
cursor,
|
|
24888
25004
|
componentId: opts.componentId,
|
|
24889
25005
|
excludeComponents: opts.excludeComponents,
|
|
24890
|
-
excludeInfraShapes: opts.excludeInfraShapes
|
|
25006
|
+
excludeInfraShapes: opts.excludeInfraShapes,
|
|
25007
|
+
where: opts.where
|
|
24891
25008
|
});
|
|
24892
25009
|
items.push(...page.items ?? []);
|
|
24893
25010
|
if (!page.nextCursor)
|
|
@@ -25333,6 +25450,10 @@ var queryFlags = {
|
|
|
25333
25450
|
}),
|
|
25334
25451
|
"exclude-components": flag.boolean({
|
|
25335
25452
|
description: "Exclude component-owned things from results"
|
|
25453
|
+
}),
|
|
25454
|
+
where: flag.string({
|
|
25455
|
+
multiple: true,
|
|
25456
|
+
description: `Field-value WHERE predicate (repeatable). Syntax: field=val, field>=val, field~prefix*, field in:[a,b] (max ${MAX_WHERE_IN_VALUES} values), field? (exists). Predicates are served by the typed field index; unservable fields return a machine-readable field-index error instead of scanning JSONB bodies.`
|
|
25336
25457
|
})
|
|
25337
25458
|
};
|
|
25338
25459
|
var handleQuery = async (ctx, { flags }) => {
|
|
@@ -25354,6 +25475,8 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
25354
25475
|
const excludeComponents = strictExclude;
|
|
25355
25476
|
const excludeInfraShapes = !strictExclude && !hasShape;
|
|
25356
25477
|
const c = ctx.colors;
|
|
25478
|
+
const whereRaw = flags.where ?? [];
|
|
25479
|
+
const where = whereRaw.map(parseWhereFlag);
|
|
25357
25480
|
if (count) {
|
|
25358
25481
|
if (cursor || all || limit || ctx.liveMode) {
|
|
25359
25482
|
usageError("Usage: wh thing query --count [--shape SHAPE] [--about WREF] [--kind KIND] [--match PATTERN]", "wh thing query --kind assertion --about Player/alice --count");
|
|
@@ -25367,7 +25490,8 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
25367
25490
|
resolveCollections,
|
|
25368
25491
|
componentId,
|
|
25369
25492
|
excludeComponents,
|
|
25370
|
-
excludeInfraShapes
|
|
25493
|
+
excludeInfraShapes,
|
|
25494
|
+
where: where.length > 0 ? where : undefined
|
|
25371
25495
|
});
|
|
25372
25496
|
}
|
|
25373
25497
|
if (cursor && !limit) {
|
|
@@ -25389,7 +25513,8 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
25389
25513
|
cursor,
|
|
25390
25514
|
componentId,
|
|
25391
25515
|
excludeComponents,
|
|
25392
|
-
excludeInfraShapes
|
|
25516
|
+
excludeInfraShapes,
|
|
25517
|
+
where: where.length > 0 ? where : undefined
|
|
25393
25518
|
};
|
|
25394
25519
|
if (ctx.liveMode) {
|
|
25395
25520
|
await runLive({
|
|
@@ -25421,7 +25546,8 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
25421
25546
|
cursor,
|
|
25422
25547
|
componentId,
|
|
25423
25548
|
excludeComponents,
|
|
25424
|
-
excludeInfraShapes
|
|
25549
|
+
excludeInfraShapes,
|
|
25550
|
+
where: where.length > 0 ? where : undefined
|
|
25425
25551
|
}) : await ctx.client.thing.query(org, repo, {
|
|
25426
25552
|
shape,
|
|
25427
25553
|
about,
|
|
@@ -25433,7 +25559,8 @@ var handleQuery = async (ctx, { flags }) => {
|
|
|
25433
25559
|
cursor,
|
|
25434
25560
|
componentId,
|
|
25435
25561
|
excludeComponents,
|
|
25436
|
-
excludeInfraShapes
|
|
25562
|
+
excludeInfraShapes,
|
|
25563
|
+
where: where.length > 0 ? where : undefined
|
|
25437
25564
|
});
|
|
25438
25565
|
writeOutput(ctx, result, () => renderQueryResults(ctx.out, c, result));
|
|
25439
25566
|
};
|
|
@@ -25452,7 +25579,8 @@ async function fetchAllQueryPages(ctx, org, repo, opts) {
|
|
|
25452
25579
|
cursor,
|
|
25453
25580
|
componentId: opts.componentId,
|
|
25454
25581
|
excludeComponents: opts.excludeComponents,
|
|
25455
|
-
excludeInfraShapes: opts.excludeInfraShapes
|
|
25582
|
+
excludeInfraShapes: opts.excludeInfraShapes,
|
|
25583
|
+
where: opts.where
|
|
25456
25584
|
});
|
|
25457
25585
|
items.push(...page.items ?? []);
|
|
25458
25586
|
if (!page.nextCursor)
|
|
@@ -33437,20 +33565,36 @@ var handleUpdate3 = async (ctx, { args, flags }) => {
|
|
|
33437
33565
|
ctx.out(`${c.green}Updated${c.reset} ${c.cyan}${orgName}/${repoName}${c.reset} description`);
|
|
33438
33566
|
});
|
|
33439
33567
|
};
|
|
33440
|
-
var
|
|
33568
|
+
var describeFlags = {
|
|
33569
|
+
"indexed-fields": flag.boolean({
|
|
33570
|
+
description: "Show typed field index state (building, ready, failed) for each shape"
|
|
33571
|
+
})
|
|
33572
|
+
};
|
|
33573
|
+
var handleDescribe = async (ctx, { args, flags }) => {
|
|
33441
33574
|
const repoRef = args[0];
|
|
33442
33575
|
const { org, repo } = parseOrgRepo(repoRef, ctx.config);
|
|
33443
33576
|
const c = ctx.colors;
|
|
33444
|
-
const
|
|
33577
|
+
const showIndexedFields = flags["indexed-fields"] === true;
|
|
33578
|
+
const [repoInfo, shapesPage, stats, indexedFields] = await Promise.all([
|
|
33445
33579
|
ctx.client.repo.get(org, repo),
|
|
33446
33580
|
ctx.client.shape.list(org, repo),
|
|
33447
|
-
ctx.client.repo.getStats(org, repo)
|
|
33581
|
+
ctx.client.repo.getStats(org, repo),
|
|
33582
|
+
showIndexedFields ? ctx.client.repo.index.describe(org, repo) : null
|
|
33448
33583
|
]);
|
|
33449
33584
|
const shapes = shapesPage.items;
|
|
33450
33585
|
const byShape = Object.fromEntries([
|
|
33451
33586
|
...shapes.map((shape) => shape.name).filter((name) => typeof name === "string").map((name) => [name, 0]),
|
|
33452
33587
|
...Object.entries(stats.byShape)
|
|
33453
33588
|
]);
|
|
33589
|
+
function stripShapeThingId(bucket) {
|
|
33590
|
+
return bucket.map(({ shapeThingId: _omit, ...rest }) => rest);
|
|
33591
|
+
}
|
|
33592
|
+
const indexedFieldsPublic = indexedFields ? {
|
|
33593
|
+
building: stripShapeThingId(indexedFields.building),
|
|
33594
|
+
ready: stripShapeThingId(indexedFields.ready),
|
|
33595
|
+
failed: stripShapeThingId(indexedFields.failed),
|
|
33596
|
+
other: stripShapeThingId(indexedFields.other)
|
|
33597
|
+
} : null;
|
|
33454
33598
|
const payload = {
|
|
33455
33599
|
org,
|
|
33456
33600
|
repo,
|
|
@@ -33470,7 +33614,8 @@ var handleDescribe = async (ctx, { args }) => {
|
|
|
33470
33614
|
description: typeof data?.description === "string" ? data.description : null,
|
|
33471
33615
|
fields: Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, displayFieldEntry(v)]))
|
|
33472
33616
|
};
|
|
33473
|
-
})
|
|
33617
|
+
}),
|
|
33618
|
+
...indexedFieldsPublic ? { indexedFields: indexedFieldsPublic } : {}
|
|
33474
33619
|
};
|
|
33475
33620
|
writeOutput(ctx, payload, () => {
|
|
33476
33621
|
ctx.out(`${c.bold}${org}/${repo}${c.reset}`);
|
|
@@ -33521,6 +33666,52 @@ var handleDescribe = async (ctx, { args }) => {
|
|
|
33521
33666
|
}
|
|
33522
33667
|
ctx.out("");
|
|
33523
33668
|
}
|
|
33669
|
+
if (indexedFieldsPublic) {
|
|
33670
|
+
const allEntries = [
|
|
33671
|
+
...indexedFieldsPublic.building,
|
|
33672
|
+
...indexedFieldsPublic.ready,
|
|
33673
|
+
...indexedFieldsPublic.failed,
|
|
33674
|
+
...indexedFieldsPublic.other
|
|
33675
|
+
];
|
|
33676
|
+
if (allEntries.length === 0) {
|
|
33677
|
+
ctx.out(`${c.bold}Indexed Fields${c.reset} ${c.dim}none${c.reset}`);
|
|
33678
|
+
} else {
|
|
33679
|
+
ctx.out(`${c.bold}Indexed Fields${c.reset} (${allEntries.length})`);
|
|
33680
|
+
ctx.out("");
|
|
33681
|
+
const stateColor = (state) => {
|
|
33682
|
+
switch (state) {
|
|
33683
|
+
case "ready":
|
|
33684
|
+
return c.green;
|
|
33685
|
+
case "building":
|
|
33686
|
+
return c.yellow;
|
|
33687
|
+
case "failed":
|
|
33688
|
+
return c.red;
|
|
33689
|
+
default:
|
|
33690
|
+
return c.dim;
|
|
33691
|
+
}
|
|
33692
|
+
};
|
|
33693
|
+
const maxShape = allEntries.reduce((m, e) => Math.max(m, e.shapeName.length), 0);
|
|
33694
|
+
const maxField = allEntries.reduce((m, e) => Math.max(m, e.fieldPath.length), 0);
|
|
33695
|
+
const maxState = allEntries.reduce((m, e) => Math.max(m, e.state.length), 0);
|
|
33696
|
+
for (const entry of allEntries) {
|
|
33697
|
+
const shapeLabel = entry.shapeName.padEnd(maxShape);
|
|
33698
|
+
const fieldLabel = entry.fieldPath.padEnd(maxField);
|
|
33699
|
+
const stateLabel = entry.state.padEnd(maxState);
|
|
33700
|
+
const sc = stateColor(entry.state);
|
|
33701
|
+
let line = ` ${c.cyan}${shapeLabel}${c.reset} ${c.dim}${fieldLabel}${c.reset} ${sc}${stateLabel}${c.reset}`;
|
|
33702
|
+
if (entry.state === "building" && entry.backfillTotal != null && entry.backfillTotal > 0) {
|
|
33703
|
+
const pct = Math.round(entry.backfillDone / entry.backfillTotal * 100);
|
|
33704
|
+
line += ` ${c.dim}${entry.backfillDone}/${entry.backfillTotal} (${pct}%)${c.reset}`;
|
|
33705
|
+
} else if (entry.state === "building") {
|
|
33706
|
+
line += ` ${c.dim}${entry.backfillDone} rows${c.reset}`;
|
|
33707
|
+
} else if (entry.state === "failed" && entry.failureReason) {
|
|
33708
|
+
line += ` ${c.dim}${entry.failureReason}${c.reset}`;
|
|
33709
|
+
}
|
|
33710
|
+
ctx.out(line);
|
|
33711
|
+
}
|
|
33712
|
+
ctx.out("");
|
|
33713
|
+
}
|
|
33714
|
+
}
|
|
33524
33715
|
});
|
|
33525
33716
|
};
|
|
33526
33717
|
var confirmFlags2 = {
|
|
@@ -33790,7 +33981,12 @@ var REPO_DOMAIN = defineDomain({
|
|
|
33790
33981
|
prime: true,
|
|
33791
33982
|
summary: "Describe repo schema: shapes, fields, and inline descriptions",
|
|
33792
33983
|
args: "[org/repo]",
|
|
33793
|
-
|
|
33984
|
+
flags: describeFlags,
|
|
33985
|
+
examples: [
|
|
33986
|
+
"wh repo describe",
|
|
33987
|
+
"wh repo describe acme/world",
|
|
33988
|
+
"wh repo describe acme/world --indexed-fields"
|
|
33989
|
+
],
|
|
33794
33990
|
handler: handleDescribe
|
|
33795
33991
|
},
|
|
33796
33992
|
visibility: {
|
|
@@ -35860,7 +36056,7 @@ function resolveLogLevel(flags, env) {
|
|
|
35860
36056
|
// package.json
|
|
35861
36057
|
var package_default3 = {
|
|
35862
36058
|
name: "@warmhub/cli",
|
|
35863
|
-
version: "0.44.
|
|
36059
|
+
version: "0.44.1",
|
|
35864
36060
|
private: false,
|
|
35865
36061
|
type: "module",
|
|
35866
36062
|
homepage: "https://docs.warmhub.ai",
|
|
@@ -36805,4 +37001,4 @@ if (!updateCheckSuppressedByArgv && shouldRunUpdateCheck(updateEligibility)) {
|
|
|
36805
37001
|
var interceptedExitCode = await maybeHandleComponentShellBoundary(dispatchArgv);
|
|
36806
37002
|
process.exitCode = interceptedExitCode === undefined ? await runCli(dispatchArgv, { version: package_default3.version }) : interceptedExitCode;
|
|
36807
37003
|
|
|
36808
|
-
//# debugId=
|
|
37004
|
+
//# debugId=8244220EBED83FEF64756E2164756E21
|