omnara 1.0.41 → 1.0.42
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/bin.js +26 -12
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -3918,7 +3918,6 @@ var zCreateMachinePath = z.object({
|
|
|
3918
3918
|
orgID: z.string().regex(/^org_[a-z2-7]{26}$/)
|
|
3919
3919
|
});
|
|
3920
3920
|
var zCreateMachineResponse = zMachine;
|
|
3921
|
-
var zConnectByoMachineBody = zConnectByoMachineRequest;
|
|
3922
3921
|
var zConnectByoMachinePath = z.object({
|
|
3923
3922
|
orgID: zOrganizationId
|
|
3924
3923
|
});
|
|
@@ -9186,6 +9185,12 @@ var zConfigFile = z10.looseObject({
|
|
|
9186
9185
|
org_id: zOrganizationId.optional(),
|
|
9187
9186
|
project_id: zProjectId.optional()
|
|
9188
9187
|
});
|
|
9188
|
+
function firstPresentSetting(...values) {
|
|
9189
|
+
for (const value of values) {
|
|
9190
|
+
if (value !== void 0 && value.trim() !== "") return value;
|
|
9191
|
+
}
|
|
9192
|
+
return void 0;
|
|
9193
|
+
}
|
|
9189
9194
|
function configFilePath() {
|
|
9190
9195
|
return join(homedir(), ".config", "omnara", "config.json");
|
|
9191
9196
|
}
|
|
@@ -9483,7 +9488,7 @@ async function loginWithDevice(options) {
|
|
|
9483
9488
|
report.success(loginMessage);
|
|
9484
9489
|
report.info(`Token saved to ${store.path}`);
|
|
9485
9490
|
if (validationWarning !== void 0) report.warn(validationWarning);
|
|
9486
|
-
if (process.env.OMNARA_API_KEY !== void 0) {
|
|
9491
|
+
if (firstPresentSetting(process.env.OMNARA_API_KEY) !== void 0) {
|
|
9487
9492
|
report.warn("OMNARA_API_KEY is set and takes precedence over the saved token");
|
|
9488
9493
|
}
|
|
9489
9494
|
return { token, orgId, projectId, hasOrganizations };
|
|
@@ -9519,10 +9524,13 @@ var DEFAULT_API_URL = "https://api.omnara.com/v1";
|
|
|
9519
9524
|
var DEFAULT_ISSUER_URL = "https://app.omnara.com";
|
|
9520
9525
|
function resolveUrls(file, env) {
|
|
9521
9526
|
return {
|
|
9522
|
-
apiUrl: env.OMNARA_API_URL
|
|
9523
|
-
issuerUrl: env.OMNARA_ISSUER_URL
|
|
9527
|
+
apiUrl: firstPresentSetting(env.OMNARA_API_URL, file.api_url) ?? DEFAULT_API_URL,
|
|
9528
|
+
issuerUrl: firstPresentSetting(env.OMNARA_ISSUER_URL, file.issuer_url) ?? DEFAULT_ISSUER_URL
|
|
9524
9529
|
};
|
|
9525
9530
|
}
|
|
9531
|
+
function resolveSavedToken(env, fileToken) {
|
|
9532
|
+
return firstPresentSetting(env.OMNARA_API_KEY, fileToken);
|
|
9533
|
+
}
|
|
9526
9534
|
function migrateLegacyBaseUrl(file) {
|
|
9527
9535
|
const { base_url: baseUrl, ...rest } = file;
|
|
9528
9536
|
if (baseUrl === void 0) return void 0;
|
|
@@ -9553,7 +9561,7 @@ function loadConfig() {
|
|
|
9553
9561
|
const { apiUrl, issuerUrl } = resolveUrls(file, process.env);
|
|
9554
9562
|
let saved = { orgId: file.org_id, projectId: file.project_id };
|
|
9555
9563
|
const resolveToken = createTokenResolver({
|
|
9556
|
-
savedToken: process.env
|
|
9564
|
+
savedToken: resolveSavedToken(process.env, file.token),
|
|
9557
9565
|
canPrompt: canPromptInteractively,
|
|
9558
9566
|
login: async () => {
|
|
9559
9567
|
const report = createLoginReporter(`Not logged in yet. Log in to ${issuerUrl}`);
|
|
@@ -9584,10 +9592,10 @@ function loadConfig() {
|
|
|
9584
9592
|
fetch: globalThis.fetch,
|
|
9585
9593
|
sleep: sleepSeconds,
|
|
9586
9594
|
get defaultOrgId() {
|
|
9587
|
-
return process.env.OMNARA_ORG_ID
|
|
9595
|
+
return firstPresentSetting(process.env.OMNARA_ORG_ID, saved.orgId);
|
|
9588
9596
|
},
|
|
9589
9597
|
get defaultProjectId() {
|
|
9590
|
-
return process.env.OMNARA_PROJECT_ID
|
|
9598
|
+
return firstPresentSetting(process.env.OMNARA_PROJECT_ID, saved.projectId);
|
|
9591
9599
|
},
|
|
9592
9600
|
ensureLoggedIn: async () => {
|
|
9593
9601
|
await resolveToken();
|
|
@@ -9595,7 +9603,7 @@ function loadConfig() {
|
|
|
9595
9603
|
};
|
|
9596
9604
|
}
|
|
9597
9605
|
function describeValue(envName, fileValue, defaultValue) {
|
|
9598
|
-
const envValue = process.env[envName];
|
|
9606
|
+
const envValue = firstPresentSetting(process.env[envName]);
|
|
9599
9607
|
if (envValue !== void 0) {
|
|
9600
9608
|
const shadowed = fileValue !== void 0 ? ` (config has ${fileValue})` : "";
|
|
9601
9609
|
return `${envValue} [from ${envName}${shadowed}]`;
|
|
@@ -9999,7 +10007,9 @@ function collectFlagValues(specs, options) {
|
|
|
9999
10007
|
return root;
|
|
10000
10008
|
}
|
|
10001
10009
|
function parseWithSchema(schema, value, label) {
|
|
10002
|
-
const result = schema.safeParse(value
|
|
10010
|
+
const result = schema.safeParse(value, {
|
|
10011
|
+
error: (issue) => issue.input === "" ? "value is empty" : void 0
|
|
10012
|
+
});
|
|
10003
10013
|
if (!result.success) {
|
|
10004
10014
|
throw new CliInputError(`invalid ${label}:
|
|
10005
10015
|
${z13.prettifyError(result.error)}`);
|
|
@@ -10168,7 +10178,7 @@ function registerLoginCommand(program2, cli) {
|
|
|
10168
10178
|
report.finish(
|
|
10169
10179
|
`This account has no organization yet. Create one at ${new URL("/onboarding", cli.issuerUrl).toString()}, then run 'omnara config select'.`
|
|
10170
10180
|
);
|
|
10171
|
-
} else if ((process.env.OMNARA_ORG_ID
|
|
10181
|
+
} else if (firstPresentSetting(process.env.OMNARA_ORG_ID, orgId) === void 0) {
|
|
10172
10182
|
report.finish("Run 'omnara config select' to choose a default organization and project.");
|
|
10173
10183
|
} else {
|
|
10174
10184
|
report.finish();
|
|
@@ -12656,7 +12666,11 @@ import { accessSync, constants, existsSync as existsSync2, readdirSync, readFile
|
|
|
12656
12666
|
import { homedir as homedir2, release } from "node:os";
|
|
12657
12667
|
import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "node:path";
|
|
12658
12668
|
import * as z24 from "zod";
|
|
12659
|
-
var zMachineSetupBody = zConnectByoMachineRequest
|
|
12669
|
+
var zMachineSetupBody = zConnectByoMachineRequest.extend({
|
|
12670
|
+
project_ids: zConnectByoMachineRequest.shape.project_ids.describe(
|
|
12671
|
+
"project ID to grant the machine to, from omnara projects list"
|
|
12672
|
+
)
|
|
12673
|
+
});
|
|
12660
12674
|
async function connectMachine(context) {
|
|
12661
12675
|
const { client: client2, path, body, report } = context;
|
|
12662
12676
|
report.start("Creating machine with a daemon token");
|
|
@@ -13654,7 +13668,7 @@ var commandGroups = [
|
|
|
13654
13668
|
fn: sdk_gen_exports.connectByoMachine,
|
|
13655
13669
|
format: formatMachineSetup,
|
|
13656
13670
|
path: zConnectByoMachinePath,
|
|
13657
|
-
body:
|
|
13671
|
+
body: zMachineSetupBody
|
|
13658
13672
|
}),
|
|
13659
13673
|
flowOp({
|
|
13660
13674
|
verb: "create-local",
|