@superwall/cli 2.6.1 → 2.7.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 (137) hide show
  1. package/dist/{apple-BE1GBJFP.js → apple-DfYTDEJy.js} +16 -16
  2. package/dist/{approve-yRZmvkCj.js → approve-CoQJhii4.js} +7 -7
  3. package/dist/{assets-DTAgbWw0.js → assets-BN0tFoj7.js} +3 -3
  4. package/dist/auth.d.ts +1 -1
  5. package/dist/auth.js +3 -3
  6. package/dist/{base-zc1wl_9b.js → base-DAnzMjI8.js} +2 -2
  7. package/dist/{billing-C1LV4-BN.js → billing-CFGrG-WZ.js} +3 -3
  8. package/dist/{build-CQd-pf7O.js → build-CTBvzIG8.js} +10 -10
  9. package/dist/{config-DCqRQTJ4.js → config-CJRNScT0.js} +4 -4
  10. package/dist/{create-wlCp83IH.js → create-BLs-0ETi.js} +29 -29
  11. package/dist/create-C_kjQp0N.js +18 -0
  12. package/dist/{create-Costu6UT.js → create-aWzdpjJU.js} +8 -8
  13. package/dist/{doctor-Bd9ffg51.js → doctor-ChI2Kfru.js} +21 -21
  14. package/dist/entry.js +28 -29
  15. package/dist/{environment-Dn7irhZr.js → environment-BQiaGqjB.js} +1 -1
  16. package/dist/{existing-BQMB_2AG.js → existing-Cxg_gSN1.js} +8 -8
  17. package/dist/{git-Hf9Wc7Hp.js → git-D9ooAMt7.js} +1 -1
  18. package/dist/held-CQMCqJMa.js +15 -0
  19. package/dist/{held-D5wSX2Mf.js → held-CmvNRCRD.js} +327 -22
  20. package/dist/{scope-DDYLQeZw.js → input-ApyzIzVy.js} +48 -7
  21. package/dist/{install-CxyqfKFe.js → install-DM0JBdpE.js} +12 -12
  22. package/dist/{integrate-MkyDDzI5.js → integrate-ZQUaScQ0.js} +21 -22
  23. package/dist/login-Cnt3UZKV.js +13 -0
  24. package/dist/{login-B7IqDafm.js → login-CvzBt9eM.js} +2 -2
  25. package/dist/{login-BMHDhxAx.js → login-Oo2NWLlX.js} +7 -7
  26. package/dist/{lookup-DkcT4E-5.js → lookup-CHLrO7v7.js} +3 -3
  27. package/dist/{migrate-CdFoZipj.js → migrate-mFKBset8.js} +30 -30
  28. package/dist/{notification-url-D6KKeXnk.js → notification-url-Dpx0pbYs.js} +3 -3
  29. package/dist/{open-COJE6ryI.js → open-CxgE8kLT.js} +2 -2
  30. package/dist/{org-BV8wwxwc.js → org-0KDPRSlc.js} +4 -4
  31. package/dist/{organization-9R_1PJKk.js → organization-Cg--QQtz.js} +4 -4
  32. package/dist/{orgs-ltP8H0Nl.js → orgs-Df8DzIav.js} +1 -1
  33. package/dist/{paths-Cb1RfjaX.js → paths-B4FNcaHO.js} +1 -1
  34. package/dist/{playbook-CVGolez9.js → playbook-pFhIg_0e.js} +10 -10
  35. package/dist/{promote-B_HnFEbX.js → promote-Crwz1xI0.js} +23 -23
  36. package/dist/{pull-DF4KYVcP.js → pull-BixwETu1.js} +10 -10
  37. package/dist/pull-C0gY7HGj.js +30 -0
  38. package/dist/{pull-lYRULo4v.js → pull-D8GfsKha.js} +30 -30
  39. package/dist/{push-BZN1Qpkq.js → push-BKoav_FU.js} +10 -10
  40. package/dist/{push-BnllH2Rd.js → push-BNFvZHUM.js} +8 -8
  41. package/dist/push-DOaBj8hr.js +29 -0
  42. package/dist/push-uWv5P0LA.js +21 -0
  43. package/dist/{registry-CqePfigB.js → registry-BPqRG08G.js} +268 -433
  44. package/dist/registry-DGHTk7l-.js +21 -0
  45. package/dist/{resolve-B4bd3Qjl.js → resolve-CarLrF4b.js} +3 -3
  46. package/dist/{resources-BaURbSpY.js → resources-BeXleviK.js} +15 -34
  47. package/dist/{run-Bme4Egyl.js → run-naBCXCfn.js} +14 -14
  48. package/dist/{scan-DugxddUU.js → scan-CtYVCqDS.js} +1 -1
  49. package/dist/scan-KWnscsk-.js +4 -0
  50. package/dist/{sdk-BFunw4Hc.js → sdk-BKVRAv23.js} +2 -2
  51. package/dist/{selection-C439nEhn.js → selection-CpEfqw2b.js} +1 -1
  52. package/dist/{series-B8NJK4yS.js → series-C9OU5kd7.js} +1 -1
  53. package/dist/server-DjBnyiwD.js +33 -0
  54. package/dist/{server-C_aMxzvS.js → server-Dp5Imq3v.js} +11 -11
  55. package/dist/{session-CfG3gzko.js → session-6HA1OwHe.js} +6 -6
  56. package/dist/session-BatiAUPQ.js +5 -0
  57. package/dist/{session-B7frlXXQ.js → session-BpLOLurZ.js} +1 -1
  58. package/dist/{setup-DQEasPhx.js → setup-RL-5c6SV.js} +10 -10
  59. package/dist/skills/superwall/SKILL.md +8 -1
  60. package/dist/skills/superwall/references/api.md +34 -3
  61. package/dist/skills/superwall/references/asc.md +5 -1
  62. package/dist/skills/superwall/workflows/dashboard/playbook.md +1 -1
  63. package/dist/skills/superwall/workflows/dashboard/setup.md +6 -2
  64. package/dist/skills/superwall/workflows/migrate/adapty.md +1 -1
  65. package/dist/skills/superwall/workflows/migrate/playbook.md +6 -1
  66. package/dist/skills/superwall/workflows/migrate/qonversion.md +1 -1
  67. package/dist/skills/superwall/workflows/migrate/revenuecat.md +1 -1
  68. package/dist/skills/superwall/workflows/placements/android.md +4 -1
  69. package/dist/skills/superwall/workflows/placements/expo.md +4 -1
  70. package/dist/skills/superwall/workflows/placements/flutter.md +4 -1
  71. package/dist/skills/superwall/workflows/placements/ios.md +4 -1
  72. package/dist/skills/superwall/workflows/placements/playbook.md +6 -1
  73. package/dist/skills/superwall/workflows/placements/react-native.md +4 -1
  74. package/dist/skills/superwall/workflows/placements/strategy.md +4 -1
  75. package/dist/skills/superwall-framework/SKILL.md +54 -4
  76. package/dist/skills/superwall-framework/references/cli.md +6 -0
  77. package/dist/skills/superwall-framework/references/elements-checkout.md +457 -0
  78. package/dist/skills/superwall-framework/references/examples.md +1 -0
  79. package/dist/skills/superwall-framework/references/layout.md +10 -0
  80. package/dist/skills/teleport/SKILL.md +1 -1
  81. package/dist/{skills-DnegE1A6.js → skills-C1ku2pgy.js} +5 -5
  82. package/dist/{skills-MmF7IyTg.js → skills-CkAWJveA.js} +8 -8
  83. package/dist/{source-push-MbJjh4Ki.js → source-push-D59hV02W.js} +6 -6
  84. package/dist/{spinner-Dcr-Dqdi.js → spinner-hTCJZAoJ.js} +42 -7
  85. package/dist/{starter-BlJ_InZJ.js → starter-jYb2nmlb.js} +3 -3
  86. package/dist/{status-DHRxg1ZA.js → status-DrD9CHtK.js} +7 -7
  87. package/dist/{storage-DdIAHolY.js → storage-D0Q4xBi-.js} +1 -1
  88. package/dist/storekit-CAOpa6_f.js +14 -0
  89. package/dist/{storekit-De998QOt.js → storekit-TLBxGIrN.js} +5 -5
  90. package/dist/{theme-BrUrye-c.js → theme-Bvv0yrk_.js} +5 -5
  91. package/dist/{token-CKCBQ4I8.js → token-SEWilQo9.js} +1 -1
  92. package/dist/tools-skills/superwall/SKILL.md +8 -1
  93. package/dist/tools-skills/superwall/references/api.md +34 -3
  94. package/dist/tools-skills/superwall/references/asc.md +5 -1
  95. package/dist/tools-skills/superwall/workflows/dashboard/playbook.md +1 -1
  96. package/dist/tools-skills/superwall/workflows/dashboard/setup.md +6 -2
  97. package/dist/tools-skills/superwall/workflows/migrate/adapty.md +1 -1
  98. package/dist/tools-skills/superwall/workflows/migrate/playbook.md +6 -1
  99. package/dist/tools-skills/superwall/workflows/migrate/qonversion.md +1 -1
  100. package/dist/tools-skills/superwall/workflows/migrate/revenuecat.md +1 -1
  101. package/dist/tools-skills/superwall/workflows/placements/android.md +4 -1
  102. package/dist/tools-skills/superwall/workflows/placements/expo.md +4 -1
  103. package/dist/tools-skills/superwall/workflows/placements/flutter.md +4 -1
  104. package/dist/tools-skills/superwall/workflows/placements/ios.md +4 -1
  105. package/dist/tools-skills/superwall/workflows/placements/playbook.md +6 -1
  106. package/dist/tools-skills/superwall/workflows/placements/react-native.md +4 -1
  107. package/dist/tools-skills/superwall/workflows/placements/strategy.md +4 -1
  108. package/dist/tools-skills/teleport/SKILL.md +1 -1
  109. package/dist/tools.d.ts +4 -2
  110. package/dist/tools.js +1352 -1187
  111. package/dist/{try-C8QQbG0b.js → try-BpMpLGCs.js} +15 -15
  112. package/dist/{ui-hFgji1e8.js → ui-Dye-QvEj.js} +26 -1
  113. package/dist/{upgrade-D0thxCA4.js → upgrade-BLFWdbGR.js} +7 -7
  114. package/dist/upgrade-BzN7PjKg.js +27 -0
  115. package/package.json +2 -2
  116. package/dist/create-CSHGZDfB.js +0 -18
  117. package/dist/held-Dmf5SR3p.js +0 -15
  118. package/dist/input-DOT_2Zvb.js +0 -42
  119. package/dist/login-Cp0-BgDZ.js +0 -13
  120. package/dist/pull-JxiMyRwY.js +0 -30
  121. package/dist/push-B5py7h5y.js +0 -29
  122. package/dist/push-DHlUMkbf.js +0 -21
  123. package/dist/registry-BGEYCWyD.js +0 -22
  124. package/dist/scan-J2DILUNE.js +0 -4
  125. package/dist/server-Cif9w5lM.js +0 -33
  126. package/dist/session-DvaPyOuH.js +0 -5
  127. package/dist/storekit-iBCWmeKn.js +0 -15
  128. package/dist/upgrade-CYFdpVpi.js +0 -27
  129. /package/dist/{design-lint-mgO-2SGS.js → design-lint-CeG3_ZWN.js} +0 -0
  130. /package/dist/{devtools-B6Vp6HMy.js → devtools-B3tCQFD-.js} +0 -0
  131. /package/dist/{download-DhGd4hOB.js → download-DVFHIwia.js} +0 -0
  132. /package/dist/{project-BomArwSj.js → project-Dml4t7jO.js} +0 -0
  133. /package/dist/{reports-hbxsd3Zo.js → reports-CJQ-8sj4.js} +0 -0
  134. /package/dist/{screenshot-file-Dix2Qynm.js → screenshot-file-CcqMLpL5.js} +0 -0
  135. /package/dist/{source-DQs6iLtC.js → source-Ct9kOCAb.js} +0 -0
  136. /package/dist/{storage-Bh3wT1Rn.d.ts → storage-BaK-MUM8.d.ts} +0 -0
  137. /package/dist/{timing-BKEEIBij.js → timing-m0ZUzYiP.js} +0 -0
