@superwall/cli 2.4.0 → 2.5.0

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 (109) hide show
  1. package/dist/{apple-Bx_fm5M-.js → apple-Dyr7OFBx.js} +16 -15
  2. package/dist/approve-Czs1-JO9.js +186 -0
  3. package/dist/{assets-W5yvyf0V.js → assets-BrB9jQPQ.js} +3 -3
  4. package/dist/auth.d.ts +1 -1
  5. package/dist/auth.js +3 -3
  6. package/dist/{billing-C4lXR0xG.js → billing-D5qqIlVb.js} +3 -3
  7. package/dist/{bind-82oTpHZ3.js → bind-B3eEcRyp.js} +4 -4
  8. package/dist/browser-Bp3yRKlU.js +36 -0
  9. package/dist/{build-7_8cBgBm.js → build-DD9pSwHX.js} +9 -7
  10. package/dist/{client-ltxxHuxn.js → client-AI9H4GGB.js} +3 -3
  11. package/dist/{create-Dk8U_B49.js → create-B4m-IKlr.js} +8 -8
  12. package/dist/create-CJljlkJK.js +20 -0
  13. package/dist/{create-DEyveHS6.js → create-ChfgWpiM.js} +39 -67
  14. package/dist/{doctor-Df2GwS4K.js → doctor-XtXW6tKE.js} +6 -6
  15. package/dist/download-2Zu2I_Og.js +58 -0
  16. package/dist/{drivers-CTyYdBL7.js → drivers-CMEL13gp.js} +3 -3
  17. package/dist/entry.js +25 -24
  18. package/dist/{environment-djS0ik60.js → environment-BWT2S4qC.js} +3 -2
  19. package/dist/{existing-Das3PHGG.js → existing-b0GxFcnc.js} +2 -2
  20. package/dist/{session-CV0P8BjK.js → git-D7AVdugb.js} +96 -334
  21. package/dist/held-CX7Zf8u-.js +17 -0
  22. package/dist/{held-B8EFWDEc.js → held-D3PUNky2.js} +7 -7
  23. package/dist/install-CVUXsx8c.js +103 -0
  24. package/dist/{integrate-Cz48dm_h.js → integrate-qvKd9pVW.js} +27 -25
  25. package/dist/{login-girc324T.js → login-COmGHrU5.js} +2 -1
  26. package/dist/login-ClnJi1Ea.js +17 -0
  27. package/dist/{login-CiK5T4w8.js → login-PMoXUGqq.js} +8 -41
  28. package/dist/{lookup-us5vu5od.js → lookup-gjcKIZvh.js} +3 -2
  29. package/dist/{migrate-DaVwhdov.js → migrate-SkkLLdmr.js} +30 -25
  30. package/dist/{migration-cS6UGeUj.js → migration-DS44-3Zr.js} +9 -9
  31. package/dist/{notification-url-Hg42tAbW.js → notification-url-BjQPLf4-.js} +4 -4
  32. package/dist/{open-BIuOZ9ka.js → open-DQpm2yVs.js} +2 -2
  33. package/dist/{org-BrR4HGvl.js → org-C04eAO-j.js} +3 -2
  34. package/dist/organization-BOECL3vZ.js +39 -0
  35. package/dist/orgs-D6Kk96mG.js +81 -0
  36. package/dist/{paths-CdwjySxK.js → paths-REb-GrbX.js} +1 -1
  37. package/dist/{playbook-BJ3opYIS.js → playbook-Du4Oydbf.js} +10 -10
  38. package/dist/{products-DH_fK9tY.js → products-Cqq59DBQ.js} +1 -1
  39. package/dist/project-CP6hiHra.js +47 -0
  40. package/dist/{promote-BQO-1ScY.js → promote-Dm2_b1WK.js} +23 -18
  41. package/dist/pull-DsdOoG-D.js +36 -0
  42. package/dist/{pull-BhRswq6x.js → pull-F6pvO4To.js} +9 -28
  43. package/dist/pull-zYAbqo9n.js +106 -0
  44. package/dist/{push-CR110qRh.js → push-BIFLhAiO.js} +8 -6
  45. package/dist/push-CJVfvFZq.js +29 -0
  46. package/dist/push-D_l9KJZN.js +290 -0
  47. package/dist/push-SVzv7fzE.js +22 -0
  48. package/dist/{registry-DZsWoWqH.js → registry-DIJB0mJa.js} +687 -64
  49. package/dist/resolve--GsHj0Q1.js +171 -0
  50. package/dist/{resources-BMspgZO1.js → resources-BaP3p_LY.js} +3 -80
  51. package/dist/{run-D4V6mq8_.js → run-C5OPwhvS.js} +2 -2
  52. package/dist/run-CgLmD2vR.js +1345 -0
  53. package/dist/{scan-CRexsHOE.js → scan-Bj5y0zTZ.js} +1 -1
  54. package/dist/scan-v_WTE722.js +4 -0
  55. package/dist/{scope-Ct0_HoNq.js → scope-Bp_zwJOo.js} +5 -4
  56. package/dist/scope-CCb_7UvN.js +89 -0
  57. package/dist/sdk-TvT0p_nO.js +71 -0
  58. package/dist/selection-BltBpyp5.js +179 -0
  59. package/dist/series-TAixFBWW.js +685 -0
  60. package/dist/{server-Dv1VwbNh.js → server-CdVIboQn.js} +10 -8
  61. package/dist/server-CvJVusw3.js +29 -0
  62. package/dist/session-B8JNXkwN.js +6 -0
  63. package/dist/session-D3fgXQBt.js +219 -0
  64. package/dist/{session-UiPlLFn6.js → session-Ywim-P8M.js} +1 -1
  65. package/dist/{setup-UWLhQG3M.js → setup-zzjtTy8k.js} +9 -8
  66. package/dist/skills/index.json +5 -0
  67. package/dist/skills/superwall/SKILL.md +48 -30
  68. package/dist/skills/superwall/references/api.md +3 -2
  69. package/dist/skills/superwall-editor/SKILL.md +7 -5
  70. package/dist/skills/superwall-framework/SKILL.md +7 -5
  71. package/dist/skills/superwall-workspaces/SKILL.md +313 -0
  72. package/dist/skills/superwall-workspaces/references/cli.md +174 -0
  73. package/dist/skills/superwall-workspaces/references/slots.md +103 -0
  74. package/dist/{skills-CiWxt6vS.js → skills-2qYaUXGE.js} +4 -4
  75. package/dist/{skills-DzOvse9L.js → skills-8um2fBPS.js} +8 -8
  76. package/dist/{source-push-CX_k_yZD.js → source-push-kAep4gPe.js} +6 -5
  77. package/dist/{spinner-1uuKKZMc.js → spinner-BANVLncC.js} +16 -4
  78. package/dist/starter-CiLrp1cN.js +190 -0
  79. package/dist/status-CoYMK7QL.js +139 -0
  80. package/dist/{storage-CrXGgIbS.js → storage-DzP22xKn.js} +1 -1
  81. package/dist/storekit-D5eopLM0.js +17 -0
  82. package/dist/{storekit-CptdG4RJ.js → storekit-n1x0bWkQ.js} +4 -4
  83. package/dist/{telemetry-BqaPbM0k.js → telemetry-CXN6f-ZX.js} +1 -1
  84. package/dist/{token-zjjlkNDF.js → token-FmeHywYt.js} +1 -1
  85. package/dist/tools-skills/superwall/SKILL.md +49 -31
  86. package/dist/tools-skills/superwall/references/api.md +3 -2
  87. package/dist/tools-skills/superwall-editor/SKILL.md +7 -5
  88. package/dist/tools.d.ts +1 -1
  89. package/dist/tools.js +452 -27
  90. package/dist/try-BWbzgelb.js +120 -0
  91. package/dist/{selection-CgZJJ3FD.js → types-JdxmnCko.js} +1 -178
  92. package/dist/{upgrade-BBnmcyY2.js → upgrade-Bk5boOgW.js} +2 -2
  93. package/dist/{upgrade-AdyF7wXk.js → upgrade-CoWCEnoi.js} +2 -2
  94. package/package.json +5 -3
  95. package/dist/create-CBCDWuyo.js +0 -19
  96. package/dist/held-BL4oizD6.js +0 -16
  97. package/dist/login-DdrOmi6m.js +0 -16
  98. package/dist/push-B3Onn_mL.js +0 -24
  99. package/dist/scan-DUQjxOZf.js +0 -4
  100. package/dist/server-Cv-Ug9JF.js +0 -24
  101. package/dist/session-BCQuMcQ0.js +0 -6
  102. package/dist/storekit-B675ZNiA.js +0 -16
  103. /package/dist/{client-BZ1UbpXz.js → client-BJQXl62Q.js} +0 -0
  104. /package/dist/{devtools-pBl_vt03.js → devtools-ByZ6XYnn.js} +0 -0
  105. /package/dist/{input-vi0bou04.js → input-MDd67UIp.js} +0 -0
  106. /package/dist/{reports-CwwKLUh0.js → reports-CuhB1_ub.js} +0 -0
  107. /package/dist/{screenshot-file-tVBfUEIi.js → screenshot-file-XAS0Xy0e.js} +0 -0
  108. /package/dist/{storage-gRyQetN9.d.ts → storage-BjQCiTuz.d.ts} +0 -0
  109. /package/dist/{timing-BVxPrYq3.js → timing-Ca0TXY-A.js} +0 -0
