cli-meta-ads 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/AGENTS.md +188 -0
- package/AI_CONTEXT.md +144 -0
- package/CLAUDE.md +183 -0
- package/README.md +590 -0
- package/REQUIREMENTS.md +148 -0
- package/dist/auth/constants.d.ts +1 -0
- package/dist/auth/constants.js +1 -0
- package/dist/auth/guards.d.ts +5 -0
- package/dist/auth/guards.js +16 -0
- package/dist/auth/login.d.ts +28 -0
- package/dist/auth/login.js +222 -0
- package/dist/cli/action.d.ts +11 -0
- package/dist/cli/action.js +77 -0
- package/dist/cli/build-cli.d.ts +2 -0
- package/dist/cli/build-cli.js +110 -0
- package/dist/cli/context.d.ts +24 -0
- package/dist/cli/context.js +19 -0
- package/dist/client/meta-api-client.d.ts +50 -0
- package/dist/client/meta-api-client.js +258 -0
- package/dist/client/meta-discovery.d.ts +13 -0
- package/dist/client/meta-discovery.js +88 -0
- package/dist/commands/accounts.d.ts +4 -0
- package/dist/commands/accounts.js +42 -0
- package/dist/commands/ads.d.ts +4 -0
- package/dist/commands/ads.js +148 -0
- package/dist/commands/adsets.d.ts +4 -0
- package/dist/commands/adsets.js +49 -0
- package/dist/commands/anomalies.d.ts +4 -0
- package/dist/commands/anomalies.js +44 -0
- package/dist/commands/assets.d.ts +4 -0
- package/dist/commands/assets.js +116 -0
- package/dist/commands/audiences.d.ts +4 -0
- package/dist/commands/audiences.js +40 -0
- package/dist/commands/auth.d.ts +4 -0
- package/dist/commands/auth.js +139 -0
- package/dist/commands/campaigns.d.ts +4 -0
- package/dist/commands/campaigns.js +273 -0
- package/dist/commands/capi.d.ts +4 -0
- package/dist/commands/capi.js +64 -0
- package/dist/commands/creatives.d.ts +4 -0
- package/dist/commands/creatives.js +49 -0
- package/dist/commands/diagnostics.d.ts +4 -0
- package/dist/commands/diagnostics.js +88 -0
- package/dist/commands/helpers.d.ts +13 -0
- package/dist/commands/helpers.js +50 -0
- package/dist/commands/launch.d.ts +4 -0
- package/dist/commands/launch.js +109 -0
- package/dist/commands/performance.d.ts +4 -0
- package/dist/commands/performance.js +55 -0
- package/dist/commands/pixel.d.ts +4 -0
- package/dist/commands/pixel.js +68 -0
- package/dist/commands/report.d.ts +4 -0
- package/dist/commands/report.js +30 -0
- package/dist/config/file-config.d.ts +6 -0
- package/dist/config/file-config.js +174 -0
- package/dist/config/types.d.ts +32 -0
- package/dist/config/types.js +1 -0
- package/dist/domain/account-scope.d.ts +7 -0
- package/dist/domain/account-scope.js +28 -0
- package/dist/domain/analytics.d.ts +52 -0
- package/dist/domain/analytics.js +125 -0
- package/dist/domain/approval-service.d.ts +10 -0
- package/dist/domain/approval-service.js +48 -0
- package/dist/domain/asset-feed-compiler.d.ts +43 -0
- package/dist/domain/asset-feed-compiler.js +104 -0
- package/dist/domain/launch-service.d.ts +200 -0
- package/dist/domain/launch-service.js +558 -0
- package/dist/domain/meta-ads-service.d.ts +620 -0
- package/dist/domain/meta-ads-service.js +841 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/dist/output/render.d.ts +3 -0
- package/dist/output/render.js +103 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +1 -0
- package/dist/utils/currency.d.ts +4 -0
- package/dist/utils/currency.js +40 -0
- package/dist/utils/date-range.d.ts +20 -0
- package/dist/utils/date-range.js +115 -0
- package/dist/utils/errors.d.ts +35 -0
- package/dist/utils/errors.js +68 -0
- package/dist/utils/ids.d.ts +4 -0
- package/dist/utils/ids.js +23 -0
- package/dist/utils/meta-placement-assets.d.ts +44 -0
- package/dist/utils/meta-placement-assets.js +315 -0
- package/dist/utils/security.d.ts +5 -0
- package/dist/utils/security.js +104 -0
- package/dist/validators/common.d.ts +10 -0
- package/dist/validators/common.js +56 -0
- package/dist/validators/create-spec.d.ts +373 -0
- package/dist/validators/create-spec.js +394 -0
- package/dist/validators/launch-spec.d.ts +229 -0
- package/dist/validators/launch-spec.js +371 -0
- package/docs/TECHNICAL.md +480 -0
- package/examples/README.md +29 -0
- package/examples/launch/assets/feed4x5.png +0 -0
- package/examples/launch/assets/story9x16.png +0 -0
- package/examples/launch/multi-format-launch.json +90 -0
- package/examples/single-object/ad.json +6 -0
- package/examples/single-object/adset.json +30 -0
- package/examples/single-object/campaign.json +6 -0
- package/examples/single-object/creative.json +19 -0
- package/package.json +62 -0
- package/skills/meta-cli-operator/SKILL.md +105 -0
- package/skills/meta-cli-operator/agents/openai.yaml +4 -0
- package/skills/meta-cli-operator/references/update-matrix.md +117 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { LaunchSpec } from "../validators/launch-spec.js";
|
|
2
|
+
import type { MetaAdsService } from "./meta-ads-service.js";
|
|
3
|
+
type LaunchStepKind = "campaign.create" | "adset.create" | "asset.image.upload" | "asset.video.upload" | "asset.video.wait" | "creative.create" | "ad.create";
|
|
4
|
+
export interface LaunchStep {
|
|
5
|
+
detail: string;
|
|
6
|
+
id: string;
|
|
7
|
+
kind: LaunchStepKind;
|
|
8
|
+
ref: string;
|
|
9
|
+
status: "pending" | "completed";
|
|
10
|
+
}
|
|
11
|
+
export interface LaunchReceipt {
|
|
12
|
+
version: 1;
|
|
13
|
+
accountId: string;
|
|
14
|
+
created: {
|
|
15
|
+
ads: Record<string, {
|
|
16
|
+
id: string;
|
|
17
|
+
}>;
|
|
18
|
+
adSets: Record<string, {
|
|
19
|
+
id: string;
|
|
20
|
+
}>;
|
|
21
|
+
assets: Record<string, {
|
|
22
|
+
kind: "image";
|
|
23
|
+
imageHash: string;
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "video";
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
status?: string | undefined;
|
|
29
|
+
videoId: string;
|
|
30
|
+
}>;
|
|
31
|
+
campaign?: {
|
|
32
|
+
id: string;
|
|
33
|
+
ref: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
creatives: Record<string, {
|
|
36
|
+
id: string;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
executionId: string;
|
|
40
|
+
lastError?: {
|
|
41
|
+
message: string;
|
|
42
|
+
stepId: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
receiptPath: string;
|
|
45
|
+
spec: LaunchSpec;
|
|
46
|
+
specPath: string;
|
|
47
|
+
status: "running" | "waiting_for_video" | "completed" | "failed";
|
|
48
|
+
steps: LaunchStep[];
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function buildLaunchSteps(spec: LaunchSpec): LaunchStep[];
|
|
52
|
+
export declare class LaunchService {
|
|
53
|
+
private readonly service;
|
|
54
|
+
constructor(service: MetaAdsService);
|
|
55
|
+
buildPlan(accountId: string, specPath: string, spec: LaunchSpec): {
|
|
56
|
+
data: {
|
|
57
|
+
accountId: string;
|
|
58
|
+
specPath: string;
|
|
59
|
+
steps: LaunchStep[];
|
|
60
|
+
summary: {
|
|
61
|
+
ads: number;
|
|
62
|
+
adSets: number;
|
|
63
|
+
assets: number;
|
|
64
|
+
creatives: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
warnings: string[];
|
|
68
|
+
};
|
|
69
|
+
validate(accountId: string, specPath: string, spec: LaunchSpec): {
|
|
70
|
+
data: {
|
|
71
|
+
accountId: string;
|
|
72
|
+
specPath: string;
|
|
73
|
+
summary: {
|
|
74
|
+
ads: number;
|
|
75
|
+
adSets: number;
|
|
76
|
+
assets: number;
|
|
77
|
+
campaignRef: string;
|
|
78
|
+
creatives: number;
|
|
79
|
+
};
|
|
80
|
+
valid: boolean;
|
|
81
|
+
};
|
|
82
|
+
warnings: string[];
|
|
83
|
+
};
|
|
84
|
+
apply(options: {
|
|
85
|
+
accountId: string;
|
|
86
|
+
receiptPath?: string | undefined;
|
|
87
|
+
spec: LaunchSpec;
|
|
88
|
+
specPath: string;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
data: {
|
|
91
|
+
created: {
|
|
92
|
+
ads: {
|
|
93
|
+
id: string;
|
|
94
|
+
ref: string;
|
|
95
|
+
}[];
|
|
96
|
+
adSets: {
|
|
97
|
+
id: string;
|
|
98
|
+
ref: string;
|
|
99
|
+
}[];
|
|
100
|
+
assets: ({
|
|
101
|
+
kind: "image";
|
|
102
|
+
imageHash: string;
|
|
103
|
+
name?: string | undefined;
|
|
104
|
+
ref: string;
|
|
105
|
+
} | {
|
|
106
|
+
kind: "video";
|
|
107
|
+
name?: string | undefined;
|
|
108
|
+
status?: string | undefined;
|
|
109
|
+
videoId: string;
|
|
110
|
+
ref: string;
|
|
111
|
+
})[];
|
|
112
|
+
campaign: {
|
|
113
|
+
id: string;
|
|
114
|
+
ref: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
creatives: {
|
|
117
|
+
id: string;
|
|
118
|
+
ref: string;
|
|
119
|
+
}[];
|
|
120
|
+
};
|
|
121
|
+
executionId: string;
|
|
122
|
+
receiptPath: string;
|
|
123
|
+
status: "failed" | "completed" | "running" | "waiting_for_video";
|
|
124
|
+
};
|
|
125
|
+
warnings: string[];
|
|
126
|
+
}>;
|
|
127
|
+
previewResume(receiptPath: string): Promise<{
|
|
128
|
+
created: {
|
|
129
|
+
ads: {
|
|
130
|
+
id: string;
|
|
131
|
+
ref: string;
|
|
132
|
+
}[];
|
|
133
|
+
adSets: {
|
|
134
|
+
id: string;
|
|
135
|
+
ref: string;
|
|
136
|
+
}[];
|
|
137
|
+
assets: ({
|
|
138
|
+
kind: "image";
|
|
139
|
+
imageHash: string;
|
|
140
|
+
name?: string | undefined;
|
|
141
|
+
ref: string;
|
|
142
|
+
} | {
|
|
143
|
+
kind: "video";
|
|
144
|
+
name?: string | undefined;
|
|
145
|
+
status?: string | undefined;
|
|
146
|
+
videoId: string;
|
|
147
|
+
ref: string;
|
|
148
|
+
})[];
|
|
149
|
+
campaign: {
|
|
150
|
+
id: string;
|
|
151
|
+
ref: string;
|
|
152
|
+
} | undefined;
|
|
153
|
+
creatives: {
|
|
154
|
+
id: string;
|
|
155
|
+
ref: string;
|
|
156
|
+
}[];
|
|
157
|
+
};
|
|
158
|
+
executionId: string;
|
|
159
|
+
pendingSteps: LaunchStep[];
|
|
160
|
+
receiptPath: string;
|
|
161
|
+
status: "failed" | "completed" | "running" | "waiting_for_video";
|
|
162
|
+
}>;
|
|
163
|
+
resume(receiptPath: string): Promise<{
|
|
164
|
+
created: {
|
|
165
|
+
ads: {
|
|
166
|
+
id: string;
|
|
167
|
+
ref: string;
|
|
168
|
+
}[];
|
|
169
|
+
adSets: {
|
|
170
|
+
id: string;
|
|
171
|
+
ref: string;
|
|
172
|
+
}[];
|
|
173
|
+
assets: ({
|
|
174
|
+
kind: "image";
|
|
175
|
+
imageHash: string;
|
|
176
|
+
name?: string | undefined;
|
|
177
|
+
ref: string;
|
|
178
|
+
} | {
|
|
179
|
+
kind: "video";
|
|
180
|
+
name?: string | undefined;
|
|
181
|
+
status?: string | undefined;
|
|
182
|
+
videoId: string;
|
|
183
|
+
ref: string;
|
|
184
|
+
})[];
|
|
185
|
+
campaign: {
|
|
186
|
+
id: string;
|
|
187
|
+
ref: string;
|
|
188
|
+
} | undefined;
|
|
189
|
+
creatives: {
|
|
190
|
+
id: string;
|
|
191
|
+
ref: string;
|
|
192
|
+
}[];
|
|
193
|
+
};
|
|
194
|
+
executionId: string;
|
|
195
|
+
pendingSteps: LaunchStep[];
|
|
196
|
+
receiptPath: string;
|
|
197
|
+
status: "failed" | "completed" | "running" | "waiting_for_video";
|
|
198
|
+
}>;
|
|
199
|
+
}
|
|
200
|
+
export {};
|