@@ -1,11 +1,14 @@
1
- import { h as cache, v as readJson } from "./storage-DdIAHolY.js";
2
- import { y as ApiError } from "./config-DCqRQTJ4.js";
3
- import { A as listField, M as textField, O as field, c as createProject, k as isRecord, m as listProjects, r as createApplication } from "./resources-BaURbSpY.js";
4
- import { d as readInput, t as apiCall } from "./spinner-Dcr-Dqdi.js";
5
- import { n as orgForNewProject } from "./org-BV8wwxwc.js";
6
- import { n as findApplication } from "./lookup-DkcT4E-5.js";
7
- import { r as pickOrganization } from "./scope-DDYLQeZw.js";
1
+ import { f as formatJson, h as cache, u as blocks, v as readJson } from "./storage-D0Q4xBi-.js";
2
+ import { f as writeDefaultApp, r as readDefaultApp, y as ApiError } from "./config-CJRNScT0.js";
3
+ import { a as isRecord, c as textField, i as field, o as listField } from "./ui-Dye-QvEj.js";
4
+ import { t as listOrgGroups } from "./orgs-Df8DzIav.js";
5
+ import { T as rowName, c as createProject, h as listResource, m as listProjects, r as createApplication, u as isAppScoped, y as platformLabel } from "./resources-BeXleviK.js";
6
+ import { d as readInput, g as withAppleErrors, t as apiCall } from "./spinner-hTCJZAoJ.js";
7
+ import { n as orgForNewProject } from "./org-0KDPRSlc.js";
8
+ import { n as findApplication, t as appNotFound } from "./lookup-CHLrO7v7.js";
9
+ import { a as chooseApp, c as pickScope, o as pickOrganization, r as textOf$1, s as pickProject } from "./input-ApyzIzVy.js";
8
10
  import { a as listAscConfigs, c as replaceAppPurchaseKey, l as replaceAscConfig, r as createAscConfig, s as replaceAppAscKey, t as ascProxy } from "./client-BwYhzITp.js";
