@koda-sl/baker-cli 0.164.0 → 0.166.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 +4 -2
- package/dist/cli.js +1491 -1420
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2328,9 +2328,51 @@ var linkedinDraftErrorResponseSchema = z4.object({
|
|
|
2328
2328
|
fields: z4.array(linkedinFieldErrorSchema).optional()
|
|
2329
2329
|
});
|
|
2330
2330
|
|
|
2331
|
-
// ../api/src/
|
|
2331
|
+
// ../api/src/brand.ts
|
|
2332
2332
|
import { z as z5 } from "zod";
|
|
2333
|
-
var
|
|
2333
|
+
var BRAND_TOKENS_VERSION = 1;
|
|
2334
|
+
var BRAND_COLOR_ROLES = ["background", "surface", "cta", "accent", "foreground", "other"];
|
|
2335
|
+
var BRAND_FONT_ROLES = ["heading", "body", "mono"];
|
|
2336
|
+
var BRAND_LOGO_VARIANTS = ["logo", "symbol", "icon"];
|
|
2337
|
+
var hexColorSchema = z5.string().regex(/^#(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, "expected #RRGGBB or #RRGGBBAA").transform((value) => value.toUpperCase());
|
|
2338
|
+
var brandColorSchema = z5.strictObject({
|
|
2339
|
+
name: z5.string().min(1),
|
|
2340
|
+
value: hexColorSchema,
|
|
2341
|
+
role: z5.enum(BRAND_COLOR_ROLES),
|
|
2342
|
+
palette: z5.string().min(1).default("primary")
|
|
2343
|
+
});
|
|
2344
|
+
var brandFontSchema = z5.strictObject({
|
|
2345
|
+
family: z5.string().min(1),
|
|
2346
|
+
role: z5.enum(BRAND_FONT_ROLES),
|
|
2347
|
+
weights: z5.array(z5.number().int().min(1).max(1e3)).min(1),
|
|
2348
|
+
source: z5.enum(["local", "google"]),
|
|
2349
|
+
files: z5.array(z5.string().startsWith("src/brand/fonts/")).optional()
|
|
2350
|
+
}).refine((font) => font.source !== "local" || (font.files?.length ?? 0) > 0, {
|
|
2351
|
+
message: "a local font must list its files under src/brand/fonts/",
|
|
2352
|
+
path: ["files"]
|
|
2353
|
+
});
|
|
2354
|
+
var brandLogoSchema = z5.strictObject({
|
|
2355
|
+
variant: z5.enum(BRAND_LOGO_VARIANTS),
|
|
2356
|
+
/** The background the mark is designed to sit on; null = works on any. */
|
|
2357
|
+
background: z5.enum(["light", "dark"]).nullable().default(null),
|
|
2358
|
+
path: z5.string().startsWith("src/brand/logos/")
|
|
2359
|
+
});
|
|
2360
|
+
var brandTokensSchema = z5.strictObject({
|
|
2361
|
+
version: z5.literal(BRAND_TOKENS_VERSION),
|
|
2362
|
+
colors: z5.array(brandColorSchema).default([]),
|
|
2363
|
+
fonts: z5.array(brandFontSchema).default([]),
|
|
2364
|
+
logos: z5.array(brandLogoSchema).default([]),
|
|
2365
|
+
radius: z5.record(z5.string().min(1), z5.string().min(1)).optional()
|
|
2366
|
+
});
|
|
2367
|
+
var putBrandRequestSchema = z5.object({
|
|
2368
|
+
content: z5.string(),
|
|
2369
|
+
tokens: brandTokensSchema.optional(),
|
|
2370
|
+
chatId: z5.string().optional()
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2373
|
+
// ../api/src/chats.ts
|
|
2374
|
+
import { z as z6 } from "zod";
|
|
2375
|
+
var chatInspectStatusSchema = z6.enum([
|
|
2334
2376
|
"draft",
|
|
2335
2377
|
"in_progress",
|
|
2336
2378
|
"publishing",
|
|
@@ -2338,8 +2380,8 @@ var chatInspectStatusSchema = z5.enum([
|
|
|
2338
2380
|
"completed",
|
|
2339
2381
|
"discarded"
|
|
2340
2382
|
]);
|
|
2341
|
-
var chatStatusGroupSchema =
|
|
2342
|
-
var chatChangeTypeSchema =
|
|
2383
|
+
var chatStatusGroupSchema = z6.enum(["active", "archived", "all"]);
|
|
2384
|
+
var chatChangeTypeSchema = z6.enum([
|
|
2343
2385
|
"landing",
|
|
2344
2386
|
"document",
|
|
2345
2387
|
"knowledge",
|
|
@@ -2360,197 +2402,197 @@ var chatChangeTypeSchema = z5.enum([
|
|
|
2360
2402
|
"followed-advertiser",
|
|
2361
2403
|
"briefs"
|
|
2362
2404
|
]);
|
|
2363
|
-
var chatChangeActionSchema =
|
|
2364
|
-
var chatChangeSummarySchema =
|
|
2405
|
+
var chatChangeActionSchema = z6.enum(["created", "updated", "deleted"]);
|
|
2406
|
+
var chatChangeSummarySchema = z6.object({
|
|
2365
2407
|
type: chatChangeTypeSchema,
|
|
2366
|
-
slug:
|
|
2408
|
+
slug: z6.string(),
|
|
2367
2409
|
action: chatChangeActionSchema,
|
|
2368
|
-
title:
|
|
2410
|
+
title: z6.string().optional()
|
|
2369
2411
|
});
|
|
2370
|
-
var repoSurfaceSchema =
|
|
2371
|
-
var chatsListRequestSchema =
|
|
2412
|
+
var repoSurfaceSchema = z6.enum(["knowledge", "company", "brand", "landings", "flows", "creatives"]);
|
|
2413
|
+
var chatsListRequestSchema = z6.object({
|
|
2372
2414
|
status: chatStatusGroupSchema.optional(),
|
|
2373
|
-
limit:
|
|
2415
|
+
limit: z6.number().int().min(1).max(100).optional(),
|
|
2374
2416
|
/** Include each Session's full `changes[]` list (compact returns counts only). */
|
|
2375
|
-
full:
|
|
2417
|
+
full: z6.boolean().optional(),
|
|
2376
2418
|
/**
|
|
2377
2419
|
* The caller's OWN Session id — excluded from results so an agent never sees
|
|
2378
2420
|
* its own in-flight chat listed as a separate "other Session" to reuse.
|
|
2379
2421
|
*/
|
|
2380
|
-
excludeChatId:
|
|
2422
|
+
excludeChatId: z6.string().optional()
|
|
2381
2423
|
});
|
|
2382
|
-
var chatSummarySchema =
|
|
2383
|
-
id:
|
|
2384
|
-
title:
|
|
2424
|
+
var chatSummarySchema = z6.object({
|
|
2425
|
+
id: z6.string(),
|
|
2426
|
+
title: z6.string(),
|
|
2385
2427
|
status: chatInspectStatusSchema,
|
|
2386
|
-
createdAt:
|
|
2387
|
-
updatedAt:
|
|
2428
|
+
createdAt: z6.number(),
|
|
2429
|
+
updatedAt: z6.number(),
|
|
2388
2430
|
/** Counts of produced outputs keyed by change type. */
|
|
2389
|
-
outputs:
|
|
2390
|
-
outputTotal:
|
|
2391
|
-
changes:
|
|
2392
|
-
});
|
|
2393
|
-
var chatsListResponseSchema =
|
|
2394
|
-
ok:
|
|
2395
|
-
data:
|
|
2396
|
-
});
|
|
2397
|
-
var chatsViewRequestSchema =
|
|
2398
|
-
chatId:
|
|
2399
|
-
full:
|
|
2400
|
-
});
|
|
2401
|
-
var chatThreadSummarySchema =
|
|
2402
|
-
id:
|
|
2403
|
-
title:
|
|
2404
|
-
status:
|
|
2405
|
-
createdAt:
|
|
2406
|
-
});
|
|
2407
|
-
var chatCommitSummarySchema =
|
|
2408
|
-
sha:
|
|
2409
|
-
message:
|
|
2410
|
-
surfaces:
|
|
2411
|
-
createdAt:
|
|
2412
|
-
});
|
|
2413
|
-
var effectOpSchema =
|
|
2414
|
-
var contentEffectSchema =
|
|
2431
|
+
outputs: z6.record(z6.string(), z6.number()),
|
|
2432
|
+
outputTotal: z6.number(),
|
|
2433
|
+
changes: z6.array(chatChangeSummarySchema).optional()
|
|
2434
|
+
});
|
|
2435
|
+
var chatsListResponseSchema = z6.object({
|
|
2436
|
+
ok: z6.literal(true),
|
|
2437
|
+
data: z6.object({ chats: z6.array(chatSummarySchema) })
|
|
2438
|
+
});
|
|
2439
|
+
var chatsViewRequestSchema = z6.object({
|
|
2440
|
+
chatId: z6.string(),
|
|
2441
|
+
full: z6.boolean().optional()
|
|
2442
|
+
});
|
|
2443
|
+
var chatThreadSummarySchema = z6.object({
|
|
2444
|
+
id: z6.string(),
|
|
2445
|
+
title: z6.string().nullable(),
|
|
2446
|
+
status: z6.string(),
|
|
2447
|
+
createdAt: z6.number()
|
|
2448
|
+
});
|
|
2449
|
+
var chatCommitSummarySchema = z6.object({
|
|
2450
|
+
sha: z6.string(),
|
|
2451
|
+
message: z6.string().nullable(),
|
|
2452
|
+
surfaces: z6.array(z6.string()),
|
|
2453
|
+
createdAt: z6.number()
|
|
2454
|
+
});
|
|
2455
|
+
var effectOpSchema = z6.enum(["created", "updated", "completed", "discarded", "deleted", "linked", "unlinked"]);
|
|
2456
|
+
var contentEffectSchema = z6.object({
|
|
2415
2457
|
surface: chatChangeTypeSchema,
|
|
2416
|
-
slug:
|
|
2458
|
+
slug: z6.string(),
|
|
2417
2459
|
op: effectOpSchema,
|
|
2418
|
-
staged:
|
|
2460
|
+
staged: z6.boolean()
|
|
2419
2461
|
});
|
|
2420
|
-
var actionEffectSchema =
|
|
2462
|
+
var actionEffectSchema = z6.object({
|
|
2421
2463
|
op: effectOpSchema,
|
|
2422
|
-
staged:
|
|
2423
|
-
name:
|
|
2424
|
-
description:
|
|
2425
|
-
priority:
|
|
2426
|
-
tags:
|
|
2427
|
-
status:
|
|
2428
|
-
note:
|
|
2429
|
-
reason:
|
|
2430
|
-
});
|
|
2431
|
-
var scheduledEffectSchema =
|
|
2464
|
+
staged: z6.boolean(),
|
|
2465
|
+
name: z6.string(),
|
|
2466
|
+
description: z6.string().nullable(),
|
|
2467
|
+
priority: z6.string().nullable(),
|
|
2468
|
+
tags: z6.array(z6.string()),
|
|
2469
|
+
status: z6.string().nullable(),
|
|
2470
|
+
note: z6.string().nullable(),
|
|
2471
|
+
reason: z6.string().nullable()
|
|
2472
|
+
});
|
|
2473
|
+
var scheduledEffectSchema = z6.object({
|
|
2432
2474
|
op: effectOpSchema,
|
|
2433
|
-
staged:
|
|
2434
|
-
name:
|
|
2435
|
-
summary:
|
|
2475
|
+
staged: z6.boolean(),
|
|
2476
|
+
name: z6.string(),
|
|
2477
|
+
summary: z6.string().nullable()
|
|
2436
2478
|
});
|
|
2437
|
-
var tagEffectSchema =
|
|
2479
|
+
var tagEffectSchema = z6.object({
|
|
2438
2480
|
op: effectOpSchema,
|
|
2439
|
-
staged:
|
|
2440
|
-
tagType:
|
|
2441
|
-
title:
|
|
2442
|
-
summary:
|
|
2443
|
-
configKeys:
|
|
2444
|
-
hasSecrets:
|
|
2445
|
-
});
|
|
2446
|
-
var adEffectSchema =
|
|
2447
|
-
platform:
|
|
2481
|
+
staged: z6.boolean(),
|
|
2482
|
+
tagType: z6.string(),
|
|
2483
|
+
title: z6.string().nullable(),
|
|
2484
|
+
summary: z6.string().nullable(),
|
|
2485
|
+
configKeys: z6.array(z6.string()),
|
|
2486
|
+
hasSecrets: z6.boolean()
|
|
2487
|
+
});
|
|
2488
|
+
var adEffectSchema = z6.object({
|
|
2489
|
+
platform: z6.enum(["google", "meta", "linkedin"]),
|
|
2448
2490
|
op: effectOpSchema,
|
|
2449
|
-
staged:
|
|
2450
|
-
entity:
|
|
2451
|
-
operation:
|
|
2452
|
-
summary:
|
|
2491
|
+
staged: z6.boolean(),
|
|
2492
|
+
entity: z6.string().nullable(),
|
|
2493
|
+
operation: z6.string().nullable(),
|
|
2494
|
+
summary: z6.string().nullable()
|
|
2453
2495
|
});
|
|
2454
|
-
var creativeEffectSchema =
|
|
2496
|
+
var creativeEffectSchema = z6.object({
|
|
2455
2497
|
op: effectOpSchema,
|
|
2456
|
-
staged:
|
|
2457
|
-
slug:
|
|
2458
|
-
title:
|
|
2459
|
-
status:
|
|
2460
|
-
});
|
|
2461
|
-
var chatEffectsSchema =
|
|
2462
|
-
content:
|
|
2463
|
-
actions:
|
|
2464
|
-
scheduledActions:
|
|
2465
|
-
tags:
|
|
2466
|
-
ads:
|
|
2467
|
-
google:
|
|
2468
|
-
meta:
|
|
2469
|
-
linkedin:
|
|
2498
|
+
staged: z6.boolean(),
|
|
2499
|
+
slug: z6.string(),
|
|
2500
|
+
title: z6.string().nullable(),
|
|
2501
|
+
status: z6.string().nullable()
|
|
2502
|
+
});
|
|
2503
|
+
var chatEffectsSchema = z6.object({
|
|
2504
|
+
content: z6.array(contentEffectSchema),
|
|
2505
|
+
actions: z6.array(actionEffectSchema),
|
|
2506
|
+
scheduledActions: z6.array(scheduledEffectSchema),
|
|
2507
|
+
tags: z6.array(tagEffectSchema),
|
|
2508
|
+
ads: z6.object({
|
|
2509
|
+
google: z6.array(adEffectSchema),
|
|
2510
|
+
meta: z6.array(adEffectSchema),
|
|
2511
|
+
linkedin: z6.array(adEffectSchema)
|
|
2470
2512
|
}),
|
|
2471
|
-
creatives:
|
|
2513
|
+
creatives: z6.array(creativeEffectSchema)
|
|
2472
2514
|
});
|
|
2473
|
-
var chatDetailSchema =
|
|
2474
|
-
id:
|
|
2475
|
-
title:
|
|
2515
|
+
var chatDetailSchema = z6.object({
|
|
2516
|
+
id: z6.string(),
|
|
2517
|
+
title: z6.string(),
|
|
2476
2518
|
status: chatInspectStatusSchema,
|
|
2477
|
-
createdAt:
|
|
2478
|
-
updatedAt:
|
|
2479
|
-
completedBySource:
|
|
2480
|
-
publishedAt:
|
|
2519
|
+
createdAt: z6.number(),
|
|
2520
|
+
updatedAt: z6.number(),
|
|
2521
|
+
completedBySource: z6.enum(["user", "bridge"]).nullable(),
|
|
2522
|
+
publishedAt: z6.number().nullable(),
|
|
2481
2523
|
/** The first user message — how this Session was originally asked. */
|
|
2482
|
-
kickoff:
|
|
2483
|
-
outputs:
|
|
2484
|
-
outputTotal:
|
|
2524
|
+
kickoff: z6.string().nullable(),
|
|
2525
|
+
outputs: z6.record(z6.string(), z6.number()),
|
|
2526
|
+
outputTotal: z6.number(),
|
|
2485
2527
|
/** The unified picture of everything this Session changed — git + DB. */
|
|
2486
2528
|
effects: chatEffectsSchema,
|
|
2487
|
-
threads:
|
|
2488
|
-
commits:
|
|
2529
|
+
threads: z6.array(chatThreadSummarySchema),
|
|
2530
|
+
commits: z6.array(chatCommitSummarySchema),
|
|
2489
2531
|
/** True when a real file-level diff is available via `baker chats diff`. */
|
|
2490
|
-
diffAvailable:
|
|
2532
|
+
diffAvailable: z6.boolean()
|
|
2491
2533
|
});
|
|
2492
|
-
var chatsViewResponseSchema =
|
|
2493
|
-
ok:
|
|
2534
|
+
var chatsViewResponseSchema = z6.object({
|
|
2535
|
+
ok: z6.literal(true),
|
|
2494
2536
|
data: chatDetailSchema
|
|
2495
2537
|
});
|
|
2496
|
-
var chatsTranscriptRequestSchema =
|
|
2497
|
-
chatId:
|
|
2498
|
-
limit:
|
|
2538
|
+
var chatsTranscriptRequestSchema = z6.object({
|
|
2539
|
+
chatId: z6.string(),
|
|
2540
|
+
limit: z6.number().int().min(1).max(1e3).optional(),
|
|
2499
2541
|
/** Return untruncated message text (compact truncates each entry). */
|
|
2500
|
-
full:
|
|
2542
|
+
full: z6.boolean().optional()
|
|
2501
2543
|
});
|
|
2502
|
-
var transcriptEntrySchema =
|
|
2503
|
-
role:
|
|
2504
|
-
text:
|
|
2544
|
+
var transcriptEntrySchema = z6.object({
|
|
2545
|
+
role: z6.string(),
|
|
2546
|
+
text: z6.string()
|
|
2505
2547
|
});
|
|
2506
|
-
var chatsTranscriptResponseSchema =
|
|
2507
|
-
ok:
|
|
2508
|
-
data:
|
|
2509
|
-
chatId:
|
|
2510
|
-
entries:
|
|
2548
|
+
var chatsTranscriptResponseSchema = z6.object({
|
|
2549
|
+
ok: z6.literal(true),
|
|
2550
|
+
data: z6.object({
|
|
2551
|
+
chatId: z6.string(),
|
|
2552
|
+
entries: z6.array(transcriptEntrySchema),
|
|
2511
2553
|
/** True when older entries were dropped to fit `limit`. */
|
|
2512
|
-
truncated:
|
|
2554
|
+
truncated: z6.boolean()
|
|
2513
2555
|
})
|
|
2514
2556
|
});
|
|
2515
|
-
var chatsDiffRequestSchema =
|
|
2516
|
-
chatId:
|
|
2557
|
+
var chatsDiffRequestSchema = z6.object({
|
|
2558
|
+
chatId: z6.string(),
|
|
2517
2559
|
surface: repoSurfaceSchema.optional(),
|
|
2518
2560
|
/** Include the unified-diff `patch` text per file (compact omits it). */
|
|
2519
|
-
full:
|
|
2561
|
+
full: z6.boolean().optional(),
|
|
2520
2562
|
/**
|
|
2521
2563
|
* Opt in to reading an in-progress (unpublished) Session's changes straight
|
|
2522
2564
|
* from its live Runtime — resumes the paused sandbox and runs a read-only git
|
|
2523
2565
|
* diff. Slower and only works while the sandbox still exists (not discarded).
|
|
2524
2566
|
* Ignored for published Sessions, which always read from git.
|
|
2525
2567
|
*/
|
|
2526
|
-
live:
|
|
2568
|
+
live: z6.boolean().optional()
|
|
2527
2569
|
});
|
|
2528
|
-
var diffFileSchema =
|
|
2529
|
-
path:
|
|
2570
|
+
var diffFileSchema = z6.object({
|
|
2571
|
+
path: z6.string(),
|
|
2530
2572
|
surface: repoSurfaceSchema.nullable(),
|
|
2531
|
-
status:
|
|
2532
|
-
additions:
|
|
2533
|
-
deletions:
|
|
2534
|
-
patch:
|
|
2535
|
-
});
|
|
2536
|
-
var diffSourceSchema =
|
|
2537
|
-
var chatsDiffResponseSchema =
|
|
2538
|
-
ok:
|
|
2539
|
-
data:
|
|
2540
|
-
chatId:
|
|
2573
|
+
status: z6.string(),
|
|
2574
|
+
additions: z6.number(),
|
|
2575
|
+
deletions: z6.number(),
|
|
2576
|
+
patch: z6.string().optional()
|
|
2577
|
+
});
|
|
2578
|
+
var diffSourceSchema = z6.enum(["published", "live"]);
|
|
2579
|
+
var chatsDiffResponseSchema = z6.object({
|
|
2580
|
+
ok: z6.literal(true),
|
|
2581
|
+
data: z6.object({
|
|
2582
|
+
chatId: z6.string(),
|
|
2541
2583
|
/** False when no published git diff exists (in-progress Session or unlinked repo). */
|
|
2542
|
-
available:
|
|
2543
|
-
reason:
|
|
2584
|
+
available: z6.boolean(),
|
|
2585
|
+
reason: z6.string().optional(),
|
|
2544
2586
|
/** Present when available — how the diff was obtained. */
|
|
2545
2587
|
source: diffSourceSchema.optional(),
|
|
2546
2588
|
/** True when the live diff was capped (very large in-progress change set). */
|
|
2547
|
-
truncated:
|
|
2548
|
-
files:
|
|
2589
|
+
truncated: z6.boolean().optional(),
|
|
2590
|
+
files: z6.array(diffFileSchema)
|
|
2549
2591
|
})
|
|
2550
2592
|
});
|
|
2551
2593
|
|
|
2552
2594
|
// ../api/src/flows.ts
|
|
2553
|
-
import { z as
|
|
2595
|
+
import { z as z7 } from "zod";
|
|
2554
2596
|
var FLOW_SECRET_SIDE_EFFECT_TYPES = [
|
|
2555
2597
|
"email",
|
|
2556
2598
|
"zapier",
|
|
@@ -2561,7 +2603,7 @@ var FLOW_SECRET_SIDE_EFFECT_TYPES = [
|
|
|
2561
2603
|
"crmble",
|
|
2562
2604
|
"goHighlevelContact"
|
|
2563
2605
|
];
|
|
2564
|
-
var flowSideEffectTypeSchema =
|
|
2606
|
+
var flowSideEffectTypeSchema = z7.enum(FLOW_SECRET_SIDE_EFFECT_TYPES);
|
|
2565
2607
|
var FLOW_SECRET_FIELDS = {
|
|
2566
2608
|
email: [],
|
|
2567
2609
|
zapier: ["zapUrl"],
|
|
@@ -2589,94 +2631,94 @@ var FLOW_RESOURCE_NODE_TYPES = [
|
|
|
2589
2631
|
"highlevel",
|
|
2590
2632
|
"highlevelForm"
|
|
2591
2633
|
];
|
|
2592
|
-
var flowResourceNodeTypeSchema =
|
|
2593
|
-
var flowInputRequestSchema =
|
|
2594
|
-
|
|
2634
|
+
var flowResourceNodeTypeSchema = z7.enum(FLOW_RESOURCE_NODE_TYPES);
|
|
2635
|
+
var flowInputRequestSchema = z7.discriminatedUnion("target", [
|
|
2636
|
+
z7.object({
|
|
2595
2637
|
/** Configure a side effect's `encryptedConfig` (+ `oauthProviderId` for OAuth types). */
|
|
2596
|
-
target:
|
|
2597
|
-
flowSlug:
|
|
2638
|
+
target: z7.literal("sideEffect"),
|
|
2639
|
+
flowSlug: z7.string(),
|
|
2598
2640
|
/** `id` of the FlowNode holding the side effect. */
|
|
2599
|
-
nodeId:
|
|
2641
|
+
nodeId: z7.string(),
|
|
2600
2642
|
/** `id` of the side effect within that node's `sideEffects[]`. */
|
|
2601
|
-
sideEffectId:
|
|
2643
|
+
sideEffectId: z7.string(),
|
|
2602
2644
|
sideEffectType: flowSideEffectTypeSchema,
|
|
2603
2645
|
/** Non-secret `encryptedConfig` values the agent proposes (e.g. webhook apiUrl, auth type). Secret keys are stripped at every boundary. */
|
|
2604
|
-
prefilledConfig:
|
|
2646
|
+
prefilledConfig: z7.record(z7.string(), z7.string()).optional(),
|
|
2605
2647
|
/** Secret credential field names the agent asks the user to provide. */
|
|
2606
|
-
requestedSecretFields:
|
|
2607
|
-
message:
|
|
2648
|
+
requestedSecretFields: z7.array(z7.string()).optional(),
|
|
2649
|
+
message: z7.string().optional()
|
|
2608
2650
|
}),
|
|
2609
|
-
|
|
2651
|
+
z7.object({
|
|
2610
2652
|
/** Configure a widget node's third-party `form.external` (+ `providerId`). */
|
|
2611
|
-
target:
|
|
2612
|
-
flowSlug:
|
|
2653
|
+
target: z7.literal("node"),
|
|
2654
|
+
flowSlug: z7.string(),
|
|
2613
2655
|
/** `id` of the widget FlowNode. */
|
|
2614
|
-
nodeId:
|
|
2656
|
+
nodeId: z7.string(),
|
|
2615
2657
|
nodeType: flowResourceNodeTypeSchema,
|
|
2616
|
-
message:
|
|
2658
|
+
message: z7.string().optional()
|
|
2617
2659
|
})
|
|
2618
2660
|
]);
|
|
2619
|
-
var flowInputToolInputSchema =
|
|
2620
|
-
requests:
|
|
2661
|
+
var flowInputToolInputSchema = z7.object({
|
|
2662
|
+
requests: z7.array(flowInputRequestSchema).min(1).max(8)
|
|
2621
2663
|
});
|
|
2622
|
-
var flowInputResultSchema =
|
|
2623
|
-
|
|
2624
|
-
status:
|
|
2664
|
+
var flowInputResultSchema = z7.discriminatedUnion("status", [
|
|
2665
|
+
z7.object({
|
|
2666
|
+
status: z7.literal("submitted"),
|
|
2625
2667
|
/** Echoes which piece this result resolves. */
|
|
2626
|
-
nodeId:
|
|
2627
|
-
sideEffectId:
|
|
2668
|
+
nodeId: z7.string(),
|
|
2669
|
+
sideEffectId: z7.string().optional(),
|
|
2628
2670
|
/** Names of secret fields the user provided. Never values. */
|
|
2629
|
-
secretFieldsSet:
|
|
2671
|
+
secretFieldsSet: z7.array(z7.string()),
|
|
2630
2672
|
/** Non-secret human summary of what was configured (e.g. "HubSpot form 'Contact us' — 7 fields"). */
|
|
2631
|
-
note:
|
|
2673
|
+
note: z7.string().optional()
|
|
2632
2674
|
}),
|
|
2633
|
-
|
|
2634
|
-
status:
|
|
2635
|
-
nodeId:
|
|
2636
|
-
sideEffectId:
|
|
2637
|
-
reason:
|
|
2675
|
+
z7.object({
|
|
2676
|
+
status: z7.literal("declined"),
|
|
2677
|
+
nodeId: z7.string(),
|
|
2678
|
+
sideEffectId: z7.string().optional(),
|
|
2679
|
+
reason: z7.string().optional()
|
|
2638
2680
|
})
|
|
2639
2681
|
]);
|
|
2640
|
-
var flowInputToolResultSchema =
|
|
2641
|
-
results:
|
|
2682
|
+
var flowInputToolResultSchema = z7.object({
|
|
2683
|
+
results: z7.array(flowInputResultSchema)
|
|
2642
2684
|
});
|
|
2643
|
-
var flowsListRequestSchema =
|
|
2644
|
-
var flowSummarySchema =
|
|
2645
|
-
slug:
|
|
2646
|
-
name:
|
|
2685
|
+
var flowsListRequestSchema = z7.object({ chatId: z7.string() });
|
|
2686
|
+
var flowSummarySchema = z7.object({
|
|
2687
|
+
slug: z7.string(),
|
|
2688
|
+
name: z7.string(),
|
|
2647
2689
|
/** Count of nodes with an unconfigured confidential field (secret missing / resource not picked / connection needed). */
|
|
2648
|
-
needsConfig:
|
|
2690
|
+
needsConfig: z7.number()
|
|
2649
2691
|
});
|
|
2650
|
-
var flowsListResponseSchema =
|
|
2651
|
-
var flowsShowRequestSchema =
|
|
2652
|
-
chatId:
|
|
2653
|
-
slug:
|
|
2654
|
-
full:
|
|
2692
|
+
var flowsListResponseSchema = z7.object({ flows: z7.array(flowSummarySchema) });
|
|
2693
|
+
var flowsShowRequestSchema = z7.object({
|
|
2694
|
+
chatId: z7.string(),
|
|
2695
|
+
slug: z7.string(),
|
|
2696
|
+
full: z7.boolean().optional()
|
|
2655
2697
|
});
|
|
2656
|
-
var flowConfigStatusSchema =
|
|
2657
|
-
nodeId:
|
|
2658
|
-
nodeName:
|
|
2698
|
+
var flowConfigStatusSchema = z7.object({
|
|
2699
|
+
nodeId: z7.string(),
|
|
2700
|
+
nodeName: z7.string().optional(),
|
|
2659
2701
|
/** "sideEffect" credential/connection, or "node" widget resource. */
|
|
2660
|
-
target:
|
|
2661
|
-
sideEffectId:
|
|
2662
|
-
kind:
|
|
2702
|
+
target: z7.enum(["sideEffect", "node"]),
|
|
2703
|
+
sideEffectId: z7.string().optional(),
|
|
2704
|
+
kind: z7.string(),
|
|
2663
2705
|
/** Human status, e.g. "webhook — apiKeyValue [set], bearerToken [missing]" / "HubSpot form [not selected]" / "Pipedrive [needs connection]". */
|
|
2664
|
-
status:
|
|
2706
|
+
status: z7.string(),
|
|
2665
2707
|
/** True when a `request_flow_input` call is still needed for this piece. */
|
|
2666
|
-
needsInput:
|
|
2708
|
+
needsInput: z7.boolean()
|
|
2667
2709
|
});
|
|
2668
|
-
var flowsShowResponseSchema =
|
|
2669
|
-
slug:
|
|
2670
|
-
name:
|
|
2710
|
+
var flowsShowResponseSchema = z7.object({
|
|
2711
|
+
slug: z7.string(),
|
|
2712
|
+
name: z7.string(),
|
|
2671
2713
|
/** Confidential fields and whether each is configured. */
|
|
2672
|
-
config:
|
|
2714
|
+
config: z7.array(flowConfigStatusSchema),
|
|
2673
2715
|
/** Present only with `--full`: the whole flow tree, secret values redacted. */
|
|
2674
|
-
tree:
|
|
2716
|
+
tree: z7.unknown().optional()
|
|
2675
2717
|
});
|
|
2676
2718
|
|
|
2677
2719
|
// ../api/src/history.ts
|
|
2678
|
-
import { z as
|
|
2679
|
-
var historyCategorySchema =
|
|
2720
|
+
import { z as z8 } from "zod";
|
|
2721
|
+
var historyCategorySchema = z8.enum([
|
|
2680
2722
|
"publish",
|
|
2681
2723
|
"chat",
|
|
2682
2724
|
"action",
|
|
@@ -2694,184 +2736,184 @@ var historyCategorySchema = z7.enum([
|
|
|
2694
2736
|
"integration",
|
|
2695
2737
|
"tag_manager"
|
|
2696
2738
|
]);
|
|
2697
|
-
var historyListRequestSchema =
|
|
2698
|
-
limit:
|
|
2739
|
+
var historyListRequestSchema = z8.object({
|
|
2740
|
+
limit: z8.number().int().min(1).max(200).optional(),
|
|
2699
2741
|
category: historyCategorySchema.optional(),
|
|
2700
2742
|
/** Only entries from the last N days. */
|
|
2701
|
-
days:
|
|
2743
|
+
days: z8.number().int().min(1).max(365).optional(),
|
|
2702
2744
|
/** Include raw metadata on each entry (compact by default). */
|
|
2703
|
-
full:
|
|
2745
|
+
full: z8.boolean().optional()
|
|
2704
2746
|
});
|
|
2705
|
-
var historyEntrySchema =
|
|
2706
|
-
id:
|
|
2747
|
+
var historyEntrySchema = z8.object({
|
|
2748
|
+
id: z8.string(),
|
|
2707
2749
|
/** Epoch ms. */
|
|
2708
|
-
at:
|
|
2750
|
+
at: z8.number(),
|
|
2709
2751
|
category: historyCategorySchema,
|
|
2710
2752
|
/** Dotted action id, e.g. "publish.commit", "member.invite_create". */
|
|
2711
|
-
action:
|
|
2712
|
-
actorType:
|
|
2753
|
+
action: z8.string(),
|
|
2754
|
+
actorType: z8.enum(["user", "agent", "system"]),
|
|
2713
2755
|
/** Display name of the acting user, when the actor is a user. */
|
|
2714
|
-
actor:
|
|
2756
|
+
actor: z8.string().nullable(),
|
|
2715
2757
|
/** What the change touched — commit subject, chat title, member email, tag type, … */
|
|
2716
|
-
target:
|
|
2717
|
-
metadata:
|
|
2758
|
+
target: z8.string().nullable(),
|
|
2759
|
+
metadata: z8.record(z8.string(), z8.unknown()).optional()
|
|
2718
2760
|
});
|
|
2719
|
-
var historyListResponseSchema =
|
|
2720
|
-
ok:
|
|
2721
|
-
data:
|
|
2761
|
+
var historyListResponseSchema = z8.object({
|
|
2762
|
+
ok: z8.literal(true),
|
|
2763
|
+
data: z8.object({ entries: z8.array(historyEntrySchema) })
|
|
2722
2764
|
});
|
|
2723
2765
|
|
|
2724
2766
|
// ../api/src/hubspot.ts
|
|
2725
|
-
import { z as
|
|
2726
|
-
var hubspotEmbedTypeSchema =
|
|
2727
|
-
var hubspotPostSubmitActionSchema =
|
|
2728
|
-
type:
|
|
2729
|
-
value:
|
|
2730
|
-
});
|
|
2731
|
-
var hubspotFormFieldSchema =
|
|
2732
|
-
name:
|
|
2733
|
-
label:
|
|
2734
|
-
fieldType:
|
|
2735
|
-
objectTypeId:
|
|
2736
|
-
required:
|
|
2737
|
-
hidden:
|
|
2738
|
-
placeholder:
|
|
2739
|
-
description:
|
|
2740
|
-
options:
|
|
2741
|
-
});
|
|
2742
|
-
var hubspotFormSummarySchema =
|
|
2743
|
-
id:
|
|
2744
|
-
name:
|
|
2767
|
+
import { z as z9 } from "zod";
|
|
2768
|
+
var hubspotEmbedTypeSchema = z9.enum(["legacy", "v4", "unknown"]);
|
|
2769
|
+
var hubspotPostSubmitActionSchema = z9.object({
|
|
2770
|
+
type: z9.enum(["redirect_url", "thank_you"]),
|
|
2771
|
+
value: z9.string()
|
|
2772
|
+
});
|
|
2773
|
+
var hubspotFormFieldSchema = z9.object({
|
|
2774
|
+
name: z9.string(),
|
|
2775
|
+
label: z9.string(),
|
|
2776
|
+
fieldType: z9.string(),
|
|
2777
|
+
objectTypeId: z9.string().optional(),
|
|
2778
|
+
required: z9.boolean().optional(),
|
|
2779
|
+
hidden: z9.boolean().optional(),
|
|
2780
|
+
placeholder: z9.string().optional(),
|
|
2781
|
+
description: z9.string().optional(),
|
|
2782
|
+
options: z9.array(z9.object({ label: z9.string(), value: z9.string() })).optional()
|
|
2783
|
+
});
|
|
2784
|
+
var hubspotFormSummarySchema = z9.object({
|
|
2785
|
+
id: z9.string(),
|
|
2786
|
+
name: z9.string(),
|
|
2745
2787
|
embedType: hubspotEmbedTypeSchema,
|
|
2746
2788
|
/** Total visible + hidden fields across every field group. */
|
|
2747
|
-
fieldCount:
|
|
2789
|
+
fieldCount: z9.number().int(),
|
|
2748
2790
|
postSubmitAction: hubspotPostSubmitActionSchema.nullable()
|
|
2749
2791
|
});
|
|
2750
|
-
var hubspotFormsListRequestSchema =
|
|
2792
|
+
var hubspotFormsListRequestSchema = z9.object({
|
|
2751
2793
|
/** Case-insensitive substring match on the form name. */
|
|
2752
|
-
search:
|
|
2794
|
+
search: z9.string().min(1).max(200).optional(),
|
|
2753
2795
|
/** Only forms whose post-submit action redirects away. */
|
|
2754
|
-
redirectingOnly:
|
|
2796
|
+
redirectingOnly: z9.boolean().optional(),
|
|
2755
2797
|
embedType: hubspotEmbedTypeSchema.optional()
|
|
2756
2798
|
});
|
|
2757
|
-
var hubspotFormsListResponseSchema =
|
|
2758
|
-
ok:
|
|
2759
|
-
data:
|
|
2799
|
+
var hubspotFormsListResponseSchema = z9.object({
|
|
2800
|
+
ok: z9.literal(true),
|
|
2801
|
+
data: z9.object({
|
|
2760
2802
|
/** Same for every form on the account — sent once, not per row. */
|
|
2761
|
-
portalId:
|
|
2762
|
-
forms:
|
|
2803
|
+
portalId: z9.number().nullable(),
|
|
2804
|
+
forms: z9.array(hubspotFormSummarySchema)
|
|
2763
2805
|
})
|
|
2764
2806
|
});
|
|
2765
|
-
var hubspotFormsViewRequestSchema =
|
|
2766
|
-
formId:
|
|
2807
|
+
var hubspotFormsViewRequestSchema = z9.object({
|
|
2808
|
+
formId: z9.string().min(1),
|
|
2767
2809
|
/** Include the untouched HubSpot payload alongside the summarized view. */
|
|
2768
|
-
full:
|
|
2810
|
+
full: z9.boolean().optional(),
|
|
2769
2811
|
/**
|
|
2770
2812
|
* Return the resource blob to write into a flow node's `form.external`
|
|
2771
2813
|
* instead of the human-readable view.
|
|
2772
2814
|
*/
|
|
2773
|
-
asNode:
|
|
2815
|
+
asNode: z9.boolean().optional()
|
|
2774
2816
|
});
|
|
2775
2817
|
var hubspotFormDetailSchema = hubspotFormSummarySchema.extend({
|
|
2776
|
-
portalId:
|
|
2777
|
-
captchaEnabled:
|
|
2778
|
-
language:
|
|
2779
|
-
fields:
|
|
2818
|
+
portalId: z9.number().nullable(),
|
|
2819
|
+
captchaEnabled: z9.boolean(),
|
|
2820
|
+
language: z9.string().nullable(),
|
|
2821
|
+
fields: z9.array(hubspotFormFieldSchema),
|
|
2780
2822
|
/** HubSpot's "Data privacy and consent options"; `null` when not configured. */
|
|
2781
|
-
legalConsentType:
|
|
2782
|
-
raw:
|
|
2823
|
+
legalConsentType: z9.string().nullable(),
|
|
2824
|
+
raw: z9.record(z9.string(), z9.unknown()).optional()
|
|
2783
2825
|
});
|
|
2784
|
-
var hubspotFormNodeExternalSchema =
|
|
2785
|
-
id:
|
|
2786
|
-
name:
|
|
2787
|
-
providerId:
|
|
2788
|
-
portalId:
|
|
2789
|
-
embedType:
|
|
2790
|
-
region:
|
|
2791
|
-
captchaEnabled:
|
|
2792
|
-
fieldGroups:
|
|
2793
|
-
configuration:
|
|
2794
|
-
legalConsentOptions:
|
|
2795
|
-
});
|
|
2796
|
-
var hubspotFormsViewResponseSchema =
|
|
2797
|
-
ok:
|
|
2798
|
-
data:
|
|
2826
|
+
var hubspotFormNodeExternalSchema = z9.object({
|
|
2827
|
+
id: z9.string(),
|
|
2828
|
+
name: z9.string(),
|
|
2829
|
+
providerId: z9.string(),
|
|
2830
|
+
portalId: z9.number(),
|
|
2831
|
+
embedType: z9.enum(["legacy", "v4"]).optional(),
|
|
2832
|
+
region: z9.string().optional(),
|
|
2833
|
+
captchaEnabled: z9.boolean(),
|
|
2834
|
+
fieldGroups: z9.array(z9.object({ fields: z9.array(hubspotFormFieldSchema) })),
|
|
2835
|
+
configuration: z9.object({ postSubmitAction: hubspotPostSubmitActionSchema }).optional(),
|
|
2836
|
+
legalConsentOptions: z9.record(z9.string(), z9.unknown()).optional()
|
|
2837
|
+
});
|
|
2838
|
+
var hubspotFormsViewResponseSchema = z9.object({
|
|
2839
|
+
ok: z9.literal(true),
|
|
2840
|
+
data: z9.object({
|
|
2799
2841
|
form: hubspotFormDetailSchema.optional(),
|
|
2800
2842
|
/** Present instead of `form` when `asNode` was requested. */
|
|
2801
2843
|
external: hubspotFormNodeExternalSchema.optional()
|
|
2802
2844
|
})
|
|
2803
2845
|
});
|
|
2804
|
-
var hubspotMeetingFieldSchema =
|
|
2805
|
-
name:
|
|
2806
|
-
label:
|
|
2807
|
-
fieldType:
|
|
2808
|
-
isRequired:
|
|
2809
|
-
isCustom:
|
|
2810
|
-
options:
|
|
2811
|
-
});
|
|
2812
|
-
var hubspotMeetingSummarySchema =
|
|
2813
|
-
id:
|
|
2814
|
-
name:
|
|
2815
|
-
slug:
|
|
2816
|
-
linkType:
|
|
2846
|
+
var hubspotMeetingFieldSchema = z9.object({
|
|
2847
|
+
name: z9.string(),
|
|
2848
|
+
label: z9.string(),
|
|
2849
|
+
fieldType: z9.string(),
|
|
2850
|
+
isRequired: z9.boolean(),
|
|
2851
|
+
isCustom: z9.boolean(),
|
|
2852
|
+
options: z9.array(z9.object({ label: z9.string(), value: z9.string() })).optional()
|
|
2853
|
+
});
|
|
2854
|
+
var hubspotMeetingSummarySchema = z9.object({
|
|
2855
|
+
id: z9.string(),
|
|
2856
|
+
name: z9.string(),
|
|
2857
|
+
slug: z9.string(),
|
|
2858
|
+
linkType: z9.string(),
|
|
2817
2859
|
/**
|
|
2818
2860
|
* Where HubSpot sends the visitor after booking. `null` means either "no
|
|
2819
2861
|
* redirect" or "not known" — read `redirectKnown` before concluding.
|
|
2820
2862
|
*/
|
|
2821
|
-
redirectUrl:
|
|
2863
|
+
redirectUrl: z9.string().nullable(),
|
|
2822
2864
|
/**
|
|
2823
2865
|
* False when the list endpoint omitted `customParams` entirely, in which case
|
|
2824
2866
|
* `redirectUrl: null` is an absence of information, not a confirmed absence
|
|
2825
2867
|
* of a redirect. `meetings view <slug>` resolves it.
|
|
2826
2868
|
*/
|
|
2827
|
-
redirectKnown:
|
|
2869
|
+
redirectKnown: z9.boolean(),
|
|
2828
2870
|
/**
|
|
2829
2871
|
* Booking-form field count, or `null` when the list endpoint did not carry
|
|
2830
2872
|
* `customParams` — HubSpot only populates those reliably on the per-slug
|
|
2831
2873
|
* booking endpoint, so `meetings view <slug>` is the source of truth.
|
|
2832
2874
|
*/
|
|
2833
|
-
fieldCount:
|
|
2875
|
+
fieldCount: z9.number().int().nullable()
|
|
2834
2876
|
});
|
|
2835
|
-
var hubspotMeetingsListRequestSchema =
|
|
2836
|
-
search:
|
|
2877
|
+
var hubspotMeetingsListRequestSchema = z9.object({
|
|
2878
|
+
search: z9.string().min(1).max(200).optional(),
|
|
2837
2879
|
/** Only meeting links that redirect after booking. */
|
|
2838
|
-
redirectingOnly:
|
|
2880
|
+
redirectingOnly: z9.boolean().optional()
|
|
2839
2881
|
});
|
|
2840
|
-
var hubspotMeetingsListResponseSchema =
|
|
2841
|
-
ok:
|
|
2842
|
-
data:
|
|
2882
|
+
var hubspotMeetingsListResponseSchema = z9.object({
|
|
2883
|
+
ok: z9.literal(true),
|
|
2884
|
+
data: z9.object({ meetings: z9.array(hubspotMeetingSummarySchema) })
|
|
2843
2885
|
});
|
|
2844
|
-
var hubspotMeetingsViewRequestSchema =
|
|
2845
|
-
slug:
|
|
2886
|
+
var hubspotMeetingsViewRequestSchema = z9.object({
|
|
2887
|
+
slug: z9.string().min(1),
|
|
2846
2888
|
/**
|
|
2847
2889
|
* Return the resource blob to write into a flow node's `form.external`
|
|
2848
2890
|
* instead of the human-readable view.
|
|
2849
2891
|
*/
|
|
2850
|
-
asNode:
|
|
2851
|
-
});
|
|
2852
|
-
var hubspotMeetingDetailSchema =
|
|
2853
|
-
name:
|
|
2854
|
-
slug:
|
|
2855
|
-
link:
|
|
2856
|
-
linkType:
|
|
2857
|
-
redirectUrl:
|
|
2858
|
-
fields:
|
|
2859
|
-
});
|
|
2860
|
-
var hubspotMeetingNodeExternalSchema =
|
|
2861
|
-
name:
|
|
2862
|
-
slug:
|
|
2892
|
+
asNode: z9.boolean().optional()
|
|
2893
|
+
});
|
|
2894
|
+
var hubspotMeetingDetailSchema = z9.object({
|
|
2895
|
+
name: z9.string(),
|
|
2896
|
+
slug: z9.string(),
|
|
2897
|
+
link: z9.string(),
|
|
2898
|
+
linkType: z9.string(),
|
|
2899
|
+
redirectUrl: z9.string().nullable(),
|
|
2900
|
+
fields: z9.array(hubspotMeetingFieldSchema)
|
|
2901
|
+
});
|
|
2902
|
+
var hubspotMeetingNodeExternalSchema = z9.object({
|
|
2903
|
+
name: z9.string(),
|
|
2904
|
+
slug: z9.string(),
|
|
2863
2905
|
/** Non-empty: an empty booking link renders an iframe pointed at nothing. */
|
|
2864
|
-
link:
|
|
2865
|
-
linkType:
|
|
2866
|
-
providerId:
|
|
2867
|
-
customParams:
|
|
2868
|
-
formFields:
|
|
2869
|
-
redirectUrl:
|
|
2906
|
+
link: z9.string().min(1),
|
|
2907
|
+
linkType: z9.enum(["PERSONAL_LINK", "GROUP_CALENDAR", "ROUND_ROBIN_CALENDAR"]),
|
|
2908
|
+
providerId: z9.string(),
|
|
2909
|
+
customParams: z9.object({
|
|
2910
|
+
formFields: z9.array(hubspotMeetingFieldSchema),
|
|
2911
|
+
redirectUrl: z9.string().nullable()
|
|
2870
2912
|
})
|
|
2871
2913
|
});
|
|
2872
|
-
var hubspotMeetingsViewResponseSchema =
|
|
2873
|
-
ok:
|
|
2874
|
-
data:
|
|
2914
|
+
var hubspotMeetingsViewResponseSchema = z9.object({
|
|
2915
|
+
ok: z9.literal(true),
|
|
2916
|
+
data: z9.object({
|
|
2875
2917
|
meeting: hubspotMeetingDetailSchema.optional(),
|
|
2876
2918
|
/** Present instead of `meeting` when `asNode` was requested. */
|
|
2877
2919
|
external: hubspotMeetingNodeExternalSchema.optional()
|
|
@@ -2879,8 +2921,8 @@ var hubspotMeetingsViewResponseSchema = z8.object({
|
|
|
2879
2921
|
});
|
|
2880
2922
|
|
|
2881
2923
|
// ../api/src/images.ts
|
|
2882
|
-
import { z as
|
|
2883
|
-
var imageSourceSchema =
|
|
2924
|
+
import { z as z10 } from "zod";
|
|
2925
|
+
var imageSourceSchema = z10.enum([
|
|
2884
2926
|
"uploaded",
|
|
2885
2927
|
"website",
|
|
2886
2928
|
"google_testimonial",
|
|
@@ -2896,49 +2938,49 @@ var imageSourceSchema = z9.enum([
|
|
|
2896
2938
|
"pinterest",
|
|
2897
2939
|
"ai_generated"
|
|
2898
2940
|
]);
|
|
2899
|
-
var imageStatusSchema =
|
|
2900
|
-
var upscaleConfigSchema =
|
|
2901
|
-
model:
|
|
2902
|
-
input:
|
|
2903
|
-
scale_factor:
|
|
2904
|
-
creativity:
|
|
2905
|
-
output_format:
|
|
2941
|
+
var imageStatusSchema = z10.enum(["uploading", "processing", "ready", "error"]);
|
|
2942
|
+
var upscaleConfigSchema = z10.object({
|
|
2943
|
+
model: z10.literal("philz1337x/crystal-upscaler"),
|
|
2944
|
+
input: z10.object({
|
|
2945
|
+
scale_factor: z10.number(),
|
|
2946
|
+
creativity: z10.number(),
|
|
2947
|
+
output_format: z10.string()
|
|
2906
2948
|
}),
|
|
2907
|
-
status:
|
|
2949
|
+
status: z10.enum(["pending", "completed"])
|
|
2908
2950
|
});
|
|
2909
|
-
var imageDocSchema =
|
|
2910
|
-
_id:
|
|
2911
|
-
_creationTime:
|
|
2912
|
-
companyId:
|
|
2913
|
-
storageKey:
|
|
2951
|
+
var imageDocSchema = z10.object({
|
|
2952
|
+
_id: z10.string(),
|
|
2953
|
+
_creationTime: z10.number(),
|
|
2954
|
+
companyId: z10.string(),
|
|
2955
|
+
storageKey: z10.string(),
|
|
2914
2956
|
upscaleConfig: upscaleConfigSchema.optional(),
|
|
2915
|
-
upscaledStorageKey:
|
|
2916
|
-
name:
|
|
2917
|
-
description:
|
|
2918
|
-
tags:
|
|
2919
|
-
source:
|
|
2920
|
-
externalId:
|
|
2921
|
-
externalUrl:
|
|
2922
|
-
contentHash:
|
|
2923
|
-
sourceId:
|
|
2924
|
-
descriptionContext:
|
|
2925
|
-
width:
|
|
2926
|
-
height:
|
|
2927
|
-
aspectRatio:
|
|
2928
|
-
dominantColor:
|
|
2929
|
-
imagePalette:
|
|
2930
|
-
thumbhashDataUri:
|
|
2931
|
-
isLightImage:
|
|
2932
|
-
descriptionEmbedding:
|
|
2933
|
-
imageEmbedding:
|
|
2934
|
-
searchText:
|
|
2957
|
+
upscaledStorageKey: z10.string().optional(),
|
|
2958
|
+
name: z10.string(),
|
|
2959
|
+
description: z10.string(),
|
|
2960
|
+
tags: z10.array(z10.string()),
|
|
2961
|
+
source: z10.string(),
|
|
2962
|
+
externalId: z10.string().optional(),
|
|
2963
|
+
externalUrl: z10.string().optional(),
|
|
2964
|
+
contentHash: z10.string().optional(),
|
|
2965
|
+
sourceId: z10.string().optional(),
|
|
2966
|
+
descriptionContext: z10.string().optional(),
|
|
2967
|
+
width: z10.number().optional(),
|
|
2968
|
+
height: z10.number().optional(),
|
|
2969
|
+
aspectRatio: z10.number().optional(),
|
|
2970
|
+
dominantColor: z10.string().optional(),
|
|
2971
|
+
imagePalette: z10.array(z10.string()).optional(),
|
|
2972
|
+
thumbhashDataUri: z10.string().optional(),
|
|
2973
|
+
isLightImage: z10.boolean().optional(),
|
|
2974
|
+
descriptionEmbedding: z10.array(z10.number()).optional(),
|
|
2975
|
+
imageEmbedding: z10.array(z10.number()).optional(),
|
|
2976
|
+
searchText: z10.string().optional(),
|
|
2935
2977
|
status: imageStatusSchema,
|
|
2936
|
-
errorMessage:
|
|
2937
|
-
createdAt:
|
|
2938
|
-
updatedAt:
|
|
2939
|
-
imageUrl:
|
|
2978
|
+
errorMessage: z10.string().optional(),
|
|
2979
|
+
createdAt: z10.number(),
|
|
2980
|
+
updatedAt: z10.number(),
|
|
2981
|
+
imageUrl: z10.string()
|
|
2940
2982
|
});
|
|
2941
|
-
var imageHitSourceSchema =
|
|
2983
|
+
var imageHitSourceSchema = z10.enum([
|
|
2942
2984
|
"library",
|
|
2943
2985
|
"magnific",
|
|
2944
2986
|
"google_images",
|
|
@@ -2949,145 +2991,145 @@ var imageHitSourceSchema = z9.enum([
|
|
|
2949
2991
|
"giphy",
|
|
2950
2992
|
"pinterest"
|
|
2951
2993
|
]);
|
|
2952
|
-
var imageHitSchema =
|
|
2994
|
+
var imageHitSchema = z10.object({
|
|
2953
2995
|
source: imageHitSourceSchema,
|
|
2954
|
-
url:
|
|
2955
|
-
thumbnailUrl:
|
|
2956
|
-
width:
|
|
2957
|
-
height:
|
|
2958
|
-
aspectRatio:
|
|
2959
|
-
dominantColor:
|
|
2960
|
-
externalId:
|
|
2961
|
-
externalUrl:
|
|
2962
|
-
providerMeta:
|
|
2963
|
-
descriptionContext:
|
|
2964
|
-
_id:
|
|
2965
|
-
name:
|
|
2966
|
-
description:
|
|
2967
|
-
tags:
|
|
2968
|
-
score:
|
|
2969
|
-
alsoInLibrary:
|
|
2970
|
-
prefetchedBytes:
|
|
2971
|
-
prefetchedContentType:
|
|
2996
|
+
url: z10.string(),
|
|
2997
|
+
thumbnailUrl: z10.string().optional(),
|
|
2998
|
+
width: z10.number().optional(),
|
|
2999
|
+
height: z10.number().optional(),
|
|
3000
|
+
aspectRatio: z10.number().optional(),
|
|
3001
|
+
dominantColor: z10.string().optional(),
|
|
3002
|
+
externalId: z10.string().optional(),
|
|
3003
|
+
externalUrl: z10.string().optional(),
|
|
3004
|
+
providerMeta: z10.record(z10.string(), z10.unknown()).optional(),
|
|
3005
|
+
descriptionContext: z10.string().optional(),
|
|
3006
|
+
_id: z10.string().optional(),
|
|
3007
|
+
name: z10.string().optional(),
|
|
3008
|
+
description: z10.string().optional(),
|
|
3009
|
+
tags: z10.array(z10.string()).optional(),
|
|
3010
|
+
score: z10.number().optional(),
|
|
3011
|
+
alsoInLibrary: z10.string().optional(),
|
|
3012
|
+
prefetchedBytes: z10.string().optional(),
|
|
3013
|
+
prefetchedContentType: z10.string().optional()
|
|
2972
3014
|
});
|
|
2973
3015
|
var ingestedImageHitSchema = imageHitSchema.extend({
|
|
2974
|
-
imageId:
|
|
2975
|
-
imageUrl:
|
|
2976
|
-
deduped:
|
|
2977
|
-
sourceUrl:
|
|
2978
|
-
});
|
|
2979
|
-
var autoIngestItemSchema =
|
|
2980
|
-
imageId:
|
|
2981
|
-
deduped:
|
|
2982
|
-
imageUrl:
|
|
2983
|
-
sourceUrl:
|
|
2984
|
-
externalUrl:
|
|
3016
|
+
imageId: z10.string().optional(),
|
|
3017
|
+
imageUrl: z10.string().optional(),
|
|
3018
|
+
deduped: z10.boolean().optional(),
|
|
3019
|
+
sourceUrl: z10.string().optional()
|
|
3020
|
+
});
|
|
3021
|
+
var autoIngestItemSchema = z10.object({
|
|
3022
|
+
imageId: z10.string(),
|
|
3023
|
+
deduped: z10.boolean(),
|
|
3024
|
+
imageUrl: z10.string(),
|
|
3025
|
+
sourceUrl: z10.string(),
|
|
3026
|
+
externalUrl: z10.string().optional()
|
|
2985
3027
|
});
|
|
2986
3028
|
function providerHitsResponseSchema() {
|
|
2987
|
-
return
|
|
2988
|
-
hits:
|
|
2989
|
-
ingested:
|
|
3029
|
+
return z10.object({
|
|
3030
|
+
hits: z10.array(ingestedImageHitSchema),
|
|
3031
|
+
ingested: z10.array(autoIngestItemSchema)
|
|
2990
3032
|
});
|
|
2991
3033
|
}
|
|
2992
|
-
var imagesGetRequestSchema =
|
|
2993
|
-
var imagesSearchRequestSchema =
|
|
2994
|
-
query:
|
|
2995
|
-
limit:
|
|
2996
|
-
aspectRatio:
|
|
2997
|
-
tags:
|
|
2998
|
-
source:
|
|
2999
|
-
externalUrlHost:
|
|
3000
|
-
});
|
|
3001
|
-
var imageSearchResultSchema =
|
|
3002
|
-
_id:
|
|
3003
|
-
imageUrl:
|
|
3004
|
-
name:
|
|
3005
|
-
description:
|
|
3006
|
-
tags:
|
|
3007
|
-
width:
|
|
3008
|
-
height:
|
|
3009
|
-
aspectRatio:
|
|
3010
|
-
dominantColor:
|
|
3011
|
-
imagePalette:
|
|
3012
|
-
source:
|
|
3013
|
-
externalUrl:
|
|
3014
|
-
score:
|
|
3015
|
-
});
|
|
3016
|
-
var imagesSearchResponseSchema =
|
|
3017
|
-
var imagesUploadRequestSchema =
|
|
3018
|
-
base64:
|
|
3019
|
-
contentType:
|
|
3020
|
-
source:
|
|
3021
|
-
descriptionContext:
|
|
3022
|
-
});
|
|
3023
|
-
var imagesUploadResponseSchema =
|
|
3024
|
-
var imagesDeleteRequestSchema =
|
|
3025
|
-
var imagesDeleteResponseSchema =
|
|
3026
|
-
var imagesUpscaleRequestSchema =
|
|
3027
|
-
var imagesUpscaleResponseSchema =
|
|
3028
|
-
imageId:
|
|
3029
|
-
status:
|
|
3034
|
+
var imagesGetRequestSchema = z10.object({ id: z10.string().min(1, "Missing id parameter") });
|
|
3035
|
+
var imagesSearchRequestSchema = z10.object({
|
|
3036
|
+
query: z10.string().min(1),
|
|
3037
|
+
limit: z10.coerce.number().int().positive().max(100).optional(),
|
|
3038
|
+
aspectRatio: z10.string().optional(),
|
|
3039
|
+
tags: z10.array(z10.string()).optional(),
|
|
3040
|
+
source: z10.string().optional(),
|
|
3041
|
+
externalUrlHost: z10.string().optional()
|
|
3042
|
+
});
|
|
3043
|
+
var imageSearchResultSchema = z10.object({
|
|
3044
|
+
_id: z10.string(),
|
|
3045
|
+
imageUrl: z10.string(),
|
|
3046
|
+
name: z10.string(),
|
|
3047
|
+
description: z10.string(),
|
|
3048
|
+
tags: z10.array(z10.string()),
|
|
3049
|
+
width: z10.number().optional(),
|
|
3050
|
+
height: z10.number().optional(),
|
|
3051
|
+
aspectRatio: z10.number().optional(),
|
|
3052
|
+
dominantColor: z10.string().optional(),
|
|
3053
|
+
imagePalette: z10.array(z10.string()).optional(),
|
|
3054
|
+
source: z10.string(),
|
|
3055
|
+
externalUrl: z10.string().optional(),
|
|
3056
|
+
score: z10.number()
|
|
3057
|
+
});
|
|
3058
|
+
var imagesSearchResponseSchema = z10.array(imageSearchResultSchema);
|
|
3059
|
+
var imagesUploadRequestSchema = z10.object({
|
|
3060
|
+
base64: z10.string().min(1),
|
|
3061
|
+
contentType: z10.string().min(1),
|
|
3062
|
+
source: z10.string().optional(),
|
|
3063
|
+
descriptionContext: z10.string().optional()
|
|
3064
|
+
});
|
|
3065
|
+
var imagesUploadResponseSchema = z10.object({ imageId: z10.string() });
|
|
3066
|
+
var imagesDeleteRequestSchema = z10.object({ id: z10.string().min(1, "Missing image ID") });
|
|
3067
|
+
var imagesDeleteResponseSchema = z10.object({ ok: z10.literal(true) });
|
|
3068
|
+
var imagesUpscaleRequestSchema = z10.object({ imageId: z10.string().min(1, "Missing image ID") });
|
|
3069
|
+
var imagesUpscaleResponseSchema = z10.object({
|
|
3070
|
+
imageId: z10.string(),
|
|
3071
|
+
status: z10.literal("processing")
|
|
3030
3072
|
});
|
|
3031
3073
|
var IMAGES_FIND_SOURCES = ["library", "magnific", "google", "iconify", "giphy", "pinterest"];
|
|
3032
|
-
var imagesFindRequestSchema =
|
|
3033
|
-
query:
|
|
3034
|
-
sources:
|
|
3035
|
-
limit:
|
|
3036
|
-
fallback:
|
|
3037
|
-
threshold:
|
|
3038
|
-
autoIngest:
|
|
3039
|
-
descriptionContext:
|
|
3040
|
-
});
|
|
3041
|
-
var imagesFindResponseSchema =
|
|
3042
|
-
groups:
|
|
3043
|
-
library:
|
|
3044
|
-
external:
|
|
3074
|
+
var imagesFindRequestSchema = z10.object({
|
|
3075
|
+
query: z10.string().min(1),
|
|
3076
|
+
sources: z10.array(z10.enum(IMAGES_FIND_SOURCES)).optional(),
|
|
3077
|
+
limit: z10.coerce.number().int().positive().max(50).optional(),
|
|
3078
|
+
fallback: z10.boolean().optional(),
|
|
3079
|
+
threshold: z10.number().min(0).max(1).optional(),
|
|
3080
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3081
|
+
descriptionContext: z10.string().optional()
|
|
3082
|
+
});
|
|
3083
|
+
var imagesFindResponseSchema = z10.object({
|
|
3084
|
+
groups: z10.object({
|
|
3085
|
+
library: z10.array(imageHitSchema),
|
|
3086
|
+
external: z10.array(ingestedImageHitSchema)
|
|
3045
3087
|
}),
|
|
3046
|
-
meta:
|
|
3047
|
-
counts:
|
|
3048
|
-
errors:
|
|
3088
|
+
meta: z10.object({
|
|
3089
|
+
counts: z10.record(z10.string(), z10.number()),
|
|
3090
|
+
errors: z10.array(z10.object({ source: imageHitSourceSchema, message: z10.string() }))
|
|
3049
3091
|
}),
|
|
3050
|
-
ingested:
|
|
3051
|
-
});
|
|
3052
|
-
var imagesStockRequestSchema =
|
|
3053
|
-
query:
|
|
3054
|
-
orientation:
|
|
3055
|
-
contentType:
|
|
3056
|
-
license:
|
|
3057
|
-
color:
|
|
3058
|
-
aiGenerated:
|
|
3059
|
-
people:
|
|
3060
|
-
order:
|
|
3061
|
-
limit:
|
|
3062
|
-
page:
|
|
3063
|
-
autoIngest:
|
|
3064
|
-
descriptionContext:
|
|
3092
|
+
ingested: z10.array(autoIngestItemSchema)
|
|
3093
|
+
});
|
|
3094
|
+
var imagesStockRequestSchema = z10.object({
|
|
3095
|
+
query: z10.string().min(1),
|
|
3096
|
+
orientation: z10.enum(["landscape", "portrait", "square", "panoramic"]).optional(),
|
|
3097
|
+
contentType: z10.enum(["photo", "vector", "psd"]).optional(),
|
|
3098
|
+
license: z10.enum(["freemium", "premium"]).optional(),
|
|
3099
|
+
color: z10.string().optional(),
|
|
3100
|
+
aiGenerated: z10.enum(["exclude", "only"]).optional(),
|
|
3101
|
+
people: z10.enum(["include", "exclude", "only"]).optional(),
|
|
3102
|
+
order: z10.enum(["relevance", "recent"]).optional(),
|
|
3103
|
+
limit: z10.coerce.number().int().positive().max(50).optional(),
|
|
3104
|
+
page: z10.coerce.number().int().positive().optional(),
|
|
3105
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3106
|
+
descriptionContext: z10.string().optional()
|
|
3065
3107
|
});
|
|
3066
3108
|
var imagesStockResponseSchema = providerHitsResponseSchema();
|
|
3067
|
-
var imagesGoogleRequestSchema =
|
|
3068
|
-
query:
|
|
3069
|
-
type:
|
|
3070
|
-
size:
|
|
3071
|
-
color:
|
|
3072
|
-
safe:
|
|
3073
|
-
limit:
|
|
3074
|
-
autoIngest:
|
|
3075
|
-
descriptionContext:
|
|
3109
|
+
var imagesGoogleRequestSchema = z10.object({
|
|
3110
|
+
query: z10.string().min(1),
|
|
3111
|
+
type: z10.string().optional(),
|
|
3112
|
+
size: z10.string().optional(),
|
|
3113
|
+
color: z10.string().optional(),
|
|
3114
|
+
safe: z10.enum(["off", "active"]).optional(),
|
|
3115
|
+
limit: z10.coerce.number().int().positive().max(50).optional(),
|
|
3116
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3117
|
+
descriptionContext: z10.string().optional()
|
|
3076
3118
|
});
|
|
3077
3119
|
var imagesGoogleResponseSchema = providerHitsResponseSchema();
|
|
3078
|
-
var imagesPinterestRequestSchema =
|
|
3079
|
-
query:
|
|
3080
|
-
limit:
|
|
3081
|
-
autoIngest:
|
|
3082
|
-
descriptionContext:
|
|
3120
|
+
var imagesPinterestRequestSchema = z10.object({
|
|
3121
|
+
query: z10.string().min(1),
|
|
3122
|
+
limit: z10.coerce.number().int().positive().max(20).optional(),
|
|
3123
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3124
|
+
descriptionContext: z10.string().optional()
|
|
3083
3125
|
});
|
|
3084
3126
|
var imagesPinterestResponseSchema = providerHitsResponseSchema();
|
|
3085
|
-
var rgbTriple =
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3127
|
+
var rgbTriple = z10.tuple([
|
|
3128
|
+
z10.number().int().min(0).max(255),
|
|
3129
|
+
z10.number().int().min(0).max(255),
|
|
3130
|
+
z10.number().int().min(0).max(255)
|
|
3089
3131
|
]);
|
|
3090
|
-
var imageGenerateModelSchema =
|
|
3132
|
+
var imageGenerateModelSchema = z10.enum([
|
|
3091
3133
|
"openai/gpt-image-2",
|
|
3092
3134
|
// Legacy — see the registry entry; kept so pre-switch canvases still run.
|
|
3093
3135
|
"openai/gpt-5.4-image-2",
|
|
@@ -3095,97 +3137,97 @@ var imageGenerateModelSchema = z9.enum([
|
|
|
3095
3137
|
"google/gemini-3-pro-image-preview",
|
|
3096
3138
|
"recraft/recraft-v4.1-pro-vector"
|
|
3097
3139
|
]);
|
|
3098
|
-
var imagesGenerateRequestSchema =
|
|
3099
|
-
prompt:
|
|
3140
|
+
var imagesGenerateRequestSchema = z10.object({
|
|
3141
|
+
prompt: z10.string().min(1),
|
|
3100
3142
|
model: imageGenerateModelSchema.optional(),
|
|
3101
3143
|
// Aspect ratio + size are validated loosely as strings; the per-model enum
|
|
3102
3144
|
// lives in canvas-contract and OpenRouter rejects unsupported combinations.
|
|
3103
|
-
aspectRatio:
|
|
3104
|
-
imageSize:
|
|
3145
|
+
aspectRatio: z10.string().optional(),
|
|
3146
|
+
imageSize: z10.string().optional(),
|
|
3105
3147
|
// Rendering quality (auto|low|medium|high) — honored by gpt-image / Gemini, ignored elsewhere.
|
|
3106
|
-
quality:
|
|
3148
|
+
quality: z10.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3107
3149
|
// Recraft v4.1 Pro Vector levers (ignored by other models).
|
|
3108
|
-
strength:
|
|
3109
|
-
rgbColors:
|
|
3150
|
+
strength: z10.coerce.number().min(0).max(1).optional(),
|
|
3151
|
+
rgbColors: z10.array(rgbTriple).optional(),
|
|
3110
3152
|
backgroundRgbColor: rgbTriple.optional(),
|
|
3111
3153
|
// Public image URLs used as visual references (multi-reference, in order).
|
|
3112
|
-
referenceUrls:
|
|
3113
|
-
descriptionContext:
|
|
3114
|
-
});
|
|
3115
|
-
var generatedImageSchema =
|
|
3116
|
-
imageId:
|
|
3117
|
-
deduped:
|
|
3118
|
-
imageUrl:
|
|
3119
|
-
width:
|
|
3120
|
-
height:
|
|
3121
|
-
});
|
|
3122
|
-
var imagesGenerateResponseSchema =
|
|
3123
|
-
model:
|
|
3124
|
-
costUsd:
|
|
3125
|
-
images:
|
|
3126
|
-
});
|
|
3127
|
-
var imagesLogoRequestSchema =
|
|
3128
|
-
domain:
|
|
3129
|
-
variant:
|
|
3130
|
-
autoIngest:
|
|
3131
|
-
descriptionContext:
|
|
3154
|
+
referenceUrls: z10.array(z10.string().url()).optional(),
|
|
3155
|
+
descriptionContext: z10.string().optional()
|
|
3156
|
+
});
|
|
3157
|
+
var generatedImageSchema = z10.object({
|
|
3158
|
+
imageId: z10.string(),
|
|
3159
|
+
deduped: z10.boolean(),
|
|
3160
|
+
imageUrl: z10.string(),
|
|
3161
|
+
width: z10.number().optional(),
|
|
3162
|
+
height: z10.number().optional()
|
|
3163
|
+
});
|
|
3164
|
+
var imagesGenerateResponseSchema = z10.object({
|
|
3165
|
+
model: z10.string(),
|
|
3166
|
+
costUsd: z10.number(),
|
|
3167
|
+
images: z10.array(generatedImageSchema)
|
|
3168
|
+
});
|
|
3169
|
+
var imagesLogoRequestSchema = z10.object({
|
|
3170
|
+
domain: z10.string().min(1),
|
|
3171
|
+
variant: z10.enum(["icon", "logo", "symbol"]).optional(),
|
|
3172
|
+
autoIngest: z10.coerce.number().int().min(0).max(5).optional(),
|
|
3173
|
+
descriptionContext: z10.string().optional()
|
|
3132
3174
|
});
|
|
3133
3175
|
var imagesLogoResponseSchema = providerHitsResponseSchema();
|
|
3134
|
-
var imagesIconRequestSchema =
|
|
3135
|
-
name:
|
|
3136
|
-
set:
|
|
3137
|
-
color:
|
|
3138
|
-
width:
|
|
3139
|
-
autoIngest:
|
|
3140
|
-
descriptionContext:
|
|
3176
|
+
var imagesIconRequestSchema = z10.object({
|
|
3177
|
+
name: z10.string().min(1),
|
|
3178
|
+
set: z10.string().optional(),
|
|
3179
|
+
color: z10.string().optional(),
|
|
3180
|
+
width: z10.coerce.number().int().positive().optional(),
|
|
3181
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3182
|
+
descriptionContext: z10.string().optional()
|
|
3141
3183
|
});
|
|
3142
3184
|
var imagesIconResponseSchema = providerHitsResponseSchema();
|
|
3143
|
-
var imagesExtractRequestSchema =
|
|
3144
|
-
url:
|
|
3145
|
-
waitFor:
|
|
3146
|
-
limit:
|
|
3147
|
-
autoIngest:
|
|
3148
|
-
descriptionContext:
|
|
3185
|
+
var imagesExtractRequestSchema = z10.object({
|
|
3186
|
+
url: z10.string().url(),
|
|
3187
|
+
waitFor: z10.coerce.number().int().min(0).max(3e4).optional(),
|
|
3188
|
+
limit: z10.coerce.number().int().positive().max(50).optional(),
|
|
3189
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3190
|
+
descriptionContext: z10.string().optional()
|
|
3149
3191
|
});
|
|
3150
3192
|
var imagesExtractResponseSchema = providerHitsResponseSchema();
|
|
3151
|
-
var imagesScreenshotRequestSchema =
|
|
3152
|
-
url:
|
|
3153
|
-
fullPage:
|
|
3154
|
-
viewportWidth:
|
|
3155
|
-
viewportHeight:
|
|
3156
|
-
format:
|
|
3157
|
-
descriptionContext:
|
|
3193
|
+
var imagesScreenshotRequestSchema = z10.object({
|
|
3194
|
+
url: z10.string().url(),
|
|
3195
|
+
fullPage: z10.boolean().optional(),
|
|
3196
|
+
viewportWidth: z10.coerce.number().int().positive().max(3840).optional(),
|
|
3197
|
+
viewportHeight: z10.coerce.number().int().positive().max(2160).optional(),
|
|
3198
|
+
format: z10.enum(["webp", "png", "jpg"]).optional(),
|
|
3199
|
+
descriptionContext: z10.string().optional()
|
|
3158
3200
|
});
|
|
3159
3201
|
var imagesScreenshotResponseSchema = providerHitsResponseSchema();
|
|
3160
|
-
var imagesGiphyRequestSchema =
|
|
3161
|
-
query:
|
|
3162
|
-
trending:
|
|
3163
|
-
limit:
|
|
3164
|
-
rating:
|
|
3165
|
-
lang:
|
|
3166
|
-
autoIngest:
|
|
3167
|
-
descriptionContext:
|
|
3202
|
+
var imagesGiphyRequestSchema = z10.object({
|
|
3203
|
+
query: z10.string().min(1).optional(),
|
|
3204
|
+
trending: z10.coerce.boolean().optional(),
|
|
3205
|
+
limit: z10.coerce.number().int().positive().max(50).optional(),
|
|
3206
|
+
rating: z10.enum(["g", "pg", "pg-13", "r"]).optional(),
|
|
3207
|
+
lang: z10.string().optional(),
|
|
3208
|
+
autoIngest: z10.coerce.number().int().min(0).max(20).optional(),
|
|
3209
|
+
descriptionContext: z10.string().optional()
|
|
3168
3210
|
});
|
|
3169
3211
|
var imagesGifResponseSchema = providerHitsResponseSchema();
|
|
3170
3212
|
var imagesStickerResponseSchema = providerHitsResponseSchema();
|
|
3171
|
-
var imagesIngestRequestSchema =
|
|
3172
|
-
url:
|
|
3213
|
+
var imagesIngestRequestSchema = z10.object({
|
|
3214
|
+
url: z10.string().url(),
|
|
3173
3215
|
// Validate source at the HTTP boundary so unknown values produce the standard
|
|
3174
3216
|
// `{ code: "BAD_REQUEST", message }` shape instead of a plain Error from
|
|
3175
3217
|
// `assertImageSource` inside the action.
|
|
3176
3218
|
source: imageSourceSchema,
|
|
3177
|
-
externalId:
|
|
3178
|
-
externalUrl:
|
|
3179
|
-
descriptionContext:
|
|
3219
|
+
externalId: z10.string().optional(),
|
|
3220
|
+
externalUrl: z10.string().optional(),
|
|
3221
|
+
descriptionContext: z10.string().optional()
|
|
3180
3222
|
});
|
|
3181
|
-
var imagesIngestResponseSchema =
|
|
3182
|
-
imageId:
|
|
3183
|
-
deduped:
|
|
3184
|
-
contentHash:
|
|
3223
|
+
var imagesIngestResponseSchema = z10.object({
|
|
3224
|
+
imageId: z10.string(),
|
|
3225
|
+
deduped: z10.boolean(),
|
|
3226
|
+
contentHash: z10.string()
|
|
3185
3227
|
});
|
|
3186
3228
|
|
|
3187
3229
|
// ../api/src/tags.ts
|
|
3188
|
-
import { z as
|
|
3230
|
+
import { z as z11 } from "zod";
|
|
3189
3231
|
var TAG_TYPES = [
|
|
3190
3232
|
"meta",
|
|
3191
3233
|
"amplitude",
|
|
@@ -3206,7 +3248,7 @@ var TAG_TYPES = [
|
|
|
3206
3248
|
"recaptcha",
|
|
3207
3249
|
"twitterAds"
|
|
3208
3250
|
];
|
|
3209
|
-
var tagTypeSchema =
|
|
3251
|
+
var tagTypeSchema = z11.enum(TAG_TYPES);
|
|
3210
3252
|
var TAG_IDENTIFYING_FIELD = {
|
|
3211
3253
|
meta: "pixelId",
|
|
3212
3254
|
googleAds: "conversionID",
|
|
@@ -3227,218 +3269,218 @@ var TAG_IDENTIFYING_FIELD = {
|
|
|
3227
3269
|
recaptcha: "siteKey",
|
|
3228
3270
|
twitterAds: "pixelId"
|
|
3229
3271
|
};
|
|
3230
|
-
var tagDraftOpKindSchema =
|
|
3231
|
-
var tagDraftOpViewSchema =
|
|
3272
|
+
var tagDraftOpKindSchema = z11.enum(["create", "update", "delete"]);
|
|
3273
|
+
var tagDraftOpViewSchema = z11.object({
|
|
3232
3274
|
/** `tag_temp_*` for staged creates; the real tag id for update/delete ops. */
|
|
3233
|
-
ref:
|
|
3275
|
+
ref: z11.string(),
|
|
3234
3276
|
kind: tagDraftOpKindSchema,
|
|
3235
3277
|
type: tagTypeSchema,
|
|
3236
3278
|
/** Present on update/delete ops — the real tag this op targets. */
|
|
3237
|
-
tagId:
|
|
3279
|
+
tagId: z11.string().optional(),
|
|
3238
3280
|
/** Non-secret config (create: full; update: the staged patch). Secrets are structurally absent. */
|
|
3239
|
-
config:
|
|
3281
|
+
config: z11.record(z11.string(), z11.string()),
|
|
3240
3282
|
/** Update only — fields the op explicitly clears. */
|
|
3241
|
-
clearFields:
|
|
3283
|
+
clearFields: z11.array(z11.string()).optional(),
|
|
3242
3284
|
/** Names of secret fields already provided via the dashboard secure form. Never values. */
|
|
3243
|
-
secretsSet:
|
|
3285
|
+
secretsSet: z11.array(z11.string()),
|
|
3244
3286
|
/** Names of secret fields still awaiting user input. */
|
|
3245
|
-
secretsPending:
|
|
3246
|
-
summary:
|
|
3247
|
-
stagedAt:
|
|
3287
|
+
secretsPending: z11.array(z11.string()),
|
|
3288
|
+
summary: z11.string(),
|
|
3289
|
+
stagedAt: z11.number()
|
|
3248
3290
|
});
|
|
3249
|
-
var tagsEffectiveEntrySchema =
|
|
3291
|
+
var tagsEffectiveEntrySchema = z11.object({
|
|
3250
3292
|
/** Real tag id, or `tag_temp_*` for staged creates. Use as flow side-effect `tagIds` value. */
|
|
3251
|
-
ref:
|
|
3252
|
-
tagId:
|
|
3293
|
+
ref: z11.string(),
|
|
3294
|
+
tagId: z11.string().optional(),
|
|
3253
3295
|
type: tagTypeSchema,
|
|
3254
3296
|
/** Value of the type's identifying field, when set. */
|
|
3255
|
-
identifier:
|
|
3297
|
+
identifier: z11.string().optional(),
|
|
3256
3298
|
/** Redacted config; for staged updates, production config with the patch merged. */
|
|
3257
|
-
config:
|
|
3299
|
+
config: z11.record(z11.string(), z11.string()),
|
|
3258
3300
|
/** Absent = live production tag with no staged changes in this chat. */
|
|
3259
3301
|
staged: tagDraftOpKindSchema.optional(),
|
|
3260
|
-
secretsSet:
|
|
3261
|
-
secretsPending:
|
|
3302
|
+
secretsSet: z11.array(z11.string()),
|
|
3303
|
+
secretsPending: z11.array(z11.string())
|
|
3262
3304
|
});
|
|
3263
|
-
var tagsListRequestSchema =
|
|
3264
|
-
var tagsListResponseSchema =
|
|
3265
|
-
var tagsDraftListRequestSchema =
|
|
3266
|
-
var tagsDraftListResponseSchema =
|
|
3267
|
-
status:
|
|
3268
|
-
ops:
|
|
3305
|
+
var tagsListRequestSchema = z11.object({ chatId: z11.string() });
|
|
3306
|
+
var tagsListResponseSchema = z11.object({ tags: z11.array(tagsEffectiveEntrySchema) });
|
|
3307
|
+
var tagsDraftListRequestSchema = z11.object({ chatId: z11.string() });
|
|
3308
|
+
var tagsDraftListResponseSchema = z11.object({
|
|
3309
|
+
status: z11.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
3310
|
+
ops: z11.array(tagDraftOpViewSchema)
|
|
3269
3311
|
});
|
|
3270
|
-
var tagInputRequestSchema =
|
|
3312
|
+
var tagInputRequestSchema = z11.object({
|
|
3271
3313
|
// Every tag change is a tab in the approval form: create/edit show the full
|
|
3272
3314
|
// body; delete shows a confirm. No tag change bypasses this approval.
|
|
3273
|
-
mode:
|
|
3315
|
+
mode: z11.enum(["create", "edit", "delete"]),
|
|
3274
3316
|
tagType: tagTypeSchema,
|
|
3275
3317
|
/** Edit/delete mode — the real tag id or `tag_temp_*` ref being changed. */
|
|
3276
|
-
ref:
|
|
3318
|
+
ref: z11.string().optional(),
|
|
3277
3319
|
/** Non-secret values the agent proposes to prefill. Secret keys are stripped at every boundary. */
|
|
3278
|
-
prefilledConfig:
|
|
3320
|
+
prefilledConfig: z11.record(z11.string(), z11.string()).optional(),
|
|
3279
3321
|
/** Secret field names the agent asks the user to provide. */
|
|
3280
|
-
requestedSecretFields:
|
|
3322
|
+
requestedSecretFields: z11.array(z11.string()).optional(),
|
|
3281
3323
|
/** Short message shown above the form explaining why the input is needed. */
|
|
3282
|
-
message:
|
|
3324
|
+
message: z11.string().optional()
|
|
3283
3325
|
});
|
|
3284
|
-
var tagChangeToolInputSchema =
|
|
3285
|
-
changes:
|
|
3326
|
+
var tagChangeToolInputSchema = z11.object({
|
|
3327
|
+
changes: z11.array(tagInputRequestSchema).min(1).max(8)
|
|
3286
3328
|
});
|
|
3287
|
-
var tagInputResultSchema =
|
|
3288
|
-
|
|
3289
|
-
status:
|
|
3290
|
-
ref:
|
|
3329
|
+
var tagInputResultSchema = z11.discriminatedUnion("status", [
|
|
3330
|
+
z11.object({
|
|
3331
|
+
status: z11.literal("submitted"),
|
|
3332
|
+
ref: z11.string(),
|
|
3291
3333
|
type: tagTypeSchema,
|
|
3292
3334
|
/** Identifying field name → value (non-secret), when the type has one. */
|
|
3293
|
-
identifier:
|
|
3294
|
-
secretFieldsSet:
|
|
3295
|
-
note:
|
|
3335
|
+
identifier: z11.record(z11.string(), z11.string()).optional(),
|
|
3336
|
+
secretFieldsSet: z11.array(z11.string()),
|
|
3337
|
+
note: z11.string().optional()
|
|
3296
3338
|
}),
|
|
3297
|
-
|
|
3298
|
-
status:
|
|
3299
|
-
reason:
|
|
3339
|
+
z11.object({
|
|
3340
|
+
status: z11.literal("declined"),
|
|
3341
|
+
reason: z11.string().optional()
|
|
3300
3342
|
})
|
|
3301
3343
|
]);
|
|
3302
|
-
var tagChangeToolResultSchema =
|
|
3303
|
-
results:
|
|
3344
|
+
var tagChangeToolResultSchema = z11.object({
|
|
3345
|
+
results: z11.array(tagInputResultSchema)
|
|
3304
3346
|
});
|
|
3305
3347
|
|
|
3306
3348
|
// ../api/src/testimonials.ts
|
|
3307
|
-
import { z as
|
|
3308
|
-
var testimonialSourceTypeSchema =
|
|
3309
|
-
var testimonialStatusSchema =
|
|
3310
|
-
var testimonialSentimentSchema =
|
|
3311
|
-
var testimonialDocSchema =
|
|
3312
|
-
_id:
|
|
3313
|
-
_creationTime:
|
|
3314
|
-
companyId:
|
|
3315
|
-
sourceId:
|
|
3349
|
+
import { z as z12 } from "zod";
|
|
3350
|
+
var testimonialSourceTypeSchema = z12.enum(["google", "trustpilot"]);
|
|
3351
|
+
var testimonialStatusSchema = z12.enum(["pending", "processing", "ready", "error"]);
|
|
3352
|
+
var testimonialSentimentSchema = z12.enum(["positive", "neutral", "negative"]);
|
|
3353
|
+
var testimonialDocSchema = z12.object({
|
|
3354
|
+
_id: z12.string(),
|
|
3355
|
+
_creationTime: z12.number(),
|
|
3356
|
+
companyId: z12.string(),
|
|
3357
|
+
sourceId: z12.string(),
|
|
3316
3358
|
sourceType: testimonialSourceTypeSchema,
|
|
3317
|
-
reviewText:
|
|
3318
|
-
reviewTitle:
|
|
3319
|
-
searchText:
|
|
3320
|
-
reviewerName:
|
|
3321
|
-
reviewerImageUrl:
|
|
3322
|
-
reviewerImageId:
|
|
3323
|
-
reviewerLocation:
|
|
3324
|
-
rating:
|
|
3325
|
-
reviewDate:
|
|
3326
|
-
ownerAnswer:
|
|
3327
|
-
mediaUrls:
|
|
3328
|
-
imageIds:
|
|
3329
|
-
videoIds:
|
|
3330
|
-
sourceUrl:
|
|
3331
|
-
rawData:
|
|
3332
|
-
tags:
|
|
3333
|
-
highlight:
|
|
3334
|
-
language:
|
|
3335
|
-
summary:
|
|
3359
|
+
reviewText: z12.string(),
|
|
3360
|
+
reviewTitle: z12.string().optional(),
|
|
3361
|
+
searchText: z12.string().optional(),
|
|
3362
|
+
reviewerName: z12.string().optional(),
|
|
3363
|
+
reviewerImageUrl: z12.string().optional(),
|
|
3364
|
+
reviewerImageId: z12.string().optional(),
|
|
3365
|
+
reviewerLocation: z12.string().optional(),
|
|
3366
|
+
rating: z12.number().optional(),
|
|
3367
|
+
reviewDate: z12.number().optional(),
|
|
3368
|
+
ownerAnswer: z12.string().optional(),
|
|
3369
|
+
mediaUrls: z12.array(z12.string()).optional(),
|
|
3370
|
+
imageIds: z12.array(z12.string()).optional(),
|
|
3371
|
+
videoIds: z12.array(z12.string()).optional(),
|
|
3372
|
+
sourceUrl: z12.string().optional(),
|
|
3373
|
+
rawData: z12.unknown().optional(),
|
|
3374
|
+
tags: z12.array(z12.string()),
|
|
3375
|
+
highlight: z12.string().optional(),
|
|
3376
|
+
language: z12.string().optional(),
|
|
3377
|
+
summary: z12.string().optional(),
|
|
3336
3378
|
sentiment: testimonialSentimentSchema.optional(),
|
|
3337
|
-
textEmbedding:
|
|
3338
|
-
externalId:
|
|
3339
|
-
contentHash:
|
|
3379
|
+
textEmbedding: z12.array(z12.number()).optional(),
|
|
3380
|
+
externalId: z12.string().optional(),
|
|
3381
|
+
contentHash: z12.string().optional(),
|
|
3340
3382
|
status: testimonialStatusSchema,
|
|
3341
|
-
errorMessage:
|
|
3342
|
-
createdAt:
|
|
3343
|
-
updatedAt:
|
|
3383
|
+
errorMessage: z12.string().optional(),
|
|
3384
|
+
createdAt: z12.number(),
|
|
3385
|
+
updatedAt: z12.number()
|
|
3344
3386
|
});
|
|
3345
|
-
var testimonialsListRequestSchema =
|
|
3387
|
+
var testimonialsListRequestSchema = z12.object({
|
|
3346
3388
|
source: testimonialSourceTypeSchema.optional(),
|
|
3347
|
-
rating_min:
|
|
3348
|
-
rating_max:
|
|
3349
|
-
tags:
|
|
3389
|
+
rating_min: z12.coerce.number().int().min(1).max(5).optional(),
|
|
3390
|
+
rating_max: z12.coerce.number().int().min(1).max(5).optional(),
|
|
3391
|
+
tags: z12.string().transform((s) => s.split(",").filter(Boolean)).optional(),
|
|
3350
3392
|
status: testimonialStatusSchema.optional(),
|
|
3351
3393
|
sentiment: testimonialSentimentSchema.optional(),
|
|
3352
|
-
language:
|
|
3353
|
-
limit:
|
|
3354
|
-
});
|
|
3355
|
-
var testimonialsListResponseSchema =
|
|
3356
|
-
var testimonialsGetRequestSchema =
|
|
3357
|
-
var testimonialsSearchRequestSchema =
|
|
3358
|
-
query:
|
|
3359
|
-
limit:
|
|
3394
|
+
language: z12.string().min(2).max(5).optional(),
|
|
3395
|
+
limit: z12.coerce.number().int().positive().max(200).optional()
|
|
3396
|
+
});
|
|
3397
|
+
var testimonialsListResponseSchema = z12.array(testimonialDocSchema);
|
|
3398
|
+
var testimonialsGetRequestSchema = z12.object({ id: z12.string().min(1, "Missing id parameter") });
|
|
3399
|
+
var testimonialsSearchRequestSchema = z12.object({
|
|
3400
|
+
query: z12.string().min(1),
|
|
3401
|
+
limit: z12.coerce.number().int().positive().max(100).optional(),
|
|
3360
3402
|
source: testimonialSourceTypeSchema.optional(),
|
|
3361
|
-
rating_min:
|
|
3362
|
-
rating_max:
|
|
3363
|
-
tags:
|
|
3403
|
+
rating_min: z12.coerce.number().int().min(1).max(5).optional(),
|
|
3404
|
+
rating_max: z12.coerce.number().int().min(1).max(5).optional(),
|
|
3405
|
+
tags: z12.array(z12.string()).optional(),
|
|
3364
3406
|
status: testimonialStatusSchema.optional(),
|
|
3365
3407
|
sentiment: testimonialSentimentSchema.optional(),
|
|
3366
|
-
language:
|
|
3408
|
+
language: z12.string().min(2).max(5).optional()
|
|
3367
3409
|
}).refine(
|
|
3368
3410
|
(data) => data.rating_min === void 0 || data.rating_max === void 0 || data.rating_min <= data.rating_max,
|
|
3369
3411
|
{ message: "rating_min must be less than or equal to rating_max" }
|
|
3370
3412
|
);
|
|
3371
|
-
var testimonialsSearchResponseSchema =
|
|
3372
|
-
var testimonialsOutscraperWebhookResponseSchema =
|
|
3373
|
-
ok:
|
|
3374
|
-
note:
|
|
3413
|
+
var testimonialsSearchResponseSchema = z12.array(testimonialDocSchema);
|
|
3414
|
+
var testimonialsOutscraperWebhookResponseSchema = z12.object({
|
|
3415
|
+
ok: z12.literal(true),
|
|
3416
|
+
note: z12.string().optional()
|
|
3375
3417
|
});
|
|
3376
3418
|
|
|
3377
3419
|
// ../api/src/videos.ts
|
|
3378
|
-
import { z as
|
|
3379
|
-
var videoStatusSchema =
|
|
3380
|
-
var videoTranscriptSegmentSchema =
|
|
3381
|
-
text:
|
|
3382
|
-
startSecond:
|
|
3383
|
-
endSecond:
|
|
3384
|
-
});
|
|
3385
|
-
var videoSceneSchema =
|
|
3386
|
-
title:
|
|
3387
|
-
description:
|
|
3388
|
-
startSecond:
|
|
3389
|
-
endSecond:
|
|
3390
|
-
thumbnailTime:
|
|
3391
|
-
});
|
|
3392
|
-
var videoDocSchema =
|
|
3393
|
-
_id:
|
|
3394
|
-
_creationTime:
|
|
3395
|
-
companyId:
|
|
3396
|
-
muxAssetId:
|
|
3397
|
-
muxPlaybackId:
|
|
3398
|
-
muxUploadId:
|
|
3399
|
-
name:
|
|
3400
|
-
description:
|
|
3401
|
-
tags:
|
|
3402
|
-
source:
|
|
3403
|
-
externalId:
|
|
3404
|
-
sourceId:
|
|
3405
|
-
width:
|
|
3406
|
-
height:
|
|
3407
|
-
aspectRatio:
|
|
3408
|
-
duration:
|
|
3409
|
-
transcript:
|
|
3410
|
-
transcriptSegments:
|
|
3411
|
-
scenes:
|
|
3412
|
-
descriptionEmbedding:
|
|
3413
|
-
searchText:
|
|
3420
|
+
import { z as z13 } from "zod";
|
|
3421
|
+
var videoStatusSchema = z13.enum(["uploading", "uploaded", "processing", "ready", "error"]);
|
|
3422
|
+
var videoTranscriptSegmentSchema = z13.object({
|
|
3423
|
+
text: z13.string(),
|
|
3424
|
+
startSecond: z13.number(),
|
|
3425
|
+
endSecond: z13.number()
|
|
3426
|
+
});
|
|
3427
|
+
var videoSceneSchema = z13.object({
|
|
3428
|
+
title: z13.string(),
|
|
3429
|
+
description: z13.string(),
|
|
3430
|
+
startSecond: z13.number(),
|
|
3431
|
+
endSecond: z13.number(),
|
|
3432
|
+
thumbnailTime: z13.number()
|
|
3433
|
+
});
|
|
3434
|
+
var videoDocSchema = z13.object({
|
|
3435
|
+
_id: z13.string(),
|
|
3436
|
+
_creationTime: z13.number(),
|
|
3437
|
+
companyId: z13.string(),
|
|
3438
|
+
muxAssetId: z13.string(),
|
|
3439
|
+
muxPlaybackId: z13.string(),
|
|
3440
|
+
muxUploadId: z13.string(),
|
|
3441
|
+
name: z13.string(),
|
|
3442
|
+
description: z13.string(),
|
|
3443
|
+
tags: z13.array(z13.string()),
|
|
3444
|
+
source: z13.string(),
|
|
3445
|
+
externalId: z13.string().optional(),
|
|
3446
|
+
sourceId: z13.string().optional(),
|
|
3447
|
+
width: z13.number().optional(),
|
|
3448
|
+
height: z13.number().optional(),
|
|
3449
|
+
aspectRatio: z13.number().optional(),
|
|
3450
|
+
duration: z13.number().optional(),
|
|
3451
|
+
transcript: z13.string().optional(),
|
|
3452
|
+
transcriptSegments: z13.array(videoTranscriptSegmentSchema).optional(),
|
|
3453
|
+
scenes: z13.array(videoSceneSchema).optional(),
|
|
3454
|
+
descriptionEmbedding: z13.array(z13.number()).optional(),
|
|
3455
|
+
searchText: z13.string().optional(),
|
|
3414
3456
|
status: videoStatusSchema,
|
|
3415
|
-
errorMessage:
|
|
3416
|
-
createdAt:
|
|
3417
|
-
updatedAt:
|
|
3418
|
-
thumbnailUrl:
|
|
3419
|
-
});
|
|
3420
|
-
var videosWebhookResponseSchema =
|
|
3421
|
-
var videosGetRequestSchema =
|
|
3422
|
-
var videosSearchRequestSchema =
|
|
3423
|
-
query:
|
|
3424
|
-
limit:
|
|
3425
|
-
tags:
|
|
3426
|
-
});
|
|
3427
|
-
var videoSearchResultSchema =
|
|
3428
|
-
_id:
|
|
3429
|
-
thumbnailUrl:
|
|
3430
|
-
name:
|
|
3431
|
-
description:
|
|
3432
|
-
tags:
|
|
3433
|
-
status:
|
|
3434
|
-
duration:
|
|
3435
|
-
muxPlaybackId:
|
|
3436
|
-
createdAt:
|
|
3437
|
-
});
|
|
3438
|
-
var videosSearchResponseSchema =
|
|
3439
|
-
var videosUploadResponseSchema =
|
|
3440
|
-
var videosDeleteRequestSchema =
|
|
3441
|
-
var videosDeleteResponseSchema =
|
|
3457
|
+
errorMessage: z13.string().optional(),
|
|
3458
|
+
createdAt: z13.number(),
|
|
3459
|
+
updatedAt: z13.number(),
|
|
3460
|
+
thumbnailUrl: z13.string()
|
|
3461
|
+
});
|
|
3462
|
+
var videosWebhookResponseSchema = z13.object({ ok: z13.literal(true) });
|
|
3463
|
+
var videosGetRequestSchema = z13.object({ id: z13.string().min(1, "Missing id parameter") });
|
|
3464
|
+
var videosSearchRequestSchema = z13.object({
|
|
3465
|
+
query: z13.string().min(1),
|
|
3466
|
+
limit: z13.coerce.number().int().positive().max(100).optional(),
|
|
3467
|
+
tags: z13.array(z13.string()).optional()
|
|
3468
|
+
});
|
|
3469
|
+
var videoSearchResultSchema = z13.object({
|
|
3470
|
+
_id: z13.string(),
|
|
3471
|
+
thumbnailUrl: z13.string(),
|
|
3472
|
+
name: z13.string(),
|
|
3473
|
+
description: z13.string(),
|
|
3474
|
+
tags: z13.array(z13.string()),
|
|
3475
|
+
status: z13.string(),
|
|
3476
|
+
duration: z13.number().optional(),
|
|
3477
|
+
muxPlaybackId: z13.string(),
|
|
3478
|
+
createdAt: z13.number()
|
|
3479
|
+
});
|
|
3480
|
+
var videosSearchResponseSchema = z13.array(videoSearchResultSchema);
|
|
3481
|
+
var videosUploadResponseSchema = z13.object({ uploadUrl: z13.string(), videoId: z13.string() });
|
|
3482
|
+
var videosDeleteRequestSchema = z13.object({ id: z13.string().min(1, "Missing video ID") });
|
|
3483
|
+
var videosDeleteResponseSchema = z13.object({ ok: z13.literal(true) });
|
|
3442
3484
|
|
|
3443
3485
|
// src/commands/actions/complete.ts
|
|
3444
3486
|
import { defineCommand as defineCommand2 } from "citty";
|
|
@@ -4394,6 +4436,7 @@ var FIELD_DESCRIPTIONS = {
|
|
|
4394
4436
|
"ad_group_ad.ad.responsive_search_ad.headlines": "Ad headline variations (array)",
|
|
4395
4437
|
"ad_group_ad.ad.responsive_search_ad.descriptions": "Ad description variations (array)",
|
|
4396
4438
|
// Keywords
|
|
4439
|
+
"ad_group_criterion.criterion_id": "Keyword criterion id \u2014 derived from text + match type, so every copy of the same keyword across ad groups shares it. Pair with ad_group.id to identify one copy (writes take customers/<cid>/adGroupCriteria/<adGroupId>~<criterionId>)",
|
|
4397
4440
|
"ad_group_criterion.keyword.text": "The keyword text",
|
|
4398
4441
|
"ad_group_criterion.keyword.match_type": "EXACT, PHRASE, or BROAD",
|
|
4399
4442
|
"ad_group_criterion.status": "ENABLED, PAUSED, or REMOVED",
|
|
@@ -4698,55 +4741,55 @@ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
|
|
|
4698
4741
|
var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
|
|
4699
4742
|
|
|
4700
4743
|
// ../api/src/ads-google/ops.ts
|
|
4701
|
-
import { z as
|
|
4702
|
-
var tempRefSchema2 =
|
|
4703
|
-
var refSchema =
|
|
4704
|
-
|
|
4705
|
-
|
|
4744
|
+
import { z as z14 } from "zod";
|
|
4745
|
+
var tempRefSchema2 = z14.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
|
|
4746
|
+
var refSchema = z14.union([
|
|
4747
|
+
z14.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
|
|
4748
|
+
z14.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
|
|
4706
4749
|
tempRefSchema2
|
|
4707
4750
|
]);
|
|
4708
4751
|
var targetRefSchema = refSchema;
|
|
4709
|
-
var microsSchema =
|
|
4710
|
-
var httpsUrlSchema2 =
|
|
4711
|
-
var customerIdSchema =
|
|
4712
|
-
var stageableStatusSchema2 =
|
|
4713
|
-
var matchTypeSchema =
|
|
4714
|
-
var finalUrlSuffixSchema =
|
|
4752
|
+
var microsSchema = z14.number().int().positive("expected a positive micros amount");
|
|
4753
|
+
var httpsUrlSchema2 = z14.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
|
|
4754
|
+
var customerIdSchema = z14.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
|
|
4755
|
+
var stageableStatusSchema2 = z14.enum(STAGEABLE_CREATE_STATUSES2);
|
|
4756
|
+
var matchTypeSchema = z14.enum(KEYWORD_MATCH_TYPES);
|
|
4757
|
+
var finalUrlSuffixSchema = z14.string().max(GOOGLE_ADS_LIMITS.campaign.finalUrlSuffixMax).refine((s) => !/^[?&]/.test(s), "drop the leading ? or & \u2014 a final URL suffix is bare query parameters").refine((s) => !s.includes("{lpurl}"), "{lpurl} belongs in a tracking template, not in a final URL suffix").refine((s) => !/\s/.test(s), "a final URL suffix cannot contain whitespace").refine((s) => s === "" || s.includes("="), 'expected key=value pairs, e.g. "utm_source=google&utm_agency=baker"');
|
|
4715
4758
|
var LANDING_PAGE_TAGS = ["{lpurl}", "{unescapedlpurl}", "{escapedlpurl}", "{lpurl+2}", "{lpurl+3}"];
|
|
4716
|
-
var trackingUrlTemplateSchema =
|
|
4759
|
+
var trackingUrlTemplateSchema = z14.string().max(GOOGLE_ADS_LIMITS.campaign.trackingUrlTemplateMax).refine((t) => !/\s/.test(t), "a tracking template cannot contain whitespace").refine(
|
|
4717
4760
|
(t) => t === "" || LANDING_PAGE_TAGS.some((tag) => t.includes(tag)),
|
|
4718
4761
|
`a tracking template must carry the landing page through one of ${LANDING_PAGE_TAGS.join(", ")}, e.g. "https://tracker.example/?url={lpurl}"`
|
|
4719
4762
|
).refine(
|
|
4720
4763
|
(t) => t === "" || /^(https?:\/\/|\{)/.test(t),
|
|
4721
4764
|
"a tracking template must start with http://, https:// or a {lpurl} tag"
|
|
4722
4765
|
);
|
|
4723
|
-
var urlCustomParametersSchema =
|
|
4724
|
-
|
|
4725
|
-
key:
|
|
4726
|
-
value:
|
|
4766
|
+
var urlCustomParametersSchema = z14.array(
|
|
4767
|
+
z14.strictObject({
|
|
4768
|
+
key: z14.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.urlCustomParameterKeyMax).regex(/^[A-Za-z0-9_]+$/, "a custom parameter key is letters, digits and underscores only"),
|
|
4769
|
+
value: z14.string().max(GOOGLE_ADS_LIMITS.campaign.urlCustomParameterValueMax)
|
|
4727
4770
|
})
|
|
4728
4771
|
).max(GOOGLE_ADS_LIMITS.campaign.urlCustomParametersMax).refine(
|
|
4729
4772
|
(params) => new Set(params.map((p) => p.key)).size === params.length,
|
|
4730
4773
|
"each custom parameter key can appear only once"
|
|
4731
4774
|
);
|
|
4732
|
-
var keywordTextSchema =
|
|
4733
|
-
var budgetCreateSchema =
|
|
4734
|
-
name:
|
|
4775
|
+
var keywordTextSchema = z14.string().min(1).max(GOOGLE_ADS_LIMITS.keyword.textMax).refine((t) => t.trim().split(/\s+/).length <= GOOGLE_ADS_LIMITS.keyword.wordsMax, "keyword exceeds 10 words");
|
|
4776
|
+
var budgetCreateSchema = z14.object({
|
|
4777
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
|
|
4735
4778
|
amountMicros: microsSchema,
|
|
4736
|
-
deliveryMethod:
|
|
4737
|
-
explicitlyShared:
|
|
4779
|
+
deliveryMethod: z14.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
|
|
4780
|
+
explicitlyShared: z14.boolean().default(false)
|
|
4738
4781
|
});
|
|
4739
|
-
var budgetUpdateSchema =
|
|
4740
|
-
name:
|
|
4782
|
+
var budgetUpdateSchema = z14.object({
|
|
4783
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
|
|
4741
4784
|
amountMicros: microsSchema.optional(),
|
|
4742
|
-
deliveryMethod:
|
|
4785
|
+
deliveryMethod: z14.enum(BUDGET_DELIVERY_METHODS).optional()
|
|
4743
4786
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4744
|
-
var biddingConfigSchema =
|
|
4745
|
-
type:
|
|
4787
|
+
var biddingConfigSchema = z14.object({
|
|
4788
|
+
type: z14.enum(BIDDING_STRATEGY_TYPES),
|
|
4746
4789
|
targetCpaMicros: microsSchema.optional(),
|
|
4747
|
-
targetRoas:
|
|
4790
|
+
targetRoas: z14.number().positive().optional(),
|
|
4748
4791
|
cpcBidCeilingMicros: microsSchema.optional(),
|
|
4749
|
-
enhancedCpcEnabled:
|
|
4792
|
+
enhancedCpcEnabled: z14.boolean().optional()
|
|
4750
4793
|
}).superRefine((p, ctx) => {
|
|
4751
4794
|
if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
|
|
4752
4795
|
ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
|
|
@@ -4755,24 +4798,24 @@ var biddingConfigSchema = z13.object({
|
|
|
4755
4798
|
ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
|
|
4756
4799
|
}
|
|
4757
4800
|
});
|
|
4758
|
-
var networkSettingsSchema =
|
|
4759
|
-
targetGoogleSearch:
|
|
4760
|
-
targetSearchNetwork:
|
|
4761
|
-
targetContentNetwork:
|
|
4762
|
-
targetPartnerSearchNetwork:
|
|
4801
|
+
var networkSettingsSchema = z14.object({
|
|
4802
|
+
targetGoogleSearch: z14.boolean().optional(),
|
|
4803
|
+
targetSearchNetwork: z14.boolean().optional(),
|
|
4804
|
+
targetContentNetwork: z14.boolean().optional(),
|
|
4805
|
+
targetPartnerSearchNetwork: z14.boolean().optional()
|
|
4763
4806
|
});
|
|
4764
|
-
var dateSchema =
|
|
4765
|
-
var geoTargetTypeSettingSchema =
|
|
4766
|
-
positiveGeoTargetType:
|
|
4767
|
-
negativeGeoTargetType:
|
|
4807
|
+
var dateSchema = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
|
|
4808
|
+
var geoTargetTypeSettingSchema = z14.strictObject({
|
|
4809
|
+
positiveGeoTargetType: z14.enum(POSITIVE_GEO_TARGET_TYPES).optional(),
|
|
4810
|
+
negativeGeoTargetType: z14.enum(NEGATIVE_GEO_TARGET_TYPES).optional()
|
|
4768
4811
|
}).refine(
|
|
4769
4812
|
(p) => p.positiveGeoTargetType !== void 0 || p.negativeGeoTargetType !== void 0,
|
|
4770
4813
|
"geoTargetTypeSetting needs positiveGeoTargetType and/or negativeGeoTargetType"
|
|
4771
4814
|
);
|
|
4772
|
-
var campaignCreateSchema2 =
|
|
4773
|
-
name:
|
|
4774
|
-
channelType:
|
|
4775
|
-
channelSubType:
|
|
4815
|
+
var campaignCreateSchema2 = z14.strictObject({
|
|
4816
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
|
|
4817
|
+
channelType: z14.enum(ADVERTISING_CHANNEL_TYPES),
|
|
4818
|
+
channelSubType: z14.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
|
|
4776
4819
|
budget: refSchema,
|
|
4777
4820
|
/** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
|
|
4778
4821
|
bidding: biddingConfigSchema.optional(),
|
|
@@ -4792,12 +4835,12 @@ var campaignCreateSchema2 = z13.strictObject({
|
|
|
4792
4835
|
/** The `{_name}` parameters this campaign's tracking template and final URLs can reference. */
|
|
4793
4836
|
urlCustomParameters: urlCustomParametersSchema.optional(),
|
|
4794
4837
|
/** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
|
|
4795
|
-
objective:
|
|
4838
|
+
objective: z14.enum(CAMPAIGN_OBJECTIVES).optional(),
|
|
4796
4839
|
/**
|
|
4797
4840
|
* Whether the campaign contains EU political advertising. Google requires the declaration on
|
|
4798
4841
|
* every campaign create (FieldError.REQUIRED without it); omitted means it does not.
|
|
4799
4842
|
*/
|
|
4800
|
-
euPoliticalAds:
|
|
4843
|
+
euPoliticalAds: z14.boolean().optional(),
|
|
4801
4844
|
status: stageableStatusSchema2.default("PAUSED")
|
|
4802
4845
|
}).superRefine((p, ctx) => {
|
|
4803
4846
|
if (!p.bidding && !p.biddingStrategy) {
|
|
@@ -4821,8 +4864,8 @@ var campaignCreateSchema2 = z13.strictObject({
|
|
|
4821
4864
|
ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
|
|
4822
4865
|
}
|
|
4823
4866
|
});
|
|
4824
|
-
var campaignUpdateSchema2 =
|
|
4825
|
-
name:
|
|
4867
|
+
var campaignUpdateSchema2 = z14.strictObject({
|
|
4868
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
|
|
4826
4869
|
budget: refSchema.optional(),
|
|
4827
4870
|
bidding: biddingConfigSchema.optional(),
|
|
4828
4871
|
networkSettings: networkSettingsSchema.optional(),
|
|
@@ -4837,130 +4880,130 @@ var campaignUpdateSchema2 = z13.strictObject({
|
|
|
4837
4880
|
/** Replaces the campaign's custom parameters wholesale; `[]` removes them all. */
|
|
4838
4881
|
urlCustomParameters: urlCustomParametersSchema.optional(),
|
|
4839
4882
|
/** Corrects the campaign's EU political advertising declaration (true = contains, false = does not). */
|
|
4840
|
-
euPoliticalAds:
|
|
4841
|
-
status:
|
|
4883
|
+
euPoliticalAds: z14.boolean().optional(),
|
|
4884
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4842
4885
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4843
|
-
var adGroupCreateSchema =
|
|
4844
|
-
name:
|
|
4886
|
+
var adGroupCreateSchema = z14.object({
|
|
4887
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
|
|
4845
4888
|
campaign: refSchema,
|
|
4846
|
-
type:
|
|
4889
|
+
type: z14.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
|
|
4847
4890
|
cpcBidMicros: microsSchema.optional(),
|
|
4848
4891
|
status: stageableStatusSchema2.default("PAUSED")
|
|
4849
4892
|
});
|
|
4850
|
-
var adGroupUpdateSchema =
|
|
4851
|
-
name:
|
|
4893
|
+
var adGroupUpdateSchema = z14.object({
|
|
4894
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
|
|
4852
4895
|
cpcBidMicros: microsSchema.optional(),
|
|
4853
|
-
status:
|
|
4896
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4854
4897
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4855
|
-
var keywordAddSchema =
|
|
4898
|
+
var keywordAddSchema = z14.object({
|
|
4856
4899
|
adGroup: refSchema,
|
|
4857
4900
|
text: keywordTextSchema,
|
|
4858
4901
|
matchType: matchTypeSchema,
|
|
4859
4902
|
cpcBidMicros: microsSchema.optional(),
|
|
4860
|
-
finalUrls:
|
|
4903
|
+
finalUrls: z14.array(httpsUrlSchema2).optional(),
|
|
4861
4904
|
status: stageableStatusSchema2.default("ENABLED")
|
|
4862
4905
|
});
|
|
4863
|
-
var keywordUpdateSchema =
|
|
4906
|
+
var keywordUpdateSchema = z14.object({
|
|
4864
4907
|
cpcBidMicros: microsSchema.optional(),
|
|
4865
|
-
finalUrls:
|
|
4866
|
-
status:
|
|
4908
|
+
finalUrls: z14.array(httpsUrlSchema2).optional(),
|
|
4909
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4867
4910
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4868
|
-
var negativeKeywordAddSchema =
|
|
4869
|
-
level:
|
|
4911
|
+
var negativeKeywordAddSchema = z14.object({
|
|
4912
|
+
level: z14.enum(["adGroup", "campaign"]),
|
|
4870
4913
|
parent: refSchema,
|
|
4871
4914
|
text: keywordTextSchema,
|
|
4872
4915
|
matchType: matchTypeSchema
|
|
4873
4916
|
});
|
|
4874
|
-
var sharedSetCreateSchema =
|
|
4875
|
-
name:
|
|
4876
|
-
type:
|
|
4917
|
+
var sharedSetCreateSchema = z14.object({
|
|
4918
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
|
|
4919
|
+
type: z14.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
|
|
4877
4920
|
});
|
|
4878
|
-
var sharedSetMemberAddSchema =
|
|
4921
|
+
var sharedSetMemberAddSchema = z14.object({
|
|
4879
4922
|
sharedSet: refSchema,
|
|
4880
4923
|
text: keywordTextSchema,
|
|
4881
4924
|
matchType: matchTypeSchema
|
|
4882
4925
|
});
|
|
4883
|
-
var campaignSharedSetAttachSchema =
|
|
4926
|
+
var campaignSharedSetAttachSchema = z14.object({
|
|
4884
4927
|
campaign: refSchema,
|
|
4885
4928
|
sharedSet: refSchema
|
|
4886
4929
|
});
|
|
4887
|
-
var adTextAssetSchema =
|
|
4888
|
-
text:
|
|
4889
|
-
pinnedField:
|
|
4930
|
+
var adTextAssetSchema = z14.object({
|
|
4931
|
+
text: z14.string().min(1),
|
|
4932
|
+
pinnedField: z14.enum(PINNED_FIELDS).optional()
|
|
4890
4933
|
});
|
|
4891
|
-
var responsiveSearchAdSchema =
|
|
4892
|
-
format:
|
|
4893
|
-
headlines:
|
|
4934
|
+
var responsiveSearchAdSchema = z14.strictObject({
|
|
4935
|
+
format: z14.literal("responsiveSearch"),
|
|
4936
|
+
headlines: z14.array(
|
|
4894
4937
|
adTextAssetSchema.refine(
|
|
4895
4938
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
|
|
4896
4939
|
"headline exceeds 30 chars"
|
|
4897
4940
|
)
|
|
4898
4941
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
|
|
4899
|
-
descriptions:
|
|
4942
|
+
descriptions: z14.array(
|
|
4900
4943
|
adTextAssetSchema.refine(
|
|
4901
4944
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
|
|
4902
4945
|
"description exceeds 90 chars"
|
|
4903
4946
|
)
|
|
4904
4947
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
|
|
4905
|
-
path1:
|
|
4906
|
-
path2:
|
|
4907
|
-
finalUrls:
|
|
4908
|
-
});
|
|
4909
|
-
var responsiveDisplayAdSchema =
|
|
4910
|
-
format:
|
|
4911
|
-
headlines:
|
|
4912
|
-
longHeadline:
|
|
4913
|
-
descriptions:
|
|
4914
|
-
businessName:
|
|
4948
|
+
path1: z14.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4949
|
+
path2: z14.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4950
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4951
|
+
});
|
|
4952
|
+
var responsiveDisplayAdSchema = z14.strictObject({
|
|
4953
|
+
format: z14.literal("responsiveDisplay"),
|
|
4954
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
|
|
4955
|
+
longHeadline: z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
|
|
4956
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
|
|
4957
|
+
businessName: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
|
|
4915
4958
|
// A Responsive Display Ad's images are fields on the ad's own content (never campaign-level
|
|
4916
4959
|
// asset links). Google requires ≥1 landscape marketing image (1.91:1) AND ≥1 square marketing
|
|
4917
4960
|
// image (1:1) to serve; the logo images are optional.
|
|
4918
|
-
marketingImageAssets:
|
|
4919
|
-
squareMarketingImageAssets:
|
|
4920
|
-
logoImageAssets:
|
|
4921
|
-
finalUrls:
|
|
4922
|
-
});
|
|
4923
|
-
var callAdSchema =
|
|
4924
|
-
format:
|
|
4925
|
-
countryCode:
|
|
4926
|
-
phoneNumber:
|
|
4927
|
-
headline1:
|
|
4928
|
-
headline2:
|
|
4929
|
-
description1:
|
|
4930
|
-
description2:
|
|
4931
|
-
businessName:
|
|
4932
|
-
finalUrls:
|
|
4933
|
-
});
|
|
4934
|
-
var appAdSchema =
|
|
4935
|
-
format:
|
|
4936
|
-
headlines:
|
|
4937
|
-
descriptions:
|
|
4961
|
+
marketingImageAssets: z14.array(refSchema).optional(),
|
|
4962
|
+
squareMarketingImageAssets: z14.array(refSchema).optional(),
|
|
4963
|
+
logoImageAssets: z14.array(refSchema).optional(),
|
|
4964
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4965
|
+
});
|
|
4966
|
+
var callAdSchema = z14.strictObject({
|
|
4967
|
+
format: z14.literal("call"),
|
|
4968
|
+
countryCode: z14.string().length(2),
|
|
4969
|
+
phoneNumber: z14.string().min(3),
|
|
4970
|
+
headline1: z14.string().min(1).max(30),
|
|
4971
|
+
headline2: z14.string().min(1).max(30),
|
|
4972
|
+
description1: z14.string().min(1).max(90),
|
|
4973
|
+
description2: z14.string().min(1).max(90),
|
|
4974
|
+
businessName: z14.string().min(1).max(25),
|
|
4975
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4976
|
+
});
|
|
4977
|
+
var appAdSchema = z14.strictObject({
|
|
4978
|
+
format: z14.literal("app"),
|
|
4979
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.appAd.headlineTextMax) })).min(GOOGLE_ADS_LIMITS.appAd.headlinesMin).max(GOOGLE_ADS_LIMITS.appAd.headlinesMax),
|
|
4980
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.appAd.descriptionTextMax) })).min(GOOGLE_ADS_LIMITS.appAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.appAd.descriptionsMax),
|
|
4938
4981
|
// An App campaign ad carries its images on its own content (`AppAdInfo.images`), not as
|
|
4939
4982
|
// campaign-level asset links — same shape as a responsive display ad's marketing images.
|
|
4940
|
-
images:
|
|
4983
|
+
images: z14.array(refSchema).max(GOOGLE_ADS_LIMITS.appAd.imagesMax).optional(),
|
|
4941
4984
|
// `AppAdInfo.youtube_videos` — an App ad's videos live on its content too. Without this field
|
|
4942
4985
|
// there is no way to express "keep these videos on the ad", so a content update that only
|
|
4943
4986
|
// restated headlines silently left the ad's videos to whatever the mask happened to omit.
|
|
4944
|
-
youtubeVideos:
|
|
4987
|
+
youtubeVideos: z14.array(refSchema).max(GOOGLE_ADS_LIMITS.appAd.youtubeVideosMax).optional()
|
|
4945
4988
|
});
|
|
4946
|
-
var videoAdSchema =
|
|
4947
|
-
format:
|
|
4989
|
+
var videoAdSchema = z14.strictObject({
|
|
4990
|
+
format: z14.literal("video"),
|
|
4948
4991
|
// A raw YouTube id is not a publishable Google Ads reference — the video must be staged as
|
|
4949
4992
|
// its own `google.asset.create` (type: youtubeVideo) first, then referenced here by asset ref.
|
|
4950
|
-
videoAssets:
|
|
4951
|
-
finalUrls:
|
|
4952
|
-
});
|
|
4953
|
-
var demandGenAdSchema =
|
|
4954
|
-
format:
|
|
4955
|
-
headlines:
|
|
4956
|
-
descriptions:
|
|
4957
|
-
businessName:
|
|
4958
|
-
finalUrls:
|
|
4959
|
-
imageAssets:
|
|
4960
|
-
squareImageAssets:
|
|
4961
|
-
logoImageAssets:
|
|
4962
|
-
});
|
|
4963
|
-
var adContentSchema2 =
|
|
4993
|
+
videoAssets: z14.array(refSchema).min(1),
|
|
4994
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4995
|
+
});
|
|
4996
|
+
var demandGenAdSchema = z14.strictObject({
|
|
4997
|
+
format: z14.literal("demandGen"),
|
|
4998
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(40) })).min(1).max(5),
|
|
4999
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(90) })).min(1).max(5),
|
|
5000
|
+
businessName: z14.string().min(1).max(25),
|
|
5001
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1),
|
|
5002
|
+
imageAssets: z14.array(refSchema).optional(),
|
|
5003
|
+
squareImageAssets: z14.array(refSchema).optional(),
|
|
5004
|
+
logoImageAssets: z14.array(refSchema).optional()
|
|
5005
|
+
});
|
|
5006
|
+
var adContentSchema2 = z14.discriminatedUnion("format", [
|
|
4964
5007
|
responsiveSearchAdSchema,
|
|
4965
5008
|
responsiveDisplayAdSchema,
|
|
4966
5009
|
callAdSchema,
|
|
@@ -4968,45 +5011,45 @@ var adContentSchema2 = z13.discriminatedUnion("format", [
|
|
|
4968
5011
|
videoAdSchema,
|
|
4969
5012
|
demandGenAdSchema
|
|
4970
5013
|
]);
|
|
4971
|
-
var adCreateSchema =
|
|
5014
|
+
var adCreateSchema = z14.object({
|
|
4972
5015
|
adGroup: refSchema,
|
|
4973
5016
|
status: stageableStatusSchema2.default("PAUSED"),
|
|
4974
5017
|
content: adContentSchema2
|
|
4975
5018
|
});
|
|
4976
|
-
var adUpdateSchema =
|
|
4977
|
-
status:
|
|
5019
|
+
var adUpdateSchema = z14.object({
|
|
5020
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
|
|
4978
5021
|
/** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
|
|
4979
|
-
content:
|
|
5022
|
+
content: z14.record(z14.string(), z14.unknown()).optional()
|
|
4980
5023
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4981
|
-
var textAssetSchema =
|
|
4982
|
-
var imageAssetSchema =
|
|
4983
|
-
type:
|
|
4984
|
-
imageId:
|
|
4985
|
-
name:
|
|
4986
|
-
});
|
|
4987
|
-
var youtubeVideoAssetSchema =
|
|
4988
|
-
type:
|
|
4989
|
-
youtubeVideoId:
|
|
4990
|
-
name:
|
|
4991
|
-
});
|
|
4992
|
-
var sitelinkAssetSchema =
|
|
4993
|
-
type:
|
|
4994
|
-
linkText:
|
|
4995
|
-
description1:
|
|
4996
|
-
description2:
|
|
4997
|
-
finalUrls:
|
|
4998
|
-
});
|
|
4999
|
-
var calloutAssetSchema =
|
|
5000
|
-
type:
|
|
5001
|
-
calloutText:
|
|
5002
|
-
});
|
|
5003
|
-
var structuredSnippetAssetSchema =
|
|
5004
|
-
type:
|
|
5005
|
-
header:
|
|
5006
|
-
values:
|
|
5007
|
-
});
|
|
5008
|
-
var callToActionAssetSchema =
|
|
5009
|
-
var assetCreateSchema =
|
|
5024
|
+
var textAssetSchema = z14.object({ type: z14.literal("text"), text: z14.string().min(1) });
|
|
5025
|
+
var imageAssetSchema = z14.object({
|
|
5026
|
+
type: z14.literal("image"),
|
|
5027
|
+
imageId: z14.string().min(1),
|
|
5028
|
+
name: z14.string().optional()
|
|
5029
|
+
});
|
|
5030
|
+
var youtubeVideoAssetSchema = z14.object({
|
|
5031
|
+
type: z14.literal("youtubeVideo"),
|
|
5032
|
+
youtubeVideoId: z14.string().min(1),
|
|
5033
|
+
name: z14.string().optional()
|
|
5034
|
+
});
|
|
5035
|
+
var sitelinkAssetSchema = z14.object({
|
|
5036
|
+
type: z14.literal("sitelink"),
|
|
5037
|
+
linkText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
|
|
5038
|
+
description1: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5039
|
+
description2: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5040
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
5041
|
+
});
|
|
5042
|
+
var calloutAssetSchema = z14.object({
|
|
5043
|
+
type: z14.literal("callout"),
|
|
5044
|
+
calloutText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
|
|
5045
|
+
});
|
|
5046
|
+
var structuredSnippetAssetSchema = z14.object({
|
|
5047
|
+
type: z14.literal("structuredSnippet"),
|
|
5048
|
+
header: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
|
|
5049
|
+
values: z14.array(z14.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
|
|
5050
|
+
});
|
|
5051
|
+
var callToActionAssetSchema = z14.object({ type: z14.literal("callToAction"), callToAction: z14.string().min(1) });
|
|
5052
|
+
var assetCreateSchema = z14.discriminatedUnion("type", [
|
|
5010
5053
|
textAssetSchema,
|
|
5011
5054
|
imageAssetSchema,
|
|
5012
5055
|
youtubeVideoAssetSchema,
|
|
@@ -5015,136 +5058,136 @@ var assetCreateSchema = z13.discriminatedUnion("type", [
|
|
|
5015
5058
|
structuredSnippetAssetSchema,
|
|
5016
5059
|
callToActionAssetSchema
|
|
5017
5060
|
]);
|
|
5018
|
-
var assetUpdateSchema =
|
|
5019
|
-
name:
|
|
5020
|
-
linkText:
|
|
5021
|
-
description1:
|
|
5022
|
-
description2:
|
|
5023
|
-
finalUrls:
|
|
5024
|
-
calloutText:
|
|
5025
|
-
header:
|
|
5026
|
-
values:
|
|
5027
|
-
callToAction:
|
|
5028
|
-
text:
|
|
5061
|
+
var assetUpdateSchema = z14.object({
|
|
5062
|
+
name: z14.string().min(1).optional(),
|
|
5063
|
+
linkText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax).optional(),
|
|
5064
|
+
description1: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5065
|
+
description2: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5066
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1).optional(),
|
|
5067
|
+
calloutText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax).optional(),
|
|
5068
|
+
header: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax).optional(),
|
|
5069
|
+
values: z14.array(z14.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
|
|
5070
|
+
callToAction: z14.string().min(1).optional(),
|
|
5071
|
+
text: z14.string().min(1).optional()
|
|
5029
5072
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5030
|
-
var assetLinkAttachSchema =
|
|
5031
|
-
level:
|
|
5073
|
+
var assetLinkAttachSchema = z14.object({
|
|
5074
|
+
level: z14.enum(["campaign", "adGroup", "customer"]),
|
|
5032
5075
|
parent: refSchema.optional(),
|
|
5033
5076
|
asset: refSchema,
|
|
5034
|
-
fieldType:
|
|
5077
|
+
fieldType: z14.enum(ASSET_FIELD_TYPES)
|
|
5035
5078
|
}).superRefine((value, ctx) => {
|
|
5036
5079
|
if (value.level !== "customer" && !value.parent) {
|
|
5037
5080
|
ctx.addIssue({
|
|
5038
|
-
code:
|
|
5081
|
+
code: z14.ZodIssueCode.custom,
|
|
5039
5082
|
path: ["parent"],
|
|
5040
5083
|
message: `parent is required for a ${value.level}-level asset link (--parent-ref)`
|
|
5041
5084
|
});
|
|
5042
5085
|
}
|
|
5043
5086
|
});
|
|
5044
|
-
var assetGroupCreateSchema =
|
|
5087
|
+
var assetGroupCreateSchema = z14.object({
|
|
5045
5088
|
campaign: refSchema,
|
|
5046
|
-
name:
|
|
5047
|
-
finalUrls:
|
|
5048
|
-
headlines:
|
|
5049
|
-
longHeadlines:
|
|
5050
|
-
descriptions:
|
|
5051
|
-
businessName:
|
|
5052
|
-
imageAssets:
|
|
5053
|
-
squareImageAssets:
|
|
5054
|
-
logoAssets:
|
|
5055
|
-
status:
|
|
5056
|
-
});
|
|
5057
|
-
var assetGroupUpdateSchema =
|
|
5058
|
-
name:
|
|
5059
|
-
finalUrls:
|
|
5060
|
-
status:
|
|
5089
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax),
|
|
5090
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1),
|
|
5091
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.headlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.headlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.headlinesMax),
|
|
5092
|
+
longHeadlines: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMax),
|
|
5093
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMin).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMax),
|
|
5094
|
+
businessName: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.businessNameMax),
|
|
5095
|
+
imageAssets: z14.array(refSchema).optional(),
|
|
5096
|
+
squareImageAssets: z14.array(refSchema).optional(),
|
|
5097
|
+
logoAssets: z14.array(refSchema).optional(),
|
|
5098
|
+
status: z14.enum(["ENABLED", "PAUSED"]).default("PAUSED")
|
|
5099
|
+
});
|
|
5100
|
+
var assetGroupUpdateSchema = z14.object({
|
|
5101
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax).optional(),
|
|
5102
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1).optional(),
|
|
5103
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
5061
5104
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5062
|
-
var audienceCreateSchema2 =
|
|
5063
|
-
name:
|
|
5064
|
-
type:
|
|
5065
|
-
description:
|
|
5105
|
+
var audienceCreateSchema2 = z14.object({
|
|
5106
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
|
|
5107
|
+
type: z14.enum(USER_LIST_TYPES).default("BASIC"),
|
|
5108
|
+
description: z14.string().optional(),
|
|
5066
5109
|
/** Customer-match members (crm-based) — file-first for large lists. */
|
|
5067
|
-
members:
|
|
5068
|
-
sourceFileRef:
|
|
5110
|
+
members: z14.array(z14.record(z14.string(), z14.string())).optional(),
|
|
5111
|
+
sourceFileRef: z14.string().optional()
|
|
5069
5112
|
});
|
|
5070
|
-
var audienceCriterionAttachSchema =
|
|
5071
|
-
level:
|
|
5113
|
+
var audienceCriterionAttachSchema = z14.object({
|
|
5114
|
+
level: z14.enum(["campaign", "adGroup"]),
|
|
5072
5115
|
parent: refSchema,
|
|
5073
5116
|
userList: refSchema,
|
|
5074
|
-
negative:
|
|
5117
|
+
negative: z14.boolean().default(false)
|
|
5075
5118
|
});
|
|
5076
|
-
var conversionActionCreateSchema =
|
|
5077
|
-
name:
|
|
5078
|
-
type:
|
|
5079
|
-
category:
|
|
5080
|
-
countingType:
|
|
5119
|
+
var conversionActionCreateSchema = z14.object({
|
|
5120
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
|
|
5121
|
+
type: z14.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
|
|
5122
|
+
category: z14.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
|
|
5123
|
+
countingType: z14.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
|
|
5081
5124
|
defaultValueMicros: microsSchema.optional(),
|
|
5082
|
-
defaultCurrencyCode:
|
|
5083
|
-
clickThroughLookbackWindowDays:
|
|
5084
|
-
viewThroughLookbackWindowDays:
|
|
5085
|
-
status:
|
|
5086
|
-
});
|
|
5087
|
-
var conversionActionUpdateSchema =
|
|
5088
|
-
name:
|
|
5089
|
-
category:
|
|
5090
|
-
countingType:
|
|
5125
|
+
defaultCurrencyCode: z14.string().length(3).optional(),
|
|
5126
|
+
clickThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5127
|
+
viewThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5128
|
+
status: z14.enum(["ENABLED", "PAUSED"]).default("ENABLED")
|
|
5129
|
+
});
|
|
5130
|
+
var conversionActionUpdateSchema = z14.object({
|
|
5131
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
|
|
5132
|
+
category: z14.enum(CONVERSION_ACTION_CATEGORIES).optional(),
|
|
5133
|
+
countingType: z14.enum(CONVERSION_COUNTING_TYPES).optional(),
|
|
5091
5134
|
defaultValueMicros: microsSchema.optional(),
|
|
5092
|
-
defaultCurrencyCode:
|
|
5093
|
-
clickThroughLookbackWindowDays:
|
|
5094
|
-
viewThroughLookbackWindowDays:
|
|
5095
|
-
status:
|
|
5135
|
+
defaultCurrencyCode: z14.string().length(3).optional(),
|
|
5136
|
+
clickThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5137
|
+
viewThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5138
|
+
status: z14.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
|
|
5096
5139
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5097
|
-
var biddingStrategyCreateSchema =
|
|
5098
|
-
name:
|
|
5140
|
+
var biddingStrategyCreateSchema = z14.object({
|
|
5141
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
|
|
5099
5142
|
config: biddingConfigSchema
|
|
5100
5143
|
}).superRefine((p, ctx) => {
|
|
5101
5144
|
if (p.config.type === "MANUAL_CPC") {
|
|
5102
5145
|
ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
|
|
5103
5146
|
}
|
|
5104
5147
|
});
|
|
5105
|
-
var biddingStrategyUpdateSchema =
|
|
5106
|
-
name:
|
|
5148
|
+
var biddingStrategyUpdateSchema = z14.object({
|
|
5149
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
|
|
5107
5150
|
config: biddingConfigSchema.optional()
|
|
5108
5151
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5109
|
-
var labelCreateSchema =
|
|
5110
|
-
name:
|
|
5111
|
-
backgroundColor:
|
|
5112
|
-
description:
|
|
5152
|
+
var labelCreateSchema = z14.object({
|
|
5153
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
|
|
5154
|
+
backgroundColor: z14.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
|
|
5155
|
+
description: z14.string().optional()
|
|
5113
5156
|
});
|
|
5114
|
-
var labelAttachSchema =
|
|
5115
|
-
level:
|
|
5157
|
+
var labelAttachSchema = z14.object({
|
|
5158
|
+
level: z14.enum(["campaign", "adGroup", "ad"]),
|
|
5116
5159
|
parent: refSchema,
|
|
5117
5160
|
label: refSchema
|
|
5118
5161
|
});
|
|
5119
|
-
var locationCriterionSchema =
|
|
5120
|
-
criterionType:
|
|
5121
|
-
geoTargetConstant:
|
|
5122
|
-
});
|
|
5123
|
-
var languageCriterionSchema =
|
|
5124
|
-
criterionType:
|
|
5125
|
-
languageConstant:
|
|
5126
|
-
});
|
|
5127
|
-
var adScheduleCriterionSchema =
|
|
5128
|
-
criterionType:
|
|
5129
|
-
dayOfWeek:
|
|
5130
|
-
startHour:
|
|
5131
|
-
startMinute:
|
|
5132
|
-
endHour:
|
|
5133
|
-
endMinute:
|
|
5134
|
-
});
|
|
5135
|
-
var deviceCriterionSchema =
|
|
5136
|
-
criterionType:
|
|
5137
|
-
device:
|
|
5162
|
+
var locationCriterionSchema = z14.object({
|
|
5163
|
+
criterionType: z14.literal("location"),
|
|
5164
|
+
geoTargetConstant: z14.union([z14.string().regex(GEO_TARGET_CONSTANT_REGEX), z14.string().regex(NUMERIC_ID_REGEX2)])
|
|
5165
|
+
});
|
|
5166
|
+
var languageCriterionSchema = z14.object({
|
|
5167
|
+
criterionType: z14.literal("language"),
|
|
5168
|
+
languageConstant: z14.union([z14.string().regex(LANGUAGE_CONSTANT_REGEX), z14.string().regex(NUMERIC_ID_REGEX2)])
|
|
5169
|
+
});
|
|
5170
|
+
var adScheduleCriterionSchema = z14.object({
|
|
5171
|
+
criterionType: z14.literal("adSchedule"),
|
|
5172
|
+
dayOfWeek: z14.enum(DAYS_OF_WEEK),
|
|
5173
|
+
startHour: z14.number().int().min(0).max(23),
|
|
5174
|
+
startMinute: z14.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
|
|
5175
|
+
endHour: z14.number().int().min(0).max(24),
|
|
5176
|
+
endMinute: z14.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
|
|
5177
|
+
});
|
|
5178
|
+
var deviceCriterionSchema = z14.object({
|
|
5179
|
+
criterionType: z14.literal("device"),
|
|
5180
|
+
device: z14.enum(DEVICE_TYPES),
|
|
5138
5181
|
// Google's `CampaignCriterion.bid_modifier`: "The modifier must be in the range 0.1 - 10.0. Use 0
|
|
5139
5182
|
// to opt out of a Device type." So 0 (exclude the device) and 0.1–10.0 are valid; the (0, 0.1) gap is not.
|
|
5140
|
-
bidModifier:
|
|
5183
|
+
bidModifier: z14.number().min(0).max(10).optional().refine((v) => v === void 0 || v === 0 || v >= 0.1, {
|
|
5141
5184
|
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
5142
5185
|
})
|
|
5143
5186
|
});
|
|
5144
|
-
var campaignCriterionAddSchema =
|
|
5187
|
+
var campaignCriterionAddSchema = z14.object({
|
|
5145
5188
|
campaign: refSchema,
|
|
5146
|
-
negative:
|
|
5147
|
-
criterion:
|
|
5189
|
+
negative: z14.boolean().default(false),
|
|
5190
|
+
criterion: z14.discriminatedUnion("criterionType", [
|
|
5148
5191
|
locationCriterionSchema,
|
|
5149
5192
|
languageCriterionSchema,
|
|
5150
5193
|
adScheduleCriterionSchema,
|
|
@@ -5154,7 +5197,7 @@ var campaignCriterionAddSchema = z13.object({
|
|
|
5154
5197
|
const c = val.criterion;
|
|
5155
5198
|
if (c.criterionType === "adSchedule" && c.endHour === 24 && c.endMinute !== "ZERO") {
|
|
5156
5199
|
ctx.addIssue({
|
|
5157
|
-
code:
|
|
5200
|
+
code: z14.ZodIssueCode.custom,
|
|
5158
5201
|
message: "endHour 24 (midnight) cannot have a non-zero endMinute",
|
|
5159
5202
|
path: ["criterion", "endMinute"]
|
|
5160
5203
|
});
|
|
@@ -5206,17 +5249,17 @@ var GOOGLE_DRAFT_OP_KINDS = [
|
|
|
5206
5249
|
"google.campaignCriterion.add",
|
|
5207
5250
|
"google.campaignCriterion.remove"
|
|
5208
5251
|
];
|
|
5209
|
-
var googleDraftOpKindSchema =
|
|
5252
|
+
var googleDraftOpKindSchema = z14.enum(GOOGLE_DRAFT_OP_KINDS);
|
|
5210
5253
|
function createOp2(kind, payload) {
|
|
5211
|
-
return
|
|
5254
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, payload });
|
|
5212
5255
|
}
|
|
5213
5256
|
function updateOp2(kind, payload) {
|
|
5214
|
-
return
|
|
5257
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
|
|
5215
5258
|
}
|
|
5216
5259
|
function targetOp(kind) {
|
|
5217
|
-
return
|
|
5260
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
|
|
5218
5261
|
}
|
|
5219
|
-
var googleDraftOpInputSchema =
|
|
5262
|
+
var googleDraftOpInputSchema = z14.discriminatedUnion("kind", [
|
|
5220
5263
|
createOp2("google.budget.create", budgetCreateSchema),
|
|
5221
5264
|
updateOp2("google.budget.update", budgetUpdateSchema),
|
|
5222
5265
|
createOp2("google.campaign.create", campaignCreateSchema2),
|
|
@@ -5264,48 +5307,48 @@ var googleDraftOpInputSchema = z13.discriminatedUnion("kind", [
|
|
|
5264
5307
|
]);
|
|
5265
5308
|
|
|
5266
5309
|
// ../api/src/ads-google/url-options.ts
|
|
5267
|
-
import { z as
|
|
5310
|
+
import { z as z15 } from "zod";
|
|
5268
5311
|
var URL_OPTION_LEVELS = ["account", "campaign", "ad_group", "ad"];
|
|
5269
|
-
var googleUrlOptionValueSchema =
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5312
|
+
var googleUrlOptionValueSchema = z15.discriminatedUnion("state", [
|
|
5313
|
+
z15.object({ state: z15.literal("set"), value: z15.string() }),
|
|
5314
|
+
z15.object({ state: z15.literal("not_set") }),
|
|
5315
|
+
z15.object({ state: z15.literal("not_read"), reason: z15.string() })
|
|
5273
5316
|
]);
|
|
5274
|
-
var googleUrlOptionsRequestSchema =
|
|
5275
|
-
customerId:
|
|
5276
|
-
managerId:
|
|
5317
|
+
var googleUrlOptionsRequestSchema = z15.object({
|
|
5318
|
+
customerId: z15.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id"),
|
|
5319
|
+
managerId: z15.string().optional(),
|
|
5277
5320
|
/** Compact by default: only campaigns that actually override the account. `full` lists every campaign. */
|
|
5278
|
-
full:
|
|
5279
|
-
skipCache:
|
|
5321
|
+
full: z15.boolean().optional(),
|
|
5322
|
+
skipCache: z15.boolean().optional()
|
|
5280
5323
|
});
|
|
5281
|
-
var googleUrlOptionsCampaignSchema =
|
|
5282
|
-
id:
|
|
5283
|
-
name:
|
|
5284
|
-
status:
|
|
5324
|
+
var googleUrlOptionsCampaignSchema = z15.object({
|
|
5325
|
+
id: z15.string(),
|
|
5326
|
+
name: z15.string(),
|
|
5327
|
+
status: z15.string(),
|
|
5285
5328
|
final_url_suffix: googleUrlOptionValueSchema,
|
|
5286
5329
|
tracking_url_template: googleUrlOptionValueSchema
|
|
5287
5330
|
});
|
|
5288
|
-
var googleUrlOptionsResponseSchema =
|
|
5289
|
-
customer_id:
|
|
5290
|
-
account:
|
|
5291
|
-
level:
|
|
5292
|
-
read:
|
|
5331
|
+
var googleUrlOptionsResponseSchema = z15.object({
|
|
5332
|
+
customer_id: z15.string(),
|
|
5333
|
+
account: z15.object({
|
|
5334
|
+
level: z15.literal("account"),
|
|
5335
|
+
read: z15.boolean(),
|
|
5293
5336
|
final_url_suffix: googleUrlOptionValueSchema,
|
|
5294
5337
|
tracking_url_template: googleUrlOptionValueSchema
|
|
5295
5338
|
}),
|
|
5296
|
-
campaigns:
|
|
5297
|
-
level:
|
|
5298
|
-
read:
|
|
5339
|
+
campaigns: z15.object({
|
|
5340
|
+
level: z15.literal("campaign"),
|
|
5341
|
+
read: z15.boolean(),
|
|
5299
5342
|
/** Campaigns actually observed. 0 with `read: true` means the account has no non-removed campaigns. */
|
|
5300
|
-
campaigns_read:
|
|
5343
|
+
campaigns_read: z15.number().int().nonnegative(),
|
|
5301
5344
|
/** Campaigns observed to carry no override of their own — an explicit finding, not an omission. */
|
|
5302
|
-
campaigns_without_override:
|
|
5303
|
-
overrides:
|
|
5345
|
+
campaigns_without_override: z15.number().int().nonnegative(),
|
|
5346
|
+
overrides: z15.array(googleUrlOptionsCampaignSchema),
|
|
5304
5347
|
/** Compact mode only: campaigns read but not listed because they carry no override. */
|
|
5305
|
-
omitted:
|
|
5348
|
+
omitted: z15.number().int().nonnegative()
|
|
5306
5349
|
}),
|
|
5307
5350
|
/** Levels this command never queried. Nothing here may be reported as "not configured". */
|
|
5308
|
-
levels_not_read:
|
|
5351
|
+
levels_not_read: z15.array(z15.object({ level: z15.enum(URL_OPTION_LEVELS), reason: z15.string() }))
|
|
5309
5352
|
});
|
|
5310
5353
|
var ACCOUNT_URL_OPTIONS_LOCATION = "Google Ads UI \u2192 Admin \u2192 Account settings \u2192 Tracking (account-level tracking template and final URL suffix)";
|
|
5311
5354
|
var ACCOUNT_URL_OPTIONS_NOT_STAGEABLE = "Account-level URL options are written by a different Google service than the one Baker's staged changes apply through, so they can't be staged or published from here.";
|
|
@@ -5350,143 +5393,143 @@ function urlOptionsHints(report) {
|
|
|
5350
5393
|
}
|
|
5351
5394
|
|
|
5352
5395
|
// ../api/src/ads-google/wire.ts
|
|
5353
|
-
import { z as
|
|
5354
|
-
var googleWriteModeSchema =
|
|
5355
|
-
var googleDraftOpResultSchema =
|
|
5356
|
-
status:
|
|
5357
|
-
resourceName:
|
|
5358
|
-
error:
|
|
5359
|
-
skippedBecause:
|
|
5360
|
-
executedAt:
|
|
5361
|
-
});
|
|
5362
|
-
var googleDraftStageRequestSchema =
|
|
5363
|
-
chatId:
|
|
5396
|
+
import { z as z16 } from "zod";
|
|
5397
|
+
var googleWriteModeSchema = z16.enum(["live", "simulated"]);
|
|
5398
|
+
var googleDraftOpResultSchema = z16.object({
|
|
5399
|
+
status: z16.enum(["applied", "simulated", "failed", "skipped"]),
|
|
5400
|
+
resourceName: z16.string().optional(),
|
|
5401
|
+
error: z16.string().optional(),
|
|
5402
|
+
skippedBecause: z16.string().optional(),
|
|
5403
|
+
executedAt: z16.number().optional()
|
|
5404
|
+
});
|
|
5405
|
+
var googleDraftStageRequestSchema = z16.object({
|
|
5406
|
+
chatId: z16.string(),
|
|
5364
5407
|
op: googleDraftOpInputSchema
|
|
5365
5408
|
});
|
|
5366
|
-
var googleDraftStageResponseSchema =
|
|
5367
|
-
|
|
5368
|
-
staged:
|
|
5369
|
-
ref:
|
|
5409
|
+
var googleDraftStageResponseSchema = z16.discriminatedUnion("staged", [
|
|
5410
|
+
z16.object({
|
|
5411
|
+
staged: z16.literal(true),
|
|
5412
|
+
ref: z16.string(),
|
|
5370
5413
|
kind: googleDraftOpKindSchema,
|
|
5371
5414
|
mode: googleWriteModeSchema,
|
|
5372
|
-
dependsOn:
|
|
5373
|
-
summary:
|
|
5374
|
-
warnings:
|
|
5415
|
+
dependsOn: z16.array(z16.string()),
|
|
5416
|
+
summary: z16.string(),
|
|
5417
|
+
warnings: z16.array(z16.string()),
|
|
5375
5418
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
5376
|
-
amended:
|
|
5419
|
+
amended: z16.boolean().optional()
|
|
5377
5420
|
}),
|
|
5378
|
-
|
|
5379
|
-
staged:
|
|
5380
|
-
noop:
|
|
5421
|
+
z16.object({
|
|
5422
|
+
staged: z16.literal(false),
|
|
5423
|
+
noop: z16.literal(true),
|
|
5381
5424
|
kind: googleDraftOpKindSchema,
|
|
5382
5425
|
mode: googleWriteModeSchema,
|
|
5383
|
-
summary:
|
|
5384
|
-
reason:
|
|
5426
|
+
summary: z16.string(),
|
|
5427
|
+
reason: z16.string()
|
|
5385
5428
|
})
|
|
5386
5429
|
]);
|
|
5387
|
-
var googleDraftAmendRequestSchema =
|
|
5388
|
-
chatId:
|
|
5389
|
-
ref:
|
|
5390
|
-
patch:
|
|
5430
|
+
var googleDraftAmendRequestSchema = z16.object({
|
|
5431
|
+
chatId: z16.string(),
|
|
5432
|
+
ref: z16.string(),
|
|
5433
|
+
patch: z16.record(z16.string(), z16.unknown())
|
|
5391
5434
|
});
|
|
5392
|
-
var googleDraftShowRequestSchema =
|
|
5393
|
-
chatId:
|
|
5394
|
-
ref:
|
|
5435
|
+
var googleDraftShowRequestSchema = z16.object({
|
|
5436
|
+
chatId: z16.string(),
|
|
5437
|
+
ref: z16.string()
|
|
5395
5438
|
});
|
|
5396
5439
|
var GOOGLE_DRAFT_BATCH_MAX = 500;
|
|
5397
|
-
var googleDraftStageBatchRequestSchema =
|
|
5398
|
-
chatId:
|
|
5399
|
-
ops:
|
|
5440
|
+
var googleDraftStageBatchRequestSchema = z16.object({
|
|
5441
|
+
chatId: z16.string(),
|
|
5442
|
+
ops: z16.array(googleDraftOpInputSchema).min(1).max(GOOGLE_DRAFT_BATCH_MAX)
|
|
5400
5443
|
});
|
|
5401
|
-
var googleDraftStageBatchResponseSchema =
|
|
5402
|
-
staged:
|
|
5444
|
+
var googleDraftStageBatchResponseSchema = z16.object({
|
|
5445
|
+
staged: z16.literal(true),
|
|
5403
5446
|
mode: googleWriteModeSchema,
|
|
5404
|
-
count:
|
|
5405
|
-
ops:
|
|
5406
|
-
|
|
5407
|
-
ref:
|
|
5447
|
+
count: z16.number(),
|
|
5448
|
+
ops: z16.array(
|
|
5449
|
+
z16.object({
|
|
5450
|
+
ref: z16.string(),
|
|
5408
5451
|
kind: googleDraftOpKindSchema,
|
|
5409
|
-
dependsOn:
|
|
5410
|
-
summary:
|
|
5411
|
-
warnings:
|
|
5452
|
+
dependsOn: z16.array(z16.string()),
|
|
5453
|
+
summary: z16.string(),
|
|
5454
|
+
warnings: z16.array(z16.string())
|
|
5412
5455
|
})
|
|
5413
5456
|
),
|
|
5414
|
-
skipped:
|
|
5457
|
+
skipped: z16.array(z16.object({ kind: googleDraftOpKindSchema, summary: z16.string(), reason: z16.string() })).optional()
|
|
5415
5458
|
});
|
|
5416
|
-
var googleDraftOpViewSchema =
|
|
5417
|
-
ref:
|
|
5459
|
+
var googleDraftOpViewSchema = z16.object({
|
|
5460
|
+
ref: z16.string(),
|
|
5418
5461
|
kind: googleDraftOpKindSchema,
|
|
5419
|
-
customerId:
|
|
5420
|
-
target:
|
|
5421
|
-
dependsOn:
|
|
5422
|
-
summary:
|
|
5423
|
-
stagedAt:
|
|
5462
|
+
customerId: z16.string(),
|
|
5463
|
+
target: z16.string().optional(),
|
|
5464
|
+
dependsOn: z16.array(z16.string()),
|
|
5465
|
+
summary: z16.string(),
|
|
5466
|
+
stagedAt: z16.number(),
|
|
5424
5467
|
result: googleDraftOpResultSchema.optional()
|
|
5425
5468
|
});
|
|
5426
|
-
var googleDraftShowResponseSchema =
|
|
5469
|
+
var googleDraftShowResponseSchema = z16.object({
|
|
5427
5470
|
op: googleDraftOpViewSchema.extend({
|
|
5428
|
-
payload:
|
|
5429
|
-
warnings:
|
|
5430
|
-
annotations:
|
|
5471
|
+
payload: z16.unknown().optional(),
|
|
5472
|
+
warnings: z16.array(z16.string()).optional(),
|
|
5473
|
+
annotations: z16.unknown().optional()
|
|
5431
5474
|
})
|
|
5432
5475
|
});
|
|
5433
|
-
var googleDraftListRequestSchema =
|
|
5434
|
-
chatId:
|
|
5476
|
+
var googleDraftListRequestSchema = z16.object({
|
|
5477
|
+
chatId: z16.string()
|
|
5435
5478
|
});
|
|
5436
|
-
var googleDraftAdvisorySchema =
|
|
5437
|
-
scope:
|
|
5438
|
-
message:
|
|
5479
|
+
var googleDraftAdvisorySchema = z16.object({
|
|
5480
|
+
scope: z16.enum(["campaign", "adGroup"]),
|
|
5481
|
+
message: z16.string()
|
|
5439
5482
|
});
|
|
5440
|
-
var googleDraftStatusCollectionSchema =
|
|
5441
|
-
label:
|
|
5442
|
-
added:
|
|
5443
|
-
removed:
|
|
5444
|
-
existing:
|
|
5483
|
+
var googleDraftStatusCollectionSchema = z16.object({
|
|
5484
|
+
label: z16.string(),
|
|
5485
|
+
added: z16.number(),
|
|
5486
|
+
removed: z16.number(),
|
|
5487
|
+
existing: z16.number()
|
|
5445
5488
|
});
|
|
5446
|
-
var googleDraftChangeOperationSchema =
|
|
5447
|
-
var googleDraftStatusNodeSchema =
|
|
5448
|
-
() =>
|
|
5449
|
-
entity:
|
|
5450
|
-
name:
|
|
5489
|
+
var googleDraftChangeOperationSchema = z16.enum(["create", "update", "pause", "resume", "remove"]);
|
|
5490
|
+
var googleDraftStatusNodeSchema = z16.lazy(
|
|
5491
|
+
() => z16.object({
|
|
5492
|
+
entity: z16.string(),
|
|
5493
|
+
name: z16.string(),
|
|
5451
5494
|
operation: googleDraftChangeOperationSchema.optional(),
|
|
5452
|
-
existing:
|
|
5453
|
-
collections:
|
|
5454
|
-
children:
|
|
5455
|
-
warnings:
|
|
5495
|
+
existing: z16.boolean(),
|
|
5496
|
+
collections: z16.array(googleDraftStatusCollectionSchema),
|
|
5497
|
+
children: z16.array(googleDraftStatusNodeSchema),
|
|
5498
|
+
warnings: z16.array(z16.string()).optional()
|
|
5456
5499
|
})
|
|
5457
5500
|
);
|
|
5458
|
-
var googleDraftListResponseSchema =
|
|
5459
|
-
status:
|
|
5501
|
+
var googleDraftListResponseSchema = z16.object({
|
|
5502
|
+
status: z16.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
5460
5503
|
mode: googleWriteModeSchema,
|
|
5461
|
-
count:
|
|
5462
|
-
ops:
|
|
5504
|
+
count: z16.number(),
|
|
5505
|
+
ops: z16.array(googleDraftOpViewSchema),
|
|
5463
5506
|
/** Grouped campaign ▸ ad group ▸ ad tree for the readable CLI status view. */
|
|
5464
|
-
tree:
|
|
5507
|
+
tree: z16.array(googleDraftStatusNodeSchema).optional(),
|
|
5465
5508
|
/** Non-blocking completeness advisories for the whole draft. */
|
|
5466
|
-
advisories:
|
|
5509
|
+
advisories: z16.array(googleDraftAdvisorySchema).optional()
|
|
5467
5510
|
});
|
|
5468
|
-
var googleDraftRemoveRequestSchema =
|
|
5469
|
-
chatId:
|
|
5470
|
-
ref:
|
|
5511
|
+
var googleDraftRemoveRequestSchema = z16.object({
|
|
5512
|
+
chatId: z16.string(),
|
|
5513
|
+
ref: z16.string()
|
|
5471
5514
|
});
|
|
5472
|
-
var googleDraftRemoveResponseSchema =
|
|
5515
|
+
var googleDraftRemoveResponseSchema = z16.object({
|
|
5473
5516
|
/** The requested ref plus any dependents removed by cascade. */
|
|
5474
|
-
removed:
|
|
5517
|
+
removed: z16.array(z16.string())
|
|
5475
5518
|
});
|
|
5476
|
-
var googleDraftClearRequestSchema =
|
|
5477
|
-
chatId:
|
|
5519
|
+
var googleDraftClearRequestSchema = z16.object({
|
|
5520
|
+
chatId: z16.string()
|
|
5478
5521
|
});
|
|
5479
|
-
var googleDraftClearResponseSchema =
|
|
5480
|
-
cleared:
|
|
5522
|
+
var googleDraftClearResponseSchema = z16.object({
|
|
5523
|
+
cleared: z16.number()
|
|
5481
5524
|
});
|
|
5482
|
-
var googleFieldErrorSchema =
|
|
5483
|
-
path:
|
|
5484
|
-
message:
|
|
5525
|
+
var googleFieldErrorSchema = z16.object({
|
|
5526
|
+
path: z16.string(),
|
|
5527
|
+
message: z16.string()
|
|
5485
5528
|
});
|
|
5486
|
-
var googleDraftErrorResponseSchema =
|
|
5487
|
-
code:
|
|
5488
|
-
error:
|
|
5489
|
-
fields:
|
|
5529
|
+
var googleDraftErrorResponseSchema = z16.object({
|
|
5530
|
+
code: z16.string(),
|
|
5531
|
+
error: z16.string(),
|
|
5532
|
+
fields: z16.array(googleFieldErrorSchema).optional()
|
|
5490
5533
|
});
|
|
5491
5534
|
|
|
5492
5535
|
// src/commands/ads/google/changes-window.ts
|
|
@@ -7041,8 +7084,8 @@ async function stageGoogleOps(rawOps, hints) {
|
|
|
7041
7084
|
async function stageUpdate(kind, customerId, target, payload, hints) {
|
|
7042
7085
|
await stageGoogleOp({ kind, customerId, target, payload }, hints);
|
|
7043
7086
|
}
|
|
7044
|
-
async function stageTarget(kind, customerId, target) {
|
|
7045
|
-
await stageGoogleOp({ kind, customerId, target });
|
|
7087
|
+
async function stageTarget(kind, customerId, target, hints) {
|
|
7088
|
+
await stageGoogleOp({ kind, customerId, target }, hints);
|
|
7046
7089
|
}
|
|
7047
7090
|
async function draftAction(path28, body) {
|
|
7048
7091
|
try {
|
|
@@ -7852,7 +7895,7 @@ var PRESETS = [
|
|
|
7852
7895
|
{
|
|
7853
7896
|
name: "keyword-analysis",
|
|
7854
7897
|
description: "Keyword performance with match type and quality",
|
|
7855
|
-
gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.name, ad_group.status, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.ctr FROM keyword_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC LIMIT {limit}`,
|
|
7898
|
+
gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.ctr FROM keyword_view WHERE segments.date DURING {dateRange}{statusScope} ORDER BY metrics.impressions DESC LIMIT {limit}`,
|
|
7856
7899
|
defaultDateRange: "LAST_30_DAYS",
|
|
7857
7900
|
defaultLimit: 200,
|
|
7858
7901
|
statusFields: ["campaign.status", "ad_group.status", "ad_group_criterion.status"]
|
|
@@ -7860,7 +7903,7 @@ var PRESETS = [
|
|
|
7860
7903
|
{
|
|
7861
7904
|
name: "positive-keywords",
|
|
7862
7905
|
description: "Positive (targeting) keywords only \u2014 excludes negatives",
|
|
7863
|
-
gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.name, ad_group.status, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.negative FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = FALSE{statusScope} ORDER BY campaign.name LIMIT {limit}`,
|
|
7906
|
+
gaqlTemplate: `SELECT campaign.id, campaign.name, campaign.status, ad_group.id, ad_group.name, ad_group.status, ad_group_criterion.criterion_id, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.negative FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD' AND ad_group_criterion.negative = FALSE{statusScope} ORDER BY campaign.name LIMIT {limit}`,
|
|
7864
7907
|
defaultDateRange: "ALL_TIME",
|
|
7865
7908
|
defaultLimit: 500,
|
|
7866
7909
|
statusFields: ["campaign.status", "ad_group.status", "ad_group_criterion.status"]
|
|
@@ -8701,7 +8744,7 @@ var campaignsCommand = defineCommand30({
|
|
|
8701
8744
|
remove: statusCommand2("google.campaign.remove", "campaign")
|
|
8702
8745
|
}
|
|
8703
8746
|
});
|
|
8704
|
-
function statusCommand2(kind, entity) {
|
|
8747
|
+
function statusCommand2(kind, entity, hints) {
|
|
8705
8748
|
return defineCommand30({
|
|
8706
8749
|
meta: { name: kind.split(".")[2], description: `Stage a ${entity} ${kind.split(".")[2]}` },
|
|
8707
8750
|
args: {
|
|
@@ -8710,7 +8753,7 @@ function statusCommand2(kind, entity) {
|
|
|
8710
8753
|
},
|
|
8711
8754
|
run: async ({ args }) => {
|
|
8712
8755
|
const customerId = requireCustomerId(args);
|
|
8713
|
-
await stageTarget(kind, customerId, requireTarget(args, entity));
|
|
8756
|
+
await stageTarget(kind, customerId, requireTarget(args, entity), hints);
|
|
8714
8757
|
}
|
|
8715
8758
|
});
|
|
8716
8759
|
}
|
|
@@ -8765,6 +8808,14 @@ var adGroupsCommand = defineCommand30({
|
|
|
8765
8808
|
remove: statusCommand2("google.adGroup.remove", "ad group")
|
|
8766
8809
|
}
|
|
8767
8810
|
});
|
|
8811
|
+
var KEYWORD_KILL_HINTS = [
|
|
8812
|
+
"Keyword metrics are per ad group. Decide this from keyword_view rows carrying ad_group.id + ad_group_criterion.criterion_id (`--preset keyword-analysis` returns both) \u2014 never from campaign totals or metrics summed across ad groups.",
|
|
8813
|
+
"The same keyword text in several ad groups shares ONE criterion id, so an aggregate blends the copy that holds the history with the copies that never served. Compare the copies row by row and keep the one with the impressions/conversions; if the keyword is duplicated and only one copy performs, pause the others, not it."
|
|
8814
|
+
];
|
|
8815
|
+
function keywordKillHints(status) {
|
|
8816
|
+
const kills = typeof status === "string" && ["PAUSED", "REMOVED"].includes(status.toUpperCase());
|
|
8817
|
+
return kills ? KEYWORD_KILL_HINTS : [];
|
|
8818
|
+
}
|
|
8768
8819
|
var keywordWriteSubcommands = {
|
|
8769
8820
|
add: defineCommand30({
|
|
8770
8821
|
meta: { name: "add", description: "Add keyword(s) to an ad group \u2014 one --text or a whole batch" },
|
|
@@ -8799,13 +8850,16 @@ var keywordWriteSubcommands = {
|
|
|
8799
8850
|
args: { ...customerIdArg, "cpc-bid": { type: "string" }, status: { type: "string" } },
|
|
8800
8851
|
run: async ({ args }) => {
|
|
8801
8852
|
const customerId = requireCustomerId(args);
|
|
8802
|
-
await stageUpdate(
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8853
|
+
await stageUpdate(
|
|
8854
|
+
"google.keyword.update",
|
|
8855
|
+
customerId,
|
|
8856
|
+
requireTarget(args, "keyword"),
|
|
8857
|
+
{ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"), status: args.status },
|
|
8858
|
+
keywordKillHints(args.status)
|
|
8859
|
+
);
|
|
8806
8860
|
}
|
|
8807
8861
|
}),
|
|
8808
|
-
remove: statusCommand2("google.keyword.remove", "keyword")
|
|
8862
|
+
remove: statusCommand2("google.keyword.remove", "keyword", KEYWORD_KILL_HINTS)
|
|
8809
8863
|
};
|
|
8810
8864
|
var NEGATIVE_COVERAGE_HINTS = [
|
|
8811
8865
|
"Before publishing, confirm each term isn't already blocked: run `baker ads google query --preset negative-keyword-lists` (shared-list terms) and `--preset negative-keywords` (campaign/ad-group negatives).",
|
|
@@ -13618,17 +13672,17 @@ var NUMERIC_ID_REGEX3 = /^\d+$/;
|
|
|
13618
13672
|
var IMAGE_HASH_REGEX = /^[A-Fa-f0-9]{16,}$/;
|
|
13619
13673
|
|
|
13620
13674
|
// ../api/src/ads-meta/ops.ts
|
|
13621
|
-
import { z as
|
|
13622
|
-
var tempRefSchema3 =
|
|
13623
|
-
var parentRefSchema2 =
|
|
13624
|
-
var moneySchema2 =
|
|
13625
|
-
amount:
|
|
13626
|
-
currencyCode:
|
|
13627
|
-
});
|
|
13628
|
-
var httpsUrlSchema3 =
|
|
13629
|
-
var bakerMediaIdSchema2 =
|
|
13630
|
-
var stageableStatusSchema3 =
|
|
13631
|
-
var updateStatusSchema =
|
|
13675
|
+
import { z as z17 } from "zod";
|
|
13676
|
+
var tempRefSchema3 = z17.string().regex(TEMP_REF_REGEX3, "expected a meta_temp_* reference");
|
|
13677
|
+
var parentRefSchema2 = z17.union([z17.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema3]);
|
|
13678
|
+
var moneySchema2 = z17.object({
|
|
13679
|
+
amount: z17.string().regex(/^\d+(\.\d{1,2})?$/, "expected a decimal amount like 50 or 50.00").refine((val) => Number(val) > 0, "amount must be greater than zero"),
|
|
13680
|
+
currencyCode: z17.string().length(3).optional()
|
|
13681
|
+
});
|
|
13682
|
+
var httpsUrlSchema3 = z17.string().url().refine((u) => u.startsWith("https://"), "destination URLs must be https");
|
|
13683
|
+
var bakerMediaIdSchema2 = z17.string().min(1);
|
|
13684
|
+
var stageableStatusSchema3 = z17.enum(STAGEABLE_CREATE_STATUSES3);
|
|
13685
|
+
var updateStatusSchema = z17.enum(UPDATE_STATUSES);
|
|
13632
13686
|
function currencyMinimums2(currencyCode) {
|
|
13633
13687
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
13634
13688
|
}
|
|
@@ -13640,35 +13694,35 @@ function validateDailyBudgetFloor(money, ctx, path28) {
|
|
|
13640
13694
|
}
|
|
13641
13695
|
}
|
|
13642
13696
|
}
|
|
13643
|
-
var geoLocationsSchema =
|
|
13644
|
-
countries:
|
|
13645
|
-
regions:
|
|
13646
|
-
cities:
|
|
13647
|
-
zips:
|
|
13648
|
-
location_types:
|
|
13649
|
-
}).catchall(
|
|
13650
|
-
var idNameSchema =
|
|
13651
|
-
var metaTargetingSchema =
|
|
13697
|
+
var geoLocationsSchema = z17.object({
|
|
13698
|
+
countries: z17.array(z17.string().length(2)).optional(),
|
|
13699
|
+
regions: z17.array(z17.object({ key: z17.string() })).optional(),
|
|
13700
|
+
cities: z17.array(z17.object({ key: z17.string(), radius: z17.number().optional(), distance_unit: z17.string().optional() })).optional(),
|
|
13701
|
+
zips: z17.array(z17.object({ key: z17.string() })).optional(),
|
|
13702
|
+
location_types: z17.array(z17.string()).optional()
|
|
13703
|
+
}).catchall(z17.unknown());
|
|
13704
|
+
var idNameSchema = z17.object({ id: z17.string(), name: z17.string().optional() });
|
|
13705
|
+
var metaTargetingSchema = z17.object({
|
|
13652
13706
|
geo_locations: geoLocationsSchema.optional(),
|
|
13653
13707
|
excluded_geo_locations: geoLocationsSchema.optional(),
|
|
13654
|
-
age_min:
|
|
13655
|
-
age_max:
|
|
13656
|
-
genders:
|
|
13657
|
-
locales:
|
|
13658
|
-
interests:
|
|
13659
|
-
behaviors:
|
|
13660
|
-
custom_audiences:
|
|
13661
|
-
excluded_custom_audiences:
|
|
13662
|
-
flexible_spec:
|
|
13663
|
-
exclusions:
|
|
13664
|
-
publisher_platforms:
|
|
13665
|
-
facebook_positions:
|
|
13666
|
-
instagram_positions:
|
|
13667
|
-
audience_network_positions:
|
|
13668
|
-
messenger_positions:
|
|
13669
|
-
device_platforms:
|
|
13670
|
-
targeting_automation:
|
|
13671
|
-
}).catchall(
|
|
13708
|
+
age_min: z17.number().int().min(13).max(65).optional(),
|
|
13709
|
+
age_max: z17.number().int().min(13).max(65).optional(),
|
|
13710
|
+
genders: z17.array(z17.union([z17.literal(1), z17.literal(2)])).optional(),
|
|
13711
|
+
locales: z17.array(z17.number().int()).optional(),
|
|
13712
|
+
interests: z17.array(idNameSchema).optional(),
|
|
13713
|
+
behaviors: z17.array(idNameSchema).optional(),
|
|
13714
|
+
custom_audiences: z17.array(z17.object({ id: parentRefSchema2 })).optional(),
|
|
13715
|
+
excluded_custom_audiences: z17.array(z17.object({ id: parentRefSchema2 })).optional(),
|
|
13716
|
+
flexible_spec: z17.array(z17.record(z17.string(), z17.unknown())).optional(),
|
|
13717
|
+
exclusions: z17.record(z17.string(), z17.unknown()).optional(),
|
|
13718
|
+
publisher_platforms: z17.array(z17.string()).optional(),
|
|
13719
|
+
facebook_positions: z17.array(z17.string()).optional(),
|
|
13720
|
+
instagram_positions: z17.array(z17.string()).optional(),
|
|
13721
|
+
audience_network_positions: z17.array(z17.string()).optional(),
|
|
13722
|
+
messenger_positions: z17.array(z17.string()).optional(),
|
|
13723
|
+
device_platforms: z17.array(z17.string()).optional(),
|
|
13724
|
+
targeting_automation: z17.object({ advantage_audience: z17.union([z17.literal(0), z17.literal(1)]) }).partial().optional()
|
|
13725
|
+
}).catchall(z17.unknown());
|
|
13672
13726
|
var GEO_INCLUSION_KEYS = [
|
|
13673
13727
|
"countries",
|
|
13674
13728
|
"country_groups",
|
|
@@ -13707,21 +13761,21 @@ function targetingHardLimitsDemographics(t) {
|
|
|
13707
13761
|
const narrowsGender = Array.isArray(t.genders) && t.genders.length === 1;
|
|
13708
13762
|
return narrowsAgeMax || narrowsAgeMin || narrowsGender;
|
|
13709
13763
|
}
|
|
13710
|
-
var specialAdCategoriesSchema =
|
|
13711
|
-
var campaignCreateSchema3 =
|
|
13712
|
-
name:
|
|
13713
|
-
objective:
|
|
13764
|
+
var specialAdCategoriesSchema = z17.array(z17.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
13765
|
+
var campaignCreateSchema3 = z17.object({
|
|
13766
|
+
name: z17.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
13767
|
+
objective: z17.enum(OBJECTIVES),
|
|
13714
13768
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
13715
13769
|
special_ad_categories: specialAdCategoriesSchema,
|
|
13716
|
-
special_ad_category_country:
|
|
13717
|
-
buying_type:
|
|
13718
|
-
bid_strategy:
|
|
13770
|
+
special_ad_category_country: z17.array(z17.string().length(2)).optional(),
|
|
13771
|
+
buying_type: z17.enum(BUYING_TYPES).default("AUCTION"),
|
|
13772
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13719
13773
|
/** Campaign Budget Optimization (Advantage campaign budget) — mutually exclusive with ad-set budgets. */
|
|
13720
13774
|
dailyBudget: moneySchema2.optional(),
|
|
13721
13775
|
lifetimeBudget: moneySchema2.optional(),
|
|
13722
13776
|
spendCap: moneySchema2.optional(),
|
|
13723
|
-
start_time:
|
|
13724
|
-
stop_time:
|
|
13777
|
+
start_time: z17.number().int().positive().optional(),
|
|
13778
|
+
stop_time: z17.number().int().positive().optional()
|
|
13725
13779
|
}).superRefine((p, ctx) => {
|
|
13726
13780
|
if (p.dailyBudget && p.lifetimeBudget) {
|
|
13727
13781
|
ctx.addIssue({ code: "custom", path: ["dailyBudget"], message: "set only one of dailyBudget or lifetimeBudget" });
|
|
@@ -13739,15 +13793,15 @@ var campaignCreateSchema3 = z16.object({
|
|
|
13739
13793
|
});
|
|
13740
13794
|
}
|
|
13741
13795
|
});
|
|
13742
|
-
var campaignUpdateSchema3 =
|
|
13743
|
-
name:
|
|
13796
|
+
var campaignUpdateSchema3 = z17.object({
|
|
13797
|
+
name: z17.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
13744
13798
|
status: updateStatusSchema.optional(),
|
|
13745
|
-
bid_strategy:
|
|
13799
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13746
13800
|
dailyBudget: moneySchema2.optional(),
|
|
13747
13801
|
lifetimeBudget: moneySchema2.optional(),
|
|
13748
13802
|
spendCap: moneySchema2.optional(),
|
|
13749
|
-
start_time:
|
|
13750
|
-
stop_time:
|
|
13803
|
+
start_time: z17.number().int().positive().optional(),
|
|
13804
|
+
stop_time: z17.number().int().positive().optional()
|
|
13751
13805
|
}).superRefine((p, ctx) => {
|
|
13752
13806
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
13753
13807
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -13757,42 +13811,42 @@ var campaignUpdateSchema3 = z16.object({
|
|
|
13757
13811
|
}
|
|
13758
13812
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
13759
13813
|
});
|
|
13760
|
-
var promotedObjectSchema =
|
|
13814
|
+
var promotedObjectSchema = z17.object({
|
|
13761
13815
|
page_id: parentRefSchema2.optional(),
|
|
13762
|
-
pixel_id:
|
|
13763
|
-
custom_event_type:
|
|
13764
|
-
application_id:
|
|
13765
|
-
object_store_url:
|
|
13766
|
-
product_catalog_id:
|
|
13767
|
-
product_set_id:
|
|
13768
|
-
whatsapp_phone_number:
|
|
13769
|
-
offline_conversion_data_set_id:
|
|
13816
|
+
pixel_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13817
|
+
custom_event_type: z17.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
13818
|
+
application_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13819
|
+
object_store_url: z17.string().url().optional(),
|
|
13820
|
+
product_catalog_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13821
|
+
product_set_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13822
|
+
whatsapp_phone_number: z17.string().optional(),
|
|
13823
|
+
offline_conversion_data_set_id: z17.string().regex(NUMERIC_ID_REGEX3).optional()
|
|
13770
13824
|
}).partial();
|
|
13771
|
-
var attributionSpecSchema =
|
|
13772
|
-
|
|
13773
|
-
event_type:
|
|
13774
|
-
window_days:
|
|
13825
|
+
var attributionSpecSchema = z17.array(
|
|
13826
|
+
z17.object({
|
|
13827
|
+
event_type: z17.enum(ATTRIBUTION_EVENT_TYPES),
|
|
13828
|
+
window_days: z17.union([z17.literal(1), z17.literal(7), z17.literal(28)])
|
|
13775
13829
|
})
|
|
13776
13830
|
);
|
|
13777
13831
|
var adSetFields = {
|
|
13778
|
-
name:
|
|
13832
|
+
name: z17.string().min(1).max(META_LIMITS.adSet.nameMax),
|
|
13779
13833
|
campaign_id: parentRefSchema2,
|
|
13780
13834
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
13781
13835
|
dailyBudget: moneySchema2.optional(),
|
|
13782
13836
|
lifetimeBudget: moneySchema2.optional(),
|
|
13783
13837
|
bidAmount: moneySchema2.optional(),
|
|
13784
|
-
bid_strategy:
|
|
13785
|
-
billing_event:
|
|
13786
|
-
optimization_goal:
|
|
13787
|
-
destination_type:
|
|
13838
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13839
|
+
billing_event: z17.enum(BILLING_EVENTS),
|
|
13840
|
+
optimization_goal: z17.enum(OPTIMIZATION_GOALS),
|
|
13841
|
+
destination_type: z17.enum(DESTINATION_TYPES).optional(),
|
|
13788
13842
|
promoted_object: promotedObjectSchema.optional(),
|
|
13789
13843
|
attribution_spec: attributionSpecSchema.optional(),
|
|
13790
|
-
start_time:
|
|
13791
|
-
end_time:
|
|
13844
|
+
start_time: z17.number().int().positive().optional(),
|
|
13845
|
+
end_time: z17.number().int().positive().optional(),
|
|
13792
13846
|
targeting: metaTargetingSchema,
|
|
13793
13847
|
/** EU Digital Services Act: who benefits from / pays for the ad. Auto-filled from the account for EU geo when omitted. */
|
|
13794
|
-
dsa_beneficiary:
|
|
13795
|
-
dsa_payor:
|
|
13848
|
+
dsa_beneficiary: z17.string().min(1).max(100).optional(),
|
|
13849
|
+
dsa_payor: z17.string().min(1).max(100).optional()
|
|
13796
13850
|
};
|
|
13797
13851
|
function validateBidStrategy(p, ctx) {
|
|
13798
13852
|
const strategy = p.bid_strategy;
|
|
@@ -13889,7 +13943,7 @@ function validateAdvantageAudience(p, ctx) {
|
|
|
13889
13943
|
});
|
|
13890
13944
|
}
|
|
13891
13945
|
}
|
|
13892
|
-
var adSetCreateSchema =
|
|
13946
|
+
var adSetCreateSchema = z17.object(adSetFields).superRefine((p, ctx) => {
|
|
13893
13947
|
validateAdSetBudgetAndBid(p, ctx);
|
|
13894
13948
|
validateAdSetPromotedObject(p, ctx);
|
|
13895
13949
|
validateAdvantageAudience(p, ctx);
|
|
@@ -13901,22 +13955,22 @@ var adSetCreateSchema = z16.object(adSetFields).superRefine((p, ctx) => {
|
|
|
13901
13955
|
});
|
|
13902
13956
|
}
|
|
13903
13957
|
});
|
|
13904
|
-
var adSetUpdateSchema =
|
|
13958
|
+
var adSetUpdateSchema = z17.object({
|
|
13905
13959
|
name: adSetFields.name.optional(),
|
|
13906
13960
|
status: updateStatusSchema.optional(),
|
|
13907
13961
|
dailyBudget: moneySchema2.optional(),
|
|
13908
13962
|
lifetimeBudget: moneySchema2.optional(),
|
|
13909
13963
|
bidAmount: moneySchema2.optional(),
|
|
13910
|
-
bid_strategy:
|
|
13911
|
-
optimization_goal:
|
|
13912
|
-
destination_type:
|
|
13964
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13965
|
+
optimization_goal: z17.enum(OPTIMIZATION_GOALS).optional(),
|
|
13966
|
+
destination_type: z17.enum(DESTINATION_TYPES).optional(),
|
|
13913
13967
|
promoted_object: promotedObjectSchema.optional(),
|
|
13914
13968
|
attribution_spec: attributionSpecSchema.optional(),
|
|
13915
|
-
start_time:
|
|
13916
|
-
end_time:
|
|
13969
|
+
start_time: z17.number().int().positive().optional(),
|
|
13970
|
+
end_time: z17.number().int().positive().optional(),
|
|
13917
13971
|
targeting: metaTargetingSchema.optional(),
|
|
13918
|
-
dsa_beneficiary:
|
|
13919
|
-
dsa_payor:
|
|
13972
|
+
dsa_beneficiary: z17.string().min(1).max(100).optional(),
|
|
13973
|
+
dsa_payor: z17.string().min(1).max(100).optional()
|
|
13920
13974
|
}).superRefine((p, ctx) => {
|
|
13921
13975
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
13922
13976
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -13927,38 +13981,38 @@ var adSetUpdateSchema = z16.object({
|
|
|
13927
13981
|
}
|
|
13928
13982
|
validateAdvantageAudience(p, ctx);
|
|
13929
13983
|
});
|
|
13930
|
-
var messageSchema =
|
|
13931
|
-
var headlineSchema2 =
|
|
13932
|
-
var descriptionSchema =
|
|
13933
|
-
var callToActionSchema =
|
|
13934
|
-
type:
|
|
13984
|
+
var messageSchema = z17.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
13985
|
+
var headlineSchema2 = z17.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
13986
|
+
var descriptionSchema = z17.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
13987
|
+
var callToActionSchema = z17.object({
|
|
13988
|
+
type: z17.enum(CTA_TYPES2),
|
|
13935
13989
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
13936
13990
|
link: httpsUrlSchema3.optional()
|
|
13937
13991
|
});
|
|
13938
|
-
var creativeEnhancementsSchema =
|
|
13939
|
-
standardEnhancements:
|
|
13940
|
-
features:
|
|
13992
|
+
var creativeEnhancementsSchema = z17.object({
|
|
13993
|
+
standardEnhancements: z17.enum(ENROLL_STATUSES).optional(),
|
|
13994
|
+
features: z17.record(z17.string(), z17.enum(ENROLL_STATUSES)).optional()
|
|
13941
13995
|
});
|
|
13942
13996
|
var creativeSharedFields = {
|
|
13943
|
-
name:
|
|
13997
|
+
name: z17.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
13944
13998
|
/** Facebook Page id backing the ad's identity. */
|
|
13945
13999
|
page_id: parentRefSchema2,
|
|
13946
14000
|
/** Instagram account id for IG placements (aka instagram_actor_id on read). */
|
|
13947
|
-
instagram_user_id:
|
|
14001
|
+
instagram_user_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13948
14002
|
/** URL tracking parameters appended to the destination, e.g. "utm_source=fb&utm_campaign=x". */
|
|
13949
|
-
url_tags:
|
|
14003
|
+
url_tags: z17.string().max(1e3).optional(),
|
|
13950
14004
|
enhancements: creativeEnhancementsSchema.optional()
|
|
13951
14005
|
};
|
|
13952
14006
|
var imageMediaFields = {
|
|
13953
|
-
imageHash:
|
|
14007
|
+
imageHash: z17.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
13954
14008
|
imageRef: tempRefSchema3.optional()
|
|
13955
14009
|
};
|
|
13956
14010
|
var videoMediaFields = {
|
|
13957
|
-
videoId:
|
|
14011
|
+
videoId: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13958
14012
|
videoRef: tempRefSchema3.optional(),
|
|
13959
14013
|
/** Thumbnail for a video creative — image hash, ref, or public url. */
|
|
13960
|
-
thumbnailHash:
|
|
13961
|
-
imageUrl:
|
|
14014
|
+
thumbnailHash: z17.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
14015
|
+
imageUrl: z17.string().url().optional()
|
|
13962
14016
|
};
|
|
13963
14017
|
function countImageRefs(p) {
|
|
13964
14018
|
return [p.imageHash, p.imageRef].filter(Boolean).length;
|
|
@@ -13966,8 +14020,8 @@ function countImageRefs(p) {
|
|
|
13966
14020
|
function countVideoRefs(p) {
|
|
13967
14021
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
13968
14022
|
}
|
|
13969
|
-
var singleCreativeSchema =
|
|
13970
|
-
creativeType:
|
|
14023
|
+
var singleCreativeSchema = z17.object({
|
|
14024
|
+
creativeType: z17.literal("single"),
|
|
13971
14025
|
...creativeSharedFields,
|
|
13972
14026
|
/** Primary text. */
|
|
13973
14027
|
message: messageSchema,
|
|
@@ -13976,7 +14030,7 @@ var singleCreativeSchema = z16.object({
|
|
|
13976
14030
|
headline: headlineSchema2.optional(),
|
|
13977
14031
|
description: descriptionSchema.optional(),
|
|
13978
14032
|
/** Display URL / caption shown under the headline. */
|
|
13979
|
-
caption:
|
|
14033
|
+
caption: z17.string().max(255).optional(),
|
|
13980
14034
|
call_to_action: callToActionSchema.optional(),
|
|
13981
14035
|
...imageMediaFields,
|
|
13982
14036
|
...videoMediaFields
|
|
@@ -14000,10 +14054,10 @@ var singleCreativeSchema = z16.object({
|
|
|
14000
14054
|
});
|
|
14001
14055
|
}
|
|
14002
14056
|
});
|
|
14003
|
-
var carouselCardSchema =
|
|
14057
|
+
var carouselCardSchema = z17.object({
|
|
14004
14058
|
link: httpsUrlSchema3,
|
|
14005
|
-
headline:
|
|
14006
|
-
description:
|
|
14059
|
+
headline: z17.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
14060
|
+
description: z17.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
14007
14061
|
call_to_action: callToActionSchema.optional(),
|
|
14008
14062
|
...imageMediaFields,
|
|
14009
14063
|
...videoMediaFields
|
|
@@ -14023,35 +14077,35 @@ var carouselCardSchema = z16.object({
|
|
|
14023
14077
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
14024
14078
|
}
|
|
14025
14079
|
});
|
|
14026
|
-
var carouselCreativeSchema2 =
|
|
14027
|
-
creativeType:
|
|
14080
|
+
var carouselCreativeSchema2 = z17.object({
|
|
14081
|
+
creativeType: z17.literal("carousel"),
|
|
14028
14082
|
...creativeSharedFields,
|
|
14029
14083
|
message: messageSchema,
|
|
14030
14084
|
/** Optional "see more" card destination applied when a card has no own link. */
|
|
14031
14085
|
link: httpsUrlSchema3.optional(),
|
|
14032
14086
|
call_to_action: callToActionSchema.optional(),
|
|
14033
|
-
cards:
|
|
14087
|
+
cards: z17.array(carouselCardSchema).min(META_LIMITS.creative.carouselCardsMin).max(META_LIMITS.creative.carouselCardsMax)
|
|
14034
14088
|
});
|
|
14035
|
-
var dynamicImageSchema =
|
|
14036
|
-
var dynamicVideoSchema =
|
|
14089
|
+
var dynamicImageSchema = z17.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
14090
|
+
var dynamicVideoSchema = z17.object({
|
|
14037
14091
|
videoId: videoMediaFields.videoId,
|
|
14038
14092
|
videoRef: videoMediaFields.videoRef,
|
|
14039
14093
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
14040
14094
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
14041
14095
|
var DYN = META_LIMITS.creative;
|
|
14042
|
-
var dynamicCreativeSchema =
|
|
14043
|
-
creativeType:
|
|
14096
|
+
var dynamicCreativeSchema = z17.object({
|
|
14097
|
+
creativeType: z17.literal("dynamic"),
|
|
14044
14098
|
...creativeSharedFields,
|
|
14045
|
-
bodies:
|
|
14046
|
-
titles:
|
|
14047
|
-
descriptions:
|
|
14048
|
-
images:
|
|
14049
|
-
videos:
|
|
14050
|
-
ad_formats:
|
|
14051
|
-
call_to_action_types:
|
|
14052
|
-
link_urls:
|
|
14099
|
+
bodies: z17.array(z17.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
14100
|
+
titles: z17.array(z17.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
14101
|
+
descriptions: z17.array(z17.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
14102
|
+
images: z17.array(dynamicImageSchema).optional(),
|
|
14103
|
+
videos: z17.array(dynamicVideoSchema).optional(),
|
|
14104
|
+
ad_formats: z17.array(z17.enum(AD_FORMATS2)).min(1),
|
|
14105
|
+
call_to_action_types: z17.array(z17.enum(CTA_TYPES2)).optional(),
|
|
14106
|
+
link_urls: z17.array(z17.object({ website_url: httpsUrlSchema3, display_url: z17.string().optional() })).min(1),
|
|
14053
14107
|
/** Multi-language / placement customization — structural passthrough for v1. */
|
|
14054
|
-
asset_customization_rules:
|
|
14108
|
+
asset_customization_rules: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
14055
14109
|
}).superRefine((p, ctx) => {
|
|
14056
14110
|
if (!(p.images?.length || p.videos?.length)) {
|
|
14057
14111
|
ctx.addIssue({
|
|
@@ -14061,57 +14115,57 @@ var dynamicCreativeSchema = z16.object({
|
|
|
14061
14115
|
});
|
|
14062
14116
|
}
|
|
14063
14117
|
});
|
|
14064
|
-
var existingPostCreativeSchema =
|
|
14065
|
-
creativeType:
|
|
14118
|
+
var existingPostCreativeSchema = z17.object({
|
|
14119
|
+
creativeType: z17.literal("existing_post"),
|
|
14066
14120
|
name: creativeSharedFields.name,
|
|
14067
14121
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
14068
|
-
object_story_id:
|
|
14122
|
+
object_story_id: z17.string().regex(/^\d+_\d+$/, 'expected "<page_id>_<post_id>"'),
|
|
14069
14123
|
instagram_user_id: creativeSharedFields.instagram_user_id,
|
|
14070
14124
|
url_tags: creativeSharedFields.url_tags,
|
|
14071
14125
|
enhancements: creativeSharedFields.enhancements
|
|
14072
14126
|
});
|
|
14073
|
-
var creativeContentSchema2 =
|
|
14127
|
+
var creativeContentSchema2 = z17.discriminatedUnion("creativeType", [
|
|
14074
14128
|
singleCreativeSchema,
|
|
14075
14129
|
carouselCreativeSchema2,
|
|
14076
14130
|
dynamicCreativeSchema,
|
|
14077
14131
|
existingPostCreativeSchema
|
|
14078
14132
|
]);
|
|
14079
14133
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
14080
|
-
var adCreativeUpdateSchema =
|
|
14081
|
-
name:
|
|
14134
|
+
var adCreativeUpdateSchema = z17.object({
|
|
14135
|
+
name: z17.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
14082
14136
|
status: updateStatusSchema.optional(),
|
|
14083
14137
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
14084
|
-
content:
|
|
14138
|
+
content: z17.record(z17.string(), z17.unknown()).optional()
|
|
14085
14139
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
14086
|
-
var adCreateSchema2 =
|
|
14087
|
-
name:
|
|
14140
|
+
var adCreateSchema2 = z17.object({
|
|
14141
|
+
name: z17.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
14088
14142
|
adset_id: parentRefSchema2,
|
|
14089
14143
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
14090
|
-
creative:
|
|
14144
|
+
creative: z17.object({ creative_id: parentRefSchema2 }),
|
|
14091
14145
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
14092
|
-
tracking_specs:
|
|
14146
|
+
tracking_specs: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
14093
14147
|
});
|
|
14094
|
-
var adUpdateSchema2 =
|
|
14095
|
-
name:
|
|
14148
|
+
var adUpdateSchema2 = z17.object({
|
|
14149
|
+
name: z17.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
14096
14150
|
status: updateStatusSchema.optional(),
|
|
14097
14151
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
14098
|
-
creative:
|
|
14099
|
-
tracking_specs:
|
|
14152
|
+
creative: z17.object({ creative_id: parentRefSchema2 }).optional(),
|
|
14153
|
+
tracking_specs: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
14100
14154
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
14101
|
-
var lookalikeSpecSchema =
|
|
14102
|
-
origin:
|
|
14103
|
-
ratio:
|
|
14104
|
-
country:
|
|
14105
|
-
});
|
|
14106
|
-
var customAudienceCreateSchema =
|
|
14107
|
-
name:
|
|
14108
|
-
subtype:
|
|
14109
|
-
description:
|
|
14110
|
-
customer_file_source:
|
|
14111
|
-
retention_days:
|
|
14155
|
+
var lookalikeSpecSchema = z17.object({
|
|
14156
|
+
origin: z17.array(z17.object({ id: parentRefSchema2 })).min(1),
|
|
14157
|
+
ratio: z17.number().min(0.01).max(0.2).optional(),
|
|
14158
|
+
country: z17.string().length(2).optional()
|
|
14159
|
+
});
|
|
14160
|
+
var customAudienceCreateSchema = z17.object({
|
|
14161
|
+
name: z17.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
14162
|
+
subtype: z17.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
14163
|
+
description: z17.string().max(500).optional(),
|
|
14164
|
+
customer_file_source: z17.string().optional(),
|
|
14165
|
+
retention_days: z17.number().int().min(1).max(META_LIMITS.audience.retentionDaysMax).optional(),
|
|
14112
14166
|
lookalike_spec: lookalikeSpecSchema.optional(),
|
|
14113
14167
|
/** Website/engagement rule — structural passthrough validated by Meta. */
|
|
14114
|
-
rule:
|
|
14168
|
+
rule: z17.record(z17.string(), z17.unknown()).optional()
|
|
14115
14169
|
}).superRefine((p, ctx) => {
|
|
14116
14170
|
if (p.subtype === "LOOKALIKE" && !p.lookalike_spec) {
|
|
14117
14171
|
ctx.addIssue({ code: "custom", path: ["lookalike_spec"], message: "LOOKALIKE audiences need a lookalike_spec" });
|
|
@@ -14120,16 +14174,16 @@ var customAudienceCreateSchema = z16.object({
|
|
|
14120
14174
|
ctx.addIssue({ code: "custom", path: ["rule"], message: `${p.subtype} audiences need a rule (use --file)` });
|
|
14121
14175
|
}
|
|
14122
14176
|
});
|
|
14123
|
-
var customAudienceUpdateSchema =
|
|
14124
|
-
name:
|
|
14125
|
-
description:
|
|
14177
|
+
var customAudienceUpdateSchema = z17.object({
|
|
14178
|
+
name: z17.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
14179
|
+
description: z17.string().max(500).optional()
|
|
14126
14180
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
14127
|
-
var mediaUploadSchema =
|
|
14128
|
-
kind:
|
|
14181
|
+
var mediaUploadSchema = z17.object({
|
|
14182
|
+
kind: z17.enum(MEDIA_KINDS),
|
|
14129
14183
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
14130
14184
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
14131
14185
|
/** Optional display name / filename hint. */
|
|
14132
|
-
name:
|
|
14186
|
+
name: z17.string().max(255).optional()
|
|
14133
14187
|
}).superRefine((p, ctx) => {
|
|
14134
14188
|
if (p.kind === "image" && !p.bakerImageId) {
|
|
14135
14189
|
ctx.addIssue({ code: "custom", path: ["bakerImageId"], message: "image uploads need a bakerImageId" });
|
|
@@ -14151,16 +14205,16 @@ var META_DRAFT_OP_KINDS = [
|
|
|
14151
14205
|
"customAudience.update",
|
|
14152
14206
|
"media.upload"
|
|
14153
14207
|
];
|
|
14154
|
-
var metaDraftOpKindSchema =
|
|
14155
|
-
var accountIdSchema2 =
|
|
14156
|
-
var updateTargetSchema2 =
|
|
14208
|
+
var metaDraftOpKindSchema = z17.enum(META_DRAFT_OP_KINDS);
|
|
14209
|
+
var accountIdSchema2 = z17.string().regex(NUMERIC_ID_REGEX3, "accountId must be the bare numeric ad account id");
|
|
14210
|
+
var updateTargetSchema2 = z17.union([z17.string().regex(NUMERIC_ID_REGEX3), tempRefSchema3]);
|
|
14157
14211
|
function createOp3(kind, payload) {
|
|
14158
|
-
return
|
|
14212
|
+
return z17.object({ kind: z17.literal(kind), accountId: accountIdSchema2, payload });
|
|
14159
14213
|
}
|
|
14160
14214
|
function updateOp3(kind, payload) {
|
|
14161
|
-
return
|
|
14215
|
+
return z17.object({ kind: z17.literal(kind), accountId: accountIdSchema2, target: updateTargetSchema2, payload });
|
|
14162
14216
|
}
|
|
14163
|
-
var metaDraftOpInputSchema =
|
|
14217
|
+
var metaDraftOpInputSchema = z17.discriminatedUnion("kind", [
|
|
14164
14218
|
createOp3("campaign.create", campaignCreateSchema3),
|
|
14165
14219
|
updateOp3("campaign.update", campaignUpdateSchema3),
|
|
14166
14220
|
createOp3("adSet.create", adSetCreateSchema),
|
|
@@ -14175,89 +14229,89 @@ var metaDraftOpInputSchema = z16.discriminatedUnion("kind", [
|
|
|
14175
14229
|
]);
|
|
14176
14230
|
|
|
14177
14231
|
// ../api/src/ads-meta/wire.ts
|
|
14178
|
-
import { z as
|
|
14179
|
-
var metaWriteModeSchema =
|
|
14180
|
-
var metaDraftOpResultSchema =
|
|
14181
|
-
status:
|
|
14232
|
+
import { z as z18 } from "zod";
|
|
14233
|
+
var metaWriteModeSchema = z18.enum(["live", "simulated"]);
|
|
14234
|
+
var metaDraftOpResultSchema = z18.object({
|
|
14235
|
+
status: z18.enum(["applied", "simulated", "failed", "skipped"]),
|
|
14182
14236
|
/** The resulting Meta node id (campaign/adset/creative/ad/audience) or simulated id. */
|
|
14183
|
-
id:
|
|
14237
|
+
id: z18.string().optional(),
|
|
14184
14238
|
/** For media.upload ops: the resulting image hash. */
|
|
14185
|
-
hash:
|
|
14186
|
-
error:
|
|
14187
|
-
skippedBecause:
|
|
14188
|
-
executedAt:
|
|
14239
|
+
hash: z18.string().optional(),
|
|
14240
|
+
error: z18.string().optional(),
|
|
14241
|
+
skippedBecause: z18.string().optional(),
|
|
14242
|
+
executedAt: z18.number().optional()
|
|
14189
14243
|
});
|
|
14190
|
-
var metaDraftStageRequestSchema =
|
|
14191
|
-
chatId:
|
|
14244
|
+
var metaDraftStageRequestSchema = z18.object({
|
|
14245
|
+
chatId: z18.string(),
|
|
14192
14246
|
op: metaDraftOpInputSchema
|
|
14193
14247
|
});
|
|
14194
|
-
var metaDraftStageResponseSchema =
|
|
14195
|
-
staged:
|
|
14196
|
-
ref:
|
|
14248
|
+
var metaDraftStageResponseSchema = z18.object({
|
|
14249
|
+
staged: z18.literal(true),
|
|
14250
|
+
ref: z18.string(),
|
|
14197
14251
|
kind: metaDraftOpKindSchema,
|
|
14198
14252
|
mode: metaWriteModeSchema,
|
|
14199
|
-
dependsOn:
|
|
14200
|
-
summary:
|
|
14201
|
-
warnings:
|
|
14253
|
+
dependsOn: z18.array(z18.string()),
|
|
14254
|
+
summary: z18.string(),
|
|
14255
|
+
warnings: z18.array(z18.string()),
|
|
14202
14256
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
14203
|
-
amended:
|
|
14204
|
-
});
|
|
14205
|
-
var metaDraftDuplicateRequestSchema =
|
|
14206
|
-
chatId:
|
|
14207
|
-
accountId:
|
|
14208
|
-
entity:
|
|
14209
|
-
sourceId:
|
|
14210
|
-
overrides:
|
|
14257
|
+
amended: z18.boolean().optional()
|
|
14258
|
+
});
|
|
14259
|
+
var metaDraftDuplicateRequestSchema = z18.object({
|
|
14260
|
+
chatId: z18.string(),
|
|
14261
|
+
accountId: z18.string(),
|
|
14262
|
+
entity: z18.enum(["campaign", "adSet", "ad"]),
|
|
14263
|
+
sourceId: z18.string(),
|
|
14264
|
+
overrides: z18.record(z18.string(), z18.unknown()).optional(),
|
|
14211
14265
|
/** Pause the original after the copy publishes. */
|
|
14212
|
-
replace:
|
|
14266
|
+
replace: z18.boolean().optional()
|
|
14213
14267
|
});
|
|
14214
|
-
var metaDraftOpViewSchema =
|
|
14215
|
-
ref:
|
|
14268
|
+
var metaDraftOpViewSchema = z18.object({
|
|
14269
|
+
ref: z18.string(),
|
|
14216
14270
|
kind: metaDraftOpKindSchema,
|
|
14217
|
-
accountId:
|
|
14218
|
-
target:
|
|
14219
|
-
dependsOn:
|
|
14220
|
-
summary:
|
|
14221
|
-
stagedAt:
|
|
14271
|
+
accountId: z18.string(),
|
|
14272
|
+
target: z18.string().optional(),
|
|
14273
|
+
dependsOn: z18.array(z18.string()),
|
|
14274
|
+
summary: z18.string(),
|
|
14275
|
+
stagedAt: z18.number(),
|
|
14222
14276
|
result: metaDraftOpResultSchema.optional()
|
|
14223
14277
|
});
|
|
14224
|
-
var metaDraftListRequestSchema =
|
|
14225
|
-
chatId:
|
|
14278
|
+
var metaDraftListRequestSchema = z18.object({
|
|
14279
|
+
chatId: z18.string()
|
|
14226
14280
|
});
|
|
14227
|
-
var metaDraftAdvisorySchema =
|
|
14228
|
-
ref:
|
|
14229
|
-
message:
|
|
14281
|
+
var metaDraftAdvisorySchema = z18.object({
|
|
14282
|
+
ref: z18.string(),
|
|
14283
|
+
message: z18.string()
|
|
14230
14284
|
});
|
|
14231
|
-
var metaDraftListResponseSchema =
|
|
14232
|
-
status:
|
|
14285
|
+
var metaDraftListResponseSchema = z18.object({
|
|
14286
|
+
status: z18.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
14233
14287
|
mode: metaWriteModeSchema,
|
|
14234
|
-
count:
|
|
14235
|
-
ops:
|
|
14288
|
+
count: z18.number(),
|
|
14289
|
+
ops: z18.array(metaDraftOpViewSchema),
|
|
14236
14290
|
/** Non-blocking cross-op quality advisories — "good campaign, not just valid". */
|
|
14237
|
-
advisories:
|
|
14291
|
+
advisories: z18.array(metaDraftAdvisorySchema)
|
|
14238
14292
|
});
|
|
14239
|
-
var metaDraftRemoveRequestSchema =
|
|
14240
|
-
chatId:
|
|
14241
|
-
ref:
|
|
14293
|
+
var metaDraftRemoveRequestSchema = z18.object({
|
|
14294
|
+
chatId: z18.string(),
|
|
14295
|
+
ref: z18.string()
|
|
14242
14296
|
});
|
|
14243
|
-
var metaDraftRemoveResponseSchema =
|
|
14297
|
+
var metaDraftRemoveResponseSchema = z18.object({
|
|
14244
14298
|
/** The requested ref plus any dependents removed by cascade. */
|
|
14245
|
-
removed:
|
|
14299
|
+
removed: z18.array(z18.string())
|
|
14246
14300
|
});
|
|
14247
|
-
var metaDraftClearRequestSchema =
|
|
14248
|
-
chatId:
|
|
14301
|
+
var metaDraftClearRequestSchema = z18.object({
|
|
14302
|
+
chatId: z18.string()
|
|
14249
14303
|
});
|
|
14250
|
-
var metaDraftClearResponseSchema =
|
|
14251
|
-
cleared:
|
|
14304
|
+
var metaDraftClearResponseSchema = z18.object({
|
|
14305
|
+
cleared: z18.number()
|
|
14252
14306
|
});
|
|
14253
|
-
var metaFieldErrorSchema =
|
|
14254
|
-
path:
|
|
14255
|
-
message:
|
|
14307
|
+
var metaFieldErrorSchema = z18.object({
|
|
14308
|
+
path: z18.string(),
|
|
14309
|
+
message: z18.string()
|
|
14256
14310
|
});
|
|
14257
|
-
var metaDraftErrorResponseSchema =
|
|
14258
|
-
code:
|
|
14259
|
-
error:
|
|
14260
|
-
fields:
|
|
14311
|
+
var metaDraftErrorResponseSchema = z18.object({
|
|
14312
|
+
code: z18.string(),
|
|
14313
|
+
error: z18.string(),
|
|
14314
|
+
fields: z18.array(metaFieldErrorSchema).optional()
|
|
14261
14315
|
});
|
|
14262
14316
|
|
|
14263
14317
|
// src/commands/ads/meta/write-shared.ts
|
|
@@ -18137,7 +18191,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
|
|
|
18137
18191
|
import { toCardinal as nwNl } from "n2words/nl-NL";
|
|
18138
18192
|
import { toCardinal as nwPl } from "n2words/pl-PL";
|
|
18139
18193
|
import { toCardinal as nwPt } from "n2words/pt-PT";
|
|
18140
|
-
import { z as
|
|
18194
|
+
import { z as z19 } from "zod";
|
|
18141
18195
|
|
|
18142
18196
|
// src/engine/scaffold/lib/shoot-modes.ts
|
|
18143
18197
|
var SHOOT_MODES = [
|
|
@@ -18473,71 +18527,71 @@ function trimArgs(durationS, offsetS = 0, dims) {
|
|
|
18473
18527
|
"{{out.video}}"
|
|
18474
18528
|
];
|
|
18475
18529
|
}
|
|
18476
|
-
var FrameAsset =
|
|
18477
|
-
var DialogueLine =
|
|
18478
|
-
speaker:
|
|
18479
|
-
line:
|
|
18530
|
+
var FrameAsset = z19.object({ url: z19.string().optional() }).loose().optional();
|
|
18531
|
+
var DialogueLine = z19.object({
|
|
18532
|
+
speaker: z19.string().optional(),
|
|
18533
|
+
line: z19.string().optional(),
|
|
18480
18534
|
// Absolute seconds on the source timeline (the deconstruct emits both).
|
|
18481
|
-
start_s:
|
|
18482
|
-
end_s:
|
|
18483
|
-
delivery:
|
|
18484
|
-
voice_description:
|
|
18535
|
+
start_s: z19.number().optional(),
|
|
18536
|
+
end_s: z19.number().optional(),
|
|
18537
|
+
delivery: z19.string().optional(),
|
|
18538
|
+
voice_description: z19.string().optional(),
|
|
18485
18539
|
// DECON-supplied: is this speaker's FACE visibly speaking in THIS scene? Element
|
|
18486
18540
|
// presence alone can't answer that — a founder pictured in a polaroid close-up is
|
|
18487
18541
|
// "present" yet the line is voiceover, and treating it as on-camera produced a
|
|
18488
18542
|
// native Seedance lip-sync clip of a still photograph. `false` pins the line to
|
|
18489
18543
|
// the VO path; absent keeps the presence-based decision (old blueprints).
|
|
18490
|
-
on_camera:
|
|
18544
|
+
on_camera: z19.boolean().optional()
|
|
18491
18545
|
}).loose();
|
|
18492
|
-
var Sfx =
|
|
18493
|
-
at_s:
|
|
18494
|
-
duration_s:
|
|
18495
|
-
sound_effect_prompt:
|
|
18496
|
-
description:
|
|
18546
|
+
var Sfx = z19.object({
|
|
18547
|
+
at_s: z19.number().optional(),
|
|
18548
|
+
duration_s: z19.number().optional(),
|
|
18549
|
+
sound_effect_prompt: z19.string().optional(),
|
|
18550
|
+
description: z19.string().optional()
|
|
18497
18551
|
}).loose();
|
|
18498
|
-
var CompositionRegion =
|
|
18552
|
+
var CompositionRegion = z19.object({
|
|
18499
18553
|
// full | top | bottom | left | right | inset
|
|
18500
|
-
panel:
|
|
18554
|
+
panel: z19.string().optional(),
|
|
18501
18555
|
// 9-grid anchor for an `inset` presenter box.
|
|
18502
|
-
position:
|
|
18503
|
-
is_presenter:
|
|
18556
|
+
position: z19.string().optional(),
|
|
18557
|
+
is_presenter: z19.boolean().optional(),
|
|
18504
18558
|
// The cast id shown/speaking in this region (routes lip-sync + element refs).
|
|
18505
|
-
cast_ref:
|
|
18559
|
+
cast_ref: z19.string().optional(),
|
|
18506
18560
|
// What the region's content IS: camera | screen_capture | static_graphic |
|
|
18507
18561
|
// generated. Authoritative for routing when present (regex-over-prose fallback
|
|
18508
18562
|
// otherwise): screen_capture/static_graphic are rebuilt from REAL surfaces on the
|
|
18509
18563
|
// overlay layer, never AI-generated.
|
|
18510
|
-
kind:
|
|
18564
|
+
kind: z19.string().optional(),
|
|
18511
18565
|
// Opaque id naming the SPECIFIC on-screen document/note/app-state this
|
|
18512
18566
|
// screen_capture region shows. Two scenes share it only when they show the SAME
|
|
18513
18567
|
// recording continuing (scrolling/typing/waiting within it) — a genuinely
|
|
18514
18568
|
// DIFFERENT document/note/recording (a source video splicing two screen captures)
|
|
18515
18569
|
// gets a different id. Breaks a persistent-layout run into separate surface stubs
|
|
18516
18570
|
// instead of asking the operator for one screenshot that can't cover both.
|
|
18517
|
-
surface_id:
|
|
18571
|
+
surface_id: z19.string().optional(),
|
|
18518
18572
|
// Camera bubble(s)/inset(s) embedded INSIDE this region's surface (a Loom-style
|
|
18519
18573
|
// presenter bubble inside a screen recording) — video-in-video the reproduction
|
|
18520
18574
|
// must re-composite, not paint into the surface.
|
|
18521
|
-
nested:
|
|
18522
|
-
summary:
|
|
18523
|
-
frame_prompt:
|
|
18524
|
-
motion_prompt:
|
|
18575
|
+
nested: z19.array(z19.object({}).loose()).optional(),
|
|
18576
|
+
summary: z19.string().optional(),
|
|
18577
|
+
frame_prompt: z19.string().optional(),
|
|
18578
|
+
motion_prompt: z19.string().optional()
|
|
18525
18579
|
}).loose();
|
|
18526
|
-
var SceneComposition =
|
|
18580
|
+
var SceneComposition = z19.object({
|
|
18527
18581
|
// full_frame (default) | split_screen | pip | keyed_overlay
|
|
18528
|
-
layout:
|
|
18582
|
+
layout: z19.string().optional(),
|
|
18529
18583
|
// split_screen only: vertical (top/bottom) | horizontal (left/right).
|
|
18530
|
-
split_axis:
|
|
18531
|
-
regions:
|
|
18584
|
+
split_axis: z19.string().optional(),
|
|
18585
|
+
regions: z19.array(CompositionRegion).optional()
|
|
18532
18586
|
}).loose();
|
|
18533
|
-
var CameraMotion =
|
|
18534
|
-
var TranscriptWord =
|
|
18535
|
-
var Scene =
|
|
18536
|
-
start_s:
|
|
18537
|
-
end_s:
|
|
18538
|
-
duration_s:
|
|
18539
|
-
summary:
|
|
18540
|
-
action_detail:
|
|
18587
|
+
var CameraMotion = z19.object({ movement: z19.string().optional(), detail: z19.string().optional() }).loose();
|
|
18588
|
+
var TranscriptWord = z19.object({ text: z19.string().optional() }).loose();
|
|
18589
|
+
var Scene = z19.object({
|
|
18590
|
+
start_s: z19.number().optional(),
|
|
18591
|
+
end_s: z19.number().optional(),
|
|
18592
|
+
duration_s: z19.number().optional(),
|
|
18593
|
+
summary: z19.string().optional(),
|
|
18594
|
+
action_detail: z19.string().optional(),
|
|
18541
18595
|
// The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
|
|
18542
18596
|
// A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
|
|
18543
18597
|
// builds one clip per region and stacks/overlays them into the scene picture.
|
|
@@ -18545,82 +18599,82 @@ var Scene = z18.object({
|
|
|
18545
18599
|
// The capture "look" for this scene — selected from the ad-native shoot-mode
|
|
18546
18600
|
// grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
|
|
18547
18601
|
// UGC/product mode; a human can override per scene by setting this.
|
|
18548
|
-
shoot_mode:
|
|
18602
|
+
shoot_mode: z19.string().optional(),
|
|
18549
18603
|
// Diegetic ambient the clip's native audio should carry (no music). When
|
|
18550
18604
|
// absent the scene falls back to its shoot mode's default ambience.
|
|
18551
|
-
ambient:
|
|
18605
|
+
ambient: z19.string().optional(),
|
|
18552
18606
|
camera_motion: CameraMotion.optional(),
|
|
18553
|
-
start_frame_prompt:
|
|
18554
|
-
end_frame_prompt:
|
|
18555
|
-
motion_prompt:
|
|
18607
|
+
start_frame_prompt: z19.string().optional(),
|
|
18608
|
+
end_frame_prompt: z19.string().optional(),
|
|
18609
|
+
motion_prompt: z19.string().optional(),
|
|
18556
18610
|
// The scene's role in the ad's persuasion arc (DECON-supplied); drives the
|
|
18557
18611
|
// script re-craft checklist. Inferred from position when absent.
|
|
18558
|
-
narrative_role:
|
|
18612
|
+
narrative_role: z19.string().optional(),
|
|
18559
18613
|
// DECON-supplied on the HOOK scene: the engineered physical/emotional state that
|
|
18560
18614
|
// makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
|
|
18561
18615
|
// into the hook's start-frame description so the generator renders that state,
|
|
18562
18616
|
// not a calm influencer (CCA-11).
|
|
18563
|
-
hook_mechanic:
|
|
18617
|
+
hook_mechanic: z19.object({ mechanic: z19.string().optional(), why_it_stops_scroll: z19.string().optional() }).loose().optional(),
|
|
18564
18618
|
// DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
|
|
18565
|
-
scene_setting:
|
|
18619
|
+
scene_setting: z19.string().optional(),
|
|
18566
18620
|
// How this scene cuts to the next (DECON-supplied). A recognized non-cut type
|
|
18567
18621
|
// (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
|
|
18568
18622
|
// boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
|
|
18569
18623
|
// ignored (nothing follows it).
|
|
18570
|
-
transition_out:
|
|
18571
|
-
dialogue:
|
|
18572
|
-
sfx:
|
|
18573
|
-
overlays:
|
|
18574
|
-
floating_elements:
|
|
18624
|
+
transition_out: z19.object({ type: z19.string().optional(), description: z19.string().optional() }).loose().optional(),
|
|
18625
|
+
dialogue: z19.array(DialogueLine).optional(),
|
|
18626
|
+
sfx: z19.array(Sfx).optional(),
|
|
18627
|
+
overlays: z19.array(z19.unknown()).optional(),
|
|
18628
|
+
floating_elements: z19.array(z19.unknown()).optional(),
|
|
18575
18629
|
// DECON-supplied: how much the picture itself moves within the shot. Gates the
|
|
18576
18630
|
// flash-hold optimization — a sub-2s b-roll flash with REAL subject motion
|
|
18577
18631
|
// (pouring, spreading, hands working) must stay a real clip; freezing it turns
|
|
18578
18632
|
// a montage into a slideshow. Absent (old blueprints) keeps the cheap still.
|
|
18579
|
-
motion_level:
|
|
18580
|
-
transcript_slice:
|
|
18633
|
+
motion_level: z19.enum(["static", "subtle", "dynamic"]).optional(),
|
|
18634
|
+
transcript_slice: z19.array(TranscriptWord).optional(),
|
|
18581
18635
|
start_frame_asset: FrameAsset,
|
|
18582
18636
|
end_frame_asset: FrameAsset,
|
|
18583
18637
|
// DECON-supplied: true when this scene is a length-split CONTINUATION of the
|
|
18584
18638
|
// previous one (the SAME physical shot, broken up only because it exceeded the
|
|
18585
18639
|
// clip ceiling). The scaffold then shares the splice keyframe — this scene's
|
|
18586
18640
|
// start frame IS the previous scene's end frame — so the join is seamless.
|
|
18587
|
-
continues_previous:
|
|
18641
|
+
continues_previous: z19.boolean().optional()
|
|
18588
18642
|
}).loose();
|
|
18589
|
-
var VideoBlueprint =
|
|
18590
|
-
source:
|
|
18591
|
-
global:
|
|
18592
|
-
music:
|
|
18593
|
-
present:
|
|
18594
|
-
music_prompt:
|
|
18643
|
+
var VideoBlueprint = z19.object({
|
|
18644
|
+
source: z19.object({ aspect_ratio: z19.string().optional(), duration_s: z19.number().optional() }).loose().optional(),
|
|
18645
|
+
global: z19.object({
|
|
18646
|
+
music: z19.object({
|
|
18647
|
+
present: z19.boolean().optional(),
|
|
18648
|
+
music_prompt: z19.string().optional(),
|
|
18595
18649
|
// Absolute second the music enters in the reference (the bed often
|
|
18596
18650
|
// kicks in mid-ad, after the hook). We start the regenerated track here
|
|
18597
18651
|
// instead of at 0 so the timing matches.
|
|
18598
|
-
starts_at_s:
|
|
18652
|
+
starts_at_s: z19.number().optional(),
|
|
18599
18653
|
// Populated by the deconstruct when AudD (Shazam-style) recognizes the
|
|
18600
18654
|
// reference track. We never reuse it — only style the regenerated bed.
|
|
18601
|
-
identified_track:
|
|
18655
|
+
identified_track: z19.object({ title: z19.string().optional(), artist: z19.string().optional() }).loose().nullish()
|
|
18602
18656
|
}).loose().optional(),
|
|
18603
|
-
cast:
|
|
18604
|
-
|
|
18605
|
-
id:
|
|
18606
|
-
description:
|
|
18657
|
+
cast: z19.array(
|
|
18658
|
+
z19.object({
|
|
18659
|
+
id: z19.string().optional(),
|
|
18660
|
+
description: z19.string().optional(),
|
|
18607
18661
|
// The deconstruct's note on the target-market localization (e.g. "native
|
|
18608
18662
|
// French speaker") — read to derive the spoken-track language code.
|
|
18609
|
-
market_localization_note:
|
|
18663
|
+
market_localization_note: z19.string().optional()
|
|
18610
18664
|
}).loose()
|
|
18611
18665
|
).optional(),
|
|
18612
|
-
voiceover:
|
|
18666
|
+
voiceover: z19.object({
|
|
18613
18667
|
// on_camera | mixed → mouths are on screen (lip-sync candidates);
|
|
18614
18668
|
// voiceover | none → narration over the picture (no lip-sync).
|
|
18615
|
-
mode:
|
|
18616
|
-
voice_description:
|
|
18617
|
-
persona:
|
|
18669
|
+
mode: z19.string().optional(),
|
|
18670
|
+
voice_description: z19.string().optional(),
|
|
18671
|
+
persona: z19.string().optional()
|
|
18618
18672
|
}).loose().optional(),
|
|
18619
18673
|
// Visual palette — read only to colour a clean brand-card/CTA plate (the
|
|
18620
18674
|
// first hex is the dominant brand colour); never to drive frame generation.
|
|
18621
|
-
style:
|
|
18675
|
+
style: z19.object({ palette: z19.array(z19.object({ hex: z19.string().optional() }).loose()).optional() }).loose().optional()
|
|
18622
18676
|
}).loose().optional(),
|
|
18623
|
-
scenes:
|
|
18677
|
+
scenes: z19.array(Scene).min(1)
|
|
18624
18678
|
}).loose();
|
|
18625
18679
|
function injectHookPhysicality(blueprint) {
|
|
18626
18680
|
for (const scene of blueprint.scenes) {
|
|
@@ -18637,26 +18691,26 @@ function clipIntentOf(scene, sceneIndex) {
|
|
|
18637
18691
|
if (/hero|reveal|product|payoff|transformation|result/.test(role) || scene.motion_level === "dynamic") return "hero";
|
|
18638
18692
|
return "body";
|
|
18639
18693
|
}
|
|
18640
|
-
var AppearsItem =
|
|
18641
|
-
var RecurringElement =
|
|
18694
|
+
var AppearsItem = z19.union([z19.number(), z19.object({ scene: z19.number(), edge: z19.string().optional() }).loose()]);
|
|
18695
|
+
var RecurringElement = z19.object({
|
|
18642
18696
|
// person | animal | product | logo | badge | other
|
|
18643
|
-
type:
|
|
18644
|
-
label:
|
|
18645
|
-
description:
|
|
18646
|
-
expression:
|
|
18697
|
+
type: z19.string(),
|
|
18698
|
+
label: z19.string().optional(),
|
|
18699
|
+
description: z19.string().optional(),
|
|
18700
|
+
expression: z19.string().nullable().optional(),
|
|
18647
18701
|
// When the element maps to a global cast entry, its stable id (for annotation).
|
|
18648
|
-
cast_id:
|
|
18702
|
+
cast_id: z19.string().nullable().optional(),
|
|
18649
18703
|
// The label of another element that is the SAME individual as this one, shown
|
|
18650
18704
|
// in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
|
|
18651
18705
|
// pink shirt and believer in a white shirt). Each look gets its own reference
|
|
18652
18706
|
// slot, but the face/identity must stay identical across them.
|
|
18653
|
-
same_as:
|
|
18707
|
+
same_as: z19.string().nullable().optional(),
|
|
18654
18708
|
// Scenes the element appears in. Either a bare list of scene indices (both
|
|
18655
18709
|
// edges) or per-{scene,edge} entries. Both forms are accepted and merged.
|
|
18656
|
-
scenes:
|
|
18657
|
-
appears_in:
|
|
18710
|
+
scenes: z19.array(z19.number()).optional(),
|
|
18711
|
+
appears_in: z19.array(AppearsItem).optional()
|
|
18658
18712
|
}).loose();
|
|
18659
|
-
var RecurringElements =
|
|
18713
|
+
var RecurringElements = z19.array(RecurringElement);
|
|
18660
18714
|
function sanitizeId(raw, fallback) {
|
|
18661
18715
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
18662
18716
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -19131,7 +19185,7 @@ function scrubFloatSentences(text, floatDescs) {
|
|
|
19131
19185
|
return kept;
|
|
19132
19186
|
}
|
|
19133
19187
|
function sceneFloatDescs(scene) {
|
|
19134
|
-
const floats =
|
|
19188
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
19135
19189
|
if (!floats.success) return [];
|
|
19136
19190
|
return floats.data.map((f) => f.description?.trim() ?? "").filter(Boolean);
|
|
19137
19191
|
}
|
|
@@ -20555,25 +20609,25 @@ function buildSfxMusic(blueprint, clock, nodes) {
|
|
|
20555
20609
|
}
|
|
20556
20610
|
return tracks;
|
|
20557
20611
|
}
|
|
20558
|
-
var OverlayStyle =
|
|
20559
|
-
var Overlay =
|
|
20560
|
-
text:
|
|
20561
|
-
appears_at_s:
|
|
20562
|
-
duration_s:
|
|
20563
|
-
position:
|
|
20564
|
-
role:
|
|
20565
|
-
animation:
|
|
20566
|
-
animation_detail:
|
|
20612
|
+
var OverlayStyle = z19.object({ color_hex: z19.string().optional(), background: z19.string().optional(), size: z19.string().optional() }).loose();
|
|
20613
|
+
var Overlay = z19.object({
|
|
20614
|
+
text: z19.string().optional(),
|
|
20615
|
+
appears_at_s: z19.number().optional(),
|
|
20616
|
+
duration_s: z19.number().optional(),
|
|
20617
|
+
position: z19.string().optional(),
|
|
20618
|
+
role: z19.string().optional(),
|
|
20619
|
+
animation: z19.string().optional(),
|
|
20620
|
+
animation_detail: z19.string().optional(),
|
|
20567
20621
|
style: OverlayStyle.optional()
|
|
20568
20622
|
}).loose();
|
|
20569
|
-
var FloatingElement =
|
|
20570
|
-
kind:
|
|
20571
|
-
description:
|
|
20572
|
-
brand_name:
|
|
20573
|
-
what_it_represents:
|
|
20574
|
-
appears_at_s:
|
|
20575
|
-
duration_s:
|
|
20576
|
-
position:
|
|
20623
|
+
var FloatingElement = z19.object({
|
|
20624
|
+
kind: z19.string().optional(),
|
|
20625
|
+
description: z19.string().optional(),
|
|
20626
|
+
brand_name: z19.string().nullish(),
|
|
20627
|
+
what_it_represents: z19.string().optional(),
|
|
20628
|
+
appears_at_s: z19.number().optional(),
|
|
20629
|
+
duration_s: z19.number().optional(),
|
|
20630
|
+
position: z19.string().optional()
|
|
20577
20631
|
}).loose();
|
|
20578
20632
|
function escapeHtml(s) {
|
|
20579
20633
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -20605,7 +20659,7 @@ function positionClass(position) {
|
|
|
20605
20659
|
function collectCaptions(blueprint, clock) {
|
|
20606
20660
|
return blueprint.scenes.flatMap((scene, i) => {
|
|
20607
20661
|
const sceneStart = scene.start_s ?? 0;
|
|
20608
|
-
const overlays =
|
|
20662
|
+
const overlays = z19.array(Overlay).safeParse(scene.overlays ?? []);
|
|
20609
20663
|
return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
|
|
20610
20664
|
const at = clock.map(i, ov.appears_at_s ?? sceneStart);
|
|
20611
20665
|
return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
|
|
@@ -20685,7 +20739,7 @@ function collectFloatWindows(blueprint, uiRouted, clock) {
|
|
|
20685
20739
|
const windows = /* @__PURE__ */ new Map();
|
|
20686
20740
|
blueprint.scenes.forEach((scene, i) => {
|
|
20687
20741
|
const sceneStart = scene.start_s ?? 0;
|
|
20688
|
-
const floats =
|
|
20742
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
20689
20743
|
if (!floats.success) return;
|
|
20690
20744
|
for (const fe of floats.data) {
|
|
20691
20745
|
const at = clock.map(i, fe.appears_at_s ?? sceneStart);
|
|
@@ -21133,8 +21187,8 @@ function buildMotionBoard(blueprint) {
|
|
|
21133
21187
|
const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
|
|
21134
21188
|
cursor = end_s;
|
|
21135
21189
|
const spoken = sceneSpokenText(scene);
|
|
21136
|
-
const overlays =
|
|
21137
|
-
const floats =
|
|
21190
|
+
const overlays = z19.array(Overlay).safeParse(scene.overlays ?? []);
|
|
21191
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
21138
21192
|
const graphics = [
|
|
21139
21193
|
...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
|
|
21140
21194
|
kind: "text",
|
|
@@ -22573,7 +22627,7 @@ import path18 from "path";
|
|
|
22573
22627
|
import { defineCommand as defineCommand95 } from "citty";
|
|
22574
22628
|
|
|
22575
22629
|
// src/engine/scaffold/staticAd.ts
|
|
22576
|
-
import { z as
|
|
22630
|
+
import { z as z20 } from "zod";
|
|
22577
22631
|
var GEN_ASPECT_RATIOS = /* @__PURE__ */ new Set(["1:1", "4:5", "9:16", "16:9", "4:3", "3:4", "2:3", "3:2", "21:9"]);
|
|
22578
22632
|
var DEFAULT_ASPECT_RATIO = "9:16";
|
|
22579
22633
|
var SHEET_SUBJECT_TYPE2 = {
|
|
@@ -22585,24 +22639,24 @@ var ACTOR_SHEET_IMAGE_SIZE = "4K";
|
|
|
22585
22639
|
var ADAPT_MODEL = "google/gemini-3-pro-image-preview";
|
|
22586
22640
|
var ADAPT_IMAGE_SIZE = "2K";
|
|
22587
22641
|
var ADAPT_GUIDANCE = "Keep the headline, logo, CTA, and hero subject fully visible in every ratio. Reproduce every text string verbatim \u2014 no dropped, added, or altered characters \u2014 and preserve the exact brand-color treatment (e.g. a black\u2192red word pivot), never flattening it.";
|
|
22588
|
-
var Blueprint =
|
|
22589
|
-
meta:
|
|
22590
|
-
text_content:
|
|
22642
|
+
var Blueprint = z20.object({
|
|
22643
|
+
meta: z20.object({ estimated_aspect_ratio: z20.string().optional() }).loose().optional(),
|
|
22644
|
+
text_content: z20.array(z20.object({ text: z20.string().optional() }).loose()).optional()
|
|
22591
22645
|
}).loose();
|
|
22592
|
-
var ElementLocator =
|
|
22593
|
-
collection:
|
|
22594
|
-
index:
|
|
22646
|
+
var ElementLocator = z20.object({
|
|
22647
|
+
collection: z20.enum(["subjects", "people", "brands_logos"]),
|
|
22648
|
+
index: z20.number().int().nonnegative()
|
|
22595
22649
|
}).loose();
|
|
22596
|
-
var MainElement =
|
|
22650
|
+
var MainElement = z20.object({
|
|
22597
22651
|
// logo | product | person | animal | badge | other
|
|
22598
|
-
type:
|
|
22599
|
-
label:
|
|
22600
|
-
description:
|
|
22601
|
-
expression:
|
|
22602
|
-
reason:
|
|
22652
|
+
type: z20.string(),
|
|
22653
|
+
label: z20.string().optional(),
|
|
22654
|
+
description: z20.string().optional(),
|
|
22655
|
+
expression: z20.string().nullable().optional(),
|
|
22656
|
+
reason: z20.string().optional(),
|
|
22603
22657
|
locator: ElementLocator.optional()
|
|
22604
22658
|
}).loose();
|
|
22605
|
-
var MainElements =
|
|
22659
|
+
var MainElements = z20.array(MainElement);
|
|
22606
22660
|
function sanitizeId2(raw, fallback) {
|
|
22607
22661
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
22608
22662
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -29162,7 +29216,24 @@ function parseBrandMd(brandMd, fonts, colors) {
|
|
|
29162
29216
|
if (named) for (const n of named) fonts.add(n.slice(1, -1).trim().toLowerCase());
|
|
29163
29217
|
}
|
|
29164
29218
|
}
|
|
29219
|
+
function brandTokensFromCanonical(tokens) {
|
|
29220
|
+
const fonts = new Set(tokens.fonts.map((f) => f.family.toLowerCase()));
|
|
29221
|
+
const colors = [];
|
|
29222
|
+
for (const color of tokens.colors) {
|
|
29223
|
+
const parsed = parseColor2(color.value);
|
|
29224
|
+
if (parsed) colors.push(parsed);
|
|
29225
|
+
}
|
|
29226
|
+
return { fonts, colors, hasTokens: fonts.size > 0 || colors.length > 0 };
|
|
29227
|
+
}
|
|
29165
29228
|
async function loadBrandTokens(projectRoot) {
|
|
29229
|
+
const tokensRaw = await safeRead(path24.join(projectRoot, "src", "brand", "tokens.json"));
|
|
29230
|
+
if (tokensRaw) {
|
|
29231
|
+
try {
|
|
29232
|
+
const canonical2 = brandTokensSchema.safeParse(JSON.parse(tokensRaw));
|
|
29233
|
+
if (canonical2.success) return brandTokensFromCanonical(canonical2.data);
|
|
29234
|
+
} catch {
|
|
29235
|
+
}
|
|
29236
|
+
}
|
|
29166
29237
|
const globalCss = await safeRead(path24.join(projectRoot, "src", "styles", "global.css"));
|
|
29167
29238
|
const brandMd = await safeRead(path24.join(projectRoot, "src", "brand", "BRAND.md"));
|
|
29168
29239
|
if (!globalCss && !brandMd) return EMPTY;
|