adapty 0.6.1-beta.0 → 0.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.
- package/dist/commands/asa/campaigns/bulk-list.d.ts +16 -0
- package/dist/commands/asa/campaigns/bulk-list.js +54 -0
- package/dist/lib/api-schemas.d.ts +0 -15
- package/dist/lib/asa-flags.d.ts +1 -0
- package/dist/lib/asa-flags.js +1 -1
- package/dist/lib/asa-schemas.d.ts +15 -0
- package/oclif.manifest.json +1114 -1099
- package/package.json +1 -1
- package/dist/commands/flows/config/validate.d.ts +0 -20
- package/dist/commands/flows/config/validate.js +0 -81
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
import type { FlowConfigValidationDTO } from '../../../lib/api-schemas.js';
|
|
3
|
-
export default class FlowsConfigValidate extends Command {
|
|
4
|
-
static args: {
|
|
5
|
-
flow_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
-
};
|
|
7
|
-
static description: string;
|
|
8
|
-
static enableJsonFlag: boolean;
|
|
9
|
-
static examples: string[];
|
|
10
|
-
static flags: {
|
|
11
|
-
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
'config-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
source: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
};
|
|
16
|
-
run(): Promise<FlowConfigValidationDTO>;
|
|
17
|
-
private parseJson;
|
|
18
|
-
private readConfig;
|
|
19
|
-
private readStdin;
|
|
20
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { createAuthenticatedClient } from '../../../lib/client-from-config.js';
|
|
4
|
-
import { appFlag, isValidUuid } from '../../../lib/flags.js';
|
|
5
|
-
import { printResponse } from '../../../lib/output.js';
|
|
6
|
-
export default class FlowsConfigValidate extends Command {
|
|
7
|
-
static args = {
|
|
8
|
-
flow_id: Args.string({ description: 'Flow ID (UUID)', required: true }),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Check whether a builder config is publishable (advisory; does not save). Exits non-zero when the config is not publishable.';
|
|
11
|
-
static enableJsonFlag = true;
|
|
12
|
-
static examples = [
|
|
13
|
-
'<%= config.bin %> flows config validate --app UUID FLOW_UUID --config-file config.json',
|
|
14
|
-
'cat config.json | <%= config.bin %> flows config validate --app UUID FLOW_UUID --config-file -',
|
|
15
|
-
'<%= config.bin %> flows config validate --app UUID FLOW_UUID --config \'{"screens":[],"locales":[]}\'',
|
|
16
|
-
];
|
|
17
|
-
static flags = {
|
|
18
|
-
...appFlag,
|
|
19
|
-
config: Flags.string({
|
|
20
|
-
description: 'Builder config as a JSON string',
|
|
21
|
-
exactlyOne: ['config', 'config-file'],
|
|
22
|
-
}),
|
|
23
|
-
'config-file': Flags.string({
|
|
24
|
-
description: 'JSON file with the builder config, or - to read stdin',
|
|
25
|
-
exactlyOne: ['config', 'config-file'],
|
|
26
|
-
}),
|
|
27
|
-
source: Flags.string({
|
|
28
|
-
default: 'adapty-cli',
|
|
29
|
-
description: 'Caller attribution, sent as X-Adapty-Source (e.g. byo-cli)',
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
async run() {
|
|
33
|
-
const { args, flags } = await this.parse(FlowsConfigValidate);
|
|
34
|
-
if (!isValidUuid(args.flow_id)) {
|
|
35
|
-
this.error('Invalid flow ID format.', { exit: 2 });
|
|
36
|
-
}
|
|
37
|
-
const config = await this.readConfig(flags);
|
|
38
|
-
const body = { config };
|
|
39
|
-
const client = await createAuthenticatedClient(this.config);
|
|
40
|
-
const result = await client.post(`/apps/${flags.app}/flows/${args.flow_id}/config/validate`, body, undefined, { headers: { 'X-Adapty-Source': flags.source } });
|
|
41
|
-
this.log(result.valid ? 'Config is publishable.' : 'Config is NOT publishable.');
|
|
42
|
-
printResponse(result, this.log.bind(this));
|
|
43
|
-
// Advisory endpoint always returns HTTP 200; surface the verdict as an exit code so scripts and agents
|
|
44
|
-
// can gate on it. The JSON/`valid` field stays the source of truth for programmatic consumers.
|
|
45
|
-
if (!result.valid) {
|
|
46
|
-
process.exitCode = 1;
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
parseJson(raw, label) {
|
|
51
|
-
try {
|
|
52
|
-
return JSON.parse(raw);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
this.error(`Invalid ${label} JSON: ${error instanceof Error ? error.message : String(error)}`, { exit: 2 });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async readConfig(flags) {
|
|
59
|
-
if (flags.config !== undefined) {
|
|
60
|
-
return this.parseJson(flags.config, '--config');
|
|
61
|
-
}
|
|
62
|
-
const path = flags['config-file'];
|
|
63
|
-
if (path === undefined) {
|
|
64
|
-
this.error('Provide --config or --config-file.', { exit: 2 });
|
|
65
|
-
}
|
|
66
|
-
let raw;
|
|
67
|
-
try {
|
|
68
|
-
raw = path === '-' ? await this.readStdin() : await readFile(path, 'utf8');
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
this.error(`Could not read ${path}.`, { exit: 2 });
|
|
72
|
-
}
|
|
73
|
-
return this.parseJson(raw, path);
|
|
74
|
-
}
|
|
75
|
-
async readStdin() {
|
|
76
|
-
const chunks = [];
|
|
77
|
-
for await (const chunk of process.stdin)
|
|
78
|
-
chunks.push(chunk);
|
|
79
|
-
return Buffer.concat(chunks).toString('utf8');
|
|
80
|
-
}
|
|
81
|
-
}
|