11
+ import pc from "picocolors";
9
12
 
10
13
  //#region src/core/app-store-connect/api/spec.ts
11
14
  const REFRESH_TTL_MS = 10080 * 60 * 1e3;
@@ -284,6 +287,296 @@ function assign(container, key, value) {
284
287
  else container[key] = value;
285
288
  }
286
289
 
290
+ //#endregion
291
+ //#region src/core/main/list.ts
292
+ async function list(context, api, resource, flags) {
293
+ const { json } = context;
294
+ if (resource === "apps") {
295
+ const query$1 = flags.search;
296
+ let room = limitOf(flags.limit) ?? Number.POSITIVE_INFINITY;
297
+ const groups = (await apiCall(context, "Loading projects", () => listOrgGroups(api))).map((group) => {
298
+ const projects = matchingProjects(group.projects, query$1).slice(0, room);
299
+ room -= projects.length;
300
+ return {
301
+ ...group,
302
+ projects
303
+ };
304
+ }).filter((group) => group.projects.length > 0 || !query$1 && room > 0);
305
+ if (json) return context.output.data(groups.flatMap(({ projects,...organization }) => projects.map((project) => organization.id ? {
306
+ ...project,
307
+ organization
308
+ } : project)));
309
+ if (groups.flatMap((group) => group.projects).length === 0) return context.output.render(blocks.list({
310
+ items: [],
311
+ empty: query$1 ? `No project or app matches "${query$1}".` : "No projects yet - run `superwall apps create --name <name> --platform ios`."
312
+ }));
313
+ for (const group of groups) {
314
+ const heading$1 = groups.length > 1 ? `\`${group.name ?? `Organization ${group.id}`}\`${group.member ? "" : " (not a member)"} · ${formatCount(group.projects.length, "project")}` : formatCount(group.projects.length, "project");
315
+ context.output.render(blocks.step(heading$1), blocks.list({ items: group.projects.map((project) => ({
316
+ label: project.name ?? String(project.id),
317
+ meta: String(project.id),
318
+ children: (project.applications ?? []).map((app) => ({
319
+ badge: platformLabel(app.platform),
320
+ label: app.bundle_id ?? app.name ?? "",
321
+ meta: `${app.id}${app.public_api_key ? ` pk_…${app.public_api_key.slice(-4)}` : ""}`
322
+ }))
323
+ })) }));
324
+ }
325
+ return;
326
+ }
327
+ const scope = await pickScope(context, api, isAppScoped(resource));
328
+ const all = await apiCall(context, `Loading ${resource}`, () => listResource(api, resource, scope));
329
+ const query = flags.search;
330
+ const matched = query ? all.filter((row) => rowMatches(row, query)) : all;
331
+ const limit = limitOf(flags.limit);
332
+ if (json) return context.output.data(limit === void 0 ? matched : matched.slice(0, limit));
333
+ const shown = matched.slice(0, limit ?? RICH_ROWS);
334
+ const noun = resource.replace(/s$/, "");
335
+ const heading = query ? `${formatCount(matched.length, noun)} matching "${query}", of ${all.length}` : formatCount(all.length, noun);
336
+ context.output.render(blocks.step(`${heading}${scopeLabel(resource, scope)}`), blocks.list({
337
+ items: shown.map((row) => {
338
+ const label = rowName(row);
339
+ const identifier = typeof row.identifier === "string" ? row.identifier : void 0;
340
+ return {
341
+ label,
342
+ meta: [identifier && identifier !== label ? identifier : void 0, secondaryId(label, row.id)].filter(Boolean).join(" ") || void 0
343
+ };
344
+ }),
345
+ empty: query ? `No ${resource} match "${query}".` : `No ${resource} yet.`
346
+ }));
347
+ if (matched.length > shown.length) context.ui.info(`…${matched.length - shown.length} more. Narrow with --search <text>, or pass --limit <n> or --json for all.`);
348
+ }
349
+ async function useApp(context, api, value) {
350
+ const projects = await apiCall(context, "Loading projects", () => listProjects(api));
351
+ const target = textOf$1(value);
352
+ let app;
353
+ let projectId;
354
+ if (target) {
355
+ const found = await apiCall(context, "Finding the app", () => findApplication(api, target, projects));
356
+ if (!found) throw appNotFound(target);
357
+ app = found.app;
358
+ projectId = String(found.project.id);
359
+ } else if (!context.interactive) throw new Error("Specify an app: superwall apps use <id|name|dashboard link>");
360
+ else {
361
+ const project = await pickProject(context, api, projects);
362
+ const apps = project.applications ?? [];
363
+ const [first] = apps;
364
+ if (!first) throw new Error(`${project.name ?? project.id} has no apps yet.`);
365
+ projectId = String(project.id);
366
+ app = await chooseApp(context, apps, apps.find((candidate) => String(candidate.id) === readDefaultApp(projectId)) ?? first);
367
+ }
368
+ writeDefaultApp(projectId, String(app.id));
369
+ if (context.json) return context.output.data(app);
370
+ context.ui.success(`Default app set to \`${app.name ?? app.id}\` (${platformLabel(app.platform)})`);
371
+ }
372
+ function secondaryId(label, id) {
373
+ const value = String(id ?? "");
374
+ return value && value !== label ? value : void 0;
375
+ }
376
+ function formatCount(value, noun) {
377
+ return `${value} ${noun}${value === 1 ? "" : "s"}`;
378
+ }
379
+ function scopeLabel(resource, scope) {
380
+ const parts = [];
381
+ if (scope.projectCount > 1 && scope.projectName) parts.push(scope.projectName);
382
+ if (isAppScoped(resource) && scope.appCount > 1 && scope.appName) parts.push(`${scope.appName} (${platformLabel(scope.appPlatform)})`);
383
+ return parts.length ? ` in \`${parts.join(" · ")}\`` : "";
384
+ }
385
+ const RICH_ROWS = 50;
386
+ function limitOf(value) {
387
+ if (value === void 0) return void 0;
388
+ const n = Number(value);
389
+ if (!Number.isInteger(n) || n < 1) throw new Error("--limit takes a whole number above 0.");
390
+ return n;
391
+ }
392
+ const SEARCHED_FIELDS = [
393
+ "id",
394
+ "name",
395
+ "identifier",
396
+ "bundle_id",
397
+ "description",
398
+ "public_api_key"
399
+ ];
400
+ function rowMatches(row, query) {
401
+ const needle = query.toLowerCase();
402
+ return Object.entries(row).some(([field$1, value]) => {
403
+ return SEARCHED_FIELDS.includes(field$1) && (typeof value === "string" || typeof value === "number") && String(value).toLowerCase().includes(needle);
404
+ });
405
+ }
406
+ function matchingProjects(projects, query) {
407
+ if (!query) return projects;
408
+ return projects.flatMap((project) => {
409
+ if (rowMatches(project, query)) return [project];
410
+ const apps = (project.applications ?? []).filter((app) => rowMatches(app, query));
411
+ return apps.length ? [{
412
+ ...project,
413
+ applications: apps
414
+ }] : [];
415
+ });
416
+ }
417
+
418
+ //#endregion
419
+ //#region src/core/main/views.ts
420
+ const INLINE_LIST = 72;
421
+ const LABEL_KEYS = [
422
+ "name",
423
+ "event_name",
424
+ "identifier",
425
+ "product_identifier",
426
+ "title",
427
+ "description",
428
+ "url"
429
+ ];
430
+ const NESTED_ROWS = 10;
431
+ const MAX_DEPTH = 2;
432
+ const isScalar = (value) => value === null || typeof value !== "object";
433
+ function scalar(value) {
434
+ if (value === null || value === void 0 || value === "") return pc.dim("—");
435
+ if (typeof value === "boolean") return value ? pc.green("yes") : pc.dim("no");
436
+ return String(value);
437
+ }
438
+ function renderObject(value, indent = "", depth = 0) {
439
+ const keys = Object.keys(value).filter((key) => key !== "object");
440
+ const width = Math.max(0, ...keys.map((key) => key.length)) + 2;
441
+ const out = [];
442
+ for (const key of keys) {
443
+ const field$1 = value[key];
444
+ const label = `${indent}${pc.dim(key.padEnd(width))}`;
445
+ if (isScalar(field$1)) out.push(`${label}${scalar(field$1)}`);
446
+ else if (Array.isArray(field$1)) out.push(...renderArray(label, field$1, indent, depth));
447
+ else if (isRecord(field$1) && depth >= MAX_DEPTH) out.push(`${label}${pc.dim(`{ ${Object.keys(field$1).length} fields }`)}`);
448
+ else if (isRecord(field$1)) {
449
+ out.push(`${indent}${pc.dim(key)}`);
450
+ out.push(...renderObject(field$1, `${indent} `, depth + 1));
451
+ }
452
+ }
453
+ return out;
454
+ }
455
+ function renderArray(label, items, indent, depth) {
456
+ if (items.length === 0) return [`${label}${pc.dim("none")}`];
457
+ if (items.every(isScalar)) {
458
+ const joined = items.map(String).join(", ");
459
+ return [`${label}${joined.length <= INLINE_LIST ? joined : pc.dim(`${items.length} items`)}`];
460
+ }
461
+ const rows = items.filter(isRecord).slice(0, NESTED_ROWS);
462
+ const lines = [`${label}${pc.dim(`${items.length} item${items.length === 1 ? "" : "s"}`)}`];
463
+ if (depth >= MAX_DEPTH) return lines;
464
+ for (const row of rows) {
465
+ const name = labelOf(row);
466
+ const id = row.id !== void 0 && String(row.id) !== name ? pc.dim(` ${row.id}`) : "";
467
+ lines.push(`${indent} · ${name}${id}`);
468
+ }
469
+ if (items.length > rows.length) lines.push(pc.dim(`${indent} … ${items.length - rows.length} more`));
470
+ return lines;
471
+ }
472
+ function labelOf(row) {
473
+ for (const key of LABEL_KEYS) {
474
+ const value = row[key];
475
+ if (typeof value === "string" && value) return value;
476
+ }
477
+ return rowName(row);
478
+ }
479
+ function rowsOf(response) {
480
+ if (Array.isArray(response)) return response;
481
+ if (isRecord(response)) {
482
+ for (const key of [
483
+ "data",
484
+ "items",
485
+ "results",
486
+ "users",
487
+ "events",
488
+ "attempts",
489
+ "versions"
490
+ ]) if (Array.isArray(response[key])) return response[key];
491
+ }
492
+ return response === void 0 || response === null ? [] : [response];
493
+ }
494
+ function renderRows(ctx, rows, noun, flags) {
495
+ const query = flags.search;
496
+ const matched = query ? rows.filter((row) => rowMatches(row, query)) : rows;
497
+ const limit = limitOf(flags.limit);
498
+ if (ctx.json) return ctx.output.data(matched.slice(0, limit));
499
+ const shown = matched.slice(0, limit ?? RICH_ROWS);
500
+ const count = `${matched.length} ${matched.length === 1 ? noun : `${noun}s`}`;
501
+ ctx.output.render(blocks.step(query ? `${count} matching "${query}", of ${rows.length}` : count), blocks.list({
502
+ items: shown.map((row) => {
503
+ const label = labelOf(row);
504
+ return {
505
+ label,
506
+ meta: [row.identifier, row.id].filter((part) => part !== void 0 && part !== null && String(part) !== label).map(String).join(" ") || void 0
507
+ };
508
+ }),
509
+ empty: query ? `Nothing matches "${query}".` : `No ${noun}s yet.`
510
+ }));
511
+ if (matched.length > shown.length) ctx.ui.info(`…${matched.length - shown.length} more. Narrow with --search, or pass --limit or --json.`);
512
+ }
513
+ function renderValue(ctx, value, heading) {
514
+ if (ctx.json) return ctx.output.data(value ?? { ok: true });
515
+ if (heading) ctx.output.render(blocks.success(heading));
516
+ if (value === void 0 || value === null || value === "") return;
517
+ if (isRecord(value)) return ctx.output.text(renderObject(value).join("\n"));
518
+ if (Array.isArray(value)) return ctx.output.text(renderArray("", value, "", 0).join("\n"));
519
+ ctx.output.text(String(value));
520
+ }
521
+
522
+ //#endregion
523
+ //#region src/core/app-store-connect/resources/operation.ts
524
+ function textOf(input, key) {
525
+ const value = input.flags[key];
526
+ return typeof value === "string" ? value : void 0;
527
+ }
528
+ function requireText(input, key) {
529
+ const value = textOf(input, key);
530
+ if (value === void 0) throw new Error(`Missing --${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}.`);
531
+ return value;
532
+ }
533
+ function numberOf(input, key) {
534
+ const value = input.flags[key];
535
+ return typeof value === "number" ? value : void 0;
536
+ }
537
+ function requireNumber(input, key) {
538
+ const value = numberOf(input, key);
539
+ if (value === void 0) throw new Error(`Missing --${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}.`);
540
+ return value;
541
+ }
542
+ function listOf(input, key) {
543
+ const value = input.flags[key];
544
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
545
+ }
546
+ function booleanOf(input, key) {
547
+ const value = input.flags[key];
548
+ return typeof value === "boolean" ? value : void 0;
549
+ }
550
+ function argOf(input, name) {
551
+ const value = input.args[name];
552
+ if (value === void 0) throw new Error(`Missing <${name}>.`);
553
+ return value;
554
+ }
555
+ function plural(count, noun) {
556
+ if (count === 1) return `${count} ${noun}`;
557
+ return `${count} ${noun.endsWith("y") ? `${noun.slice(0, -1)}ie` : noun}s`;
558
+ }
559
+
560
+ //#endregion
561
+ //#region src/core/app-store-connect/resources/print.ts
562
+ function printAscPlan(ctx, planned) {
563
+ if (ctx.json) return ctx.output.data({
564
+ dryRun: true,
565
+ requests: planned
566
+ });
567
+ ctx.ui.success(`Dry run: nothing was changed. ${plural(planned.length, "request")}:`);
568
+ for (const request of planned) {
569
+ ctx.ui.step(`${request.method} ${request.path}`);
570
+ if (request.body !== void 0) ctx.output.text(formatJson(request.body));
571
+ }
572
+ }
573
+ function printAscOutput(ctx, output) {
574
+ if ("value" in output) return renderValue(ctx, output.value, output.heading);
575
+ if (ctx.json) return ctx.output.data(output.data);
576
+ ctx.ui.step(plural(output.rows.length, output.noun));
577
+ for (const row of output.rows) ctx.ui.info(`\`${row.label}\`${row.meta ? ` ${row.meta}` : ""}`);
578
+ }
579
+
287
580
  //#endregion
