@formo/cli 0.1.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/README.md +142 -0
- package/dist/commands/alerts.d.ts +22 -0
- package/dist/commands/alerts.js +204 -0
- package/dist/commands/boards.d.ts +15 -0
- package/dist/commands/boards.js +126 -0
- package/dist/commands/charts.d.ts +7 -0
- package/dist/commands/charts.js +157 -0
- package/dist/commands/contracts.d.ts +18 -0
- package/dist/commands/contracts.js +150 -0
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +49 -0
- package/dist/commands/profiles.d.ts +14 -0
- package/dist/commands/profiles.js +130 -0
- package/dist/commands/query.d.ts +1 -0
- package/dist/commands/query.js +9 -0
- package/dist/commands/segments.d.ts +9 -0
- package/dist/commands/segments.js +81 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +270 -0
- package/dist/lib/client.d.ts +3 -0
- package/dist/lib/client.js +37 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/config.js +46 -0
- package/dist/lib/ui.d.ts +31 -0
- package/dist/lib/ui.js +79 -0
- package/package.json +49 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contracts = void 0;
|
|
4
|
+
exports.listContractsRun = listContractsRun;
|
|
5
|
+
exports.createContractRun = createContractRun;
|
|
6
|
+
exports.updateContractRun = updateContractRun;
|
|
7
|
+
exports.deleteContractRun = deleteContractRun;
|
|
8
|
+
const incur_1 = require("incur");
|
|
9
|
+
const client_1 = require("../lib/client");
|
|
10
|
+
exports.contracts = incur_1.Cli.create('contracts', {
|
|
11
|
+
description: 'Smart contract commands — register, list, update, and remove tracked contracts',
|
|
12
|
+
});
|
|
13
|
+
// ── List contracts ──
|
|
14
|
+
function listContractsRun() {
|
|
15
|
+
(0, client_1.requireApiKey)();
|
|
16
|
+
const client = (0, client_1.createClient)();
|
|
17
|
+
return client.get('/v0/contracts/');
|
|
18
|
+
}
|
|
19
|
+
exports.contracts.command('list', {
|
|
20
|
+
description: 'List all tracked contracts for the project',
|
|
21
|
+
examples: [{ description: 'List all project contracts' }],
|
|
22
|
+
hint: 'Requires contracts:read scope on your API key.',
|
|
23
|
+
run() {
|
|
24
|
+
return listContractsRun();
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
function createContractRun(options) {
|
|
28
|
+
(0, client_1.requireApiKey)();
|
|
29
|
+
const client = (0, client_1.createClient)();
|
|
30
|
+
let parsedAbi;
|
|
31
|
+
try {
|
|
32
|
+
parsedAbi = JSON.parse(options.abi);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error('--abi must be a valid JSON array');
|
|
36
|
+
}
|
|
37
|
+
let parsedEvents;
|
|
38
|
+
try {
|
|
39
|
+
parsedEvents = JSON.parse(options.events);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error('--events must be valid JSON');
|
|
43
|
+
}
|
|
44
|
+
return client.post('/v0/contracts/', {
|
|
45
|
+
address: options.address,
|
|
46
|
+
chain: options.chain,
|
|
47
|
+
name: options.name,
|
|
48
|
+
abi: parsedAbi,
|
|
49
|
+
events: parsedEvents,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.contracts.command('create', {
|
|
53
|
+
description: 'Register a new smart contract to track',
|
|
54
|
+
options: incur_1.z.object({
|
|
55
|
+
address: incur_1.z.string().describe('Contract address (0x…)'),
|
|
56
|
+
chain: incur_1.z.coerce.number().describe('Chain ID (e.g. 1 for Ethereum, 137 for Polygon)'),
|
|
57
|
+
name: incur_1.z.string().describe('Human-readable contract name'),
|
|
58
|
+
abi: incur_1.z.string().describe('Contract ABI as a JSON string'),
|
|
59
|
+
events: incur_1.z.string().describe('Events configuration as a JSON string'),
|
|
60
|
+
}),
|
|
61
|
+
examples: [
|
|
62
|
+
{
|
|
63
|
+
options: {
|
|
64
|
+
address: '0x1234…',
|
|
65
|
+
chain: 1,
|
|
66
|
+
name: 'My Token',
|
|
67
|
+
abi: '[{"type":"event","name":"Transfer"}]',
|
|
68
|
+
events: '{"Transfer":true}',
|
|
69
|
+
},
|
|
70
|
+
description: 'Register an ERC-20 contract on Ethereum',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
hint: 'Requires contracts:write scope on your API key.',
|
|
74
|
+
run({ options }) {
|
|
75
|
+
return createContractRun(options);
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
function updateContractRun(chain, address, options) {
|
|
79
|
+
(0, client_1.requireApiKey)();
|
|
80
|
+
const client = (0, client_1.createClient)();
|
|
81
|
+
let parsedAbi;
|
|
82
|
+
try {
|
|
83
|
+
parsedAbi = JSON.parse(options.abi);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new Error('--abi must be a valid JSON array');
|
|
87
|
+
}
|
|
88
|
+
let parsedEvents;
|
|
89
|
+
try {
|
|
90
|
+
parsedEvents = JSON.parse(options.events);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
throw new Error('--events must be valid JSON');
|
|
94
|
+
}
|
|
95
|
+
return client.put(`/v0/contracts/${encodeURIComponent(chain)}/${encodeURIComponent(address)}`, {
|
|
96
|
+
name: options.name,
|
|
97
|
+
abi: parsedAbi,
|
|
98
|
+
events: parsedEvents,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
exports.contracts.command('update', {
|
|
102
|
+
description: 'Update a tracked contract',
|
|
103
|
+
args: incur_1.z.object({
|
|
104
|
+
chain: incur_1.z.string().describe('Chain ID'),
|
|
105
|
+
address: incur_1.z.string().describe('Contract address (0x…)'),
|
|
106
|
+
}),
|
|
107
|
+
options: incur_1.z.object({
|
|
108
|
+
name: incur_1.z.string().describe('Updated contract name'),
|
|
109
|
+
abi: incur_1.z.string().describe('Updated ABI as a JSON string'),
|
|
110
|
+
events: incur_1.z.string().describe('Updated events configuration as a JSON string'),
|
|
111
|
+
}),
|
|
112
|
+
examples: [
|
|
113
|
+
{
|
|
114
|
+
args: { chain: '1', address: '0x1234…' },
|
|
115
|
+
options: {
|
|
116
|
+
name: 'Renamed Token',
|
|
117
|
+
abi: '[{"type":"event","name":"Transfer"}]',
|
|
118
|
+
events: '{"Transfer":true}',
|
|
119
|
+
},
|
|
120
|
+
description: 'Update a contract',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
hint: 'Requires contracts:write scope on your API key.',
|
|
124
|
+
run({ args, options }) {
|
|
125
|
+
return updateContractRun(args.chain, args.address, options);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
// ── Delete a contract ──
|
|
129
|
+
function deleteContractRun(chain, address) {
|
|
130
|
+
(0, client_1.requireApiKey)();
|
|
131
|
+
const client = (0, client_1.createClient)();
|
|
132
|
+
return client.delete(`/v0/contracts/${encodeURIComponent(chain)}/${encodeURIComponent(address)}`);
|
|
133
|
+
}
|
|
134
|
+
exports.contracts.command('delete', {
|
|
135
|
+
description: 'Remove a tracked contract',
|
|
136
|
+
args: incur_1.z.object({
|
|
137
|
+
chain: incur_1.z.string().describe('Chain ID'),
|
|
138
|
+
address: incur_1.z.string().describe('Contract address (0x…)'),
|
|
139
|
+
}),
|
|
140
|
+
examples: [
|
|
141
|
+
{
|
|
142
|
+
args: { chain: '1', address: '0x1234…' },
|
|
143
|
+
description: 'Delete a contract',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
hint: 'Requires contracts:write scope on your API key.',
|
|
147
|
+
run({ args }) {
|
|
148
|
+
return deleteContractRun(args.chain, args.address);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Cli } from 'incur';
|
|
2
|
+
export declare const importCmd: Cli.Cli<{}, undefined, undefined>;
|
|
3
|
+
export interface ImportWalletsOptions {
|
|
4
|
+
addresses: string;
|
|
5
|
+
writeKey: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function importWalletsRun(options: ImportWalletsOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importCmd = void 0;
|
|
4
|
+
exports.importWalletsRun = importWalletsRun;
|
|
5
|
+
const incur_1 = require("incur");
|
|
6
|
+
const client_1 = require("../lib/client");
|
|
7
|
+
exports.importCmd = incur_1.Cli.create('import', {
|
|
8
|
+
description: 'Import commands — bulk import wallet addresses into your project',
|
|
9
|
+
});
|
|
10
|
+
function importWalletsRun(options) {
|
|
11
|
+
(0, client_1.requireApiKey)();
|
|
12
|
+
const client = (0, client_1.createClient)();
|
|
13
|
+
let parsedAddresses;
|
|
14
|
+
try {
|
|
15
|
+
parsedAddresses = JSON.parse(options.addresses);
|
|
16
|
+
if (!Array.isArray(parsedAddresses)) {
|
|
17
|
+
throw new Error('not an array');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new Error('--addresses must be a valid JSON array of wallet address strings');
|
|
22
|
+
}
|
|
23
|
+
return client.post('/v0/import/', {
|
|
24
|
+
addresses: parsedAddresses,
|
|
25
|
+
writeKey: options.writeKey,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.importCmd.command('wallets', {
|
|
29
|
+
description: 'Bulk import wallet addresses into the project',
|
|
30
|
+
options: incur_1.z.object({
|
|
31
|
+
addresses: incur_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.describe('JSON array of wallet address strings to import'),
|
|
34
|
+
writeKey: incur_1.z.string().describe('Project write SDK key'),
|
|
35
|
+
}),
|
|
36
|
+
examples: [
|
|
37
|
+
{
|
|
38
|
+
options: {
|
|
39
|
+
addresses: '["0xabc…","0xdef…"]',
|
|
40
|
+
writeKey: 'write_key_xxx',
|
|
41
|
+
},
|
|
42
|
+
description: 'Import two wallet addresses',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
hint: 'Requires profiles:write scope. Only available on Scale and Enterprise plans.',
|
|
46
|
+
run({ options }) {
|
|
47
|
+
return importWalletsRun(options);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Cli } from 'incur';
|
|
2
|
+
export declare const profiles: Cli.Cli<{}, undefined, undefined>;
|
|
3
|
+
export declare function getProfileRun(address: string, expand?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
export interface SearchProfilesOptions {
|
|
5
|
+
address?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
orderBy?: string;
|
|
9
|
+
orderDir?: string;
|
|
10
|
+
expand?: string;
|
|
11
|
+
conditions?: string;
|
|
12
|
+
logic?: 'and' | 'or';
|
|
13
|
+
}
|
|
14
|
+
export declare function searchProfilesRun(options: SearchProfilesOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.profiles = void 0;
|
|
4
|
+
exports.getProfileRun = getProfileRun;
|
|
5
|
+
exports.searchProfilesRun = searchProfilesRun;
|
|
6
|
+
const incur_1 = require("incur");
|
|
7
|
+
const client_1 = require("../lib/client");
|
|
8
|
+
exports.profiles = incur_1.Cli.create('profiles', {
|
|
9
|
+
description: 'Wallet profile commands',
|
|
10
|
+
});
|
|
11
|
+
function getProfileRun(address, expand) {
|
|
12
|
+
(0, client_1.requireApiKey)();
|
|
13
|
+
const client = (0, client_1.createClient)();
|
|
14
|
+
const params = {};
|
|
15
|
+
if (expand)
|
|
16
|
+
params.expand = expand;
|
|
17
|
+
return client.get(`/v0/profiles/${encodeURIComponent(address)}`, { params });
|
|
18
|
+
}
|
|
19
|
+
exports.profiles.command('get', {
|
|
20
|
+
description: 'Get a wallet profile by address',
|
|
21
|
+
args: incur_1.z.object({
|
|
22
|
+
address: incur_1.z.string().describe('Wallet address (0x... or ENS name)'),
|
|
23
|
+
}),
|
|
24
|
+
options: incur_1.z.object({
|
|
25
|
+
expand: incur_1.z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Comma-separated list of fields to expand: apps,chains,tokens,labels'),
|
|
29
|
+
}),
|
|
30
|
+
examples: [
|
|
31
|
+
{ args: { address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' }, description: 'Get a wallet profile' },
|
|
32
|
+
{
|
|
33
|
+
args: { address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' },
|
|
34
|
+
options: { expand: 'labels,chains' },
|
|
35
|
+
description: 'Get profile with expanded labels and chains',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
run({ args, options }) {
|
|
39
|
+
return getProfileRun(args.address, options.expand);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
function searchProfilesRun(options) {
|
|
43
|
+
(0, client_1.requireApiKey)();
|
|
44
|
+
const client = (0, client_1.createClient)();
|
|
45
|
+
const params = {};
|
|
46
|
+
if (options.address)
|
|
47
|
+
params.address = options.address;
|
|
48
|
+
if (options.limit !== undefined)
|
|
49
|
+
params.limit = options.limit;
|
|
50
|
+
if (options.offset !== undefined)
|
|
51
|
+
params.offset = options.offset;
|
|
52
|
+
if (options.orderBy)
|
|
53
|
+
params.order_by = options.orderBy;
|
|
54
|
+
if (options.orderDir)
|
|
55
|
+
params.order_dir = options.orderDir;
|
|
56
|
+
if (options.expand)
|
|
57
|
+
params.expand = options.expand;
|
|
58
|
+
let body;
|
|
59
|
+
if (options.conditions) {
|
|
60
|
+
try {
|
|
61
|
+
const conditions = JSON.parse(options.conditions);
|
|
62
|
+
if (!Array.isArray(conditions))
|
|
63
|
+
throw new Error('not an array');
|
|
64
|
+
body = { conditions, logic: options.logic ?? 'and' };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
throw new Error('--conditions must be valid JSON array of FilterCondition objects');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return client.request({ method: 'get', url: '/v0/profiles/', params, data: body });
|
|
71
|
+
}
|
|
72
|
+
exports.profiles.command('search', {
|
|
73
|
+
description: 'Search wallet profiles with optional filters',
|
|
74
|
+
options: incur_1.z.object({
|
|
75
|
+
address: incur_1.z.string().optional().describe('Filter by wallet address'),
|
|
76
|
+
limit: incur_1.z.coerce.number().optional().describe('Max results to return'),
|
|
77
|
+
offset: incur_1.z.coerce.number().optional().describe('Pagination offset'),
|
|
78
|
+
orderBy: incur_1.z
|
|
79
|
+
.enum([
|
|
80
|
+
'last_onchain',
|
|
81
|
+
'first_onchain',
|
|
82
|
+
'net_worth_usd',
|
|
83
|
+
'updated_at',
|
|
84
|
+
'tx_count',
|
|
85
|
+
'first_seen',
|
|
86
|
+
'last_seen',
|
|
87
|
+
'num_sessions',
|
|
88
|
+
'revenue',
|
|
89
|
+
'volume',
|
|
90
|
+
'points',
|
|
91
|
+
])
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('Field to sort by'),
|
|
94
|
+
orderDir: incur_1.z.enum(['asc', 'desc']).optional().describe('Sort direction'),
|
|
95
|
+
expand: incur_1.z.string().optional().describe('Comma-separated fields to expand'),
|
|
96
|
+
conditions: incur_1.z
|
|
97
|
+
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe('JSON array of FilterCondition objects for advanced filtering'),
|
|
100
|
+
logic: incur_1.z
|
|
101
|
+
.enum(['and', 'or'])
|
|
102
|
+
.optional()
|
|
103
|
+
.describe('Logic operator for combining conditions: "and" (default) or "or"'),
|
|
104
|
+
}),
|
|
105
|
+
examples: [
|
|
106
|
+
{ options: { limit: 10 }, description: 'List first 10 profiles' },
|
|
107
|
+
{
|
|
108
|
+
options: { orderBy: 'net_worth_usd', orderDir: 'desc', limit: 5 },
|
|
109
|
+
description: 'Top 5 profiles by net worth',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
options: {
|
|
113
|
+
conditions: '[{"field":"net_worth_usd","op":"gt","value":10000}]',
|
|
114
|
+
limit: 20,
|
|
115
|
+
},
|
|
116
|
+
description: 'Search profiles with net worth > 10000',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
options: {
|
|
120
|
+
conditions: '[{"field":"net_worth_usd","op":"gt","value":10000},{"field":"tx_count","op":"gt","value":50}]',
|
|
121
|
+
logic: 'or',
|
|
122
|
+
limit: 20,
|
|
123
|
+
},
|
|
124
|
+
description: 'Search profiles matching either condition',
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
run({ args: _args, options }) {
|
|
128
|
+
return searchProfilesRun(options);
|
|
129
|
+
},
|
|
130
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function queryRunRun(sql: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryRunRun = queryRunRun;
|
|
4
|
+
const client_1 = require("../lib/client");
|
|
5
|
+
function queryRunRun(sql) {
|
|
6
|
+
(0, client_1.requireApiKey)();
|
|
7
|
+
const client = (0, client_1.createClient)();
|
|
8
|
+
return client.post('/v0/query/', { query: sql });
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Cli } from 'incur';
|
|
2
|
+
export declare const segments: Cli.Cli<{}, undefined, undefined>;
|
|
3
|
+
export declare function listSegmentsRun(): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
export interface CreateSegmentOptions {
|
|
5
|
+
title: string;
|
|
6
|
+
filterSets: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSegmentRun(options: CreateSegmentOptions): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
9
|
+
export declare function deleteSegmentRun(segmentId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.segments = void 0;
|
|
4
|
+
exports.listSegmentsRun = listSegmentsRun;
|
|
5
|
+
exports.createSegmentRun = createSegmentRun;
|
|
6
|
+
exports.deleteSegmentRun = deleteSegmentRun;
|
|
7
|
+
const incur_1 = require("incur");
|
|
8
|
+
const client_1 = require("../lib/client");
|
|
9
|
+
exports.segments = incur_1.Cli.create('segments', {
|
|
10
|
+
description: 'User segment commands — create, list, and delete audience segments',
|
|
11
|
+
});
|
|
12
|
+
// ── List segments ──
|
|
13
|
+
function listSegmentsRun() {
|
|
14
|
+
(0, client_1.requireApiKey)();
|
|
15
|
+
const client = (0, client_1.createClient)();
|
|
16
|
+
return client.get('/v0/segments/');
|
|
17
|
+
}
|
|
18
|
+
exports.segments.command('list', {
|
|
19
|
+
description: 'List all user segments for the project',
|
|
20
|
+
examples: [{ description: 'List all project segments' }],
|
|
21
|
+
hint: 'Requires segments:read scope on your API key.',
|
|
22
|
+
run() {
|
|
23
|
+
return listSegmentsRun();
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
function createSegmentRun(options) {
|
|
27
|
+
(0, client_1.requireApiKey)();
|
|
28
|
+
const client = (0, client_1.createClient)();
|
|
29
|
+
let parsedFilterSets;
|
|
30
|
+
try {
|
|
31
|
+
parsedFilterSets = JSON.parse(options.filterSets);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new Error('--filterSets must be a valid JSON array');
|
|
35
|
+
}
|
|
36
|
+
return client.post('/v0/segments/', {
|
|
37
|
+
title: options.title,
|
|
38
|
+
filterSets: parsedFilterSets,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.segments.command('create', {
|
|
42
|
+
description: 'Create a new user segment',
|
|
43
|
+
options: incur_1.z.object({
|
|
44
|
+
title: incur_1.z.string().describe('Segment title'),
|
|
45
|
+
filterSets: incur_1.z
|
|
46
|
+
.string()
|
|
47
|
+
.describe('JSON array of filter set strings defining the segment'),
|
|
48
|
+
}),
|
|
49
|
+
examples: [
|
|
50
|
+
{
|
|
51
|
+
options: {
|
|
52
|
+
title: 'Whales',
|
|
53
|
+
filterSets: '["net_worth_usd > 100000"]',
|
|
54
|
+
},
|
|
55
|
+
description: 'Create a high-value segment',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
hint: 'Requires segments:write scope on your API key.',
|
|
59
|
+
run({ options }) {
|
|
60
|
+
return createSegmentRun(options);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
// ── Delete a segment ──
|
|
64
|
+
function deleteSegmentRun(segmentId) {
|
|
65
|
+
(0, client_1.requireApiKey)();
|
|
66
|
+
const client = (0, client_1.createClient)();
|
|
67
|
+
return client.delete(`/v0/segments/${encodeURIComponent(segmentId)}`);
|
|
68
|
+
}
|
|
69
|
+
exports.segments.command('delete', {
|
|
70
|
+
description: 'Delete a user segment',
|
|
71
|
+
args: incur_1.z.object({
|
|
72
|
+
segmentId: incur_1.z.string().describe('Segment ID to delete'),
|
|
73
|
+
}),
|
|
74
|
+
examples: [
|
|
75
|
+
{ args: { segmentId: 'seg_abc123' }, description: 'Delete a segment' },
|
|
76
|
+
],
|
|
77
|
+
hint: 'Requires segments:write scope on your API key.',
|
|
78
|
+
run({ args }) {
|
|
79
|
+
return deleteSegmentRun(args.segmentId);
|
|
80
|
+
},
|
|
81
|
+
});
|
package/dist/index.d.ts
ADDED