@@ -1,21 +1,22 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import { t as blocks } from "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import { t as ApiError } from "./client-ltxxHuxn.js";
6
- import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-B8EFWDEc.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import { t as ApiError } from "./client-AI9H4GGB.js";
6
+ import { E as updateBundleId, a as chooseAppIntent, g as RefusedByApi, i as savedKey, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, s as resolveApp, y as findIntegrations } from "./held-D3PUNky2.js";
7
7
  import "./config-CGcG7GOt.js";
8
- import { t as apiCall } from "./spinner-1uuKKZMc.js";
8
+ import { t as apiCall } from "./spinner-BANVLncC.js";
9
9
  import "./ui-D_qf3Gvw.js";
10
- import "./paths-CdwjySxK.js";
11
- import "./resources-BMspgZO1.js";
12
- import "./org-BrR4HGvl.js";
13
- import "./lookup-us5vu5od.js";
14
- import "./scope-Ct0_HoNq.js";
15
- import "./client-BZ1UbpXz.js";
16
- import "./timing-BVxPrYq3.js";
17
- import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-Hg42tAbW.js";
18
- import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-Dk8U_B49.js";
10
+ import "./paths-REb-GrbX.js";
11
+ import "./orgs-D6Kk96mG.js";
12
+ import "./resources-BaP3p_LY.js";
13
+ import "./org-C04eAO-j.js";
14
+ import "./lookup-gjcKIZvh.js";
15
+ import "./scope-Bp_zwJOo.js";
16
+ import "./client-BJQXl62Q.js";
17
+ import "./timing-Ca0TXY-A.js";
18
+ import { n as ensureNotificationUrl, r as environmentLines, t as describeNotificationUrl } from "./notification-url-BjQPLf4-.js";
19
+ import { a as chooseTeam, n as keyAccess, o as signIn, r as keyRole, s as appleDeps, t as createAndSaveKey } from "./create-B4m-IKlr.js";
19
20
 
