@tinycloud/cli 1.3.0-beta.36 → 1.3.0-beta.37
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 +13 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +142 -4
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -122,7 +122,7 @@ import {
|
|
|
122
122
|
tinycloudConfigPath,
|
|
123
123
|
tinycloudHomePath
|
|
124
124
|
} from "@tinycloud/operations/state";
|
|
125
|
-
var CONFIG_DIR, PROFILES_DIR, CONFIG_FILE, DEFAULT_HOST, DEFAULT_PROFILE, PROFILE_COMMIT_LOCK_TIMEOUT_MS, ExitCode;
|
|
125
|
+
var CONFIG_DIR, PROFILES_DIR, CONFIG_FILE, DEFAULT_HOST, DEFAULT_PROFILE, PROFILE_COMMIT_LOCK_TIMEOUT_MS, ExitCode, OPENKEY_SPACE_SETUP_RETRY_HINT;
|
|
126
126
|
var init_constants = __esm({
|
|
127
127
|
"src/config/constants.ts"() {
|
|
128
128
|
"use strict";
|
|
@@ -148,6 +148,7 @@ var init_constants = __esm({
|
|
|
148
148
|
/** Interrupted by SIGINT/SIGTERM (`CANCELLED`). */
|
|
149
149
|
CANCELLED: 130
|
|
150
150
|
};
|
|
151
|
+
OPENKEY_SPACE_SETUP_RETRY_HINT = "Wait a minute and retry; approving again in OpenKey re-runs the setup.";
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
154
|
|
|
@@ -7266,17 +7267,25 @@ async function isRootAuthority(spaceUri, profileName) {
|
|
|
7266
7267
|
const selfAddr = await resolveLocalAddress(profile, profileName);
|
|
7267
7268
|
return selfAddr !== null && selfAddr === ownerAddr;
|
|
7268
7269
|
}
|
|
7270
|
+
async function primarySpaceUri(profileName) {
|
|
7271
|
+
const session = await ProfileManager.getSession(profileName);
|
|
7272
|
+
if (typeof session?.spaceId === "string" && session.spaceId !== "") return session.spaceId;
|
|
7273
|
+
const profile = await ProfileManager.getProfile(profileName);
|
|
7274
|
+
return typeof profile.spaceId === "string" && profile.spaceId !== "" ? profile.spaceId : void 0;
|
|
7275
|
+
}
|
|
7269
7276
|
function spaceNameFromUri(spaceUri) {
|
|
7270
7277
|
return spaceUri.slice(spaceUri.lastIndexOf(":") + 1);
|
|
7271
7278
|
}
|
|
7272
|
-
async function unhostedSpaceError(error,
|
|
7273
|
-
if (!spaceUri) return null;
|
|
7279
|
+
async function unhostedSpaceError(error, requestedSpaceUri, profileName) {
|
|
7274
7280
|
const status = error.meta?.status;
|
|
7275
7281
|
const isUnhosted = status === 404 && /space not found/i.test(error.message);
|
|
7276
7282
|
if (!isUnhosted) return null;
|
|
7283
|
+
const spaceUri = requestedSpaceUri ?? await primarySpaceUri(profileName);
|
|
7284
|
+
if (!spaceUri) return null;
|
|
7277
7285
|
const spaceName = spaceNameFromUri(spaceUri);
|
|
7278
7286
|
const owner = await isRootAuthority(spaceUri, profileName);
|
|
7279
|
-
const
|
|
7287
|
+
const openKeyOwner = owner && resolveProfilePosture(await ProfileManager.getProfile(profileName)) === "owner-openkey";
|
|
7288
|
+
const hint = openKeyOwner ? `OpenKey is still setting up your space. ${OPENKEY_SPACE_SETUP_RETRY_HINT}` : owner ? [
|
|
7280
7289
|
"You are the owner. Host it once:",
|
|
7281
7290
|
` ${CLI_NAME10} space host ${spaceName}`,
|
|
7282
7291
|
"Then retry."
|