288
581
  //#region src/core/app-store-connect/api/replaced.ts
289
582
  const REVIEW_SUBMISSIONS = "/v1/reviewSubmissions with /v1/reviewSubmissionItems";
@@ -580,10 +873,10 @@ function renderAscDocs(query, verb) {
580
873
  if (!query.trim()) {
581
874
  const roots = /* @__PURE__ */ new Set();
582
875
  for (const tmpl of Object.keys(idx.paths)) if (segments(tmpl).length === 2) roots.add(tmpl);
583
- const list = [...roots].sort();
584
- return `${header}\n${list.length} top-level resources. Run \`asc docs <path> [verb]\` for a schema, or \`asc docs <search term>\` to filter.
876
+ const list$1 = [...roots].sort();
877
+ return `${header}\n${list$1.length} top-level resources. Run \`asc docs <path> [verb]\` for a schema, or \`asc docs <search term>\` to filter.
585
878
 
586
- ` + list.join("\n");
879
+ ` + list$1.join("\n");
587
880
  }
588
881
  if (query.startsWith("/")) {
589
882
  const concrete = segments(query);
@@ -655,21 +948,33 @@ async function resolveAscTeam(ctx, api, team) {
655
948
  }
656
949
  async function sendAscRequest(ctx, verb, path, options) {
657
950
  const api = await resolveAscOrgApi(ctx);
951
+ const body = await buildAscRequestBody(ctx, verb, path, options);
952
+ const teamId = await resolveAscTeam(ctx, api, options.team);
953
+ return await apiCall(ctx, `${verb.toUpperCase()} ${path}`, () => withAppleErrors(() => ascProxy(api, teamId, verb, path, body))) ?? { ok: true };
954
+ }
955
+ async function runAscWrite(ctx, verb, path, options) {
956
+ if (!options.dryRun) return ctx.output.data(await sendAscRequest(ctx, verb, path, options));
957
+ const body = await buildAscRequestBody(ctx, verb, path, options);
958
+ const planned = {
959
+ method: verb.toUpperCase(),
960
+ path
961
+ };
962
+ if (Object.keys(body).length) planned.body = body;
963
+ printAscPlan(ctx, [planned]);
964
+ }
965
+ async function buildAscRequestBody(ctx, verb, path, options) {
658
966
  if (!path.startsWith("/")) throw new Error(`Path must start with "/", e.g. /v1/apps`);
659
967
  const replaced = selectReplacement(verb, path);
660
968
  if (replaced) ctx.ui.warn(formatReplacement(replaced));
661
969
  let body = parseParams(options.data);
662
- if (verb === "post" || verb === "patch") {
663
- await ensureAscIndex(ctx);
664
- const found = lookupAscOp(verb, path);
665
- if (found) {
666
- body = buildAscBody(found.op, verb, path, body);
667
- const problems = validateAscBody(found.op, verb, body);
668
- if (problems.length && !options.force) throw new Error(`Invalid ${verb.toUpperCase()} ${path} body:\n` + problems.map((p) => ` • ${p}`).join("\n") + `\nFix and retry, run \`superwall asc docs ${path} ${verb}\`, or pass --force to send as-is.`);
669
- }
670
- }
671
- const teamId = await resolveAscTeam(ctx, api, options.team);
672
- return await apiCall(ctx, `${verb.toUpperCase()} ${path}`, () => ascProxy(api, teamId, verb, path, body)) ?? { ok: true };
970
+ if (verb !== "post" && verb !== "patch") return body;
971
+ await ensureAscIndex(ctx);
972
+ const found = lookupAscOp(verb, path);
973
+ if (!found) return body;
974
+ body = buildAscBody(found.op, verb, path, body);
975
+ const problems = validateAscBody(found.op, verb, body);
976
+ if (problems.length && !options.force) throw new Error(`Invalid ${verb.toUpperCase()} ${path} body:\n` + problems.map((p) => ` • ${p}`).join("\n") + `\nFix and retry, run \`superwall asc docs ${path} ${verb}\`, or pass --force to send as-is.`);
977
+ return body;
673
978
  }
