adapty 0.8.6 → 0.8.8

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 (89) hide show
  1. package/README.md +31 -2
  2. package/dist/cli/base/adapty/adapty-command.d.ts +1 -4
  3. package/dist/cli/base/adapty/build.d.ts +2 -8
  4. package/dist/cli/base/adapty/index.d.ts +2 -3
  5. package/dist/cli/base/adapty/index.js +1 -1
  6. package/dist/cli/base/adapty/openSession.d.ts +2 -19
  7. package/dist/cli/base/adapty/openSession.js +6 -16
  8. package/dist/cli/base/attribution/attribution-command.d.ts +16 -0
  9. package/dist/cli/base/attribution/attribution-command.js +42 -0
  10. package/dist/cli/base/attribution/build.d.ts +5 -0
  11. package/dist/cli/base/attribution/build.js +12 -0
  12. package/dist/cli/base/attribution/flags.d.ts +16 -0
  13. package/dist/cli/base/attribution/flags.js +28 -0
  14. package/dist/cli/base/attribution/index.d.ts +4 -0
  15. package/dist/cli/base/attribution/index.js +4 -0
  16. package/dist/cli/base/attribution/openSession.d.ts +9 -0
  17. package/dist/cli/base/attribution/openSession.js +19 -0
  18. package/dist/cli/base/base-command.d.ts +7 -0
  19. package/dist/cli/base/session.d.ts +30 -0
  20. package/dist/cli/base/session.js +20 -0
  21. package/dist/cli/commands/attribution/dimensions.d.ts +7 -0
  22. package/dist/cli/commands/attribution/dimensions.js +18 -0
  23. package/dist/cli/commands/attribution/metrics.d.ts +7 -0
  24. package/dist/cli/commands/attribution/metrics.js +35 -0
  25. package/dist/cli/commands/attribution/report/index.d.ts +18 -0
  26. package/dist/cli/commands/attribution/report/index.js +93 -0
  27. package/dist/cli/commands/attribution/report/lib/render.d.ts +3 -0
  28. package/dist/cli/commands/attribution/report/lib/render.js +24 -0
  29. package/dist/cli/commands/attribution/values.d.ts +14 -0
  30. package/dist/cli/commands/attribution/values.js +44 -0
  31. package/dist/cli/errors.d.ts +12 -0
  32. package/dist/cli/errors.js +16 -0
  33. package/dist/cli/flags.d.ts +4 -0
  34. package/dist/cli/flags.js +14 -4
  35. package/dist/commands/access-levels/create.js +2 -2
  36. package/dist/commands/access-levels/get.js +3 -2
  37. package/dist/commands/access-levels/list.js +3 -2
  38. package/dist/commands/access-levels/update.js +3 -2
  39. package/dist/commands/asa/keywords/recommend.d.ts +20 -0
  40. package/dist/commands/asa/keywords/recommend.js +102 -0
  41. package/dist/commands/attribution/dimensions.d.ts +1 -0
  42. package/dist/commands/attribution/dimensions.js +2 -0
  43. package/dist/commands/attribution/metrics.d.ts +1 -0
  44. package/dist/commands/attribution/metrics.js +2 -0
  45. package/dist/commands/attribution/report.d.ts +1 -0
  46. package/dist/commands/attribution/report.js +2 -0
  47. package/dist/commands/attribution/values.d.ts +1 -0
  48. package/dist/commands/attribution/values.js +2 -0
  49. package/dist/commands/flows/config/get.js +3 -2
  50. package/dist/commands/flows/config/update.js +3 -2
  51. package/dist/commands/flows/config/validate.js +3 -2
  52. package/dist/commands/flows/create.js +2 -2
  53. package/dist/commands/flows/get.js +3 -2
  54. package/dist/commands/flows/list.js +3 -2
  55. package/dist/commands/flows/media/upload.js +2 -2
  56. package/dist/commands/flows/publish.js +3 -2
  57. package/dist/commands/flows/update.js +3 -2
  58. package/dist/commands/paywalls/create.js +2 -2
  59. package/dist/commands/paywalls/get.js +3 -2
  60. package/dist/commands/paywalls/list.js +3 -2
  61. package/dist/commands/paywalls/placements.js +3 -2
  62. package/dist/commands/paywalls/update.js +3 -2
  63. package/dist/commands/placements/create.js +2 -2
  64. package/dist/commands/placements/get.js +3 -2
  65. package/dist/commands/placements/list.js +3 -2
  66. package/dist/commands/placements/update.js +3 -2
  67. package/dist/commands/products/create.js +2 -2
  68. package/dist/commands/products/get.js +3 -2
  69. package/dist/commands/products/list.js +3 -2
  70. package/dist/commands/products/update.js +3 -2
  71. package/dist/commands/segments/get.js +3 -2
  72. package/dist/commands/segments/list.js +3 -2
  73. package/dist/lib/asa-schemas.d.ts +40 -0
  74. package/dist/lib/flags.d.ts +0 -3
  75. package/dist/lib/flags.js +0 -13
  76. package/dist/sdk/attribution/catalog.d.ts +51 -0
  77. package/dist/sdk/attribution/catalog.js +6 -0
  78. package/dist/sdk/attribution/errors.d.ts +10 -0
  79. package/dist/sdk/attribution/errors.js +43 -0
  80. package/dist/sdk/attribution/index.d.ts +30 -0
  81. package/dist/sdk/attribution/index.js +33 -0
  82. package/dist/sdk/attribution/report.d.ts +75 -0
  83. package/dist/sdk/attribution/report.js +81 -0
  84. package/dist/sdk/attribution/resource.d.ts +30 -0
  85. package/dist/sdk/attribution/resource.js +51 -0
  86. package/dist/sdk/attribution/values.d.ts +39 -0
  87. package/dist/sdk/attribution/values.js +21 -0
  88. package/oclif.manifest.json +1024 -692
  89. package/package.json +4 -1