20
21
  //#region src/core/app-store-connect/setup/apple.ts
21
22
  const STEPS = [
@@ -0,0 +1,186 @@
1
+ import "./token-FmeHywYt.js";
2
+ import "./output-Ggzq5_-t.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import { t as ApiError } from "./client-AI9H4GGB.js";
6
+ import "./config-CGcG7GOt.js";
7
+ import "./orgs-D6Kk96mG.js";
8
+ import "./types-JdxmnCko.js";
9
+ import "./scope-CCb_7UvN.js";
10
+ import { c as resolveWorkspace, l as roleCanApprove, m as approveVersion, o as pickVersion } from "./resolve--GsHj0Q1.js";
11
+ import { r as WorkspaceError } from "./project-CP6hiHra.js";
12
+
13
+ //#region src/core/workspaces/approve.ts
14
+ const SECTIONS = [
15
+ ["scopes", "Scopes"],
16
+ ["backgroundScopes", "Background scopes"],
17
+ ["egress", "Outside hosts"],
18
+ ["secrets", "Secrets"],
19
+ ["entrypoints", "Entrypoints"],
20
+ ["crons", "Crons"],
21
+ ["events", "Events"],
22
+ ["storage", "Storage"],
23
+ ["compatibility", "Compatibility"]
24
+ ];
25
+ const quoted = (text) => JSON.stringify(text);
26
+ const secretLabel = (secret) => `${secret.name} to ${secret.host} (${quoted(secret.inject)})`;
27
+ const metricLabel = (metric) => {
28
+ const breakdowns = (metric.breakdowns ?? []).map((breakdown) => breakdown.key);
29
+ const filters = (metric.filters ?? []).map((filter) => `${filter.key} (${filter.values.map((option) => quoted(option.value)).join(", ")})`);
30
+ return [
31
+ metric.value_type ?? "number",
32
+ breakdowns.length > 0 ? `split by ${breakdowns.join(", ")}` : void 0,
33
+ filters.length > 0 ? `filtered by ${filters.join(", ")}` : void 0
34
+ ].filter(Boolean).join(", ");
35
+ };
36
+ const entrypointLabel = (entrypoint) => [
37
+ `${entrypoint.id}: ${entrypoint.slot}`,
38
+ entrypoint.path ? `at ${entrypoint.path}` : void 0,
39
+ quoted(entrypoint.title),
40
+ entrypoint.metric ? `metric: ${metricLabel(entrypoint.metric)}` : void 0
41
+ ].filter(Boolean).join(" ");
42
+ const emptySide = {
43
+ scopes: [],
44
+ backgroundScopes: [],
45
+ egress: [],
46
+ secrets: [],
47
+ entrypoints: [],
48
+ crons: [],
49
+ events: [],
50
+ storage: [],
51
+ compatibility: []
52
+ };
53
+ function sideOf(version, enforced) {
54
+ const manifest = version?.manifest;
55
+ if (!version || !manifest) return emptySide;
56
+ if (enforced && version.grant === null) return emptySide;
57
+ const grant = enforced ? version.grant : null;
58
+ const storage = manifest.storage ?? {};
59
+ return {
60
+ scopes: grant?.scopes ?? manifest.scopes,
61
+ backgroundScopes: grant?.background_scopes ?? manifest.background?.scopes ?? [],
62
+ egress: grant?.egress ?? manifest.egress ?? [],
63
+ secrets: (grant?.secret_bindings ?? manifest.secrets ?? []).map(secretLabel),
64
+ entrypoints: manifest.entrypoints.map(entrypointLabel),
65
+ crons: (manifest.crons ?? []).map((cron) => `${cron.name}: ${cron.schedule}`),
66
+ events: manifest.events ?? [],
67
+ storage: [storage.sql ? "sql" : void 0, storage.kv ? "kv" : void 0].filter((kind) => kind !== void 0),
68
+ compatibility: [...version.compatibility_date ? [`date ${version.compatibility_date}`] : [], ...(version.compatibility_flags ?? []).map((flag) => `flag ${flag}`)]
69
+ };
70
+ }
71
+ function diffSides(before, after) {
72
+ return SECTIONS.flatMap(([section, title]) => {
73
+ const [old, next] = [new Set(before[section]), new Set(after[section])];
74
+ const added = [...next].filter((item) => !old.has(item)).sort();
75
+ const removed = [...old].filter((item) => !next.has(item)).sort();
76
+ return added.length + removed.length > 0 ? [{
77
+ section,
78
+ title,
79
+ added,
80
+ removed
81
+ }] : [];
82
+ });
83
+ }
84
+ const manifestLines = (side) => SECTIONS.flatMap(([section, title]) => {
85
+ const items = side[section];
86
+ if (items.length === 0) return section === "scopes" || section === "egress" ? [`${title}: none`] : [];
87
+ return [`${title}:`, ...[...items].sort().map((item) => ` ${item}`)];
88
+ });
89
+ const diffLines = (diff) => diff.flatMap(({ title, added, removed }) => [
90
+ `${title}:`,
91
+ ...added.map((item) => ` + ${item}`),
92
+ ...removed.map((item) => ` - ${item}`)
93
+ ]);
94
+ const ONLY_ADMINS = "Only organization owners and admins can approve workspace versions. Ask one of them to review this version.";
95
+ async function runWorkspaceApprove(ctx, input) {
96
+ const workspace = await resolveWorkspace(ctx, input);
97
+ const { version, versions } = await pickVersion(ctx, workspace, input.version, (candidate) => candidate.build_status === "SUCCEEDED" && candidate.id !== workspace.active_version_id);
98
+ if (version.build_status !== "SUCCEEDED" || version.manifest === null) throw new WorkspaceError(`Version ${version.id} is ${version.build_status.toLowerCase()}. Only a built version can be approved.`);
99
+ if (version.id === workspace.active_version_id && version.grant !== null) {
100
+ if (ctx.json) ctx.output.data({
101
+ approved: false,
102
+ reason: "already_active",
103
+ version_id: version.id
104
+ });
105
+ else ctx.ui.info(`Version ${version.id} is already live.`);
106
+ return;
107
+ }
108
+ const active = versions.find((candidate) => candidate.id === workspace.active_version_id);
109
+ const proposed = sideOf(version, false);
110
+ const diff = diffSides(sideOf(active, true), proposed);
111
+ const details = {
112
+ workspace_id: workspace.id,
113
+ version_id: version.id,
114
+ commit_sha: version.commit_sha,
115
+ active_version_id: active?.id ?? null,
116
+ manifest: version.manifest,
117
+ compatibility_date: version.compatibility_date ?? null,
118
+ compatibility_flags: version.compatibility_flags ?? [],
119
+ diff
120
+ };
121
+ if (!ctx.json) ctx.ui.report([
122
+ `${workspace.name}, version ${version.id} (${version.commit_sha.slice(0, 12)})`,
123
+ ...version.commit_message ? [version.commit_message.split("\n")[0] ?? ""] : [],
124
+ "",
125
+ "What it can do:",
126
+ ...manifestLines(proposed),
127
+ "",
128
+ active ? `Changes from the live version, ${active.id}:` : "Nothing is live yet, so all of this is new:",
129
+ ...diff.length === 0 ? [" Nothing it can do changes."] : diffLines(diff)
130
+ ].join("\n"));
131
+ const refuse = (reason, message) => {
132
+ if (ctx.json) ctx.output.data({
133
+ approved: false,
134
+ reason,
135
+ ...details
136
+ });
137
+ else ctx.ui.error(message);
138
+ ctx.fail();
139
+ };
140
+ if (!await roleCanApprove(ctx, workspace)) {
141
+ refuse("needs_admin", ONLY_ADMINS);
142
+ if (!ctx.json) ctx.ui.info("To ask for review, run `superwall workspaces share`.");
143
+ return;
144
+ }
145
+ const changes = diff.length > 0;
146
+ const accepted = !changes || input.acceptChanges;
147
+ if (ctx.interactive && !(input.yes && accepted)) {
148
+ if (!await ctx.ui.confirm({
149
+ message: changes ? `Approve version ${version.id}, with the changes above to what it can do?` : `Approve version ${version.id}?`,
150
+ initial: false
151
+ })) {
152
+ ctx.ui.outro("Nothing was approved.");
153
+ return;
154
+ }
155
+ } else if (!ctx.interactive) {
156
+ if (!input.yes) {
157
+ refuse("needs_yes", "Nothing was approved. Read the above, then pass --yes to approve it.");
158
+ return;
159
+ }
160
+ if (!accepted) {
161
+ refuse("needs_accept_changes", "Nothing was approved, because this changes what the workspace can do. Read the changes above, then pass --accept-changes too.");
162
+ return;
163
+ }
164
+ }
165
+ let approved;
166
+ try {
167
+ approved = await approveVersion(ctx.api, workspace.id, version.id);
168
+ } catch (error) {
169
+ if (!(error instanceof ApiError) || error.status !== 403) throw error;
170
+ refuse("forbidden", error.message);
171
+ return;
172
+ }
173
+ if (ctx.json) {
174
+ ctx.output.data({
175
+ approved: true,
176
+ ...details,
177
+ version: approved
178
+ });
179
+ return;
180
+ }
181
+ ctx.ui.success(`Approved version ${version.id}. It's live for everyone it's installed for.`);
182
+ ctx.ui.info(`Choose where it shows with \`superwall workspaces install <entrypoint> --workspace ${workspace.id}\`.`);
183
+ }
184
+
185
+ //#endregion
186
+ export { diffSides, runWorkspaceApprove, sideOf };
@@ -1,6 +1,6 @@
1
- import { r as ASSET_HOST } from "./environment-djS0ik60.js";
2
- import { t as ApiError } from "./client-ltxxHuxn.js";
3
- import { S as pushPaywallAssets } from "./resources-BMspgZO1.js";
1
+ import { r as ASSET_HOST } from "./environment-BWT2S4qC.js";
2
+ import { t as ApiError } from "./client-AI9H4GGB.js";
3
+ import { S as pushPaywallAssets } from "./resources-BaP3p_LY.js";
4
4
  import * as fs from "node:fs";
5
5
 
6
6
  //#region src/core/paywalls/assets.ts
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Session } from "./storage-gRyQetN9.js";
1
+ import { t as Session } from "./storage-BjQCiTuz.js";
2
2
 
