@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,21 +1,21 @@
1
- import { i as NotLoggedInError } from "./token-CKCBQ4I8.js";
2
- import { f as formatJson, h as cache, m as stripAnsi, n as readSession, u as blocks, v as readJson } from "./storage-DdIAHolY.js";
3
- import { o as AUTO_UPDATE_TARGET, s as CHANNEL, t as API_HOST, v as TELEMETRY_HOST, w as detectAgent, x as VERSION, y as TELEMETRY_KEY } from "./environment-Dn7irhZr.js";
4
- import { C as withQuery$1, b as ApiUnreachableError, f as writeDefaultApp, i as readOnboardedApp, r as readDefaultApp, t as readAnonymousId, y as ApiError } from "./config-DCqRQTJ4.js";
5
- import { C as listKeySources, S as listBundleIdSuggestions, T as replaceRevenueProvider, _ as checkServerNotifications, b as importAppKey, c as resolveAscOrgApi, d as runAscDocs, f as parseParams, h as REVENUE_INTEGRATIONS, i as savedKey, l as resolveAscTeam, m as KEY_LABEL, n as testModeWarning, p as KEY_KINDS, r as chooseKeyApp, t as upsertHeldKey, u as sendAscRequest, v as copyAppKey, w as removeAppKey, x as keyKind, y as findIntegrations } from "./held-D5wSX2Mf.js";
6
- import { M as textField, O as field, T as rowName, a as createEntitlement, c as createProject, h as listResource, i as createCampaign, j as parseJson, k as isRecord, m as listProjects, r as createApplication, s as createProduct, t as RESOURCES, u as isAppScoped, y as platformLabel } from "./resources-BaURbSpY.js";
7
- import { i as orgIdOf, t as listOrgGroups } from "./orgs-ltP8H0Nl.js";
8
- import { a as defineCommand, d as readInput, i as defineCatalog, r as UsageError, t as apiCall } from "./spinner-Dcr-Dqdi.js";
9
- import { n as orgForNewProject } from "./org-BV8wwxwc.js";
10
- import { n as fg, r as platformForIntegration, t as THEME } from "./theme-BrUrye-c.js";
11
- import { a as parseDashboardUrl, i as findProject, n as findApplication, t as appNotFound } from "./lookup-DkcT4E-5.js";
12
- import { n as runWhoami } from "./session-B7frlXXQ.js";
13
- import { a as pickScope, i as pickProject, n as chooseApp, r as pickOrganization, t as boundOrganization } from "./scope-DDYLQeZw.js";
1
+ import { i as NotLoggedInError } from "./token-SEWilQo9.js";
2
+ import { h as cache, m as stripAnsi, n as readSession, v as readJson } from "./storage-D0Q4xBi-.js";
3
+ import { o as AUTO_UPDATE_TARGET, s as CHANNEL, t as API_HOST, v as TELEMETRY_HOST, w as detectAgent, x as VERSION, y as TELEMETRY_KEY } from "./environment-BQiaGqjB.js";
4
+ import { C as withQuery$1, b as ApiUnreachableError, i as readOnboardedApp, t as readAnonymousId, y as ApiError } from "./config-CJRNScT0.js";
5
+ import { A as KEY_LABEL, B as removeAppKey, C as renderRows, D as useApp, E as list, F as findIntegrations, I as importAppKey, L as keyKind, N as checkServerNotifications, O as parseParams, P as copyAppKey, R as listBundleIdSuggestions, S as textOf$1, T as rowsOf, V as replaceRevenueProvider, _ as listOf$1, b as requireNumber, c as resolveAscOrgApi, d as sendAscRequest, f as runAscDocs, g as booleanOf, h as argOf, i as savedKey, j as REVENUE_INTEGRATIONS, k as KEY_KINDS, l as resolveAscTeam, m as printAscPlan, n as testModeWarning, p as printAscOutput, r as chooseKeyApp, t as upsertHeldKey, u as runAscWrite, v as numberOf, w as renderValue, x as requireText, y as plural, z as listKeySources } from "./held-CmvNRCRD.js";
6
+ import { a as isRecord, c as textField, i as field, o as listField, s as parseJson } from "./ui-Dye-QvEj.js";
7
+ import { i as orgIdOf, t as listOrgGroups } from "./orgs-Df8DzIav.js";
8
+ import { T as rowName, a as createEntitlement, c as createProject, h as listResource, i as createCampaign, m as listProjects, r as createApplication, s as createProduct, t as RESOURCES, u as isAppScoped, y as platformLabel } from "./resources-BeXleviK.js";
9
+ import { a as defineCommand, d as readInput, h as statusOf, i as defineCatalog, m as describeAppleError$1, p as AscRequestError, r as UsageError, t as apiCall } from "./spinner-hTCJZAoJ.js";
10
+ import { n as orgForNewProject } from "./org-0KDPRSlc.js";
11
+ import { n as fg, r as platformForIntegration, t as THEME } from "./theme-Bvv0yrk_.js";
12
+ import { a as parseDashboardUrl, i as findProject, n as findApplication, t as appNotFound } from "./lookup-CHLrO7v7.js";
13
+ import { n as runWhoami } from "./session-BpLOLurZ.js";
14
+ import { c as pickScope, i as boundOrganization, n as readResourceFlags, o as pickOrganization, r as textOf, t as fieldName } from "./input-ApyzIzVy.js";
14
15
  import { a as listAscConfigs, i as findAppNotificationUrl, o as removeAscConfig, t as ascProxy } from "./client-BwYhzITp.js";
15
16
  import { i as listUnimportedAscProducts, n as findAscAppId, r as listAscApps, t as ascTypeDisplay } from "./products-CJq_iXv5.js";
16
- import { n as readResourceFlags, r as textOf, t as fieldName } from "./input-DOT_2Zvb.js";
17
- import { t as timing } from "./timing-BKEEIBij.js";
18
- import { a as runAscNotificationUrlSet, i as printServerNotifications, t as describeNotificationUrl } from "./notification-url-D6KKeXnk.js";
17
+ import { t as timing } from "./timing-m0ZUzYiP.js";
18
+ import { a as runAscNotificationUrlSet, i as printServerNotifications, t as describeNotificationUrl } from "./notification-url-Dpx0pbYs.js";
19
19
  import pc from "picocolors";
20
20
 
21
21
  //#region src/ui/help-layout.ts
@@ -142,7 +142,7 @@ const command = defineCommand({
142
142
  prompts: true,
143
143
  mcp: false,
144
144
  async run(ctx, input) {
145
- const { runLogin } = await import("./login-Cp0-BgDZ.js");
145
+ const { runLogin } = await import("./login-Cnt3UZKV.js");
146
146
  return runLogin(ctx, input);
147
147
  }
148
148
  });
@@ -158,7 +158,7 @@ const command$1 = defineCommand({
158
158
  prompts: true,
159
159
  mcp: false,
160
160
  async run(ctx) {
161
- const { runLogout } = await import("./session-DvaPyOuH.js");
161
+ const { runLogout } = await import("./session-BatiAUPQ.js");
162
162
  return runLogout(ctx);
163
163
  }
164
164
  });
@@ -345,7 +345,7 @@ The backend forces SQL to readonly=1. Before executing SQL it may provision a Cl
345
345
  //#endregion
346
346
  //#region src/core/api/reference.ts
347
347
  const REFRESH_TTL_MS = 1440 * 60 * 1e3;
348
- const MAX_DEPTH$1 = 3;
348
+ const MAX_DEPTH = 3;
349
349
  const SEARCH_HITS = 40;
