@settlemint/dalp-cli 3.1.32-main.42884423762 → 3.1.32-main.42894513068
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/dalp.js +34 -10
- package/dist/dalp.js.map +5 -5
- package/package.json +4 -4
- package/src/lib/cli-cta.ts +24 -0
- package/src/lib/register-operations.ts +25 -16
package/dist/dalp.js
CHANGED
|
@@ -52819,6 +52819,27 @@ Fix: ${input.fix}`,
|
|
|
52819
52819
|
commands
|
|
52820
52820
|
};
|
|
52821
52821
|
}
|
|
52822
|
+
function formatCtaCommand(cliName, entry) {
|
|
52823
|
+
if (typeof entry === "string") {
|
|
52824
|
+
return { command: `${cliName} ${entry}` };
|
|
52825
|
+
}
|
|
52826
|
+
const prefixed = entry.command === cliName || entry.command.startsWith(`${cliName} `);
|
|
52827
|
+
let command = prefixed ? entry.command : `${cliName} ${entry.command}`;
|
|
52828
|
+
for (const [key, value] of Object.entries(entry.args ?? {})) {
|
|
52829
|
+
command += value === true ? ` <${key}>` : ` ${String(value)}`;
|
|
52830
|
+
}
|
|
52831
|
+
for (const [key, value] of Object.entries(entry.options ?? {})) {
|
|
52832
|
+
command += value === true ? ` --${key} <${key}>` : ` --${key} ${String(value)}`;
|
|
52833
|
+
}
|
|
52834
|
+
return entry.description === undefined ? { command } : { command, description: entry.description };
|
|
52835
|
+
}
|
|
52836
|
+
function renderCtaText2(cliName, block) {
|
|
52837
|
+
const commands = block.commands.map((entry) => formatCtaCommand(cliName, entry));
|
|
52838
|
+
const width = Math.max(0, ...commands.map((entry) => entry.command.length));
|
|
52839
|
+
const lines = commands.map((entry) => entry.description === undefined ? ` ${entry.command}` : ` ${entry.command.padEnd(width)} # ${entry.description}`);
|
|
52840
|
+
return [block.description, ...lines].join(`
|
|
52841
|
+
`);
|
|
52842
|
+
}
|
|
52822
52843
|
function buildSuccessCtaFromResult(result) {
|
|
52823
52844
|
const links = extractResourceLinks(result);
|
|
52824
52845
|
const commands = commandsFromLinks(links);
|
|
@@ -53056,7 +53077,7 @@ async function runCommand(context, operation, errorContext = UNKNOWN_COMMAND_ERR
|
|
|
53056
53077
|
// package.json
|
|
53057
53078
|
var package_default = {
|
|
53058
53079
|
name: "@settlemint/dalp-cli",
|
|
53059
|
-
version: "3.1.32-main.
|
|
53080
|
+
version: "3.1.32-main.42894513068",
|
|
53060
53081
|
private: false,
|
|
53061
53082
|
description: "CLI for the Digital Asset Lifecycle Platform \u2014 manage tokens, identities, compliance, and more from the command line.",
|
|
53062
53083
|
homepage: "https://settlemint.com",
|
|
@@ -54662,9 +54683,12 @@ function makeLeafHandler(ops) {
|
|
|
54662
54683
|
...optionsSchema === undefined ? {} : { options: optionsSchema },
|
|
54663
54684
|
examples: buildExamples(ops, surface),
|
|
54664
54685
|
async* run(c) {
|
|
54686
|
+
const refuseWithGuidanceInMessage = ({ cta, ...error }) => c.error(cta === undefined ? error : { ...error, message: `${error.message}
|
|
54687
|
+
|
|
54688
|
+
${renderCtaText2(c.displayName ?? "dalp", cta)}` });
|
|
54665
54689
|
const { client } = c.var;
|
|
54666
54690
|
if (client === undefined) {
|
|
54667
|
-
return
|
|
54691
|
+
return refuseWithGuidanceInMessage({
|
|
54668
54692
|
code: "NOT_AUTHENTICATED",
|
|
54669
54693
|
message: "Not logged in. Run 'dalp login' to authenticate.",
|
|
54670
54694
|
retryable: true,
|
|
@@ -54700,7 +54724,7 @@ function makeLeafHandler(ops) {
|
|
|
54700
54724
|
if (failedEvent !== undefined) {
|
|
54701
54725
|
yield failedEvent;
|
|
54702
54726
|
}
|
|
54703
|
-
return
|
|
54727
|
+
return refuseWithGuidanceInMessage({
|
|
54704
54728
|
code: "kit.cli.MISSING_PATH",
|
|
54705
54729
|
message: `Operation ${descriptor.name} requires path parameters.`,
|
|
54706
54730
|
retryable: true,
|
|
@@ -54722,7 +54746,7 @@ function makeLeafHandler(ops) {
|
|
|
54722
54746
|
yield failedEvent;
|
|
54723
54747
|
}
|
|
54724
54748
|
const message = error instanceof Error ? error.message : "Invalid path parameters";
|
|
54725
|
-
return
|
|
54749
|
+
return refuseWithGuidanceInMessage({
|
|
54726
54750
|
code: "kit.cli.INVALID_PATH",
|
|
54727
54751
|
message,
|
|
54728
54752
|
retryable: true,
|
|
@@ -54746,7 +54770,7 @@ function makeLeafHandler(ops) {
|
|
|
54746
54770
|
yield failedEvent;
|
|
54747
54771
|
}
|
|
54748
54772
|
const message = error instanceof Error ? error.message : "Invalid query parameters";
|
|
54749
|
-
return
|
|
54773
|
+
return refuseWithGuidanceInMessage({
|
|
54750
54774
|
code: "kit.cli.INVALID_QUERY",
|
|
54751
54775
|
message,
|
|
54752
54776
|
retryable: true,
|
|
@@ -54768,7 +54792,7 @@ function makeLeafHandler(ops) {
|
|
|
54768
54792
|
yield failedEvent;
|
|
54769
54793
|
}
|
|
54770
54794
|
const message = error instanceof Error ? error.message : "Invalid request body";
|
|
54771
|
-
return
|
|
54795
|
+
return refuseWithGuidanceInMessage({
|
|
54772
54796
|
code: "kit.cli.INVALID_BODY",
|
|
54773
54797
|
message,
|
|
54774
54798
|
retryable: true,
|
|
@@ -54789,7 +54813,7 @@ function makeLeafHandler(ops) {
|
|
|
54789
54813
|
if (submitEvent !== undefined) {
|
|
54790
54814
|
yield submitEvent;
|
|
54791
54815
|
}
|
|
54792
|
-
const result = await runCommand(
|
|
54816
|
+
const result = await runCommand({ error: refuseWithGuidanceInMessage }, invokeOperation(descriptor, client, {
|
|
54793
54817
|
path: validatedPath,
|
|
54794
54818
|
query: validatedQuery,
|
|
54795
54819
|
body: validatedBody,
|
|
@@ -54835,7 +54859,7 @@ function makeLeafHandler(ops) {
|
|
|
54835
54859
|
if (failed !== undefined) {
|
|
54836
54860
|
yield failed;
|
|
54837
54861
|
}
|
|
54838
|
-
return
|
|
54862
|
+
return refuseWithGuidanceInMessage({
|
|
54839
54863
|
...rendered,
|
|
54840
54864
|
exitCode: 1
|
|
54841
54865
|
});
|
|
@@ -54870,7 +54894,7 @@ function makeLeafHandler(ops) {
|
|
|
54870
54894
|
if (failed !== undefined) {
|
|
54871
54895
|
yield failed;
|
|
54872
54896
|
}
|
|
54873
|
-
return
|
|
54897
|
+
return refuseWithGuidanceInMessage({
|
|
54874
54898
|
...rendered,
|
|
54875
54899
|
exitCode: 1
|
|
54876
54900
|
});
|
|
@@ -55036,4 +55060,4 @@ if (false) {}
|
|
|
55036
55060
|
// src/bin.ts
|
|
55037
55061
|
await cli.serve();
|
|
55038
55062
|
|
|
55039
|
-
//# debugId=
|
|
55063
|
+
//# debugId=85E985CBB97CBA2764756E2164756E21
|