@koda-sl/baker-cli 0.163.0 → 0.165.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 +12 -2
- package/dist/cli.js +1596 -1405
- 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";
|
|
@@ -4489,7 +4531,13 @@ var GOOGLE_ADS_LIMITS = {
|
|
|
4489
4531
|
campaign: {
|
|
4490
4532
|
nameMax: 255,
|
|
4491
4533
|
/** `campaign.final_url_suffix` — the query string appended to every final URL under the campaign. */
|
|
4492
|
-
finalUrlSuffixMax: 2048
|
|
4534
|
+
finalUrlSuffixMax: 2048,
|
|
4535
|
+
/** `campaign.tracking_url_template` — the click-measurement URL every ad routes through. */
|
|
4536
|
+
trackingUrlTemplateMax: 2048,
|
|
4537
|
+
/** `campaign.url_custom_parameters` — Google caps a single entity at 8 `{_name}` parameters. */
|
|
4538
|
+
urlCustomParametersMax: 8,
|
|
4539
|
+
urlCustomParameterKeyMax: 16,
|
|
4540
|
+
urlCustomParameterValueMax: 250
|
|
4493
4541
|
},
|
|
4494
4542
|
adGroup: {
|
|
4495
4543
|
nameMax: 255
|
|
@@ -4609,6 +4657,8 @@ var BIDDING_STRATEGY_TYPES = [
|
|
|
4609
4657
|
"MANUAL_CPV",
|
|
4610
4658
|
"PERCENT_CPC"
|
|
4611
4659
|
];
|
|
4660
|
+
var POSITIVE_GEO_TARGET_TYPES = ["PRESENCE_OR_INTEREST", "PRESENCE"];
|
|
4661
|
+
var NEGATIVE_GEO_TARGET_TYPES = ["PRESENCE_OR_INTEREST", "PRESENCE"];
|
|
4612
4662
|
var BUDGET_DELIVERY_METHODS = ["STANDARD", "ACCELERATED"];
|
|
4613
4663
|
var AD_GROUP_TYPES = [
|
|
4614
4664
|
"SEARCH_STANDARD",
|
|
@@ -4690,38 +4740,55 @@ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
|
|
|
4690
4740
|
var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
|
|
4691
4741
|
|
|
4692
4742
|
// ../api/src/ads-google/ops.ts
|
|
4693
|
-
import { z as
|
|
4694
|
-
var tempRefSchema2 =
|
|
4695
|
-
var refSchema =
|
|
4696
|
-
|
|
4697
|
-
|
|
4743
|
+
import { z as z14 } from "zod";
|
|
4744
|
+
var tempRefSchema2 = z14.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
|
|
4745
|
+
var refSchema = z14.union([
|
|
4746
|
+
z14.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
|
|
4747
|
+
z14.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
|
|
4698
4748
|
tempRefSchema2
|
|
4699
4749
|
]);
|
|
4700
4750
|
var targetRefSchema = refSchema;
|
|
4701
|
-
var microsSchema =
|
|
4702
|
-
var httpsUrlSchema2 =
|
|
4703
|
-
var customerIdSchema =
|
|
4704
|
-
var stageableStatusSchema2 =
|
|
4705
|
-
var matchTypeSchema =
|
|
4706
|
-
var finalUrlSuffixSchema =
|
|
4707
|
-
var
|
|
4708
|
-
var
|
|
4709
|
-
|
|
4751
|
+
var microsSchema = z14.number().int().positive("expected a positive micros amount");
|
|
4752
|
+
var httpsUrlSchema2 = z14.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
|
|
4753
|
+
var customerIdSchema = z14.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
|
|
4754
|
+
var stageableStatusSchema2 = z14.enum(STAGEABLE_CREATE_STATUSES2);
|
|
4755
|
+
var matchTypeSchema = z14.enum(KEYWORD_MATCH_TYPES);
|
|
4756
|
+
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"');
|
|
4757
|
+
var LANDING_PAGE_TAGS = ["{lpurl}", "{unescapedlpurl}", "{escapedlpurl}", "{lpurl+2}", "{lpurl+3}"];
|
|
4758
|
+
var trackingUrlTemplateSchema = z14.string().max(GOOGLE_ADS_LIMITS.campaign.trackingUrlTemplateMax).refine((t) => !/\s/.test(t), "a tracking template cannot contain whitespace").refine(
|
|
4759
|
+
(t) => t === "" || LANDING_PAGE_TAGS.some((tag) => t.includes(tag)),
|
|
4760
|
+
`a tracking template must carry the landing page through one of ${LANDING_PAGE_TAGS.join(", ")}, e.g. "https://tracker.example/?url={lpurl}"`
|
|
4761
|
+
).refine(
|
|
4762
|
+
(t) => t === "" || /^(https?:\/\/|\{)/.test(t),
|
|
4763
|
+
"a tracking template must start with http://, https:// or a {lpurl} tag"
|
|
4764
|
+
);
|
|
4765
|
+
var urlCustomParametersSchema = z14.array(
|
|
4766
|
+
z14.strictObject({
|
|
4767
|
+
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"),
|
|
4768
|
+
value: z14.string().max(GOOGLE_ADS_LIMITS.campaign.urlCustomParameterValueMax)
|
|
4769
|
+
})
|
|
4770
|
+
).max(GOOGLE_ADS_LIMITS.campaign.urlCustomParametersMax).refine(
|
|
4771
|
+
(params) => new Set(params.map((p) => p.key)).size === params.length,
|
|
4772
|
+
"each custom parameter key can appear only once"
|
|
4773
|
+
);
|
|
4774
|
+
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");
|
|
4775
|
+
var budgetCreateSchema = z14.object({
|
|
4776
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
|
|
4710
4777
|
amountMicros: microsSchema,
|
|
4711
|
-
deliveryMethod:
|
|
4712
|
-
explicitlyShared:
|
|
4778
|
+
deliveryMethod: z14.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
|
|
4779
|
+
explicitlyShared: z14.boolean().default(false)
|
|
4713
4780
|
});
|
|
4714
|
-
var budgetUpdateSchema =
|
|
4715
|
-
name:
|
|
4781
|
+
var budgetUpdateSchema = z14.object({
|
|
4782
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
|
|
4716
4783
|
amountMicros: microsSchema.optional(),
|
|
4717
|
-
deliveryMethod:
|
|
4784
|
+
deliveryMethod: z14.enum(BUDGET_DELIVERY_METHODS).optional()
|
|
4718
4785
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4719
|
-
var biddingConfigSchema =
|
|
4720
|
-
type:
|
|
4786
|
+
var biddingConfigSchema = z14.object({
|
|
4787
|
+
type: z14.enum(BIDDING_STRATEGY_TYPES),
|
|
4721
4788
|
targetCpaMicros: microsSchema.optional(),
|
|
4722
|
-
targetRoas:
|
|
4789
|
+
targetRoas: z14.number().positive().optional(),
|
|
4723
4790
|
cpcBidCeilingMicros: microsSchema.optional(),
|
|
4724
|
-
enhancedCpcEnabled:
|
|
4791
|
+
enhancedCpcEnabled: z14.boolean().optional()
|
|
4725
4792
|
}).superRefine((p, ctx) => {
|
|
4726
4793
|
if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
|
|
4727
4794
|
ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
|
|
@@ -4730,33 +4797,49 @@ var biddingConfigSchema = z13.object({
|
|
|
4730
4797
|
ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
|
|
4731
4798
|
}
|
|
4732
4799
|
});
|
|
4733
|
-
var networkSettingsSchema =
|
|
4734
|
-
targetGoogleSearch:
|
|
4735
|
-
targetSearchNetwork:
|
|
4736
|
-
targetContentNetwork:
|
|
4737
|
-
targetPartnerSearchNetwork:
|
|
4800
|
+
var networkSettingsSchema = z14.object({
|
|
4801
|
+
targetGoogleSearch: z14.boolean().optional(),
|
|
4802
|
+
targetSearchNetwork: z14.boolean().optional(),
|
|
4803
|
+
targetContentNetwork: z14.boolean().optional(),
|
|
4804
|
+
targetPartnerSearchNetwork: z14.boolean().optional()
|
|
4738
4805
|
});
|
|
4739
|
-
var dateSchema =
|
|
4740
|
-
var
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4806
|
+
var dateSchema = z14.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
|
|
4807
|
+
var geoTargetTypeSettingSchema = z14.strictObject({
|
|
4808
|
+
positiveGeoTargetType: z14.enum(POSITIVE_GEO_TARGET_TYPES).optional(),
|
|
4809
|
+
negativeGeoTargetType: z14.enum(NEGATIVE_GEO_TARGET_TYPES).optional()
|
|
4810
|
+
}).refine(
|
|
4811
|
+
(p) => p.positiveGeoTargetType !== void 0 || p.negativeGeoTargetType !== void 0,
|
|
4812
|
+
"geoTargetTypeSetting needs positiveGeoTargetType and/or negativeGeoTargetType"
|
|
4813
|
+
);
|
|
4814
|
+
var campaignCreateSchema2 = z14.strictObject({
|
|
4815
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
|
|
4816
|
+
channelType: z14.enum(ADVERTISING_CHANNEL_TYPES),
|
|
4817
|
+
channelSubType: z14.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
|
|
4744
4818
|
budget: refSchema,
|
|
4745
4819
|
/** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
|
|
4746
4820
|
bidding: biddingConfigSchema.optional(),
|
|
4747
4821
|
biddingStrategy: refSchema.optional(),
|
|
4748
4822
|
networkSettings: networkSettingsSchema.optional(),
|
|
4823
|
+
/**
|
|
4824
|
+
* "Location options". Omitted stages Google's own default — reach people *in or interested in*
|
|
4825
|
+
* the targeted locations — so pass `PRESENCE` explicitly when only people physically there count.
|
|
4826
|
+
*/
|
|
4827
|
+
geoTargetTypeSetting: geoTargetTypeSettingSchema.optional(),
|
|
4749
4828
|
startDate: dateSchema.optional(),
|
|
4750
4829
|
endDate: dateSchema.optional(),
|
|
4751
4830
|
/** Campaign-level override of the account's final URL suffix — REPLACES it, never merges. */
|
|
4752
4831
|
finalUrlSuffix: finalUrlSuffixSchema.optional(),
|
|
4832
|
+
/** Campaign-level override of the account's tracking template — REPLACES it, never merges. */
|
|
4833
|
+
trackingUrlTemplate: trackingUrlTemplateSchema.optional(),
|
|
4834
|
+
/** The `{_name}` parameters this campaign's tracking template and final URLs can reference. */
|
|
4835
|
+
urlCustomParameters: urlCustomParametersSchema.optional(),
|
|
4753
4836
|
/** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
|
|
4754
|
-
objective:
|
|
4837
|
+
objective: z14.enum(CAMPAIGN_OBJECTIVES).optional(),
|
|
4755
4838
|
/**
|
|
4756
4839
|
* Whether the campaign contains EU political advertising. Google requires the declaration on
|
|
4757
4840
|
* every campaign create (FieldError.REQUIRED without it); omitted means it does not.
|
|
4758
4841
|
*/
|
|
4759
|
-
euPoliticalAds:
|
|
4842
|
+
euPoliticalAds: z14.boolean().optional(),
|
|
4760
4843
|
status: stageableStatusSchema2.default("PAUSED")
|
|
4761
4844
|
}).superRefine((p, ctx) => {
|
|
4762
4845
|
if (!p.bidding && !p.biddingStrategy) {
|
|
@@ -4780,140 +4863,146 @@ var campaignCreateSchema2 = z13.object({
|
|
|
4780
4863
|
ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
|
|
4781
4864
|
}
|
|
4782
4865
|
});
|
|
4783
|
-
var campaignUpdateSchema2 =
|
|
4784
|
-
name:
|
|
4866
|
+
var campaignUpdateSchema2 = z14.strictObject({
|
|
4867
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
|
|
4785
4868
|
budget: refSchema.optional(),
|
|
4786
4869
|
bidding: biddingConfigSchema.optional(),
|
|
4787
4870
|
networkSettings: networkSettingsSchema.optional(),
|
|
4871
|
+
/** Switches an existing campaign between "Presence or interest" and "Presence". */
|
|
4872
|
+
geoTargetTypeSetting: geoTargetTypeSettingSchema.optional(),
|
|
4788
4873
|
startDate: dateSchema.optional(),
|
|
4789
4874
|
endDate: dateSchema.optional(),
|
|
4790
4875
|
/** Campaign-level override of the account's final URL suffix. `""` clears it back to the account value. */
|
|
4791
4876
|
finalUrlSuffix: finalUrlSuffixSchema.optional(),
|
|
4877
|
+
/** Campaign-level tracking template. `""` clears it back to the account value. */
|
|
4878
|
+
trackingUrlTemplate: trackingUrlTemplateSchema.optional(),
|
|
4879
|
+
/** Replaces the campaign's custom parameters wholesale; `[]` removes them all. */
|
|
4880
|
+
urlCustomParameters: urlCustomParametersSchema.optional(),
|
|
4792
4881
|
/** Corrects the campaign's EU political advertising declaration (true = contains, false = does not). */
|
|
4793
|
-
euPoliticalAds:
|
|
4794
|
-
status:
|
|
4882
|
+
euPoliticalAds: z14.boolean().optional(),
|
|
4883
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4795
4884
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4796
|
-
var adGroupCreateSchema =
|
|
4797
|
-
name:
|
|
4885
|
+
var adGroupCreateSchema = z14.object({
|
|
4886
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
|
|
4798
4887
|
campaign: refSchema,
|
|
4799
|
-
type:
|
|
4888
|
+
type: z14.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
|
|
4800
4889
|
cpcBidMicros: microsSchema.optional(),
|
|
4801
4890
|
status: stageableStatusSchema2.default("PAUSED")
|
|
4802
4891
|
});
|
|
4803
|
-
var adGroupUpdateSchema =
|
|
4804
|
-
name:
|
|
4892
|
+
var adGroupUpdateSchema = z14.object({
|
|
4893
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
|
|
4805
4894
|
cpcBidMicros: microsSchema.optional(),
|
|
4806
|
-
status:
|
|
4895
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4807
4896
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4808
|
-
var keywordAddSchema =
|
|
4897
|
+
var keywordAddSchema = z14.object({
|
|
4809
4898
|
adGroup: refSchema,
|
|
4810
4899
|
text: keywordTextSchema,
|
|
4811
4900
|
matchType: matchTypeSchema,
|
|
4812
4901
|
cpcBidMicros: microsSchema.optional(),
|
|
4813
|
-
finalUrls:
|
|
4902
|
+
finalUrls: z14.array(httpsUrlSchema2).optional(),
|
|
4814
4903
|
status: stageableStatusSchema2.default("ENABLED")
|
|
4815
4904
|
});
|
|
4816
|
-
var keywordUpdateSchema =
|
|
4905
|
+
var keywordUpdateSchema = z14.object({
|
|
4817
4906
|
cpcBidMicros: microsSchema.optional(),
|
|
4818
|
-
finalUrls:
|
|
4819
|
-
status:
|
|
4907
|
+
finalUrls: z14.array(httpsUrlSchema2).optional(),
|
|
4908
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4820
4909
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4821
|
-
var negativeKeywordAddSchema =
|
|
4822
|
-
level:
|
|
4910
|
+
var negativeKeywordAddSchema = z14.object({
|
|
4911
|
+
level: z14.enum(["adGroup", "campaign"]),
|
|
4823
4912
|
parent: refSchema,
|
|
4824
4913
|
text: keywordTextSchema,
|
|
4825
4914
|
matchType: matchTypeSchema
|
|
4826
4915
|
});
|
|
4827
|
-
var sharedSetCreateSchema =
|
|
4828
|
-
name:
|
|
4829
|
-
type:
|
|
4916
|
+
var sharedSetCreateSchema = z14.object({
|
|
4917
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
|
|
4918
|
+
type: z14.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
|
|
4830
4919
|
});
|
|
4831
|
-
var sharedSetMemberAddSchema =
|
|
4920
|
+
var sharedSetMemberAddSchema = z14.object({
|
|
4832
4921
|
sharedSet: refSchema,
|
|
4833
4922
|
text: keywordTextSchema,
|
|
4834
4923
|
matchType: matchTypeSchema
|
|
4835
4924
|
});
|
|
4836
|
-
var campaignSharedSetAttachSchema =
|
|
4925
|
+
var campaignSharedSetAttachSchema = z14.object({
|
|
4837
4926
|
campaign: refSchema,
|
|
4838
4927
|
sharedSet: refSchema
|
|
4839
4928
|
});
|
|
4840
|
-
var adTextAssetSchema =
|
|
4841
|
-
text:
|
|
4842
|
-
pinnedField:
|
|
4929
|
+
var adTextAssetSchema = z14.object({
|
|
4930
|
+
text: z14.string().min(1),
|
|
4931
|
+
pinnedField: z14.enum(PINNED_FIELDS).optional()
|
|
4843
4932
|
});
|
|
4844
|
-
var responsiveSearchAdSchema =
|
|
4845
|
-
format:
|
|
4846
|
-
headlines:
|
|
4933
|
+
var responsiveSearchAdSchema = z14.strictObject({
|
|
4934
|
+
format: z14.literal("responsiveSearch"),
|
|
4935
|
+
headlines: z14.array(
|
|
4847
4936
|
adTextAssetSchema.refine(
|
|
4848
4937
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
|
|
4849
4938
|
"headline exceeds 30 chars"
|
|
4850
4939
|
)
|
|
4851
4940
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
|
|
4852
|
-
descriptions:
|
|
4941
|
+
descriptions: z14.array(
|
|
4853
4942
|
adTextAssetSchema.refine(
|
|
4854
4943
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
|
|
4855
4944
|
"description exceeds 90 chars"
|
|
4856
4945
|
)
|
|
4857
4946
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
|
|
4858
|
-
path1:
|
|
4859
|
-
path2:
|
|
4860
|
-
finalUrls:
|
|
4861
|
-
});
|
|
4862
|
-
var responsiveDisplayAdSchema =
|
|
4863
|
-
format:
|
|
4864
|
-
headlines:
|
|
4865
|
-
longHeadline:
|
|
4866
|
-
descriptions:
|
|
4867
|
-
businessName:
|
|
4947
|
+
path1: z14.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4948
|
+
path2: z14.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4949
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4950
|
+
});
|
|
4951
|
+
var responsiveDisplayAdSchema = z14.strictObject({
|
|
4952
|
+
format: z14.literal("responsiveDisplay"),
|
|
4953
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
|
|
4954
|
+
longHeadline: z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
|
|
4955
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
|
|
4956
|
+
businessName: z14.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
|
|
4868
4957
|
// A Responsive Display Ad's images are fields on the ad's own content (never campaign-level
|
|
4869
4958
|
// asset links). Google requires ≥1 landscape marketing image (1.91:1) AND ≥1 square marketing
|
|
4870
4959
|
// image (1:1) to serve; the logo images are optional.
|
|
4871
|
-
marketingImageAssets:
|
|
4872
|
-
squareMarketingImageAssets:
|
|
4873
|
-
logoImageAssets:
|
|
4874
|
-
finalUrls:
|
|
4875
|
-
});
|
|
4876
|
-
var callAdSchema =
|
|
4877
|
-
format:
|
|
4878
|
-
countryCode:
|
|
4879
|
-
phoneNumber:
|
|
4880
|
-
headline1:
|
|
4881
|
-
headline2:
|
|
4882
|
-
description1:
|
|
4883
|
-
description2:
|
|
4884
|
-
businessName:
|
|
4885
|
-
finalUrls:
|
|
4886
|
-
});
|
|
4887
|
-
var appAdSchema =
|
|
4888
|
-
format:
|
|
4889
|
-
headlines:
|
|
4890
|
-
descriptions:
|
|
4960
|
+
marketingImageAssets: z14.array(refSchema).optional(),
|
|
4961
|
+
squareMarketingImageAssets: z14.array(refSchema).optional(),
|
|
4962
|
+
logoImageAssets: z14.array(refSchema).optional(),
|
|
4963
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4964
|
+
});
|
|
4965
|
+
var callAdSchema = z14.strictObject({
|
|
4966
|
+
format: z14.literal("call"),
|
|
4967
|
+
countryCode: z14.string().length(2),
|
|
4968
|
+
phoneNumber: z14.string().min(3),
|
|
4969
|
+
headline1: z14.string().min(1).max(30),
|
|
4970
|
+
headline2: z14.string().min(1).max(30),
|
|
4971
|
+
description1: z14.string().min(1).max(90),
|
|
4972
|
+
description2: z14.string().min(1).max(90),
|
|
4973
|
+
businessName: z14.string().min(1).max(25),
|
|
4974
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4975
|
+
});
|
|
4976
|
+
var appAdSchema = z14.strictObject({
|
|
4977
|
+
format: z14.literal("app"),
|
|
4978
|
+
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),
|
|
4979
|
+
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),
|
|
4891
4980
|
// An App campaign ad carries its images on its own content (`AppAdInfo.images`), not as
|
|
4892
4981
|
// campaign-level asset links — same shape as a responsive display ad's marketing images.
|
|
4893
|
-
images:
|
|
4982
|
+
images: z14.array(refSchema).max(GOOGLE_ADS_LIMITS.appAd.imagesMax).optional(),
|
|
4894
4983
|
// `AppAdInfo.youtube_videos` — an App ad's videos live on its content too. Without this field
|
|
4895
4984
|
// there is no way to express "keep these videos on the ad", so a content update that only
|
|
4896
4985
|
// restated headlines silently left the ad's videos to whatever the mask happened to omit.
|
|
4897
|
-
youtubeVideos:
|
|
4986
|
+
youtubeVideos: z14.array(refSchema).max(GOOGLE_ADS_LIMITS.appAd.youtubeVideosMax).optional()
|
|
4898
4987
|
});
|
|
4899
|
-
var videoAdSchema =
|
|
4900
|
-
format:
|
|
4988
|
+
var videoAdSchema = z14.strictObject({
|
|
4989
|
+
format: z14.literal("video"),
|
|
4901
4990
|
// A raw YouTube id is not a publishable Google Ads reference — the video must be staged as
|
|
4902
4991
|
// its own `google.asset.create` (type: youtubeVideo) first, then referenced here by asset ref.
|
|
4903
|
-
videoAssets:
|
|
4904
|
-
finalUrls:
|
|
4905
|
-
});
|
|
4906
|
-
var demandGenAdSchema =
|
|
4907
|
-
format:
|
|
4908
|
-
headlines:
|
|
4909
|
-
descriptions:
|
|
4910
|
-
businessName:
|
|
4911
|
-
finalUrls:
|
|
4912
|
-
imageAssets:
|
|
4913
|
-
squareImageAssets:
|
|
4914
|
-
logoImageAssets:
|
|
4915
|
-
});
|
|
4916
|
-
var adContentSchema2 =
|
|
4992
|
+
videoAssets: z14.array(refSchema).min(1),
|
|
4993
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
4994
|
+
});
|
|
4995
|
+
var demandGenAdSchema = z14.strictObject({
|
|
4996
|
+
format: z14.literal("demandGen"),
|
|
4997
|
+
headlines: z14.array(z14.object({ text: z14.string().min(1).max(40) })).min(1).max(5),
|
|
4998
|
+
descriptions: z14.array(z14.object({ text: z14.string().min(1).max(90) })).min(1).max(5),
|
|
4999
|
+
businessName: z14.string().min(1).max(25),
|
|
5000
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1),
|
|
5001
|
+
imageAssets: z14.array(refSchema).optional(),
|
|
5002
|
+
squareImageAssets: z14.array(refSchema).optional(),
|
|
5003
|
+
logoImageAssets: z14.array(refSchema).optional()
|
|
5004
|
+
});
|
|
5005
|
+
var adContentSchema2 = z14.discriminatedUnion("format", [
|
|
4917
5006
|
responsiveSearchAdSchema,
|
|
4918
5007
|
responsiveDisplayAdSchema,
|
|
4919
5008
|
callAdSchema,
|
|
@@ -4921,45 +5010,45 @@ var adContentSchema2 = z13.discriminatedUnion("format", [
|
|
|
4921
5010
|
videoAdSchema,
|
|
4922
5011
|
demandGenAdSchema
|
|
4923
5012
|
]);
|
|
4924
|
-
var adCreateSchema =
|
|
5013
|
+
var adCreateSchema = z14.object({
|
|
4925
5014
|
adGroup: refSchema,
|
|
4926
5015
|
status: stageableStatusSchema2.default("PAUSED"),
|
|
4927
5016
|
content: adContentSchema2
|
|
4928
5017
|
});
|
|
4929
|
-
var adUpdateSchema =
|
|
4930
|
-
status:
|
|
5018
|
+
var adUpdateSchema = z14.object({
|
|
5019
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
|
|
4931
5020
|
/** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
|
|
4932
|
-
content:
|
|
5021
|
+
content: z14.record(z14.string(), z14.unknown()).optional()
|
|
4933
5022
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4934
|
-
var textAssetSchema =
|
|
4935
|
-
var imageAssetSchema =
|
|
4936
|
-
type:
|
|
4937
|
-
imageId:
|
|
4938
|
-
name:
|
|
4939
|
-
});
|
|
4940
|
-
var youtubeVideoAssetSchema =
|
|
4941
|
-
type:
|
|
4942
|
-
youtubeVideoId:
|
|
4943
|
-
name:
|
|
4944
|
-
});
|
|
4945
|
-
var sitelinkAssetSchema =
|
|
4946
|
-
type:
|
|
4947
|
-
linkText:
|
|
4948
|
-
description1:
|
|
4949
|
-
description2:
|
|
4950
|
-
finalUrls:
|
|
4951
|
-
});
|
|
4952
|
-
var calloutAssetSchema =
|
|
4953
|
-
type:
|
|
4954
|
-
calloutText:
|
|
4955
|
-
});
|
|
4956
|
-
var structuredSnippetAssetSchema =
|
|
4957
|
-
type:
|
|
4958
|
-
header:
|
|
4959
|
-
values:
|
|
4960
|
-
});
|
|
4961
|
-
var callToActionAssetSchema =
|
|
4962
|
-
var assetCreateSchema =
|
|
5023
|
+
var textAssetSchema = z14.object({ type: z14.literal("text"), text: z14.string().min(1) });
|
|
5024
|
+
var imageAssetSchema = z14.object({
|
|
5025
|
+
type: z14.literal("image"),
|
|
5026
|
+
imageId: z14.string().min(1),
|
|
5027
|
+
name: z14.string().optional()
|
|
5028
|
+
});
|
|
5029
|
+
var youtubeVideoAssetSchema = z14.object({
|
|
5030
|
+
type: z14.literal("youtubeVideo"),
|
|
5031
|
+
youtubeVideoId: z14.string().min(1),
|
|
5032
|
+
name: z14.string().optional()
|
|
5033
|
+
});
|
|
5034
|
+
var sitelinkAssetSchema = z14.object({
|
|
5035
|
+
type: z14.literal("sitelink"),
|
|
5036
|
+
linkText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
|
|
5037
|
+
description1: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5038
|
+
description2: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5039
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1)
|
|
5040
|
+
});
|
|
5041
|
+
var calloutAssetSchema = z14.object({
|
|
5042
|
+
type: z14.literal("callout"),
|
|
5043
|
+
calloutText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
|
|
5044
|
+
});
|
|
5045
|
+
var structuredSnippetAssetSchema = z14.object({
|
|
5046
|
+
type: z14.literal("structuredSnippet"),
|
|
5047
|
+
header: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
|
|
5048
|
+
values: z14.array(z14.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
|
|
5049
|
+
});
|
|
5050
|
+
var callToActionAssetSchema = z14.object({ type: z14.literal("callToAction"), callToAction: z14.string().min(1) });
|
|
5051
|
+
var assetCreateSchema = z14.discriminatedUnion("type", [
|
|
4963
5052
|
textAssetSchema,
|
|
4964
5053
|
imageAssetSchema,
|
|
4965
5054
|
youtubeVideoAssetSchema,
|
|
@@ -4968,136 +5057,136 @@ var assetCreateSchema = z13.discriminatedUnion("type", [
|
|
|
4968
5057
|
structuredSnippetAssetSchema,
|
|
4969
5058
|
callToActionAssetSchema
|
|
4970
5059
|
]);
|
|
4971
|
-
var assetUpdateSchema =
|
|
4972
|
-
name:
|
|
4973
|
-
linkText:
|
|
4974
|
-
description1:
|
|
4975
|
-
description2:
|
|
4976
|
-
finalUrls:
|
|
4977
|
-
calloutText:
|
|
4978
|
-
header:
|
|
4979
|
-
values:
|
|
4980
|
-
callToAction:
|
|
4981
|
-
text:
|
|
5060
|
+
var assetUpdateSchema = z14.object({
|
|
5061
|
+
name: z14.string().min(1).optional(),
|
|
5062
|
+
linkText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax).optional(),
|
|
5063
|
+
description1: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5064
|
+
description2: z14.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
5065
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1).optional(),
|
|
5066
|
+
calloutText: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax).optional(),
|
|
5067
|
+
header: z14.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax).optional(),
|
|
5068
|
+
values: z14.array(z14.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
|
|
5069
|
+
callToAction: z14.string().min(1).optional(),
|
|
5070
|
+
text: z14.string().min(1).optional()
|
|
4982
5071
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4983
|
-
var assetLinkAttachSchema =
|
|
4984
|
-
level:
|
|
5072
|
+
var assetLinkAttachSchema = z14.object({
|
|
5073
|
+
level: z14.enum(["campaign", "adGroup", "customer"]),
|
|
4985
5074
|
parent: refSchema.optional(),
|
|
4986
5075
|
asset: refSchema,
|
|
4987
|
-
fieldType:
|
|
5076
|
+
fieldType: z14.enum(ASSET_FIELD_TYPES)
|
|
4988
5077
|
}).superRefine((value, ctx) => {
|
|
4989
5078
|
if (value.level !== "customer" && !value.parent) {
|
|
4990
5079
|
ctx.addIssue({
|
|
4991
|
-
code:
|
|
5080
|
+
code: z14.ZodIssueCode.custom,
|
|
4992
5081
|
path: ["parent"],
|
|
4993
5082
|
message: `parent is required for a ${value.level}-level asset link (--parent-ref)`
|
|
4994
5083
|
});
|
|
4995
5084
|
}
|
|
4996
5085
|
});
|
|
4997
|
-
var assetGroupCreateSchema =
|
|
5086
|
+
var assetGroupCreateSchema = z14.object({
|
|
4998
5087
|
campaign: refSchema,
|
|
4999
|
-
name:
|
|
5000
|
-
finalUrls:
|
|
5001
|
-
headlines:
|
|
5002
|
-
longHeadlines:
|
|
5003
|
-
descriptions:
|
|
5004
|
-
businessName:
|
|
5005
|
-
imageAssets:
|
|
5006
|
-
squareImageAssets:
|
|
5007
|
-
logoAssets:
|
|
5008
|
-
status:
|
|
5009
|
-
});
|
|
5010
|
-
var assetGroupUpdateSchema =
|
|
5011
|
-
name:
|
|
5012
|
-
finalUrls:
|
|
5013
|
-
status:
|
|
5088
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax),
|
|
5089
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1),
|
|
5090
|
+
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),
|
|
5091
|
+
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),
|
|
5092
|
+
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),
|
|
5093
|
+
businessName: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.businessNameMax),
|
|
5094
|
+
imageAssets: z14.array(refSchema).optional(),
|
|
5095
|
+
squareImageAssets: z14.array(refSchema).optional(),
|
|
5096
|
+
logoAssets: z14.array(refSchema).optional(),
|
|
5097
|
+
status: z14.enum(["ENABLED", "PAUSED"]).default("PAUSED")
|
|
5098
|
+
});
|
|
5099
|
+
var assetGroupUpdateSchema = z14.object({
|
|
5100
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax).optional(),
|
|
5101
|
+
finalUrls: z14.array(httpsUrlSchema2).min(1).optional(),
|
|
5102
|
+
status: z14.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
5014
5103
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5015
|
-
var audienceCreateSchema2 =
|
|
5016
|
-
name:
|
|
5017
|
-
type:
|
|
5018
|
-
description:
|
|
5104
|
+
var audienceCreateSchema2 = z14.object({
|
|
5105
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
|
|
5106
|
+
type: z14.enum(USER_LIST_TYPES).default("BASIC"),
|
|
5107
|
+
description: z14.string().optional(),
|
|
5019
5108
|
/** Customer-match members (crm-based) — file-first for large lists. */
|
|
5020
|
-
members:
|
|
5021
|
-
sourceFileRef:
|
|
5109
|
+
members: z14.array(z14.record(z14.string(), z14.string())).optional(),
|
|
5110
|
+
sourceFileRef: z14.string().optional()
|
|
5022
5111
|
});
|
|
5023
|
-
var audienceCriterionAttachSchema =
|
|
5024
|
-
level:
|
|
5112
|
+
var audienceCriterionAttachSchema = z14.object({
|
|
5113
|
+
level: z14.enum(["campaign", "adGroup"]),
|
|
5025
5114
|
parent: refSchema,
|
|
5026
5115
|
userList: refSchema,
|
|
5027
|
-
negative:
|
|
5116
|
+
negative: z14.boolean().default(false)
|
|
5028
5117
|
});
|
|
5029
|
-
var conversionActionCreateSchema =
|
|
5030
|
-
name:
|
|
5031
|
-
type:
|
|
5032
|
-
category:
|
|
5033
|
-
countingType:
|
|
5118
|
+
var conversionActionCreateSchema = z14.object({
|
|
5119
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
|
|
5120
|
+
type: z14.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
|
|
5121
|
+
category: z14.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
|
|
5122
|
+
countingType: z14.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
|
|
5034
5123
|
defaultValueMicros: microsSchema.optional(),
|
|
5035
|
-
defaultCurrencyCode:
|
|
5036
|
-
clickThroughLookbackWindowDays:
|
|
5037
|
-
viewThroughLookbackWindowDays:
|
|
5038
|
-
status:
|
|
5039
|
-
});
|
|
5040
|
-
var conversionActionUpdateSchema =
|
|
5041
|
-
name:
|
|
5042
|
-
category:
|
|
5043
|
-
countingType:
|
|
5124
|
+
defaultCurrencyCode: z14.string().length(3).optional(),
|
|
5125
|
+
clickThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5126
|
+
viewThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5127
|
+
status: z14.enum(["ENABLED", "PAUSED"]).default("ENABLED")
|
|
5128
|
+
});
|
|
5129
|
+
var conversionActionUpdateSchema = z14.object({
|
|
5130
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
|
|
5131
|
+
category: z14.enum(CONVERSION_ACTION_CATEGORIES).optional(),
|
|
5132
|
+
countingType: z14.enum(CONVERSION_COUNTING_TYPES).optional(),
|
|
5044
5133
|
defaultValueMicros: microsSchema.optional(),
|
|
5045
|
-
defaultCurrencyCode:
|
|
5046
|
-
clickThroughLookbackWindowDays:
|
|
5047
|
-
viewThroughLookbackWindowDays:
|
|
5048
|
-
status:
|
|
5134
|
+
defaultCurrencyCode: z14.string().length(3).optional(),
|
|
5135
|
+
clickThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5136
|
+
viewThroughLookbackWindowDays: z14.number().int().positive().optional(),
|
|
5137
|
+
status: z14.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
|
|
5049
5138
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5050
|
-
var biddingStrategyCreateSchema =
|
|
5051
|
-
name:
|
|
5139
|
+
var biddingStrategyCreateSchema = z14.object({
|
|
5140
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
|
|
5052
5141
|
config: biddingConfigSchema
|
|
5053
5142
|
}).superRefine((p, ctx) => {
|
|
5054
5143
|
if (p.config.type === "MANUAL_CPC") {
|
|
5055
5144
|
ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
|
|
5056
5145
|
}
|
|
5057
5146
|
});
|
|
5058
|
-
var biddingStrategyUpdateSchema =
|
|
5059
|
-
name:
|
|
5147
|
+
var biddingStrategyUpdateSchema = z14.object({
|
|
5148
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
|
|
5060
5149
|
config: biddingConfigSchema.optional()
|
|
5061
5150
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
5062
|
-
var labelCreateSchema =
|
|
5063
|
-
name:
|
|
5064
|
-
backgroundColor:
|
|
5065
|
-
description:
|
|
5151
|
+
var labelCreateSchema = z14.object({
|
|
5152
|
+
name: z14.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
|
|
5153
|
+
backgroundColor: z14.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
|
|
5154
|
+
description: z14.string().optional()
|
|
5066
5155
|
});
|
|
5067
|
-
var labelAttachSchema =
|
|
5068
|
-
level:
|
|
5156
|
+
var labelAttachSchema = z14.object({
|
|
5157
|
+
level: z14.enum(["campaign", "adGroup", "ad"]),
|
|
5069
5158
|
parent: refSchema,
|
|
5070
5159
|
label: refSchema
|
|
5071
5160
|
});
|
|
5072
|
-
var locationCriterionSchema =
|
|
5073
|
-
criterionType:
|
|
5074
|
-
geoTargetConstant:
|
|
5075
|
-
});
|
|
5076
|
-
var languageCriterionSchema =
|
|
5077
|
-
criterionType:
|
|
5078
|
-
languageConstant:
|
|
5079
|
-
});
|
|
5080
|
-
var adScheduleCriterionSchema =
|
|
5081
|
-
criterionType:
|
|
5082
|
-
dayOfWeek:
|
|
5083
|
-
startHour:
|
|
5084
|
-
startMinute:
|
|
5085
|
-
endHour:
|
|
5086
|
-
endMinute:
|
|
5087
|
-
});
|
|
5088
|
-
var deviceCriterionSchema =
|
|
5089
|
-
criterionType:
|
|
5090
|
-
device:
|
|
5161
|
+
var locationCriterionSchema = z14.object({
|
|
5162
|
+
criterionType: z14.literal("location"),
|
|
5163
|
+
geoTargetConstant: z14.union([z14.string().regex(GEO_TARGET_CONSTANT_REGEX), z14.string().regex(NUMERIC_ID_REGEX2)])
|
|
5164
|
+
});
|
|
5165
|
+
var languageCriterionSchema = z14.object({
|
|
5166
|
+
criterionType: z14.literal("language"),
|
|
5167
|
+
languageConstant: z14.union([z14.string().regex(LANGUAGE_CONSTANT_REGEX), z14.string().regex(NUMERIC_ID_REGEX2)])
|
|
5168
|
+
});
|
|
5169
|
+
var adScheduleCriterionSchema = z14.object({
|
|
5170
|
+
criterionType: z14.literal("adSchedule"),
|
|
5171
|
+
dayOfWeek: z14.enum(DAYS_OF_WEEK),
|
|
5172
|
+
startHour: z14.number().int().min(0).max(23),
|
|
5173
|
+
startMinute: z14.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
|
|
5174
|
+
endHour: z14.number().int().min(0).max(24),
|
|
5175
|
+
endMinute: z14.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
|
|
5176
|
+
});
|
|
5177
|
+
var deviceCriterionSchema = z14.object({
|
|
5178
|
+
criterionType: z14.literal("device"),
|
|
5179
|
+
device: z14.enum(DEVICE_TYPES),
|
|
5091
5180
|
// Google's `CampaignCriterion.bid_modifier`: "The modifier must be in the range 0.1 - 10.0. Use 0
|
|
5092
5181
|
// 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.
|
|
5093
|
-
bidModifier:
|
|
5182
|
+
bidModifier: z14.number().min(0).max(10).optional().refine((v) => v === void 0 || v === 0 || v >= 0.1, {
|
|
5094
5183
|
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
5095
5184
|
})
|
|
5096
5185
|
});
|
|
5097
|
-
var campaignCriterionAddSchema =
|
|
5186
|
+
var campaignCriterionAddSchema = z14.object({
|
|
5098
5187
|
campaign: refSchema,
|
|
5099
|
-
negative:
|
|
5100
|
-
criterion:
|
|
5188
|
+
negative: z14.boolean().default(false),
|
|
5189
|
+
criterion: z14.discriminatedUnion("criterionType", [
|
|
5101
5190
|
locationCriterionSchema,
|
|
5102
5191
|
languageCriterionSchema,
|
|
5103
5192
|
adScheduleCriterionSchema,
|
|
@@ -5107,7 +5196,7 @@ var campaignCriterionAddSchema = z13.object({
|
|
|
5107
5196
|
const c = val.criterion;
|
|
5108
5197
|
if (c.criterionType === "adSchedule" && c.endHour === 24 && c.endMinute !== "ZERO") {
|
|
5109
5198
|
ctx.addIssue({
|
|
5110
|
-
code:
|
|
5199
|
+
code: z14.ZodIssueCode.custom,
|
|
5111
5200
|
message: "endHour 24 (midnight) cannot have a non-zero endMinute",
|
|
5112
5201
|
path: ["criterion", "endMinute"]
|
|
5113
5202
|
});
|
|
@@ -5159,17 +5248,17 @@ var GOOGLE_DRAFT_OP_KINDS = [
|
|
|
5159
5248
|
"google.campaignCriterion.add",
|
|
5160
5249
|
"google.campaignCriterion.remove"
|
|
5161
5250
|
];
|
|
5162
|
-
var googleDraftOpKindSchema =
|
|
5251
|
+
var googleDraftOpKindSchema = z14.enum(GOOGLE_DRAFT_OP_KINDS);
|
|
5163
5252
|
function createOp2(kind, payload) {
|
|
5164
|
-
return
|
|
5253
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, payload });
|
|
5165
5254
|
}
|
|
5166
5255
|
function updateOp2(kind, payload) {
|
|
5167
|
-
return
|
|
5256
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
|
|
5168
5257
|
}
|
|
5169
5258
|
function targetOp(kind) {
|
|
5170
|
-
return
|
|
5259
|
+
return z14.object({ kind: z14.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
|
|
5171
5260
|
}
|
|
5172
|
-
var googleDraftOpInputSchema =
|
|
5261
|
+
var googleDraftOpInputSchema = z14.discriminatedUnion("kind", [
|
|
5173
5262
|
createOp2("google.budget.create", budgetCreateSchema),
|
|
5174
5263
|
updateOp2("google.budget.update", budgetUpdateSchema),
|
|
5175
5264
|
createOp2("google.campaign.create", campaignCreateSchema2),
|
|
@@ -5217,48 +5306,48 @@ var googleDraftOpInputSchema = z13.discriminatedUnion("kind", [
|
|
|
5217
5306
|
]);
|
|
5218
5307
|
|
|
5219
5308
|
// ../api/src/ads-google/url-options.ts
|
|
5220
|
-
import { z as
|
|
5309
|
+
import { z as z15 } from "zod";
|
|
5221
5310
|
var URL_OPTION_LEVELS = ["account", "campaign", "ad_group", "ad"];
|
|
5222
|
-
var googleUrlOptionValueSchema =
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5311
|
+
var googleUrlOptionValueSchema = z15.discriminatedUnion("state", [
|
|
5312
|
+
z15.object({ state: z15.literal("set"), value: z15.string() }),
|
|
5313
|
+
z15.object({ state: z15.literal("not_set") }),
|
|
5314
|
+
z15.object({ state: z15.literal("not_read"), reason: z15.string() })
|
|
5226
5315
|
]);
|
|
5227
|
-
var googleUrlOptionsRequestSchema =
|
|
5228
|
-
customerId:
|
|
5229
|
-
managerId:
|
|
5316
|
+
var googleUrlOptionsRequestSchema = z15.object({
|
|
5317
|
+
customerId: z15.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id"),
|
|
5318
|
+
managerId: z15.string().optional(),
|
|
5230
5319
|
/** Compact by default: only campaigns that actually override the account. `full` lists every campaign. */
|
|
5231
|
-
full:
|
|
5232
|
-
skipCache:
|
|
5320
|
+
full: z15.boolean().optional(),
|
|
5321
|
+
skipCache: z15.boolean().optional()
|
|
5233
5322
|
});
|
|
5234
|
-
var googleUrlOptionsCampaignSchema =
|
|
5235
|
-
id:
|
|
5236
|
-
name:
|
|
5237
|
-
status:
|
|
5323
|
+
var googleUrlOptionsCampaignSchema = z15.object({
|
|
5324
|
+
id: z15.string(),
|
|
5325
|
+
name: z15.string(),
|
|
5326
|
+
status: z15.string(),
|
|
5238
5327
|
final_url_suffix: googleUrlOptionValueSchema,
|
|
5239
5328
|
tracking_url_template: googleUrlOptionValueSchema
|
|
5240
5329
|
});
|
|
5241
|
-
var googleUrlOptionsResponseSchema =
|
|
5242
|
-
customer_id:
|
|
5243
|
-
account:
|
|
5244
|
-
level:
|
|
5245
|
-
read:
|
|
5330
|
+
var googleUrlOptionsResponseSchema = z15.object({
|
|
5331
|
+
customer_id: z15.string(),
|
|
5332
|
+
account: z15.object({
|
|
5333
|
+
level: z15.literal("account"),
|
|
5334
|
+
read: z15.boolean(),
|
|
5246
5335
|
final_url_suffix: googleUrlOptionValueSchema,
|
|
5247
5336
|
tracking_url_template: googleUrlOptionValueSchema
|
|
5248
5337
|
}),
|
|
5249
|
-
campaigns:
|
|
5250
|
-
level:
|
|
5251
|
-
read:
|
|
5338
|
+
campaigns: z15.object({
|
|
5339
|
+
level: z15.literal("campaign"),
|
|
5340
|
+
read: z15.boolean(),
|
|
5252
5341
|
/** Campaigns actually observed. 0 with `read: true` means the account has no non-removed campaigns. */
|
|
5253
|
-
campaigns_read:
|
|
5342
|
+
campaigns_read: z15.number().int().nonnegative(),
|
|
5254
5343
|
/** Campaigns observed to carry no override of their own — an explicit finding, not an omission. */
|
|
5255
|
-
campaigns_without_override:
|
|
5256
|
-
overrides:
|
|
5344
|
+
campaigns_without_override: z15.number().int().nonnegative(),
|
|
5345
|
+
overrides: z15.array(googleUrlOptionsCampaignSchema),
|
|
5257
5346
|
/** Compact mode only: campaigns read but not listed because they carry no override. */
|
|
5258
|
-
omitted:
|
|
5347
|
+
omitted: z15.number().int().nonnegative()
|
|
5259
5348
|
}),
|
|
5260
5349
|
/** Levels this command never queried. Nothing here may be reported as "not configured". */
|
|
5261
|
-
levels_not_read:
|
|
5350
|
+
levels_not_read: z15.array(z15.object({ level: z15.enum(URL_OPTION_LEVELS), reason: z15.string() }))
|
|
5262
5351
|
});
|
|
5263
5352
|
var ACCOUNT_URL_OPTIONS_LOCATION = "Google Ads UI \u2192 Admin \u2192 Account settings \u2192 Tracking (account-level tracking template and final URL suffix)";
|
|
5264
5353
|
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.";
|
|
@@ -5303,143 +5392,143 @@ function urlOptionsHints(report) {
|
|
|
5303
5392
|
}
|
|
5304
5393
|
|
|
5305
5394
|
// ../api/src/ads-google/wire.ts
|
|
5306
|
-
import { z as
|
|
5307
|
-
var googleWriteModeSchema =
|
|
5308
|
-
var googleDraftOpResultSchema =
|
|
5309
|
-
status:
|
|
5310
|
-
resourceName:
|
|
5311
|
-
error:
|
|
5312
|
-
skippedBecause:
|
|
5313
|
-
executedAt:
|
|
5314
|
-
});
|
|
5315
|
-
var googleDraftStageRequestSchema =
|
|
5316
|
-
chatId:
|
|
5395
|
+
import { z as z16 } from "zod";
|
|
5396
|
+
var googleWriteModeSchema = z16.enum(["live", "simulated"]);
|
|
5397
|
+
var googleDraftOpResultSchema = z16.object({
|
|
5398
|
+
status: z16.enum(["applied", "simulated", "failed", "skipped"]),
|
|
5399
|
+
resourceName: z16.string().optional(),
|
|
5400
|
+
error: z16.string().optional(),
|
|
5401
|
+
skippedBecause: z16.string().optional(),
|
|
5402
|
+
executedAt: z16.number().optional()
|
|
5403
|
+
});
|
|
5404
|
+
var googleDraftStageRequestSchema = z16.object({
|
|
5405
|
+
chatId: z16.string(),
|
|
5317
5406
|
op: googleDraftOpInputSchema
|
|
5318
5407
|
});
|
|
5319
|
-
var googleDraftStageResponseSchema =
|
|
5320
|
-
|
|
5321
|
-
staged:
|
|
5322
|
-
ref:
|
|
5408
|
+
var googleDraftStageResponseSchema = z16.discriminatedUnion("staged", [
|
|
5409
|
+
z16.object({
|
|
5410
|
+
staged: z16.literal(true),
|
|
5411
|
+
ref: z16.string(),
|
|
5323
5412
|
kind: googleDraftOpKindSchema,
|
|
5324
5413
|
mode: googleWriteModeSchema,
|
|
5325
|
-
dependsOn:
|
|
5326
|
-
summary:
|
|
5327
|
-
warnings:
|
|
5414
|
+
dependsOn: z16.array(z16.string()),
|
|
5415
|
+
summary: z16.string(),
|
|
5416
|
+
warnings: z16.array(z16.string()),
|
|
5328
5417
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
5329
|
-
amended:
|
|
5418
|
+
amended: z16.boolean().optional()
|
|
5330
5419
|
}),
|
|
5331
|
-
|
|
5332
|
-
staged:
|
|
5333
|
-
noop:
|
|
5420
|
+
z16.object({
|
|
5421
|
+
staged: z16.literal(false),
|
|
5422
|
+
noop: z16.literal(true),
|
|
5334
5423
|
kind: googleDraftOpKindSchema,
|
|
5335
5424
|
mode: googleWriteModeSchema,
|
|
5336
|
-
summary:
|
|
5337
|
-
reason:
|
|
5425
|
+
summary: z16.string(),
|
|
5426
|
+
reason: z16.string()
|
|
5338
5427
|
})
|
|
5339
5428
|
]);
|
|
5340
|
-
var googleDraftAmendRequestSchema =
|
|
5341
|
-
chatId:
|
|
5342
|
-
ref:
|
|
5343
|
-
patch:
|
|
5429
|
+
var googleDraftAmendRequestSchema = z16.object({
|
|
5430
|
+
chatId: z16.string(),
|
|
5431
|
+
ref: z16.string(),
|
|
5432
|
+
patch: z16.record(z16.string(), z16.unknown())
|
|
5344
5433
|
});
|
|
5345
|
-
var googleDraftShowRequestSchema =
|
|
5346
|
-
chatId:
|
|
5347
|
-
ref:
|
|
5434
|
+
var googleDraftShowRequestSchema = z16.object({
|
|
5435
|
+
chatId: z16.string(),
|
|
5436
|
+
ref: z16.string()
|
|
5348
5437
|
});
|
|
5349
5438
|
var GOOGLE_DRAFT_BATCH_MAX = 500;
|
|
5350
|
-
var googleDraftStageBatchRequestSchema =
|
|
5351
|
-
chatId:
|
|
5352
|
-
ops:
|
|
5439
|
+
var googleDraftStageBatchRequestSchema = z16.object({
|
|
5440
|
+
chatId: z16.string(),
|
|
5441
|
+
ops: z16.array(googleDraftOpInputSchema).min(1).max(GOOGLE_DRAFT_BATCH_MAX)
|
|
5353
5442
|
});
|
|
5354
|
-
var googleDraftStageBatchResponseSchema =
|
|
5355
|
-
staged:
|
|
5443
|
+
var googleDraftStageBatchResponseSchema = z16.object({
|
|
5444
|
+
staged: z16.literal(true),
|
|
5356
5445
|
mode: googleWriteModeSchema,
|
|
5357
|
-
count:
|
|
5358
|
-
ops:
|
|
5359
|
-
|
|
5360
|
-
ref:
|
|
5446
|
+
count: z16.number(),
|
|
5447
|
+
ops: z16.array(
|
|
5448
|
+
z16.object({
|
|
5449
|
+
ref: z16.string(),
|
|
5361
5450
|
kind: googleDraftOpKindSchema,
|
|
5362
|
-
dependsOn:
|
|
5363
|
-
summary:
|
|
5364
|
-
warnings:
|
|
5451
|
+
dependsOn: z16.array(z16.string()),
|
|
5452
|
+
summary: z16.string(),
|
|
5453
|
+
warnings: z16.array(z16.string())
|
|
5365
5454
|
})
|
|
5366
5455
|
),
|
|
5367
|
-
skipped:
|
|
5456
|
+
skipped: z16.array(z16.object({ kind: googleDraftOpKindSchema, summary: z16.string(), reason: z16.string() })).optional()
|
|
5368
5457
|
});
|
|
5369
|
-
var googleDraftOpViewSchema =
|
|
5370
|
-
ref:
|
|
5458
|
+
var googleDraftOpViewSchema = z16.object({
|
|
5459
|
+
ref: z16.string(),
|
|
5371
5460
|
kind: googleDraftOpKindSchema,
|
|
5372
|
-
customerId:
|
|
5373
|
-
target:
|
|
5374
|
-
dependsOn:
|
|
5375
|
-
summary:
|
|
5376
|
-
stagedAt:
|
|
5461
|
+
customerId: z16.string(),
|
|
5462
|
+
target: z16.string().optional(),
|
|
5463
|
+
dependsOn: z16.array(z16.string()),
|
|
5464
|
+
summary: z16.string(),
|
|
5465
|
+
stagedAt: z16.number(),
|
|
5377
5466
|
result: googleDraftOpResultSchema.optional()
|
|
5378
5467
|
});
|
|
5379
|
-
var googleDraftShowResponseSchema =
|
|
5468
|
+
var googleDraftShowResponseSchema = z16.object({
|
|
5380
5469
|
op: googleDraftOpViewSchema.extend({
|
|
5381
|
-
payload:
|
|
5382
|
-
warnings:
|
|
5383
|
-
annotations:
|
|
5470
|
+
payload: z16.unknown().optional(),
|
|
5471
|
+
warnings: z16.array(z16.string()).optional(),
|
|
5472
|
+
annotations: z16.unknown().optional()
|
|
5384
5473
|
})
|
|
5385
5474
|
});
|
|
5386
|
-
var googleDraftListRequestSchema =
|
|
5387
|
-
chatId:
|
|
5475
|
+
var googleDraftListRequestSchema = z16.object({
|
|
5476
|
+
chatId: z16.string()
|
|
5388
5477
|
});
|
|
5389
|
-
var googleDraftAdvisorySchema =
|
|
5390
|
-
scope:
|
|
5391
|
-
message:
|
|
5478
|
+
var googleDraftAdvisorySchema = z16.object({
|
|
5479
|
+
scope: z16.enum(["campaign", "adGroup"]),
|
|
5480
|
+
message: z16.string()
|
|
5392
5481
|
});
|
|
5393
|
-
var googleDraftStatusCollectionSchema =
|
|
5394
|
-
label:
|
|
5395
|
-
added:
|
|
5396
|
-
removed:
|
|
5397
|
-
existing:
|
|
5482
|
+
var googleDraftStatusCollectionSchema = z16.object({
|
|
5483
|
+
label: z16.string(),
|
|
5484
|
+
added: z16.number(),
|
|
5485
|
+
removed: z16.number(),
|
|
5486
|
+
existing: z16.number()
|
|
5398
5487
|
});
|
|
5399
|
-
var googleDraftChangeOperationSchema =
|
|
5400
|
-
var googleDraftStatusNodeSchema =
|
|
5401
|
-
() =>
|
|
5402
|
-
entity:
|
|
5403
|
-
name:
|
|
5488
|
+
var googleDraftChangeOperationSchema = z16.enum(["create", "update", "pause", "resume", "remove"]);
|
|
5489
|
+
var googleDraftStatusNodeSchema = z16.lazy(
|
|
5490
|
+
() => z16.object({
|
|
5491
|
+
entity: z16.string(),
|
|
5492
|
+
name: z16.string(),
|
|
5404
5493
|
operation: googleDraftChangeOperationSchema.optional(),
|
|
5405
|
-
existing:
|
|
5406
|
-
collections:
|
|
5407
|
-
children:
|
|
5408
|
-
warnings:
|
|
5494
|
+
existing: z16.boolean(),
|
|
5495
|
+
collections: z16.array(googleDraftStatusCollectionSchema),
|
|
5496
|
+
children: z16.array(googleDraftStatusNodeSchema),
|
|
5497
|
+
warnings: z16.array(z16.string()).optional()
|
|
5409
5498
|
})
|
|
5410
5499
|
);
|
|
5411
|
-
var googleDraftListResponseSchema =
|
|
5412
|
-
status:
|
|
5500
|
+
var googleDraftListResponseSchema = z16.object({
|
|
5501
|
+
status: z16.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
5413
5502
|
mode: googleWriteModeSchema,
|
|
5414
|
-
count:
|
|
5415
|
-
ops:
|
|
5503
|
+
count: z16.number(),
|
|
5504
|
+
ops: z16.array(googleDraftOpViewSchema),
|
|
5416
5505
|
/** Grouped campaign ▸ ad group ▸ ad tree for the readable CLI status view. */
|
|
5417
|
-
tree:
|
|
5506
|
+
tree: z16.array(googleDraftStatusNodeSchema).optional(),
|
|
5418
5507
|
/** Non-blocking completeness advisories for the whole draft. */
|
|
5419
|
-
advisories:
|
|
5508
|
+
advisories: z16.array(googleDraftAdvisorySchema).optional()
|
|
5420
5509
|
});
|
|
5421
|
-
var googleDraftRemoveRequestSchema =
|
|
5422
|
-
chatId:
|
|
5423
|
-
ref:
|
|
5510
|
+
var googleDraftRemoveRequestSchema = z16.object({
|
|
5511
|
+
chatId: z16.string(),
|
|
5512
|
+
ref: z16.string()
|
|
5424
5513
|
});
|
|
5425
|
-
var googleDraftRemoveResponseSchema =
|
|
5514
|
+
var googleDraftRemoveResponseSchema = z16.object({
|
|
5426
5515
|
/** The requested ref plus any dependents removed by cascade. */
|
|
5427
|
-
removed:
|
|
5516
|
+
removed: z16.array(z16.string())
|
|
5428
5517
|
});
|
|
5429
|
-
var googleDraftClearRequestSchema =
|
|
5430
|
-
chatId:
|
|
5518
|
+
var googleDraftClearRequestSchema = z16.object({
|
|
5519
|
+
chatId: z16.string()
|
|
5431
5520
|
});
|
|
5432
|
-
var googleDraftClearResponseSchema =
|
|
5433
|
-
cleared:
|
|
5521
|
+
var googleDraftClearResponseSchema = z16.object({
|
|
5522
|
+
cleared: z16.number()
|
|
5434
5523
|
});
|
|
5435
|
-
var googleFieldErrorSchema =
|
|
5436
|
-
path:
|
|
5437
|
-
message:
|
|
5524
|
+
var googleFieldErrorSchema = z16.object({
|
|
5525
|
+
path: z16.string(),
|
|
5526
|
+
message: z16.string()
|
|
5438
5527
|
});
|
|
5439
|
-
var googleDraftErrorResponseSchema =
|
|
5440
|
-
code:
|
|
5441
|
-
error:
|
|
5442
|
-
fields:
|
|
5528
|
+
var googleDraftErrorResponseSchema = z16.object({
|
|
5529
|
+
code: z16.string(),
|
|
5530
|
+
error: z16.string(),
|
|
5531
|
+
fields: z16.array(googleFieldErrorSchema).optional()
|
|
5443
5532
|
});
|
|
5444
5533
|
|
|
5445
5534
|
// src/commands/ads/google/changes-window.ts
|
|
@@ -6947,8 +7036,8 @@ async function stageGoogleOp(raw, hints) {
|
|
|
6947
7036
|
handleGoogleError(err);
|
|
6948
7037
|
}
|
|
6949
7038
|
}
|
|
6950
|
-
async function stageCreate(kind, customerId, payload) {
|
|
6951
|
-
await stageGoogleOp({ kind, customerId, payload });
|
|
7039
|
+
async function stageCreate(kind, customerId, payload, hints) {
|
|
7040
|
+
await stageGoogleOp({ kind, customerId, payload }, hints);
|
|
6952
7041
|
}
|
|
6953
7042
|
async function stageGoogleOps(rawOps, hints) {
|
|
6954
7043
|
if (rawOps.length === 1 && rawOps[0]) {
|
|
@@ -8451,6 +8540,81 @@ var finalUrlSuffixArg = {
|
|
|
8451
8540
|
description: 'Final URL suffix for this campaign \u2014 bare query params, no leading "?" (e.g. "utm_source=google&utm_agency=baker"). REPLACES the account-level suffix for this campaign; pass "" to clear it back to the account value. Account-wide tagging belongs at the account level: --level account tells you where.'
|
|
8452
8541
|
}
|
|
8453
8542
|
};
|
|
8543
|
+
var urlOptionsArgs = {
|
|
8544
|
+
"tracking-template": {
|
|
8545
|
+
type: "string",
|
|
8546
|
+
description: 'Campaign tracking template \u2014 the click-measurement URL every ad routes through. Must carry the landing page through {lpurl}, e.g. "https://tracker.example/?url={lpurl}". REPLACES the account-level template for this campaign; pass "" to clear it back to the account value.'
|
|
8547
|
+
},
|
|
8548
|
+
"custom-param": {
|
|
8549
|
+
type: "string",
|
|
8550
|
+
description: "Custom parameter as key=value, referenced in a template or final URL as {_key} (e.g. --custom-param season=summer). Repeat for several; Google allows 8. REPLACES the campaign's whole set."
|
|
8551
|
+
},
|
|
8552
|
+
"clear-custom-params": {
|
|
8553
|
+
type: "boolean",
|
|
8554
|
+
description: "Remove every custom parameter from this campaign (Google replaces the set wholesale)."
|
|
8555
|
+
}
|
|
8556
|
+
};
|
|
8557
|
+
function urlCustomParametersFromFlags(args) {
|
|
8558
|
+
const raw = args["custom-param"];
|
|
8559
|
+
const entries = (Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : []).filter(
|
|
8560
|
+
(v) => typeof v === "string" && v.length > 0
|
|
8561
|
+
);
|
|
8562
|
+
if (entries.length === 0) {
|
|
8563
|
+
return args["clear-custom-params"] === true ? [] : void 0;
|
|
8564
|
+
}
|
|
8565
|
+
if (args["clear-custom-params"] === true) {
|
|
8566
|
+
failWriteValidation("--clear-custom-params removes every parameter \u2014 pass it OR --custom-param, not both");
|
|
8567
|
+
}
|
|
8568
|
+
return entries.map((entry) => {
|
|
8569
|
+
const split = entry.indexOf("=");
|
|
8570
|
+
if (split <= 0) {
|
|
8571
|
+
failWriteValidation(`--custom-param "${entry}" must be key=value (e.g. --custom-param season=summer)`);
|
|
8572
|
+
}
|
|
8573
|
+
return { key: entry.slice(0, split), value: entry.slice(split + 1) };
|
|
8574
|
+
});
|
|
8575
|
+
}
|
|
8576
|
+
var geoTargetTypeArgs = {
|
|
8577
|
+
"geo-target-type": {
|
|
8578
|
+
type: "string",
|
|
8579
|
+
description: 'Location option \u2014 PRESENCE (only people in your targeted locations) or PRESENCE_OR_INTEREST (also people interested in them). Google applies PRESENCE_OR_INTEREST when this is left out, so pass PRESENCE explicitly for local-service, delivery-radius or in-store campaigns. Sets the same "Location options" as the Google Ads UI.'
|
|
8580
|
+
},
|
|
8581
|
+
"negative-geo-target-type": {
|
|
8582
|
+
type: "string",
|
|
8583
|
+
description: "How EXCLUDED locations are matched \u2014 PRESENCE (default: excludes people in the location) or PRESENCE_OR_INTEREST (also excludes people interested in it)."
|
|
8584
|
+
}
|
|
8585
|
+
};
|
|
8586
|
+
function enumFlag(value, flag, allowed) {
|
|
8587
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
8588
|
+
return void 0;
|
|
8589
|
+
}
|
|
8590
|
+
const upper2 = value.toUpperCase();
|
|
8591
|
+
if (!allowed.includes(upper2)) {
|
|
8592
|
+
failWriteValidation(`${flag} must be one of ${allowed.join(" | ")}`);
|
|
8593
|
+
}
|
|
8594
|
+
return upper2;
|
|
8595
|
+
}
|
|
8596
|
+
function geoTargetTypeFromFlags(args) {
|
|
8597
|
+
const positiveGeoTargetType = enumFlag(args["geo-target-type"], "--geo-target-type", POSITIVE_GEO_TARGET_TYPES);
|
|
8598
|
+
const negativeGeoTargetType = enumFlag(
|
|
8599
|
+
args["negative-geo-target-type"],
|
|
8600
|
+
"--negative-geo-target-type",
|
|
8601
|
+
NEGATIVE_GEO_TARGET_TYPES
|
|
8602
|
+
);
|
|
8603
|
+
if (positiveGeoTargetType === void 0 && negativeGeoTargetType === void 0) {
|
|
8604
|
+
return void 0;
|
|
8605
|
+
}
|
|
8606
|
+
return Object.fromEntries(
|
|
8607
|
+
Object.entries({ positiveGeoTargetType, negativeGeoTargetType }).filter(([, v]) => v !== void 0)
|
|
8608
|
+
);
|
|
8609
|
+
}
|
|
8610
|
+
function geoTargetTypeHints(payload) {
|
|
8611
|
+
if (payload.geoTargetTypeSetting !== void 0) {
|
|
8612
|
+
return [];
|
|
8613
|
+
}
|
|
8614
|
+
return [
|
|
8615
|
+
`No --geo-target-type set, so this campaign will use Google's default location option "Presence or interest" \u2014 it reaches people interested in your locations, not only people in them. Re-stage with --geo-target-type PRESENCE if the offer is local (in-store, delivery radius, service area), and tell the user which of the two this campaign uses.`
|
|
8616
|
+
];
|
|
8617
|
+
}
|
|
8454
8618
|
function accountLevelNotStageable(customerId, suffix) {
|
|
8455
8619
|
writeJsonEnvelope({
|
|
8456
8620
|
ok: false,
|
|
@@ -8494,6 +8658,8 @@ var campaignsCommand = defineCommand30({
|
|
|
8494
8658
|
"target-roas": { type: "string", description: "Target ROAS (e.g. 4.0) for TARGET_ROAS" },
|
|
8495
8659
|
...maxCpcArg,
|
|
8496
8660
|
...finalUrlSuffixArg,
|
|
8661
|
+
...urlOptionsArgs,
|
|
8662
|
+
...geoTargetTypeArgs,
|
|
8497
8663
|
objective: { type: "string", description: "Advisory UI objective (SALES, LEADS, \u2026)" },
|
|
8498
8664
|
"start-date": { type: "string", description: "YYYY-MM-DD" },
|
|
8499
8665
|
"end-date": { type: "string", description: "YYYY-MM-DD" },
|
|
@@ -8511,14 +8677,17 @@ var campaignsCommand = defineCommand30({
|
|
|
8511
8677
|
channelSubType: args["sub-type"],
|
|
8512
8678
|
budget: args["budget-ref"],
|
|
8513
8679
|
bidding: biddingFromFlags(args),
|
|
8680
|
+
geoTargetTypeSetting: geoTargetTypeFromFlags(args),
|
|
8514
8681
|
finalUrlSuffix: args["final-url-suffix"],
|
|
8682
|
+
trackingUrlTemplate: args["tracking-template"],
|
|
8683
|
+
urlCustomParameters: urlCustomParametersFromFlags(args),
|
|
8515
8684
|
objective: args.objective,
|
|
8516
8685
|
startDate: args["start-date"],
|
|
8517
8686
|
endDate: args["end-date"],
|
|
8518
8687
|
euPoliticalAds: args["eu-political-ads"],
|
|
8519
8688
|
status: args.status
|
|
8520
8689
|
});
|
|
8521
|
-
await stageCreate("google.campaign.create", customerId, payload);
|
|
8690
|
+
await stageCreate("google.campaign.create", customerId, payload, geoTargetTypeHints(payload));
|
|
8522
8691
|
}
|
|
8523
8692
|
}),
|
|
8524
8693
|
update: defineCommand30({
|
|
@@ -8533,6 +8702,8 @@ var campaignsCommand = defineCommand30({
|
|
|
8533
8702
|
"target-roas": { type: "string" },
|
|
8534
8703
|
...maxCpcArg,
|
|
8535
8704
|
...finalUrlSuffixArg,
|
|
8705
|
+
...urlOptionsArgs,
|
|
8706
|
+
...geoTargetTypeArgs,
|
|
8536
8707
|
"eu-political-ads": {
|
|
8537
8708
|
type: "boolean",
|
|
8538
8709
|
description: "Corrects the campaign's EU political advertising declaration: --eu-political-ads if it contains EU political ads, --eu-political-ads=false if it does not. Existing campaigns without a declaration block location-targeting changes until one is set."
|
|
@@ -8557,7 +8728,10 @@ var campaignsCommand = defineCommand30({
|
|
|
8557
8728
|
name: args.name,
|
|
8558
8729
|
budget: args["budget-ref"],
|
|
8559
8730
|
bidding: biddingFromFlags(args),
|
|
8731
|
+
geoTargetTypeSetting: geoTargetTypeFromFlags(args),
|
|
8560
8732
|
finalUrlSuffix: args["final-url-suffix"],
|
|
8733
|
+
trackingUrlTemplate: args["tracking-template"],
|
|
8734
|
+
urlCustomParameters: urlCustomParametersFromFlags(args),
|
|
8561
8735
|
euPoliticalAds: args["eu-political-ads"],
|
|
8562
8736
|
status: args.status
|
|
8563
8737
|
});
|
|
@@ -13486,17 +13660,17 @@ var NUMERIC_ID_REGEX3 = /^\d+$/;
|
|
|
13486
13660
|
var IMAGE_HASH_REGEX = /^[A-Fa-f0-9]{16,}$/;
|
|
13487
13661
|
|
|
13488
13662
|
// ../api/src/ads-meta/ops.ts
|
|
13489
|
-
import { z as
|
|
13490
|
-
var tempRefSchema3 =
|
|
13491
|
-
var parentRefSchema2 =
|
|
13492
|
-
var moneySchema2 =
|
|
13493
|
-
amount:
|
|
13494
|
-
currencyCode:
|
|
13495
|
-
});
|
|
13496
|
-
var httpsUrlSchema3 =
|
|
13497
|
-
var bakerMediaIdSchema2 =
|
|
13498
|
-
var stageableStatusSchema3 =
|
|
13499
|
-
var updateStatusSchema =
|
|
13663
|
+
import { z as z17 } from "zod";
|
|
13664
|
+
var tempRefSchema3 = z17.string().regex(TEMP_REF_REGEX3, "expected a meta_temp_* reference");
|
|
13665
|
+
var parentRefSchema2 = z17.union([z17.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema3]);
|
|
13666
|
+
var moneySchema2 = z17.object({
|
|
13667
|
+
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"),
|
|
13668
|
+
currencyCode: z17.string().length(3).optional()
|
|
13669
|
+
});
|
|
13670
|
+
var httpsUrlSchema3 = z17.string().url().refine((u) => u.startsWith("https://"), "destination URLs must be https");
|
|
13671
|
+
var bakerMediaIdSchema2 = z17.string().min(1);
|
|
13672
|
+
var stageableStatusSchema3 = z17.enum(STAGEABLE_CREATE_STATUSES3);
|
|
13673
|
+
var updateStatusSchema = z17.enum(UPDATE_STATUSES);
|
|
13500
13674
|
function currencyMinimums2(currencyCode) {
|
|
13501
13675
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
13502
13676
|
}
|
|
@@ -13508,35 +13682,35 @@ function validateDailyBudgetFloor(money, ctx, path28) {
|
|
|
13508
13682
|
}
|
|
13509
13683
|
}
|
|
13510
13684
|
}
|
|
13511
|
-
var geoLocationsSchema =
|
|
13512
|
-
countries:
|
|
13513
|
-
regions:
|
|
13514
|
-
cities:
|
|
13515
|
-
zips:
|
|
13516
|
-
location_types:
|
|
13517
|
-
}).catchall(
|
|
13518
|
-
var idNameSchema =
|
|
13519
|
-
var metaTargetingSchema =
|
|
13685
|
+
var geoLocationsSchema = z17.object({
|
|
13686
|
+
countries: z17.array(z17.string().length(2)).optional(),
|
|
13687
|
+
regions: z17.array(z17.object({ key: z17.string() })).optional(),
|
|
13688
|
+
cities: z17.array(z17.object({ key: z17.string(), radius: z17.number().optional(), distance_unit: z17.string().optional() })).optional(),
|
|
13689
|
+
zips: z17.array(z17.object({ key: z17.string() })).optional(),
|
|
13690
|
+
location_types: z17.array(z17.string()).optional()
|
|
13691
|
+
}).catchall(z17.unknown());
|
|
13692
|
+
var idNameSchema = z17.object({ id: z17.string(), name: z17.string().optional() });
|
|
13693
|
+
var metaTargetingSchema = z17.object({
|
|
13520
13694
|
geo_locations: geoLocationsSchema.optional(),
|
|
13521
13695
|
excluded_geo_locations: geoLocationsSchema.optional(),
|
|
13522
|
-
age_min:
|
|
13523
|
-
age_max:
|
|
13524
|
-
genders:
|
|
13525
|
-
locales:
|
|
13526
|
-
interests:
|
|
13527
|
-
behaviors:
|
|
13528
|
-
custom_audiences:
|
|
13529
|
-
excluded_custom_audiences:
|
|
13530
|
-
flexible_spec:
|
|
13531
|
-
exclusions:
|
|
13532
|
-
publisher_platforms:
|
|
13533
|
-
facebook_positions:
|
|
13534
|
-
instagram_positions:
|
|
13535
|
-
audience_network_positions:
|
|
13536
|
-
messenger_positions:
|
|
13537
|
-
device_platforms:
|
|
13538
|
-
targeting_automation:
|
|
13539
|
-
}).catchall(
|
|
13696
|
+
age_min: z17.number().int().min(13).max(65).optional(),
|
|
13697
|
+
age_max: z17.number().int().min(13).max(65).optional(),
|
|
13698
|
+
genders: z17.array(z17.union([z17.literal(1), z17.literal(2)])).optional(),
|
|
13699
|
+
locales: z17.array(z17.number().int()).optional(),
|
|
13700
|
+
interests: z17.array(idNameSchema).optional(),
|
|
13701
|
+
behaviors: z17.array(idNameSchema).optional(),
|
|
13702
|
+
custom_audiences: z17.array(z17.object({ id: parentRefSchema2 })).optional(),
|
|
13703
|
+
excluded_custom_audiences: z17.array(z17.object({ id: parentRefSchema2 })).optional(),
|
|
13704
|
+
flexible_spec: z17.array(z17.record(z17.string(), z17.unknown())).optional(),
|
|
13705
|
+
exclusions: z17.record(z17.string(), z17.unknown()).optional(),
|
|
13706
|
+
publisher_platforms: z17.array(z17.string()).optional(),
|
|
13707
|
+
facebook_positions: z17.array(z17.string()).optional(),
|
|
13708
|
+
instagram_positions: z17.array(z17.string()).optional(),
|
|
13709
|
+
audience_network_positions: z17.array(z17.string()).optional(),
|
|
13710
|
+
messenger_positions: z17.array(z17.string()).optional(),
|
|
13711
|
+
device_platforms: z17.array(z17.string()).optional(),
|
|
13712
|
+
targeting_automation: z17.object({ advantage_audience: z17.union([z17.literal(0), z17.literal(1)]) }).partial().optional()
|
|
13713
|
+
}).catchall(z17.unknown());
|
|
13540
13714
|
var GEO_INCLUSION_KEYS = [
|
|
13541
13715
|
"countries",
|
|
13542
13716
|
"country_groups",
|
|
@@ -13575,21 +13749,21 @@ function targetingHardLimitsDemographics(t) {
|
|
|
13575
13749
|
const narrowsGender = Array.isArray(t.genders) && t.genders.length === 1;
|
|
13576
13750
|
return narrowsAgeMax || narrowsAgeMin || narrowsGender;
|
|
13577
13751
|
}
|
|
13578
|
-
var specialAdCategoriesSchema =
|
|
13579
|
-
var campaignCreateSchema3 =
|
|
13580
|
-
name:
|
|
13581
|
-
objective:
|
|
13752
|
+
var specialAdCategoriesSchema = z17.array(z17.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
13753
|
+
var campaignCreateSchema3 = z17.object({
|
|
13754
|
+
name: z17.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
13755
|
+
objective: z17.enum(OBJECTIVES),
|
|
13582
13756
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
13583
13757
|
special_ad_categories: specialAdCategoriesSchema,
|
|
13584
|
-
special_ad_category_country:
|
|
13585
|
-
buying_type:
|
|
13586
|
-
bid_strategy:
|
|
13758
|
+
special_ad_category_country: z17.array(z17.string().length(2)).optional(),
|
|
13759
|
+
buying_type: z17.enum(BUYING_TYPES).default("AUCTION"),
|
|
13760
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13587
13761
|
/** Campaign Budget Optimization (Advantage campaign budget) — mutually exclusive with ad-set budgets. */
|
|
13588
13762
|
dailyBudget: moneySchema2.optional(),
|
|
13589
13763
|
lifetimeBudget: moneySchema2.optional(),
|
|
13590
13764
|
spendCap: moneySchema2.optional(),
|
|
13591
|
-
start_time:
|
|
13592
|
-
stop_time:
|
|
13765
|
+
start_time: z17.number().int().positive().optional(),
|
|
13766
|
+
stop_time: z17.number().int().positive().optional()
|
|
13593
13767
|
}).superRefine((p, ctx) => {
|
|
13594
13768
|
if (p.dailyBudget && p.lifetimeBudget) {
|
|
13595
13769
|
ctx.addIssue({ code: "custom", path: ["dailyBudget"], message: "set only one of dailyBudget or lifetimeBudget" });
|
|
@@ -13607,15 +13781,15 @@ var campaignCreateSchema3 = z16.object({
|
|
|
13607
13781
|
});
|
|
13608
13782
|
}
|
|
13609
13783
|
});
|
|
13610
|
-
var campaignUpdateSchema3 =
|
|
13611
|
-
name:
|
|
13784
|
+
var campaignUpdateSchema3 = z17.object({
|
|
13785
|
+
name: z17.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
13612
13786
|
status: updateStatusSchema.optional(),
|
|
13613
|
-
bid_strategy:
|
|
13787
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13614
13788
|
dailyBudget: moneySchema2.optional(),
|
|
13615
13789
|
lifetimeBudget: moneySchema2.optional(),
|
|
13616
13790
|
spendCap: moneySchema2.optional(),
|
|
13617
|
-
start_time:
|
|
13618
|
-
stop_time:
|
|
13791
|
+
start_time: z17.number().int().positive().optional(),
|
|
13792
|
+
stop_time: z17.number().int().positive().optional()
|
|
13619
13793
|
}).superRefine((p, ctx) => {
|
|
13620
13794
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
13621
13795
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -13625,42 +13799,42 @@ var campaignUpdateSchema3 = z16.object({
|
|
|
13625
13799
|
}
|
|
13626
13800
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
13627
13801
|
});
|
|
13628
|
-
var promotedObjectSchema =
|
|
13802
|
+
var promotedObjectSchema = z17.object({
|
|
13629
13803
|
page_id: parentRefSchema2.optional(),
|
|
13630
|
-
pixel_id:
|
|
13631
|
-
custom_event_type:
|
|
13632
|
-
application_id:
|
|
13633
|
-
object_store_url:
|
|
13634
|
-
product_catalog_id:
|
|
13635
|
-
product_set_id:
|
|
13636
|
-
whatsapp_phone_number:
|
|
13637
|
-
offline_conversion_data_set_id:
|
|
13804
|
+
pixel_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13805
|
+
custom_event_type: z17.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
13806
|
+
application_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13807
|
+
object_store_url: z17.string().url().optional(),
|
|
13808
|
+
product_catalog_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13809
|
+
product_set_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13810
|
+
whatsapp_phone_number: z17.string().optional(),
|
|
13811
|
+
offline_conversion_data_set_id: z17.string().regex(NUMERIC_ID_REGEX3).optional()
|
|
13638
13812
|
}).partial();
|
|
13639
|
-
var attributionSpecSchema =
|
|
13640
|
-
|
|
13641
|
-
event_type:
|
|
13642
|
-
window_days:
|
|
13813
|
+
var attributionSpecSchema = z17.array(
|
|
13814
|
+
z17.object({
|
|
13815
|
+
event_type: z17.enum(ATTRIBUTION_EVENT_TYPES),
|
|
13816
|
+
window_days: z17.union([z17.literal(1), z17.literal(7), z17.literal(28)])
|
|
13643
13817
|
})
|
|
13644
13818
|
);
|
|
13645
13819
|
var adSetFields = {
|
|
13646
|
-
name:
|
|
13820
|
+
name: z17.string().min(1).max(META_LIMITS.adSet.nameMax),
|
|
13647
13821
|
campaign_id: parentRefSchema2,
|
|
13648
13822
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
13649
13823
|
dailyBudget: moneySchema2.optional(),
|
|
13650
13824
|
lifetimeBudget: moneySchema2.optional(),
|
|
13651
13825
|
bidAmount: moneySchema2.optional(),
|
|
13652
|
-
bid_strategy:
|
|
13653
|
-
billing_event:
|
|
13654
|
-
optimization_goal:
|
|
13655
|
-
destination_type:
|
|
13826
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13827
|
+
billing_event: z17.enum(BILLING_EVENTS),
|
|
13828
|
+
optimization_goal: z17.enum(OPTIMIZATION_GOALS),
|
|
13829
|
+
destination_type: z17.enum(DESTINATION_TYPES).optional(),
|
|
13656
13830
|
promoted_object: promotedObjectSchema.optional(),
|
|
13657
13831
|
attribution_spec: attributionSpecSchema.optional(),
|
|
13658
|
-
start_time:
|
|
13659
|
-
end_time:
|
|
13832
|
+
start_time: z17.number().int().positive().optional(),
|
|
13833
|
+
end_time: z17.number().int().positive().optional(),
|
|
13660
13834
|
targeting: metaTargetingSchema,
|
|
13661
13835
|
/** EU Digital Services Act: who benefits from / pays for the ad. Auto-filled from the account for EU geo when omitted. */
|
|
13662
|
-
dsa_beneficiary:
|
|
13663
|
-
dsa_payor:
|
|
13836
|
+
dsa_beneficiary: z17.string().min(1).max(100).optional(),
|
|
13837
|
+
dsa_payor: z17.string().min(1).max(100).optional()
|
|
13664
13838
|
};
|
|
13665
13839
|
function validateBidStrategy(p, ctx) {
|
|
13666
13840
|
const strategy = p.bid_strategy;
|
|
@@ -13757,7 +13931,7 @@ function validateAdvantageAudience(p, ctx) {
|
|
|
13757
13931
|
});
|
|
13758
13932
|
}
|
|
13759
13933
|
}
|
|
13760
|
-
var adSetCreateSchema =
|
|
13934
|
+
var adSetCreateSchema = z17.object(adSetFields).superRefine((p, ctx) => {
|
|
13761
13935
|
validateAdSetBudgetAndBid(p, ctx);
|
|
13762
13936
|
validateAdSetPromotedObject(p, ctx);
|
|
13763
13937
|
validateAdvantageAudience(p, ctx);
|
|
@@ -13769,22 +13943,22 @@ var adSetCreateSchema = z16.object(adSetFields).superRefine((p, ctx) => {
|
|
|
13769
13943
|
});
|
|
13770
13944
|
}
|
|
13771
13945
|
});
|
|
13772
|
-
var adSetUpdateSchema =
|
|
13946
|
+
var adSetUpdateSchema = z17.object({
|
|
13773
13947
|
name: adSetFields.name.optional(),
|
|
13774
13948
|
status: updateStatusSchema.optional(),
|
|
13775
13949
|
dailyBudget: moneySchema2.optional(),
|
|
13776
13950
|
lifetimeBudget: moneySchema2.optional(),
|
|
13777
13951
|
bidAmount: moneySchema2.optional(),
|
|
13778
|
-
bid_strategy:
|
|
13779
|
-
optimization_goal:
|
|
13780
|
-
destination_type:
|
|
13952
|
+
bid_strategy: z17.enum(BID_STRATEGIES).optional(),
|
|
13953
|
+
optimization_goal: z17.enum(OPTIMIZATION_GOALS).optional(),
|
|
13954
|
+
destination_type: z17.enum(DESTINATION_TYPES).optional(),
|
|
13781
13955
|
promoted_object: promotedObjectSchema.optional(),
|
|
13782
13956
|
attribution_spec: attributionSpecSchema.optional(),
|
|
13783
|
-
start_time:
|
|
13784
|
-
end_time:
|
|
13957
|
+
start_time: z17.number().int().positive().optional(),
|
|
13958
|
+
end_time: z17.number().int().positive().optional(),
|
|
13785
13959
|
targeting: metaTargetingSchema.optional(),
|
|
13786
|
-
dsa_beneficiary:
|
|
13787
|
-
dsa_payor:
|
|
13960
|
+
dsa_beneficiary: z17.string().min(1).max(100).optional(),
|
|
13961
|
+
dsa_payor: z17.string().min(1).max(100).optional()
|
|
13788
13962
|
}).superRefine((p, ctx) => {
|
|
13789
13963
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
13790
13964
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -13795,38 +13969,38 @@ var adSetUpdateSchema = z16.object({
|
|
|
13795
13969
|
}
|
|
13796
13970
|
validateAdvantageAudience(p, ctx);
|
|
13797
13971
|
});
|
|
13798
|
-
var messageSchema =
|
|
13799
|
-
var headlineSchema2 =
|
|
13800
|
-
var descriptionSchema =
|
|
13801
|
-
var callToActionSchema =
|
|
13802
|
-
type:
|
|
13972
|
+
var messageSchema = z17.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
13973
|
+
var headlineSchema2 = z17.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
13974
|
+
var descriptionSchema = z17.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
13975
|
+
var callToActionSchema = z17.object({
|
|
13976
|
+
type: z17.enum(CTA_TYPES2),
|
|
13803
13977
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
13804
13978
|
link: httpsUrlSchema3.optional()
|
|
13805
13979
|
});
|
|
13806
|
-
var creativeEnhancementsSchema =
|
|
13807
|
-
standardEnhancements:
|
|
13808
|
-
features:
|
|
13980
|
+
var creativeEnhancementsSchema = z17.object({
|
|
13981
|
+
standardEnhancements: z17.enum(ENROLL_STATUSES).optional(),
|
|
13982
|
+
features: z17.record(z17.string(), z17.enum(ENROLL_STATUSES)).optional()
|
|
13809
13983
|
});
|
|
13810
13984
|
var creativeSharedFields = {
|
|
13811
|
-
name:
|
|
13985
|
+
name: z17.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
13812
13986
|
/** Facebook Page id backing the ad's identity. */
|
|
13813
13987
|
page_id: parentRefSchema2,
|
|
13814
13988
|
/** Instagram account id for IG placements (aka instagram_actor_id on read). */
|
|
13815
|
-
instagram_user_id:
|
|
13989
|
+
instagram_user_id: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13816
13990
|
/** URL tracking parameters appended to the destination, e.g. "utm_source=fb&utm_campaign=x". */
|
|
13817
|
-
url_tags:
|
|
13991
|
+
url_tags: z17.string().max(1e3).optional(),
|
|
13818
13992
|
enhancements: creativeEnhancementsSchema.optional()
|
|
13819
13993
|
};
|
|
13820
13994
|
var imageMediaFields = {
|
|
13821
|
-
imageHash:
|
|
13995
|
+
imageHash: z17.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
13822
13996
|
imageRef: tempRefSchema3.optional()
|
|
13823
13997
|
};
|
|
13824
13998
|
var videoMediaFields = {
|
|
13825
|
-
videoId:
|
|
13999
|
+
videoId: z17.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
13826
14000
|
videoRef: tempRefSchema3.optional(),
|
|
13827
14001
|
/** Thumbnail for a video creative — image hash, ref, or public url. */
|
|
13828
|
-
thumbnailHash:
|
|
13829
|
-
imageUrl:
|
|
14002
|
+
thumbnailHash: z17.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
14003
|
+
imageUrl: z17.string().url().optional()
|
|
13830
14004
|
};
|
|
13831
14005
|
function countImageRefs(p) {
|
|
13832
14006
|
return [p.imageHash, p.imageRef].filter(Boolean).length;
|
|
@@ -13834,8 +14008,8 @@ function countImageRefs(p) {
|
|
|
13834
14008
|
function countVideoRefs(p) {
|
|
13835
14009
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
13836
14010
|
}
|
|
13837
|
-
var singleCreativeSchema =
|
|
13838
|
-
creativeType:
|
|
14011
|
+
var singleCreativeSchema = z17.object({
|
|
14012
|
+
creativeType: z17.literal("single"),
|
|
13839
14013
|
...creativeSharedFields,
|
|
13840
14014
|
/** Primary text. */
|
|
13841
14015
|
message: messageSchema,
|
|
@@ -13844,7 +14018,7 @@ var singleCreativeSchema = z16.object({
|
|
|
13844
14018
|
headline: headlineSchema2.optional(),
|
|
13845
14019
|
description: descriptionSchema.optional(),
|
|
13846
14020
|
/** Display URL / caption shown under the headline. */
|
|
13847
|
-
caption:
|
|
14021
|
+
caption: z17.string().max(255).optional(),
|
|
13848
14022
|
call_to_action: callToActionSchema.optional(),
|
|
13849
14023
|
...imageMediaFields,
|
|
13850
14024
|
...videoMediaFields
|
|
@@ -13868,10 +14042,10 @@ var singleCreativeSchema = z16.object({
|
|
|
13868
14042
|
});
|
|
13869
14043
|
}
|
|
13870
14044
|
});
|
|
13871
|
-
var carouselCardSchema =
|
|
14045
|
+
var carouselCardSchema = z17.object({
|
|
13872
14046
|
link: httpsUrlSchema3,
|
|
13873
|
-
headline:
|
|
13874
|
-
description:
|
|
14047
|
+
headline: z17.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
14048
|
+
description: z17.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
13875
14049
|
call_to_action: callToActionSchema.optional(),
|
|
13876
14050
|
...imageMediaFields,
|
|
13877
14051
|
...videoMediaFields
|
|
@@ -13891,35 +14065,35 @@ var carouselCardSchema = z16.object({
|
|
|
13891
14065
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
13892
14066
|
}
|
|
13893
14067
|
});
|
|
13894
|
-
var carouselCreativeSchema2 =
|
|
13895
|
-
creativeType:
|
|
14068
|
+
var carouselCreativeSchema2 = z17.object({
|
|
14069
|
+
creativeType: z17.literal("carousel"),
|
|
13896
14070
|
...creativeSharedFields,
|
|
13897
14071
|
message: messageSchema,
|
|
13898
14072
|
/** Optional "see more" card destination applied when a card has no own link. */
|
|
13899
14073
|
link: httpsUrlSchema3.optional(),
|
|
13900
14074
|
call_to_action: callToActionSchema.optional(),
|
|
13901
|
-
cards:
|
|
14075
|
+
cards: z17.array(carouselCardSchema).min(META_LIMITS.creative.carouselCardsMin).max(META_LIMITS.creative.carouselCardsMax)
|
|
13902
14076
|
});
|
|
13903
|
-
var dynamicImageSchema =
|
|
13904
|
-
var dynamicVideoSchema =
|
|
14077
|
+
var dynamicImageSchema = z17.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
14078
|
+
var dynamicVideoSchema = z17.object({
|
|
13905
14079
|
videoId: videoMediaFields.videoId,
|
|
13906
14080
|
videoRef: videoMediaFields.videoRef,
|
|
13907
14081
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
13908
14082
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
13909
14083
|
var DYN = META_LIMITS.creative;
|
|
13910
|
-
var dynamicCreativeSchema =
|
|
13911
|
-
creativeType:
|
|
14084
|
+
var dynamicCreativeSchema = z17.object({
|
|
14085
|
+
creativeType: z17.literal("dynamic"),
|
|
13912
14086
|
...creativeSharedFields,
|
|
13913
|
-
bodies:
|
|
13914
|
-
titles:
|
|
13915
|
-
descriptions:
|
|
13916
|
-
images:
|
|
13917
|
-
videos:
|
|
13918
|
-
ad_formats:
|
|
13919
|
-
call_to_action_types:
|
|
13920
|
-
link_urls:
|
|
14087
|
+
bodies: z17.array(z17.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
14088
|
+
titles: z17.array(z17.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
14089
|
+
descriptions: z17.array(z17.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
14090
|
+
images: z17.array(dynamicImageSchema).optional(),
|
|
14091
|
+
videos: z17.array(dynamicVideoSchema).optional(),
|
|
14092
|
+
ad_formats: z17.array(z17.enum(AD_FORMATS2)).min(1),
|
|
14093
|
+
call_to_action_types: z17.array(z17.enum(CTA_TYPES2)).optional(),
|
|
14094
|
+
link_urls: z17.array(z17.object({ website_url: httpsUrlSchema3, display_url: z17.string().optional() })).min(1),
|
|
13921
14095
|
/** Multi-language / placement customization — structural passthrough for v1. */
|
|
13922
|
-
asset_customization_rules:
|
|
14096
|
+
asset_customization_rules: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
13923
14097
|
}).superRefine((p, ctx) => {
|
|
13924
14098
|
if (!(p.images?.length || p.videos?.length)) {
|
|
13925
14099
|
ctx.addIssue({
|
|
@@ -13929,57 +14103,57 @@ var dynamicCreativeSchema = z16.object({
|
|
|
13929
14103
|
});
|
|
13930
14104
|
}
|
|
13931
14105
|
});
|
|
13932
|
-
var existingPostCreativeSchema =
|
|
13933
|
-
creativeType:
|
|
14106
|
+
var existingPostCreativeSchema = z17.object({
|
|
14107
|
+
creativeType: z17.literal("existing_post"),
|
|
13934
14108
|
name: creativeSharedFields.name,
|
|
13935
14109
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
13936
|
-
object_story_id:
|
|
14110
|
+
object_story_id: z17.string().regex(/^\d+_\d+$/, 'expected "<page_id>_<post_id>"'),
|
|
13937
14111
|
instagram_user_id: creativeSharedFields.instagram_user_id,
|
|
13938
14112
|
url_tags: creativeSharedFields.url_tags,
|
|
13939
14113
|
enhancements: creativeSharedFields.enhancements
|
|
13940
14114
|
});
|
|
13941
|
-
var creativeContentSchema2 =
|
|
14115
|
+
var creativeContentSchema2 = z17.discriminatedUnion("creativeType", [
|
|
13942
14116
|
singleCreativeSchema,
|
|
13943
14117
|
carouselCreativeSchema2,
|
|
13944
14118
|
dynamicCreativeSchema,
|
|
13945
14119
|
existingPostCreativeSchema
|
|
13946
14120
|
]);
|
|
13947
14121
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
13948
|
-
var adCreativeUpdateSchema =
|
|
13949
|
-
name:
|
|
14122
|
+
var adCreativeUpdateSchema = z17.object({
|
|
14123
|
+
name: z17.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
13950
14124
|
status: updateStatusSchema.optional(),
|
|
13951
14125
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
13952
|
-
content:
|
|
14126
|
+
content: z17.record(z17.string(), z17.unknown()).optional()
|
|
13953
14127
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
13954
|
-
var adCreateSchema2 =
|
|
13955
|
-
name:
|
|
14128
|
+
var adCreateSchema2 = z17.object({
|
|
14129
|
+
name: z17.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
13956
14130
|
adset_id: parentRefSchema2,
|
|
13957
14131
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
13958
|
-
creative:
|
|
14132
|
+
creative: z17.object({ creative_id: parentRefSchema2 }),
|
|
13959
14133
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
13960
|
-
tracking_specs:
|
|
14134
|
+
tracking_specs: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
13961
14135
|
});
|
|
13962
|
-
var adUpdateSchema2 =
|
|
13963
|
-
name:
|
|
14136
|
+
var adUpdateSchema2 = z17.object({
|
|
14137
|
+
name: z17.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
13964
14138
|
status: updateStatusSchema.optional(),
|
|
13965
14139
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
13966
|
-
creative:
|
|
13967
|
-
tracking_specs:
|
|
14140
|
+
creative: z17.object({ creative_id: parentRefSchema2 }).optional(),
|
|
14141
|
+
tracking_specs: z17.array(z17.record(z17.string(), z17.unknown())).optional()
|
|
13968
14142
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
13969
|
-
var lookalikeSpecSchema =
|
|
13970
|
-
origin:
|
|
13971
|
-
ratio:
|
|
13972
|
-
country:
|
|
13973
|
-
});
|
|
13974
|
-
var customAudienceCreateSchema =
|
|
13975
|
-
name:
|
|
13976
|
-
subtype:
|
|
13977
|
-
description:
|
|
13978
|
-
customer_file_source:
|
|
13979
|
-
retention_days:
|
|
14143
|
+
var lookalikeSpecSchema = z17.object({
|
|
14144
|
+
origin: z17.array(z17.object({ id: parentRefSchema2 })).min(1),
|
|
14145
|
+
ratio: z17.number().min(0.01).max(0.2).optional(),
|
|
14146
|
+
country: z17.string().length(2).optional()
|
|
14147
|
+
});
|
|
14148
|
+
var customAudienceCreateSchema = z17.object({
|
|
14149
|
+
name: z17.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
14150
|
+
subtype: z17.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
14151
|
+
description: z17.string().max(500).optional(),
|
|
14152
|
+
customer_file_source: z17.string().optional(),
|
|
14153
|
+
retention_days: z17.number().int().min(1).max(META_LIMITS.audience.retentionDaysMax).optional(),
|
|
13980
14154
|
lookalike_spec: lookalikeSpecSchema.optional(),
|
|
13981
14155
|
/** Website/engagement rule — structural passthrough validated by Meta. */
|
|
13982
|
-
rule:
|
|
14156
|
+
rule: z17.record(z17.string(), z17.unknown()).optional()
|
|
13983
14157
|
}).superRefine((p, ctx) => {
|
|
13984
14158
|
if (p.subtype === "LOOKALIKE" && !p.lookalike_spec) {
|
|
13985
14159
|
ctx.addIssue({ code: "custom", path: ["lookalike_spec"], message: "LOOKALIKE audiences need a lookalike_spec" });
|
|
@@ -13988,16 +14162,16 @@ var customAudienceCreateSchema = z16.object({
|
|
|
13988
14162
|
ctx.addIssue({ code: "custom", path: ["rule"], message: `${p.subtype} audiences need a rule (use --file)` });
|
|
13989
14163
|
}
|
|
13990
14164
|
});
|
|
13991
|
-
var customAudienceUpdateSchema =
|
|
13992
|
-
name:
|
|
13993
|
-
description:
|
|
14165
|
+
var customAudienceUpdateSchema = z17.object({
|
|
14166
|
+
name: z17.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
14167
|
+
description: z17.string().max(500).optional()
|
|
13994
14168
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
13995
|
-
var mediaUploadSchema =
|
|
13996
|
-
kind:
|
|
14169
|
+
var mediaUploadSchema = z17.object({
|
|
14170
|
+
kind: z17.enum(MEDIA_KINDS),
|
|
13997
14171
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
13998
14172
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
13999
14173
|
/** Optional display name / filename hint. */
|
|
14000
|
-
name:
|
|
14174
|
+
name: z17.string().max(255).optional()
|
|
14001
14175
|
}).superRefine((p, ctx) => {
|
|
14002
14176
|
if (p.kind === "image" && !p.bakerImageId) {
|
|
14003
14177
|
ctx.addIssue({ code: "custom", path: ["bakerImageId"], message: "image uploads need a bakerImageId" });
|
|
@@ -14019,16 +14193,16 @@ var META_DRAFT_OP_KINDS = [
|
|
|
14019
14193
|
"customAudience.update",
|
|
14020
14194
|
"media.upload"
|
|
14021
14195
|
];
|
|
14022
|
-
var metaDraftOpKindSchema =
|
|
14023
|
-
var accountIdSchema2 =
|
|
14024
|
-
var updateTargetSchema2 =
|
|
14196
|
+
var metaDraftOpKindSchema = z17.enum(META_DRAFT_OP_KINDS);
|
|
14197
|
+
var accountIdSchema2 = z17.string().regex(NUMERIC_ID_REGEX3, "accountId must be the bare numeric ad account id");
|
|
14198
|
+
var updateTargetSchema2 = z17.union([z17.string().regex(NUMERIC_ID_REGEX3), tempRefSchema3]);
|
|
14025
14199
|
function createOp3(kind, payload) {
|
|
14026
|
-
return
|
|
14200
|
+
return z17.object({ kind: z17.literal(kind), accountId: accountIdSchema2, payload });
|
|
14027
14201
|
}
|
|
14028
14202
|
function updateOp3(kind, payload) {
|
|
14029
|
-
return
|
|
14203
|
+
return z17.object({ kind: z17.literal(kind), accountId: accountIdSchema2, target: updateTargetSchema2, payload });
|
|
14030
14204
|
}
|
|
14031
|
-
var metaDraftOpInputSchema =
|
|
14205
|
+
var metaDraftOpInputSchema = z17.discriminatedUnion("kind", [
|
|
14032
14206
|
createOp3("campaign.create", campaignCreateSchema3),
|
|
14033
14207
|
updateOp3("campaign.update", campaignUpdateSchema3),
|
|
14034
14208
|
createOp3("adSet.create", adSetCreateSchema),
|
|
@@ -14043,89 +14217,89 @@ var metaDraftOpInputSchema = z16.discriminatedUnion("kind", [
|
|
|
14043
14217
|
]);
|
|
14044
14218
|
|
|
14045
14219
|
// ../api/src/ads-meta/wire.ts
|
|
14046
|
-
import { z as
|
|
14047
|
-
var metaWriteModeSchema =
|
|
14048
|
-
var metaDraftOpResultSchema =
|
|
14049
|
-
status:
|
|
14220
|
+
import { z as z18 } from "zod";
|
|
14221
|
+
var metaWriteModeSchema = z18.enum(["live", "simulated"]);
|
|
14222
|
+
var metaDraftOpResultSchema = z18.object({
|
|
14223
|
+
status: z18.enum(["applied", "simulated", "failed", "skipped"]),
|
|
14050
14224
|
/** The resulting Meta node id (campaign/adset/creative/ad/audience) or simulated id. */
|
|
14051
|
-
id:
|
|
14225
|
+
id: z18.string().optional(),
|
|
14052
14226
|
/** For media.upload ops: the resulting image hash. */
|
|
14053
|
-
hash:
|
|
14054
|
-
error:
|
|
14055
|
-
skippedBecause:
|
|
14056
|
-
executedAt:
|
|
14227
|
+
hash: z18.string().optional(),
|
|
14228
|
+
error: z18.string().optional(),
|
|
14229
|
+
skippedBecause: z18.string().optional(),
|
|
14230
|
+
executedAt: z18.number().optional()
|
|
14057
14231
|
});
|
|
14058
|
-
var metaDraftStageRequestSchema =
|
|
14059
|
-
chatId:
|
|
14232
|
+
var metaDraftStageRequestSchema = z18.object({
|
|
14233
|
+
chatId: z18.string(),
|
|
14060
14234
|
op: metaDraftOpInputSchema
|
|
14061
14235
|
});
|
|
14062
|
-
var metaDraftStageResponseSchema =
|
|
14063
|
-
staged:
|
|
14064
|
-
ref:
|
|
14236
|
+
var metaDraftStageResponseSchema = z18.object({
|
|
14237
|
+
staged: z18.literal(true),
|
|
14238
|
+
ref: z18.string(),
|
|
14065
14239
|
kind: metaDraftOpKindSchema,
|
|
14066
14240
|
mode: metaWriteModeSchema,
|
|
14067
|
-
dependsOn:
|
|
14068
|
-
summary:
|
|
14069
|
-
warnings:
|
|
14241
|
+
dependsOn: z18.array(z18.string()),
|
|
14242
|
+
summary: z18.string(),
|
|
14243
|
+
warnings: z18.array(z18.string()),
|
|
14070
14244
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
14071
|
-
amended:
|
|
14072
|
-
});
|
|
14073
|
-
var metaDraftDuplicateRequestSchema =
|
|
14074
|
-
chatId:
|
|
14075
|
-
accountId:
|
|
14076
|
-
entity:
|
|
14077
|
-
sourceId:
|
|
14078
|
-
overrides:
|
|
14245
|
+
amended: z18.boolean().optional()
|
|
14246
|
+
});
|
|
14247
|
+
var metaDraftDuplicateRequestSchema = z18.object({
|
|
14248
|
+
chatId: z18.string(),
|
|
14249
|
+
accountId: z18.string(),
|
|
14250
|
+
entity: z18.enum(["campaign", "adSet", "ad"]),
|
|
14251
|
+
sourceId: z18.string(),
|
|
14252
|
+
overrides: z18.record(z18.string(), z18.unknown()).optional(),
|
|
14079
14253
|
/** Pause the original after the copy publishes. */
|
|
14080
|
-
replace:
|
|
14254
|
+
replace: z18.boolean().optional()
|
|
14081
14255
|
});
|
|
14082
|
-
var metaDraftOpViewSchema =
|
|
14083
|
-
ref:
|
|
14256
|
+
var metaDraftOpViewSchema = z18.object({
|
|
14257
|
+
ref: z18.string(),
|
|
14084
14258
|
kind: metaDraftOpKindSchema,
|
|
14085
|
-
accountId:
|
|
14086
|
-
target:
|
|
14087
|
-
dependsOn:
|
|
14088
|
-
summary:
|
|
14089
|
-
stagedAt:
|
|
14259
|
+
accountId: z18.string(),
|
|
14260
|
+
target: z18.string().optional(),
|
|
14261
|
+
dependsOn: z18.array(z18.string()),
|
|
14262
|
+
summary: z18.string(),
|
|
14263
|
+
stagedAt: z18.number(),
|
|
14090
14264
|
result: metaDraftOpResultSchema.optional()
|
|
14091
14265
|
});
|
|
14092
|
-
var metaDraftListRequestSchema =
|
|
14093
|
-
chatId:
|
|
14266
|
+
var metaDraftListRequestSchema = z18.object({
|
|
14267
|
+
chatId: z18.string()
|
|
14094
14268
|
});
|
|
14095
|
-
var metaDraftAdvisorySchema =
|
|
14096
|
-
ref:
|
|
14097
|
-
message:
|
|
14269
|
+
var metaDraftAdvisorySchema = z18.object({
|
|
14270
|
+
ref: z18.string(),
|
|
14271
|
+
message: z18.string()
|
|
14098
14272
|
});
|
|
14099
|
-
var metaDraftListResponseSchema =
|
|
14100
|
-
status:
|
|
14273
|
+
var metaDraftListResponseSchema = z18.object({
|
|
14274
|
+
status: z18.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
14101
14275
|
mode: metaWriteModeSchema,
|
|
14102
|
-
count:
|
|
14103
|
-
ops:
|
|
14276
|
+
count: z18.number(),
|
|
14277
|
+
ops: z18.array(metaDraftOpViewSchema),
|
|
14104
14278
|
/** Non-blocking cross-op quality advisories — "good campaign, not just valid". */
|
|
14105
|
-
advisories:
|
|
14279
|
+
advisories: z18.array(metaDraftAdvisorySchema)
|
|
14106
14280
|
});
|
|
14107
|
-
var metaDraftRemoveRequestSchema =
|
|
14108
|
-
chatId:
|
|
14109
|
-
ref:
|
|
14281
|
+
var metaDraftRemoveRequestSchema = z18.object({
|
|
14282
|
+
chatId: z18.string(),
|
|
14283
|
+
ref: z18.string()
|
|
14110
14284
|
});
|
|
14111
|
-
var metaDraftRemoveResponseSchema =
|
|
14285
|
+
var metaDraftRemoveResponseSchema = z18.object({
|
|
14112
14286
|
/** The requested ref plus any dependents removed by cascade. */
|
|
14113
|
-
removed:
|
|
14287
|
+
removed: z18.array(z18.string())
|
|
14114
14288
|
});
|
|
14115
|
-
var metaDraftClearRequestSchema =
|
|
14116
|
-
chatId:
|
|
14289
|
+
var metaDraftClearRequestSchema = z18.object({
|
|
14290
|
+
chatId: z18.string()
|
|
14117
14291
|
});
|
|
14118
|
-
var metaDraftClearResponseSchema =
|
|
14119
|
-
cleared:
|
|
14292
|
+
var metaDraftClearResponseSchema = z18.object({
|
|
14293
|
+
cleared: z18.number()
|
|
14120
14294
|
});
|
|
14121
|
-
var metaFieldErrorSchema =
|
|
14122
|
-
path:
|
|
14123
|
-
message:
|
|
14295
|
+
var metaFieldErrorSchema = z18.object({
|
|
14296
|
+
path: z18.string(),
|
|
14297
|
+
message: z18.string()
|
|
14124
14298
|
});
|
|
14125
|
-
var metaDraftErrorResponseSchema =
|
|
14126
|
-
code:
|
|
14127
|
-
error:
|
|
14128
|
-
fields:
|
|
14299
|
+
var metaDraftErrorResponseSchema = z18.object({
|
|
14300
|
+
code: z18.string(),
|
|
14301
|
+
error: z18.string(),
|
|
14302
|
+
fields: z18.array(metaFieldErrorSchema).optional()
|
|
14129
14303
|
});
|
|
14130
14304
|
|
|
14131
14305
|
// src/commands/ads/meta/write-shared.ts
|
|
@@ -18005,7 +18179,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
|
|
|
18005
18179
|
import { toCardinal as nwNl } from "n2words/nl-NL";
|
|
18006
18180
|
import { toCardinal as nwPl } from "n2words/pl-PL";
|
|
18007
18181
|
import { toCardinal as nwPt } from "n2words/pt-PT";
|
|
18008
|
-
import { z as
|
|
18182
|
+
import { z as z19 } from "zod";
|
|
18009
18183
|
|
|
18010
18184
|
// src/engine/scaffold/lib/shoot-modes.ts
|
|
18011
18185
|
var SHOOT_MODES = [
|
|
@@ -18341,71 +18515,71 @@ function trimArgs(durationS, offsetS = 0, dims) {
|
|
|
18341
18515
|
"{{out.video}}"
|
|
18342
18516
|
];
|
|
18343
18517
|
}
|
|
18344
|
-
var FrameAsset =
|
|
18345
|
-
var DialogueLine =
|
|
18346
|
-
speaker:
|
|
18347
|
-
line:
|
|
18518
|
+
var FrameAsset = z19.object({ url: z19.string().optional() }).loose().optional();
|
|
18519
|
+
var DialogueLine = z19.object({
|
|
18520
|
+
speaker: z19.string().optional(),
|
|
18521
|
+
line: z19.string().optional(),
|
|
18348
18522
|
// Absolute seconds on the source timeline (the deconstruct emits both).
|
|
18349
|
-
start_s:
|
|
18350
|
-
end_s:
|
|
18351
|
-
delivery:
|
|
18352
|
-
voice_description:
|
|
18523
|
+
start_s: z19.number().optional(),
|
|
18524
|
+
end_s: z19.number().optional(),
|
|
18525
|
+
delivery: z19.string().optional(),
|
|
18526
|
+
voice_description: z19.string().optional(),
|
|
18353
18527
|
// DECON-supplied: is this speaker's FACE visibly speaking in THIS scene? Element
|
|
18354
18528
|
// presence alone can't answer that — a founder pictured in a polaroid close-up is
|
|
18355
18529
|
// "present" yet the line is voiceover, and treating it as on-camera produced a
|
|
18356
18530
|
// native Seedance lip-sync clip of a still photograph. `false` pins the line to
|
|
18357
18531
|
// the VO path; absent keeps the presence-based decision (old blueprints).
|
|
18358
|
-
on_camera:
|
|
18532
|
+
on_camera: z19.boolean().optional()
|
|
18359
18533
|
}).loose();
|
|
18360
|
-
var Sfx =
|
|
18361
|
-
at_s:
|
|
18362
|
-
duration_s:
|
|
18363
|
-
sound_effect_prompt:
|
|
18364
|
-
description:
|
|
18534
|
+
var Sfx = z19.object({
|
|
18535
|
+
at_s: z19.number().optional(),
|
|
18536
|
+
duration_s: z19.number().optional(),
|
|
18537
|
+
sound_effect_prompt: z19.string().optional(),
|
|
18538
|
+
description: z19.string().optional()
|
|
18365
18539
|
}).loose();
|
|
18366
|
-
var CompositionRegion =
|
|
18540
|
+
var CompositionRegion = z19.object({
|
|
18367
18541
|
// full | top | bottom | left | right | inset
|
|
18368
|
-
panel:
|
|
18542
|
+
panel: z19.string().optional(),
|
|
18369
18543
|
// 9-grid anchor for an `inset` presenter box.
|
|
18370
|
-
position:
|
|
18371
|
-
is_presenter:
|
|
18544
|
+
position: z19.string().optional(),
|
|
18545
|
+
is_presenter: z19.boolean().optional(),
|
|
18372
18546
|
// The cast id shown/speaking in this region (routes lip-sync + element refs).
|
|
18373
|
-
cast_ref:
|
|
18547
|
+
cast_ref: z19.string().optional(),
|
|
18374
18548
|
// What the region's content IS: camera | screen_capture | static_graphic |
|
|
18375
18549
|
// generated. Authoritative for routing when present (regex-over-prose fallback
|
|
18376
18550
|
// otherwise): screen_capture/static_graphic are rebuilt from REAL surfaces on the
|
|
18377
18551
|
// overlay layer, never AI-generated.
|
|
18378
|
-
kind:
|
|
18552
|
+
kind: z19.string().optional(),
|
|
18379
18553
|
// Opaque id naming the SPECIFIC on-screen document/note/app-state this
|
|
18380
18554
|
// screen_capture region shows. Two scenes share it only when they show the SAME
|
|
18381
18555
|
// recording continuing (scrolling/typing/waiting within it) — a genuinely
|
|
18382
18556
|
// DIFFERENT document/note/recording (a source video splicing two screen captures)
|
|
18383
18557
|
// gets a different id. Breaks a persistent-layout run into separate surface stubs
|
|
18384
18558
|
// instead of asking the operator for one screenshot that can't cover both.
|
|
18385
|
-
surface_id:
|
|
18559
|
+
surface_id: z19.string().optional(),
|
|
18386
18560
|
// Camera bubble(s)/inset(s) embedded INSIDE this region's surface (a Loom-style
|
|
18387
18561
|
// presenter bubble inside a screen recording) — video-in-video the reproduction
|
|
18388
18562
|
// must re-composite, not paint into the surface.
|
|
18389
|
-
nested:
|
|
18390
|
-
summary:
|
|
18391
|
-
frame_prompt:
|
|
18392
|
-
motion_prompt:
|
|
18563
|
+
nested: z19.array(z19.object({}).loose()).optional(),
|
|
18564
|
+
summary: z19.string().optional(),
|
|
18565
|
+
frame_prompt: z19.string().optional(),
|
|
18566
|
+
motion_prompt: z19.string().optional()
|
|
18393
18567
|
}).loose();
|
|
18394
|
-
var SceneComposition =
|
|
18568
|
+
var SceneComposition = z19.object({
|
|
18395
18569
|
// full_frame (default) | split_screen | pip | keyed_overlay
|
|
18396
|
-
layout:
|
|
18570
|
+
layout: z19.string().optional(),
|
|
18397
18571
|
// split_screen only: vertical (top/bottom) | horizontal (left/right).
|
|
18398
|
-
split_axis:
|
|
18399
|
-
regions:
|
|
18572
|
+
split_axis: z19.string().optional(),
|
|
18573
|
+
regions: z19.array(CompositionRegion).optional()
|
|
18400
18574
|
}).loose();
|
|
18401
|
-
var CameraMotion =
|
|
18402
|
-
var TranscriptWord =
|
|
18403
|
-
var Scene =
|
|
18404
|
-
start_s:
|
|
18405
|
-
end_s:
|
|
18406
|
-
duration_s:
|
|
18407
|
-
summary:
|
|
18408
|
-
action_detail:
|
|
18575
|
+
var CameraMotion = z19.object({ movement: z19.string().optional(), detail: z19.string().optional() }).loose();
|
|
18576
|
+
var TranscriptWord = z19.object({ text: z19.string().optional() }).loose();
|
|
18577
|
+
var Scene = z19.object({
|
|
18578
|
+
start_s: z19.number().optional(),
|
|
18579
|
+
end_s: z19.number().optional(),
|
|
18580
|
+
duration_s: z19.number().optional(),
|
|
18581
|
+
summary: z19.string().optional(),
|
|
18582
|
+
action_detail: z19.string().optional(),
|
|
18409
18583
|
// The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
|
|
18410
18584
|
// A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
|
|
18411
18585
|
// builds one clip per region and stacks/overlays them into the scene picture.
|
|
@@ -18413,82 +18587,82 @@ var Scene = z18.object({
|
|
|
18413
18587
|
// The capture "look" for this scene — selected from the ad-native shoot-mode
|
|
18414
18588
|
// grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
|
|
18415
18589
|
// UGC/product mode; a human can override per scene by setting this.
|
|
18416
|
-
shoot_mode:
|
|
18590
|
+
shoot_mode: z19.string().optional(),
|
|
18417
18591
|
// Diegetic ambient the clip's native audio should carry (no music). When
|
|
18418
18592
|
// absent the scene falls back to its shoot mode's default ambience.
|
|
18419
|
-
ambient:
|
|
18593
|
+
ambient: z19.string().optional(),
|
|
18420
18594
|
camera_motion: CameraMotion.optional(),
|
|
18421
|
-
start_frame_prompt:
|
|
18422
|
-
end_frame_prompt:
|
|
18423
|
-
motion_prompt:
|
|
18595
|
+
start_frame_prompt: z19.string().optional(),
|
|
18596
|
+
end_frame_prompt: z19.string().optional(),
|
|
18597
|
+
motion_prompt: z19.string().optional(),
|
|
18424
18598
|
// The scene's role in the ad's persuasion arc (DECON-supplied); drives the
|
|
18425
18599
|
// script re-craft checklist. Inferred from position when absent.
|
|
18426
|
-
narrative_role:
|
|
18600
|
+
narrative_role: z19.string().optional(),
|
|
18427
18601
|
// DECON-supplied on the HOOK scene: the engineered physical/emotional state that
|
|
18428
18602
|
// makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
|
|
18429
18603
|
// into the hook's start-frame description so the generator renders that state,
|
|
18430
18604
|
// not a calm influencer (CCA-11).
|
|
18431
|
-
hook_mechanic:
|
|
18605
|
+
hook_mechanic: z19.object({ mechanic: z19.string().optional(), why_it_stops_scroll: z19.string().optional() }).loose().optional(),
|
|
18432
18606
|
// DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
|
|
18433
|
-
scene_setting:
|
|
18607
|
+
scene_setting: z19.string().optional(),
|
|
18434
18608
|
// How this scene cuts to the next (DECON-supplied). A recognized non-cut type
|
|
18435
18609
|
// (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
|
|
18436
18610
|
// boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
|
|
18437
18611
|
// ignored (nothing follows it).
|
|
18438
|
-
transition_out:
|
|
18439
|
-
dialogue:
|
|
18440
|
-
sfx:
|
|
18441
|
-
overlays:
|
|
18442
|
-
floating_elements:
|
|
18612
|
+
transition_out: z19.object({ type: z19.string().optional(), description: z19.string().optional() }).loose().optional(),
|
|
18613
|
+
dialogue: z19.array(DialogueLine).optional(),
|
|
18614
|
+
sfx: z19.array(Sfx).optional(),
|
|
18615
|
+
overlays: z19.array(z19.unknown()).optional(),
|
|
18616
|
+
floating_elements: z19.array(z19.unknown()).optional(),
|
|
18443
18617
|
// DECON-supplied: how much the picture itself moves within the shot. Gates the
|
|
18444
18618
|
// flash-hold optimization — a sub-2s b-roll flash with REAL subject motion
|
|
18445
18619
|
// (pouring, spreading, hands working) must stay a real clip; freezing it turns
|
|
18446
18620
|
// a montage into a slideshow. Absent (old blueprints) keeps the cheap still.
|
|
18447
|
-
motion_level:
|
|
18448
|
-
transcript_slice:
|
|
18621
|
+
motion_level: z19.enum(["static", "subtle", "dynamic"]).optional(),
|
|
18622
|
+
transcript_slice: z19.array(TranscriptWord).optional(),
|
|
18449
18623
|
start_frame_asset: FrameAsset,
|
|
18450
18624
|
end_frame_asset: FrameAsset,
|
|
18451
18625
|
// DECON-supplied: true when this scene is a length-split CONTINUATION of the
|
|
18452
18626
|
// previous one (the SAME physical shot, broken up only because it exceeded the
|
|
18453
18627
|
// clip ceiling). The scaffold then shares the splice keyframe — this scene's
|
|
18454
18628
|
// start frame IS the previous scene's end frame — so the join is seamless.
|
|
18455
|
-
continues_previous:
|
|
18629
|
+
continues_previous: z19.boolean().optional()
|
|
18456
18630
|
}).loose();
|
|
18457
|
-
var VideoBlueprint =
|
|
18458
|
-
source:
|
|
18459
|
-
global:
|
|
18460
|
-
music:
|
|
18461
|
-
present:
|
|
18462
|
-
music_prompt:
|
|
18631
|
+
var VideoBlueprint = z19.object({
|
|
18632
|
+
source: z19.object({ aspect_ratio: z19.string().optional(), duration_s: z19.number().optional() }).loose().optional(),
|
|
18633
|
+
global: z19.object({
|
|
18634
|
+
music: z19.object({
|
|
18635
|
+
present: z19.boolean().optional(),
|
|
18636
|
+
music_prompt: z19.string().optional(),
|
|
18463
18637
|
// Absolute second the music enters in the reference (the bed often
|
|
18464
18638
|
// kicks in mid-ad, after the hook). We start the regenerated track here
|
|
18465
18639
|
// instead of at 0 so the timing matches.
|
|
18466
|
-
starts_at_s:
|
|
18640
|
+
starts_at_s: z19.number().optional(),
|
|
18467
18641
|
// Populated by the deconstruct when AudD (Shazam-style) recognizes the
|
|
18468
18642
|
// reference track. We never reuse it — only style the regenerated bed.
|
|
18469
|
-
identified_track:
|
|
18643
|
+
identified_track: z19.object({ title: z19.string().optional(), artist: z19.string().optional() }).loose().nullish()
|
|
18470
18644
|
}).loose().optional(),
|
|
18471
|
-
cast:
|
|
18472
|
-
|
|
18473
|
-
id:
|
|
18474
|
-
description:
|
|
18645
|
+
cast: z19.array(
|
|
18646
|
+
z19.object({
|
|
18647
|
+
id: z19.string().optional(),
|
|
18648
|
+
description: z19.string().optional(),
|
|
18475
18649
|
// The deconstruct's note on the target-market localization (e.g. "native
|
|
18476
18650
|
// French speaker") — read to derive the spoken-track language code.
|
|
18477
|
-
market_localization_note:
|
|
18651
|
+
market_localization_note: z19.string().optional()
|
|
18478
18652
|
}).loose()
|
|
18479
18653
|
).optional(),
|
|
18480
|
-
voiceover:
|
|
18654
|
+
voiceover: z19.object({
|
|
18481
18655
|
// on_camera | mixed → mouths are on screen (lip-sync candidates);
|
|
18482
18656
|
// voiceover | none → narration over the picture (no lip-sync).
|
|
18483
|
-
mode:
|
|
18484
|
-
voice_description:
|
|
18485
|
-
persona:
|
|
18657
|
+
mode: z19.string().optional(),
|
|
18658
|
+
voice_description: z19.string().optional(),
|
|
18659
|
+
persona: z19.string().optional()
|
|
18486
18660
|
}).loose().optional(),
|
|
18487
18661
|
// Visual palette — read only to colour a clean brand-card/CTA plate (the
|
|
18488
18662
|
// first hex is the dominant brand colour); never to drive frame generation.
|
|
18489
|
-
style:
|
|
18663
|
+
style: z19.object({ palette: z19.array(z19.object({ hex: z19.string().optional() }).loose()).optional() }).loose().optional()
|
|
18490
18664
|
}).loose().optional(),
|
|
18491
|
-
scenes:
|
|
18665
|
+
scenes: z19.array(Scene).min(1)
|
|
18492
18666
|
}).loose();
|
|
18493
18667
|
function injectHookPhysicality(blueprint) {
|
|
18494
18668
|
for (const scene of blueprint.scenes) {
|
|
@@ -18505,26 +18679,26 @@ function clipIntentOf(scene, sceneIndex) {
|
|
|
18505
18679
|
if (/hero|reveal|product|payoff|transformation|result/.test(role) || scene.motion_level === "dynamic") return "hero";
|
|
18506
18680
|
return "body";
|
|
18507
18681
|
}
|
|
18508
|
-
var AppearsItem =
|
|
18509
|
-
var RecurringElement =
|
|
18682
|
+
var AppearsItem = z19.union([z19.number(), z19.object({ scene: z19.number(), edge: z19.string().optional() }).loose()]);
|
|
18683
|
+
var RecurringElement = z19.object({
|
|
18510
18684
|
// person | animal | product | logo | badge | other
|
|
18511
|
-
type:
|
|
18512
|
-
label:
|
|
18513
|
-
description:
|
|
18514
|
-
expression:
|
|
18685
|
+
type: z19.string(),
|
|
18686
|
+
label: z19.string().optional(),
|
|
18687
|
+
description: z19.string().optional(),
|
|
18688
|
+
expression: z19.string().nullable().optional(),
|
|
18515
18689
|
// When the element maps to a global cast entry, its stable id (for annotation).
|
|
18516
|
-
cast_id:
|
|
18690
|
+
cast_id: z19.string().nullable().optional(),
|
|
18517
18691
|
// The label of another element that is the SAME individual as this one, shown
|
|
18518
18692
|
// in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
|
|
18519
18693
|
// pink shirt and believer in a white shirt). Each look gets its own reference
|
|
18520
18694
|
// slot, but the face/identity must stay identical across them.
|
|
18521
|
-
same_as:
|
|
18695
|
+
same_as: z19.string().nullable().optional(),
|
|
18522
18696
|
// Scenes the element appears in. Either a bare list of scene indices (both
|
|
18523
18697
|
// edges) or per-{scene,edge} entries. Both forms are accepted and merged.
|
|
18524
|
-
scenes:
|
|
18525
|
-
appears_in:
|
|
18698
|
+
scenes: z19.array(z19.number()).optional(),
|
|
18699
|
+
appears_in: z19.array(AppearsItem).optional()
|
|
18526
18700
|
}).loose();
|
|
18527
|
-
var RecurringElements =
|
|
18701
|
+
var RecurringElements = z19.array(RecurringElement);
|
|
18528
18702
|
function sanitizeId(raw, fallback) {
|
|
18529
18703
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
18530
18704
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -18999,7 +19173,7 @@ function scrubFloatSentences(text, floatDescs) {
|
|
|
18999
19173
|
return kept;
|
|
19000
19174
|
}
|
|
19001
19175
|
function sceneFloatDescs(scene) {
|
|
19002
|
-
const floats =
|
|
19176
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
19003
19177
|
if (!floats.success) return [];
|
|
19004
19178
|
return floats.data.map((f) => f.description?.trim() ?? "").filter(Boolean);
|
|
19005
19179
|
}
|
|
@@ -20423,25 +20597,25 @@ function buildSfxMusic(blueprint, clock, nodes) {
|
|
|
20423
20597
|
}
|
|
20424
20598
|
return tracks;
|
|
20425
20599
|
}
|
|
20426
|
-
var OverlayStyle =
|
|
20427
|
-
var Overlay =
|
|
20428
|
-
text:
|
|
20429
|
-
appears_at_s:
|
|
20430
|
-
duration_s:
|
|
20431
|
-
position:
|
|
20432
|
-
role:
|
|
20433
|
-
animation:
|
|
20434
|
-
animation_detail:
|
|
20600
|
+
var OverlayStyle = z19.object({ color_hex: z19.string().optional(), background: z19.string().optional(), size: z19.string().optional() }).loose();
|
|
20601
|
+
var Overlay = z19.object({
|
|
20602
|
+
text: z19.string().optional(),
|
|
20603
|
+
appears_at_s: z19.number().optional(),
|
|
20604
|
+
duration_s: z19.number().optional(),
|
|
20605
|
+
position: z19.string().optional(),
|
|
20606
|
+
role: z19.string().optional(),
|
|
20607
|
+
animation: z19.string().optional(),
|
|
20608
|
+
animation_detail: z19.string().optional(),
|
|
20435
20609
|
style: OverlayStyle.optional()
|
|
20436
20610
|
}).loose();
|
|
20437
|
-
var FloatingElement =
|
|
20438
|
-
kind:
|
|
20439
|
-
description:
|
|
20440
|
-
brand_name:
|
|
20441
|
-
what_it_represents:
|
|
20442
|
-
appears_at_s:
|
|
20443
|
-
duration_s:
|
|
20444
|
-
position:
|
|
20611
|
+
var FloatingElement = z19.object({
|
|
20612
|
+
kind: z19.string().optional(),
|
|
20613
|
+
description: z19.string().optional(),
|
|
20614
|
+
brand_name: z19.string().nullish(),
|
|
20615
|
+
what_it_represents: z19.string().optional(),
|
|
20616
|
+
appears_at_s: z19.number().optional(),
|
|
20617
|
+
duration_s: z19.number().optional(),
|
|
20618
|
+
position: z19.string().optional()
|
|
20445
20619
|
}).loose();
|
|
20446
20620
|
function escapeHtml(s) {
|
|
20447
20621
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -20473,7 +20647,7 @@ function positionClass(position) {
|
|
|
20473
20647
|
function collectCaptions(blueprint, clock) {
|
|
20474
20648
|
return blueprint.scenes.flatMap((scene, i) => {
|
|
20475
20649
|
const sceneStart = scene.start_s ?? 0;
|
|
20476
|
-
const overlays =
|
|
20650
|
+
const overlays = z19.array(Overlay).safeParse(scene.overlays ?? []);
|
|
20477
20651
|
return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
|
|
20478
20652
|
const at = clock.map(i, ov.appears_at_s ?? sceneStart);
|
|
20479
20653
|
return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
|
|
@@ -20553,7 +20727,7 @@ function collectFloatWindows(blueprint, uiRouted, clock) {
|
|
|
20553
20727
|
const windows = /* @__PURE__ */ new Map();
|
|
20554
20728
|
blueprint.scenes.forEach((scene, i) => {
|
|
20555
20729
|
const sceneStart = scene.start_s ?? 0;
|
|
20556
|
-
const floats =
|
|
20730
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
20557
20731
|
if (!floats.success) return;
|
|
20558
20732
|
for (const fe of floats.data) {
|
|
20559
20733
|
const at = clock.map(i, fe.appears_at_s ?? sceneStart);
|
|
@@ -21001,8 +21175,8 @@ function buildMotionBoard(blueprint) {
|
|
|
21001
21175
|
const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
|
|
21002
21176
|
cursor = end_s;
|
|
21003
21177
|
const spoken = sceneSpokenText(scene);
|
|
21004
|
-
const overlays =
|
|
21005
|
-
const floats =
|
|
21178
|
+
const overlays = z19.array(Overlay).safeParse(scene.overlays ?? []);
|
|
21179
|
+
const floats = z19.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
21006
21180
|
const graphics = [
|
|
21007
21181
|
...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
|
|
21008
21182
|
kind: "text",
|
|
@@ -22441,7 +22615,7 @@ import path18 from "path";
|
|
|
22441
22615
|
import { defineCommand as defineCommand95 } from "citty";
|
|
22442
22616
|
|
|
22443
22617
|
// src/engine/scaffold/staticAd.ts
|
|
22444
|
-
import { z as
|
|
22618
|
+
import { z as z20 } from "zod";
|
|
22445
22619
|
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"]);
|
|
22446
22620
|
var DEFAULT_ASPECT_RATIO = "9:16";
|
|
22447
22621
|
var SHEET_SUBJECT_TYPE2 = {
|
|
@@ -22453,24 +22627,24 @@ var ACTOR_SHEET_IMAGE_SIZE = "4K";
|
|
|
22453
22627
|
var ADAPT_MODEL = "google/gemini-3-pro-image-preview";
|
|
22454
22628
|
var ADAPT_IMAGE_SIZE = "2K";
|
|
22455
22629
|
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.";
|
|
22456
|
-
var Blueprint =
|
|
22457
|
-
meta:
|
|
22458
|
-
text_content:
|
|
22630
|
+
var Blueprint = z20.object({
|
|
22631
|
+
meta: z20.object({ estimated_aspect_ratio: z20.string().optional() }).loose().optional(),
|
|
22632
|
+
text_content: z20.array(z20.object({ text: z20.string().optional() }).loose()).optional()
|
|
22459
22633
|
}).loose();
|
|
22460
|
-
var ElementLocator =
|
|
22461
|
-
collection:
|
|
22462
|
-
index:
|
|
22634
|
+
var ElementLocator = z20.object({
|
|
22635
|
+
collection: z20.enum(["subjects", "people", "brands_logos"]),
|
|
22636
|
+
index: z20.number().int().nonnegative()
|
|
22463
22637
|
}).loose();
|
|
22464
|
-
var MainElement =
|
|
22638
|
+
var MainElement = z20.object({
|
|
22465
22639
|
// logo | product | person | animal | badge | other
|
|
22466
|
-
type:
|
|
22467
|
-
label:
|
|
22468
|
-
description:
|
|
22469
|
-
expression:
|
|
22470
|
-
reason:
|
|
22640
|
+
type: z20.string(),
|
|
22641
|
+
label: z20.string().optional(),
|
|
22642
|
+
description: z20.string().optional(),
|
|
22643
|
+
expression: z20.string().nullable().optional(),
|
|
22644
|
+
reason: z20.string().optional(),
|
|
22471
22645
|
locator: ElementLocator.optional()
|
|
22472
22646
|
}).loose();
|
|
22473
|
-
var MainElements =
|
|
22647
|
+
var MainElements = z20.array(MainElement);
|
|
22474
22648
|
function sanitizeId2(raw, fallback) {
|
|
22475
22649
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
22476
22650
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -29030,7 +29204,24 @@ function parseBrandMd(brandMd, fonts, colors) {
|
|
|
29030
29204
|
if (named) for (const n of named) fonts.add(n.slice(1, -1).trim().toLowerCase());
|
|
29031
29205
|
}
|
|
29032
29206
|
}
|
|
29207
|
+
function brandTokensFromCanonical(tokens) {
|
|
29208
|
+
const fonts = new Set(tokens.fonts.map((f) => f.family.toLowerCase()));
|
|
29209
|
+
const colors = [];
|
|
29210
|
+
for (const color of tokens.colors) {
|
|
29211
|
+
const parsed = parseColor2(color.value);
|
|
29212
|
+
if (parsed) colors.push(parsed);
|
|
29213
|
+
}
|
|
29214
|
+
return { fonts, colors, hasTokens: fonts.size > 0 || colors.length > 0 };
|
|
29215
|
+
}
|
|
29033
29216
|
async function loadBrandTokens(projectRoot) {
|
|
29217
|
+
const tokensRaw = await safeRead(path24.join(projectRoot, "src", "brand", "tokens.json"));
|
|
29218
|
+
if (tokensRaw) {
|
|
29219
|
+
try {
|
|
29220
|
+
const canonical2 = brandTokensSchema.safeParse(JSON.parse(tokensRaw));
|
|
29221
|
+
if (canonical2.success) return brandTokensFromCanonical(canonical2.data);
|
|
29222
|
+
} catch {
|
|
29223
|
+
}
|
|
29224
|
+
}
|
|
29034
29225
|
const globalCss = await safeRead(path24.join(projectRoot, "src", "styles", "global.css"));
|
|
29035
29226
|
const brandMd = await safeRead(path24.join(projectRoot, "src", "brand", "BRAND.md"));
|
|
29036
29227
|
if (!globalCss && !brandMd) return EMPTY;
|