adapty 0.8.9 → 0.9.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 (199) hide show
  1. package/README.md +147 -2
  2. package/dist/cli/base/adapty/adapty-command.d.ts +3 -2
  3. package/dist/cli/base/adapty/adapty-command.js +8 -5
  4. package/dist/cli/base/adapty/build.d.ts +6 -1
  5. package/dist/cli/base/adapty/build.js +1 -0
  6. package/dist/cli/base/adapty/index.d.ts +1 -0
  7. package/dist/cli/base/adapty/index.js +1 -0
  8. package/dist/cli/base/adapty/migration-command.d.ts +11 -0
  9. package/dist/cli/base/adapty/migration-command.js +17 -0
  10. package/dist/cli/base/base-command.d.ts +6 -0
  11. package/dist/cli/base/base-command.js +14 -0
  12. package/dist/cli/commands/apps/create.d.ts +1 -1
  13. package/dist/cli/commands/apps/get.js +1 -1
  14. package/dist/cli/commands/apps/list.js +1 -1
  15. package/dist/cli/commands/apps/update.js +1 -1
  16. package/dist/cli/commands/attribution/report/command.d.ts +18 -0
  17. package/dist/cli/commands/attribution/report/command.js +93 -0
  18. package/dist/cli/commands/attribution/report/index.d.ts +1 -18
  19. package/dist/cli/commands/attribution/report/index.js +1 -93
  20. package/dist/cli/commands/attribution/values.js +1 -1
  21. package/dist/cli/commands/auth/login.js +1 -0
  22. package/dist/cli/commands/auth/{logout.d.ts → logout/command.d.ts} +1 -1
  23. package/dist/cli/commands/auth/logout/command.js +33 -0
  24. package/dist/cli/commands/auth/logout/index.d.ts +1 -0
  25. package/dist/cli/commands/auth/logout/index.js +1 -0
  26. package/dist/cli/commands/auth/logout/lib/cleanup.d.ts +3 -0
  27. package/dist/cli/commands/auth/logout/lib/cleanup.js +21 -0
  28. package/dist/cli/commands/auth/{revoke.d.ts → revoke/command.d.ts} +1 -1
  29. package/dist/cli/commands/auth/{revoke.js → revoke/command.js} +7 -7
  30. package/dist/cli/commands/auth/revoke/index.d.ts +1 -0
  31. package/dist/cli/commands/auth/revoke/index.js +1 -0
  32. package/dist/cli/commands/auth/revoke/lib/cleanup.d.ts +4 -0
  33. package/dist/cli/commands/auth/revoke/lib/cleanup.js +29 -0
  34. package/dist/cli/commands/auth/status/command.d.ts +7 -0
  35. package/dist/cli/commands/auth/status/command.js +22 -0
  36. package/dist/cli/commands/auth/status/index.d.ts +1 -7
  37. package/dist/cli/commands/auth/status/index.js +1 -22
  38. package/dist/cli/commands/migrations/close/command.d.ts +16 -0
  39. package/dist/cli/commands/migrations/close/command.js +58 -0
  40. package/dist/cli/commands/migrations/close/index.d.ts +1 -0
  41. package/dist/cli/commands/migrations/close/index.js +1 -0
  42. package/dist/cli/commands/migrations/create/command.d.ts +20 -0
  43. package/dist/cli/commands/migrations/create/command.js +86 -0
  44. package/dist/cli/commands/migrations/create/index.d.ts +1 -0
  45. package/dist/cli/commands/migrations/create/index.js +1 -0
  46. package/dist/cli/commands/migrations/current/command.d.ts +12 -0
  47. package/dist/cli/commands/migrations/current/command.js +25 -0
  48. package/dist/cli/commands/migrations/current/index.d.ts +1 -0
  49. package/dist/cli/commands/migrations/current/index.js +1 -0
  50. package/dist/cli/commands/migrations/list/command.d.ts +11 -0
  51. package/dist/cli/commands/migrations/list/command.js +27 -0
  52. package/dist/cli/commands/migrations/list/index.d.ts +1 -0
  53. package/dist/cli/commands/migrations/list/index.js +1 -0
  54. package/dist/cli/commands/migrations/list/lib/render.d.ts +3 -0
  55. package/dist/cli/commands/migrations/list/lib/render.js +77 -0
  56. package/dist/cli/commands/migrations/run/command.d.ts +25 -0
  57. package/dist/cli/commands/migrations/run/command.js +141 -0
  58. package/dist/cli/commands/migrations/run/index.d.ts +1 -0
  59. package/dist/cli/commands/migrations/run/index.js +1 -0
  60. package/dist/cli/commands/migrations/run/lib/action-view.d.ts +7 -0
  61. package/dist/cli/commands/migrations/run/lib/action-view.js +2 -0
  62. package/dist/cli/commands/migrations/run/lib/actions.d.ts +4 -0
  63. package/dist/cli/commands/migrations/run/lib/actions.js +20 -0
  64. package/dist/cli/commands/migrations/run/lib/https.d.ts +1 -0
  65. package/dist/cli/commands/migrations/run/lib/https.js +8 -0
  66. package/dist/cli/commands/migrations/run/lib/input.d.ts +10 -0
  67. package/dist/cli/commands/migrations/run/lib/input.js +51 -0
  68. package/dist/cli/commands/migrations/run/lib/open-link.d.ts +7 -0
  69. package/dist/cli/commands/migrations/run/lib/open-link.js +11 -0
  70. package/dist/cli/commands/migrations/show/command.d.ts +17 -0
  71. package/dist/cli/commands/migrations/show/command.js +47 -0
  72. package/dist/cli/commands/migrations/show/index.d.ts +1 -0
  73. package/dist/cli/commands/migrations/show/index.js +1 -0
  74. package/dist/cli/commands/migrations/show/lib/render.d.ts +4 -0
  75. package/dist/cli/commands/migrations/show/lib/render.js +27 -0
  76. package/dist/cli/commands/migrations/status/command.d.ts +18 -0
  77. package/dist/cli/commands/migrations/status/command.js +54 -0
  78. package/dist/cli/commands/migrations/status/index.d.ts +1 -0
  79. package/dist/cli/commands/migrations/status/index.js +1 -0
  80. package/dist/cli/commands/migrations/status/lib/flags.d.ts +8 -0
  81. package/dist/cli/commands/migrations/status/lib/flags.js +29 -0
  82. package/dist/cli/commands/migrations/status/lib/notice.d.ts +3 -0
  83. package/dist/cli/commands/migrations/status/lib/notice.js +10 -0
  84. package/dist/cli/commands/migrations/steps/command.d.ts +14 -0
  85. package/dist/cli/commands/migrations/steps/command.js +34 -0
  86. package/dist/cli/commands/migrations/steps/index.d.ts +1 -0
  87. package/dist/cli/commands/migrations/steps/index.js +1 -0
  88. package/dist/cli/commands/migrations/steps/lib/render.d.ts +3 -0
  89. package/dist/cli/commands/migrations/steps/lib/render.js +28 -0
  90. package/dist/cli/commands/migrations/unuse/command.d.ts +11 -0
  91. package/dist/cli/commands/migrations/unuse/command.js +23 -0
  92. package/dist/cli/commands/migrations/unuse/index.d.ts +1 -0
  93. package/dist/cli/commands/migrations/unuse/index.js +1 -0
  94. package/dist/cli/commands/migrations/use/command.d.ts +14 -0
  95. package/dist/cli/commands/migrations/use/command.js +24 -0
  96. package/dist/cli/commands/migrations/use/index.d.ts +1 -0
  97. package/dist/cli/commands/migrations/use/index.js +1 -0
  98. package/dist/cli/context/migration/current.d.ts +32 -0
  99. package/dist/cli/context/migration/current.js +30 -0
  100. package/dist/cli/context/migration/index.d.ts +4 -0
  101. package/dist/cli/context/migration/index.js +2 -0
  102. package/dist/cli/context/migration/model.d.ts +14 -0
  103. package/dist/cli/context/migration/model.js +30 -0
  104. package/dist/cli/context/migration/resolve.d.ts +16 -0
  105. package/dist/cli/context/migration/resolve.js +26 -0
  106. package/dist/cli/context/migration/store.d.ts +9 -0
  107. package/dist/cli/context/migration/store.js +99 -0
  108. package/dist/cli/errors/wizard.d.ts +5 -0
  109. package/dist/cli/errors/wizard.js +54 -0
  110. package/dist/cli/errors.d.ts +37 -4
  111. package/dist/cli/errors.js +58 -4
  112. package/dist/cli/input/app.d.ts +8 -0
  113. package/dist/cli/{flags.js → input/app.js} +2 -9
  114. package/dist/cli/input/migration.d.ts +7 -0
  115. package/dist/cli/input/migration.js +17 -0
  116. package/dist/cli/input/pagination.d.ts +11 -0
  117. package/dist/cli/input/pagination.js +8 -0
  118. package/dist/cli/views/migrations/envelope/action-block.d.ts +2 -0
  119. package/dist/cli/views/migrations/envelope/action-block.js +32 -0
  120. package/dist/cli/views/migrations/envelope/envelope.d.ts +3 -0
  121. package/dist/cli/views/migrations/envelope/envelope.js +40 -0
  122. package/dist/cli/views/migrations/envelope/issue-block.d.ts +2 -0
  123. package/dist/cli/views/migrations/envelope/issue-block.js +13 -0
  124. package/dist/cli/views/migrations/notices.d.ts +7 -0
  125. package/dist/cli/views/migrations/notices.js +7 -0
  126. package/dist/commands/access-levels/create.js +1 -1
  127. package/dist/commands/access-levels/get.js +1 -1
  128. package/dist/commands/access-levels/list.js +1 -1
  129. package/dist/commands/access-levels/update.js +1 -1
  130. package/dist/commands/auth/logout.d.ts +1 -1
  131. package/dist/commands/auth/logout.js +1 -1
  132. package/dist/commands/auth/revoke.d.ts +1 -1
  133. package/dist/commands/auth/revoke.js +1 -1
  134. package/dist/commands/flows/config/get.js +1 -1
  135. package/dist/commands/flows/config/update.js +1 -1
  136. package/dist/commands/flows/config/validate.js +1 -1
  137. package/dist/commands/flows/create.js +1 -1
  138. package/dist/commands/flows/get.js +1 -1
  139. package/dist/commands/flows/list.js +1 -1
  140. package/dist/commands/flows/media/upload.js +1 -1
  141. package/dist/commands/flows/publish.js +1 -1
  142. package/dist/commands/flows/update.js +1 -1
  143. package/dist/commands/migrations/close.d.ts +1 -0
  144. package/dist/commands/migrations/close.js +2 -0
  145. package/dist/commands/migrations/create.d.ts +1 -0
  146. package/dist/commands/migrations/create.js +2 -0
  147. package/dist/commands/migrations/current.d.ts +1 -0
  148. package/dist/commands/migrations/current.js +1 -0
  149. package/dist/commands/migrations/list.d.ts +1 -0
  150. package/dist/commands/migrations/list.js +2 -0
  151. package/dist/commands/migrations/run.d.ts +1 -0
  152. package/dist/commands/migrations/run.js +2 -0
  153. package/dist/commands/migrations/show.d.ts +1 -0
  154. package/dist/commands/migrations/show.js +2 -0
  155. package/dist/commands/migrations/status.d.ts +1 -0
  156. package/dist/commands/migrations/status.js +2 -0
  157. package/dist/commands/migrations/steps.d.ts +1 -0
  158. package/dist/commands/migrations/steps.js +2 -0
  159. package/dist/commands/migrations/unuse.d.ts +1 -0
  160. package/dist/commands/migrations/unuse.js +1 -0
  161. package/dist/commands/migrations/use.d.ts +1 -0
  162. package/dist/commands/migrations/use.js +1 -0
  163. package/dist/commands/paywalls/create.js +1 -1
  164. package/dist/commands/paywalls/get.js +1 -1
  165. package/dist/commands/paywalls/list.js +1 -1
  166. package/dist/commands/paywalls/placements.js +1 -1
  167. package/dist/commands/paywalls/update.js +1 -1
  168. package/dist/commands/placements/create.js +1 -1
  169. package/dist/commands/placements/get.js +1 -1
  170. package/dist/commands/placements/list.js +1 -1
  171. package/dist/commands/placements/update.js +1 -1
  172. package/dist/commands/products/create.js +1 -1
  173. package/dist/commands/products/get.js +1 -1
  174. package/dist/commands/products/list.js +1 -1
  175. package/dist/commands/products/update.js +1 -1
  176. package/dist/commands/segments/get.js +1 -1
  177. package/dist/commands/segments/list.js +1 -1
  178. package/dist/sdk/adapty/errors.d.ts +4 -0
  179. package/dist/sdk/adapty/errors.js +25 -0
  180. package/dist/sdk/adapty/index.d.ts +5 -0
  181. package/dist/sdk/adapty/index.js +29 -3
  182. package/dist/sdk/adapty/migrations/action.d.ts +15 -0
  183. package/dist/sdk/adapty/migrations/action.js +17 -0
  184. package/dist/sdk/adapty/migrations/close.d.ts +16 -0
  185. package/dist/sdk/adapty/migrations/close.js +7 -0
  186. package/dist/sdk/adapty/migrations/create.d.ts +16 -0
  187. package/dist/sdk/adapty/migrations/create.js +43 -0
  188. package/dist/sdk/adapty/migrations/index.d.ts +9 -0
  189. package/dist/sdk/adapty/migrations/index.js +4 -0
  190. package/dist/sdk/adapty/migrations/model.d.ts +100 -0
  191. package/dist/sdk/adapty/migrations/model.js +1 -0
  192. package/dist/sdk/adapty/migrations/resource.d.ts +27 -0
  193. package/dist/sdk/adapty/migrations/resource.js +52 -0
  194. package/dist/sdk/adapty/migrations/wait.d.ts +6 -0
  195. package/dist/sdk/adapty/migrations/wait.js +9 -0
  196. package/oclif.manifest.json +1722 -1117
  197. package/package.json +4 -1
  198. package/dist/cli/commands/auth/logout.js +0 -28
  199. package/dist/cli/flags.d.ts +0 -20