674
979
 
675
980
  //#endregion
@@ -1109,4 +1414,4 @@ async function resolveKeyInput(ctx, held, forApp, action) {
1109
1414
  }
1110
1415
 
1111
1416
  //#endregion
1112
- export { listKeySources as C, updateServerNotifications as D, updateBundleId as E, useAscRefresh as O, listBundleIdSuggestions as S, replaceRevenueProvider as T, checkServerNotifications as _, chooseAppIntent as a, importAppKey as b, resolveAscOrgApi as c, runAscDocs as d, parseParams as f, RefusedByApi as g, REVENUE_INTEGRATIONS as h, savedKey as i, resolveAscTeam as l, KEY_LABEL as m, testModeWarning as n, chooseIosApp as o, KEY_KINDS as p, chooseKeyApp as r, resolveApp as s, upsertHeldKey as t, sendAscRequest as u, copyAppKey as v, removeAppKey as w, keyKind as x, findIntegrations as y };
1417
+ export { KEY_LABEL as A, removeAppKey as B, renderRows as C, useApp as D, list as E, findIntegrations as F, updateBundleId as H, importAppKey as I, keyKind as L, RefusedByApi as M, checkServerNotifications as N, parseParams as O, copyAppKey as P, listBundleIdSuggestions as R, textOf as S, rowsOf as T, updateServerNotifications as U, replaceRevenueProvider as V, useAscRefresh as W, listOf as _, chooseAppIntent as a, requireNumber as b, resolveAscOrgApi as c, sendAscRequest as d, runAscDocs as f, booleanOf as g, argOf as h, savedKey as i, REVENUE_INTEGRATIONS as j, KEY_KINDS as k, resolveAscTeam as l, printAscPlan as m, testModeWarning as n, chooseIosApp as o, printAscOutput as p, chooseKeyApp as r, resolveApp as s, upsertHeldKey as t, runAscWrite as u, numberOf as v, renderValue as w, requireText as x, plural as y, listKeySources as z };
@@ -1,9 +1,9 @@
1
- import { f as writeDefaultApp, r as readDefaultApp } from "./config-DCqRQTJ4.js";
2
- import { l as findPaywall, m as listProjects, y as platformLabel } from "./resources-BaURbSpY.js";
3
- import { i as orgIdOf, o as organizationOf, t as listOrgGroups } from "./orgs-ltP8H0Nl.js";
4
- import { t as apiCall, u as currentHost } from "./spinner-Dcr-Dqdi.js";
5
- import { t as chooseOrgOfApps } from "./org-BV8wwxwc.js";
6
- import { i as findProject, n as findApplication, r as findCustomStore, t as appNotFound } from "./lookup-DkcT4E-5.js";
1
+ import { f as writeDefaultApp, r as readDefaultApp } from "./config-CJRNScT0.js";
2
+ import { i as orgIdOf, o as organizationOf, t as listOrgGroups } from "./orgs-Df8DzIav.js";
3
+ import { l as findPaywall, m as listProjects, y as platformLabel } from "./resources-BeXleviK.js";
4
+ import { t as apiCall, u as currentHost } from "./spinner-hTCJZAoJ.js";
5
+ import { t as chooseOrgOfApps } from "./org-0KDPRSlc.js";
6
+ import { i as findProject, n as findApplication, r as findCustomStore, t as appNotFound } from "./lookup-CHLrO7v7.js";
7
7
 