@@ -0,0 +1,44 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { validateValues } from '../../../sdk/attribution/index.js';
3
+ import { assertValid } from '../../../sdk/core/validation.js';
4
+ import { AttributionCommand, periodFlags, periodParams, revenueBasisFlag } from '../../base/attribution/index.js';
5
+ import { appIdFlag } from '../../flags.js';
6
+ const describeItem = (item) => {
7
+ if ('value' in item) {
8
+ return item.value ?? '—';
9
+ }
10
+ return `${item.name ?? '—'} (${item.channel ?? '—'}, id ${item.id ?? '—'})`;
11
+ };
12
+ const renderValues = ({ data }) => (data.items.length === 0
13
+ ? `No ${data.dimension} values for this period.`
14
+ : data.items.map(item => describeItem(item)).join('\n'));
15
+ export default class AttributionValues extends AttributionCommand {
16
+ static description = 'List the values a dimension takes for an app over a period: what a report --filter can use';
17
+ static examples = [
18
+ '<%= config.bin %> attribution values --app APP_UUID --date-from 2026-08-01 --date-to 2026-08-31 --dimension campaign',
19
+ '<%= config.bin %> attribution values --app APP_UUID --date-from 2026-08-01 --date-to 2026-08-31 --dimension country --json',
20
+ ];
21
+ static flags = {
22
+ ...appIdFlag,
23
+ ...periodFlags,
24
+ dimension: Flags.string({
25
+ description: 'A filterable dimension, as `adapty attribution dimensions` lists it',
26
+ required: true,
27
+ }),
28
+ ...revenueBasisFlag,
29
+ };
30
+ async run() {
31
+ const { flags } = await this.parse(AttributionValues);
32
+ const input = {
33
+ appId: flags.app,
34
+ ...periodParams(flags),
35
+ dimension: flags.dimension,
36
+ revenueBasis: flags['revenue-basis'],
37
+ };
38
+ // Before this.attribution: bad input is exit 2 even without a token
39
+ assertValid(validateValues(input));
40
+ const values = await this.attribution.values(input);
41
+ this.render(values, renderValues);
42
+ return values;
43
+ }
44
+ }
@@ -20,6 +20,8 @@ export type ErrorJson = {
20
20
  error_code?: string | undefined;
21
21
  errors?: unknown;
22
22
  message: string;
23
+ /** The server's Retry-After in whole seconds, rounded up; absent when the server asked for no wait. */
24
+ retry_after_seconds?: number | undefined;
23
25
  status?: number | undefined;
24
26
  status_code?: number | undefined;
25
27
  };
