@superwall/cli 2.5.0 → 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.
Files changed (103) hide show
  1. package/README.md +7 -0
  2. package/dist/{apple-Dyr7OFBx.js → apple-D2z3tALE.js} +14 -14
  3. package/dist/{approve-Czs1-JO9.js → approve-I-lvTanp.js} +35 -28
  4. package/dist/{assets-BrB9jQPQ.js → assets-oo93EFou.js} +3 -3
  5. package/dist/auth.d.ts +1 -1
  6. package/dist/auth.js +3 -3
  7. package/dist/{session-D3fgXQBt.js → base-Cft9NZfU.js} +35 -35
  8. package/dist/{billing-D5qqIlVb.js → billing-Bo1UEKqV.js} +3 -3
  9. package/dist/{bind-B3eEcRyp.js → bind-BvScWziR.js} +4 -4
  10. package/dist/{build-DD9pSwHX.js → build-Co487gha.js} +11 -9
  11. package/dist/{client-AI9H4GGB.js → client-Tp6iD66_.js} +55 -5
  12. package/dist/create-CHIPz5vb.js +20 -0
  13. package/dist/{create-ChfgWpiM.js → create-G3HuOHZ4.js} +31 -31
  14. package/dist/{create-B4m-IKlr.js → create-uA3nrMIa.js} +6 -6
  15. package/dist/design-lint-CiFc78aM.js +158 -0
  16. package/dist/{doctor-XtXW6tKE.js → doctor-CHF9aNFc.js} +6 -6
  17. package/dist/{drivers-CMEL13gp.js → drivers-YZEcBiSV.js} +3 -3
  18. package/dist/entry.js +20 -20
  19. package/dist/{environment-BWT2S4qC.js → environment-EU7Mrk7j.js} +3 -3
  20. package/dist/{existing-b0GxFcnc.js → existing-DV_6NLfW.js} +2 -2
  21. package/dist/{selection-BltBpyp5.js → framework-b-Yf8sP1.js} +50 -50
  22. package/dist/held-Dd19AduK.js +17 -0
  23. package/dist/{held-D3PUNky2.js → held-L0vz0_hA.js} +6 -6
  24. package/dist/install-CXfLcLhU.js +109 -0
  25. package/dist/{integrate-qvKd9pVW.js → integrate-DS2YGLsM.js} +23 -23
  26. package/dist/{types-JdxmnCko.js → lock-DgSx-p8Y.js} +79 -79
  27. package/dist/login-C0BjJmFy.js +17 -0
  28. package/dist/{login-PMoXUGqq.js → login-Ca6FhI6R.js} +6 -6
  29. package/dist/{login-COmGHrU5.js → login-DoMmU3Bq.js} +1 -1
  30. package/dist/{lookup-gjcKIZvh.js → lookup-DhMLZmdW.js} +3 -3
  31. package/dist/{migrate-SkkLLdmr.js → migrate-CoQWqzhJ.js} +29 -29
  32. package/dist/{migration-DS44-3Zr.js → migration-C22iQzAW.js} +29 -11
  33. package/dist/{notification-url-BjQPLf4-.js → notification-url-CqnXE9yB.js} +2 -2
  34. package/dist/{open-DQpm2yVs.js → open-DriuY3di.js} +2 -2
  35. package/dist/{org-C04eAO-j.js → org-D7LQrg3k.js} +3 -3
  36. package/dist/{organization-BOECL3vZ.js → organization-DDidaGRK.js} +8 -8
  37. package/dist/{orgs-D6Kk96mG.js → orgs-CYXjVdxM.js} +1 -1
  38. package/dist/{paths-REb-GrbX.js → paths-Bf3othB-.js} +1 -1
  39. package/dist/{playbook-Du4Oydbf.js → playbook-K7vmAUsu.js} +10 -10
  40. package/dist/{project-CP6hiHra.js → project-NoMtbMyl.js} +9 -9
  41. package/dist/{promote-Dm2_b1WK.js → promote-DXxxj4BU.js} +23 -22
  42. package/dist/pull-Bfa3_SBt.js +106 -0
  43. package/dist/pull-DGrlBSAG.js +36 -0
  44. package/dist/{pull-F6pvO4To.js → pull-DuFUkP7t.js} +8 -8
  45. package/dist/{push-D_l9KJZN.js → push-CrowxhpU.js} +54 -48
  46. package/dist/push-DPZdch2W.js +30 -0
  47. package/dist/push-DV-kJZdw.js +22 -0
  48. package/dist/{push-BIFLhAiO.js → push-Dk5x2xP3.js} +122 -22
  49. package/dist/{registry-DIJB0mJa.js → registry-HhZVRBqY.js} +178 -155
  50. package/dist/resolve-D3RBtfkI.js +242 -0
  51. package/dist/{resources-BaP3p_LY.js → resources-CkG6SCia.js} +2 -2
  52. package/dist/{run-C5OPwhvS.js → run-CL5ZnujW.js} +2 -2
  53. package/dist/{run-CgLmD2vR.js → run-Co8u_BkN.js} +93 -70
  54. package/dist/scan-BQmjhs3g.js +4 -0
  55. package/dist/{scan-Bj5y0zTZ.js → scan-DhmGH1rF.js} +1 -1
  56. package/dist/{scope-Bp_zwJOo.js → scope-D0XpYMn4.js} +5 -5
  57. package/dist/{scope-CCb_7UvN.js → scope-ehZ7L1nj.js} +25 -11
  58. package/dist/{sdk-TvT0p_nO.js → sdk-DEfQttek.js} +7 -7
  59. package/dist/{series-TAixFBWW.js → series-D2ZpZ8cx.js} +96 -63
  60. package/dist/server-4ZK_1Off.js +29 -0
  61. package/dist/{server-CdVIboQn.js → server-DamMN_ig.js} +9 -9
  62. package/dist/session-4F_YWSul.js +6 -0
  63. package/dist/{session-Ywim-P8M.js → session-G1uwJI8L.js} +1 -1
  64. package/dist/{setup-zzjtTy8k.js → setup-BFTSxEWU.js} +9 -9
  65. package/dist/skills/index.json +2 -2
  66. package/dist/skills/superwall/workflows/integrate/flutter.md +9 -7
  67. package/dist/skills/{superwall-workspaces → superwall-artifacts}/SKILL.md +47 -32
  68. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/cli.md +35 -29
  69. package/dist/skills/{superwall-workspaces → superwall-artifacts}/references/slots.md +9 -9
  70. package/dist/{skills-2qYaUXGE.js → skills-CE4c9eHX.js} +4 -4
  71. package/dist/{skills-8um2fBPS.js → skills-ClEVgXUB.js} +8 -8
  72. package/dist/{git-D7AVdugb.js → source-BccdO4aL.js} +111 -102
  73. package/dist/{source-push-kAep4gPe.js → source-push-EyF02ekO.js} +43 -26
  74. package/dist/{spinner-BANVLncC.js → spinner-mWZnJCkN.js} +3 -3
  75. package/dist/{starter-CiLrp1cN.js → starter-BtUUQWhd.js} +38 -28
  76. package/dist/{status-CoYMK7QL.js → status-SAZxltzW.js} +42 -39
  77. package/dist/{storage-DzP22xKn.js → storage-R5-qDvHq.js} +1 -1
  78. package/dist/{storekit-n1x0bWkQ.js → storekit-CQHVFTOC.js} +3 -3
  79. package/dist/storekit-DK3xXKoY.js +17 -0
  80. package/dist/{telemetry-CXN6f-ZX.js → telemetry-B-uKuu49.js} +1 -1
  81. package/dist/{token-FmeHywYt.js → token-C2kzntVM.js} +1 -1
  82. package/dist/tools.d.ts +6 -1
  83. package/dist/tools.js +208 -130
  84. package/dist/{try-BWbzgelb.js → try-BrJJyXgq.js} +32 -32
  85. package/dist/{upgrade-CoWCEnoi.js → upgrade-g_Bd9oJe.js} +2 -2
  86. package/dist/{upgrade-Bk5boOgW.js → upgrade-zOXTIaAZ.js} +2 -2
  87. package/package.json +2 -2
  88. package/dist/create-CJljlkJK.js +0 -20
  89. package/dist/held-CX7Zf8u-.js +0 -17
  90. package/dist/install-CVUXsx8c.js +0 -103
  91. package/dist/login-ClnJi1Ea.js +0 -17
  92. package/dist/pull-DsdOoG-D.js +0 -36
  93. package/dist/pull-zYAbqo9n.js +0 -106
  94. package/dist/push-CJVfvFZq.js +0 -29
  95. package/dist/push-SVzv7fzE.js +0 -22
  96. package/dist/resolve--GsHj0Q1.js +0 -171
  97. package/dist/scan-v_WTE722.js +0 -4
  98. package/dist/server-CvJVusw3.js +0 -29
  99. package/dist/session-B8JNXkwN.js +0 -6
  100. package/dist/storekit-D5eopLM0.js +0 -17
  101. /package/dist/{download-2Zu2I_Og.js → download-DhGd4hOB.js} +0 -0
  102. /package/dist/{reports-CuhB1_ub.js → reports-HYVp169R.js} +0 -0
  103. /package/dist/{storage-BjQCiTuz.d.ts → storage-Bdz5AmqS.d.ts} +0 -0