8
8
  //#region src/core/account/scope.ts
9
9
  function moveFirst(items, match) {
@@ -203,4 +203,45 @@ function candidates(lines) {
203
203
  }
204
204
 
205
205
  //#endregion
206
- export { pickScope as a, pickProject as i, chooseApp as n, pickOrganization as r, boundOrganization as t };
206
+ //#region src/core/main/input.ts
207
+ const OWN_FLAGS = new Set([
208
+ "app",
209
+ "project",
210
+ "d",
211
+ "dryRun",
212
+ "yes",
213
+ "search",
214
+ "limit",
215
+ "version"
216
+ ]);
217
+ const LIST_FLAGS = new Set(["entitlement"]);
218
+ function textOf(value) {
219
+ if (typeof value === "number") return String(value);
220
+ if (typeof value !== "string") return void 0;
221
+ const text = value.trim();
222
+ return text === "" ? void 0 : text;
223
+ }
224
+ function listOf(value) {
225
+ if (value === void 0 || value === null) return [];
226
+ return (Array.isArray(value) ? value : [value]).map(String);
227
+ }
228
+ function readResourceFlags(raw) {
229
+ const fields = {};
230
+ for (const [key, value] of Object.entries(raw)) {
231
+ if (OWN_FLAGS.has(key) || value === void 0) continue;
232
+ fields[key] = LIST_FLAGS.has(key) ? listOf(value) : value;
233
+ }
234
+ return {
235
+ search: textOf(raw.search),
236
+ limit: raw.limit,
237
+ yes: raw.yes === true,
238
+ data: listOf(raw.d),
239
+ fields
240
+ };
241
+ }
242
+ function fieldName(flag) {
243
+ return flag.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`).replace(/-/g, "_");
244
+ }
245
+
246
+ //#endregion
247
+ export { chooseApp as a, pickScope as c, boundOrganization as i, readResourceFlags as n, pickOrganization as o, textOf as r, pickProject as s, fieldName as t };
@@ -1,18 +1,18 @@
1
- import "./token-CKCBQ4I8.js";
2
- import "./storage-DdIAHolY.js";
3
- import "./environment-Dn7irhZr.js";
4
- import "./config-DCqRQTJ4.js";
5
- import "./resources-BaURbSpY.js";
6
- import "./orgs-ltP8H0Nl.js";
7
- import "./ui-hFgji1e8.js";
8
- import "./spinner-Dcr-Dqdi.js";
9
- import "./lookup-DkcT4E-5.js";
1
+ import "./token-SEWilQo9.js";
2
+ import "./storage-D0Q4xBi-.js";
3
+ import "./environment-BQiaGqjB.js";
4
+ import "./config-CJRNScT0.js";
5
+ import "./ui-Dye-QvEj.js";
6
+ import "./orgs-Df8DzIav.js";
7
+ import "./resources-BeXleviK.js";
8
+ import "./spinner-hTCJZAoJ.js";
9
+ import "./lookup-CHLrO7v7.js";
10
10
  import "./types-Dc9U_4kp.js";
11
11
  import { n as openBrowser } from "./browser-BVjaf98V.js";
12
12
  import "./scope-Cg1AdAfO.js";
13
- import { C as listInstallations, O as setInstallation, S as listArtifacts, T as listVersions, a as latestManifest, c as openLink, d as resolveArtifact, m as readBinding, t as appEntrypointUrl, u as projectRoot, y as deleteInstallation } from "./resolve-B4bd3Qjl.js";
14
- import { t as ArtifactError } from "./project-BomArwSj.js";
15
- import { n as resolveOrganization, t as resolveAppScope } from "./organization-9R_1PJKk.js";
13
+ import { C as listInstallations, O as setInstallation, S as listArtifacts, T as listVersions, a as latestManifest, c as openLink, d as resolveArtifact, m as readBinding, t as appEntrypointUrl, u as projectRoot, y as deleteInstallation } from "./resolve-CarLrF4b.js";
14
+ import { t as ArtifactError } from "./project-Dml4t7jO.js";
15
+ import { n as resolveOrganization, t as resolveAppScope } from "./organization-Cg--QQtz.js";
16
16
 
17
17
  //#region src/core/artifacts/install.ts
18
18
  const whereLabel = (application) => application === null || application === void 0 ? "the whole organization" : `app ${application}`;
@@ -1,28 +1,27 @@
1
- import "./token-CKCBQ4I8.js";
2
- import { f as formatJson, i as removeSession, n as readSession, s as sessionOrgName, u as blocks } from "./storage-DdIAHolY.js";
3
- import { d as DASHBOARD_URL, x as VERSION } from "./environment-Dn7irhZr.js";
4
- import { S as superwallApi, i as readOnboardedApp } from "./config-DCqRQTJ4.js";
5
- import { S as updateTelemetryTags, s as ensureSkillsCurrent } from "./skills-DnegE1A6.js";
6
- import { n as SUPPORTED_LABEL, t as scanProject } from "./scan-DugxddUU.js";
7
- import { A as listField, O as field, T as rowName, h as listResource, p as listApplications, s as createProduct, y as platformLabel } from "./resources-BaURbSpY.js";
8
- import "./orgs-ltP8H0Nl.js";
9
- import { n as ui } from "./ui-hFgji1e8.js";
10
- import { n as withSpinner } from "./spinner-Dcr-Dqdi.js";
11
- import "./org-BV8wwxwc.js";
12
- import { a as resolveScopeFromKey, i as resolveAppBinding, r as platformForIntegration } from "./theme-BrUrye-c.js";
13
- import "./lookup-DkcT4E-5.js";
14
- import { a as runAction, d as superwallDriver, f as selectHostedStatus, l as detectDrivers, n as stripReport, p as copyToClipboard, s as buildCopyPrompt, t as detectExisting, u as AGENT_SDK_INSTALL_MESSAGE } from "./existing-BQMB_2AG.js";
15
- import { r as expandHome } from "./paths-Cb1RfjaX.js";
16
- import "./login-BMHDhxAx.js";
1
+ import "./token-SEWilQo9.js";
2
+ import { f as formatJson, i as removeSession, n as readSession, s as sessionOrgName, u as blocks } from "./storage-D0Q4xBi-.js";
3
+ import { d as DASHBOARD_URL, x as VERSION } from "./environment-BQiaGqjB.js";
4
+ import { S as superwallApi, i as readOnboardedApp } from "./config-CJRNScT0.js";
5
+ import { S as updateTelemetryTags, s as ensureSkillsCurrent } from "./skills-C1ku2pgy.js";
6
+ import { n as SUPPORTED_LABEL, t as scanProject } from "./scan-CtYVCqDS.js";
7
+ import { i as field, n as ui, o as listField } from "./ui-Dye-QvEj.js";
8
+ import "./orgs-Df8DzIav.js";
9
+ import { T as rowName, h as listResource, p as listApplications, s as createProduct, y as platformLabel } from "./resources-BeXleviK.js";
10
+ import { n as withSpinner } from "./spinner-hTCJZAoJ.js";
11
+ import "./org-0KDPRSlc.js";
12
+ import { a as resolveScopeFromKey, i as resolveAppBinding, r as platformForIntegration } from "./theme-Bvv0yrk_.js";
13
+ import "./lookup-CHLrO7v7.js";
14
+ import { a as runAction, d as superwallDriver, f as selectHostedStatus, l as detectDrivers, n as stripReport, p as copyToClipboard, s as buildCopyPrompt, t as detectExisting, u as AGENT_SDK_INSTALL_MESSAGE } from "./existing-Cxg_gSN1.js";
15
+ import { r as expandHome } from "./paths-B4FNcaHO.js";
16
+ import "./login-Oo2NWLlX.js";
17
17
  import "./browser-BVjaf98V.js";
18
- import { n as performLoginWithUi, t as createLoginGate } from "./login-B7IqDafm.js";
19
- import "./scope-DDYLQeZw.js";
18
+ import { n as performLoginWithUi, t as createLoginGate } from "./login-CvzBt9eM.js";
19
+ import "./input-ApyzIzVy.js";
20
20
  import { a as listAscConfigs, r as createAscConfig } from "./client-BwYhzITp.js";
21
21
  import { i as listUnimportedAscProducts, n as findAscAppId, r as listAscApps, t as ascTypeDisplay } from "./products-CJq_iXv5.js";
22
- import "./input-DOT_2Zvb.js";
23
- import { n as generateStoreKit, t as describeSkipped } from "./storekit-De998QOt.js";
24
- import { r as actionById, t as detectBilling } from "./billing-C1LV4-BN.js";
25
- import { n as writeReport, t as readReport } from "./reports-hbxsd3Zo.js";
22
+ import { n as generateStoreKit, t as describeSkipped } from "./storekit-TLBxGIrN.js";
23
+ import { r as actionById, t as detectBilling } from "./billing-CFGrG-WZ.js";
24
+ import { n as writeReport, t as readReport } from "./reports-CJQ-8sj4.js";
26
25
  import { readFileSync, writeFileSync } from "node:fs";
27
26
  import { basename } from "node:path";
28
27
  import fg from "fast-glob";
@@ -0,0 +1,13 @@
1
+ import "./token-SEWilQo9.js";
2
+ import "./storage-D0Q4xBi-.js";
3
+ import "./environment-BQiaGqjB.js";
4
+ import "./config-CJRNScT0.js";
5
+ import "./skills-C1ku2pgy.js";
6
+ import "./scan-CtYVCqDS.js";
7
+ import "./ui-Dye-QvEj.js";
8
+ import "./spinner-hTCJZAoJ.js";
9
+ import "./paths-B4FNcaHO.js";
10
+ import { i as startLogin, n as pollLogin, r as runLogin, t as performLogin } from "./login-Oo2NWLlX.js";
11
+ import "./browser-BVjaf98V.js";
12
+
13
+ export { performLogin, pollLogin, runLogin, startLogin };
@@ -1,5 +1,5 @@
1
- import { n as ui } from "./ui-hFgji1e8.js";
2
- import { a as onboardingHooks, t as performLogin } from "./login-BMHDhxAx.js";
1
+ import { n as ui } from "./ui-Dye-QvEj.js";
2
+ import { a as onboardingHooks, t as performLogin } from "./login-Oo2NWLlX.js";
3
3
  import { t as BROWSER_UNAVAILABLE } from "./browser-BVjaf98V.js";
4
4
 
5
5
  //#region src/core/workflows/login.ts
@@ -1,10 +1,10 @@
1
- import { c as writePendingLogin, l as writeSession, o as serializeSession, r as removePendingLogin, t as readPendingLogin } from "./storage-DdIAHolY.js";
2
- import { g as OAUTH_SCOPE, h as Integration, i as AUTH_HOST, l as CLI_CLIENT_ID, t as API_HOST } from "./environment-Dn7irhZr.js";
3
- import { a as readOnboardedOrg, m as writeOnboardedOrg, o as readOnboardingIdempotencyKey, p as writeOnboardedApp } from "./config-DCqRQTJ4.js";
4
- import { s as ensureSkillsCurrent, x as track } from "./skills-DnegE1A6.js";
5
- import { t as scanProject } from "./scan-DugxddUU.js";
6
- import { n as ui } from "./ui-hFgji1e8.js";
7
- import { r as UsageError } from "./spinner-Dcr-Dqdi.js";
1
+ import { c as writePendingLogin, l as writeSession, o as serializeSession, r as removePendingLogin, t as readPendingLogin } from "./storage-D0Q4xBi-.js";
2
+ import { g as OAUTH_SCOPE, h as Integration, i as AUTH_HOST, l as CLI_CLIENT_ID, t as API_HOST } from "./environment-BQiaGqjB.js";
3
+ import { a as readOnboardedOrg, m as writeOnboardedOrg, o as readOnboardingIdempotencyKey, p as writeOnboardedApp } from "./config-CJRNScT0.js";
4
+ import { s as ensureSkillsCurrent, x as track } from "./skills-C1ku2pgy.js";
5
+ import { t as scanProject } from "./scan-CtYVCqDS.js";
6
+ import { n as ui } from "./ui-Dye-QvEj.js";
7
+ import { r as UsageError } from "./spinner-hTCJZAoJ.js";
8
8
  import { n as openBrowser, t as BROWSER_UNAVAILABLE } from "./browser-BVjaf98V.js";
9
9
  import { setTimeout } from "node:timers/promises";
10
10
 
@@ -1,6 +1,6 @@
1
- import { y as ApiError } from "./config-DCqRQTJ4.js";
2
- import { m as listProjects } from "./resources-BaURbSpY.js";
3
- import { a as orgProjects, s as rememberOrg } from "./orgs-ltP8H0Nl.js";
1
+ import { y as ApiError } from "./config-CJRNScT0.js";
2
+ import { a as orgProjects, s as rememberOrg } from "./orgs-Df8DzIav.js";
3
+ import { m as listProjects } from "./resources-BeXleviK.js";
4
4
 
5
5
  //#region src/core/api/lookup.ts
6
6
  const DASHBOARD_PATH = /^\/(\d+)(?:\/(\d+))?(?:\/|$)/;