@superwall/cli 2.5.1 → 2.5.2
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/{apple-BSKxY7Gx.js → apple-D2z3tALE.js} +14 -14
- package/dist/{approve-DbwsYO4s.js → approve-I-lvTanp.js} +31 -28
- package/dist/{assets-CqpFg5mM.js → assets-oo93EFou.js} +3 -3
- package/dist/auth.js +3 -3
- package/dist/{session-DYdxTNZf.js → base-Cft9NZfU.js} +35 -35
- package/dist/{billing-BopwIhR3.js → billing-Bo1UEKqV.js} +3 -3
- package/dist/{bind-DOF3o3FR.js → bind-BvScWziR.js} +4 -4
- package/dist/{build-BF22vVdV.js → build-Co487gha.js} +10 -10
- package/dist/{client-DHlsTaP1.js → client-Tp6iD66_.js} +55 -5
- package/dist/create-CHIPz5vb.js +20 -0
- package/dist/{create-CboPfAlN.js → create-G3HuOHZ4.js} +31 -31
- package/dist/{create-CiZzZrru.js → create-uA3nrMIa.js} +6 -6
- package/dist/{doctor-BqZGaQE5.js → doctor-CHF9aNFc.js} +6 -6
- package/dist/{drivers-DkboeR1c.js → drivers-YZEcBiSV.js} +3 -3
- package/dist/entry.js +20 -20
- package/dist/{environment-FR3bcq0D.js → environment-EU7Mrk7j.js} +1 -1
- package/dist/{existing-C6TTT6c4.js → existing-DV_6NLfW.js} +2 -2
- package/dist/{selection-CWfI4a0O.js → framework-b-Yf8sP1.js} +50 -50
- package/dist/held-Dd19AduK.js +17 -0
- package/dist/{held-C2IjAyg6.js → held-L0vz0_hA.js} +6 -6
- package/dist/{install-DoSYCwLL.js → install-CXfLcLhU.js} +37 -37
- package/dist/{integrate-BSqd2wgI.js → integrate-DS2YGLsM.js} +23 -23
- package/dist/{types-CB6O_wjy.js → lock-DgSx-p8Y.js} +79 -79
- package/dist/login-C0BjJmFy.js +17 -0
- package/dist/{login-C6FcBQZg.js → login-Ca6FhI6R.js} +6 -6
- package/dist/{login-dRPPnGr7.js → login-DoMmU3Bq.js} +1 -1
- package/dist/{lookup-D23dAOz6.js → lookup-DhMLZmdW.js} +3 -3
- package/dist/{migrate-CDdUCTH3.js → migrate-CoQWqzhJ.js} +29 -29
- package/dist/{migration-r9plM7F6.js → migration-C22iQzAW.js} +9 -9
- package/dist/{notification-url-rdnENCxt.js → notification-url-CqnXE9yB.js} +2 -2
- package/dist/{open-DVdE3HnK.js → open-DriuY3di.js} +2 -2
- package/dist/{org-DZ41muzA.js → org-D7LQrg3k.js} +3 -3
- package/dist/{organization-DIODPOwO.js → organization-DDidaGRK.js} +8 -8
- package/dist/{orgs-BxlwcvTu.js → orgs-CYXjVdxM.js} +1 -1
- package/dist/{paths-BaeoxDze.js → paths-Bf3othB-.js} +1 -1
- package/dist/{playbook-B-Pdonhg.js → playbook-K7vmAUsu.js} +10 -10
- package/dist/{project-DHU5wc3R.js → project-NoMtbMyl.js} +9 -9
- package/dist/{promote-Ca4URuHY.js → promote-DXxxj4BU.js} +23 -23
- package/dist/pull-Bfa3_SBt.js +106 -0
- package/dist/pull-DGrlBSAG.js +36 -0
- package/dist/{pull-CQcTZxW8.js → pull-DuFUkP7t.js} +8 -8
- package/dist/{push-DQE48h_M.js → push-CrowxhpU.js} +53 -47
- package/dist/push-DPZdch2W.js +30 -0
- package/dist/push-DV-kJZdw.js +22 -0
- package/dist/{push-BlZoIwIj.js → push-Dk5x2xP3.js} +9 -9
- package/dist/{registry-FNG-uiIt.js → registry-HhZVRBqY.js} +154 -152
- package/dist/resolve-D3RBtfkI.js +242 -0
- package/dist/{resources-COOEvqqW.js → resources-CkG6SCia.js} +2 -2
- package/dist/{run-DpYDOAw-.js → run-CL5ZnujW.js} +2 -2
- package/dist/{run-Czbb-sHR.js → run-Co8u_BkN.js} +65 -65
- package/dist/scan-BQmjhs3g.js +4 -0
- package/dist/{scan-BZS2FZeU.js → scan-DhmGH1rF.js} +1 -1
- package/dist/{scope-BJQ-KcQg.js → scope-D0XpYMn4.js} +5 -5
- package/dist/{scope-t_SqFN6W.js → scope-ehZ7L1nj.js} +8 -8
- package/dist/{sdk-CyttTnGf.js → sdk-DEfQttek.js} +7 -7
- package/dist/{series--Wp7TngJ.js → series-D2ZpZ8cx.js} +95 -62
- package/dist/server-4ZK_1Off.js +29 -0
- package/dist/{server-BmmOj7bh.js → server-DamMN_ig.js} +9 -9
- package/dist/session-4F_YWSul.js +6 -0
- package/dist/{session-BpYpOgaY.js → session-G1uwJI8L.js} +1 -1
- package/dist/{setup-DW50luOZ.js → setup-BFTSxEWU.js} +9 -9
- package/dist/skills/index.json +2 -2
- package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +44 -30
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +35 -29
- package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
- package/dist/{skills-Cm1j2d1W.js → skills-CE4c9eHX.js} +4 -4
- package/dist/{skills-Bbtq8V_D.js → skills-ClEVgXUB.js} +8 -8
- package/dist/{git-DqDPnldI.js → source-BccdO4aL.js} +95 -95
- package/dist/{source-push-B3c-VLfe.js → source-push-EyF02ekO.js} +6 -6
- package/dist/{spinner-025_eqCX.js → spinner-mWZnJCkN.js} +3 -3
- package/dist/{starter-hcwocv_Z.js → starter-BtUUQWhd.js} +38 -28
- package/dist/{status-K1IGp6pe.js → status-SAZxltzW.js} +39 -39
- package/dist/{storage-CUMgpcVH.js → storage-R5-qDvHq.js} +1 -1
- package/dist/{storekit-Cb0TkToV.js → storekit-CQHVFTOC.js} +3 -3
- package/dist/storekit-DK3xXKoY.js +17 -0
- package/dist/{telemetry-ekUQuhLJ.js → telemetry-B-uKuu49.js} +1 -1
- package/dist/{token-B2PduqrR.js → token-C2kzntVM.js} +1 -1
- package/dist/tools.d.ts +5 -0
- package/dist/tools.js +183 -125
- package/dist/{try-BUnhITXS.js → try-BrJJyXgq.js} +32 -32
- package/dist/{upgrade-DfZfDljd.js → upgrade-g_Bd9oJe.js} +2 -2
- package/dist/{upgrade-CI7K1UZ-.js → upgrade-zOXTIaAZ.js} +2 -2
- package/package.json +2 -2
- package/dist/create-DAkNdEzt.js +0 -20
- package/dist/held-KVcYIplR.js +0 -17
- package/dist/login-BiwaQkXS.js +0 -17
- package/dist/pull-DRMIxqR8.js +0 -36
- package/dist/pull-_qs90vGA.js +0 -106
- package/dist/push-Cb4g_l1K.js +0 -30
- package/dist/push-DZKsd6Dp.js +0 -22
- package/dist/resolve-DGePiHgL.js +0 -196
- package/dist/scan-2WqHGkjU.js +0 -4
- package/dist/server-BqLPwcy9.js +0 -29
- package/dist/session-BHBIGscL.js +0 -6
- package/dist/storekit-Dewj_5qg.js +0 -17
- /package/dist/{design-lint-CvgcSzVg.js → design-lint-CiFc78aM.js} +0 -0
- /package/dist/{download-F8OtTJze.js → download-DhGd4hOB.js} +0 -0
- /package/dist/{reports-BZfxvenS.js → reports-HYVp169R.js} +0 -0
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import "./token-
|
|
1
|
+
import "./token-C2kzntVM.js";
|
|
2
2
|
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-
|
|
4
|
-
import "./storage-
|
|
5
|
-
import { t as ApiError } from "./client-
|
|
3
|
+
import "./environment-EU7Mrk7j.js";
|
|
4
|
+
import "./storage-R5-qDvHq.js";
|
|
5
|
+
import { t as ApiError } from "./client-Tp6iD66_.js";
|
|
6
6
|
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./spinner-
|
|
7
|
+
import "./spinner-mWZnJCkN.js";
|
|
8
8
|
import "./ui-D_qf3Gvw.js";
|
|
9
|
-
import "./orgs-
|
|
10
|
-
import "./resources-
|
|
11
|
-
import "./lookup-
|
|
9
|
+
import "./orgs-CYXjVdxM.js";
|
|
10
|
+
import "./resources-CkG6SCia.js";
|
|
11
|
+
import "./lookup-DhMLZmdW.js";
|
|
12
12
|
import { n as openBrowser } from "./browser-Bp3yRKlU.js";
|
|
13
|
-
import "./
|
|
14
|
-
import "./
|
|
15
|
-
import "./
|
|
16
|
-
import
|
|
17
|
-
import { a as
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import { i as warnIfSdkBehind } from "./sdk-
|
|
13
|
+
import { r as dashboardOrigin } from "./resolve-D3RBtfkI.js";
|
|
14
|
+
import { a as findEntrypoint, s as readProject, t as ArtifactError } from "./project-NoMtbMyl.js";
|
|
15
|
+
import "./lock-DgSx-p8Y.js";
|
|
16
|
+
import "./scope-ehZ7L1nj.js";
|
|
17
|
+
import { _ as DRAFT_MODULE_MAX_BYTES, a as summarizeSeries, c as defaultRange, n as parseFilters, u as bundleArtifact } from "./series-D2ZpZ8cx.js";
|
|
18
|
+
import { n as resolveOrganization, t as resolveAppScope } from "./organization-DDidaGRK.js";
|
|
19
|
+
import "./download-DhGd4hOB.js";
|
|
20
|
+
import { i as warnIfSdkBehind } from "./sdk-DEfQttek.js";
|
|
21
21
|
|
|
22
|
-
//#region src/core/
|
|
23
|
-
async function postDraft(ctx, path, body) {
|
|
22
|
+
//#region src/core/artifacts/try.ts
|
|
23
|
+
async function postDraft(ctx, path, body, options = {}) {
|
|
24
24
|
try {
|
|
25
|
-
return await ctx.api.post(path, body);
|
|
25
|
+
return await ctx.api.post(path, body, options);
|
|
26
26
|
} catch (error) {
|
|
27
|
-
if (error instanceof ApiError && error.status === 400) throw new
|
|
27
|
+
if (error instanceof ApiError && error.status === 400) throw new ArtifactError(error.message);
|
|
28
28
|
throw error;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
async function uploadDraft(ctx, project, organizationId, wrangler) {
|
|
32
|
-
const { module, bytes } = await
|
|
33
|
-
if (bytes > DRAFT_MODULE_MAX_BYTES) throw new
|
|
34
|
-
return postDraft(ctx, "/v2/
|
|
32
|
+
const { module, bytes } = await bundleArtifact(project.root, wrangler);
|
|
33
|
+
if (bytes > DRAFT_MODULE_MAX_BYTES) throw new ArtifactError(`The bundle is ${bytes} bytes; a draft can be ${DRAFT_MODULE_MAX_BYTES} at most.`);
|
|
34
|
+
return postDraft(ctx, "/v2/artifacts/drafts", {
|
|
35
35
|
organization_id: Number(organizationId),
|
|
36
36
|
manifest: project.manifest,
|
|
37
37
|
module
|
|
38
|
-
});
|
|
38
|
+
}, { idempotent: true });
|
|
39
39
|
}
|
|
40
40
|
async function tryMetric(ctx, project, entrypoint, input, wrangler) {
|
|
41
|
-
if (input.app === void 0) throw new
|
|
41
|
+
if (input.app === void 0) throw new ArtifactError("A metric runs for one app. Say which with --app <id>.");
|
|
42
42
|
const { organizationId, applicationId } = await resolveAppScope(ctx.api, input.app, input.org);
|
|
43
|
-
if (organizationId === void 0) throw new
|
|
43
|
+
if (organizationId === void 0) throw new ArtifactError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
|
|
44
44
|
const range = defaultRange(input.days);
|
|
45
45
|
const filters = parseFilters(input.filter);
|
|
46
46
|
const draft = await uploadDraft(ctx, project, organizationId, wrangler);
|
|
47
|
-
const run = await postDraft(ctx, `/v2/
|
|
47
|
+
const run = await postDraft(ctx, `/v2/artifacts/drafts/${encodeURIComponent(draft.id)}/metric`, {
|
|
48
48
|
organization_id: Number(organizationId),
|
|
49
49
|
application_id: Number(applicationId),
|
|
50
50
|
entrypoint_id: entrypoint.id,
|
|
@@ -82,14 +82,14 @@ async function tryMetric(ctx, project, entrypoint, input, wrangler) {
|
|
|
82
82
|
const round = (value) => Math.round(value * 1e3) / 1e3;
|
|
83
83
|
async function tryFrame(ctx, project, entrypoint, input, seams) {
|
|
84
84
|
const scope = input.app === void 0 ? { organizationId: await resolveOrganization(ctx, input.org) } : await resolveAppScope(ctx.api, input.app, input.org);
|
|
85
|
-
if (scope.organizationId === void 0) throw new
|
|
85
|
+
if (scope.organizationId === void 0) throw new ArtifactError(`Couldn't find the organization of app ${input.app}. Say which with --org <id>.`);
|
|
86
86
|
const draft = await uploadDraft(ctx, project, scope.organizationId, seams.wrangler);
|
|
87
87
|
const search = new URLSearchParams({ entrypoint: entrypoint.id });
|
|
88
88
|
if (scope.applicationId !== void 0) search.set("app", scope.applicationId);
|
|
89
89
|
if (input.campaign !== void 0) search.set("campaign", input.campaign);
|
|
90
90
|
if (input.user !== void 0) search.set("user", input.user);
|
|
91
91
|
if (input.environment !== void 0) search.set("environment", input.environment);
|
|
92
|
-
const url = `${dashboardOrigin(ctx.api.host)}/${scope.organizationId}/
|
|
92
|
+
const url = `${dashboardOrigin(ctx.api.host)}/${scope.organizationId}/artifact-drafts/${draft.id}?${search}`;
|
|
93
93
|
if (ctx.json) {
|
|
94
94
|
ctx.output.data({
|
|
95
95
|
draft_id: draft.id,
|
|
@@ -105,9 +105,9 @@ async function tryFrame(ctx, project, entrypoint, input, seams) {
|
|
|
105
105
|
if (input.open && ctx.outputMode === "rich") await (seams.open ?? openBrowser)(url);
|
|
106
106
|
}
|
|
107
107
|
function tryReadout(entrypoint) {
|
|
108
|
-
throw new
|
|
108
|
+
throw new ArtifactError(`\`${entrypoint.id}\` (${entrypoint.slot}) is a readout, and readouts can't be tried on the real runtime yet. Run \`superwall artifacts dev\` to run it locally.`);
|
|
109
109
|
}
|
|
110
|
-
async function
|
|
110
|
+
async function runArtifactTry(ctx, input, seams = {}) {
|
|
111
111
|
const project = readProject(input.dir);
|
|
112
112
|
const entrypoint = findEntrypoint(project.manifest, input.entrypoint);
|
|
113
113
|
await warnIfSdkBehind(ctx.ui, project.root);
|
|
@@ -117,4 +117,4 @@ async function runWorkspaceTry(ctx, input, seams = {}) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
//#endregion
|
|
120
|
-
export {
|
|
120
|
+
export { runArtifactTry };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./output-Ggzq5_-t.js";
|
|
2
|
-
import "./environment-
|
|
2
|
+
import "./environment-EU7Mrk7j.js";
|
|
3
3
|
import "./config-CGcG7GOt.js";
|
|
4
4
|
import "./spawn-DmmmHIP-.js";
|
|
5
|
-
import { a as printAutoUpdate, c as runUpgrade, i as maybeNotifyUpdate, l as selectAutoUpdate, n as isGlobalInstall, o as recordAutoUpdate, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-
|
|
5
|
+
import { a as printAutoUpdate, c as runUpgrade, i as maybeNotifyUpdate, l as selectAutoUpdate, n as isGlobalInstall, o as recordAutoUpdate, r as isNewerVersion, s as refreshUpdateCheck, t as flushUpdateCheck } from "./upgrade-zOXTIaAZ.js";
|
|
6
6
|
|
|
7
7
|
export { flushUpdateCheck, isGlobalInstall, isNewerVersion, maybeNotifyUpdate, printAutoUpdate, recordAutoUpdate, refreshUpdateCheck, runUpgrade, selectAutoUpdate };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as RUNNING_VIA_NPX, a as AUTO_UPDATE, x as VERSION } from "./environment-
|
|
1
|
+
import { _ as RUNNING_VIA_NPX, a as AUTO_UPDATE, x as VERSION } from "./environment-EU7Mrk7j.js";
|
|
2
2
|
import { c as readSkillsSync, d as writeAutoUpdate, l as readUpdateCheck, n as readAutoUpdate, v as writeUpdateCheck } from "./config-CGcG7GOt.js";
|
|
3
3
|
import { r as spawnStream } from "./spawn-DmmmHIP-.js";
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
@@ -111,7 +111,7 @@ async function updateAgentSkills(ctx, work) {
|
|
|
111
111
|
return skills;
|
|
112
112
|
}
|
|
113
113
|
async function updateSkillsInProcess() {
|
|
114
|
-
const { updateSkills } = await import("./skills-
|
|
114
|
+
const { updateSkills } = await import("./skills-ClEVgXUB.js");
|
|
115
115
|
return updateSkills();
|
|
116
116
|
}
|
|
117
117
|
async function updateSkillsWithInstalledCli(version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superwall/cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "The official CLI for managing Superwall from your terminal or coding agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@anthropic-ai/claude-agent-sdk": "0.3.201",
|
|
67
|
-
"@superwall/studio": "2.5.
|
|
67
|
+
"@superwall/studio": "2.5.2",
|
|
68
68
|
"ansi-escapes": "^7.3.0",
|
|
69
69
|
"fast-glob": "^3.3.3",
|
|
70
70
|
"ink": "^5.2.1",
|
package/dist/create-DAkNdEzt.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./held-C2IjAyg6.js";
|
|
7
|
-
import "./config-CGcG7GOt.js";
|
|
8
|
-
import "./spinner-025_eqCX.js";
|
|
9
|
-
import "./ui-D_qf3Gvw.js";
|
|
10
|
-
import "./paths-BaeoxDze.js";
|
|
11
|
-
import "./orgs-BxlwcvTu.js";
|
|
12
|
-
import "./resources-COOEvqqW.js";
|
|
13
|
-
import "./org-DZ41muzA.js";
|
|
14
|
-
import "./lookup-D23dAOz6.js";
|
|
15
|
-
import "./scope-BJQ-KcQg.js";
|
|
16
|
-
import "./client-BJQXl62Q.js";
|
|
17
|
-
import "./timing-Ca0TXY-A.js";
|
|
18
|
-
import { i as runAscKeysCreate, n as keyAccess, r as keyRole, t as createAndSaveKey } from "./create-CiZzZrru.js";
|
|
19
|
-
|
|
20
|
-
export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
|
package/dist/held-KVcYIplR.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import { t as upsertHeldKey } from "./held-C2IjAyg6.js";
|
|
7
|
-
import "./config-CGcG7GOt.js";
|
|
8
|
-
import "./spinner-025_eqCX.js";
|
|
9
|
-
import "./ui-D_qf3Gvw.js";
|
|
10
|
-
import "./orgs-BxlwcvTu.js";
|
|
11
|
-
import "./resources-COOEvqqW.js";
|
|
12
|
-
import "./org-DZ41muzA.js";
|
|
13
|
-
import "./lookup-D23dAOz6.js";
|
|
14
|
-
import "./scope-BJQ-KcQg.js";
|
|
15
|
-
import "./client-BJQXl62Q.js";
|
|
16
|
-
|
|
17
|
-
export { upsertHeldKey };
|
package/dist/login-BiwaQkXS.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./telemetry-ekUQuhLJ.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-025_eqCX.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-BZS2FZeU.js";
|
|
12
|
-
import "./paths-BaeoxDze.js";
|
|
13
|
-
import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-C6FcBQZg.js";
|
|
14
|
-
import "./skills-Cm1j2d1W.js";
|
|
15
|
-
import "./browser-Bp3yRKlU.js";
|
|
16
|
-
|
|
17
|
-
export { performLogin, pollLogin, runLogin, startLogin };
|
package/dist/pull-DRMIxqR8.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./telemetry-ekUQuhLJ.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-025_eqCX.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./theme-DUsCh-Vd.js";
|
|
12
|
-
import "./log-C0MDCfA2.js";
|
|
13
|
-
import "./scan-BZS2FZeU.js";
|
|
14
|
-
import "./existing-C6TTT6c4.js";
|
|
15
|
-
import "./paths-BaeoxDze.js";
|
|
16
|
-
import "./orgs-BxlwcvTu.js";
|
|
17
|
-
import "./resources-COOEvqqW.js";
|
|
18
|
-
import "./org-DZ41muzA.js";
|
|
19
|
-
import "./lookup-D23dAOz6.js";
|
|
20
|
-
import "./bind-DOF3o3FR.js";
|
|
21
|
-
import "./login-C6FcBQZg.js";
|
|
22
|
-
import "./skills-Cm1j2d1W.js";
|
|
23
|
-
import "./browser-Bp3yRKlU.js";
|
|
24
|
-
import "./selection-CWfI4a0O.js";
|
|
25
|
-
import "./types-CB6O_wjy.js";
|
|
26
|
-
import "./session-DYdxTNZf.js";
|
|
27
|
-
import "./git-DqDPnldI.js";
|
|
28
|
-
import "./scope-t_SqFN6W.js";
|
|
29
|
-
import "./login-dRPPnGr7.js";
|
|
30
|
-
import "./run-DpYDOAw-.js";
|
|
31
|
-
import "./drivers-DkboeR1c.js";
|
|
32
|
-
import "./migration-r9plM7F6.js";
|
|
33
|
-
import "./setup-DW50luOZ.js";
|
|
34
|
-
import { a as cloneInto, c as pullInto, i as boundPaywall, l as runPull, n as applyPulledChanges, o as cloneTarget, r as appsToPull, s as mergePulledLock, t as PullPathError } from "./pull-CQcTZxW8.js";
|
|
35
|
-
|
|
36
|
-
export { PullPathError, applyPulledChanges, appsToPull, boundPaywall, cloneInto, cloneTarget, mergePulledLock, pullInto, runPull };
|
package/dist/pull-_qs90vGA.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./telemetry-ekUQuhLJ.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-025_eqCX.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./theme-DUsCh-Vd.js";
|
|
12
|
-
import "./log-C0MDCfA2.js";
|
|
13
|
-
import "./scan-BZS2FZeU.js";
|
|
14
|
-
import "./existing-C6TTT6c4.js";
|
|
15
|
-
import "./paths-BaeoxDze.js";
|
|
16
|
-
import "./orgs-BxlwcvTu.js";
|
|
17
|
-
import "./resources-COOEvqqW.js";
|
|
18
|
-
import "./org-DZ41muzA.js";
|
|
19
|
-
import "./lookup-D23dAOz6.js";
|
|
20
|
-
import "./bind-DOF3o3FR.js";
|
|
21
|
-
import "./login-C6FcBQZg.js";
|
|
22
|
-
import "./skills-Cm1j2d1W.js";
|
|
23
|
-
import "./browser-Bp3yRKlU.js";
|
|
24
|
-
import "./selection-CWfI4a0O.js";
|
|
25
|
-
import "./types-CB6O_wjy.js";
|
|
26
|
-
import "./session-DYdxTNZf.js";
|
|
27
|
-
import { a as collectSourceFiles, n as pullSourceTree } from "./git-DqDPnldI.js";
|
|
28
|
-
import { r as WORKSPACE_DERIVED_FILES } from "./scope-t_SqFN6W.js";
|
|
29
|
-
import "./login-dRPPnGr7.js";
|
|
30
|
-
import "./run-DpYDOAw-.js";
|
|
31
|
-
import "./drivers-DkboeR1c.js";
|
|
32
|
-
import "./migration-r9plM7F6.js";
|
|
33
|
-
import "./download-F8OtTJze.js";
|
|
34
|
-
import "./setup-DW50luOZ.js";
|
|
35
|
-
import { n as applyPulledChanges } from "./pull-CQcTZxW8.js";
|
|
36
|
-
import { c as projectRoot, f as readBinding, l as resolveWorkspace, m as writeBinding, p as readSourceFile, w as mintSourceAccess } from "./resolve-DGePiHgL.js";
|
|
37
|
-
import { r as WorkspaceError } from "./project-DHU5wc3R.js";
|
|
38
|
-
import "./organization-DIODPOwO.js";
|
|
39
|
-
import "./sdk-CyttTnGf.js";
|
|
40
|
-
import { a as toSourceAccess } from "./push-DQE48h_M.js";
|
|
41
|
-
import * as fs from "node:fs";
|
|
42
|
-
import * as path from "node:path";
|
|
43
|
-
|
|
44
|
-
//#region src/core/workspaces/pull.ts
|
|
45
|
-
const NOT_PUSHED = "Its source repo is empty: nobody has pushed yet. Run `superwall workspaces push` first.";
|
|
46
|
-
function report(ctx, slug, head, written, skipped) {
|
|
47
|
-
if (ctx.json) {
|
|
48
|
-
ctx.output.data({
|
|
49
|
-
slug,
|
|
50
|
-
head,
|
|
51
|
-
written,
|
|
52
|
-
skipped
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
ctx.ui.success(written.length === 0 ? "Already up to date." : `Pulled ${written.length} ${written.length === 1 ? "file" : "files"} of \`${slug}\`.`);
|
|
57
|
-
if (written.length > 0) ctx.ui.list({ items: written.map((label) => ({ label })) });
|
|
58
|
-
if (skipped.length > 0) ctx.ui.warn(`Not pulled, because a file of yours that git doesn't track is in the way: ${skipped.join(", ")}. Move it, then pull again.`);
|
|
59
|
-
}
|
|
60
|
-
function assertCloneTarget(root) {
|
|
61
|
-
if (!fs.existsSync(root)) return;
|
|
62
|
-
if (fs.readdirSync(root).length > 0) throw new WorkspaceError(`${root} already has files and isn't linked to this workspace. Pick an empty directory.`);
|
|
63
|
-
}
|
|
64
|
-
async function runWorkspacePull(ctx, input) {
|
|
65
|
-
const root = projectRoot(input.dir);
|
|
66
|
-
const linked = readBinding(root);
|
|
67
|
-
const workspace = await resolveWorkspace(ctx, input);
|
|
68
|
-
if (linked && linked.workspaceId !== String(workspace.id)) throw new WorkspaceError(`This project is linked to workspace ${linked.workspaceId}, not ${workspace.id}. Pull into an empty directory instead.`);
|
|
69
|
-
if (!linked) assertCloneTarget(root);
|
|
70
|
-
fs.mkdirSync(root, { recursive: true });
|
|
71
|
-
const collected = linked ? await collectSourceFiles(root, readSourceFile) : {
|
|
72
|
-
ok: true,
|
|
73
|
-
files: []
|
|
74
|
-
};
|
|
75
|
-
if (!collected.ok) throw new WorkspaceError(collected.reason);
|
|
76
|
-
const pulled = await pullSourceTree({
|
|
77
|
-
access: toSourceAccess(await mintSourceAccess(ctx.api, workspace.id)),
|
|
78
|
-
files: collected.files,
|
|
79
|
-
base: linked?.syncedCommit,
|
|
80
|
-
theirs: input.theirs,
|
|
81
|
-
derived: WORKSPACE_DERIVED_FILES
|
|
82
|
-
});
|
|
83
|
-
if (pulled.status === "empty") throw new WorkspaceError(NOT_PUSHED);
|
|
84
|
-
const { written, skipped } = applyPulledChanges(root, pulled.changes, new Set(collected.files.map((file) => file.path)));
|
|
85
|
-
writeBinding(root, {
|
|
86
|
-
workspaceId: String(workspace.id),
|
|
87
|
-
organizationId: String(workspace.organization_id),
|
|
88
|
-
slug: workspace.slug,
|
|
89
|
-
...skipped.length > 0 ? {
|
|
90
|
-
syncedCommit: linked?.syncedCommit,
|
|
91
|
-
reviewedCommit: linked?.reviewedCommit
|
|
92
|
-
} : {
|
|
93
|
-
syncedCommit: pulled.head,
|
|
94
|
-
reviewedCommit: pulled.head
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
report(ctx, workspace.slug, pulled.head, written, skipped);
|
|
98
|
-
if (linked && written.length > 0 && !ctx.json) ctx.ui.info("Read what came in before you push: your own copy runs all of it with your reads.");
|
|
99
|
-
if (!linked && !ctx.json) {
|
|
100
|
-
const where = path.relative(process.cwd(), root) || ".";
|
|
101
|
-
ctx.ui.info(`Next: cd ${where} && npm install && superwall workspaces dev`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
//#endregion
|
|
106
|
-
export { runWorkspacePull };
|
package/dist/push-Cb4g_l1K.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./telemetry-ekUQuhLJ.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-025_eqCX.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-BZS2FZeU.js";
|
|
12
|
-
import "./paths-BaeoxDze.js";
|
|
13
|
-
import "./orgs-BxlwcvTu.js";
|
|
14
|
-
import "./resources-COOEvqqW.js";
|
|
15
|
-
import "./lookup-D23dAOz6.js";
|
|
16
|
-
import "./login-C6FcBQZg.js";
|
|
17
|
-
import "./skills-Cm1j2d1W.js";
|
|
18
|
-
import "./browser-Bp3yRKlU.js";
|
|
19
|
-
import "./assets-CqpFg5mM.js";
|
|
20
|
-
import "./selection-CWfI4a0O.js";
|
|
21
|
-
import "./design-lint-CvgcSzVg.js";
|
|
22
|
-
import "./types-CB6O_wjy.js";
|
|
23
|
-
import "./session-DYdxTNZf.js";
|
|
24
|
-
import "./source-push-B3c-VLfe.js";
|
|
25
|
-
import { i as timed, n as runPush, r as runPushPipeline, t as group } from "./push-BlZoIwIj.js";
|
|
26
|
-
import "./git-DqDPnldI.js";
|
|
27
|
-
import "./scope-t_SqFN6W.js";
|
|
28
|
-
import "./login-dRPPnGr7.js";
|
|
29
|
-
|
|
30
|
-
export { group, runPush, runPushPipeline, timed };
|
package/dist/push-DZKsd6Dp.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./spinner-025_eqCX.js";
|
|
8
|
-
import "./ui-D_qf3Gvw.js";
|
|
9
|
-
import "./orgs-BxlwcvTu.js";
|
|
10
|
-
import "./resources-COOEvqqW.js";
|
|
11
|
-
import "./lookup-D23dAOz6.js";
|
|
12
|
-
import "./types-CB6O_wjy.js";
|
|
13
|
-
import "./git-DqDPnldI.js";
|
|
14
|
-
import "./scope-t_SqFN6W.js";
|
|
15
|
-
import "./download-F8OtTJze.js";
|
|
16
|
-
import "./resolve-DGePiHgL.js";
|
|
17
|
-
import "./project-DHU5wc3R.js";
|
|
18
|
-
import "./organization-DIODPOwO.js";
|
|
19
|
-
import "./sdk-CyttTnGf.js";
|
|
20
|
-
import { a as toSourceAccess, i as slugOfName, n as namesOf, o as waitForBuild, r as runWorkspacePush, t as IncomingCommitsRefused } from "./push-DQE48h_M.js";
|
|
21
|
-
|
|
22
|
-
export { IncomingCommitsRefused, namesOf, runWorkspacePush, slugOfName, toSourceAccess, waitForBuild };
|
package/dist/resolve-DGePiHgL.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { u as DASHBOARD_ORIGIN_OVERRIDE } from "./environment-FR3bcq0D.js";
|
|
2
|
-
import { a as orgProjects, n as listOrganizations } from "./orgs-BxlwcvTu.js";
|
|
3
|
-
import { i as WORKSPACE_FILE } from "./scope-t_SqFN6W.js";
|
|
4
|
-
import { r as WorkspaceError } from "./project-DHU5wc3R.js";
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import * as path from "node:path";
|
|
7
|
-
|
|
8
|
-
//#region src/core/workspaces/api.ts
|
|
9
|
-
const workspacePath = (id) => `/v2/workspaces/${encodeURIComponent(String(id))}`;
|
|
10
|
-
const versionPath = (id, version) => `${workspacePath(id)}/versions/${encodeURIComponent(String(version))}`;
|
|
11
|
-
const getMe = (api) => api.get("/v2/me");
|
|
12
|
-
const listMembers = async (api, organizationId) => (await api.get(`/v2/organizations/${encodeURIComponent(String(organizationId))}/access/members`)).data ?? [];
|
|
13
|
-
const getWorkspace = (api, id) => api.get(workspacePath(id));
|
|
14
|
-
const listWorkspaces = async (api, organizationId, slug) => {
|
|
15
|
-
const search = new URLSearchParams({
|
|
16
|
-
organization_id: organizationId,
|
|
17
|
-
...slug ? { slug } : {}
|
|
18
|
-
});
|
|
19
|
-
return (await api.get(`/v2/workspaces?${search}`)).data;
|
|
20
|
-
};
|
|
21
|
-
const createWorkspace = (api, organizationId, name, slug) => api.post("/v2/workspaces", {
|
|
22
|
-
organization_id: Number(organizationId),
|
|
23
|
-
name,
|
|
24
|
-
slug
|
|
25
|
-
});
|
|
26
|
-
const listVersions = async (api, id) => (await api.get(`${workspacePath(id)}/versions`)).data;
|
|
27
|
-
const mintSourceAccess = (api, id) => api.post(`${workspacePath(id)}/source-access`, {});
|
|
28
|
-
const startBuild = (api, id, commitSha, tokenId) => api.post(`${workspacePath(id)}/builds`, {
|
|
29
|
-
commit_sha: commitSha,
|
|
30
|
-
token_id: tokenId
|
|
31
|
-
});
|
|
32
|
-
const getBuild = (api, id, version) => api.get(`${versionPath(id, version)}/build`);
|
|
33
|
-
const requestDeploy = (api, id, version) => api.post(`${versionPath(id, version)}/request-deploy`, {});
|
|
34
|
-
const approveVersion = (api, id, version) => api.post(`${versionPath(id, version)}/approve`, {});
|
|
35
|
-
const listInstallations = async (api, id) => (await api.get(`${workspacePath(id)}/installations`)).data;
|
|
36
|
-
const setInstallation = (api, id, body) => api.put(`${workspacePath(id)}/installations`, body);
|
|
37
|
-
const deleteInstallation = (api, id, entrypoint, application) => {
|
|
38
|
-
const search = new URLSearchParams({
|
|
39
|
-
entrypoint_id: entrypoint,
|
|
40
|
-
...application ? { application_id: application } : {}
|
|
41
|
-
});
|
|
42
|
-
return api.del(`${workspacePath(id)}/installations?${search}`);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/core/workspaces/binding.ts
|
|
47
|
-
function readBinding(root) {
|
|
48
|
-
const file = path.join(root, WORKSPACE_FILE);
|
|
49
|
-
let text;
|
|
50
|
-
try {
|
|
51
|
-
text = fs.readFileSync(file, "utf8");
|
|
52
|
-
} catch {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
let parsed;
|
|
56
|
-
try {
|
|
57
|
-
parsed = JSON.parse(text);
|
|
58
|
-
} catch (error) {
|
|
59
|
-
throw new WorkspaceError(`${WORKSPACE_FILE} is not valid JSON: ${error.message}`);
|
|
60
|
-
}
|
|
61
|
-
const { workspace_id: workspaceId, organization_id: organizationId, slug, synced_commit: syncedCommit, reviewed_commit: reviewedCommit } = parsed;
|
|
62
|
-
if (typeof workspaceId !== "number" || typeof organizationId !== "number" || typeof slug !== "string") throw new WorkspaceError(`${WORKSPACE_FILE} needs workspace_id, organization_id and slug.`);
|
|
63
|
-
return {
|
|
64
|
-
workspaceId: String(workspaceId),
|
|
65
|
-
organizationId: String(organizationId),
|
|
66
|
-
slug,
|
|
67
|
-
...typeof syncedCommit === "string" ? { syncedCommit } : {},
|
|
68
|
-
...typeof reviewedCommit === "string" ? { reviewedCommit } : {}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
const formatBinding = (binding, includeSync) => `${JSON.stringify({
|
|
72
|
-
workspace_id: Number(binding.workspaceId),
|
|
73
|
-
organization_id: Number(binding.organizationId),
|
|
74
|
-
slug: binding.slug,
|
|
75
|
-
...includeSync && binding.syncedCommit ? { synced_commit: binding.syncedCommit } : {},
|
|
76
|
-
...includeSync && binding.reviewedCommit ? { reviewed_commit: binding.reviewedCommit } : {}
|
|
77
|
-
}, null, 2)}\n`;
|
|
78
|
-
function writeBinding(root, binding) {
|
|
79
|
-
fs.writeFileSync(path.join(root, WORKSPACE_FILE), formatBinding(binding, true));
|
|
80
|
-
}
|
|
81
|
-
function readSourceFile(root, relative$1) {
|
|
82
|
-
const file = path.join(root, relative$1);
|
|
83
|
-
if (relative$1 !== WORKSPACE_FILE) return fs.readFileSync(file);
|
|
84
|
-
const binding = readBinding(root);
|
|
85
|
-
return binding ? Buffer.from(formatBinding(binding, false)) : fs.readFileSync(file);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/core/workspaces/resolve.ts
|
|
90
|
-
const projectRoot = (dir) => path.resolve(dir ?? process.cwd());
|
|
91
|
-
async function resolveWorkspace(ctx, ref) {
|
|
92
|
-
if (ref.workspace !== void 0) {
|
|
93
|
-
if (/^\d+$/.test(ref.workspace)) return getWorkspace(ctx.api, ref.workspace);
|
|
94
|
-
if (ref.org === void 0) throw new WorkspaceError(`A slug needs its organization: add --org <id>, or pass the workspace's id.`);
|
|
95
|
-
const [found] = await listWorkspaces(ctx.api, ref.org, ref.workspace);
|
|
96
|
-
if (!found) throw new WorkspaceError(`No workspace \`${ref.workspace}\` in organization ${ref.org}.`);
|
|
97
|
-
return found;
|
|
98
|
-
}
|
|
99
|
-
const binding = readBinding(projectRoot(ref.dir));
|
|
100
|
-
if (!binding) throw new WorkspaceError("This project isn't linked to a workspace yet. Run `superwall workspaces push`, or say which with --workspace <id>.");
|
|
101
|
-
return getWorkspace(ctx.api, binding.workspaceId);
|
|
102
|
-
}
|
|
103
|
-
function dashboardOrigin(apiHost) {
|
|
104
|
-
return DASHBOARD_ORIGIN_OVERRIDE() ?? (new URL(apiHost).hostname.endsWith(".dev") ? "https://app.superwall.dev" : "https://app.superwall.com");
|
|
105
|
-
}
|
|
106
|
-
const workspaceUrl = (apiHost, workspace) => `${dashboardOrigin(apiHost)}/${workspace.organization_id}/workspaces/${encodeURIComponent(workspace.slug)}`;
|
|
107
|
-
const EMBED_SLOTS = new Set([
|
|
108
|
-
"app.dashboard.widget@1",
|
|
109
|
-
"campaign.tab@1",
|
|
110
|
-
"campaign.metric@1",
|
|
111
|
-
"user.panel@1",
|
|
112
|
-
"user.action@1"
|
|
113
|
-
]);
|
|
114
|
-
const appEntrypointUrl = (apiHost, workspace, applicationId, entrypoint) => {
|
|
115
|
-
const app = `${dashboardOrigin(apiHost)}/${workspace.organization_id}/${applicationId}`;
|
|
116
|
-
if (entrypoint.slot === "chart.source@1") return `${app}/charts?cS=workspaces`;
|
|
117
|
-
if (EMBED_SLOTS.has(entrypoint.slot)) return `${app}/embeds`;
|
|
118
|
-
return `${app}/apps/${workspace.id}/${encodeURIComponent(entrypoint.id)}`;
|
|
119
|
-
};
|
|
120
|
-
const mainEntrypoint = (entrypoints) => entrypoints.find((entrypoint) => entrypoint.slot === "app.page@1") ?? entrypoints.find((entrypoint) => EMBED_SLOTS.has(entrypoint.slot)) ?? entrypoints.find((entrypoint) => entrypoint.slot === "chart.source@1");
|
|
121
|
-
async function openLink(ctx, workspace, manifest) {
|
|
122
|
-
const fallback = { url: workspaceUrl(ctx.api.host, workspace) };
|
|
123
|
-
const entrypoints = manifest?.entrypoints ?? [];
|
|
124
|
-
const main = mainEntrypoint(entrypoints);
|
|
125
|
-
if (!main || entrypoints.some((entrypoint) => entrypoint.slot === "org.page@1")) return fallback;
|
|
126
|
-
const apps = (await orgProjects(ctx.api, String(workspace.organization_id)).catch(() => [])).flatMap((project) => project.applications ?? []);
|
|
127
|
-
const [first] = apps;
|
|
128
|
-
if (first === void 0) return fallback;
|
|
129
|
-
return {
|
|
130
|
-
url: appEntrypointUrl(ctx.api.host, workspace, String(first.id), main),
|
|
131
|
-
app: String(first.name ?? first.id),
|
|
132
|
-
otherApps: apps.length > 1
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
async function awaitingInstall(api, workspaceId, manifest) {
|
|
136
|
-
const entrypoints = manifest?.entrypoints ?? [];
|
|
137
|
-
if (entrypoints.length === 0 || entrypoints.some((entrypoint) => entrypoint.slot === "org.page@1")) return false;
|
|
138
|
-
const installed = await listInstallations(api, workspaceId).catch(() => void 0);
|
|
139
|
-
if (installed === void 0) return false;
|
|
140
|
-
return entrypoints.every((entrypoint) => !installed.some((row) => row.entrypoint_id === entrypoint.id));
|
|
141
|
-
}
|
|
142
|
-
const latestManifest = (versions) => newestFirst(versions).find((version) => version.manifest !== null)?.manifest;
|
|
143
|
-
async function visibilityOf(ctx, workspaceId, version, manifest) {
|
|
144
|
-
const [workspace, me] = await Promise.all([getWorkspace(ctx.api, workspaceId).catch(() => void 0), getMe(ctx.api).catch(() => void 0)]);
|
|
145
|
-
if (workspace?.state === "turned_off") return {
|
|
146
|
-
visibleTo: "nobody",
|
|
147
|
-
sentence: `This workspace is turned off, so nobody can see version ${version}.`
|
|
148
|
-
};
|
|
149
|
-
if (workspace?.active_version_id === version) {
|
|
150
|
-
if (await awaitingInstall(ctx.api, workspaceId, manifest)) return {
|
|
151
|
-
visibleTo: "its_author",
|
|
152
|
-
sentence: `Version ${version} is approved, but nothing is installed yet, so only its author can see it, marked "Not installed". An admin chooses where it shows with \`superwall workspaces install\`.`
|
|
153
|
-
};
|
|
154
|
-
return {
|
|
155
|
-
visibleTo: "everyone",
|
|
156
|
-
sentence: `Version ${version} is live.`
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
if (workspace?.author_version_id === version) return {
|
|
160
|
-
visibleTo: "you",
|
|
161
|
-
sentence: `Only you can see version ${version} until an admin approves it.`
|
|
162
|
-
};
|
|
163
|
-
if (me?.role === "SUPERADMIN") return {
|
|
164
|
-
visibleTo: "nobody",
|
|
165
|
-
sentence: `Nobody can see version ${version} until an admin approves it, because a staff account doesn't get a copy of its own.`
|
|
166
|
-
};
|
|
167
|
-
return {
|
|
168
|
-
visibleTo: "its_author",
|
|
169
|
-
sentence: `Only its author can see version ${version} until an admin approves it.`
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
async function roleCanApprove(ctx, workspace) {
|
|
173
|
-
const role = (await listOrganizations(ctx.api).catch(() => [])).find((organization) => String(organization.id) === String(workspace.organization_id))?.role;
|
|
174
|
-
return typeof role !== "string" || role === "OWNER" || role === "ADMIN";
|
|
175
|
-
}
|
|
176
|
-
const newestFirst = (versions) => [...versions].sort((a, b) => b.id - a.id);
|
|
177
|
-
async function pickVersion(ctx, workspace, requested, matches = () => true) {
|
|
178
|
-
const versions = newestFirst(await listVersions(ctx.api, workspace.id));
|
|
179
|
-
if (requested !== void 0) {
|
|
180
|
-
const version$1 = versions.find((candidate) => String(candidate.id) === requested);
|
|
181
|
-
if (!version$1) throw new WorkspaceError(`No version ${requested} of \`${workspace.slug}\`.`);
|
|
182
|
-
return {
|
|
183
|
-
version: version$1,
|
|
184
|
-
versions
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
const version = versions.find(matches);
|
|
188
|
-
if (!version) throw new WorkspaceError(`\`${workspace.slug}\` has no version for this yet. Run \`superwall workspaces push\`.`);
|
|
189
|
-
return {
|
|
190
|
-
version,
|
|
191
|
-
versions
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
//#endregion
|
|
196
|
-
export { listWorkspaces as C, startBuild as D, setInstallation as E, listVersions as S, requestDeploy as T, deleteInstallation as _, newestFirst as a, listInstallations as b, projectRoot as c, visibilityOf as d, readBinding as f, createWorkspace as g, approveVersion as h, latestManifest as i, resolveWorkspace as l, writeBinding as m, awaitingInstall as n, openLink as o, readSourceFile as p, dashboardOrigin as r, pickVersion as s, appEntrypointUrl as t, roleCanApprove as u, getBuild as v, mintSourceAccess as w, listMembers as x, getMe as y };
|
package/dist/scan-2WqHGkjU.js
DELETED
package/dist/server-BqLPwcy9.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import "./token-B2PduqrR.js";
|
|
2
|
-
import "./output-Ggzq5_-t.js";
|
|
3
|
-
import "./environment-FR3bcq0D.js";
|
|
4
|
-
import "./storage-CUMgpcVH.js";
|
|
5
|
-
import "./client-DHlsTaP1.js";
|
|
6
|
-
import "./config-CGcG7GOt.js";
|
|
7
|
-
import "./telemetry-ekUQuhLJ.js";
|
|
8
|
-
import "./spawn-DmmmHIP-.js";
|
|
9
|
-
import "./spinner-025_eqCX.js";
|
|
10
|
-
import "./ui-D_qf3Gvw.js";
|
|
11
|
-
import "./scan-BZS2FZeU.js";
|
|
12
|
-
import "./paths-BaeoxDze.js";
|
|
13
|
-
import "./orgs-BxlwcvTu.js";
|
|
14
|
-
import "./resources-COOEvqqW.js";
|
|
15
|
-
import "./lookup-D23dAOz6.js";
|
|
16
|
-
import "./login-C6FcBQZg.js";
|
|
17
|
-
import "./skills-Cm1j2d1W.js";
|
|
18
|
-
import "./browser-Bp3yRKlU.js";
|
|
19
|
-
import "./assets-CqpFg5mM.js";
|
|
20
|
-
import "./selection-CWfI4a0O.js";
|
|
21
|
-
import "./types-CB6O_wjy.js";
|
|
22
|
-
import "./session-DYdxTNZf.js";
|
|
23
|
-
import "./source-push-B3c-VLfe.js";
|
|
24
|
-
import "./git-DqDPnldI.js";
|
|
25
|
-
import "./scope-t_SqFN6W.js";
|
|
26
|
-
import "./login-dRPPnGr7.js";
|
|
27
|
-
import { t as runStudio } from "./server-BmmOj7bh.js";
|
|
28
|
-
|
|
29
|
-
export { runStudio };
|