@quatronic/qore 0.4.0-rc.2 → 0.4.0-test.45abf0b
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/cli.js +15 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ce41f571-68ec-5ea7-85ee-ae940086da7e")}catch(e){}}();
|
|
4
4
|
import { createRequire as __qoreCreateRequire } from "node:module"; const require = __qoreCreateRequire(import.meta.url);
|
|
5
5
|
import {
|
|
6
6
|
addSecretValues,
|
|
@@ -135,6 +135,7 @@ function processIo(interactive, stderrTTY = Boolean(process.stderr.isTTY)) {
|
|
|
135
135
|
stderrTTY,
|
|
136
136
|
stderrRaw: process.stderr,
|
|
137
137
|
async select(message, choices) {
|
|
138
|
+
if (choices.length === 0) throw noChoices(message);
|
|
138
139
|
try {
|
|
139
140
|
return await select({ message, choices });
|
|
140
141
|
} catch (e) {
|
|
@@ -170,6 +171,11 @@ function processIo(interactive, stderrTTY = Boolean(process.stderr.isTTY)) {
|
|
|
170
171
|
openUrl: openBrowser
|
|
171
172
|
};
|
|
172
173
|
}
|
|
174
|
+
function noChoices(message) {
|
|
175
|
+
return new QoreError("QORE_RESOURCE_NOT_FOUND", `Nothing to choose from (${message}): the list is empty`, {
|
|
176
|
+
hint: "Run `qore whoami` to check what your account has access to, or pass the value as an argument."
|
|
177
|
+
});
|
|
178
|
+
}
|
|
173
179
|
function createWaitForEnter(input2, output) {
|
|
174
180
|
return (message, signal) => new Promise((resolve9, reject) => {
|
|
175
181
|
const rl = createInterface({ input: input2, output, terminal: true });
|
|
@@ -8186,6 +8192,11 @@ async function useTenant(ctx, slug, known) {
|
|
|
8186
8192
|
const portal = resolvePortal(g.portal, cfg.defaultProfile);
|
|
8187
8193
|
const me = known ?? await (await openSession(deps2, portal, "tenant use", requestLog(ctx))).api.get("/api/cli/v1/me");
|
|
8188
8194
|
const candidates = me.tenants.map((t) => ({ kind: "tenant", id: t.id, slug: t.slug, name: t.name }));
|
|
8195
|
+
if (me.tenants.length === 0) {
|
|
8196
|
+
throw new QoreError("QORE_NO_DEVELOPER_ACCESS", "Your account is not a developer in any organisation", {
|
|
8197
|
+
hint: "Ask an admin to invite you as a developer."
|
|
8198
|
+
});
|
|
8199
|
+
}
|
|
8189
8200
|
let chosen;
|
|
8190
8201
|
if (slug) {
|
|
8191
8202
|
const found = me.tenants.find((t) => t.slug === slug);
|
|
@@ -8431,7 +8442,7 @@ async function extractRoles(source) {
|
|
|
8431
8442
|
|
|
8432
8443
|
// src/core/roles/read.ts
|
|
8433
8444
|
var PERMISSIONS_FILE = "src/lib/permissions.ts";
|
|
8434
|
-
var SLUG = /^[
|
|
8445
|
+
var SLUG = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
8435
8446
|
var MAX_SLUG = 64;
|
|
8436
8447
|
var MAX_ROLES = 100;
|
|
8437
8448
|
async function readCodeRoles(repoRoot) {
|
|
@@ -8450,7 +8461,7 @@ async function readCodeRoles(repoRoot) {
|
|
|
8450
8461
|
const invalid4 = roles.filter((r) => !SLUG.test(r.slug) || r.slug.length > MAX_SLUG).map((r) => r.slug);
|
|
8451
8462
|
if (invalid4.length) {
|
|
8452
8463
|
throw new QoreError("QORE_CONTEXT_INVALID", `The portal refuses these role names: ${invalid4.join(", ")}`, {
|
|
8453
|
-
hint: `Use
|
|
8464
|
+
hint: `Use letters, digits, - and _, starting with a letter or digit, at most ${MAX_SLUG} characters.`,
|
|
8454
8465
|
details: { invalid: invalid4 }
|
|
8455
8466
|
});
|
|
8456
8467
|
}
|
|
@@ -9884,4 +9895,4 @@ if (!drained) {
|
|
|
9884
9895
|
process.exit();
|
|
9885
9896
|
}
|
|
9886
9897
|
//# sourceMappingURL=cli.js.map
|
|
9887
|
-
//# debugId=
|
|
9898
|
+
//# debugId=ce41f571-68ec-5ea7-85ee-ae940086da7e
|