sim 2.1.3 → 2.1.4-dev.56.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.
- package/dist/index.js +20 -0
- package/package.json +7 -1
package/dist/index.js
CHANGED
|
@@ -2314,6 +2314,23 @@ 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
|
+
|
|
2317
2334
|
// src/config/ini.ts
|
|
2318
2335
|
class ProfileConfigError extends Error {
|
|
2319
2336
|
constructor(message) {
|
|
@@ -2629,6 +2646,9 @@ function refuseBlankOverrides(overrides) {
|
|
|
2629
2646
|
}
|
|
2630
2647
|
}
|
|
2631
2648
|
function resolveProfile(overrides = {}) {
|
|
2649
|
+
const embedded = embeddedProfile();
|
|
2650
|
+
if (embedded)
|
|
2651
|
+
return embedded;
|
|
2632
2652
|
refuseBlankOverrides(overrides);
|
|
2633
2653
|
const named = overrides.profile || process.env.SIM_PROFILE;
|
|
2634
2654
|
const name = named || DEFAULT_PROFILE;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sim",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4-dev.56.1",
|
|
4
4
|
"description": "Sim CLI - talk to the Sim API from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,5 +56,11 @@
|
|
|
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
|
+
}
|
|
59
65
|
}
|
|
60
66
|
}
|