sim 2.0.0-preview.14.1 → 2.0.0-preview.15.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/index.js +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6142,6 +6142,8 @@ function sleep(ms) {
|
|
|
6142
6142
|
var PAIRING_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
6143
6143
|
var POLL_INTERVAL_MS = 2000;
|
|
6144
6144
|
var POLL_TIMEOUT_MS = 15 * 60 * 1000;
|
|
6145
|
+
var APPROVAL_PATH = "/cli/auth";
|
|
6146
|
+
var POLL_PATH = "/api/cli/auth/poll";
|
|
6145
6147
|
var RETRYABLE_POLL_STATUSES = new Set([409, 429, 500, 502, 503, 504]);
|
|
6146
6148
|
function token() {
|
|
6147
6149
|
return randomBytes(32).toString("base64url");
|
|
@@ -6160,16 +6162,14 @@ function createAuthRequest() {
|
|
|
6160
6162
|
};
|
|
6161
6163
|
}
|
|
6162
6164
|
function buildApprovalUrl(endpoint, auth, scope, workspaceId) {
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
return url.toString();
|
|
6165
|
+
return buildUrl(endpoint, APPROVAL_PATH, {
|
|
6166
|
+
request: auth.request,
|
|
6167
|
+
challenge: auth.challenge,
|
|
6168
|
+
pairing: auth.pairing,
|
|
6169
|
+
scope,
|
|
6170
|
+
workspace: workspaceId
|
|
6171
|
+
});
|
|
6171
6172
|
}
|
|
6172
|
-
var POLL_PATH = "/api/cli/auth/poll";
|
|
6173
6173
|
function toRedirectError(endpoint, response) {
|
|
6174
6174
|
const location = response.headers.get("location")?.trim();
|
|
6175
6175
|
let target = null;
|
|
@@ -6194,7 +6194,7 @@ async function pollForKey(endpoint, auth, signal) {
|
|
|
6194
6194
|
throw new SimApiError("Login cancelled.", 0);
|
|
6195
6195
|
let response = null;
|
|
6196
6196
|
try {
|
|
6197
|
-
response = await fetch(
|
|
6197
|
+
response = await fetch(buildUrl(endpoint, POLL_PATH), {
|
|
6198
6198
|
method: "POST",
|
|
6199
6199
|
headers: {
|
|
6200
6200
|
"content-type": "application/json",
|