@@ -1,171 +0,0 @@
1
- import { u as DASHBOARD_ORIGIN_OVERRIDE } from "./environment-BWT2S4qC.js";
2
- import { a as orgProjects, n as listOrganizations } from "./orgs-D6Kk96mG.js";
3
- import { i as WORKSPACE_FILE } from "./scope-CCb_7UvN.js";
4
- import { r as WorkspaceError } from "./project-CP6hiHra.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 appEntrypointUrl = (apiHost, workspace, applicationId, entrypoint) => `${dashboardOrigin(apiHost)}/${workspace.organization_id}/${applicationId}/apps/${workspace.id}/${encodeURIComponent(entrypoint)}`;
108
- async function openLink(ctx, workspace, manifest) {
109
- const fallback = { url: workspaceUrl(ctx.api.host, workspace) };
110
- const entrypoints = manifest?.entrypoints ?? [];
111
- const appPage = entrypoints.find((entrypoint) => entrypoint.slot === "app.page@1");
112
- if (!appPage || entrypoints.some((entrypoint) => entrypoint.slot === "org.page@1")) return fallback;
113
- const apps = (await orgProjects(ctx.api, String(workspace.organization_id)).catch(() => [])).flatMap((project) => project.applications ?? []);
114
- const [first] = apps;
115
- if (first === void 0) return fallback;
116
- return {
117
- url: appEntrypointUrl(ctx.api.host, workspace, String(first.id), appPage.id),
118
- entrypoint: appPage.id,
119
- app: String(first.name ?? first.id),
120
- otherApps: apps.length > 1
121
- };
122
- }
123
- const latestManifest = (versions) => newestFirst(versions).find((version) => version.manifest !== null)?.manifest;
124
- async function visibilityOf(ctx, workspaceId, version) {
125
- const [workspace, me] = await Promise.all([getWorkspace(ctx.api, workspaceId).catch(() => void 0), getMe(ctx.api).catch(() => void 0)]);
126
- if (workspace?.state === "turned_off") return {
127
- visibleTo: "nobody",
128
- sentence: `This workspace is turned off, so nobody can see version ${version}.`
129
- };
130
- if (workspace?.active_version_id === version) return {
131
- visibleTo: "everyone",
132
- sentence: `Version ${version} is live.`
133
- };
134
- if (workspace?.author_version_id === version) return {
135
- visibleTo: "you",
136
- sentence: `Only you can see version ${version} until an admin approves it.`
137
- };
138
- if (me?.role === "SUPERADMIN") return {
139
- visibleTo: "nobody",
140
- sentence: `Nobody can see version ${version} until an admin approves it, because a staff account doesn't get a copy of its own.`
141
- };
142
- return {
143
- visibleTo: "its_author",
144
- sentence: `Only its author can see version ${version} until an admin approves it.`
145
- };
146
- }
147
- async function roleCanApprove(ctx, workspace) {
148
- const role = (await listOrganizations(ctx.api).catch(() => [])).find((organization) => String(organization.id) === String(workspace.organization_id))?.role;
149
- return typeof role !== "string" || role === "OWNER" || role === "ADMIN";
150
- }
151
- const newestFirst = (versions) => [...versions].sort((a, b) => b.id - a.id);
152
- async function pickVersion(ctx, workspace, requested, matches = () => true) {
153
- const versions = newestFirst(await listVersions(ctx.api, workspace.id));
154
- if (requested !== void 0) {
155
- const version$1 = versions.find((candidate) => String(candidate.id) === requested);
156
- if (!version$1) throw new WorkspaceError(`No version ${requested} of \`${workspace.slug}\`.`);
157
- return {
158
- version: version$1,
159
- versions
160
- };
161
- }
162
- const version = versions.find(matches);
163
- if (!version) throw new WorkspaceError(`\`${workspace.slug}\` has no version for this yet. Run \`superwall workspaces push\`.`);
164
- return {
165
- version,
166
- versions
167
- };
168
- }
169
-
170
- //#endregion
171
- export { mintSourceAccess as C, startBuild as E, listWorkspaces as S, setInstallation as T, getBuild as _, openLink as a, listMembers as b, resolveWorkspace as c, readBinding as d, readSourceFile as f, deleteInstallation as g, createWorkspace as h, newestFirst as i, roleCanApprove as l, approveVersion as m, dashboardOrigin as n, pickVersion as o, writeBinding as p, latestManifest as r, projectRoot as s, appEntrypointUrl as t, visibilityOf as u, getMe as v, requestDeploy as w, listVersions as x, listInstallations as y };
@@ -1,4 +0,0 @@
1
- import "./environment-BWT2S4qC.js";
2
- import { t as scanProject } from "./scan-Bj5y0zTZ.js";
3
-
4
- export { scanProject };
@@ -1,29 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./telemetry-CXN6f-ZX.js";
8
- import "./spawn-DmmmHIP-.js";
9
- import "./spinner-BANVLncC.js";
10
- import "./ui-D_qf3Gvw.js";
11
- import "./scan-Bj5y0zTZ.js";
12
- import "./paths-REb-GrbX.js";
13
- import "./orgs-D6Kk96mG.js";
14
- import "./resources-BaP3p_LY.js";
15
- import "./lookup-gjcKIZvh.js";
16
- import "./login-PMoXUGqq.js";
17
- import "./skills-2qYaUXGE.js";
18
- import "./browser-Bp3yRKlU.js";
19
- import "./assets-BrB9jQPQ.js";
20
- import "./selection-BltBpyp5.js";
21
- import "./types-JdxmnCko.js";
22
- import "./session-D3fgXQBt.js";
23
- import "./source-push-kAep4gPe.js";
24
- import "./git-D7AVdugb.js";
25
- import "./scope-CCb_7UvN.js";
26
- import "./login-COmGHrU5.js";
27
- import { t as runStudio } from "./server-CdVIboQn.js";
28
-
29
- export { runStudio };
@@ -1,6 +0,0 @@
1
- import "./output-Ggzq5_-t.js";
2
- import "./environment-BWT2S4qC.js";
3
- import "./storage-DzP22xKn.js";
4
- import { n as runWhoami, t as runLogout } from "./session-Ywim-P8M.js";
5
-
6
- export { runLogout, runWhoami };
@@ -1,17 +0,0 @@
1
- import "./token-FmeHywYt.js";
2
- import "./output-Ggzq5_-t.js";
3
- import "./environment-BWT2S4qC.js";
4
- import "./storage-DzP22xKn.js";
5
- import "./client-AI9H4GGB.js";
6
- import "./config-CGcG7GOt.js";
7
- import "./spinner-BANVLncC.js";
8
- import "./ui-D_qf3Gvw.js";
9
- import "./orgs-D6Kk96mG.js";
10
- import "./resources-BaP3p_LY.js";
11
- import "./org-C04eAO-j.js";
12
- import "./lookup-gjcKIZvh.js";
13
- import "./scope-Bp_zwJOo.js";
14
- import "./input-MDd67UIp.js";
15
- import { n as writeStoreKit, t as generateStoreKit } from "./storekit-n1x0bWkQ.js";
16
-
17
- export { generateStoreKit, writeStoreKit };