@settlemint/dalp-cli 3.1.32-main.42509611913 → 3.1.32-main.42529819080
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 +47 -31
- package/dist/dalp.js.map +17 -17
- package/package.json +5 -5
- package/src/commands/login.ts +3 -1
- package/src/lib/auth-request.ts +3 -1
- package/src/lib/credential-store.ts +5 -2
- package/src/lib/register-operations.ts +5 -2
- package/src/lib/sdk-cli-schema.ts +5 -2
- package/src/main.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@settlemint/dalp-cli",
|
|
3
|
-
"version": "3.1.32-main.
|
|
3
|
+
"version": "3.1.32-main.42529819080",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI for the Digital Asset Lifecycle Platform — manage tokens, identities, compliance, and more from the command line.",
|
|
6
6
|
"homepage": "https://settlemint.com",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"typecheck": "taskguard effect-tsgo tsrs --customConditions dalp-types"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/server": "2.
|
|
53
|
-
"@settlemint/dalp-sdk": "3.1.32-main.
|
|
52
|
+
"@modelcontextprotocol/server": "2.0.0-alpha.4",
|
|
53
|
+
"@settlemint/dalp-sdk": "3.1.32-main.42529819080",
|
|
54
54
|
"incur": "0.7.1",
|
|
55
55
|
"zod": "4.6.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@arethetypeswrong/cli": "0.18.5",
|
|
59
|
-
"@testkit/effect-bun-test": "3.1.32-main.
|
|
60
|
-
"@tools/typescript-config": "3.1.32-main.
|
|
59
|
+
"@testkit/effect-bun-test": "3.1.32-main.42529819080",
|
|
60
|
+
"@tools/typescript-config": "3.1.32-main.42529819080",
|
|
61
61
|
"@types/bun": "1.4.4",
|
|
62
62
|
"publint": "0.3.25"
|
|
63
63
|
},
|
package/src/commands/login.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { runCommand } from "../lib/run-command.ts";
|
|
|
8
8
|
import { promptSecret } from "../lib/secret-prompt.ts";
|
|
9
9
|
import { CLI_USER_AGENT, cliVars } from "../lib/vars.ts";
|
|
10
10
|
|
|
11
|
+
const TRAILING_SLASHES_PATTERN = /\/+$/u;
|
|
12
|
+
|
|
11
13
|
const deviceCodeSchema = z.object({
|
|
12
14
|
device_code: z.string(),
|
|
13
15
|
user_code: z.string(),
|
|
@@ -108,7 +110,7 @@ export function validateLoginBaseUrl(apiUrl: string): string {
|
|
|
108
110
|
message: "DALP login URLs must not contain a query string or fragment.",
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
|
-
return parsed.href.replace(
|
|
113
|
+
return parsed.href.replace(TRAILING_SLASHES_PATTERN, "");
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
async function readBoundedJson<T>(response: Response, schema: z.ZodType<T>): Promise<T> {
|
package/src/lib/auth-request.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { z } from "incur";
|
|
|
3
3
|
import type { StoredCredentials } from "./credential-store.ts";
|
|
4
4
|
import { CLI_USER_AGENT } from "./vars.ts";
|
|
5
5
|
|
|
6
|
+
const TRAILING_SLASHES_PATTERN = /\/+$/u;
|
|
7
|
+
|
|
6
8
|
const AUTH_REQUEST_TIMEOUT_MS = 10_000;
|
|
7
9
|
|
|
8
10
|
export async function authRequest(
|
|
@@ -24,7 +26,7 @@ export async function authRequest(
|
|
|
24
26
|
let response: Response;
|
|
25
27
|
let text: string;
|
|
26
28
|
try {
|
|
27
|
-
response = await fetch(`${apiUrl.replace(
|
|
29
|
+
response = await fetch(`${apiUrl.replace(TRAILING_SLASHES_PATTERN, "")}/api/auth${route}`, {
|
|
28
30
|
method: request.method,
|
|
29
31
|
headers,
|
|
30
32
|
signal: deadline.signal,
|
|
@@ -4,6 +4,9 @@ import { z } from "zod";
|
|
|
4
4
|
import { getConfigDir } from "./cli-config.ts";
|
|
5
5
|
import { makeCliError, isCliFailure } from "./errors.ts";
|
|
6
6
|
|
|
7
|
+
const KEYCHAIN_ENTRY_SEPARATOR_PATTERN = /\n(?=keychain:)/u;
|
|
8
|
+
const ACCOUNT_PATTERN = /"acct"<blob>="([^"]*)"/u;
|
|
9
|
+
|
|
7
10
|
const SERVICE_NAME = "dalp-cli";
|
|
8
11
|
|
|
9
12
|
const StoredCredentialsSchema = z.object({
|
|
@@ -48,11 +51,11 @@ async function keychainAccounts(
|
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
const accounts = new Set<string>();
|
|
51
|
-
for (const entry of dump.stdout.split(
|
|
54
|
+
for (const entry of dump.stdout.split(KEYCHAIN_ENTRY_SEPARATOR_PATTERN)) {
|
|
52
55
|
if (!entry.includes(`"svce"<blob>="${SERVICE_NAME}"`)) {
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
55
|
-
const account = entry.match(
|
|
58
|
+
const account = entry.match(ACCOUNT_PATTERN)?.[1];
|
|
56
59
|
if (account !== undefined) {
|
|
57
60
|
accounts.add(account);
|
|
58
61
|
}
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
} from "./sdk-cli-schema.ts";
|
|
20
20
|
import { cliVars } from "./vars.ts";
|
|
21
21
|
|
|
22
|
+
const CAMEL_BOUNDARY_PATTERN = /([a-z0-9])([A-Z])/gu;
|
|
23
|
+
const DASH_RUN_PATTERN = /-+/gu;
|
|
24
|
+
|
|
22
25
|
function readOkHelper<T extends object>(
|
|
23
26
|
context: T
|
|
24
27
|
): ((data: unknown, meta?: { cta?: CliCtaBlock }) => unknown) | undefined {
|
|
@@ -128,9 +131,9 @@ function selectOperation(ops: ReadonlyArray<OperationDescriptor>, path: ApiBag |
|
|
|
128
131
|
|
|
129
132
|
function headerOptionName(name: string): string {
|
|
130
133
|
return name
|
|
131
|
-
.replaceAll(
|
|
134
|
+
.replaceAll(CAMEL_BOUNDARY_PATTERN, "$1-$2")
|
|
132
135
|
.replaceAll("_", "-")
|
|
133
|
-
.replaceAll(
|
|
136
|
+
.replaceAll(DASH_RUN_PATTERN, "-")
|
|
134
137
|
.toLowerCase();
|
|
135
138
|
}
|
|
136
139
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from "incur";
|
|
2
2
|
import type { SurfaceOperation, SurfaceParam } from "./openapi-surface-types.ts";
|
|
3
3
|
|
|
4
|
+
const CAMEL_BOUNDARY_PATTERN = /([a-z0-9])([A-Z])/gu;
|
|
5
|
+
const DASH_RUN_PATTERN = /-+/gu;
|
|
6
|
+
|
|
4
7
|
export type ZodTypeAny = z.ZodType;
|
|
5
8
|
|
|
6
9
|
const cliValueSchema = z.union([z.json(), z.date(), z.bigint(), z.undefined()]);
|
|
@@ -226,9 +229,9 @@ export function buildOptionsFromSdk(
|
|
|
226
229
|
|
|
227
230
|
for (const param of surface?.headerParams ?? []) {
|
|
228
231
|
const headerOption = param.name
|
|
229
|
-
.replaceAll(
|
|
232
|
+
.replaceAll(CAMEL_BOUNDARY_PATTERN, "$1-$2")
|
|
230
233
|
.replaceAll("_", "-")
|
|
231
|
-
.replaceAll(
|
|
234
|
+
.replaceAll(DASH_RUN_PATTERN, "-")
|
|
232
235
|
.toLowerCase();
|
|
233
236
|
if (out[headerOption] !== undefined) {
|
|
234
237
|
continue;
|
package/src/main.ts
CHANGED
|
@@ -11,9 +11,12 @@ import { registerGeneratedOperations } from "./lib/register-operations.ts";
|
|
|
11
11
|
import { runCommand } from "./lib/run-command.ts";
|
|
12
12
|
import { CLI_VERSION, cliVars } from "./lib/vars.ts";
|
|
13
13
|
|
|
14
|
+
const COMMAND_NAME_SEPARATOR_PATTERN = /[ _]/u;
|
|
15
|
+
|
|
14
16
|
const SKIP_AUTH_COMMANDS = new Set(["login", "logout", "config", "mcp", "skills"]);
|
|
15
17
|
|
|
16
|
-
export const topLevelCommandName = (command: string | undefined): string =>
|
|
18
|
+
export const topLevelCommandName = (command: string | undefined): string =>
|
|
19
|
+
command?.split(COMMAND_NAME_SEPARATOR_PATTERN)[0] ?? "";
|
|
17
20
|
|
|
18
21
|
export const makeCli = (): Cli.Cli<Record<string, never>, typeof cliVars> => {
|
|
19
22
|
const cli: Cli.Cli<Record<string, never>, typeof cliVars> = Cli.create("dalp", {
|