350
350
  const METHODS = [
351
351
  "GET",
@@ -355,46 +355,79 @@ const METHODS = [
355
355
  "DELETE"
356
356
  ];
357
357
  const specUrl = () => `${API_HOST()}/openapi.json`;
358
- const CACHE_FILE = "api-index.json";
359
- function typeOf(schema) {
360
- if (!schema) return "any";
358
+ const API_CACHE_FILE = "api-reference.json";
359
+ function resolve(schema, refs, seen) {
360
+ if (typeof schema?.$ref !== "string") return {
361
+ schema,
362
+ seen
363
+ };
364
+ const name = schema.$ref.slice(schema.$ref.lastIndexOf("/") + 1);
365
+ if (seen.has(name)) return {
366
+ schema: void 0,
367
+ seen,
368
+ cycle: name
369
+ };
370
+ const siblings = Object.fromEntries(Object.entries(schema).filter(([key]) => key !== "$ref"));
371
+ return resolve({
372
+ ...refs[name],
373
+ ...siblings
374
+ }, refs, new Set([...seen, name]));
375
+ }
376
+ function typeParts(raw, refs, from = /* @__PURE__ */ new Set()) {
377
+ const { schema, seen, cycle } = resolve(raw, refs, from);
378
+ if (cycle) return [cycle];
379
+ if (!schema) return ["any"];
361
380
  const options = schema.anyOf ?? schema.oneOf;
362
- if (options) {
363
- const parts = options.map(typeOf);
364
- return [...new Set(parts)].join(" | ");
365
- }
366
- if (schema.enum) return schema.enum.map((value$1) => JSON.stringify(value$1)).join(" | ");
367
- if (schema.const !== void 0) return JSON.stringify(schema.const);
368
- if (schema.type === "array") return `${typeOf(schema.items)}[]`;
369
- if (Array.isArray(schema.type)) return schema.type.join(" | ");
370
- return schema.type ?? (schema.properties ? "object" : "any");
371
- }
372
- function objectOf$1(schema) {
381
+ if (options) return [...new Set(options.flatMap((option) => typeParts(option, refs, seen)))];
382
+ if (schema.enum) return schema.enum.map((value$1) => JSON.stringify(value$1));
383
+ if (schema.const !== void 0) return [JSON.stringify(schema.const)];
384
+ if (schema.type === "array") return [`${typeParts(schema.items, refs, seen).join(" | ")}[]`];
385
+ if (Array.isArray(schema.type)) return schema.type;
386
+ return [schema.type ?? (schema.properties ? "object" : "any")];
387
+ }
388
+ const typeOf = (schema, refs) => typeParts(schema, refs).join(" | ");
389
+ function objectsOf(raw, refs, from = /* @__PURE__ */ new Set()) {
390
+ const { schema, seen } = resolve(raw, refs, from);
391
+ if (!schema) return [];
392
+ if (schema.properties) return [schema];
393
+ if (schema.type === "array") return objectsOf(schema.items, refs, seen);
394
+ return (schema.anyOf ?? schema.oneOf ?? []).flatMap((option) => objectsOf(option, refs, seen));
395
+ }
396
+ function exampleOf(raw, refs, from = /* @__PURE__ */ new Set()) {
397
+ const { schema, seen } = resolve(raw, refs, from);
373
398
  if (!schema) return void 0;
374
- if (schema.properties) return schema;
375
- if (schema.type === "array") return objectOf$1(schema.items);
399
+ if (Array.isArray(schema.examples) && schema.examples.length) return schema.examples[0];
400
+ if (schema.example !== void 0) return schema.example;
376
401
  for (const option of schema.anyOf ?? schema.oneOf ?? []) {
377
- const found = objectOf$1(option);
378
- if (found) return found;
379
- }
380
- }
381
- function fieldsOf$1(schema, depth = 0) {
382
- const object = objectOf$1(schema);
383
- if (!object?.properties || depth >= MAX_DEPTH$1) return void 0;
384
- const required = new Set(object.required ?? []);
385
- return Object.entries(object.properties).map(([name, field$1]) => {
386
- const nested = fieldsOf$1(field$1, depth + 1);
402
+ const example = exampleOf(option, refs, seen);
403
+ if (example !== void 0) return example;
404
+ }
405
+ }
406
+ function mergedType(schemas, refs) {
407
+ return [...new Set(schemas.flatMap((schema) => typeParts(schema, refs)))].join(" | ");
408
+ }
409
+ function fieldsOf$1(schema, refs, depth = 0) {
410
+ const objects = objectsOf(schema, refs);
411
+ if (!objects.length || depth >= MAX_DEPTH) return void 0;
412
+ const branches = /* @__PURE__ */ new Map();
413
+ for (const object of objects) for (const [name, field$1] of Object.entries(object.properties)) branches.set(name, [...branches.get(name) ?? [], field$1]);
414
+ return [...branches].map(([name, schemas]) => {
415
+ const nested = fieldsOf$1(schemas.length === 1 ? schemas[0] : { anyOf: schemas }, refs, depth + 1);
416
+ const description = schemas.map((field$1) => resolve(field$1, refs, /* @__PURE__ */ new Set()).schema?.description).find(Boolean);
417
+ const example = schemas.map((field$1) => exampleOf(field$1, refs)).find((value$1) => value$1 !== void 0);
387
418
  return {
388
419
  name,
389
- type: typeOf(field$1),
390
- required: required.has(name),
391
- ...field$1.description ? { description: oneLine(field$1.description) } : {},
420
+ type: mergedType(schemas, refs),
421
+ required: objects.every((object) => (object.required ?? []).includes(name)),
422
+ ...description ? { description: oneLine(description) } : {},
423
+ ...example !== void 0 ? { example } : {},
392
424
  ...nested ? { fields: nested } : {}
393
425
  };
394
426
  });
395
427
  }
396
428
  const oneLine = (text) => text.replace(/\s+/g, " ").trim();
397
429
  function deriveApiIndex(spec) {
430
+ const refs = spec.components?.schemas ?? {};
398
431
  const operations = [];
399
432
  for (const [path, item] of Object.entries(spec.paths ?? {})) {
400
433
  if (path.includes("/internal")) continue;
@@ -409,7 +442,7 @@ function deriveApiIndex(spec) {
409
442
  if (!op$1) continue;
410
443
  const description = op$1.description ? oneLine(op$1.description) : void 0;
411
444
  const success = Object.entries(op$1.responses ?? {}).find(([code]) => code.startsWith("2"))?.[1];
412
- const returned = objectOf$1(success?.content?.["application/json"]?.schema);
445
+ const returned = objectsOf(success?.content?.["application/json"]?.schema, refs);
413
446
  const scope = description?.match(/Requires ([a-z_]+:[a-z]+) scope/)?.[1];
414
447
  operations.push({
415
448
  method: method.toUpperCase(),
@@ -422,13 +455,13 @@ function deriveApiIndex(spec) {
422
455
  return {
423
456
  name: param.name,
424
457
  in: param.in,
425
- type: typeOf(param.schema),
458
+ type: typeOf(param.schema, refs),
426
459
  required: Boolean(param.required),
427
460
  ...param.description ? { description: oneLine(param.description) } : {}
428
461
  };
429
462
  }),
430
- ...op$1.requestBody ? { body: fieldsOf$1(op$1.requestBody.content?.["application/json"]?.schema) ?? [] } : {},
431
- returns: Object.keys(returned?.properties ?? {})
463
+ ...op$1.requestBody ? { body: fieldsOf$1(op$1.requestBody.content?.["application/json"]?.schema, refs) ?? [] } : {},
464
+ returns: [...new Set(returned.flatMap((object) => Object.keys(object.properties)))]
432
465
  });
433
466
  }
434
467
  }
@@ -451,10 +484,10 @@ async function downloadApiIndex(timeoutMs = DOWNLOAD_TIMEOUT_MS) {
451
484
  return deriveApiIndex(await res.json());
452
485
  }
453
486
  function readCached() {
454
- return readJson(cache(), CACHE_FILE);
487
+ return readJson(cache(), API_CACHE_FILE);
455
488
  }
456
489
  function writeCached(index) {
457
- cache().write(CACHE_FILE, JSON.stringify(index));
490
+ cache().write(API_CACHE_FILE, JSON.stringify(index));
458
491
  }
459
492
  let inFlight;
460
493
  async function resolveApiIndex(opts = {}) {
@@ -497,6 +530,9 @@ function matchesPath(template, concrete) {
497
530
  const c = segments(concretePath);
498
531
  return t.length === c.length && t.every((part, i) => part.startsWith("{") || part === c[i]);
499
532
  }
533
+ function mentionsField(fields, word) {
534
+ return (fields ?? []).some((field$1) => field$1.name.toLowerCase().includes(word) || Boolean(field$1.description?.toLowerCase().includes(word)) || mentionsField(field$1.fields, word));
535
+ }
500
536
  function score(op$1, terms) {
501
537
  let total = 0;
502
538
  for (const term of terms) {
@@ -506,6 +542,7 @@ function score(op$1, terms) {
506
542
  if (op$1.path.toLowerCase().includes(word)) return 3;
507
543
  if (op$1.group.toLowerCase().includes(word)) return 2;
508
544
  if (op$1.description?.toLowerCase().includes(word)) return 1;
545
+ if (mentionsField(op$1.body, word)) return .5;
509
546
  return 0;
510
547
  }));
511
548
  if (best === 0) return 0;
@@ -528,7 +565,11 @@ function findOperations(index, path, method) {
528
565
  const line = (op$1) => `${op$1.method.padEnd(6)} ${op$1.path} — ${op$1.summary}`;
529
566
  function renderFields(fields, indent = " ") {
530
567
  return fields.flatMap((field$1) => {
531
- return [`${indent}${field$1.name}${field$1.required ? "" : "?"}: ${field$1.type}${field$1.description ? ` — ${field$1.description}` : ""}`, ...renderFields(field$1.fields ?? [], `${indent} `)];
568
+ return [
569
+ `${indent}${field$1.name}${field$1.required ? "" : "?"}: ${field$1.type}${field$1.description ? ` — ${field$1.description}` : ""}`,
570
+ ...field$1.example !== void 0 ? [`${indent} Example: ${JSON.stringify(field$1.example)}`] : [],
571
+ ...renderFields(field$1.fields ?? [], `${indent} `)
572
+ ];
532
573
  });
533
574
  }
534
575
  function renderOperation(op$1, commandFor) {
@@ -595,10 +636,11 @@ async function runApiRequest(ctx, api, request) {
595
636
  const { verb, path } = request;
596
637
  if (!path.startsWith("/")) throw new Error(`Path must start with "/", e.g. /v2/products`);
597
638
  const params = parseParams(request.data);
639
+ const deletion = verb === "delete" ? await splitDeleteParams(path, params) : void 0;
598
640
  const res = await apiCall(ctx, `${verb.toUpperCase()} ${path}`, () => {
599
641
  switch (verb) {
600
642
  case "get": return api.get(withQuery$1(path, params));
601
- case "delete": return api.del(withQuery$1(path, params));
643
+ case "delete": return api.del(withQuery$1(path, deletion?.query ?? params), deletion?.body ? { body: deletion.body } : {});
602
644
  case "post": return api.post(path, params);
603
645
  case "put": return api.put(path, params);
604
646
  case "patch": return api.patch(path, params);
@@ -610,6 +652,20 @@ async function runApiRequest(ctx, api, request) {
610
652
  });
611
653
  ctx.output.data(res ?? { ok: true });
612
654
  }
655
+ async function splitDeleteParams(path, params) {
656
+ if (Object.keys(params).length === 0) return { query: params };
657
+ const index = await resolveApiIndex().catch(() => void 0);
658
+ const [op$1] = index ? findOperations(index, path, "DELETE") : [];
659
+ if (!op$1?.body) return { query: params };
660
+ const queryNames = new Set(op$1.params.filter((param) => param.in === "query").map((param) => param.name));
661
+ const query$1 = {};
662
+ const body = {};
663
+ for (const [key, value$1] of Object.entries(params)) (queryNames.has(key) ? query$1 : body)[key] = value$1;
664
+ return Object.keys(body).length > 0 ? {
665
+ query: query$1,
666
+ body
667
+ } : { query: query$1 };
668
+ }
613
669
  const namesMissingResource = ({ status, detail }) => status === 404 && (detail.code === "resource_missing" || detail.type === "resource_missing" || detail.resourceType !== void 0);
614
670
  async function resolveReferenceHint(verb, path) {
615
671
  const index = await resolveApiIndex().catch(() => void 0);
@@ -649,7 +705,7 @@ const command$4 = defineCommand({
649
705
  //#endregion
650
706
  //#region src/core/api/commands.ts
651
707
  async function resolveCommandLookup() {
652
- const { listGroups: listGroups$1 } = await import("./registry-BGEYCWyD.js");
708
+ const { listGroups: listGroups$1 } = await import("./registry-DGHTk7l-.js");
653
709
  const catalogs = listGroups$1().flatMap((group$1) => group$1.commands.flatMap((command$83) => command$83.kind === "catalog" && command$83.commandFor ? [command$83.commandFor] : []));
654
710
  return (endpoint) => {
655
711
  for (const commandFor of catalogs) {
@@ -980,24 +1036,6 @@ function placeholder(name) {
980
1036
  function isPlaceholder(value$1) {
981
1037
  return value$1.includes("${");
982
1038
  }
983
- function describeAppleError$1(error) {
984
- const parsed = error.body ? parseJson(error.body) : void 0;
985
- const errors = isRecord(parsed) && Array.isArray(parsed.errors) ? parsed.errors.filter(isRecord) : [];
986
- if (errors.length === 0) return void 0;
987
- const lines = errors.map((entry) => {
988
- return ` • ${typeof entry.detail === "string" ? entry.detail : String(entry.title ?? entry.code ?? "")}${isRecord(entry.source) && typeof entry.source.pointer === "string" ? ` (${entry.source.pointer})` : ""}`;
989
- });
990
- return `App Store Connect refused ${error.request.replace(/^(\w+) \/v2\/organizations\/[^/]+\/app-store-connect\/proxy\/[^/]+/, "$1 ")} (${error.status}):\n${lines.join("\n")}`;
991
- }
992
- var AscRequestError = class extends Error {
993
- constructor(message, status) {
994
- super(message);
995
- this.status = status;
996
- }
997
- };
998
- function statusOf(error) {
999
- return error instanceof ApiError || error instanceof AscRequestError ? error.status : void 0;
1000
- }
1001
1039
  var AscSession = class {
1002
1040
  planned = [];
1003
1041
  created = [];
@@ -1122,296 +1160,6 @@ async function assertConfirmed(session, yes$1, what) {
1122
1160
  }) !== "yes") throw new Error("Cancelled. Nothing was changed.");
1123
1161
  }
1124
1162
 
1125
- //#endregion
1126
- //#region src/core/main/list.ts
1127
- async function list(context, api, resource, flags) {
1128
- const { json } = context;
1129
- if (resource === "apps") {
1130
- const query$2 = flags.search;
1131
- let room = limitOf(flags.limit) ?? Number.POSITIVE_INFINITY;
1132
- const groups = (await apiCall(context, "Loading projects", () => listOrgGroups(api))).map((group$1) => {
1133
- const projects = matchingProjects(group$1.projects, query$2).slice(0, room);
1134
- room -= projects.length;
1135
- return {
1136
- ...group$1,
1137
- projects
1138
- };
1139
- }).filter((group$1) => group$1.projects.length > 0 || !query$2 && room > 0);
1140
- if (json) return context.output.data(groups.flatMap(({ projects,...organization }) => projects.map((project$1) => organization.id ? {
1141
- ...project$1,
1142
- organization
1143
- } : project$1)));
1144
- if (groups.flatMap((group$1) => group$1.projects).length === 0) return context.output.render(blocks.list({
1145
- items: [],
1146
- empty: query$2 ? `No project or app matches "${query$2}".` : "No projects yet - run `superwall apps create --name <name> --platform ios`."
1147
- }));
1148
- for (const group$1 of groups) {
1149
- const heading$1 = groups.length > 1 ? `\`${group$1.name ?? `Organization ${group$1.id}`}\`${group$1.member ? "" : " (not a member)"} · ${formatCount(group$1.projects.length, "project")}` : formatCount(group$1.projects.length, "project");
1150
- context.output.render(blocks.step(heading$1), blocks.list({ items: group$1.projects.map((project$1) => ({
1151
- label: project$1.name ?? String(project$1.id),
1152
- meta: String(project$1.id),
1153
- children: (project$1.applications ?? []).map((app$1) => ({
1154
- badge: platformLabel(app$1.platform),
1155
- label: app$1.bundle_id ?? app$1.name ?? "",
1156
- meta: `${app$1.id}${app$1.public_api_key ? ` pk_…${app$1.public_api_key.slice(-4)}` : ""}`
1157
- }))
1158
- })) }));
1159
- }
1160
- return;
1161
- }
1162
- const scope = await pickScope(context, api, isAppScoped(resource));
1163
- const all = await apiCall(context, `Loading ${resource}`, () => listResource(api, resource, scope));
1164
- const query$1 = flags.search;
1165
- const matched = query$1 ? all.filter((row) => rowMatches(row, query$1)) : all;
1166
- const limit = limitOf(flags.limit);
1167
- if (json) return context.output.data(limit === void 0 ? matched : matched.slice(0, limit));
1168
- const shown = matched.slice(0, limit ?? RICH_ROWS);
1169
- const noun = resource.replace(/s$/, "");
1170
- const heading = query$1 ? `${formatCount(matched.length, noun)} matching "${query$1}", of ${all.length}` : formatCount(all.length, noun);
1171
- context.output.render(blocks.step(`${heading}${scopeLabel(resource, scope)}`), blocks.list({
1172
- items: shown.map((row) => {
1173
- const label = rowName(row);
1174
- const identifier = typeof row.identifier === "string" ? row.identifier : void 0;
1175
- return {
1176
- label,
1177
- meta: [identifier && identifier !== label ? identifier : void 0, secondaryId(label, row.id)].filter(Boolean).join(" ") || void 0
1178
- };
1179
- }),
1180
- empty: query$1 ? `No ${resource} match "${query$1}".` : `No ${resource} yet.`
1181
- }));
1182
- 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.`);
1183
- }
1184
- async function useApp(context, api, value$1) {
1185
- const projects = await apiCall(context, "Loading projects", () => listProjects(api));
1186
- const target = textOf(value$1);
1187
- let app$1;
1188
- let projectId;
1189
- if (target) {
1190
- const found = await apiCall(context, "Finding the app", () => findApplication(api, target, projects));
1191
- if (!found) throw appNotFound(target);
1192
- app$1 = found.app;
1193
- projectId = String(found.project.id);
1194
- } else if (!context.interactive) throw new Error("Specify an app: superwall apps use <id|name|dashboard link>");
1195
- else {
1196
- const project$1 = await pickProject(context, api, projects);
1197
- const apps = project$1.applications ?? [];
1198
- const [first] = apps;
1199
- if (!first) throw new Error(`${project$1.name ?? project$1.id} has no apps yet.`);
1200
- projectId = String(project$1.id);
1201
- app$1 = await chooseApp(context, apps, apps.find((candidate) => String(candidate.id) === readDefaultApp(projectId)) ?? first);
1202
- }
1203
- writeDefaultApp(projectId, String(app$1.id));
1204
- if (context.json) return context.output.data(app$1);
1205
- context.ui.success(`Default app set to \`${app$1.name ?? app$1.id}\` (${platformLabel(app$1.platform)})`);
1206
- }
1207
- function secondaryId(label, id$1) {
1208
- const value$1 = String(id$1 ?? "");
1209
- return value$1 && value$1 !== label ? value$1 : void 0;
1210
- }
1211
- function formatCount(value$1, noun) {
1212
- return `${value$1} ${noun}${value$1 === 1 ? "" : "s"}`;
1213
- }
1214
- function scopeLabel(resource, scope) {
1215
- const parts = [];
1216
- if (scope.projectCount > 1 && scope.projectName) parts.push(scope.projectName);
1217
- if (isAppScoped(resource) && scope.appCount > 1 && scope.appName) parts.push(`${scope.appName} (${platformLabel(scope.appPlatform)})`);
1218
- return parts.length ? ` in \`${parts.join(" · ")}\`` : "";
1219
- }
1220
- const RICH_ROWS = 50;
1221
- function limitOf(value$1) {
1222
- if (value$1 === void 0) return void 0;
1223
- const n = Number(value$1);
1224
- if (!Number.isInteger(n) || n < 1) throw new Error("--limit takes a whole number above 0.");
1225
- return n;
1226
- }
1227
- const SEARCHED_FIELDS = [
1228
- "id",
1229
- "name",
1230
- "identifier",
1231
- "bundle_id",
1232
- "description",
1233
- "public_api_key"
1234
- ];
1235
- function rowMatches(row, query$1) {
1236
- const needle = query$1.toLowerCase();
1237
- return Object.entries(row).some(([field$1, value$1]) => {
1238
- return SEARCHED_FIELDS.includes(field$1) && (typeof value$1 === "string" || typeof value$1 === "number") && String(value$1).toLowerCase().includes(needle);
1239
- });
1240
- }
1241
- function matchingProjects(projects, query$1) {
1242
- if (!query$1) return projects;
1243
- return projects.flatMap((project$1) => {
1244
- if (rowMatches(project$1, query$1)) return [project$1];
1245
- const apps = (project$1.applications ?? []).filter((app$1) => rowMatches(app$1, query$1));
1246
- return apps.length ? [{
1247
- ...project$1,
1248
- applications: apps
1249
- }] : [];
1250
- });
1251
- }
1252
-
1253
- //#endregion
1254
- //#region src/core/main/views.ts
1255
- const INLINE_LIST = 72;
1256
- const LABEL_KEYS = [
1257
- "name",
1258
- "event_name",
1259
- "identifier",
1260
- "product_identifier",
1261
- "title",
1262
- "description",
1263
- "url"
1264
- ];
1265
- const NESTED_ROWS = 10;
1266
- const MAX_DEPTH = 2;
1267
- const isScalar = (value$1) => value$1 === null || typeof value$1 !== "object";
1268
- function scalar(value$1) {
1269
- if (value$1 === null || value$1 === void 0 || value$1 === "") return pc.dim("—");
1270
- if (typeof value$1 === "boolean") return value$1 ? pc.green("yes") : pc.dim("no");
1271
- return String(value$1);
1272
- }
1273
- function renderObject(value$1, indent = "", depth = 0) {
1274
- const keys = Object.keys(value$1).filter((key) => key !== "object");
1275
- const width = Math.max(0, ...keys.map((key) => key.length)) + 2;
1276
- const out = [];
1277
- for (const key of keys) {
1278
- const field$1 = value$1[key];
1279
- const label = `${indent}${pc.dim(key.padEnd(width))}`;
1280
- if (isScalar(field$1)) out.push(`${label}${scalar(field$1)}`);
1281
- else if (Array.isArray(field$1)) out.push(...renderArray(label, field$1, indent, depth));
1282
- else if (isRecord(field$1) && depth >= MAX_DEPTH) out.push(`${label}${pc.dim(`{ ${Object.keys(field$1).length} fields }`)}`);
1283
- else if (isRecord(field$1)) {
1284
- out.push(`${indent}${pc.dim(key)}`);
1285
- out.push(...renderObject(field$1, `${indent} `, depth + 1));
1286
- }
1287
- }
1288
- return out;
1289
- }
1290
- function renderArray(label, items, indent, depth) {
1291
- if (items.length === 0) return [`${label}${pc.dim("none")}`];
1292
- if (items.every(isScalar)) {
1293
- const joined = items.map(String).join(", ");
1294
- return [`${label}${joined.length <= INLINE_LIST ? joined : pc.dim(`${items.length} items`)}`];
1295
- }
1296
- const rows = items.filter(isRecord).slice(0, NESTED_ROWS);
1297
- const lines = [`${label}${pc.dim(`${items.length} item${items.length === 1 ? "" : "s"}`)}`];
1298
- if (depth >= MAX_DEPTH) return lines;
1299
- for (const row of rows) {
1300
- const name = labelOf(row);
1301
- const id$1 = row.id !== void 0 && String(row.id) !== name ? pc.dim(` ${row.id}`) : "";
1302
- lines.push(`${indent} · ${name}${id$1}`);
1303
- }
1304
- if (items.length > rows.length) lines.push(pc.dim(`${indent} … ${items.length - rows.length} more`));
1305
- return lines;
1306
- }
1307
- function labelOf(row) {
1308
- for (const key of LABEL_KEYS) {
1309
- const value$1 = row[key];
1310
- if (typeof value$1 === "string" && value$1) return value$1;
1311
- }
1312
- return rowName(row);
1313
- }
1314
- function rowsOf(response) {
1315
- if (Array.isArray(response)) return response;
1316
- if (isRecord(response)) {
1317
- for (const key of [
1318
- "data",
1319
- "items",
1320
- "results",
1321
- "users",
1322
- "events",
1323
- "attempts",
1324
- "versions"
1325
- ]) if (Array.isArray(response[key])) return response[key];
1326
- }
1327
- return response === void 0 || response === null ? [] : [response];
1328
- }
1329
- function renderRows(ctx, rows, noun, flags) {
1330
- const query$1 = flags.search;
1331
- const matched = query$1 ? rows.filter((row) => rowMatches(row, query$1)) : rows;
1332
- const limit = limitOf(flags.limit);
1333
- if (ctx.json) return ctx.output.data(matched.slice(0, limit));
1334
- const shown = matched.slice(0, limit ?? RICH_ROWS);
1335
- const count = `${matched.length} ${matched.length === 1 ? noun : `${noun}s`}`;
1336
- ctx.output.render(blocks.step(query$1 ? `${count} matching "${query$1}", of ${rows.length}` : count), blocks.list({
1337
- items: shown.map((row) => {
1338
- const label = labelOf(row);
1339
- return {
1340
- label,
1341
- meta: [row.identifier, row.id].filter((part) => part !== void 0 && part !== null && String(part) !== label).map(String).join(" ") || void 0
1342
- };
1343
- }),
1344
- empty: query$1 ? `Nothing matches "${query$1}".` : `No ${noun}s yet.`
1345
- }));
1346
- if (matched.length > shown.length) ctx.ui.info(`…${matched.length - shown.length} more. Narrow with --search, or pass --limit or --json.`);
1347
- }
1348
- function renderValue(ctx, value$1, heading) {
1349
- if (ctx.json) return ctx.output.data(value$1 ?? { ok: true });
1350
- if (heading) ctx.output.render(blocks.success(heading));
1351
- if (value$1 === void 0 || value$1 === null || value$1 === "") return;
1352
- if (isRecord(value$1)) return ctx.output.text(renderObject(value$1).join("\n"));
1353
- if (Array.isArray(value$1)) return ctx.output.text(renderArray("", value$1, "", 0).join("\n"));
1354
- ctx.output.text(String(value$1));
1355
- }
1356
-
1357
- //#endregion
1358
- //#region src/core/app-store-connect/resources/operation.ts
1359
- function textOf$1(input, key) {
1360
- const value$1 = input.flags[key];
1361
- return typeof value$1 === "string" ? value$1 : void 0;
1362
- }
1363
- function requireText(input, key) {
1364
- const value$1 = textOf$1(input, key);
1365
- if (value$1 === void 0) throw new Error(`Missing --${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}.`);
1366
- return value$1;
1367
- }
1368
- function numberOf(input, key) {
1369
- const value$1 = input.flags[key];
1370
- return typeof value$1 === "number" ? value$1 : void 0;
1371
- }
1372
- function requireNumber(input, key) {
1373
- const value$1 = numberOf(input, key);
1374
- if (value$1 === void 0) throw new Error(`Missing --${key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}.`);
1375
- return value$1;
1376
- }
1377
- function listOf$1(input, key) {
1378
- const value$1 = input.flags[key];
1379
- return Array.isArray(value$1) ? value$1.filter((item) => typeof item === "string") : [];
1380
- }
1381
- function booleanOf(input, key) {
1382
- const value$1 = input.flags[key];
1383
- return typeof value$1 === "boolean" ? value$1 : void 0;
1384
- }
1385
- function argOf(input, name) {
1386
- const value$1 = input.args[name];
1387
- if (value$1 === void 0) throw new Error(`Missing <${name}>.`);
1388
- return value$1;
1389
- }
1390
- function plural(count, noun) {
1391
- if (count === 1) return `${count} ${noun}`;
1392
- return `${count} ${noun.endsWith("y") ? `${noun.slice(0, -1)}ie` : noun}s`;
1393
- }
1394
-
1395
- //#endregion
1396
- //#region src/core/app-store-connect/resources/print.ts
1397
- function printAscPlan(ctx, planned) {
1398
- if (ctx.json) return ctx.output.data({
1399
- dryRun: true,
1400
- requests: planned
1401
- });
1402
- ctx.ui.success(`Dry run: nothing was changed. ${plural(planned.length, "request")}:`);
1403
- for (const request of planned) {
1404
- ctx.ui.step(`${request.method} ${request.path}`);
1405
- if (request.body !== void 0) ctx.output.text(formatJson(request.body));
1406
- }
1407
- }
1408
- function printAscOutput(ctx, output) {
1409
- if ("value" in output) return renderValue(ctx, output.value, output.heading);
1410
- if (ctx.json) return ctx.output.data(output.data);
1411
- ctx.ui.step(plural(output.rows.length, output.noun));
1412
- for (const row of output.rows) ctx.ui.info(`\`${row.label}\`${row.meta ? ` ${row.meta}` : ""}`);
1413
- }
1414
-
1415
1163
  //#endregion
1416
1164
  //#region src/core/app-store-connect/resources/tools.ts
1417
1165
  const snake$1 = (key) => key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`).replace(/-/g, "_");
@@ -2290,6 +2038,10 @@ const command$13 = defineCommand({
2290
2038
  required: true
2291
2039
  } },
2292
2040
  flags: {
2041
+ dryRun: {
2042
+ ...dryRun,
2043
+ describe: "Print the request it would send; send nothing"
2044
+ },
2293
2045
  team: {
2294
2046
  ...team,
2295
2047
  describe: "Apple team id, when your organization has several"
@@ -2306,12 +2058,12 @@ const command$13 = defineCommand({
2306
2058
  prompts: true,
2307
2059
  mcp: "destructive",
2308
2060
  async run(ctx, { args, flags }) {
2309
- const response = await sendAscRequest(ctx, "delete", args.path, {
2061
+ await runAscWrite(ctx, "delete", args.path, {
2310
2062
  data: [],
2311
2063
  team: flags.team,
2312
- force: false
2064
+ force: false,
2065
+ dryRun: flags.dryRun
2313
2066
  });
2314
- ctx.output.data(response);
2315
2067
  }
2316
2068
  });
2317
2069
 
@@ -2883,7 +2635,7 @@ async function failedCommitMessage(session, path, failure, label, replaced) {
2883
2635
  async function runScreenshotsUpload(session, input) {
2884
2636
  const { kind, id: id$1 } = resolveTarget(input, PRICED);
2885
2637
  const spec = SCREENSHOT[kind];
2886
- const { readScreenshotFile } = await import("./screenshot-file-Dix2Qynm.js");
2638
+ const { readScreenshotFile } = await import("./screenshot-file-CcqMLpL5.js");
2887
2639
  const file = readScreenshotFile(argOf(input, "file"));
2888
2640
  const existing = await selectScreenshot(session, kind, id$1);
2889
2641
  if (existing) await session.send("delete", `${spec.path}/${existing.id}`);
@@ -3595,7 +3347,7 @@ A purchase_key is for the app's bundle ID; an app with none gets --bundle-id sav
3595
3347
  prompts: true,
3596
3348
  mcp: false,
3597
3349
  async run(ctx, input) {
3598
- const { runAscKeysCreate } = await import("./create-CSHGZDfB.js");
3350
+ const { runAscKeysCreate } = await import("./create-C_kjQp0N.js");
3599
3351
  return runAscKeysCreate(ctx, input);
3600
3352
  }
3601
3353
  });
@@ -3982,7 +3734,7 @@ With --app it saves the key you hold on that app instead, as asc keys create --k
3982
3734
  prompts: true,
3983
3735
  mcp: false,
3984
3736
  async run(ctx, { args, flags }) {
3985
- const { upsertHeldKey: upsertHeldKey$1 } = await import("./held-Dmf5SR3p.js");
3737
+ const { upsertHeldKey: upsertHeldKey$1 } = await import("./held-CQMCqJMa.js");
3986
3738
  return upsertHeldKey$1(ctx, {
3987
3739
  action: "update",
3988
3740
  key: {
@@ -4351,6 +4103,10 @@ Executes an arbitrary App Store Connect PATCH through the signed proxy, with sch
4351
4103
  type: "boolean",
4352
4104
  describe: "Send the body as-is, without checking it against Apple's schema"
4353
4105
  },
4106
+ dryRun: {
4107
+ ...dryRun,
4108
+ describe: "Print the request it would send, its body checked; send nothing"
4109
+ },
4354
4110
  team: {
4355
4111
  ...team,
4356
4112
  describe: "Apple team id, when your organization has several"
@@ -4367,12 +4123,12 @@ Executes an arbitrary App Store Connect PATCH through the signed proxy, with sch
4367
4123
  prompts: true,
4368
4124
  mcp: "destructive",
4369
4125
  async run(ctx, { args, flags }) {
4370
- const response = await sendAscRequest(ctx, "patch", args.path, {
4126
+ await runAscWrite(ctx, "patch", args.path, {
4371
4127
  data: flags.d,
4372
4128
  team: flags.team,
4373
- force: flags.force
4129
+ force: flags.force,
4130
+ dryRun: flags.dryRun
4374
4131
  });
4375
- ctx.output.data(response);
4376
4132
  }
4377
4133
  });
4378
4134
 
@@ -4400,6 +4156,10 @@ Executes an arbitrary App Store Connect POST through the signed proxy, with sche
4400
4156
  type: "boolean",
4401
4157
  describe: "Send the body as-is, without checking it against Apple's schema"
4402
4158
  },
4159
+ dryRun: {
4160
+ ...dryRun,
4161
+ describe: "Print the request it would send, its body checked; send nothing"
4162
+ },
4403
4163
  team: {
4404
4164
  ...team,
4405
4165
  describe: "Apple team id, when your organization has several"
@@ -4416,12 +4176,12 @@ Executes an arbitrary App Store Connect POST through the signed proxy, with sche
4416
4176
  prompts: true,
4417
4177
  mcp: "destructive",
4418
4178
  async run(ctx, { args, flags }) {
4419
- const response = await sendAscRequest(ctx, "post", args.path, {
4179
+ await runAscWrite(ctx, "post", args.path, {
4420
4180
  data: flags.d,
4421
4181
  team: flags.team,
4422
- force: flags.force
4182
+ force: flags.force,
4183
+ dryRun: flags.dryRun
4423
4184
  });
4424
- ctx.output.data(response);
4425
4185
  }
4426
4186
  });
4427
4187
 
@@ -5234,7 +4994,7 @@ Exit codes
5234
4994
  prompts: true,
5235
4995
  mcp: false,
5236
4996
  async run(ctx, input) {
5237
- const { runSetupApple } = await import("./apple-BE1GBJFP.js");
4997
+ const { runSetupApple } = await import("./apple-DfYTDEJy.js");
5238
4998
  return runSetupApple(ctx, input);
5239
4999
  }
5240
5000
  });
@@ -6930,8 +6690,8 @@ function printResult(ctx, op$1, response) {
6930
6690
  if (!rows || !listing) return ctx.output.data(response);
6931
6691
  if (rows.length === 0) return ctx.ui.step(`No ${op$1.group} found`);
6932
6692
  const total = response.pagination?.totalCount;
6933
- const count = typeof total === "number" && total > rows.length ? `${rows.length} of ${total}` : String(rows.length);
6934
- ctx.ui.step(`${count} ${op$1.group}`);
6693
+ const count$1 = typeof total === "number" && total > rows.length ? `${rows.length} of ${total}` : String(rows.length);
6694
+ ctx.ui.step(`${count$1} ${op$1.group}`);
6935
6695
  for (const row of rows) ctx.ui.info(`\`${rowLabel(row)}\` ${rowMeta(row)}`);
6936
6696
  }
6937
6697
 
@@ -8075,7 +7835,7 @@ const command$46 = defineCommand({
8075
7835
  prompts: true,
8076
7836
  mcp: false,
8077
7837
  async run(ctx, { args, flags }) {
8078
- const { runBuildPipeline } = await import("./build-CQd-pf7O.js");
7838
+ const { runBuildPipeline } = await import("./build-CTBvzIG8.js");
8079
7839
  await runBuildPipeline({
8080
7840
  output: ctx.output,
8081
7841
  json: ctx.json
@@ -8142,7 +7902,7 @@ const command$47 = defineCommand({
8142
7902
  prompts: true,
8143
7903
  mcp: false,
8144
7904
  async run(ctx, { args, flags }) {
8145
- const { runCreate } = await import("./create-wlCp83IH.js");
7905
+ const { runCreate } = await import("./create-BLs-0ETi.js");
8146
7906
  return runCreate(ctx, {
8147
7907
  dir: args.dir,
8148
7908
  ...flags
@@ -8185,7 +7945,7 @@ const command$48 = defineCommand({
8185
7945
  prompts: true,
8186
7946
  mcp: false,
8187
7947
  async run(ctx, { args, flags }) {
8188
- const { runStudio } = await import("./server-Cif9w5lM.js");
7948
+ const { runStudio } = await import("./server-DjBnyiwD.js");
8189
7949
  await runStudio({
8190
7950
  dirs: args.dir,
8191
7951
  port: flags.port,
@@ -8225,7 +7985,7 @@ const command$49 = defineCommand({
8225
7985
  prompts: true,
8226
7986
  mcp: false,
8227
7987
  async run(ctx, input) {
8228
- const { runPromote } = await import("./promote-B_HnFEbX.js");
7988
+ const { runPromote } = await import("./promote-Crwz1xI0.js");
8229
7989
  return runPromote(ctx, input);
8230
7990
  }
8231
7991
  });
@@ -8281,7 +8041,7 @@ const command$50 = defineCommand({
8281
8041
  prompts: true,
8282
8042
  mcp: false,
8283
8043
  async run(ctx, input) {
8284
- const { runPush } = await import("./push-B5py7h5y.js");
8044
+ const { runPush } = await import("./push-DOaBj8hr.js");
8285
8045
  return runPush(ctx, input, true);
8286
8046
  }
8287
8047
  });
@@ -8317,7 +8077,7 @@ const command$51 = defineCommand({
8317
8077
  prompts: true,
8318
8078
  mcp: false,
8319
8079
  async run(ctx, input) {
8320
- const { runPull } = await import("./pull-JxiMyRwY.js");
8080
+ const { runPull } = await import("./pull-C0gY7HGj.js");
8321
8081
  return runPull(ctx, input);
8322
8082
  }
8323
8083
  });
@@ -8369,7 +8129,7 @@ const command$52 = defineCommand({
8369
8129
  prompts: true,
8370
8130
  mcp: false,
8371
8131
  async run(ctx, input) {
8372
- const { runPush } = await import("./push-B5py7h5y.js");
8132
+ const { runPush } = await import("./push-DOaBj8hr.js");
8373
8133
  return runPush(ctx, input, false);
8374
8134
  }
8375
8135
  });
@@ -8743,6 +8503,7 @@ async function create(context, api, resource, rawValue, value2, flags) {
8743
8503
  if (resource === "campaigns" && !value2) throw new Error("Usage: superwall campaigns create --description \"<description>\" --placement <placement> (campaigns need at least one placement)");
8744
8504
  const scope = await pickScope(context, api, isAppScoped(resource) || resource === "products" && context.target.app !== void 0, { customStores: resource === "products" });
8745
8505
  const grants = resource === "products" ? await resolveProductEntitlements(context, api, scope, entitlementValues(flags.fields)) : void 0;
8506
+ const paywall = resource === "campaigns" ? textOf(flags.fields.paywall) : void 0;
8746
8507
  if (dryRun$1) {
8747
8508
  const { projectCount: _projects, appCount: _apps,...where } = scope;
8748
8509
  const plan = {
@@ -8750,6 +8511,7 @@ async function create(context, api, resource, rawValue, value2, flags) {
8750
8511
  action: "create",
8751
8512
  resource,
8752
8513
  value: value$1,
8514
+ ...paywall ? { paywall } : {},
8753
8515
  scope: grants?.app ? {
8754
8516
  ...where,
8755
8517
  applicationId: String(grants.app.id)
@@ -8759,14 +8521,30 @@ async function create(context, api, resource, rawValue, value2, flags) {
8759
8521
  if (json) return context.output.data(plan);
8760
8522
  const target = grants?.app ? appLabel(grants.app) : scope.applicationId ? `${scope.appName ?? scope.applicationId} (${platformLabel(scope.appPlatform)})` : resource === "entitlements" && scope.boundApplicationId ? `${scope.projectName ?? scope.projectId}, app ${scope.boundApplicationId}` : scope.projectName ?? scope.projectId;
8761
8523
  const granting = grants?.ids.length ? ` granting entitlement ${grants.ids.join(", ")}` : "";
8762
- ui.info(`[dry-run] would create ${resource.replace(/s$/, "")} "${value$1}" in ${target}${granting}`);
8524
+ const showing = paywall ? ` showing paywall ${paywall} to 100% of users` : "";
8525
+ ui.info(`[dry-run] would create ${resource.replace(/s$/, "")} "${value$1}" in ${target}${granting}${showing}`);
8763
8526
  return;
8764
8527
  }
8765
8528
  const created = await apiCall(context, `Creating ${resource.replace(/s$/, "")}`, () => {
8766
8529
  return createOne(api, resource, scope, value$1, value2, flags.fields, grants);
8767
8530
  });
8768
- if (json) return context.output.data(created);
8531
+ const warnings = resource === "campaigns" ? describeSilentAudiences(created, String(value2)) : [];
8532
+ if (json) return context.output.data(warnings.length ? {
8533
+ ...created,
8534
+ warnings
8535
+ } : created);
8769
8536
  ui.success(`Created ${resource.replace(/s$/, "")} \`${rowName(created)}\` ${created.id ?? ""}`);
8537
+ for (const warning of warnings) ui.warn(warning);
8538
+ }
8539
+ function describeSilentAudiences(campaign, placement) {
8540
+ const campaignId = String(campaign.id ?? "<campaign>");
8541
+ return listField(campaign, "audiences").flatMap((audience) => {
8542
+ const audienceId = String(field(audience, "id") ?? "<audience>");
8543
+ const lines = [];
8544
+ if (field(audience, "enabled") === false) lines.push(`Audience ${audienceId} is disabled, so placement "${placement}" matches no audience and shows no paywall. Enable it: superwall campaigns audiences update ${campaignId} ${audienceId} --enabled`);
8545
+ if (!listField(audience, "variants").some((variant) => field(variant, "type") === "treatment" && Number(field(variant, "percentage")) > 0)) lines.push(`Audience ${audienceId} has no paywall variant with traffic (all of it goes to the holdout), so placement "${placement}" shows no paywall. Add one: superwall campaigns variants create ${campaignId} ${audienceId} --type treatment --paywall <paywall>`);
8546
+ return lines;
8547
+ });
8770
8548
  }
8771
8549
  const APP_PLATFORMS = [
8772
8550
  "ios",
@@ -8780,7 +8558,7 @@ async function createApp(context, api, nameArg, fields) {
8780
8558
  let name = nameArg;
8781
8559
  let platform = textOf(fields.platform);
8782
8560
  if (interactive && (!name || !platform)) {
8783
- const { scanProject } = await import("./scan-J2DILUNE.js");
8561
+ const { scanProject } = await import("./scan-KWnscsk-.js");
8784
8562
  const detected = (await scanProject(context.installDir).catch(() => null))?.apps[0];
8785
8563
  if (detected && !name && !platform) {
8786
8564
  ui.info(`Detected \`${detected.framework.name}\`` + (detected.details ? ` · \`${detected.details}\`` : ""));
@@ -8871,7 +8649,7 @@ function createOne(api, resource, scope, value$1, value2, fields, grants) {
8871
8649
  ...grants?.ids.length ? { entitlements: grants.ids } : {}
8872
8650
  });
8873
8651
  }
8874
- case "campaigns": return createCampaign(api, scope, value$1, String(value2));
8652
+ case "campaigns": return createCampaign(api, scope, value$1, String(value2), textOf(fields.paywall));
8875
8653
  default: throw new Error(`create is not supported for ${resource} yet.`);
8876
8654
  }
8877
8655
  }
@@ -9004,8 +8782,8 @@ const LABEL = {
9004
8782
  function sent(overview, provider) {
9005
8783
  const events = overview.revenue_provider_events;
9006
8784
  if (!events) return void 0;
9007
- const count = events[provider].events;
9008
- return `${provider} sent ${count} event${count === 1 ? "" : "s"} in the last ${events.window_days} days`;
8785
+ const count$1 = events[provider].events;
8786
+ return `${provider} sent ${count$1} event${count$1 === 1 ? "" : "s"} in the last ${events.window_days} days`;
9009
8787
  }
9010
8788
  function parseRevenueProvider(value$1) {
9011
8789
  const provider = REVENUE_PROVIDERS.find((candidate) => candidate === value$1);
@@ -9096,6 +8874,41 @@ const HANDLERS = {
9096
8874
  revenue_provider: change
9097
8875
  });
9098
8876
  },
8877
+ "products.update": async (ctx, resource, op$1, args, flags) => {
8878
+ const { period, periodCount, trialDays,...fields } = flags.fields;
8879
+ const given$1 = {
8880
+ period,
8881
+ periodCount,
8882
+ trialDays
8883
+ };
8884
+ const named = Object.entries(given$1).filter(([, value$1]) => value$1 !== void 0);
8885
+ if (named.length === 0 || !args[0]) return callOperation(ctx, resource, resource, op$1, args, flags);
8886
+ const used = named.map(([flag$1]) => toFlag(fieldName(flag$1))).join(", ");
8887
+ if (fields.subscription !== void 0) throw new Error(`Pass --subscription or ${used}, not both.`);
8888
+ const id$1 = args[0];
8889
+ const product = await apiCall(ctx, `GET /v2/products/${id$1}`, () => ctx.api.get(`/v2/products/${encodeURIComponent(id$1)}`));
8890
+ const stored = Reflect.get(Object(product), "subscription");
8891
+ const current = stored !== null && typeof stored === "object" ? stored : void 0;
8892
+ if (!current && period === void 0) throw new Error(`Product ${id$1} is a one-time purchase, so ${used} needs --period to make it a subscription.`);
8893
+ const kept = Object.fromEntries([
8894
+ "period",
8895
+ "period_count",
8896
+ "trial_period_days"
8897
+ ].flatMap((key) => current?.[key] === void 0 || current[key] === null ? [] : [[key, current[key]]]));
8898
+ const subscription = {
8899
+ ...current ? kept : { period_count: 1 },
8900
+ ...period !== void 0 ? { period: String(period) } : {},
8901
+ ...periodCount !== void 0 ? { period_count: count(periodCount, "--period-count", 1) } : {},
8902
+ ...trialDays !== void 0 ? { trial_period_days: count(trialDays, "--trial-days", 0) } : {}
8903
+ };
8904
+ return callOperation(ctx, resource, resource, op$1, args, {
8905
+ ...flags,
8906
+ fields: {
8907
+ ...fields,
8908
+ subscription
8909
+ }
8910
+ });
8911
+ },
9099
8912
  resource: async (ctx, resource, op$1, args, flags) => {
9100
8913
  const [value$1, value2] = op$1.name === "create" ? createValues(resource, op$1, args, flags) : args;
9101
8914
  if (!isResourceName(resource.name)) throw new Error(`Unknown resource "${resource.name}".`);
@@ -9127,7 +8940,7 @@ async function runResource(ctx, resource, action, value$1, value2, flags) {
9127
8940
  if (action === "create") return create(ctx, ctx.api, resource, value$1, value2, flags);
9128
8941
  if (action === "use" && resource === "apps") return useApp(ctx, ctx.api, value$1);
9129
8942
  if (action === "storekit" && resource === "products") {
9130
- const { writeStoreKit } = await import("./storekit-iBCWmeKn.js");
8943
+ const { writeStoreKit } = await import("./storekit-CAOpa6_f.js");
9131
8944
  return writeStoreKit(ctx, ctx.api, flags.fields.out);
9132
8945
  }
9133
8946
  throw new Error(`Unknown action "${action}" for ${resource}.`);
@@ -9139,6 +8952,11 @@ async function runOperation(ctx, owner, resource, op$1, args, flags) {
9139
8952
  if (!handler) throw new Error(`${name} has no handler "${op$1.handler}".`);
9140
8953
  return handler(ctx, resource, op$1, args, flags);
9141
8954
  }
8955
+ function count(value$1, flag$1, least) {
8956
+ const number = Number(value$1);
8957
+ if (!Number.isInteger(number) || number < least) throw new Error(`${flag$1} is a whole number of at least ${least}, not "${String(value$1)}".`);
8958
+ return number;
8959
+ }
9142
8960
  const toFlag = (field$1) => `--${field$1.replace(/_/g, "-")}`;
9143
8961
  async function callOperation(context, owner, resource, op$1, ids, flags, merged = {}) {
9144
8962
  const command$83 = `superwall ${owner === resource ? "" : `${owner.name} `}${resource.name} ${op$1.name}`;
@@ -9161,7 +8979,7 @@ async function callOperation(context, owner, resource, op$1, ids, flags, merged
9161
8979
  }
9162
8980
  const body = {};
9163
8981
  const bodyFields = new Map((spec?.body ?? []).map((field$1) => [field$1.name, field$1]));
9164
- const sendsBody = method !== "GET" && method !== "DELETE";
8982
+ const sendsBody = method !== "GET" && (method !== "DELETE" || spec?.body !== void 0);
9165
8983
  for (const [flag$1, raw] of Object.entries(flags.fields)) {
9166
8984
  const field$1 = fieldName(flag$1);
9167
8985
  const queryParam = spec?.params.find((param) => param.in === "query" && param.name === field$1);
@@ -9197,7 +9015,7 @@ async function callOperation(context, owner, resource, op$1, ids, flags, merged
9197
9015
  case "GET":
9198
9016
  if (paged) return ctx.api.list(url);
9199
9017
  return ctx.api.get(url);
9200
- case "DELETE": return ctx.api.del(url);
9018
+ case "DELETE": return ctx.api.del(url, sendsBody ? { body } : {});
9201
9019
  case "POST": return ctx.api.post(url, body);
9202
9020
  case "PUT": return ctx.api.put(url, body);
9203
9021
  case "PATCH": return ctx.api.patch(url, body);
@@ -9241,24 +9059,28 @@ async function fillScope(ctx, op$1, spec, pathValues, query$1, body) {
9241
9059
  }
9242
9060
  }
9243
9061
  function coerce(raw, type) {
9244
- if (Array.isArray(raw)) return raw.map((item) => coerce(item, type.replace(/\[\]$/, "")));
9062
+ const parts = type.split("|").map((part) => part.trim());
9063
+ const nullable = parts.includes("null");
9064
+ const values = parts.filter((part) => part !== "null");
9065
+ const item = values.length && values.every((part) => part.endsWith("[]")) ? values[0].slice(0, -2) : void 0;
9066
+ const takesJson = (types) => types.some((part) => part === "object" || part === "any");
9067
+ if (Array.isArray(raw)) return raw.map((value$1) => coerce(value$1, item ?? type));
9245
9068
  if (raw !== null && typeof raw === "object") return raw;
9246
- if (type.endsWith("[]")) {
9247
- const item = type.slice(0, -2);
9248
- const parsed = item === "object" || item === "any" ? coerce(raw, "any") : raw;
9069
+ const text = String(raw);
9070
+ if (nullable && text === "null") return null;
9071
+ if (item !== void 0) {
9072
+ const parsed = takesJson([item]) ? coerce(raw, "any") : raw;
9249
9073
  if (parsed !== raw) return Array.isArray(parsed) ? parsed : [parsed];
9250
- return String(raw).split(",").map((part) => coerce(part.trim(), item));
9074
+ return text.split(",").map((part) => coerce(part.trim(), item));
9251
9075
  }
9252
- const text = String(raw);
9253
9076
  if (/\bboolean\b/.test(type) && /^(true|false)$/.test(text)) return text === "true";
9254
9077
  if (/\b(number|integer)\b/.test(type) && text.trim() !== "" && !Number.isNaN(Number(text))) return Number(text);
9255
- if ((type === "object" || type === "any") && /^[[{]/.test(text)) try {
9078
+ if (takesJson(parts) && /^[[{]/.test(text)) try {
9256
9079
  return JSON.parse(text);
9257
9080
  } catch {
9258
9081
  return text;
9259
9082
  }
9260
9083
  if (type === "null") return null;
9261
- if (text === "null" && type.split("|").some((part) => part.trim() === "null")) return null;
9262
9084
  return typeof raw === "number" && !/\b(number|integer)\b/.test(type) ? text : raw;
9263
9085
  }
9264
9086
  function withQuery(path, params) {
@@ -9468,11 +9290,11 @@ const FLAGS = {
9468
9290
  },
9469
9291
  periodCount: {
9470
9292
  type: "number",
9471
- describe: "products create: periods per cycle"
9293
+ describe: "products create|update: periods per cycle"
9472
9294
  },
9473
9295
  trialDays: {
9474
9296
  type: "number",
9475
- describe: "products create: free-trial days"
9297
+ describe: "products create|update: free-trial days"
9476
9298
  },
9477
9299
  entitlement: {
9478
9300
  type: "list",
@@ -9858,10 +9680,15 @@ const command$56 = defineResource({
9858
9680
  {
9859
9681
  name: "create",
9860
9682
  summary: "Create a campaign that a placement triggers",
9683
+ details: "Creates one audience. With --paywall, its only variant shows that paywall to 100% of users. Without it, its only variant is a holdout at 100%, so the placement shows no paywall until a treatment gets traffic: `campaigns variants create <campaign> <audience> --type treatment --paywall <paywall>`. The output warns about every audience that shows no paywall.",
9861
9684
  effect: "write",
9862
9685
  handler: "resource",
9863
9686
  usage: "--description <text> --placement <placement>",
9864
- flags: [["--description <text>", "What the campaign is for"], ["--placement <name>", "The event that triggers it"]]
9687
+ flags: [
9688
+ ["--description <text>", "What the campaign is for"],
9689
+ ["--placement <name>", "The event that triggers it"],
9690
+ ["--paywall <id>", "The paywall its audience shows to 100% of users; without it, a 100% holdout"]
9691
+ ]
9865
9692
  },
9866
9693
  {
9867
9694
  name: "update",
@@ -10055,6 +9882,7 @@ const command$56 = defineResource({
10055
9882
  examples: [
10056
9883
  ["campaigns list --app <app>", "Campaigns of one app"],
10057
9884
  ["campaigns get <campaign>", "One campaign in full"],
9885
+ ["campaigns create --description \"Upsell\" --placement onboarding --paywall <paywall>", "A campaign that shows a paywall"],
10058
9886
  ["campaigns placements create <campaign> --event-name <placement>", "Trigger it on a placement"],
10059
9887
  ["campaigns audiences readout <campaign> <audience>", "How an audience is doing"]
10060
9888
  ]
@@ -10291,9 +10119,15 @@ const command$60 = defineResource({
10291
10119
  name: "update",
10292
10120
  summary: "Change a product",
10293
10121
  effect: "destructive",
10122
+ handler: "products.update",
10294
10123
  method: "PATCH",
10295
10124
  path: "/v2/products/{id}",
10296
- destructive: true
10125
+ destructive: true,
10126
+ flags: [
10127
+ ["--period <p>", "day | week | month | year; merged into its current subscription"],
10128
+ ["--period-count <n>", "Periods per cycle; merged into its current subscription"],
10129
+ ["--trial-days <n>", "Free-trial length in days; merged into its current subscription"]
10130
+ ]
10297
10131
  },
10298
10132
  {
10299
10133
  name: "delete",
@@ -10322,6 +10156,7 @@ const command$60 = defineResource({
10322
10156
  examples: [
10323
10157
  ["products list --app <app>", "Products of an app's project"],
10324
10158
  ["products create --identifier <id> --price 9.99 --period month", "A monthly subscription"],
10159
+ ["products update <id> --trial-days 3", "Give a subscription a 3-day free trial"],
10325
10160
  ["products create --identifier <id> --price 9.99 --period month --entitlement pro", "One that grants pro"],
10326
10161
  ["products create --identifier <id> --app <custom store> --price 9.99 --period month", "One in a custom store"]
10327
10162
  ]
@@ -10484,7 +10319,7 @@ const command$63 = defineCommand({
10484
10319
  prompts: true,
10485
10320
  mcp: false,
10486
10321
  async run(ctx) {
10487
- const { runDoctor } = await import("./doctor-Bd9ffg51.js");
10322
+ const { runDoctor } = await import("./doctor-ChI2Kfru.js");
10488
10323
  return runDoctor(ctx);
10489
10324
  }
10490
10325
  });
@@ -10589,7 +10424,7 @@ function parseFeedbackReport(value$1) {
10589
10424
  const outcome = field(value$1, "outcome");
10590
10425
  const id$1 = field(value$1, "id");
10591
10426
  if (!isRecord(request) || typeof id$1 !== "number" || outcome !== "created" && outcome !== "merged") return void 0;
10592
- const count = (key) => {
10427
+ const count$1 = (key) => {
10593
10428
  const found = field(request, key);
10594
10429
  return typeof found === "number" ? found : 0;
10595
10430
  };
@@ -10603,8 +10438,8 @@ function parseFeedbackReport(value$1) {
10603
10438
  title: textField(request, "title") ?? "",
10604
10439
  kind: textField(request, "kind") ?? "other",
10605
10440
  status: textField(request, "status") ?? "open",
10606
- report_count: count("report_count"),
10607
- organization_count: count("organization_count")
10441
+ report_count: count$1("report_count"),
10442
+ organization_count: count$1("organization_count")
10608
10443
  }
10609
10444
  };
10610
10445
  }
@@ -10829,7 +10664,7 @@ const command$65 = defineCommand({
10829
10664
  prompts: true,
10830
10665
  mcp: false,
10831
10666
  async run(ctx, input) {
10832
- const { runSkills } = await import("./skills-MmF7IyTg.js");
10667
+ const { runSkills } = await import("./skills-CkAWJveA.js");
10833
10668
  return runSkills(ctx, input);
10834
10669
  }
10835
10670
  });
@@ -10845,7 +10680,7 @@ const command$66 = defineCommand({
10845
10680
  prompts: true,
10846
10681
  mcp: false,
10847
10682
  async run(ctx) {
10848
- const { runUpgrade } = await import("./upgrade-CYFdpVpi.js");
10683
+ const { runUpgrade } = await import("./upgrade-BzN7PjKg.js");
10849
10684
  return runUpgrade(ctx, AUTO_UPDATE_TARGET());
10850
10685
  }
10851
10686
  });
@@ -10885,7 +10720,7 @@ const command$67 = defineCommand({
10885
10720
  mcp: false,
10886
10721
  channel: "next",
10887
10722
  async run(ctx, { args, flags }) {
10888
- const { runArtifactApprove } = await import("./approve-yRZmvkCj.js");
10723
+ const { runArtifactApprove } = await import("./approve-CoQJhii4.js");
10889
10724
  await runArtifactApprove(ctx, {
10890
10725
  version: args.version,
10891
10726
  ...flags
@@ -10911,7 +10746,7 @@ const command$68 = defineCommand({
10911
10746
  mcp: false,
10912
10747
  channel: "next",
10913
10748
  async run(ctx, { args, flags }) {
10914
- const { runArtifactCreate } = await import("./starter-BlJ_InZJ.js");
10749
+ const { runArtifactCreate } = await import("./starter-jYb2nmlb.js");
10915
10750
  await runArtifactCreate(ctx, {
10916
10751
  dir: args.dir,
10917
10752
  install: flags.install
@@ -10995,7 +10830,7 @@ const command$69 = defineCommand({
10995
10830
  mcp: false,
10996
10831
  channel: "next",
10997
10832
  async run(ctx, { args, flags }) {
10998
- const { runArtifactDev } = await import("./run-Bme4Egyl.js");
10833
+ const { runArtifactDev } = await import("./run-naBCXCfn.js");
10999
10834
  await runArtifactDev(ctx, {
11000
10835
  dir: args.dir,
11001
10836
  ...flags
@@ -11051,7 +10886,7 @@ const command$70 = defineCommand({
11051
10886
  mcp: false,
11052
10887
  channel: "next",
11053
10888
  async run(ctx, { args, flags }) {
11054
- const { runArtifactInstall } = await import("./install-CxyqfKFe.js");
10889
+ const { runArtifactInstall } = await import("./install-DM0JBdpE.js");
11055
10890
  await runArtifactInstall(ctx, {
11056
10891
  entrypoint: args.entrypoint,
11057
10892
  ...flags
@@ -11079,7 +10914,7 @@ const command$71 = defineCommand({
11079
10914
  mcp: false,
11080
10915
  channel: "next",
11081
10916
  async run(ctx, { flags }) {
11082
- const { runArtifactList } = await import("./install-CxyqfKFe.js");
10917
+ const { runArtifactList } = await import("./install-DM0JBdpE.js");
11083
10918
  await runArtifactList(ctx, flags);
11084
10919
  }
11085
10920
  });
@@ -11107,7 +10942,7 @@ const command$72 = defineCommand({
11107
10942
  mcp: false,
11108
10943
  channel: "next",
11109
10944
  async run(ctx, { args, flags }) {
11110
- const { runArtifactLogs } = await import("./status-DHRxg1ZA.js");
10945
+ const { runArtifactLogs } = await import("./status-DrD9CHtK.js");
11111
10946
  await runArtifactLogs(ctx, {
11112
10947
  version: args.version,
11113
10948
  ...flags
@@ -11146,7 +10981,7 @@ const command$73 = defineCommand({
11146
10981
  mcp: false,
11147
10982
  channel: "next",
11148
10983
  async run(ctx, { args, flags }) {
11149
- const { runArtifactOpen } = await import("./install-CxyqfKFe.js");
10984
+ const { runArtifactOpen } = await import("./install-DM0JBdpE.js");
11150
10985
  await runArtifactOpen(ctx, {
11151
10986
  entrypoint: args.entrypoint,
11152
10987
  ...flags
@@ -11183,7 +11018,7 @@ const command$74 = defineCommand({
11183
11018
  mcp: false,
11184
11019
  channel: "next",
11185
11020
  async run(ctx, { args, flags }) {
11186
- const { runArtifactPull } = await import("./pull-lYRULo4v.js");
11021
+ const { runArtifactPull } = await import("./pull-D8GfsKha.js");
11187
11022
  await runArtifactPull(ctx, {
11188
11023
  dir: args.dir,
11189
11024
  ...flags
@@ -11229,7 +11064,7 @@ const command$75 = defineCommand({
11229
11064
  mcp: false,
11230
11065
  channel: "next",
11231
11066
  async run(ctx, { args, flags }) {
11232
- const { runArtifactPush } = await import("./push-DHlUMkbf.js");
11067
+ const { runArtifactPush } = await import("./push-uWv5P0LA.js");
11233
11068
  await runArtifactPush(ctx, {
11234
11069
  dir: args.dir,
11235
11070
  ...flags
@@ -11260,7 +11095,7 @@ const command$76 = defineCommand({
11260
11095
  mcp: false,
11261
11096
  channel: "next",
11262
11097
  async run(ctx, { args, flags }) {
11263
- const { runArtifactShare } = await import("./status-DHRxg1ZA.js");
11098
+ const { runArtifactShare } = await import("./status-DrD9CHtK.js");
11264
11099
  await runArtifactShare(ctx, {
11265
11100
  version: args.version,
11266
11101
  ...flags
@@ -11293,7 +11128,7 @@ const command$77 = defineCommand({
11293
11128
  mcp: false,
11294
11129
  channel: "next",
11295
11130
  async run(ctx, { flags }) {
11296
- const { runArtifactStatus } = await import("./status-DHRxg1ZA.js");
11131
+ const { runArtifactStatus } = await import("./status-DrD9CHtK.js");
11297
11132
  await runArtifactStatus(ctx, flags);
11298
11133
  }
11299
11134
  });
@@ -11395,7 +11230,7 @@ const command$78 = defineCommand({
11395
11230
  mcp: false,
11396
11231
  channel: "next",
11397
11232
  async run(ctx, { args, flags }) {
11398
- const { runArtifactTry } = await import("./try-C8QQbG0b.js");
11233
+ const { runArtifactTry } = await import("./try-BpMpLGCs.js");
11399
11234
  await runArtifactTry(ctx, {
11400
11235
  entrypoint: args.entrypoint,
11401
11236
  ...flags
@@ -11427,7 +11262,7 @@ const command$79 = defineCommand({
11427
11262
  mcp: false,
11428
11263
  channel: "next",
11429
11264
  async run(ctx, { args, flags }) {
11430
- const { runArtifactUpdate } = await import("./starter-BlJ_InZJ.js");
11265
+ const { runArtifactUpdate } = await import("./starter-jYb2nmlb.js");
11431
11266
  await runArtifactUpdate(ctx, {
11432
11267
  dir: args.dir,
11433
11268
  install: flags.install,
@@ -11470,8 +11305,8 @@ const command$80 = defineCommand({
11470
11305
  prompts: true,
11471
11306
  mcp: false,
11472
11307
  async run(ctx, { flags }) {
11473
- const { runIntegrate } = await import("./integrate-MkyDDzI5.js");
11474
- const { printPlaybook } = await import("./playbook-CVGolez9.js");
11308
+ const { runIntegrate } = await import("./integrate-ZQUaScQ0.js");
11309
+ const { printPlaybook } = await import("./playbook-pFhIg_0e.js");
11475
11310
  if (flags.skill) return printPlaybook(ctx.installDir, "integrate");
11476
11311
  await runIntegrate({
11477
11312
  ...ctx,
@@ -11517,8 +11352,8 @@ const command$81 = defineCommand({
11517
11352
  prompts: true,
11518
11353
  mcp: false,
11519
11354
  async run(ctx, { args, flags }) {
11520
- const { runPaywallMigration, runProviderMigration, runScreenMigration } = await import("./migrate-CdFoZipj.js");
11521
- const { printPlaybook } = await import("./playbook-CVGolez9.js");
11355
+ const { runPaywallMigration, runProviderMigration, runScreenMigration } = await import("./migrate-mFKBset8.js");
11356
+ const { printPlaybook } = await import("./playbook-pFhIg_0e.js");
11522
11357
  if (flags.screen !== void 0) return runScreenMigration(ctx, {
11523
11358
  path: flags.screen,
11524
11359
  screenshot: flags.screenshot
@@ -11552,8 +11387,8 @@ const command$82 = defineCommand({
11552
11387
  prompts: true,
11553
11388
  mcp: false,
11554
11389
  async run(ctx, { flags }) {
11555
- const { runReview } = await import("./integrate-MkyDDzI5.js");
11556
- const { printPlaybook } = await import("./playbook-CVGolez9.js");
11390
+ const { runReview } = await import("./integrate-ZQUaScQ0.js");
11391
+ const { printPlaybook } = await import("./playbook-pFhIg_0e.js");
11557
11392
  if (flags.skill) return printPlaybook(ctx.installDir, flags.fix ? "review-fix" : "review");
11558
11393
  await runReview(ctx, flags.fix);
11559
11394
  }