@settlemint/dalp-cli 3.1.19-main.35334824779 → 3.1.19-main.35339568264
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 +27 -13
- package/dist/dalp.js.map +3 -3
- package/package.json +1 -1
package/dist/dalp.js
CHANGED
|
@@ -41910,7 +41910,7 @@ var WEBHOOK_MANIFEST_VERSION = Webhook.MANIFEST_VERSION;
|
|
|
41910
41910
|
// ../sdk/package.json
|
|
41911
41911
|
var package_default = {
|
|
41912
41912
|
name: "@settlemint/dalp-sdk",
|
|
41913
|
-
version: "3.1.19-main.
|
|
41913
|
+
version: "3.1.19-main.35339568264",
|
|
41914
41914
|
private: false,
|
|
41915
41915
|
description: "Fully typed SDK for the DALP tokenization platform API",
|
|
41916
41916
|
homepage: "https://settlemint.com",
|
|
@@ -108646,7 +108646,7 @@ async function runCommand(context, operation, errorContext = UNKNOWN_COMMAND_ERR
|
|
|
108646
108646
|
// package.json
|
|
108647
108647
|
var package_default2 = {
|
|
108648
108648
|
name: "@settlemint/dalp-cli",
|
|
108649
|
-
version: "3.1.19-main.
|
|
108649
|
+
version: "3.1.19-main.35339568264",
|
|
108650
108650
|
private: false,
|
|
108651
108651
|
description: "CLI for the Digital Asset Lifecycle Platform \u2014 manage tokens, identities, compliance, and more from the command line.",
|
|
108652
108652
|
homepage: "https://settlemint.com",
|
|
@@ -108976,6 +108976,7 @@ var apiKeyResponseSchema = object({
|
|
|
108976
108976
|
name: string2()
|
|
108977
108977
|
});
|
|
108978
108978
|
var MAX_LOGIN_RESPONSE_BYTES = 1024 * 1024;
|
|
108979
|
+
var DEVICE_CLIENT_ID = "dalp-cli";
|
|
108979
108980
|
var isLoopbackHost = (host) => host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]";
|
|
108980
108981
|
function validateLoginBaseUrl(apiUrl) {
|
|
108981
108982
|
let parsed;
|
|
@@ -109030,6 +109031,27 @@ async function postJson(url, body, headers = {}) {
|
|
|
109030
109031
|
body: JSON.stringify(body)
|
|
109031
109032
|
});
|
|
109032
109033
|
}
|
|
109034
|
+
async function requestDeviceCode(apiUrl) {
|
|
109035
|
+
const baseUrl = validateLoginBaseUrl(apiUrl);
|
|
109036
|
+
const response = await postJson(`${baseUrl}/api/auth/device/code`, { client_id: DEVICE_CLIENT_ID });
|
|
109037
|
+
if (response.ok) {
|
|
109038
|
+
return readBoundedJson(response, deviceCodeSchema);
|
|
109039
|
+
}
|
|
109040
|
+
const refusal = await readBoundedJson(response, tokenErrorSchema).catch(() => null);
|
|
109041
|
+
if (refusal?.error === "invalid_client") {
|
|
109042
|
+
throw makeCliError({
|
|
109043
|
+
code: "kit.cli.DEVICE_CLIENT_REJECTED",
|
|
109044
|
+
message: `The DALP server at ${baseUrl} does not accept this CLI for device login.`,
|
|
109045
|
+
why: `The server refused the device client id '${DEVICE_CLIENT_ID}'.`,
|
|
109046
|
+
fix: "Check that the URL points at a DALP instance, and use a CLI version that instance supports."
|
|
109047
|
+
});
|
|
109048
|
+
}
|
|
109049
|
+
throw makeCliError({
|
|
109050
|
+
code: "DEVICE_CODE_FAILED",
|
|
109051
|
+
message: `Failed to request device code from ${apiUrl}. Check that the URL is correct and the server is running.`,
|
|
109052
|
+
retryable: true
|
|
109053
|
+
});
|
|
109054
|
+
}
|
|
109033
109055
|
async function pollForToken(apiUrl, deviceCode, intervalSeconds, expiresInSeconds, sleep = (ms) => new Promise((resolve) => {
|
|
109034
109056
|
setTimeout(resolve, ms);
|
|
109035
109057
|
}), now = () => Date.now()) {
|
|
@@ -109041,7 +109063,7 @@ async function pollForToken(apiUrl, deviceCode, intervalSeconds, expiresInSecond
|
|
|
109041
109063
|
const response = await postJson(`${baseUrl}/api/auth/device/token`, {
|
|
109042
109064
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
109043
109065
|
device_code: deviceCode,
|
|
109044
|
-
client_id:
|
|
109066
|
+
client_id: DEVICE_CLIENT_ID
|
|
109045
109067
|
});
|
|
109046
109068
|
if (response.ok) {
|
|
109047
109069
|
return readBoundedJson(response, tokenResponseSchema);
|
|
@@ -109130,15 +109152,7 @@ var loginCommand = create("login", {
|
|
|
109130
109152
|
});
|
|
109131
109153
|
}
|
|
109132
109154
|
const baseUrl = validateLoginBaseUrl(apiUrl);
|
|
109133
|
-
const
|
|
109134
|
-
if (!codeResponse.ok) {
|
|
109135
|
-
return c.error({
|
|
109136
|
-
code: "DEVICE_CODE_FAILED",
|
|
109137
|
-
message: `Failed to request device code from ${apiUrl}. Check that the URL is correct and the server is running.`,
|
|
109138
|
-
retryable: true
|
|
109139
|
-
});
|
|
109140
|
-
}
|
|
109141
|
-
const deviceCode = await readBoundedJson(codeResponse, deviceCodeSchema);
|
|
109155
|
+
const deviceCode = await requestDeviceCode(apiUrl);
|
|
109142
109156
|
if (c.agent !== true) {
|
|
109143
109157
|
const verificationBase = deviceCode.verification_uri.startsWith("http") ? deviceCode.verification_uri : `${baseUrl}${deviceCode.verification_uri}`;
|
|
109144
109158
|
const completeUri = deviceCode.verification_uri_complete ?? `${verificationBase}?code=${deviceCode.user_code}`;
|
|
@@ -109996,4 +110010,4 @@ if (false) {}
|
|
|
109996
110010
|
// src/bin.ts
|
|
109997
110011
|
await cli.serve();
|
|
109998
110012
|
|
|
109999
|
-
//# debugId=
|
|
110013
|
+
//# debugId=0EB11BB9DF8C1E8064756E2164756E21
|