3
3
  //#region src/core/account/errors.d.ts
4
4
  declare class NotLoggedInError extends Error {
package/dist/auth.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-zjjlkNDF.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError, t as getOAuthAccessToken } from "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
5
 
6
6
  export { NotLoggedInError, getOAuthAccessToken, resolveAuthToken };
@@ -1,6 +1,6 @@
1
- import { m as Integration } from "./environment-djS0ik60.js";
2
- import { i as readPackageJson, r as allDeps } from "./scan-CRexsHOE.js";
3
- import { d as readBundledSkill } from "./skills-CiWxt6vS.js";
1
+ import { h as Integration } from "./environment-BWT2S4qC.js";
2
+ import { i as readPackageJson, r as allDeps } from "./scan-Bj5y0zTZ.js";
3
+ import { d as readBundledSkill } from "./skills-2qYaUXGE.js";
4
4
  import { readFileSync } from "node:fs";
5
5
  import fg from "fast-glob";
6
6
 
@@ -1,8 +1,8 @@
1
- import { m as Integration } from "./environment-djS0ik60.js";
2
- import { n as withSpinner } from "./spinner-1uuKKZMc.js";
1
+ import { h as Integration } from "./environment-BWT2S4qC.js";
2
+ import { n as withSpinner } from "./spinner-BANVLncC.js";
3
3
  import { n as ui } from "./ui-D_qf3Gvw.js";
