@boxes-dev/dvb 1.0.54 → 1.0.55

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.
@@ -0,0 +1,52 @@
1
+ import { createSecretStore, loadConfig } from "@boxes-dev/core";
2
+ import { ensureControlPlaneToken } from "../../auth.js";
3
+ import { ensureModalDevboxActive } from "../../controlPlane.js";
4
+ import { createProviderCredentialContext, resolveModalCommandOperationOptions, } from "../providerClient.js";
5
+ const resolveModalCommandContext = async (options) => {
6
+ const config = await loadConfig(process.env.HOME ? { homeDir: process.env.HOME } : undefined);
7
+ const store = await createSecretStore(config?.tokenStore, process.env.HOME ? { homeDir: process.env.HOME } : undefined);
8
+ const modalCredentialContext = createProviderCredentialContext({
9
+ mode: "auto",
10
+ controlPlaneToken: await store.getControlPlaneToken(),
11
+ });
12
+ let operationOptions = await resolveModalCommandOperationOptions({
13
+ credentials: modalCredentialContext,
14
+ cwd: options.cwd,
15
+ });
16
+ if (operationOptions.credentialMode === "shared" &&
17
+ (!operationOptions.credentials.modalTokenId ||
18
+ !operationOptions.credentials.modalTokenSecret)) {
19
+ const controlPlaneToken = await ensureControlPlaneToken(store, options.stage);
20
+ if (controlPlaneToken) {
21
+ operationOptions = await resolveModalCommandOperationOptions({
22
+ credentials: createProviderCredentialContext({
23
+ mode: "auto",
24
+ controlPlaneToken,
25
+ }),
26
+ cwd: options.cwd,
27
+ });
28
+ }
29
+ }
30
+ let controlPlaneToken = modalCredentialContext.controlPlaneToken;
31
+ const ensureActive = async (intent) => {
32
+ if (!controlPlaneToken) {
33
+ controlPlaneToken = await ensureControlPlaneToken(store, options.stage);
34
+ }
35
+ if (!controlPlaneToken) {
36
+ throw new Error("Control plane authentication is required to wake modal devboxes. Run `dvb setup` and retry.");
37
+ }
38
+ const ensured = await ensureModalDevboxActive(controlPlaneToken, options.alias, intent);
39
+ return {
40
+ appName: ensured.appName,
41
+ sandboxId: ensured.sandboxId,
42
+ woke: ensured.woke,
43
+ wakeSource: ensured.wakeSource,
44
+ };
45
+ };
46
+ return {
47
+ operationOptions,
48
+ ensureActive,
49
+ };
50
+ };
51
+ export { resolveModalCommandContext };
52
+ //# sourceMappingURL=modalCommandContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modalCommandContext.js","sourceRoot":"","sources":["../../../../src/devbox/commands/provider/modalCommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACL,+BAA+B,EAC/B,mCAAmC,GAEpC,MAAM,sBAAsB,CAAC;AAwB9B,MAAM,0BAA0B,GAAG,KAAK,EACtC,OAA0C,EACJ,EAAE;IACxC,MAAM,MAAM,GAAG,MAAM,UAAU,CAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAC7D,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,iBAAiB,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAC7D,CAAC;IAEF,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;QAC7D,IAAI,EAAE,MAAM;QACZ,iBAAiB,EAAE,MAAM,KAAK,CAAC,oBAAoB,EAAE;KACtD,CAAC,CAAC;IAEH,IAAI,gBAAgB,GAAG,MAAM,mCAAmC,CAAC;QAC/D,WAAW,EAAE,sBAAsB;QACnC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,IACE,gBAAgB,CAAC,cAAc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2
2
  "name": "@boxes-dev/dvb",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {