@quatronic/qore 0.4.0-test.a3fa77f → 0.4.1-rc.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.
Files changed (2) hide show
  1. package/dist/cli.js +13 -2
  2. 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]="61c8b355-f1e5-5a19-8b8d-2f4dc57679da")}catch(e){}}();
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]="d011143c-a5e4-5dc8-8c44-cb092151ea87")}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);
@@ -9884,4 +9895,4 @@ if (!drained) {
9884
9895
  process.exit();
9885
9896
  }
9886
9897
  //# sourceMappingURL=cli.js.map
9887
- //# debugId=61c8b355-f1e5-5a19-8b8d-2f4dc57679da
9898
+ //# debugId=d011143c-a5e4-5dc8-8c44-cb092151ea87
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatronic/qore",
3
- "version": "0.4.0-test.a3fa77f",
3
+ "version": "0.4.1-rc.1",
4
4
  "description": "Qore developer CLI",
5
5
  "type": "module",
6
6
  "bin": {