4
- import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BMspgZO1.js";
5
- import { n as orgForNewProject } from "./org-BrR4HGvl.js";
4
+ import { c as createProject, m as listProjects, r as createApplication, y as platformLabel } from "./resources-BaP3p_LY.js";
5
+ import { n as orgForNewProject } from "./org-C04eAO-j.js";
6
6
 
7
7
  //#region src/core/account/bind.ts
8
8
  const NEW = "__new__";
@@ -0,0 +1,36 @@
1
+ import { spawn } from "node:child_process";
2
+
3
+ //#region src/core/account/browser.ts
4
+ const BROWSER_UNAVAILABLE = "Couldn't open a browser here. Open the URL above to approve the login.";
5
+ function hasDisplay(env, platform) {
6
+ if (platform !== "linux") return true;
7
+ return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY || env.WSL_DISTRO_NAME);
8
+ }
9
+ function openBrowser(url, deps = {}) {
10
+ const platform = deps.platform ?? process.platform;
11
+ const env = deps.env ?? process.env;
12
+ if (env.BROWSER === "none" || !hasDisplay(env, platform)) return Promise.resolve(false);
13
+ const cmd = platform === "darwin" ? "open" : platform === "win32" ? "cmd" : "xdg-open";
14
+ const args = platform === "win32" ? [
15
+ "/c",
16
+ "start",
17
+ "",
18
+ url.replaceAll("&", "^&")
19
+ ] : [url];
20
+ return new Promise((resolve) => {
21
+ try {
22
+ const child = (deps.spawn ?? spawn)(cmd, args, {
23
+ stdio: "ignore",
24
+ detached: true
25
+ });
26
+ child.once("error", () => resolve(false));
27
+ child.once("spawn", () => resolve(true));
28
+ child.unref();
29
+ } catch {
30
+ resolve(false);
31
+ }
32
+ });
33
+ }
34
+
35
+ //#endregion
36
+ export { openBrowser as n, BROWSER_UNAVAILABLE as t };
@@ -1,13 +1,15 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { b as VERSION } from "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import "./client-ltxxHuxn.js";
3
+ import { x as VERSION } from "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import "./client-AI9H4GGB.js";
6
6
  import "./config-CGcG7GOt.js";
7
7
  import { n as ui } from "./ui-D_qf3Gvw.js";
8
- import "./resources-BMspgZO1.js";
9
- import { t as assetBaseUrl } from "./assets-W5yvyf0V.js";
10
- import { a as resolveProjectDir, b as writeProjectTypes, d as kb, h as took, i as requireProject, k as readLock, n as parseIds, s as selectSurfaces, y as collectProjectDeclarations, z as resolveFramework } from "./selection-CgZJJ3FD.js";
8
+ import "./orgs-D6Kk96mG.js";
9
+ import "./resources-BaP3p_LY.js";
10
+ import { t as assetBaseUrl } from "./assets-BrB9jQPQ.js";
11
+ import { a as resolveProjectDir, d as kb, h as took, i as requireProject, n as parseIds, s as selectSurfaces, y as resolveFramework } from "./selection-BltBpyp5.js";
12
+ import { f as readLock, n as collectProjectDeclarations, r as writeProjectTypes } from "./types-JdxmnCko.js";
11
13
  import * as fs from "node:fs";
12
14
  import * as path from "node:path";
13
15
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
- import { n as resolveAuthToken, r as NotLoggedInError } from "./token-zjjlkNDF.js";
2
- import { y as USER_AGENT } from "./environment-djS0ik60.js";
3
- import { a as resolveApiHost, n as readSession } from "./storage-CrXGgIbS.js";
1
+ import { n as resolveAuthToken, r as NotLoggedInError } from "./token-FmeHywYt.js";
2
+ import { b as USER_AGENT } from "./environment-BWT2S4qC.js";
3
+ import { a as resolveApiHost, n as readSession } from "./storage-DzP22xKn.js";
4
4
 
5
5
  //#region src/core/api/client.ts
6
6
  const BODY_SNIPPET = 200;
@@ -1,12 +1,12 @@
1
1
  import { r as formatJson, t as blocks } from "./output-Ggzq5_-t.js";