@@ -31,7 +33,17 @@ export declare class CliError extends Errors.CLIError {
31
33
  readonly exitCode: number;
32
34
  readonly json: ErrorJson;
33
35
  constructor(message: string, exit: number, code?: string, data?: Partial<ErrorJson>);
36
+ /**
37
+ * What a command still on oclif's own Command prints under --json, where the error object is
38
+ * serialized as it is: the same `{ message, ... }` a migrated command prints, not its internals.
39
+ */
40
+ toJSON(): ErrorJson;
34
41
  }
42
+ /**
43
+ * Bad input found by a flag parser: exit 2 in both human and --json mode, hence a CliError. Its
44
+ * json keeps the text as written; oclif prefixes only the human message with the flag's name.
45
+ */
46
+ export declare const usageError: (message: string) => CliError;
35
47
  /**
36
48
  * The one place where an sdk error gets a human text and an exit code. No default in the switch:
37
49
  * a new kind fails to compile until it is mapped here.
@@ -28,7 +28,19 @@ export class CliError extends Errors.CLIError {
28
28
  this.code = code;
29
29
  this.json = { message, code, ...data };
30
30
  }
31
+ /**
32
+ * What a command still on oclif's own Command prints under --json, where the error object is
33
+ * serialized as it is: the same `{ message, ... }` a migrated command prints, not its internals.
34
+ */
35
+ toJSON() {
36
+ return this.json;
37
+ }
31
38
  }
39
+ /**
40
+ * Bad input found by a flag parser: exit 2 in both human and --json mode, hence a CliError. Its
41
+ * json keeps the text as written; oclif prefixes only the human message with the flag's name.
42
+ */
43
+ export const usageError = (message) => new CliError(message, exitCode.usage);
32
44
  const cliError = (message, exit, code, data) => new CliError(message, exit, code, data);
33
45
  /** Issue.path is a camelCase sdk field; the user typed a kebab-case flag. */
34
46
  const flagName = (path) => `--${path.replace(/[A-Z]/g, char => `-${char.toLowerCase()}`)}`;
@@ -55,6 +67,10 @@ export const toCliError = (error) => {
55
67
  errors: fields,
56
68
  status: error.status,
57
69
  status_code: error.status,
70
+ // Only when the server asked for a wait: an agent reads it instead of guessing one
71
+ ...(error.retryAfterMs === undefined
72
+ ? {}
73
+ : { retry_after_seconds: Math.ceil(error.retryAfterMs / 1000) }),
58
74
  });
59
75
  }