@@ -0,0 +1,17 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { validateMigrationId } from '../context/migration/index.js';
3
+ export const migrationArgs = {
4
+ id: Args.string({
5
+ description: 'Migration ID from `adapty migrations list`',
6
+ required: true,
7
+ parse: value => Promise.resolve(validateMigrationId(value)),
8
+ }),
9
+ };
10
+ /** Explicit ID wins over the environment and the saved selection, resolved after parsing. */
11
+ export const migrationFlags = {
12
+ migration: Flags.string({
13
+ char: 'm',
14
+ description: 'Migration ID; overrides ADAPTY_MIGRATION and the saved selection from migrations use/create',
15
+ helpValue: 'ID',
16
+ }),
17
+ };
@@ -0,0 +1,11 @@
1
+ import type { PageParams } from '../../sdk/adapty/index.js';
2
+ /** The published defaults, so a migrated `list` asks for the same page as an untouched one. */
3
+ export declare const paginationFlags: {
4
+ page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
5
+ 'page-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
6
+ };
7
+ /** The one place where flag names meet sdk field names. */
8
+ export declare const pageParams: (flags: {
9
+ "page": number;
10
+ "page-size": number;
11
+ }) => PageParams;
@@ -0,0 +1,8 @@
1
+ import { Flags } from '@oclif/core';
2
+ /** The published defaults, so a migrated `list` asks for the same page as an untouched one. */
3
+ export const paginationFlags = {
4
+ 'page': Flags.integer({ default: 1, description: 'Page number', min: 1 }),
5
+ 'page-size': Flags.integer({ default: 20, description: 'Items per page (max 100)', max: 100, min: 1 }),
6
+ };
7
+ /** The one place where flag names meet sdk field names. */
8
+ export const pageParams = (flags) => ({ page: flags.page, pageSize: flags['page-size'] });
@@ -0,0 +1,2 @@
1
+ import type { Action } from '../../../../sdk/adapty/index.js';
2
+ export declare const actionBlock: (action: Action, migrationId: string) => string[];
@@ -0,0 +1,32 @@
1
+ const knownKinds = new Set(['external', 'input', 'upload']);
2
+ const indent = (text, pad) => {
3
+ return text.split('\n').map(line => `${pad}${line}`).join('\n');
4
+ };
5
+ export const actionBlock = (action, migrationId) => {
6
+ const lines = [` ${action.action_id} (${action.kind}) ${action.title}`];
7
+ const href = 'href' in action ? action.href : undefined;
8
+ if (action.detail !== null) {
9
+ lines.push(indent(action.detail, ' '));
10
+ }
11
+ if (href !== undefined) {
12
+ lines.push(` ${href}`);
13
+ }
14
+ if (action.reads.length > 0) {
15
+ const commands = action.reads.map(name => `adapty migrations show ${name} -m ${migrationId}`);
16
+ lines.push(` Read first: ${commands.join(', ')}`);
17
+ }
18
+ if (action.confirm !== null) {
19
+ lines.push(' Confirmation:', indent(action.confirm, ' '));
20
+ if (action.kind === 'input') {
21
+ lines.push(' Review this text before passing --yes.');
22
+ }
23
+ }
24
+ if (action.kind === 'upload') {
25
+ lines.push(' File uploads are not supported by this CLI.');
26
+ lines.push(' Use the dashboard or an offered Cloud Export action.');
27
+ }
28
+ if (!knownKinds.has(action.kind)) {
29
+ lines.push(' This action needs a newer adapty-cli');
30
+ }
31
+ return lines;
32
+ };
@@ -0,0 +1,3 @@
1
+ import type { Envelope } from '../../../../sdk/adapty/index.js';
2
+ /** Preserve server wording so new steps and actions need no CLI update. */
3
+ export declare const renderEnvelope: (envelope: Envelope) => string;
@@ -0,0 +1,40 @@
1
+ import { actionBlock } from './action-block.js';
2
+ import { issueBlock } from './issue-block.js';
3
+ const knownStates = new Set([
4
+ 'running', 'action_required', 'completed', 'failed', 'canceled',
5
+ ]);
6
+ const appLine = (app) => {
7
+ return app === null ? 'App: not created yet' : `App: ${app.name} (${app.id})`;
8
+ };
9
+ const progressLine = (progress) => {
10
+ const done = progress.total === null ? String(progress.done) : `${progress.done} of ${progress.total}`;
11
+ return `Progress: ${done} ${progress.unit}`;
12
+ };
13
+ /** Preserve server wording so new steps and actions need no CLI update. */
14
+ export const renderEnvelope = (envelope) => {
15
+ const { migration } = envelope;
16
+ const lines = [
17
+ `${migration.id} ${migration.flow} ${migration.state}`,
18
+ appLine(migration.app),
19
+ migration.summary,
20
+ ];
21
+ if (!knownStates.has(migration.state)) {
22
+ lines.push('This migration state needs a newer adapty-cli');
23
+ }
24
+ if (migration.progress !== null) {
25
+ lines.push(progressLine(migration.progress));
26
+ }
27
+ if (envelope.issues.length > 0) {
28
+ lines.push('', 'Issues:', ...envelope.issues.flatMap(issue => issueBlock(issue, migration.id)));
29
+ }
30
+ if (envelope.next_actions.length > 0) {
31
+ lines.push('', 'Do next:', ...envelope.next_actions.flatMap(action => actionBlock(action, migration.id)));
32
+ }
33
+ if (envelope.available_actions.length > 0) {
34
+ lines.push('', 'Also available:', ...envelope.available_actions.flatMap(action => actionBlock(action, migration.id)));
35
+ }
36
+ if (envelope.resources.length > 0) {
37
+ lines.push('', `Readable now: ${envelope.resources.map(resource => resource.name).join(', ')}`);
38
+ }
39
+ return lines.join('\n');
40
+ };
@@ -0,0 +1,2 @@
1
+ import type { Issue } from '../../../../sdk/adapty/index.js';
2
+ export declare const issueBlock: (issue: Issue, migrationId: string) => string[];
@@ -0,0 +1,13 @@
1
+ const indent = (text, pad) => {
2
+ return text.split('\n').map(line => `${pad}${line}`).join('\n');
3
+ };
4
+ export const issueBlock = (issue, migrationId) => {
5
+ const lines = [` ${issue.title} (${issue.code})`];
6
+ if (issue.detail !== null) {
7
+ lines.push(indent(issue.detail, ' '));
8
+ }
9
+ if (issue.action_id !== null) {
10
+ lines.push(` Fix with: adapty migrations run ${issue.action_id} -m ${migrationId}`);
11
+ }
12
+ return lines;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ADAPTY_MIGRATION outlives both a save and a clear, so "saved" or "cleared" alone would be a lie.
3
+ * Commands write these to stderr rather than through `warn()`, which oclif silences under --json:
4
+ * a selection that is not in effect is exactly what a script has to be told about.
5
+ */
6
+ export declare const envOverridesSelection = "Warning: ADAPTY_MIGRATION still overrides the saved selection. Unset it in your shell to use this ID.\n";
7
+ export declare const envSuppliesMigration = "Warning: ADAPTY_MIGRATION still supplies a migration ID. Unset it in your shell.\n";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ADAPTY_MIGRATION outlives both a save and a clear, so "saved" or "cleared" alone would be a lie.
3
+ * Commands write these to stderr rather than through `warn()`, which oclif silences under --json:
4
+ * a selection that is not in effect is exactly what a script has to be told about.
5
+ */
6
+ export const envOverridesSelection = 'Warning: ADAPTY_MIGRATION still overrides the saved selection. Unset it in your shell to use this ID.\n';
7
+ export const envSuppliesMigration = 'Warning: ADAPTY_MIGRATION still supplies a migration ID. Unset it in your shell.\n';
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class AccessLevelsCreate extends Command {
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1 +1 @@
1
- export { default } from '../../cli/commands/auth/logout.js';
1
+ export { default } from '../../cli/commands/auth/logout/index.js';
@@ -1,2 +1,2 @@
1
1
  // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
- export { default } from '../../cli/commands/auth/logout.js';
2
+ export { default } from '../../cli/commands/auth/logout/index.js';
@@ -1 +1 @@
1
- export { default } from '../../cli/commands/auth/revoke.js';
1
+ export { default } from '../../cli/commands/auth/revoke/index.js';
@@ -1,2 +1,2 @@
1
1
  // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
- export { default } from '../../cli/commands/auth/revoke.js';
2
+ export { default } from '../../cli/commands/auth/revoke/index.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../../cli/flags.js';
2
+ import { appIdFlag } from '../../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../../lib/flags.js';
5
5
  import { printResponse } from '../../../lib/output.js';
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { Args, Command, Flags } from '@oclif/core';
3
- import { appIdFlag } from '../../../cli/flags.js';
3
+ import { appIdFlag } from '../../../cli/input/app.js';
4
4
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
5
5
  import { isValidUuid } from '../../../lib/flags.js';
6
6
  import { printResponse } from '../../../lib/output.js';
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { Args, Command, Flags } from '@oclif/core';
3
- import { appIdFlag } from '../../../cli/flags.js';
3
+ import { appIdFlag } from '../../../cli/input/app.js';
4
4
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
5
5
  import { isValidUuid } from '../../../lib/flags.js';
6
6
  import { printResponse } from '../../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class FlowsCreate extends Command {
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,7 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { basename, extname } from 'node:path';
3
3
  import { Args, Command } from '@oclif/core';
4
- import { appIdFlag } from '../../../cli/flags.js';
4
+ import { appIdFlag } from '../../../cli/input/app.js';
5
5
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
6
6
  import { printResponse } from '../../../lib/output.js';
7
7
  const IMAGE_MIME_TYPES = {
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { confirmFlags, confirmMutation } from '../../lib/confirm.js';
5
5
  import { ApiError } from '../../lib/errors.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/close/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/close/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/create/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/create/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/current/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/current/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/list/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/list/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/run/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/run/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/show/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/show/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/status/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/status/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/steps/index.js';
@@ -0,0 +1,2 @@
1
+ // Implementation lives in the new cli layer; oclif discovers commands only under src/commands.
2
+ export { default } from '../../cli/commands/migrations/steps/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/unuse/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/unuse/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/use/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/migrations/use/index.js';
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class PaywallsCreate extends Command {
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { draftFlowError } from '../../lib/flow-help.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { draftFlowError } from '../../lib/flow-help.js';
@@ -1,5 +1,5 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  const VALID_PERIODS = [
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Args, Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { isValidUuid } from '../../lib/flags.js';
5
5
  import { printResponse } from '../../lib/output.js';
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import { appIdFlag } from '../../cli/flags.js';
2
+ import { appIdFlag } from '../../cli/input/app.js';
3
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
4
4
  import { paginationFlags, paginationParams } from '../../lib/flags.js';
5
5
  import { printList } from '../../lib/output.js';
@@ -6,5 +6,9 @@ import type { ErrorParser } from '../core/http/index.js';
6
6
  *
7
7
  * Wired once in createAdapty: which shapes a service speaks is product knowledge, and ASA speaks
8
8
  * another — which is why the transport takes the parser as a parameter.
9
+ *
10
+ * The Wizard Service sits behind the same transport (section 4.5 of the CLI–WS contract) and
11
+ * words its rejection as `{ error: { code, message } }` (`WizardError`) — one shape this parser
12
+ * now reads too, alongside the ones the developer API sends.
9
13
  */
10
14
  export declare const developerErrorParser: ErrorParser;
@@ -5,6 +5,10 @@
5
5
  *
6
6
  * Wired once in createAdapty: which shapes a service speaks is product knowledge, and ASA speaks
7
7
  * another — which is why the transport takes the parser as a parameter.
8
+ *
9
+ * The Wizard Service sits behind the same transport (section 4.5 of the CLI–WS contract) and
10
+ * words its rejection as `{ error: { code, message } }` (`WizardError`) — one shape this parser
11
+ * now reads too, alongside the ones the developer API sends.
8
12
  */
9
13
  export const developerErrorParser = (_status, body) => {
10
14
  if (typeof body !== 'object' || body === null) {
@@ -16,11 +20,32 @@ export const developerErrorParser = (_status, body) => {
16
20
  // than an HTTP status when the server sends no field errors
17
21
  return { code: errorCode, message: fieldMessages(errors) ?? errorCode };
18
22
  }
23
+ if (typeof error === 'object' && error !== null) {
24
+ const { code, message } = error;
25
+ if (typeof code === 'string' && code !== '') {
26
+ return { code, message: typeof message === 'string' && message !== '' ? message : code };
27
+ }
28
+ }
19
29
  if (typeof error === 'string' && error !== '') {
20
30
  return { code: error, message: error };
21
31
  }
32
+ if (Array.isArray(errors)) {
33
+ return listedErrors(errors);
34
+ }
22
35
  return {};
23
36
  };
37
+ /** `{ errors: [{ detail, code, status }] }`: how the API turns a token away, `not_authenticated` on a 403. */
38
+ const listedErrors = (errors) => {
39
+ const items = errors.filter(item => typeof item === 'object' && item !== null);
40
+ const details = items.map(item => item.detail).filter(isText);
41
+ const code = items.map(item => item.code).find(isText);
42
+ const message = details.length > 0 ? details.join('; ') : code;
43
+ if (message === undefined) {
44
+ return {};
45
+ }
46
+ return code === undefined ? { message } : { code, message };
47
+ };
48
+ const isText = (value) => typeof value === 'string' && value !== '';
24
49
  /** `non_field_errors` is the server's name for "about the request as a whole": printed bare. */
25
50
  const fieldMessages = (errors) => {
26
51
  if (typeof errors !== 'object' || errors === null) {
@@ -1,6 +1,7 @@
1
1
  import type { AccessLevelsApi } from './access-levels.js';
2
2
  import type { AppsApi } from './apps/index.js';
3
3
  import type { AuthApi } from './auth/index.js';
4
+ import type { MigrationApi } from './migrations/index.js';
4
5
  import type { Clock } from '../core/clock.js';
5
6
  import type { RetryAttempt } from '../core/http/index.js';
6
7
  export { platforms } from './apps/index.js';
@@ -8,6 +9,7 @@ export { developerErrorParser } from './errors.js';
8
9
  export type { AccessLevel, AccessLevelList, AccessLevelsApi } from './access-levels.js';
9
10
  export type { AppDetail, AppsApi, AppSummary, CreateAppInput, UpdateAppInput } from './apps/index.js';
10
11
  export type { AuthApi, AuthUser, IssuedToken } from './auth/index.js';
12
+ export type { Action, ActionKind, AvailableFlow, CreateMigrationInput, Envelope, Issue, JsonSchema, Migration, MigrationApi, MigrationList, MigrationState, Progress, ResourceRef, Step, StepStatus, WaitOptions, WizardError, } from './migrations/index.js';
11
13
  export type { PageParams, Paginated, Pagination } from './pagination.js';
12
14
  /** Exported because the adapter compares the resolved URL with it and warns when they differ. */
13
15
  export declare const DEFAULT_ADAPTY_API_URL = "https://api-admin.adapty.io/api/v1/developer";
@@ -20,6 +22,8 @@ export type AdaptyOptions = {
20
22
  baseUrl?: string | undefined;
21
23
  clock?: Clock | undefined;
22
24
  fetch?: typeof globalThis.fetch | undefined;
25
+ /** Whether a person is watching the caller, for the server's audit trail. */
26
+ interactive?: boolean | undefined;
23
27
  onRetry?: ((info: RetryAttempt) => void) | undefined;
24
28
  signal?: AbortSignal | undefined;
25
29
  /** Without a token only auth is usable — that is how login builds the sdk. */
@@ -31,6 +35,7 @@ export type Adapty = {
31
35
  accessLevels: AccessLevelsApi;
32
36
  apps: AppsApi;
33
37
  auth: AuthApi;
38
+ migrations: MigrationApi;
34
39
  };
35
40
  /** The assembly point of the developer API: one transport, resources on top of it. */
36
41
  export declare const createAdapty: (options?: AdaptyOptions) => Adapty;