2
- import { S as appleCredentialsFromEnv, b as VERSION, f as ENV_APPLE_ID, p as ENV_APPLE_PASSWORD } from "./environment-djS0ik60.js";
3
- import { t as ApiError } from "./client-ltxxHuxn.js";
4
- import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-B8EFWDEc.js";
5
- import { t as apiCall } from "./spinner-1uuKKZMc.js";
6
- import { n as SUPERWALL_HOME } from "./paths-CdwjySxK.js";
7
- import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BMspgZO1.js";
8
- import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BZ1UbpXz.js";
9
- import { t as timing } from "./timing-BVxPrYq3.js";
2
+ import { C as appleCredentialsFromEnv, m as ENV_APPLE_PASSWORD, p as ENV_APPLE_ID, x as VERSION } from "./environment-BWT2S4qC.js";
3
+ import { t as ApiError } from "./client-AI9H4GGB.js";
4
+ import { i as savedKey, m as KEY_LABEL, n as testModeWarning, o as chooseIosApp, s as resolveApp, t as upsertHeldKey, x as keyKind, y as findIntegrations } from "./held-D3PUNky2.js";
5
+ import { t as apiCall } from "./spinner-BANVLncC.js";
6
+ import { n as SUPERWALL_HOME } from "./paths-REb-GrbX.js";
7
+ import { A as listField, M as textField, O as field, j as parseJson } from "./resources-BaP3p_LY.js";
8
+ import { c as replaceAppPurchaseKey, s as replaceAppAscKey } from "./client-BJQXl62Q.js";
9
+ import { t as timing } from "./timing-Ca0TXY-A.js";
10
10
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
11
11
  import { join } from "node:path";
12
12
  import { createHash, pbkdf2Sync, randomBytes } from "node:crypto";
@@ -0,0 +1,20 @@
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 "./held-D3PUNky2.js";
7
+ import "./config-CGcG7GOt.js";
8
+ import "./spinner-BANVLncC.js";
9
+ import "./ui-D_qf3Gvw.js";
10
+ import "./paths-REb-GrbX.js";
11
+ import "./orgs-D6Kk96mG.js";
12
+ import "./resources-BaP3p_LY.js";
13
+ import "./org-C04eAO-j.js";
14
+ import "./lookup-gjcKIZvh.js";
15
+ import "./scope-Bp_zwJOo.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-B4m-IKlr.js";
19
+
20
+ export { createAndSaveKey, keyAccess, keyRole, runAscKeysCreate };
@@ -1,84 +1,56 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import "./environment-djS0ik60.js";
4
- import "./storage-CrXGgIbS.js";
5
- import "./client-ltxxHuxn.js";
3
+ import "./environment-BWT2S4qC.js";
4
+ import "./storage-DzP22xKn.js";
5
+ import "./client-AI9H4GGB.js";
6
6
  import "./config-CGcG7GOt.js";
7
- import "./telemetry-BqaPbM0k.js";
7
+ import "./telemetry-CXN6f-ZX.js";
8
8
  import "./spawn-DmmmHIP-.js";
9
- import "./spinner-1uuKKZMc.js";
9
+ import "./spinner-BANVLncC.js";
10
10
  import "./ui-D_qf3Gvw.js";
11
11
  import "./theme-DUsCh-Vd.js";
12
12
  import "./log-C0MDCfA2.js";
13
- import "./scan-CRexsHOE.js";
14
- import "./existing-Das3PHGG.js";
15
- import "./paths-CdwjySxK.js";
16
- import { O as field } from "./resources-BMspgZO1.js";
17
- import "./org-BrR4HGvl.js";
18
- import "./lookup-us5vu5od.js";
19
- import "./bind-82oTpHZ3.js";
20
- import "./login-CiK5T4w8.js";
21
- import "./skills-CiWxt6vS.js";
22
- import "./assets-W5yvyf0V.js";
23
- import "./selection-CgZJJ3FD.js";
24
- import { n as requireApi, t as LoginRequiredError, u as projectPackageName } from "./session-CV0P8BjK.js";
25
- import "./source-push-CX_k_yZD.js";
26
- import "./login-girc324T.js";
27
- import "./run-D4V6mq8_.js";
28
- import "./drivers-CTyYdBL7.js";
29
- import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-cS6UGeUj.js";
30
- import "./server-Dv1VwbNh.js";
31
- import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-BIuOZ9ka.js";
32
- import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-UWLhQG3M.js";
33
- import { execFile } from "node:child_process";
13
+ import "./scan-Bj5y0zTZ.js";
14
+ import "./existing-b0GxFcnc.js";
15
+ import "./paths-REb-GrbX.js";
16
+ import "./orgs-D6Kk96mG.js";
17
+ import { O as field } from "./resources-BaP3p_LY.js";
18
+ import "./org-C04eAO-j.js";
19
+ import "./lookup-gjcKIZvh.js";
20
+ import "./bind-B3eEcRyp.js";
21
+ import "./login-PMoXUGqq.js";
22
+ import "./skills-2qYaUXGE.js";
23
+ import "./browser-Bp3yRKlU.js";
24
+ import "./assets-BrB9jQPQ.js";
25
+ import "./selection-BltBpyp5.js";
26
+ import "./types-JdxmnCko.js";
27
+ import { a as projectPackageName, n as requireApi, t as LoginRequiredError } from "./session-D3fgXQBt.js";
28
+ import "./source-push-kAep4gPe.js";
29
+ import "./git-D7AVdugb.js";
30
+ import "./scope-CCb_7UvN.js";
31
+ import "./login-COmGHrU5.js";
32
+ import "./run-C5OPwhvS.js";
33
+ import "./drivers-CMEL13gp.js";
34
+ import { _ as slugOf, c as scaffoldFromPaywall, g as writeTemplate, h as writeSurfaceFiles, i as migrationFor, m as starterConfig, o as offerMigration, s as projectDirOf } from "./migration-DS44-3Zr.js";
35
+ import "./server-CdVIboQn.js";
36
+ import { i as startStudio, n as migrationNextSteps, t as askStudio } from "./open-DQpm2yVs.js";
37
+ import { i as downloadRepoDir, n as PUBLIC_REPO, r as RepoDownloadError, t as PUBLIC_REF } from "./download-2Zu2I_Og.js";
38
+ import { a as devCommand, c as uniqueSurfaceId, i as detectPackageManager, n as connectApp, o as initGit, r as detectHostApp, s as installDependencies, t as alreadyAProject } from "./setup-zzjtTy8k.js";
34
39
  import * as fs from "node:fs";
