adapty 0.8.3-beta.1 → 0.8.3
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/README.md +132 -2
- package/dist/commands/asa/ad-groups/create.js +1 -1
- package/dist/commands/asa/ad-groups/update.js +1 -1
- package/dist/commands/asa/ads/create.js +1 -1
- package/dist/commands/asa/ads/update.js +1 -1
- package/dist/commands/asa/automations/create.d.ts +9 -0
- package/dist/commands/asa/automations/create.js +19 -3
- package/dist/commands/asa/automations/run.js +1 -1
- package/dist/commands/asa/automations/update.d.ts +9 -0
- package/dist/commands/asa/automations/update.js +22 -6
- package/dist/commands/asa/campaigns/bulk-create.js +1 -1
- package/dist/commands/asa/campaigns/create.js +1 -1
- package/dist/commands/asa/campaigns/update.js +1 -1
- package/dist/commands/asa/keywords/add.js +1 -1
- package/dist/commands/asa/keywords/update.js +1 -1
- package/dist/commands/asa/metrics/index.d.ts +4 -1
- package/dist/commands/asa/metrics/index.js +18 -8
- package/dist/commands/asa/negative-keywords/add.js +1 -1
- package/dist/commands/asa/product-pages/sync.js +1 -1
- package/dist/commands/placements/create.js +3 -18
- package/dist/commands/placements/update.js +3 -18
- package/dist/lib/api-schemas.d.ts +1 -10
- package/dist/lib/asa-flags.d.ts +24 -0
- package/dist/lib/asa-flags.js +54 -0
- package/dist/lib/asa-keyword-action.d.ts +18 -0
- package/dist/lib/asa-keyword-action.js +160 -0
- package/dist/lib/errors.js +2 -1
- package/oclif.manifest.json +1353 -1290
- package/package.json +2 -3
- package/dist/commands/flows/publish.d.ts +0 -15
- package/dist/commands/flows/publish.js +0 -47
- package/dist/commands/flows/update.d.ts +0 -15
- package/dist/commands/flows/update.js +0 -28
- package/dist/lib/placement-audiences.d.ts +0 -6
- package/dist/lib/placement-audiences.js +0 -25
- /package/dist/lib/{confirm.d.ts → asa-confirm.d.ts} +0 -0
- /package/dist/lib/{confirm.js → asa-confirm.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapty",
|
|
3
3
|
"description": "Adapty command line interface",
|
|
4
|
-
"version": "0.8.3
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"author": "Adapty team <support@adapty.io>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"adapty": "./bin/run.js"
|
|
@@ -143,8 +143,7 @@
|
|
|
143
143
|
"prepack": "oclif manifest && oclif readme",
|
|
144
144
|
"prepublishOnly": "pnpm build && oclif manifest",
|
|
145
145
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
146
|
-
"version": "oclif readme && git add README.md"
|
|
147
|
-
"publish:beta": "npm publish --tag beta"
|
|
146
|
+
"version": "oclif readme && git add README.md"
|
|
148
147
|
},
|
|
149
148
|
"types": "dist/index.d.ts"
|
|
150
149
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
import type { FlowDTO } from '../../lib/api-schemas.js';
|
|
3
|
-
export default class FlowsPublish 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
|
-
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<FlowDTO>;
|
|
15
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Args, Command } from '@oclif/core';
|
|
2
|
-
import { createAuthenticatedClient } from '../../lib/client-from-config.js';
|
|
3
|
-
import { confirmFlags, confirmMutation } from '../../lib/confirm.js';
|
|
4
|
-
import { ApiError } from '../../lib/errors.js';
|
|
5
|
-
import { appFlag, isValidUuid } from '../../lib/flags.js';
|
|
6
|
-
import { printResponse } from '../../lib/output.js';
|
|
7
|
-
export default class FlowsPublish extends Command {
|
|
8
|
-
static args = {
|
|
9
|
-
flow_id: Args.string({ description: 'Flow ID (UUID)', required: true }),
|
|
10
|
-
};
|
|
11
|
-
static description = 'Publish a flow (async — publication completes in the background)';
|
|
12
|
-
static enableJsonFlag = true;
|
|
13
|
-
static examples = ['<%= config.bin %> flows publish --app UUID 550e8400-e29b-41d4-a716-446655440000'];
|
|
14
|
-
static flags = {
|
|
15
|
-
...appFlag,
|
|
16
|
-
...confirmFlags,
|
|
17
|
-
};
|
|
18
|
-
async run() {
|
|
19
|
-
const { args, flags } = await this.parse(FlowsPublish);
|
|
20
|
-
if (!isValidUuid(args.flow_id)) {
|
|
21
|
-
this.error('Invalid flow ID format.', { exit: 2 });
|
|
22
|
-
}
|
|
23
|
-
const client = await createAuthenticatedClient(this.config);
|
|
24
|
-
const flow = await client.get(`/apps/${flags.app}/flows/${args.flow_id}/`);
|
|
25
|
-
await confirmMutation(this, {
|
|
26
|
-
method: 'POST',
|
|
27
|
-
path: `/apps/${flags.app}/flows/${args.flow_id}/publish/`,
|
|
28
|
-
summary: `Publish flow "${flow.name}" live to end users`,
|
|
29
|
-
}, flags.yes);
|
|
30
|
-
let result;
|
|
31
|
-
try {
|
|
32
|
-
result = await client.post(`/apps/${flags.app}/flows/${args.flow_id}/publish/`);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error instanceof ApiError && (error.statusCode === 400 || error.errorCode === 'validation_error')) {
|
|
36
|
-
this.error(`Flow publish failed: ${error.message}\n` +
|
|
37
|
-
'Publishing needs a flow with a valid config. Fix it, then run `adapty flows publish` again:\n' +
|
|
38
|
-
` • Builder UI: https://app.adapty.io/flows/${args.flow_id}/builder\n` +
|
|
39
|
-
' • Adapty flows agent skill: https://adapty.io/docs/flow-generator-skill', { exit: 1 });
|
|
40
|
-
}
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
this.log('Publishing started — status: publishing. Publication completes asynchronously.');
|
|
44
|
-
printResponse(result, this.log.bind(this));
|
|
45
|
-
return result;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
import type { FlowDTO } from '../../lib/api-schemas.js';
|
|
3
|
-
export default class FlowsUpdate 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
|
-
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<FlowDTO>;
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { createAuthenticatedClient } from '../../lib/client-from-config.js';
|
|
3
|
-
import { appFlag, isValidUuid } from '../../lib/flags.js';
|
|
4
|
-
import { printResponse } from '../../lib/output.js';
|
|
5
|
-
export default class FlowsUpdate extends Command {
|
|
6
|
-
static args = {
|
|
7
|
-
flow_id: Args.string({ description: 'Flow ID (UUID)', required: true }),
|
|
8
|
-
};
|
|
9
|
-
static description = 'Rename a flow';
|
|
10
|
-
static enableJsonFlag = true;
|
|
11
|
-
static examples = ['<%= config.bin %> flows update --app UUID 550e8400-e29b-41d4-a716-446655440000 --name "Onboarding v2"'];
|
|
12
|
-
static flags = {
|
|
13
|
-
...appFlag,
|
|
14
|
-
name: Flags.string({ description: 'New flow name', required: true }),
|
|
15
|
-
};
|
|
16
|
-
async run() {
|
|
17
|
-
const { args, flags } = await this.parse(FlowsUpdate);
|
|
18
|
-
if (!isValidUuid(args.flow_id)) {
|
|
19
|
-
this.error('Invalid flow ID format.', { exit: 2 });
|
|
20
|
-
}
|
|
21
|
-
const body = { name: flags.name };
|
|
22
|
-
const client = await createAuthenticatedClient(this.config);
|
|
23
|
-
const result = await client.put(`/apps/${flags.app}/flows/${args.flow_id}/`, body);
|
|
24
|
-
this.log('Flow updated!');
|
|
25
|
-
printResponse(result, this.log.bind(this));
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a human-readable problem string when `entry` is not a valid placement
|
|
3
|
-
* audience entry, or `null` when it is well-formed. Every entry must carry an
|
|
4
|
-
* explicit `content_type` ('paywall' | 'flow'); there is no implicit paywall.
|
|
5
|
-
*/
|
|
6
|
-
export declare function audienceEntryProblem(entry: unknown): null | string;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Runtime guard for --audiences entries parsed from user/agent-supplied JSON.
|
|
2
|
-
// The DTO union in api-schemas.ts requires content_type, but a JSON.parse gives
|
|
3
|
-
// back `unknown`, so the type alone cannot enforce it — this does, the same way
|
|
4
|
-
// for humans and agents (no prompting).
|
|
5
|
-
/**
|
|
6
|
-
* Returns a human-readable problem string when `entry` is not a valid placement
|
|
7
|
-
* audience entry, or `null` when it is well-formed. Every entry must carry an
|
|
8
|
-
* explicit `content_type` ('paywall' | 'flow'); there is no implicit paywall.
|
|
9
|
-
*/
|
|
10
|
-
export function audienceEntryProblem(entry) {
|
|
11
|
-
if (typeof entry !== 'object' || entry === null) {
|
|
12
|
-
return 'each entry must be a JSON object';
|
|
13
|
-
}
|
|
14
|
-
const { content_type: contentType, flow_id: flowId, paywall_id: paywallId } = entry;
|
|
15
|
-
if (contentType !== 'flow' && contentType !== 'paywall') {
|
|
16
|
-
return 'content_type is required and must be "paywall" or "flow"';
|
|
17
|
-
}
|
|
18
|
-
if (contentType === 'paywall' && typeof paywallId !== 'string') {
|
|
19
|
-
return 'a paywall entry requires paywall_id';
|
|
20
|
-
}
|
|
21
|
-
if (contentType === 'flow' && typeof flowId !== 'string') {
|
|
22
|
-
return 'a flow entry requires flow_id';
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|