60
76
  case 'auth_required': {
@@ -4,6 +4,10 @@ export declare const isUuid: (value: string) => boolean;
4
4
  export declare const appIdArg: {
5
5
  app_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
6
  };
7
+ /** `appIdArg` as a flag: `static flags = { ...appIdFlag }`. Texts kept as the published `--app`. */
8
+ export declare const appIdFlag: {
9
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
7
11
  /** The published defaults, so a migrated `list` asks for the same page as an untouched one. */
8
12
  export declare const paginationFlags: {
9
13
  page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
package/dist/cli/flags.js CHANGED
@@ -1,6 +1,8 @@
1
- import { Args, Errors, Flags } from '@oclif/core';
2
- import { exitCode } from './errors.js';
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { usageError } from './errors.js';
3
3
  const UUID_PATTERN = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i;
4
+ /** The published wording of both the `app_id` arg and the `--app` flag. */
5
+ const APP_ID_HINT = 'Invalid app ID format. Run `adapty apps list` to find your app ID.';
4
6
  export const isUuid = (value) => UUID_PATTERN.test(value);
5
7
  /**
6
8
  * Checking the shape of a value is the parser's job, so a run() never starts with one. oclif turns
@@ -9,12 +11,20 @@ export const isUuid = (value) => UUID_PATTERN.test(value);
9
11
  */
10
12
  const uuidParser = (hint) => (input) => (isUuid(input)
11
13
  ? Promise.resolve(input)
12
- : Promise.reject(new Errors.CLIError(hint, { exit: exitCode.usage })));
14
+ : Promise.reject(usageError(hint)));
13
15
  /** Spread into a command: `static args = { ...appIdArg }`. Texts kept as published. */
14
16
  export const appIdArg = {
15
17
  app_id: Args.string({
16
18
  description: 'App ID (UUID)',
17
- parse: uuidParser('Invalid app ID format. Run `adapty apps list` to find your app ID.'),
19
+ parse: uuidParser(APP_ID_HINT),
20
+ required: true,
21
+ }),
22
+ };
23
+ /** `appIdArg` as a flag: `static flags = { ...appIdFlag }`. Texts kept as the published `--app`. */
24
+ export const appIdFlag = {
25
+ app: Flags.string({
26
+ description: 'App ID (UUID)',
27
+ parse: uuidParser(APP_ID_HINT),
18
28
  required: true,
19
29
  }),
20
30
  };
@@ -1,6 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag } from '../../lib/flags.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class AccessLevelsCreate extends Command {
6
6
  static description = 'Create a custom access level';
@@ -9,7 +9,7 @@ export default class AccessLevelsCreate extends Command {
9
9
  '<%= config.bin %> access-levels create --app 550e8400-... --sdk-id vip --title "VIP Access"',
10
10
  ];
11
11
  static flags = {
12
- ...appFlag,
12
+ ...appIdFlag,
13
13
  'sdk-id': Flags.string({ description: 'Access level SDK identifier', required: true }),
14
14
  'title': Flags.string({ description: 'Access level title', required: true }),
15
15
  };
@@ -1,6 +1,7 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class AccessLevelsGet extends Command {
6
7
  static args = {
@@ -10,7 +11,7 @@ export default class AccessLevelsGet extends Command {
10
11
  static enableJsonFlag = true;
11
12
  static examples = ['<%= config.bin %> access-levels get --app UUID 550e8400-e29b-41d4-a716-446655440000'];
12
13
  static flags = {
13
- ...appFlag,
14
+ ...appIdFlag,
14
15
  };
15
16
  async run() {
16
17
  const { args, flags } = await this.parse(AccessLevelsGet);
@@ -1,13 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, paginationFlags, paginationParams } from '../../lib/flags.js';
4
+ import { paginationFlags, paginationParams } from '../../lib/flags.js';
4
5
  import { printList } from '../../lib/output.js';
5
6
  export default class AccessLevelsList extends Command {
6
7
  static description = 'List access levels for an app';
7
8
  static enableJsonFlag = true;
8
9
  static examples = ['<%= config.bin %> access-levels list --app 550e8400-e29b-41d4-a716-446655440000'];
9
10
  static flags = {
10
- ...appFlag,
11
+ ...appIdFlag,
11
12
  ...paginationFlags,
12
13
  };
13
14
  async run() {
@@ -1,6 +1,7 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class AccessLevelsUpdate extends Command {
6
7
  static args = {
@@ -12,7 +13,7 @@ export default class AccessLevelsUpdate extends Command {
12
13
  '<%= config.bin %> access-levels update --app UUID 550e8400-... --title "VIP Access"',
13
14
  ];
14
15
  static flags = {
15
- ...appFlag,
16
+ ...appIdFlag,
16
17
  title: Flags.string({ description: 'Access level title', required: true }),
17
18
  };
18
19
  async run() {
@@ -0,0 +1,20 @@
1
+ import { Command } from '@oclif/core';
2
+ import type { AsaBrandKeywordPoolDTO, AsaCompetitorBrandKeywordPoolsDTO, AsaGenericKeywordPoolDTO } from '../../../lib/asa-schemas.js';
3
+ type PoolDTO = AsaBrandKeywordPoolDTO | AsaGenericKeywordPoolDTO;
4
+ type RecommendationResult = AsaCompetitorBrandKeywordPoolsDTO | PoolDTO;
5
+ export default class AsaKeywordsRecommend extends Command {
6
+ static description: string;
7
+ static enableJsonFlag: boolean;
8
+ static examples: string[];
9
+ static flags: {
10
+ 'adam-id': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ country: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ type: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<RecommendationResult>;
15
+ private printCompetitorPools;
16
+ private printPool;
17
+ private omitAdamId;
18
+ private statusHint;
19
+ }
20
+ export {};
@@ -0,0 +1,102 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { createAsaClient } from '../../../lib/asa-client.js';
3
+ import { printList, printResponse } from '../../../lib/output.js';
4
+ const TYPES = ['brand', 'generic', 'competitor'];
5
+ const PATHS = {
6
+ brand: '/keyword-recommendations/brand',
7
+ competitor: '/keyword-recommendations/competitor-brand',
8
+ generic: '/keyword-recommendations/generic',
9
+ };
10
+ export default class AsaKeywordsRecommend extends Command {
11
+ static description = 'Keyword recommendations for one of your apps: its brand terms, generic terms, or the brand terms of its selected competitors';
12
+ static enableJsonFlag = true;
13
+ static examples = [
14
+ '<%= config.bin %> asa keywords recommend --adam-id 1668337467 --type brand',
15
+ '<%= config.bin %> asa keywords recommend --adam-id 1668337467 --type generic --country US',
16
+ '<%= config.bin %> asa keywords recommend --adam-id 1668337467 --type competitor',
17
+ ];
18
+ static flags = {
19
+ 'adam-id': Flags.integer({
20
+ description: 'Apple App Store ID (adam_id) of your app, from `asa apps list`',
21
+ required: true,
22
+ }),
23
+ 'country': Flags.string({
24
+ description: 'ISO country code (e.g. US); repeatable, default every country in the pool',
25
+ multiple: true,
26
+ }),
27
+ 'type': Flags.string({ description: 'Which pool to read', options: [...TYPES], required: true }),
28
+ };
29
+ async run() {
30
+ const { flags } = await this.parse(AsaKeywordsRecommend);
31
+ const countries = (flags.country ?? []).map(code => code.trim().toUpperCase());
32
+ if (countries.some(code => !/^[A-Z]{2}$/.test(code))) {
33
+ this.error('--country takes two-letter ISO codes, e.g. --country US.', { exit: 2 });
34
+ }
35
+ const type = flags.type;
36
+ const client = await createAsaClient(this);
37
+ const params = { adam_id: String(flags['adam-id']), country: countries.length > 0 ? countries : undefined };
38
+ if (type === 'competitor') {
39
+ const pools = await client.get(PATHS.competitor, params);
40
+ this.printCompetitorPools(pools);
41
+ return pools;
42
+ }
43
+ const pool = await client.get(PATHS[type], params);
44
+ this.printPool(pool, type);
45
+ return pool;
46
+ }
47
+ printCompetitorPools(result) {
48
+ if (result.pools.length === 0) {
49
+ this.log('No competitors selected for this app yet — select them in the Adapty dashboard (Autopilot setup).');
50
+ return;
51
+ }
52
+ for (const [i, pool] of result.pools.entries()) {
53
+ printResponse({
54
+ competitor_adam_id: pool.competitor_adam_id,
55
+ status: pool.status,
56
+ keywords_count: pool.keywords.length,
57
+ }, this.log.bind(this));
58
+ const hint = this.statusHint(pool.status);
59
+ if (hint !== undefined) {
60
+ this.log(hint);
61
+ }
62
+ if (pool.keywords.length > 0) {
63
+ this.log('');
64
+ printList(pool.keywords.map(keyword => this.omitAdamId(keyword)), this.log.bind(this));
65
+ }
66
+ if (i < result.pools.length - 1) {
67
+ this.log('===');
68
+ }
69
+ }
70
+ }
71
+ printPool(pool, type) {
72
+ const header = { status: pool.status, keywords_count: pool.keywords.length };
73
+ if (type === 'brand') {
74
+ header.brand_terms = pool.brand?.brand_terms ?? [];
75
+ }
76
+ printResponse(header, this.log.bind(this));
77
+ const hint = this.statusHint(pool.status);
78
+ if (hint !== undefined) {
79
+ this.log(hint);
80
+ }
81
+ if (pool.keywords.length > 0) {
82
+ this.log('');
83
+ const keywords = type === 'brand'
84
+ ? pool.keywords.map(keyword => this.omitAdamId(keyword))
85
+ : pool.keywords;
86
+ printList(keywords, this.log.bind(this));
87
+ }
88
+ }
89
+ omitAdamId(keyword) {
90
+ const { adam_id: _adamId, ...rest } = keyword;
91
+ return rest;
92
+ }
93
+ statusHint(status) {
94
+ if (status === 'building') {
95
+ return 'Still building — retry in about a minute.';
96
+ }
97
+ if (status === 'failed') {
98
+ return 'The pool build failed — retry later or contact support.';
99
+ }
100
+ return undefined;
101
+ }
102
+ }
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/attribution/dimensions.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/attribution/dimensions.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/attribution/metrics.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/attribution/metrics.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/attribution/report/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/attribution/report/index.js';
@@ -0,0 +1 @@
1
+ export { default } from '../../cli/commands/attribution/values.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/attribution/values.js';
@@ -1,6 +1,7 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../../lib/flags.js';
4
+ import { isValidUuid } from '../../../lib/flags.js';
4
5
  import { printResponse } from '../../../lib/output.js';
5
6
  export default class FlowsConfigGet extends Command {
6
7
  static args = {
@@ -11,7 +12,7 @@ export default class FlowsConfigGet extends Command {
11
12
  static enableJsonFlag = true;
12
13
  static examples = ['<%= config.bin %> flows config get --app UUID 550e8400-e29b-41d4-a716-446655440000'];
13
14
  static flags = {
14
- ...appFlag,
15
+ ...appIdFlag,
15
16
  };
16
17
  async run() {
17
18
  const { args, flags } = await this.parse(FlowsConfigGet);
@@ -1,7 +1,8 @@
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
4
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
4
- import { appFlag, isValidUuid } from '../../../lib/flags.js';
5
+ import { isValidUuid } from '../../../lib/flags.js';
5
6
  import { printResponse } from '../../../lib/output.js';
6
7
  export default class FlowsConfigUpdate extends Command {
7
8
  static args = {
@@ -15,7 +16,7 @@ export default class FlowsConfigUpdate extends Command {
15
16
  '<%= config.bin %> flows config update --app UUID FLOW_UUID --config \'{"screens":[],"locales":[]}\' --expected-updated-at 1755001800000',
16
17
  ];
17
18
  static flags = {
18
- ...appFlag,
19
+ ...appIdFlag,
19
20
  'config': Flags.string({
20
21
  description: 'Builder config as a JSON string',
21
22
  exactlyOne: ['config', 'config-file'],
@@ -1,7 +1,8 @@
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
4
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
4
- import { appFlag, isValidUuid } from '../../../lib/flags.js';
5
+ import { isValidUuid } from '../../../lib/flags.js';
5
6
  import { printResponse } from '../../../lib/output.js';
6
7
  export default class FlowsConfigValidate extends Command {
7
8
  static args = {
@@ -15,7 +16,7 @@ export default class FlowsConfigValidate extends Command {
15
16
  '<%= config.bin %> flows config validate --app UUID FLOW_UUID --config \'{"screens":[],"locales":[]}\'',
16
17
  ];
17
18
  static flags = {
18
- ...appFlag,
19
+ ...appIdFlag,
19
20
  'config': Flags.string({
20
21
  description: 'Builder config as a JSON string',
21
22
  exactlyOne: ['config', 'config-file'],
@@ -1,13 +1,13 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag } from '../../lib/flags.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class FlowsCreate extends Command {
6
6
  static description = 'Create a flow (row only — write its config with `flows config update`)';
7
7
  static enableJsonFlag = true;
8
8
  static examples = ['<%= config.bin %> flows create --app UUID --name "Onboarding"'];
9
9
  static flags = {
10
- ...appFlag,
10
+ ...appIdFlag,
11
11
  name: Flags.string({ description: 'Flow name', required: true }),
12
12
  };
13
13
  async run() {
@@ -1,6 +1,7 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class FlowsGet extends Command {
6
7
  static args = {
@@ -10,7 +11,7 @@ export default class FlowsGet extends Command {
10
11
  static enableJsonFlag = true;
11
12
  static examples = ['<%= config.bin %> flows get --app UUID 550e8400-e29b-41d4-a716-446655440000'];
12
13
  static flags = {
13
- ...appFlag,
14
+ ...appIdFlag,
14
15
  };
15
16
  async run() {
16
17
  const { args, flags } = await this.parse(FlowsGet);
@@ -1,13 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, paginationFlags, paginationParams } from '../../lib/flags.js';
4
+ import { paginationFlags, paginationParams } from '../../lib/flags.js';
4
5
  import { printList } from '../../lib/output.js';
5
6
  export default class FlowsList extends Command {
6
7
  static description = 'List flows for an app';
7
8
  static enableJsonFlag = true;
8
9
  static examples = ['<%= config.bin %> flows list --app 550e8400-...'];
9
10
  static flags = {
10
- ...appFlag,
11
+ ...appIdFlag,
11
12
  ...paginationFlags,
12
13
  };
13
14
  async run() {
@@ -1,8 +1,8 @@
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
5
  import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
5
- import { appFlag } from '../../../lib/flags.js';
6
6
  import { printResponse } from '../../../lib/output.js';
7
7
  const IMAGE_MIME_TYPES = {
8
8
  '.gif': 'image/gif',
@@ -21,7 +21,7 @@ export default class FlowsMediaUpload extends Command {
21
21
  static enableJsonFlag = true;
22
22
  static examples = ['<%= config.bin %> flows media upload --app UUID ./onboarding-hero.png'];
23
23
  static flags = {
24
- ...appFlag,
24
+ ...appIdFlag,
25
25
  };
26
26
  async run() {
27
27
  const { args, flags } = await this.parse(FlowsMediaUpload);
@@ -1,8 +1,9 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
4
  import { confirmFlags, confirmMutation } from '../../lib/confirm.js';
4
5
  import { ApiError } from '../../lib/errors.js';
5
- import { appFlag, isValidUuid } from '../../lib/flags.js';
6
+ import { isValidUuid } from '../../lib/flags.js';
6
7
  import { flowFixLinks } from '../../lib/flow-help.js';
7
8
  import { printResponse } from '../../lib/output.js';
8
9
  export default class FlowsPublish extends Command {
@@ -14,7 +15,7 @@ export default class FlowsPublish extends Command {
14
15
  static enableJsonFlag = true;
15
16
  static examples = ['<%= config.bin %> flows publish --app UUID 550e8400-e29b-41d4-a716-446655440000'];
16
17
  static flags = {
17
- ...appFlag,
18
+ ...appIdFlag,
18
19
  ...confirmFlags,
19
20
  };
20
21
  async run() {
@@ -1,6 +1,7 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class FlowsUpdate extends Command {
6
7
  static args = {
@@ -10,7 +11,7 @@ export default class FlowsUpdate extends Command {
10
11
  static enableJsonFlag = true;
11
12
  static examples = ['<%= config.bin %> flows update --app UUID 550e8400-e29b-41d4-a716-446655440000 --name "Onboarding v2"'];
12
13
  static flags = {
13
- ...appFlag,
14
+ ...appIdFlag,
14
15
  name: Flags.string({ description: 'New flow name', required: true }),
15
16
  };
16
17
  async run() {
@@ -1,6 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag } from '../../lib/flags.js';
4
4
  import { printResponse } from '../../lib/output.js';
5
5
  export default class PaywallsCreate extends Command {
6
6
  static description = 'Create a paywall with products';
@@ -9,7 +9,7 @@ export default class PaywallsCreate extends Command {
9
9
  '<%= config.bin %> paywalls create --app UUID --title "Default Paywall" --product-id UUID1 --product-id UUID2',
10
10
  ];
11
11
  static flags = {
12
- ...appFlag,
12
+ ...appIdFlag,
13
13
  'product-id': Flags.string({
14
14
  description: 'Product ID (UUID). Repeat for multiple.',
15
15
  multiple: true,
@@ -1,6 +1,7 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class PaywallsGet extends Command {
6
7
  static args = {
@@ -10,7 +11,7 @@ export default class PaywallsGet extends Command {
10
11
  static enableJsonFlag = true;
11
12
  static examples = ['<%= config.bin %> paywalls get --app UUID 550e8400-e29b-41d4-a716-446655440000'];
12
13
  static flags = {
13
- ...appFlag,
14
+ ...appIdFlag,
14
15
  };
15
16
  async run() {
16
17
  const { args, flags } = await this.parse(PaywallsGet);
@@ -1,13 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, paginationFlags, paginationParams } from '../../lib/flags.js';
4
+ import { paginationFlags, paginationParams } from '../../lib/flags.js';
4
5
  import { printList } from '../../lib/output.js';
5
6
  export default class PaywallsList extends Command {
6
7
  static description = 'List paywalls for an app';
7
8
  static enableJsonFlag = true;
8
9
  static examples = ['<%= config.bin %> paywalls list --app 550e8400-...'];
9
10
  static flags = {
10
- ...appFlag,
11
+ ...appIdFlag,
11
12
  ...paginationFlags,
12
13
  };
13
14
  async run() {
@@ -1,6 +1,7 @@
1
1
  import { Args, Command } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printList } from '../../lib/output.js';
5
6
  export default class PaywallsPlacements extends Command {
6
7
  static args = {
@@ -10,7 +11,7 @@ export default class PaywallsPlacements extends Command {
10
11
  static enableJsonFlag = true;
11
12
  static examples = ['<%= config.bin %> paywalls placements --app UUID 770e8400-e29b-41d4-a716-446655440002'];
12
13
  static flags = {
13
- ...appFlag,
14
+ ...appIdFlag,
14
15
  };
15
16
  async run() {
16
17
  const { args, flags } = await this.parse(PaywallsPlacements);
@@ -1,6 +1,7 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
+ import { appIdFlag } from '../../cli/flags.js';
2
3
  import { createAuthenticatedClient } from '../../lib/client-from-config.js';
3
- import { appFlag, isValidUuid } from '../../lib/flags.js';
4
+ import { isValidUuid } from '../../lib/flags.js';
4
5
  import { printResponse } from '../../lib/output.js';
5
6
  export default class PaywallsUpdate extends Command {
6
7
  static args = {
@@ -12,7 +13,7 @@ export default class PaywallsUpdate extends Command {
12
13
  '<%= config.bin %> paywalls update --app UUID 550e8400-... --title "Default Paywall" --product-id UUID1 --product-id UUID2',
13
14
  ];
14
15
  static flags = {
15
- ...appFlag,
16
+ ...appIdFlag,
16
17
  'product-id': Flags.string({
17
18
  description: 'Product ID (UUID). Repeat for multiple.',
18
19
  multiple: true,