35
- import * as os$1 from "node:os";
36
40
  import * as path from "node:path";
37
41
  import pc from "picocolors";
38
- import { promisify } from "node:util";
39
- import { gunzipSync } from "node:zlib";
40
42
 
41
43
  //#region src/core/paywalls/project/examples.ts
42
- const run = promisify(execFile);
43
- const EXAMPLES_REPO = process.env.SUPERWALL_EXAMPLES_REPO ?? "superwall/superwall";
44
- const EXAMPLES_REF = process.env.SUPERWALL_EXAMPLES_REF ?? "main";
45
- var ExampleError = class extends Error {};
46
44
  async function listExamples(fetchImpl = fetch) {
47
- const response = await fetchImpl(`https://api.github.com/repos/${EXAMPLES_REPO}/contents/examples?ref=${EXAMPLES_REF}`);
48
- if (!response.ok) throw new ExampleError(`Could not list examples from github.com/${EXAMPLES_REPO} (HTTP ${response.status}).`);
45
+ const response = await fetchImpl(`https://api.github.com/repos/${PUBLIC_REPO}/contents/examples?ref=${PUBLIC_REF}`);
46
+ if (!response.ok) throw new RepoDownloadError(`Could not list examples from github.com/${PUBLIC_REPO} (HTTP ${response.status}).`);
49
47
  const entries = await response.json();
50
48
  return (Array.isArray(entries) ? entries : []).filter((entry) => field(entry, "type") === "dir").map((entry) => field(entry, "name")).filter((name) => typeof name === "string").sort();
51
49
  }
52
50
  async function downloadExample(name, target, fetchImpl = fetch) {
53
- if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new ExampleError(`\`${name}\` is not an example name.`);
54
- const response = await fetchImpl(`https://codeload.github.com/${EXAMPLES_REPO}/tar.gz/refs/heads/${EXAMPLES_REF}`);
55
- if (!response.ok) throw new ExampleError(`Could not download github.com/${EXAMPLES_REPO} (HTTP ${response.status}). Check your network, then try again.`);
56
- let archive;
57
- try {
58
- archive = gunzipSync(Buffer.from(await response.arrayBuffer()));
59
- } catch {
60
- throw new ExampleError(`The download of github.com/${EXAMPLES_REPO} was damaged. Try again.`);
61
- }
62
- const tarball = path.join(os$1.tmpdir(), `superwall-example-${process.pid}.tar`);
63
- fs.writeFileSync(tarball, archive);
64
- const prefix = `${EXAMPLES_REPO.split("/")[1]}-${EXAMPLES_REF.replace(/\//g, "-")}`;
65
- fs.mkdirSync(target, { recursive: true });
66
- try {
67
- await run("tar", [
68
- "-xf",
69
- tarball,
70
- "-C",
71
- target,
72
- "--strip-components",
73
- "3",
74
- `${prefix}/examples/${name}`
75
- ]);
76
- } catch {
77
- throw new ExampleError(`No example named \`${name}\` in github.com/${EXAMPLES_REPO} — run \`superwall create\` without --example to pick from the list.`);
78
- } finally {
79
- fs.rmSync(tarball, { force: true });
80
- }
81
- if (!fs.existsSync(path.join(target, "package.json"))) throw new ExampleError(`Example \`${name}\` did not contain a project.`);
51
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) throw new RepoDownloadError(`\`${name}\` is not an example name.`);
52
+ await downloadRepoDir(`examples/${name}`, target, `No example named \`${name}\` in github.com/${PUBLIC_REPO} — run \`superwall create\` without --example to pick from the list.`, fetchImpl);
53
+ if (!fs.existsSync(path.join(target, "package.json"))) throw new RepoDownloadError(`Example \`${name}\` did not contain a project.`);
82
54
  }
83
55
  function adoptExamplePackage(target, name) {
84
56
  const file = path.join(target, "package.json");
@@ -186,7 +158,7 @@ async function runCreate(ctx, options, deps = runtime) {
186
158
  }, {
187
159
  value: "example",
188
160
  label: "An example",
189
- hint: `github.com/${EXAMPLES_REPO}`
161
+ hint: `github.com/${PUBLIC_REPO}`
190
162
  }],
191
163
  initialValue: "minimal"
192
164
  });
