sim 2.1.4-dev.58.1 → 2.1.4-preview.59.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/index.js +10 -38
  2. package/package.json +1 -7
package/dist/index.js CHANGED
@@ -2314,23 +2314,6 @@ function credentialsPath() {
2314
2314
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2315
2315
  import { dirname } from "node:path";
2316
2316
 
2317
- // src/embed-context.ts
2318
- import { AsyncLocalStorage } from "node:async_hooks";
2319
- var embedStore = new AsyncLocalStorage;
2320
- function embeddedProfile() {
2321
- const ctx = embedStore.getStore();
2322
- if (!ctx)
2323
- return null;
2324
- return {
2325
- name: "embedded",
2326
- endpoint: ctx.identity.endpoint,
2327
- apiKey: ctx.identity.apiKey,
2328
- workspaceId: ctx.identity.workspaceId ?? null,
2329
- output: "json",
2330
- sources: { endpoint: "flag", apiKey: "flag", workspaceId: "flag", output: "flag" }
2331
- };
2332
- }
2333
-
2334
2317
  // src/config/ini.ts
2335
2318
  class ProfileConfigError extends Error {
2336
2319
  constructor(message) {
@@ -2646,9 +2629,6 @@ function refuseBlankOverrides(overrides) {
2646
2629
  }
2647
2630
  }
2648
2631
  function resolveProfile(overrides = {}) {
2649
- const embedded = embeddedProfile();
2650
- if (embedded)
2651
- return embedded;
2652
2632
  refuseBlankOverrides(overrides);
2653
2633
  const named = overrides.profile || process.env.SIM_PROFILE;
2654
2634
  const name = named || DEFAULT_PROFILE;
@@ -2701,22 +2681,14 @@ function resolveProfile(overrides = {}) {
2701
2681
  // src/version.ts
2702
2682
  import { readFileSync as readFileSync2 } from "node:fs";
2703
2683
  function readPackageVersion() {
2704
- try {
2705
- const metadata = JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf8"));
2706
- if (typeof metadata === "object" && metadata !== null && "version" in metadata && typeof metadata.version === "string") {
2707
- return metadata.version;
2708
- }
2709
- } catch {}
2710
- return "0.0.0-embedded";
2711
- }
2712
- var cachedVersion = null;
2713
- function cliVersion() {
2714
- cachedVersion ??= readPackageVersion();
2715
- return cachedVersion;
2716
- }
2717
- function userAgent() {
2718
- return `sim-cli/${cliVersion()} node/${process.versions.node} (${process.platform}; ${process.arch})`;
2684
+ const metadata = JSON.parse(readFileSync2(new URL("../package.json", import.meta.url), "utf8"));
2685
+ if (typeof metadata !== "object" || metadata === null || !("version" in metadata) || typeof metadata.version !== "string") {
2686
+ throw new Error("CLI package metadata is missing a valid version");
2687
+ }
2688
+ return metadata.version;
2719
2689
  }
2690
+ var CLI_VERSION = readPackageVersion();
2691
+ var USER_AGENT = `sim-cli/${CLI_VERSION} node/${process.versions.node} (${process.platform}; ${process.arch})`;
2720
2692
 
2721
2693
  // src/http/environment.ts
2722
2694
  var reported = new Set;
@@ -2999,7 +2971,7 @@ class SimClient {
2999
2971
  headers: {
3000
2972
  ...apiKey ? { "x-api-key": apiKey } : {},
3001
2973
  accept: "application/json",
3002
- "user-agent": userAgent(),
2974
+ "user-agent": USER_AGENT,
3003
2975
  ...hasBody ? { "content-type": "application/json" } : {},
3004
2976
  ...options.headers
3005
2977
  },
@@ -6498,7 +6470,7 @@ async function pollForKey(endpoint, auth, signal) {
6498
6470
  headers: {
6499
6471
  "content-type": "application/json",
6500
6472
  accept: "application/json",
6501
- "user-agent": userAgent()
6473
+ "user-agent": USER_AGENT
6502
6474
  },
6503
6475
  body: JSON.stringify({ request: auth.request, verifier: auth.pollSecret }),
6504
6476
  signal,
@@ -16369,7 +16341,7 @@ function addVersionOption(program2) {
16369
16341
  }
16370
16342
  program2.error("error: --version reports the Sim CLI version and takes no value. A command that acts on a deployment version reads it from --to-version.");
16371
16343
  });
16372
- program2.version(cliVersion(), "-V, --version [none]", "output the version number (takes no value)");
16344
+ program2.version(CLI_VERSION, "-V, --version [none]", "output the version number (takes no value)");
16373
16345
  }
16374
16346
  function buildProgram(options = {}) {
16375
16347
  const program2 = new Command;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.4-dev.58.1",
3
+ "version": "2.1.4-preview.59.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,11 +56,5 @@
56
56
  "js-yaml": "4.3.1",
57
57
  "typescript": "^7.0.2",
58
58
  "vitest": "^4.1.0"
59
- },
60
- "exports": {
61
- "./embed": {
62
- "types": "./src/embed.ts",
63
- "default": "./src/embed.ts"
64
- }
65
59
  }
66
60
  }