@@ -208,7 +180,7 @@ async function runCreate(ctx, options, deps = runtime) {
208
180
  example = picked;
209
181
  } catch (error) {
210
182
  spin.stop("Could not fetch the example list");
211
- ui.warn(`${error instanceof ExampleError ? error.message : String(error)}\nStarting from minimal instead.`);
183
+ ui.warn(`${error instanceof RepoDownloadError ? error.message : String(error)}\nStarting from minimal instead.`);
212
184
  }
213
185
  }
214
186
  }
@@ -1,13 +1,13 @@
1
- import "./token-zjjlkNDF.js";
1
+ import "./token-FmeHywYt.js";
2
2
  import "./output-Ggzq5_-t.js";
3
- import { x as apiKeyFromEnv } from "./environment-djS0ik60.js";
4
- import { n as readSession } from "./storage-CrXGgIbS.js";
3
+ import { S as apiKeyFromEnv } from "./environment-BWT2S4qC.js";
4
+ import { n as readSession } from "./storage-DzP22xKn.js";
5
5
  import "./spawn-DmmmHIP-.js";
6
6
  import { n as ui } from "./ui-D_qf3Gvw.js";
7
7
  import { n as fg, t as THEME } from "./theme-DUsCh-Vd.js";
8
- import { t as scanProject } from "./scan-CRexsHOE.js";
9
- import { t as detectExisting } from "./existing-Das3PHGG.js";
10
- import { t as detectDrivers } from "./drivers-CTyYdBL7.js";
8
+ import { t as scanProject } from "./scan-Bj5y0zTZ.js";
9
+ import { t as detectExisting } from "./existing-b0GxFcnc.js";
10
+ import { t as detectDrivers } from "./drivers-CMEL13gp.js";
11
11
 
12
12
  //#region src/core/support/doctor.ts
13
13
  async function runDoctor(ctx, deps = {}) {
@@ -0,0 +1,58 @@
1
+ import { execFile } from "node:child_process";
2
+ import * as fs from "node:fs";
3
+ import * as os$1 from "node:os";
4
+ import * as path from "node:path";
5
+ import { promisify } from "node:util";
6
+ import { gunzipSync } from "node:zlib";
7
+
8
+ //#region src/core/repo/download.ts
9
+ const run = promisify(execFile);
10
+ const PUBLIC_REPO = process.env.SUPERWALL_EXAMPLES_REPO ?? "superwall/superwall";
11
+ const PUBLIC_REF = process.env.SUPERWALL_EXAMPLES_REF ?? "main";
12
+ var RepoDownloadError = class extends Error {};
13
+ const DOWNLOAD_TIMEOUT_MS = 12e4;
14
+ async function downloadRepoDir(dir, target, notFound, fetchImpl = fetch) {
15
+ const signal = AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS);
16
+ let response;
17
+ let bytes;
18
+ try {
19
+ response = await fetchImpl(`https://codeload.github.com/${PUBLIC_REPO}/tar.gz/refs/heads/${PUBLIC_REF}`, { signal });
20
+ if (!response.ok) throw new RepoDownloadError(`Could not download github.com/${PUBLIC_REPO} (HTTP ${response.status}). Check your network, then try again.`);
21
+ bytes = await response.arrayBuffer();
22
+ } catch (error) {
23
+ if (error instanceof RepoDownloadError) throw error;
24
+ throw new RepoDownloadError(`Could not reach github.com/${PUBLIC_REPO}. Check your network, then try again.`);
25
+ }
26
+ let archive;
27
+ try {
28
+ archive = gunzipSync(Buffer.from(bytes));
29
+ } catch {
30
+ throw new RepoDownloadError(`The download of github.com/${PUBLIC_REPO} was damaged. Try again.`);
31
+ }
32
+ const stage = fs.mkdtempSync(path.join(os$1.tmpdir(), "superwall-download-"));
33
+ const tarball = path.join(stage, "repo.tar");
34
+ fs.writeFileSync(tarball, archive);
35
+ const prefix = `${PUBLIC_REPO.split("/")[1]}-${PUBLIC_REF.replace(/\//g, "-")}`;
36
+ fs.mkdirSync(target, { recursive: true });
37
+ try {
38
+ await run("tar", [
39
+ "-xf",
40
+ tarball,
41
+ "-C",
42
+ target,
43
+ "--strip-components",
44
+ String(dir.split("/").length + 1),
45
+ `${prefix}/${dir}`
46
+ ]);
47
+ } catch {
48
+ throw new RepoDownloadError(notFound);
49
+ } finally {
50
+ fs.rmSync(stage, {
51
+ recursive: true,
52
+ force: true
53
+ });
54
+ }
55
+ }
56
+
57
+ //#endregion
58
+ export { downloadRepoDir as i, PUBLIC_REPO as n, RepoDownloadError as r, PUBLIC_REF as t };
@@ -1,6 +1,6 @@
1
- import { t as getOAuthAccessToken } from "./token-zjjlkNDF.js";
2
- import { b as VERSION, t as API_HOST } from "./environment-djS0ik60.js";
3
- import { n as readSession } from "./storage-CrXGgIbS.js";
1
+ import { t as getOAuthAccessToken } from "./token-FmeHywYt.js";
2
+ import { t as API_HOST, x as VERSION } from "./environment-BWT2S4qC.js";
3
+ import { n as readSession } from "./storage-DzP22xKn.js";
4
4
  import { n as readVersion, r as spawnStream, t as onPath } from "./spawn-DmmmHIP-.js";
5
5
  import { tmpdir } from "node:os";
6
6
  import { basename, join } from "node:path";