@koda-sl/baker-cli 0.121.0-dev.045b11c52 → 0.121.0-dev.36aef87f5
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 +21 -0
- package/dist/cli.js +1020 -810
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
import "./chunk-5WRI5ZAA.js";
|
|
50
50
|
|
|
51
51
|
// src/cli.ts
|
|
52
|
-
import { defineCommand as
|
|
52
|
+
import { defineCommand as defineCommand161, runMain } from "citty";
|
|
53
53
|
|
|
54
54
|
// src/commands/actions/index.ts
|
|
55
55
|
import { defineCommand as defineCommand18 } from "citty";
|
|
@@ -1916,142 +1916,241 @@ var imagesIngestResponseSchema = z4.object({
|
|
|
1916
1916
|
contentHash: z4.string()
|
|
1917
1917
|
});
|
|
1918
1918
|
|
|
1919
|
-
// ../api/src/
|
|
1919
|
+
// ../api/src/tags.ts
|
|
1920
1920
|
import { z as z5 } from "zod";
|
|
1921
|
-
var
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1921
|
+
var TAG_TYPES = [
|
|
1922
|
+
"meta",
|
|
1923
|
+
"amplitude",
|
|
1924
|
+
"googleAds",
|
|
1925
|
+
"tiktok",
|
|
1926
|
+
"vwo",
|
|
1927
|
+
"hotjar",
|
|
1928
|
+
"clarity",
|
|
1929
|
+
"pinterest",
|
|
1930
|
+
"code",
|
|
1931
|
+
"googleAnalytics",
|
|
1932
|
+
"googleTagManager",
|
|
1933
|
+
"hubspot",
|
|
1934
|
+
"linkedinInsightTag",
|
|
1935
|
+
"onetrust",
|
|
1936
|
+
"posthog",
|
|
1937
|
+
"datafast",
|
|
1938
|
+
"recaptcha",
|
|
1939
|
+
"twitterAds"
|
|
1940
|
+
];
|
|
1941
|
+
var tagTypeSchema = z5.enum(TAG_TYPES);
|
|
1942
|
+
var tagDraftOpKindSchema = z5.enum(["create", "update", "delete"]);
|
|
1943
|
+
var tagDraftOpViewSchema = z5.object({
|
|
1944
|
+
/** `tag_temp_*` for staged creates; the real tag id for update/delete ops. */
|
|
1945
|
+
ref: z5.string(),
|
|
1946
|
+
kind: tagDraftOpKindSchema,
|
|
1947
|
+
type: tagTypeSchema,
|
|
1948
|
+
/** Present on update/delete ops — the real tag this op targets. */
|
|
1949
|
+
tagId: z5.string().optional(),
|
|
1950
|
+
/** Non-secret config (create: full; update: the staged patch). Secrets are structurally absent. */
|
|
1951
|
+
config: z5.record(z5.string(), z5.string()),
|
|
1952
|
+
/** Update only — fields the op explicitly clears. */
|
|
1953
|
+
clearFields: z5.array(z5.string()).optional(),
|
|
1954
|
+
/** Names of secret fields already provided via the dashboard secure form. Never values. */
|
|
1955
|
+
secretsSet: z5.array(z5.string()),
|
|
1956
|
+
/** Names of secret fields still awaiting user input. */
|
|
1957
|
+
secretsPending: z5.array(z5.string()),
|
|
1958
|
+
summary: z5.string(),
|
|
1959
|
+
stagedAt: z5.number()
|
|
1960
|
+
});
|
|
1961
|
+
var tagsEffectiveEntrySchema = z5.object({
|
|
1962
|
+
/** Real tag id, or `tag_temp_*` for staged creates. Use as flow side-effect `tagIds` value. */
|
|
1963
|
+
ref: z5.string(),
|
|
1964
|
+
tagId: z5.string().optional(),
|
|
1965
|
+
type: tagTypeSchema,
|
|
1966
|
+
/** Value of the type's identifying field, when set. */
|
|
1967
|
+
identifier: z5.string().optional(),
|
|
1968
|
+
/** Redacted config; for staged updates, production config with the patch merged. */
|
|
1969
|
+
config: z5.record(z5.string(), z5.string()),
|
|
1970
|
+
/** Absent = live production tag with no staged changes in this chat. */
|
|
1971
|
+
staged: tagDraftOpKindSchema.optional(),
|
|
1972
|
+
secretsSet: z5.array(z5.string()),
|
|
1973
|
+
secretsPending: z5.array(z5.string())
|
|
1974
|
+
});
|
|
1975
|
+
var tagsListRequestSchema = z5.object({ chatId: z5.string() });
|
|
1976
|
+
var tagsListResponseSchema = z5.object({ tags: z5.array(tagsEffectiveEntrySchema) });
|
|
1977
|
+
var tagsDraftListRequestSchema = z5.object({ chatId: z5.string() });
|
|
1978
|
+
var tagsDraftListResponseSchema = z5.object({
|
|
1979
|
+
status: z5.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
1980
|
+
ops: z5.array(tagDraftOpViewSchema)
|
|
1981
|
+
});
|
|
1982
|
+
var tagInputRequestSchema = z5.object({
|
|
1983
|
+
// Every tag change is a tab in the approval form: create/edit show the full
|
|
1984
|
+
// body; delete shows a confirm. No tag change bypasses this approval.
|
|
1985
|
+
mode: z5.enum(["create", "edit", "delete"]),
|
|
1986
|
+
tagType: tagTypeSchema,
|
|
1987
|
+
/** Edit/delete mode — the real tag id or `tag_temp_*` ref being changed. */
|
|
1988
|
+
ref: z5.string().optional(),
|
|
1989
|
+
/** Non-secret values the agent proposes to prefill. Secret keys are stripped at every boundary. */
|
|
1990
|
+
prefilledConfig: z5.record(z5.string(), z5.string()).optional(),
|
|
1991
|
+
/** Secret field names the agent asks the user to provide. */
|
|
1992
|
+
requestedSecretFields: z5.array(z5.string()).optional(),
|
|
1993
|
+
/** Short message shown above the form explaining why the input is needed. */
|
|
1994
|
+
message: z5.string().optional()
|
|
1995
|
+
});
|
|
1996
|
+
var tagChangeToolInputSchema = z5.object({
|
|
1997
|
+
changes: z5.array(tagInputRequestSchema).min(1).max(8)
|
|
1998
|
+
});
|
|
1999
|
+
var tagInputResultSchema = z5.discriminatedUnion("status", [
|
|
2000
|
+
z5.object({
|
|
2001
|
+
status: z5.literal("submitted"),
|
|
2002
|
+
ref: z5.string(),
|
|
2003
|
+
type: tagTypeSchema,
|
|
2004
|
+
/** Identifying field name → value (non-secret), when the type has one. */
|
|
2005
|
+
identifier: z5.record(z5.string(), z5.string()).optional(),
|
|
2006
|
+
secretFieldsSet: z5.array(z5.string()),
|
|
2007
|
+
note: z5.string().optional()
|
|
2008
|
+
}),
|
|
2009
|
+
z5.object({
|
|
2010
|
+
status: z5.literal("declined"),
|
|
2011
|
+
reason: z5.string().optional()
|
|
2012
|
+
})
|
|
2013
|
+
]);
|
|
2014
|
+
var tagChangeToolResultSchema = z5.object({
|
|
2015
|
+
results: z5.array(tagInputResultSchema)
|
|
2016
|
+
});
|
|
2017
|
+
|
|
2018
|
+
// ../api/src/testimonials.ts
|
|
2019
|
+
import { z as z6 } from "zod";
|
|
2020
|
+
var testimonialSourceTypeSchema = z6.enum(["google", "trustpilot"]);
|
|
2021
|
+
var testimonialStatusSchema = z6.enum(["pending", "processing", "ready", "error"]);
|
|
2022
|
+
var testimonialSentimentSchema = z6.enum(["positive", "neutral", "negative"]);
|
|
2023
|
+
var testimonialDocSchema = z6.object({
|
|
2024
|
+
_id: z6.string(),
|
|
2025
|
+
_creationTime: z6.number(),
|
|
2026
|
+
companyId: z6.string(),
|
|
2027
|
+
sourceId: z6.string(),
|
|
1929
2028
|
sourceType: testimonialSourceTypeSchema,
|
|
1930
|
-
reviewText:
|
|
1931
|
-
reviewTitle:
|
|
1932
|
-
searchText:
|
|
1933
|
-
reviewerName:
|
|
1934
|
-
reviewerImageUrl:
|
|
1935
|
-
reviewerImageId:
|
|
1936
|
-
reviewerLocation:
|
|
1937
|
-
rating:
|
|
1938
|
-
reviewDate:
|
|
1939
|
-
ownerAnswer:
|
|
1940
|
-
mediaUrls:
|
|
1941
|
-
imageIds:
|
|
1942
|
-
videoIds:
|
|
1943
|
-
sourceUrl:
|
|
1944
|
-
rawData:
|
|
1945
|
-
tags:
|
|
1946
|
-
highlight:
|
|
1947
|
-
language:
|
|
1948
|
-
summary:
|
|
2029
|
+
reviewText: z6.string(),
|
|
2030
|
+
reviewTitle: z6.string().optional(),
|
|
2031
|
+
searchText: z6.string().optional(),
|
|
2032
|
+
reviewerName: z6.string().optional(),
|
|
2033
|
+
reviewerImageUrl: z6.string().optional(),
|
|
2034
|
+
reviewerImageId: z6.string().optional(),
|
|
2035
|
+
reviewerLocation: z6.string().optional(),
|
|
2036
|
+
rating: z6.number().optional(),
|
|
2037
|
+
reviewDate: z6.number().optional(),
|
|
2038
|
+
ownerAnswer: z6.string().optional(),
|
|
2039
|
+
mediaUrls: z6.array(z6.string()).optional(),
|
|
2040
|
+
imageIds: z6.array(z6.string()).optional(),
|
|
2041
|
+
videoIds: z6.array(z6.string()).optional(),
|
|
2042
|
+
sourceUrl: z6.string().optional(),
|
|
2043
|
+
rawData: z6.unknown().optional(),
|
|
2044
|
+
tags: z6.array(z6.string()),
|
|
2045
|
+
highlight: z6.string().optional(),
|
|
2046
|
+
language: z6.string().optional(),
|
|
2047
|
+
summary: z6.string().optional(),
|
|
1949
2048
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1950
|
-
textEmbedding:
|
|
1951
|
-
externalId:
|
|
1952
|
-
contentHash:
|
|
2049
|
+
textEmbedding: z6.array(z6.number()).optional(),
|
|
2050
|
+
externalId: z6.string().optional(),
|
|
2051
|
+
contentHash: z6.string().optional(),
|
|
1953
2052
|
status: testimonialStatusSchema,
|
|
1954
|
-
errorMessage:
|
|
1955
|
-
createdAt:
|
|
1956
|
-
updatedAt:
|
|
2053
|
+
errorMessage: z6.string().optional(),
|
|
2054
|
+
createdAt: z6.number(),
|
|
2055
|
+
updatedAt: z6.number()
|
|
1957
2056
|
});
|
|
1958
|
-
var testimonialsListRequestSchema =
|
|
2057
|
+
var testimonialsListRequestSchema = z6.object({
|
|
1959
2058
|
source: testimonialSourceTypeSchema.optional(),
|
|
1960
|
-
rating_min:
|
|
1961
|
-
rating_max:
|
|
1962
|
-
tags:
|
|
2059
|
+
rating_min: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2060
|
+
rating_max: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2061
|
+
tags: z6.string().transform((s) => s.split(",").filter(Boolean)).optional(),
|
|
1963
2062
|
status: testimonialStatusSchema.optional(),
|
|
1964
2063
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1965
|
-
language:
|
|
1966
|
-
limit:
|
|
1967
|
-
});
|
|
1968
|
-
var testimonialsListResponseSchema =
|
|
1969
|
-
var testimonialsGetRequestSchema =
|
|
1970
|
-
var testimonialsSearchRequestSchema =
|
|
1971
|
-
query:
|
|
1972
|
-
limit:
|
|
2064
|
+
language: z6.string().min(2).max(5).optional(),
|
|
2065
|
+
limit: z6.coerce.number().int().positive().max(200).optional()
|
|
2066
|
+
});
|
|
2067
|
+
var testimonialsListResponseSchema = z6.array(testimonialDocSchema);
|
|
2068
|
+
var testimonialsGetRequestSchema = z6.object({ id: z6.string().min(1, "Missing id parameter") });
|
|
2069
|
+
var testimonialsSearchRequestSchema = z6.object({
|
|
2070
|
+
query: z6.string().min(1),
|
|
2071
|
+
limit: z6.coerce.number().int().positive().max(100).optional(),
|
|
1973
2072
|
source: testimonialSourceTypeSchema.optional(),
|
|
1974
|
-
rating_min:
|
|
1975
|
-
rating_max:
|
|
1976
|
-
tags:
|
|
2073
|
+
rating_min: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2074
|
+
rating_max: z6.coerce.number().int().min(1).max(5).optional(),
|
|
2075
|
+
tags: z6.array(z6.string()).optional(),
|
|
1977
2076
|
status: testimonialStatusSchema.optional(),
|
|
1978
2077
|
sentiment: testimonialSentimentSchema.optional(),
|
|
1979
|
-
language:
|
|
2078
|
+
language: z6.string().min(2).max(5).optional()
|
|
1980
2079
|
}).refine(
|
|
1981
2080
|
(data) => data.rating_min === void 0 || data.rating_max === void 0 || data.rating_min <= data.rating_max,
|
|
1982
2081
|
{ message: "rating_min must be less than or equal to rating_max" }
|
|
1983
2082
|
);
|
|
1984
|
-
var testimonialsSearchResponseSchema =
|
|
1985
|
-
var testimonialsOutscraperWebhookResponseSchema =
|
|
1986
|
-
ok:
|
|
1987
|
-
note:
|
|
2083
|
+
var testimonialsSearchResponseSchema = z6.array(testimonialDocSchema);
|
|
2084
|
+
var testimonialsOutscraperWebhookResponseSchema = z6.object({
|
|
2085
|
+
ok: z6.literal(true),
|
|
2086
|
+
note: z6.string().optional()
|
|
1988
2087
|
});
|
|
1989
2088
|
|
|
1990
2089
|
// ../api/src/videos.ts
|
|
1991
|
-
import { z as
|
|
1992
|
-
var videoStatusSchema =
|
|
1993
|
-
var videoTranscriptSegmentSchema =
|
|
1994
|
-
text:
|
|
1995
|
-
startSecond:
|
|
1996
|
-
endSecond:
|
|
1997
|
-
});
|
|
1998
|
-
var videoSceneSchema =
|
|
1999
|
-
title:
|
|
2000
|
-
description:
|
|
2001
|
-
startSecond:
|
|
2002
|
-
endSecond:
|
|
2003
|
-
thumbnailTime:
|
|
2004
|
-
});
|
|
2005
|
-
var videoDocSchema =
|
|
2006
|
-
_id:
|
|
2007
|
-
_creationTime:
|
|
2008
|
-
companyId:
|
|
2009
|
-
muxAssetId:
|
|
2010
|
-
muxPlaybackId:
|
|
2011
|
-
muxUploadId:
|
|
2012
|
-
name:
|
|
2013
|
-
description:
|
|
2014
|
-
tags:
|
|
2015
|
-
source:
|
|
2016
|
-
externalId:
|
|
2017
|
-
sourceId:
|
|
2018
|
-
width:
|
|
2019
|
-
height:
|
|
2020
|
-
aspectRatio:
|
|
2021
|
-
duration:
|
|
2022
|
-
transcript:
|
|
2023
|
-
transcriptSegments:
|
|
2024
|
-
scenes:
|
|
2025
|
-
descriptionEmbedding:
|
|
2026
|
-
searchText:
|
|
2090
|
+
import { z as z7 } from "zod";
|
|
2091
|
+
var videoStatusSchema = z7.enum(["uploading", "uploaded", "processing", "ready", "error"]);
|
|
2092
|
+
var videoTranscriptSegmentSchema = z7.object({
|
|
2093
|
+
text: z7.string(),
|
|
2094
|
+
startSecond: z7.number(),
|
|
2095
|
+
endSecond: z7.number()
|
|
2096
|
+
});
|
|
2097
|
+
var videoSceneSchema = z7.object({
|
|
2098
|
+
title: z7.string(),
|
|
2099
|
+
description: z7.string(),
|
|
2100
|
+
startSecond: z7.number(),
|
|
2101
|
+
endSecond: z7.number(),
|
|
2102
|
+
thumbnailTime: z7.number()
|
|
2103
|
+
});
|
|
2104
|
+
var videoDocSchema = z7.object({
|
|
2105
|
+
_id: z7.string(),
|
|
2106
|
+
_creationTime: z7.number(),
|
|
2107
|
+
companyId: z7.string(),
|
|
2108
|
+
muxAssetId: z7.string(),
|
|
2109
|
+
muxPlaybackId: z7.string(),
|
|
2110
|
+
muxUploadId: z7.string(),
|
|
2111
|
+
name: z7.string(),
|
|
2112
|
+
description: z7.string(),
|
|
2113
|
+
tags: z7.array(z7.string()),
|
|
2114
|
+
source: z7.string(),
|
|
2115
|
+
externalId: z7.string().optional(),
|
|
2116
|
+
sourceId: z7.string().optional(),
|
|
2117
|
+
width: z7.number().optional(),
|
|
2118
|
+
height: z7.number().optional(),
|
|
2119
|
+
aspectRatio: z7.number().optional(),
|
|
2120
|
+
duration: z7.number().optional(),
|
|
2121
|
+
transcript: z7.string().optional(),
|
|
2122
|
+
transcriptSegments: z7.array(videoTranscriptSegmentSchema).optional(),
|
|
2123
|
+
scenes: z7.array(videoSceneSchema).optional(),
|
|
2124
|
+
descriptionEmbedding: z7.array(z7.number()).optional(),
|
|
2125
|
+
searchText: z7.string().optional(),
|
|
2027
2126
|
status: videoStatusSchema,
|
|
2028
|
-
errorMessage:
|
|
2029
|
-
createdAt:
|
|
2030
|
-
updatedAt:
|
|
2031
|
-
thumbnailUrl:
|
|
2032
|
-
});
|
|
2033
|
-
var videosWebhookResponseSchema =
|
|
2034
|
-
var videosGetRequestSchema =
|
|
2035
|
-
var videosSearchRequestSchema =
|
|
2036
|
-
query:
|
|
2037
|
-
limit:
|
|
2038
|
-
tags:
|
|
2039
|
-
});
|
|
2040
|
-
var videoSearchResultSchema =
|
|
2041
|
-
_id:
|
|
2042
|
-
thumbnailUrl:
|
|
2043
|
-
name:
|
|
2044
|
-
description:
|
|
2045
|
-
tags:
|
|
2046
|
-
status:
|
|
2047
|
-
duration:
|
|
2048
|
-
muxPlaybackId:
|
|
2049
|
-
createdAt:
|
|
2050
|
-
});
|
|
2051
|
-
var videosSearchResponseSchema =
|
|
2052
|
-
var videosUploadResponseSchema =
|
|
2053
|
-
var videosDeleteRequestSchema =
|
|
2054
|
-
var videosDeleteResponseSchema =
|
|
2127
|
+
errorMessage: z7.string().optional(),
|
|
2128
|
+
createdAt: z7.number(),
|
|
2129
|
+
updatedAt: z7.number(),
|
|
2130
|
+
thumbnailUrl: z7.string()
|
|
2131
|
+
});
|
|
2132
|
+
var videosWebhookResponseSchema = z7.object({ ok: z7.literal(true) });
|
|
2133
|
+
var videosGetRequestSchema = z7.object({ id: z7.string().min(1, "Missing id parameter") });
|
|
2134
|
+
var videosSearchRequestSchema = z7.object({
|
|
2135
|
+
query: z7.string().min(1),
|
|
2136
|
+
limit: z7.coerce.number().int().positive().max(100).optional(),
|
|
2137
|
+
tags: z7.array(z7.string()).optional()
|
|
2138
|
+
});
|
|
2139
|
+
var videoSearchResultSchema = z7.object({
|
|
2140
|
+
_id: z7.string(),
|
|
2141
|
+
thumbnailUrl: z7.string(),
|
|
2142
|
+
name: z7.string(),
|
|
2143
|
+
description: z7.string(),
|
|
2144
|
+
tags: z7.array(z7.string()),
|
|
2145
|
+
status: z7.string(),
|
|
2146
|
+
duration: z7.number().optional(),
|
|
2147
|
+
muxPlaybackId: z7.string(),
|
|
2148
|
+
createdAt: z7.number()
|
|
2149
|
+
});
|
|
2150
|
+
var videosSearchResponseSchema = z7.array(videoSearchResultSchema);
|
|
2151
|
+
var videosUploadResponseSchema = z7.object({ uploadUrl: z7.string(), videoId: z7.string() });
|
|
2152
|
+
var videosDeleteRequestSchema = z7.object({ id: z7.string().min(1, "Missing video ID") });
|
|
2153
|
+
var videosDeleteResponseSchema = z7.object({ ok: z7.literal(true) });
|
|
2055
2154
|
|
|
2056
2155
|
// src/commands/actions/complete.ts
|
|
2057
2156
|
import { defineCommand as defineCommand2 } from "citty";
|
|
@@ -3864,37 +3963,37 @@ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
|
|
|
3864
3963
|
var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
|
|
3865
3964
|
|
|
3866
3965
|
// ../api/src/ads-google/ops.ts
|
|
3867
|
-
import { z as
|
|
3868
|
-
var tempRefSchema2 =
|
|
3869
|
-
var refSchema =
|
|
3870
|
-
|
|
3871
|
-
|
|
3966
|
+
import { z as z8 } from "zod";
|
|
3967
|
+
var tempRefSchema2 = z8.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
|
|
3968
|
+
var refSchema = z8.union([
|
|
3969
|
+
z8.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
|
|
3970
|
+
z8.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
|
|
3872
3971
|
tempRefSchema2
|
|
3873
3972
|
]);
|
|
3874
3973
|
var targetRefSchema = refSchema;
|
|
3875
|
-
var microsSchema =
|
|
3876
|
-
var httpsUrlSchema2 =
|
|
3877
|
-
var customerIdSchema =
|
|
3878
|
-
var stageableStatusSchema2 =
|
|
3879
|
-
var matchTypeSchema =
|
|
3880
|
-
var keywordTextSchema =
|
|
3881
|
-
var budgetCreateSchema =
|
|
3882
|
-
name:
|
|
3974
|
+
var microsSchema = z8.number().int().positive("expected a positive micros amount");
|
|
3975
|
+
var httpsUrlSchema2 = z8.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
|
|
3976
|
+
var customerIdSchema = z8.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
|
|
3977
|
+
var stageableStatusSchema2 = z8.enum(STAGEABLE_CREATE_STATUSES2);
|
|
3978
|
+
var matchTypeSchema = z8.enum(KEYWORD_MATCH_TYPES);
|
|
3979
|
+
var keywordTextSchema = z8.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");
|
|
3980
|
+
var budgetCreateSchema = z8.object({
|
|
3981
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
|
|
3883
3982
|
amountMicros: microsSchema,
|
|
3884
|
-
deliveryMethod:
|
|
3885
|
-
explicitlyShared:
|
|
3983
|
+
deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
|
|
3984
|
+
explicitlyShared: z8.boolean().default(false)
|
|
3886
3985
|
});
|
|
3887
|
-
var budgetUpdateSchema =
|
|
3888
|
-
name:
|
|
3986
|
+
var budgetUpdateSchema = z8.object({
|
|
3987
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
|
|
3889
3988
|
amountMicros: microsSchema.optional(),
|
|
3890
|
-
deliveryMethod:
|
|
3989
|
+
deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).optional()
|
|
3891
3990
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3892
|
-
var biddingConfigSchema =
|
|
3893
|
-
type:
|
|
3991
|
+
var biddingConfigSchema = z8.object({
|
|
3992
|
+
type: z8.enum(BIDDING_STRATEGY_TYPES),
|
|
3894
3993
|
targetCpaMicros: microsSchema.optional(),
|
|
3895
|
-
targetRoas:
|
|
3994
|
+
targetRoas: z8.number().positive().optional(),
|
|
3896
3995
|
cpcBidCeilingMicros: microsSchema.optional(),
|
|
3897
|
-
enhancedCpcEnabled:
|
|
3996
|
+
enhancedCpcEnabled: z8.boolean().optional()
|
|
3898
3997
|
}).superRefine((p, ctx) => {
|
|
3899
3998
|
if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
|
|
3900
3999
|
ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
|
|
@@ -3903,17 +4002,17 @@ var biddingConfigSchema = z7.object({
|
|
|
3903
4002
|
ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
|
|
3904
4003
|
}
|
|
3905
4004
|
});
|
|
3906
|
-
var networkSettingsSchema =
|
|
3907
|
-
targetGoogleSearch:
|
|
3908
|
-
targetSearchNetwork:
|
|
3909
|
-
targetContentNetwork:
|
|
3910
|
-
targetPartnerSearchNetwork:
|
|
4005
|
+
var networkSettingsSchema = z8.object({
|
|
4006
|
+
targetGoogleSearch: z8.boolean().optional(),
|
|
4007
|
+
targetSearchNetwork: z8.boolean().optional(),
|
|
4008
|
+
targetContentNetwork: z8.boolean().optional(),
|
|
4009
|
+
targetPartnerSearchNetwork: z8.boolean().optional()
|
|
3911
4010
|
});
|
|
3912
|
-
var dateSchema =
|
|
3913
|
-
var campaignCreateSchema2 =
|
|
3914
|
-
name:
|
|
3915
|
-
channelType:
|
|
3916
|
-
channelSubType:
|
|
4011
|
+
var dateSchema = z8.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
|
|
4012
|
+
var campaignCreateSchema2 = z8.object({
|
|
4013
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
|
|
4014
|
+
channelType: z8.enum(ADVERTISING_CHANNEL_TYPES),
|
|
4015
|
+
channelSubType: z8.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
|
|
3917
4016
|
budget: refSchema,
|
|
3918
4017
|
/** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
|
|
3919
4018
|
bidding: biddingConfigSchema.optional(),
|
|
@@ -3922,7 +4021,7 @@ var campaignCreateSchema2 = z7.object({
|
|
|
3922
4021
|
startDate: dateSchema.optional(),
|
|
3923
4022
|
endDate: dateSchema.optional(),
|
|
3924
4023
|
/** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
|
|
3925
|
-
objective:
|
|
4024
|
+
objective: z8.enum(CAMPAIGN_OBJECTIVES).optional(),
|
|
3926
4025
|
status: stageableStatusSchema2.default("PAUSED")
|
|
3927
4026
|
}).superRefine((p, ctx) => {
|
|
3928
4027
|
if (!p.bidding && !p.biddingStrategy) {
|
|
@@ -3946,129 +4045,129 @@ var campaignCreateSchema2 = z7.object({
|
|
|
3946
4045
|
ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
|
|
3947
4046
|
}
|
|
3948
4047
|
});
|
|
3949
|
-
var campaignUpdateSchema2 =
|
|
3950
|
-
name:
|
|
4048
|
+
var campaignUpdateSchema2 = z8.object({
|
|
4049
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
|
|
3951
4050
|
budget: refSchema.optional(),
|
|
3952
4051
|
bidding: biddingConfigSchema.optional(),
|
|
3953
4052
|
networkSettings: networkSettingsSchema.optional(),
|
|
3954
4053
|
startDate: dateSchema.optional(),
|
|
3955
4054
|
endDate: dateSchema.optional(),
|
|
3956
|
-
status:
|
|
4055
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3957
4056
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3958
|
-
var adGroupCreateSchema =
|
|
3959
|
-
name:
|
|
4057
|
+
var adGroupCreateSchema = z8.object({
|
|
4058
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
|
|
3960
4059
|
campaign: refSchema,
|
|
3961
|
-
type:
|
|
4060
|
+
type: z8.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
|
|
3962
4061
|
cpcBidMicros: microsSchema.optional(),
|
|
3963
4062
|
status: stageableStatusSchema2.default("PAUSED")
|
|
3964
4063
|
});
|
|
3965
|
-
var adGroupUpdateSchema =
|
|
3966
|
-
name:
|
|
4064
|
+
var adGroupUpdateSchema = z8.object({
|
|
4065
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
|
|
3967
4066
|
cpcBidMicros: microsSchema.optional(),
|
|
3968
|
-
status:
|
|
4067
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3969
4068
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3970
|
-
var keywordAddSchema =
|
|
4069
|
+
var keywordAddSchema = z8.object({
|
|
3971
4070
|
adGroup: refSchema,
|
|
3972
4071
|
text: keywordTextSchema,
|
|
3973
4072
|
matchType: matchTypeSchema,
|
|
3974
4073
|
cpcBidMicros: microsSchema.optional(),
|
|
3975
|
-
finalUrls:
|
|
4074
|
+
finalUrls: z8.array(httpsUrlSchema2).optional(),
|
|
3976
4075
|
status: stageableStatusSchema2.default("ENABLED")
|
|
3977
4076
|
});
|
|
3978
|
-
var keywordUpdateSchema =
|
|
4077
|
+
var keywordUpdateSchema = z8.object({
|
|
3979
4078
|
cpcBidMicros: microsSchema.optional(),
|
|
3980
|
-
finalUrls:
|
|
3981
|
-
status:
|
|
4079
|
+
finalUrls: z8.array(httpsUrlSchema2).optional(),
|
|
4080
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
3982
4081
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
3983
|
-
var negativeKeywordAddSchema =
|
|
3984
|
-
level:
|
|
4082
|
+
var negativeKeywordAddSchema = z8.object({
|
|
4083
|
+
level: z8.enum(["adGroup", "campaign"]),
|
|
3985
4084
|
parent: refSchema,
|
|
3986
4085
|
text: keywordTextSchema,
|
|
3987
4086
|
matchType: matchTypeSchema
|
|
3988
4087
|
});
|
|
3989
|
-
var sharedSetCreateSchema =
|
|
3990
|
-
name:
|
|
3991
|
-
type:
|
|
4088
|
+
var sharedSetCreateSchema = z8.object({
|
|
4089
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
|
|
4090
|
+
type: z8.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
|
|
3992
4091
|
});
|
|
3993
|
-
var sharedSetMemberAddSchema =
|
|
4092
|
+
var sharedSetMemberAddSchema = z8.object({
|
|
3994
4093
|
sharedSet: refSchema,
|
|
3995
4094
|
text: keywordTextSchema,
|
|
3996
4095
|
matchType: matchTypeSchema
|
|
3997
4096
|
});
|
|
3998
|
-
var campaignSharedSetAttachSchema =
|
|
4097
|
+
var campaignSharedSetAttachSchema = z8.object({
|
|
3999
4098
|
campaign: refSchema,
|
|
4000
4099
|
sharedSet: refSchema
|
|
4001
4100
|
});
|
|
4002
|
-
var adTextAssetSchema =
|
|
4003
|
-
text:
|
|
4004
|
-
pinnedField:
|
|
4101
|
+
var adTextAssetSchema = z8.object({
|
|
4102
|
+
text: z8.string().min(1),
|
|
4103
|
+
pinnedField: z8.enum(PINNED_FIELDS).optional()
|
|
4005
4104
|
});
|
|
4006
|
-
var responsiveSearchAdSchema =
|
|
4007
|
-
format:
|
|
4008
|
-
headlines:
|
|
4105
|
+
var responsiveSearchAdSchema = z8.object({
|
|
4106
|
+
format: z8.literal("responsiveSearch"),
|
|
4107
|
+
headlines: z8.array(
|
|
4009
4108
|
adTextAssetSchema.refine(
|
|
4010
4109
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
|
|
4011
4110
|
"headline exceeds 30 chars"
|
|
4012
4111
|
)
|
|
4013
4112
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
|
|
4014
|
-
descriptions:
|
|
4113
|
+
descriptions: z8.array(
|
|
4015
4114
|
adTextAssetSchema.refine(
|
|
4016
4115
|
(a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
|
|
4017
4116
|
"description exceeds 90 chars"
|
|
4018
4117
|
)
|
|
4019
4118
|
).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
|
|
4020
|
-
path1:
|
|
4021
|
-
path2:
|
|
4022
|
-
finalUrls:
|
|
4023
|
-
});
|
|
4024
|
-
var responsiveDisplayAdSchema =
|
|
4025
|
-
format:
|
|
4026
|
-
headlines:
|
|
4027
|
-
longHeadline:
|
|
4028
|
-
descriptions:
|
|
4029
|
-
businessName:
|
|
4119
|
+
path1: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4120
|
+
path2: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
|
|
4121
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4122
|
+
});
|
|
4123
|
+
var responsiveDisplayAdSchema = z8.object({
|
|
4124
|
+
format: z8.literal("responsiveDisplay"),
|
|
4125
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
|
|
4126
|
+
longHeadline: z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
|
|
4127
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
|
|
4128
|
+
businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
|
|
4030
4129
|
// A Responsive Display Ad's images are fields on the ad's own content (never campaign-level
|
|
4031
4130
|
// asset links). Google requires ≥1 landscape marketing image (1.91:1) AND ≥1 square marketing
|
|
4032
4131
|
// image (1:1) to serve; the logo images are optional.
|
|
4033
|
-
marketingImageAssets:
|
|
4034
|
-
squareMarketingImageAssets:
|
|
4035
|
-
logoImageAssets:
|
|
4036
|
-
finalUrls:
|
|
4037
|
-
});
|
|
4038
|
-
var callAdSchema =
|
|
4039
|
-
format:
|
|
4040
|
-
countryCode:
|
|
4041
|
-
phoneNumber:
|
|
4042
|
-
headline1:
|
|
4043
|
-
headline2:
|
|
4044
|
-
description1:
|
|
4045
|
-
description2:
|
|
4046
|
-
businessName:
|
|
4047
|
-
finalUrls:
|
|
4048
|
-
});
|
|
4049
|
-
var appAdSchema =
|
|
4050
|
-
format:
|
|
4051
|
-
headlines:
|
|
4052
|
-
descriptions:
|
|
4053
|
-
});
|
|
4054
|
-
var videoAdSchema =
|
|
4055
|
-
format:
|
|
4132
|
+
marketingImageAssets: z8.array(refSchema).optional(),
|
|
4133
|
+
squareMarketingImageAssets: z8.array(refSchema).optional(),
|
|
4134
|
+
logoImageAssets: z8.array(refSchema).optional(),
|
|
4135
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4136
|
+
});
|
|
4137
|
+
var callAdSchema = z8.object({
|
|
4138
|
+
format: z8.literal("call"),
|
|
4139
|
+
countryCode: z8.string().length(2),
|
|
4140
|
+
phoneNumber: z8.string().min(3),
|
|
4141
|
+
headline1: z8.string().min(1).max(30),
|
|
4142
|
+
headline2: z8.string().min(1).max(30),
|
|
4143
|
+
description1: z8.string().min(1).max(90),
|
|
4144
|
+
description2: z8.string().min(1).max(90),
|
|
4145
|
+
businessName: z8.string().min(1).max(25),
|
|
4146
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4147
|
+
});
|
|
4148
|
+
var appAdSchema = z8.object({
|
|
4149
|
+
format: z8.literal("app"),
|
|
4150
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(1),
|
|
4151
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1)
|
|
4152
|
+
});
|
|
4153
|
+
var videoAdSchema = z8.object({
|
|
4154
|
+
format: z8.literal("video"),
|
|
4056
4155
|
// A raw YouTube id is not a publishable Google Ads reference — the video must be staged as
|
|
4057
4156
|
// its own `google.asset.create` (type: youtubeVideo) first, then referenced here by asset ref.
|
|
4058
|
-
videoAssets:
|
|
4059
|
-
finalUrls:
|
|
4060
|
-
});
|
|
4061
|
-
var demandGenAdSchema =
|
|
4062
|
-
format:
|
|
4063
|
-
headlines:
|
|
4064
|
-
descriptions:
|
|
4065
|
-
businessName:
|
|
4066
|
-
finalUrls:
|
|
4067
|
-
imageAssets:
|
|
4068
|
-
squareImageAssets:
|
|
4069
|
-
logoImageAssets:
|
|
4070
|
-
});
|
|
4071
|
-
var adContentSchema =
|
|
4157
|
+
videoAssets: z8.array(refSchema).min(1),
|
|
4158
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4159
|
+
});
|
|
4160
|
+
var demandGenAdSchema = z8.object({
|
|
4161
|
+
format: z8.literal("demandGen"),
|
|
4162
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(40) })).min(1).max(5),
|
|
4163
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1).max(5),
|
|
4164
|
+
businessName: z8.string().min(1).max(25),
|
|
4165
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1),
|
|
4166
|
+
imageAssets: z8.array(refSchema).optional(),
|
|
4167
|
+
squareImageAssets: z8.array(refSchema).optional(),
|
|
4168
|
+
logoImageAssets: z8.array(refSchema).optional()
|
|
4169
|
+
});
|
|
4170
|
+
var adContentSchema = z8.discriminatedUnion("format", [
|
|
4072
4171
|
responsiveSearchAdSchema,
|
|
4073
4172
|
responsiveDisplayAdSchema,
|
|
4074
4173
|
callAdSchema,
|
|
@@ -4076,45 +4175,45 @@ var adContentSchema = z7.discriminatedUnion("format", [
|
|
|
4076
4175
|
videoAdSchema,
|
|
4077
4176
|
demandGenAdSchema
|
|
4078
4177
|
]);
|
|
4079
|
-
var adCreateSchema =
|
|
4178
|
+
var adCreateSchema = z8.object({
|
|
4080
4179
|
adGroup: refSchema,
|
|
4081
4180
|
status: stageableStatusSchema2.default("PAUSED"),
|
|
4082
4181
|
content: adContentSchema
|
|
4083
4182
|
});
|
|
4084
|
-
var adUpdateSchema =
|
|
4085
|
-
status:
|
|
4183
|
+
var adUpdateSchema = z8.object({
|
|
4184
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
|
|
4086
4185
|
/** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
|
|
4087
|
-
content:
|
|
4186
|
+
content: z8.record(z8.string(), z8.unknown()).optional()
|
|
4088
4187
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4089
|
-
var textAssetSchema =
|
|
4090
|
-
var imageAssetSchema =
|
|
4091
|
-
type:
|
|
4092
|
-
imageId:
|
|
4093
|
-
name:
|
|
4094
|
-
});
|
|
4095
|
-
var youtubeVideoAssetSchema =
|
|
4096
|
-
type:
|
|
4097
|
-
youtubeVideoId:
|
|
4098
|
-
name:
|
|
4099
|
-
});
|
|
4100
|
-
var sitelinkAssetSchema =
|
|
4101
|
-
type:
|
|
4102
|
-
linkText:
|
|
4103
|
-
description1:
|
|
4104
|
-
description2:
|
|
4105
|
-
finalUrls:
|
|
4106
|
-
});
|
|
4107
|
-
var calloutAssetSchema =
|
|
4108
|
-
type:
|
|
4109
|
-
calloutText:
|
|
4110
|
-
});
|
|
4111
|
-
var structuredSnippetAssetSchema =
|
|
4112
|
-
type:
|
|
4113
|
-
header:
|
|
4114
|
-
values:
|
|
4115
|
-
});
|
|
4116
|
-
var callToActionAssetSchema =
|
|
4117
|
-
var assetCreateSchema =
|
|
4188
|
+
var textAssetSchema = z8.object({ type: z8.literal("text"), text: z8.string().min(1) });
|
|
4189
|
+
var imageAssetSchema = z8.object({
|
|
4190
|
+
type: z8.literal("image"),
|
|
4191
|
+
imageId: z8.string().min(1),
|
|
4192
|
+
name: z8.string().optional()
|
|
4193
|
+
});
|
|
4194
|
+
var youtubeVideoAssetSchema = z8.object({
|
|
4195
|
+
type: z8.literal("youtubeVideo"),
|
|
4196
|
+
youtubeVideoId: z8.string().min(1),
|
|
4197
|
+
name: z8.string().optional()
|
|
4198
|
+
});
|
|
4199
|
+
var sitelinkAssetSchema = z8.object({
|
|
4200
|
+
type: z8.literal("sitelink"),
|
|
4201
|
+
linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
|
|
4202
|
+
description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4203
|
+
description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4204
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1)
|
|
4205
|
+
});
|
|
4206
|
+
var calloutAssetSchema = z8.object({
|
|
4207
|
+
type: z8.literal("callout"),
|
|
4208
|
+
calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
|
|
4209
|
+
});
|
|
4210
|
+
var structuredSnippetAssetSchema = z8.object({
|
|
4211
|
+
type: z8.literal("structuredSnippet"),
|
|
4212
|
+
header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
|
|
4213
|
+
values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
|
|
4214
|
+
});
|
|
4215
|
+
var callToActionAssetSchema = z8.object({ type: z8.literal("callToAction"), callToAction: z8.string().min(1) });
|
|
4216
|
+
var assetCreateSchema = z8.discriminatedUnion("type", [
|
|
4118
4217
|
textAssetSchema,
|
|
4119
4218
|
imageAssetSchema,
|
|
4120
4219
|
youtubeVideoAssetSchema,
|
|
@@ -4123,136 +4222,136 @@ var assetCreateSchema = z7.discriminatedUnion("type", [
|
|
|
4123
4222
|
structuredSnippetAssetSchema,
|
|
4124
4223
|
callToActionAssetSchema
|
|
4125
4224
|
]);
|
|
4126
|
-
var assetUpdateSchema =
|
|
4127
|
-
name:
|
|
4128
|
-
linkText:
|
|
4129
|
-
description1:
|
|
4130
|
-
description2:
|
|
4131
|
-
finalUrls:
|
|
4132
|
-
calloutText:
|
|
4133
|
-
header:
|
|
4134
|
-
values:
|
|
4135
|
-
callToAction:
|
|
4136
|
-
text:
|
|
4225
|
+
var assetUpdateSchema = z8.object({
|
|
4226
|
+
name: z8.string().min(1).optional(),
|
|
4227
|
+
linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax).optional(),
|
|
4228
|
+
description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4229
|
+
description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
|
|
4230
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1).optional(),
|
|
4231
|
+
calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax).optional(),
|
|
4232
|
+
header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax).optional(),
|
|
4233
|
+
values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax).optional(),
|
|
4234
|
+
callToAction: z8.string().min(1).optional(),
|
|
4235
|
+
text: z8.string().min(1).optional()
|
|
4137
4236
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4138
|
-
var assetLinkAttachSchema =
|
|
4139
|
-
level:
|
|
4237
|
+
var assetLinkAttachSchema = z8.object({
|
|
4238
|
+
level: z8.enum(["campaign", "adGroup", "customer"]),
|
|
4140
4239
|
parent: refSchema.optional(),
|
|
4141
4240
|
asset: refSchema,
|
|
4142
|
-
fieldType:
|
|
4241
|
+
fieldType: z8.enum(ASSET_FIELD_TYPES)
|
|
4143
4242
|
}).superRefine((value, ctx) => {
|
|
4144
4243
|
if (value.level !== "customer" && !value.parent) {
|
|
4145
4244
|
ctx.addIssue({
|
|
4146
|
-
code:
|
|
4245
|
+
code: z8.ZodIssueCode.custom,
|
|
4147
4246
|
path: ["parent"],
|
|
4148
4247
|
message: `parent is required for a ${value.level}-level asset link (--parent-ref)`
|
|
4149
4248
|
});
|
|
4150
4249
|
}
|
|
4151
4250
|
});
|
|
4152
|
-
var assetGroupCreateSchema =
|
|
4251
|
+
var assetGroupCreateSchema = z8.object({
|
|
4153
4252
|
campaign: refSchema,
|
|
4154
|
-
name:
|
|
4155
|
-
finalUrls:
|
|
4156
|
-
headlines:
|
|
4157
|
-
longHeadlines:
|
|
4158
|
-
descriptions:
|
|
4159
|
-
businessName:
|
|
4160
|
-
imageAssets:
|
|
4161
|
-
squareImageAssets:
|
|
4162
|
-
logoAssets:
|
|
4163
|
-
status:
|
|
4164
|
-
});
|
|
4165
|
-
var assetGroupUpdateSchema =
|
|
4166
|
-
name:
|
|
4167
|
-
finalUrls:
|
|
4168
|
-
status:
|
|
4253
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax),
|
|
4254
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1),
|
|
4255
|
+
headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.headlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.headlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.headlinesMax),
|
|
4256
|
+
longHeadlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlineTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMin).max(GOOGLE_ADS_LIMITS.assetGroup.longHeadlinesMax),
|
|
4257
|
+
descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionTextMax) })).min(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMin).max(GOOGLE_ADS_LIMITS.assetGroup.descriptionsMax),
|
|
4258
|
+
businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.businessNameMax),
|
|
4259
|
+
imageAssets: z8.array(refSchema).optional(),
|
|
4260
|
+
squareImageAssets: z8.array(refSchema).optional(),
|
|
4261
|
+
logoAssets: z8.array(refSchema).optional(),
|
|
4262
|
+
status: z8.enum(["ENABLED", "PAUSED"]).default("PAUSED")
|
|
4263
|
+
});
|
|
4264
|
+
var assetGroupUpdateSchema = z8.object({
|
|
4265
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.assetGroup.nameMax).optional(),
|
|
4266
|
+
finalUrls: z8.array(httpsUrlSchema2).min(1).optional(),
|
|
4267
|
+
status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
|
|
4169
4268
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4170
|
-
var audienceCreateSchema2 =
|
|
4171
|
-
name:
|
|
4172
|
-
type:
|
|
4173
|
-
description:
|
|
4269
|
+
var audienceCreateSchema2 = z8.object({
|
|
4270
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
|
|
4271
|
+
type: z8.enum(USER_LIST_TYPES).default("BASIC"),
|
|
4272
|
+
description: z8.string().optional(),
|
|
4174
4273
|
/** Customer-match members (crm-based) — file-first for large lists. */
|
|
4175
|
-
members:
|
|
4176
|
-
sourceFileRef:
|
|
4274
|
+
members: z8.array(z8.record(z8.string(), z8.string())).optional(),
|
|
4275
|
+
sourceFileRef: z8.string().optional()
|
|
4177
4276
|
});
|
|
4178
|
-
var audienceCriterionAttachSchema =
|
|
4179
|
-
level:
|
|
4277
|
+
var audienceCriterionAttachSchema = z8.object({
|
|
4278
|
+
level: z8.enum(["campaign", "adGroup"]),
|
|
4180
4279
|
parent: refSchema,
|
|
4181
4280
|
userList: refSchema,
|
|
4182
|
-
negative:
|
|
4281
|
+
negative: z8.boolean().default(false)
|
|
4183
4282
|
});
|
|
4184
|
-
var conversionActionCreateSchema =
|
|
4185
|
-
name:
|
|
4186
|
-
type:
|
|
4187
|
-
category:
|
|
4188
|
-
countingType:
|
|
4283
|
+
var conversionActionCreateSchema = z8.object({
|
|
4284
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
|
|
4285
|
+
type: z8.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
|
|
4286
|
+
category: z8.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
|
|
4287
|
+
countingType: z8.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
|
|
4189
4288
|
defaultValueMicros: microsSchema.optional(),
|
|
4190
|
-
defaultCurrencyCode:
|
|
4191
|
-
clickThroughLookbackWindowDays:
|
|
4192
|
-
viewThroughLookbackWindowDays:
|
|
4193
|
-
status:
|
|
4194
|
-
});
|
|
4195
|
-
var conversionActionUpdateSchema =
|
|
4196
|
-
name:
|
|
4197
|
-
category:
|
|
4198
|
-
countingType:
|
|
4289
|
+
defaultCurrencyCode: z8.string().length(3).optional(),
|
|
4290
|
+
clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4291
|
+
viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4292
|
+
status: z8.enum(["ENABLED", "PAUSED"]).default("ENABLED")
|
|
4293
|
+
});
|
|
4294
|
+
var conversionActionUpdateSchema = z8.object({
|
|
4295
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
|
|
4296
|
+
category: z8.enum(CONVERSION_ACTION_CATEGORIES).optional(),
|
|
4297
|
+
countingType: z8.enum(CONVERSION_COUNTING_TYPES).optional(),
|
|
4199
4298
|
defaultValueMicros: microsSchema.optional(),
|
|
4200
|
-
defaultCurrencyCode:
|
|
4201
|
-
clickThroughLookbackWindowDays:
|
|
4202
|
-
viewThroughLookbackWindowDays:
|
|
4203
|
-
status:
|
|
4299
|
+
defaultCurrencyCode: z8.string().length(3).optional(),
|
|
4300
|
+
clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4301
|
+
viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
|
|
4302
|
+
status: z8.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
|
|
4204
4303
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4205
|
-
var biddingStrategyCreateSchema =
|
|
4206
|
-
name:
|
|
4304
|
+
var biddingStrategyCreateSchema = z8.object({
|
|
4305
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
|
|
4207
4306
|
config: biddingConfigSchema
|
|
4208
4307
|
}).superRefine((p, ctx) => {
|
|
4209
4308
|
if (p.config.type === "MANUAL_CPC") {
|
|
4210
4309
|
ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
|
|
4211
4310
|
}
|
|
4212
4311
|
});
|
|
4213
|
-
var biddingStrategyUpdateSchema =
|
|
4214
|
-
name:
|
|
4312
|
+
var biddingStrategyUpdateSchema = z8.object({
|
|
4313
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
|
|
4215
4314
|
config: biddingConfigSchema.optional()
|
|
4216
4315
|
}).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
|
|
4217
|
-
var labelCreateSchema =
|
|
4218
|
-
name:
|
|
4219
|
-
backgroundColor:
|
|
4220
|
-
description:
|
|
4316
|
+
var labelCreateSchema = z8.object({
|
|
4317
|
+
name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
|
|
4318
|
+
backgroundColor: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
|
|
4319
|
+
description: z8.string().optional()
|
|
4221
4320
|
});
|
|
4222
|
-
var labelAttachSchema =
|
|
4223
|
-
level:
|
|
4321
|
+
var labelAttachSchema = z8.object({
|
|
4322
|
+
level: z8.enum(["campaign", "adGroup", "ad"]),
|
|
4224
4323
|
parent: refSchema,
|
|
4225
4324
|
label: refSchema
|
|
4226
4325
|
});
|
|
4227
|
-
var locationCriterionSchema =
|
|
4228
|
-
criterionType:
|
|
4229
|
-
geoTargetConstant:
|
|
4230
|
-
});
|
|
4231
|
-
var languageCriterionSchema =
|
|
4232
|
-
criterionType:
|
|
4233
|
-
languageConstant:
|
|
4234
|
-
});
|
|
4235
|
-
var adScheduleCriterionSchema =
|
|
4236
|
-
criterionType:
|
|
4237
|
-
dayOfWeek:
|
|
4238
|
-
startHour:
|
|
4239
|
-
startMinute:
|
|
4240
|
-
endHour:
|
|
4241
|
-
endMinute:
|
|
4242
|
-
});
|
|
4243
|
-
var deviceCriterionSchema =
|
|
4244
|
-
criterionType:
|
|
4245
|
-
device:
|
|
4326
|
+
var locationCriterionSchema = z8.object({
|
|
4327
|
+
criterionType: z8.literal("location"),
|
|
4328
|
+
geoTargetConstant: z8.union([z8.string().regex(GEO_TARGET_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
|
|
4329
|
+
});
|
|
4330
|
+
var languageCriterionSchema = z8.object({
|
|
4331
|
+
criterionType: z8.literal("language"),
|
|
4332
|
+
languageConstant: z8.union([z8.string().regex(LANGUAGE_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
|
|
4333
|
+
});
|
|
4334
|
+
var adScheduleCriterionSchema = z8.object({
|
|
4335
|
+
criterionType: z8.literal("adSchedule"),
|
|
4336
|
+
dayOfWeek: z8.enum(DAYS_OF_WEEK),
|
|
4337
|
+
startHour: z8.number().int().min(0).max(23),
|
|
4338
|
+
startMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
|
|
4339
|
+
endHour: z8.number().int().min(0).max(24),
|
|
4340
|
+
endMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
|
|
4341
|
+
});
|
|
4342
|
+
var deviceCriterionSchema = z8.object({
|
|
4343
|
+
criterionType: z8.literal("device"),
|
|
4344
|
+
device: z8.enum(DEVICE_TYPES),
|
|
4246
4345
|
// Google's `CampaignCriterion.bid_modifier`: "The modifier must be in the range 0.1 - 10.0. Use 0
|
|
4247
4346
|
// 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.
|
|
4248
|
-
bidModifier:
|
|
4347
|
+
bidModifier: z8.number().min(0).max(10).optional().refine((v) => v === void 0 || v === 0 || v >= 0.1, {
|
|
4249
4348
|
message: "bid modifier must be 0 (exclude the device) or between 0.1 and 10.0"
|
|
4250
4349
|
})
|
|
4251
4350
|
});
|
|
4252
|
-
var campaignCriterionAddSchema =
|
|
4351
|
+
var campaignCriterionAddSchema = z8.object({
|
|
4253
4352
|
campaign: refSchema,
|
|
4254
|
-
negative:
|
|
4255
|
-
criterion:
|
|
4353
|
+
negative: z8.boolean().default(false),
|
|
4354
|
+
criterion: z8.discriminatedUnion("criterionType", [
|
|
4256
4355
|
locationCriterionSchema,
|
|
4257
4356
|
languageCriterionSchema,
|
|
4258
4357
|
adScheduleCriterionSchema,
|
|
@@ -4262,7 +4361,7 @@ var campaignCriterionAddSchema = z7.object({
|
|
|
4262
4361
|
const c = val.criterion;
|
|
4263
4362
|
if (c.criterionType === "adSchedule" && c.endHour === 24 && c.endMinute !== "ZERO") {
|
|
4264
4363
|
ctx.addIssue({
|
|
4265
|
-
code:
|
|
4364
|
+
code: z8.ZodIssueCode.custom,
|
|
4266
4365
|
message: "endHour 24 (midnight) cannot have a non-zero endMinute",
|
|
4267
4366
|
path: ["criterion", "endMinute"]
|
|
4268
4367
|
});
|
|
@@ -4314,17 +4413,17 @@ var GOOGLE_DRAFT_OP_KINDS = [
|
|
|
4314
4413
|
"google.campaignCriterion.add",
|
|
4315
4414
|
"google.campaignCriterion.remove"
|
|
4316
4415
|
];
|
|
4317
|
-
var googleDraftOpKindSchema =
|
|
4416
|
+
var googleDraftOpKindSchema = z8.enum(GOOGLE_DRAFT_OP_KINDS);
|
|
4318
4417
|
function createOp2(kind, payload) {
|
|
4319
|
-
return
|
|
4418
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, payload });
|
|
4320
4419
|
}
|
|
4321
4420
|
function updateOp2(kind, payload) {
|
|
4322
|
-
return
|
|
4421
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
|
|
4323
4422
|
}
|
|
4324
4423
|
function targetOp(kind) {
|
|
4325
|
-
return
|
|
4424
|
+
return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
|
|
4326
4425
|
}
|
|
4327
|
-
var googleDraftOpInputSchema =
|
|
4426
|
+
var googleDraftOpInputSchema = z8.discriminatedUnion("kind", [
|
|
4328
4427
|
createOp2("google.budget.create", budgetCreateSchema),
|
|
4329
4428
|
updateOp2("google.budget.update", budgetUpdateSchema),
|
|
4330
4429
|
createOp2("google.campaign.create", campaignCreateSchema2),
|
|
@@ -4372,132 +4471,132 @@ var googleDraftOpInputSchema = z7.discriminatedUnion("kind", [
|
|
|
4372
4471
|
]);
|
|
4373
4472
|
|
|
4374
4473
|
// ../api/src/ads-google/wire.ts
|
|
4375
|
-
import { z as
|
|
4376
|
-
var googleWriteModeSchema =
|
|
4377
|
-
var googleDraftOpResultSchema =
|
|
4378
|
-
status:
|
|
4379
|
-
resourceName:
|
|
4380
|
-
error:
|
|
4381
|
-
skippedBecause:
|
|
4382
|
-
executedAt:
|
|
4383
|
-
});
|
|
4384
|
-
var googleDraftStageRequestSchema =
|
|
4385
|
-
chatId:
|
|
4474
|
+
import { z as z9 } from "zod";
|
|
4475
|
+
var googleWriteModeSchema = z9.enum(["live", "simulated"]);
|
|
4476
|
+
var googleDraftOpResultSchema = z9.object({
|
|
4477
|
+
status: z9.enum(["applied", "simulated", "failed", "skipped"]),
|
|
4478
|
+
resourceName: z9.string().optional(),
|
|
4479
|
+
error: z9.string().optional(),
|
|
4480
|
+
skippedBecause: z9.string().optional(),
|
|
4481
|
+
executedAt: z9.number().optional()
|
|
4482
|
+
});
|
|
4483
|
+
var googleDraftStageRequestSchema = z9.object({
|
|
4484
|
+
chatId: z9.string(),
|
|
4386
4485
|
op: googleDraftOpInputSchema
|
|
4387
4486
|
});
|
|
4388
|
-
var googleDraftStageResponseSchema =
|
|
4389
|
-
staged:
|
|
4390
|
-
ref:
|
|
4487
|
+
var googleDraftStageResponseSchema = z9.object({
|
|
4488
|
+
staged: z9.literal(true),
|
|
4489
|
+
ref: z9.string(),
|
|
4391
4490
|
kind: googleDraftOpKindSchema,
|
|
4392
4491
|
mode: googleWriteModeSchema,
|
|
4393
|
-
dependsOn:
|
|
4394
|
-
summary:
|
|
4395
|
-
warnings:
|
|
4492
|
+
dependsOn: z9.array(z9.string()),
|
|
4493
|
+
summary: z9.string(),
|
|
4494
|
+
warnings: z9.array(z9.string()),
|
|
4396
4495
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
4397
|
-
amended:
|
|
4496
|
+
amended: z9.boolean().optional()
|
|
4398
4497
|
});
|
|
4399
|
-
var googleDraftAmendRequestSchema =
|
|
4400
|
-
chatId:
|
|
4401
|
-
ref:
|
|
4402
|
-
patch:
|
|
4498
|
+
var googleDraftAmendRequestSchema = z9.object({
|
|
4499
|
+
chatId: z9.string(),
|
|
4500
|
+
ref: z9.string(),
|
|
4501
|
+
patch: z9.record(z9.string(), z9.unknown())
|
|
4403
4502
|
});
|
|
4404
|
-
var googleDraftShowRequestSchema =
|
|
4405
|
-
chatId:
|
|
4406
|
-
ref:
|
|
4503
|
+
var googleDraftShowRequestSchema = z9.object({
|
|
4504
|
+
chatId: z9.string(),
|
|
4505
|
+
ref: z9.string()
|
|
4407
4506
|
});
|
|
4408
4507
|
var GOOGLE_DRAFT_BATCH_MAX = 500;
|
|
4409
|
-
var googleDraftStageBatchRequestSchema =
|
|
4410
|
-
chatId:
|
|
4411
|
-
ops:
|
|
4508
|
+
var googleDraftStageBatchRequestSchema = z9.object({
|
|
4509
|
+
chatId: z9.string(),
|
|
4510
|
+
ops: z9.array(googleDraftOpInputSchema).min(1).max(GOOGLE_DRAFT_BATCH_MAX)
|
|
4412
4511
|
});
|
|
4413
|
-
var googleDraftStageBatchResponseSchema =
|
|
4414
|
-
staged:
|
|
4512
|
+
var googleDraftStageBatchResponseSchema = z9.object({
|
|
4513
|
+
staged: z9.literal(true),
|
|
4415
4514
|
mode: googleWriteModeSchema,
|
|
4416
|
-
count:
|
|
4417
|
-
ops:
|
|
4418
|
-
|
|
4419
|
-
ref:
|
|
4515
|
+
count: z9.number(),
|
|
4516
|
+
ops: z9.array(
|
|
4517
|
+
z9.object({
|
|
4518
|
+
ref: z9.string(),
|
|
4420
4519
|
kind: googleDraftOpKindSchema,
|
|
4421
|
-
dependsOn:
|
|
4422
|
-
summary:
|
|
4423
|
-
warnings:
|
|
4520
|
+
dependsOn: z9.array(z9.string()),
|
|
4521
|
+
summary: z9.string(),
|
|
4522
|
+
warnings: z9.array(z9.string())
|
|
4424
4523
|
})
|
|
4425
4524
|
)
|
|
4426
4525
|
});
|
|
4427
|
-
var googleDraftOpViewSchema =
|
|
4428
|
-
ref:
|
|
4526
|
+
var googleDraftOpViewSchema = z9.object({
|
|
4527
|
+
ref: z9.string(),
|
|
4429
4528
|
kind: googleDraftOpKindSchema,
|
|
4430
|
-
customerId:
|
|
4431
|
-
target:
|
|
4432
|
-
dependsOn:
|
|
4433
|
-
summary:
|
|
4434
|
-
stagedAt:
|
|
4529
|
+
customerId: z9.string(),
|
|
4530
|
+
target: z9.string().optional(),
|
|
4531
|
+
dependsOn: z9.array(z9.string()),
|
|
4532
|
+
summary: z9.string(),
|
|
4533
|
+
stagedAt: z9.number(),
|
|
4435
4534
|
result: googleDraftOpResultSchema.optional()
|
|
4436
4535
|
});
|
|
4437
|
-
var googleDraftShowResponseSchema =
|
|
4536
|
+
var googleDraftShowResponseSchema = z9.object({
|
|
4438
4537
|
op: googleDraftOpViewSchema.extend({
|
|
4439
|
-
payload:
|
|
4440
|
-
warnings:
|
|
4441
|
-
annotations:
|
|
4538
|
+
payload: z9.unknown().optional(),
|
|
4539
|
+
warnings: z9.array(z9.string()).optional(),
|
|
4540
|
+
annotations: z9.unknown().optional()
|
|
4442
4541
|
})
|
|
4443
4542
|
});
|
|
4444
|
-
var googleDraftListRequestSchema =
|
|
4445
|
-
chatId:
|
|
4543
|
+
var googleDraftListRequestSchema = z9.object({
|
|
4544
|
+
chatId: z9.string()
|
|
4446
4545
|
});
|
|
4447
|
-
var googleDraftAdvisorySchema =
|
|
4448
|
-
scope:
|
|
4449
|
-
message:
|
|
4546
|
+
var googleDraftAdvisorySchema = z9.object({
|
|
4547
|
+
scope: z9.enum(["campaign", "adGroup"]),
|
|
4548
|
+
message: z9.string()
|
|
4450
4549
|
});
|
|
4451
|
-
var googleDraftStatusCollectionSchema =
|
|
4452
|
-
label:
|
|
4453
|
-
added:
|
|
4454
|
-
removed:
|
|
4455
|
-
existing:
|
|
4550
|
+
var googleDraftStatusCollectionSchema = z9.object({
|
|
4551
|
+
label: z9.string(),
|
|
4552
|
+
added: z9.number(),
|
|
4553
|
+
removed: z9.number(),
|
|
4554
|
+
existing: z9.number()
|
|
4456
4555
|
});
|
|
4457
|
-
var googleDraftChangeOperationSchema =
|
|
4458
|
-
var googleDraftStatusNodeSchema =
|
|
4459
|
-
() =>
|
|
4460
|
-
entity:
|
|
4461
|
-
name:
|
|
4556
|
+
var googleDraftChangeOperationSchema = z9.enum(["create", "update", "pause", "resume", "remove"]);
|
|
4557
|
+
var googleDraftStatusNodeSchema = z9.lazy(
|
|
4558
|
+
() => z9.object({
|
|
4559
|
+
entity: z9.string(),
|
|
4560
|
+
name: z9.string(),
|
|
4462
4561
|
operation: googleDraftChangeOperationSchema.optional(),
|
|
4463
|
-
existing:
|
|
4464
|
-
collections:
|
|
4465
|
-
children:
|
|
4466
|
-
warnings:
|
|
4562
|
+
existing: z9.boolean(),
|
|
4563
|
+
collections: z9.array(googleDraftStatusCollectionSchema),
|
|
4564
|
+
children: z9.array(googleDraftStatusNodeSchema),
|
|
4565
|
+
warnings: z9.array(z9.string()).optional()
|
|
4467
4566
|
})
|
|
4468
4567
|
);
|
|
4469
|
-
var googleDraftListResponseSchema =
|
|
4470
|
-
status:
|
|
4568
|
+
var googleDraftListResponseSchema = z9.object({
|
|
4569
|
+
status: z9.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
4471
4570
|
mode: googleWriteModeSchema,
|
|
4472
|
-
count:
|
|
4473
|
-
ops:
|
|
4571
|
+
count: z9.number(),
|
|
4572
|
+
ops: z9.array(googleDraftOpViewSchema),
|
|
4474
4573
|
/** Grouped campaign ▸ ad group ▸ ad tree for the readable CLI status view. */
|
|
4475
|
-
tree:
|
|
4574
|
+
tree: z9.array(googleDraftStatusNodeSchema).optional(),
|
|
4476
4575
|
/** Non-blocking completeness advisories for the whole draft. */
|
|
4477
|
-
advisories:
|
|
4576
|
+
advisories: z9.array(googleDraftAdvisorySchema).optional()
|
|
4478
4577
|
});
|
|
4479
|
-
var googleDraftRemoveRequestSchema =
|
|
4480
|
-
chatId:
|
|
4481
|
-
ref:
|
|
4578
|
+
var googleDraftRemoveRequestSchema = z9.object({
|
|
4579
|
+
chatId: z9.string(),
|
|
4580
|
+
ref: z9.string()
|
|
4482
4581
|
});
|
|
4483
|
-
var googleDraftRemoveResponseSchema =
|
|
4582
|
+
var googleDraftRemoveResponseSchema = z9.object({
|
|
4484
4583
|
/** The requested ref plus any dependents removed by cascade. */
|
|
4485
|
-
removed:
|
|
4584
|
+
removed: z9.array(z9.string())
|
|
4486
4585
|
});
|
|
4487
|
-
var googleDraftClearRequestSchema =
|
|
4488
|
-
chatId:
|
|
4586
|
+
var googleDraftClearRequestSchema = z9.object({
|
|
4587
|
+
chatId: z9.string()
|
|
4489
4588
|
});
|
|
4490
|
-
var googleDraftClearResponseSchema =
|
|
4491
|
-
cleared:
|
|
4589
|
+
var googleDraftClearResponseSchema = z9.object({
|
|
4590
|
+
cleared: z9.number()
|
|
4492
4591
|
});
|
|
4493
|
-
var googleFieldErrorSchema =
|
|
4494
|
-
path:
|
|
4495
|
-
message:
|
|
4592
|
+
var googleFieldErrorSchema = z9.object({
|
|
4593
|
+
path: z9.string(),
|
|
4594
|
+
message: z9.string()
|
|
4496
4595
|
});
|
|
4497
|
-
var googleDraftErrorResponseSchema =
|
|
4498
|
-
code:
|
|
4499
|
-
error:
|
|
4500
|
-
fields:
|
|
4596
|
+
var googleDraftErrorResponseSchema = z9.object({
|
|
4597
|
+
code: z9.string(),
|
|
4598
|
+
error: z9.string(),
|
|
4599
|
+
fields: z9.array(googleFieldErrorSchema).optional()
|
|
4501
4600
|
});
|
|
4502
4601
|
|
|
4503
4602
|
// src/commands/ads/google/draft-status.ts
|
|
@@ -10805,17 +10904,17 @@ var NUMERIC_ID_REGEX3 = /^\d+$/;
|
|
|
10805
10904
|
var IMAGE_HASH_REGEX = /^[A-Fa-f0-9]{16,}$/;
|
|
10806
10905
|
|
|
10807
10906
|
// ../api/src/ads-meta/ops.ts
|
|
10808
|
-
import { z as
|
|
10809
|
-
var tempRefSchema3 =
|
|
10810
|
-
var parentRefSchema2 =
|
|
10811
|
-
var moneySchema2 =
|
|
10812
|
-
amount:
|
|
10813
|
-
currencyCode:
|
|
10814
|
-
});
|
|
10815
|
-
var httpsUrlSchema3 =
|
|
10816
|
-
var bakerMediaIdSchema2 =
|
|
10817
|
-
var stageableStatusSchema3 =
|
|
10818
|
-
var updateStatusSchema =
|
|
10907
|
+
import { z as z10 } from "zod";
|
|
10908
|
+
var tempRefSchema3 = z10.string().regex(TEMP_REF_REGEX3, "expected a meta_temp_* reference");
|
|
10909
|
+
var parentRefSchema2 = z10.union([z10.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema3]);
|
|
10910
|
+
var moneySchema2 = z10.object({
|
|
10911
|
+
amount: z10.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"),
|
|
10912
|
+
currencyCode: z10.string().length(3).optional()
|
|
10913
|
+
});
|
|
10914
|
+
var httpsUrlSchema3 = z10.string().url().refine((u) => u.startsWith("https://"), "destination URLs must be https");
|
|
10915
|
+
var bakerMediaIdSchema2 = z10.string().min(1);
|
|
10916
|
+
var stageableStatusSchema3 = z10.enum(STAGEABLE_CREATE_STATUSES3);
|
|
10917
|
+
var updateStatusSchema = z10.enum(UPDATE_STATUSES);
|
|
10819
10918
|
function currencyMinimums2(currencyCode) {
|
|
10820
10919
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
10821
10920
|
}
|
|
@@ -10827,50 +10926,50 @@ function validateDailyBudgetFloor(money, ctx, path12) {
|
|
|
10827
10926
|
}
|
|
10828
10927
|
}
|
|
10829
10928
|
}
|
|
10830
|
-
var geoLocationsSchema =
|
|
10831
|
-
countries:
|
|
10832
|
-
regions:
|
|
10833
|
-
cities:
|
|
10834
|
-
zips:
|
|
10835
|
-
location_types:
|
|
10836
|
-
}).catchall(
|
|
10837
|
-
var idNameSchema =
|
|
10838
|
-
var metaTargetingSchema =
|
|
10929
|
+
var geoLocationsSchema = z10.object({
|
|
10930
|
+
countries: z10.array(z10.string().length(2)).optional(),
|
|
10931
|
+
regions: z10.array(z10.object({ key: z10.string() })).optional(),
|
|
10932
|
+
cities: z10.array(z10.object({ key: z10.string(), radius: z10.number().optional(), distance_unit: z10.string().optional() })).optional(),
|
|
10933
|
+
zips: z10.array(z10.object({ key: z10.string() })).optional(),
|
|
10934
|
+
location_types: z10.array(z10.string()).optional()
|
|
10935
|
+
}).catchall(z10.unknown());
|
|
10936
|
+
var idNameSchema = z10.object({ id: z10.string(), name: z10.string().optional() });
|
|
10937
|
+
var metaTargetingSchema = z10.object({
|
|
10839
10938
|
geo_locations: geoLocationsSchema.optional(),
|
|
10840
10939
|
excluded_geo_locations: geoLocationsSchema.optional(),
|
|
10841
|
-
age_min:
|
|
10842
|
-
age_max:
|
|
10843
|
-
genders:
|
|
10844
|
-
locales:
|
|
10845
|
-
interests:
|
|
10846
|
-
behaviors:
|
|
10847
|
-
custom_audiences:
|
|
10848
|
-
excluded_custom_audiences:
|
|
10849
|
-
flexible_spec:
|
|
10850
|
-
exclusions:
|
|
10851
|
-
publisher_platforms:
|
|
10852
|
-
facebook_positions:
|
|
10853
|
-
instagram_positions:
|
|
10854
|
-
audience_network_positions:
|
|
10855
|
-
messenger_positions:
|
|
10856
|
-
device_platforms:
|
|
10857
|
-
targeting_automation:
|
|
10858
|
-
}).catchall(
|
|
10859
|
-
var specialAdCategoriesSchema =
|
|
10860
|
-
var campaignCreateSchema3 =
|
|
10861
|
-
name:
|
|
10862
|
-
objective:
|
|
10940
|
+
age_min: z10.number().int().min(13).max(65).optional(),
|
|
10941
|
+
age_max: z10.number().int().min(13).max(65).optional(),
|
|
10942
|
+
genders: z10.array(z10.union([z10.literal(1), z10.literal(2)])).optional(),
|
|
10943
|
+
locales: z10.array(z10.number().int()).optional(),
|
|
10944
|
+
interests: z10.array(idNameSchema).optional(),
|
|
10945
|
+
behaviors: z10.array(idNameSchema).optional(),
|
|
10946
|
+
custom_audiences: z10.array(z10.object({ id: parentRefSchema2 })).optional(),
|
|
10947
|
+
excluded_custom_audiences: z10.array(z10.object({ id: parentRefSchema2 })).optional(),
|
|
10948
|
+
flexible_spec: z10.array(z10.record(z10.string(), z10.unknown())).optional(),
|
|
10949
|
+
exclusions: z10.record(z10.string(), z10.unknown()).optional(),
|
|
10950
|
+
publisher_platforms: z10.array(z10.string()).optional(),
|
|
10951
|
+
facebook_positions: z10.array(z10.string()).optional(),
|
|
10952
|
+
instagram_positions: z10.array(z10.string()).optional(),
|
|
10953
|
+
audience_network_positions: z10.array(z10.string()).optional(),
|
|
10954
|
+
messenger_positions: z10.array(z10.string()).optional(),
|
|
10955
|
+
device_platforms: z10.array(z10.string()).optional(),
|
|
10956
|
+
targeting_automation: z10.object({ advantage_audience: z10.union([z10.literal(0), z10.literal(1)]) }).partial().optional()
|
|
10957
|
+
}).catchall(z10.unknown());
|
|
10958
|
+
var specialAdCategoriesSchema = z10.array(z10.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
10959
|
+
var campaignCreateSchema3 = z10.object({
|
|
10960
|
+
name: z10.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
10961
|
+
objective: z10.enum(OBJECTIVES),
|
|
10863
10962
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
10864
10963
|
special_ad_categories: specialAdCategoriesSchema,
|
|
10865
|
-
special_ad_category_country:
|
|
10866
|
-
buying_type:
|
|
10867
|
-
bid_strategy:
|
|
10964
|
+
special_ad_category_country: z10.array(z10.string().length(2)).optional(),
|
|
10965
|
+
buying_type: z10.enum(BUYING_TYPES).default("AUCTION"),
|
|
10966
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
10868
10967
|
/** Campaign Budget Optimization (Advantage campaign budget) — mutually exclusive with ad-set budgets. */
|
|
10869
10968
|
dailyBudget: moneySchema2.optional(),
|
|
10870
10969
|
lifetimeBudget: moneySchema2.optional(),
|
|
10871
10970
|
spendCap: moneySchema2.optional(),
|
|
10872
|
-
start_time:
|
|
10873
|
-
stop_time:
|
|
10971
|
+
start_time: z10.number().int().positive().optional(),
|
|
10972
|
+
stop_time: z10.number().int().positive().optional()
|
|
10874
10973
|
}).superRefine((p, ctx) => {
|
|
10875
10974
|
if (p.dailyBudget && p.lifetimeBudget) {
|
|
10876
10975
|
ctx.addIssue({ code: "custom", path: ["dailyBudget"], message: "set only one of dailyBudget or lifetimeBudget" });
|
|
@@ -10880,15 +10979,15 @@ var campaignCreateSchema3 = z9.object({
|
|
|
10880
10979
|
ctx.addIssue({ code: "custom", path: ["stop_time"], message: "stop_time must be after start_time" });
|
|
10881
10980
|
}
|
|
10882
10981
|
});
|
|
10883
|
-
var campaignUpdateSchema3 =
|
|
10884
|
-
name:
|
|
10982
|
+
var campaignUpdateSchema3 = z10.object({
|
|
10983
|
+
name: z10.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
10885
10984
|
status: updateStatusSchema.optional(),
|
|
10886
|
-
bid_strategy:
|
|
10985
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
10887
10986
|
dailyBudget: moneySchema2.optional(),
|
|
10888
10987
|
lifetimeBudget: moneySchema2.optional(),
|
|
10889
10988
|
spendCap: moneySchema2.optional(),
|
|
10890
|
-
start_time:
|
|
10891
|
-
stop_time:
|
|
10989
|
+
start_time: z10.number().int().positive().optional(),
|
|
10990
|
+
stop_time: z10.number().int().positive().optional()
|
|
10892
10991
|
}).superRefine((p, ctx) => {
|
|
10893
10992
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
10894
10993
|
ctx.addIssue({ code: "custom", message: "update needs at least one field" });
|
|
@@ -10898,38 +10997,38 @@ var campaignUpdateSchema3 = z9.object({
|
|
|
10898
10997
|
}
|
|
10899
10998
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
10900
10999
|
});
|
|
10901
|
-
var promotedObjectSchema =
|
|
11000
|
+
var promotedObjectSchema = z10.object({
|
|
10902
11001
|
page_id: parentRefSchema2.optional(),
|
|
10903
|
-
pixel_id:
|
|
10904
|
-
custom_event_type:
|
|
10905
|
-
application_id:
|
|
10906
|
-
object_store_url:
|
|
10907
|
-
product_catalog_id:
|
|
10908
|
-
product_set_id:
|
|
10909
|
-
whatsapp_phone_number:
|
|
10910
|
-
offline_conversion_data_set_id:
|
|
11002
|
+
pixel_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11003
|
+
custom_event_type: z10.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
11004
|
+
application_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11005
|
+
object_store_url: z10.string().url().optional(),
|
|
11006
|
+
product_catalog_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11007
|
+
product_set_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11008
|
+
whatsapp_phone_number: z10.string().optional(),
|
|
11009
|
+
offline_conversion_data_set_id: z10.string().regex(NUMERIC_ID_REGEX3).optional()
|
|
10911
11010
|
}).partial();
|
|
10912
|
-
var attributionSpecSchema =
|
|
10913
|
-
|
|
10914
|
-
event_type:
|
|
10915
|
-
window_days:
|
|
11011
|
+
var attributionSpecSchema = z10.array(
|
|
11012
|
+
z10.object({
|
|
11013
|
+
event_type: z10.enum(ATTRIBUTION_EVENT_TYPES),
|
|
11014
|
+
window_days: z10.union([z10.literal(1), z10.literal(7), z10.literal(28)])
|
|
10916
11015
|
})
|
|
10917
11016
|
);
|
|
10918
11017
|
var adSetFields = {
|
|
10919
|
-
name:
|
|
11018
|
+
name: z10.string().min(1).max(META_LIMITS.adSet.nameMax),
|
|
10920
11019
|
campaign_id: parentRefSchema2,
|
|
10921
11020
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
10922
11021
|
dailyBudget: moneySchema2.optional(),
|
|
10923
11022
|
lifetimeBudget: moneySchema2.optional(),
|
|
10924
11023
|
bidAmount: moneySchema2.optional(),
|
|
10925
|
-
bid_strategy:
|
|
10926
|
-
billing_event:
|
|
10927
|
-
optimization_goal:
|
|
10928
|
-
destination_type:
|
|
11024
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
11025
|
+
billing_event: z10.enum(BILLING_EVENTS),
|
|
11026
|
+
optimization_goal: z10.enum(OPTIMIZATION_GOALS),
|
|
11027
|
+
destination_type: z10.enum(DESTINATION_TYPES).optional(),
|
|
10929
11028
|
promoted_object: promotedObjectSchema.optional(),
|
|
10930
11029
|
attribution_spec: attributionSpecSchema.optional(),
|
|
10931
|
-
start_time:
|
|
10932
|
-
end_time:
|
|
11030
|
+
start_time: z10.number().int().positive().optional(),
|
|
11031
|
+
end_time: z10.number().int().positive().optional(),
|
|
10933
11032
|
targeting: metaTargetingSchema
|
|
10934
11033
|
};
|
|
10935
11034
|
function validateAdSetBudgetAndBid(p, ctx) {
|
|
@@ -10947,22 +11046,22 @@ function validateAdSetBudgetAndBid(p, ctx) {
|
|
|
10947
11046
|
ctx.addIssue({ code: "custom", path: ["end_time"], message: "end_time must be after start_time" });
|
|
10948
11047
|
}
|
|
10949
11048
|
}
|
|
10950
|
-
var adSetCreateSchema =
|
|
11049
|
+
var adSetCreateSchema = z10.object(adSetFields).superRefine((p, ctx) => {
|
|
10951
11050
|
validateAdSetBudgetAndBid(p, ctx);
|
|
10952
11051
|
});
|
|
10953
|
-
var adSetUpdateSchema =
|
|
11052
|
+
var adSetUpdateSchema = z10.object({
|
|
10954
11053
|
name: adSetFields.name.optional(),
|
|
10955
11054
|
status: updateStatusSchema.optional(),
|
|
10956
11055
|
dailyBudget: moneySchema2.optional(),
|
|
10957
11056
|
lifetimeBudget: moneySchema2.optional(),
|
|
10958
11057
|
bidAmount: moneySchema2.optional(),
|
|
10959
|
-
bid_strategy:
|
|
10960
|
-
optimization_goal:
|
|
10961
|
-
destination_type:
|
|
11058
|
+
bid_strategy: z10.enum(BID_STRATEGIES).optional(),
|
|
11059
|
+
optimization_goal: z10.enum(OPTIMIZATION_GOALS).optional(),
|
|
11060
|
+
destination_type: z10.enum(DESTINATION_TYPES).optional(),
|
|
10962
11061
|
promoted_object: promotedObjectSchema.optional(),
|
|
10963
11062
|
attribution_spec: attributionSpecSchema.optional(),
|
|
10964
|
-
start_time:
|
|
10965
|
-
end_time:
|
|
11063
|
+
start_time: z10.number().int().positive().optional(),
|
|
11064
|
+
end_time: z10.number().int().positive().optional(),
|
|
10966
11065
|
targeting: metaTargetingSchema.optional()
|
|
10967
11066
|
}).superRefine((p, ctx) => {
|
|
10968
11067
|
if (!Object.values(p).some((val) => val !== void 0)) {
|
|
@@ -10970,38 +11069,38 @@ var adSetUpdateSchema = z9.object({
|
|
|
10970
11069
|
}
|
|
10971
11070
|
validateAdSetBudgetAndBid(p, ctx);
|
|
10972
11071
|
});
|
|
10973
|
-
var messageSchema =
|
|
10974
|
-
var headlineSchema2 =
|
|
10975
|
-
var descriptionSchema =
|
|
10976
|
-
var callToActionSchema =
|
|
10977
|
-
type:
|
|
11072
|
+
var messageSchema = z10.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
11073
|
+
var headlineSchema2 = z10.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
11074
|
+
var descriptionSchema = z10.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
11075
|
+
var callToActionSchema = z10.object({
|
|
11076
|
+
type: z10.enum(CTA_TYPES2),
|
|
10978
11077
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
10979
11078
|
link: httpsUrlSchema3.optional()
|
|
10980
11079
|
});
|
|
10981
|
-
var creativeEnhancementsSchema =
|
|
10982
|
-
standardEnhancements:
|
|
10983
|
-
features:
|
|
11080
|
+
var creativeEnhancementsSchema = z10.object({
|
|
11081
|
+
standardEnhancements: z10.enum(ENROLL_STATUSES).optional(),
|
|
11082
|
+
features: z10.record(z10.string(), z10.enum(ENROLL_STATUSES)).optional()
|
|
10984
11083
|
});
|
|
10985
11084
|
var creativeSharedFields = {
|
|
10986
|
-
name:
|
|
11085
|
+
name: z10.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
10987
11086
|
/** Facebook Page id backing the ad's identity. */
|
|
10988
11087
|
page_id: parentRefSchema2,
|
|
10989
11088
|
/** Instagram account id for IG placements (aka instagram_actor_id on read). */
|
|
10990
|
-
instagram_user_id:
|
|
11089
|
+
instagram_user_id: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
10991
11090
|
/** URL tracking parameters appended to the destination, e.g. "utm_source=fb&utm_campaign=x". */
|
|
10992
|
-
url_tags:
|
|
11091
|
+
url_tags: z10.string().max(1e3).optional(),
|
|
10993
11092
|
enhancements: creativeEnhancementsSchema.optional()
|
|
10994
11093
|
};
|
|
10995
11094
|
var imageMediaFields = {
|
|
10996
|
-
imageHash:
|
|
11095
|
+
imageHash: z10.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
10997
11096
|
imageRef: tempRefSchema3.optional()
|
|
10998
11097
|
};
|
|
10999
11098
|
var videoMediaFields = {
|
|
11000
|
-
videoId:
|
|
11099
|
+
videoId: z10.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
11001
11100
|
videoRef: tempRefSchema3.optional(),
|
|
11002
11101
|
/** Thumbnail for a video creative — image hash, ref, or public url. */
|
|
11003
|
-
thumbnailHash:
|
|
11004
|
-
imageUrl:
|
|
11102
|
+
thumbnailHash: z10.string().regex(IMAGE_HASH_REGEX).optional(),
|
|
11103
|
+
imageUrl: z10.string().url().optional()
|
|
11005
11104
|
};
|
|
11006
11105
|
function countImageRefs(p) {
|
|
11007
11106
|
return [p.imageHash, p.imageRef].filter(Boolean).length;
|
|
@@ -11009,8 +11108,8 @@ function countImageRefs(p) {
|
|
|
11009
11108
|
function countVideoRefs(p) {
|
|
11010
11109
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
11011
11110
|
}
|
|
11012
|
-
var singleCreativeSchema =
|
|
11013
|
-
creativeType:
|
|
11111
|
+
var singleCreativeSchema = z10.object({
|
|
11112
|
+
creativeType: z10.literal("single"),
|
|
11014
11113
|
...creativeSharedFields,
|
|
11015
11114
|
/** Primary text. */
|
|
11016
11115
|
message: messageSchema,
|
|
@@ -11019,7 +11118,7 @@ var singleCreativeSchema = z9.object({
|
|
|
11019
11118
|
headline: headlineSchema2.optional(),
|
|
11020
11119
|
description: descriptionSchema.optional(),
|
|
11021
11120
|
/** Display URL / caption shown under the headline. */
|
|
11022
|
-
caption:
|
|
11121
|
+
caption: z10.string().max(255).optional(),
|
|
11023
11122
|
call_to_action: callToActionSchema.optional(),
|
|
11024
11123
|
...imageMediaFields,
|
|
11025
11124
|
...videoMediaFields
|
|
@@ -11043,10 +11142,10 @@ var singleCreativeSchema = z9.object({
|
|
|
11043
11142
|
});
|
|
11044
11143
|
}
|
|
11045
11144
|
});
|
|
11046
|
-
var carouselCardSchema =
|
|
11145
|
+
var carouselCardSchema = z10.object({
|
|
11047
11146
|
link: httpsUrlSchema3,
|
|
11048
|
-
headline:
|
|
11049
|
-
description:
|
|
11147
|
+
headline: z10.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
11148
|
+
description: z10.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
11050
11149
|
call_to_action: callToActionSchema.optional(),
|
|
11051
11150
|
...imageMediaFields,
|
|
11052
11151
|
...videoMediaFields
|
|
@@ -11066,35 +11165,35 @@ var carouselCardSchema = z9.object({
|
|
|
11066
11165
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
11067
11166
|
}
|
|
11068
11167
|
});
|
|
11069
|
-
var carouselCreativeSchema2 =
|
|
11070
|
-
creativeType:
|
|
11168
|
+
var carouselCreativeSchema2 = z10.object({
|
|
11169
|
+
creativeType: z10.literal("carousel"),
|
|
11071
11170
|
...creativeSharedFields,
|
|
11072
11171
|
message: messageSchema,
|
|
11073
11172
|
/** Optional "see more" card destination applied when a card has no own link. */
|
|
11074
11173
|
link: httpsUrlSchema3.optional(),
|
|
11075
11174
|
call_to_action: callToActionSchema.optional(),
|
|
11076
|
-
cards:
|
|
11175
|
+
cards: z10.array(carouselCardSchema).min(META_LIMITS.creative.carouselCardsMin).max(META_LIMITS.creative.carouselCardsMax)
|
|
11077
11176
|
});
|
|
11078
|
-
var dynamicImageSchema =
|
|
11079
|
-
var dynamicVideoSchema =
|
|
11177
|
+
var dynamicImageSchema = z10.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
11178
|
+
var dynamicVideoSchema = z10.object({
|
|
11080
11179
|
videoId: videoMediaFields.videoId,
|
|
11081
11180
|
videoRef: videoMediaFields.videoRef,
|
|
11082
11181
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
11083
11182
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
11084
11183
|
var DYN = META_LIMITS.creative;
|
|
11085
|
-
var dynamicCreativeSchema =
|
|
11086
|
-
creativeType:
|
|
11184
|
+
var dynamicCreativeSchema = z10.object({
|
|
11185
|
+
creativeType: z10.literal("dynamic"),
|
|
11087
11186
|
...creativeSharedFields,
|
|
11088
|
-
bodies:
|
|
11089
|
-
titles:
|
|
11090
|
-
descriptions:
|
|
11091
|
-
images:
|
|
11092
|
-
videos:
|
|
11093
|
-
ad_formats:
|
|
11094
|
-
call_to_action_types:
|
|
11095
|
-
link_urls:
|
|
11187
|
+
bodies: z10.array(z10.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
11188
|
+
titles: z10.array(z10.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
11189
|
+
descriptions: z10.array(z10.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
11190
|
+
images: z10.array(dynamicImageSchema).optional(),
|
|
11191
|
+
videos: z10.array(dynamicVideoSchema).optional(),
|
|
11192
|
+
ad_formats: z10.array(z10.enum(AD_FORMATS2)).min(1),
|
|
11193
|
+
call_to_action_types: z10.array(z10.enum(CTA_TYPES2)).optional(),
|
|
11194
|
+
link_urls: z10.array(z10.object({ website_url: httpsUrlSchema3, display_url: z10.string().optional() })).min(1),
|
|
11096
11195
|
/** Multi-language / placement customization — structural passthrough for v1. */
|
|
11097
|
-
asset_customization_rules:
|
|
11196
|
+
asset_customization_rules: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11098
11197
|
}).superRefine((p, ctx) => {
|
|
11099
11198
|
if (!(p.images?.length || p.videos?.length)) {
|
|
11100
11199
|
ctx.addIssue({
|
|
@@ -11104,57 +11203,57 @@ var dynamicCreativeSchema = z9.object({
|
|
|
11104
11203
|
});
|
|
11105
11204
|
}
|
|
11106
11205
|
});
|
|
11107
|
-
var existingPostCreativeSchema =
|
|
11108
|
-
creativeType:
|
|
11206
|
+
var existingPostCreativeSchema = z10.object({
|
|
11207
|
+
creativeType: z10.literal("existing_post"),
|
|
11109
11208
|
name: creativeSharedFields.name,
|
|
11110
11209
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
11111
|
-
object_story_id:
|
|
11210
|
+
object_story_id: z10.string().regex(/^\d+_\d+$/, 'expected "<page_id>_<post_id>"'),
|
|
11112
11211
|
instagram_user_id: creativeSharedFields.instagram_user_id,
|
|
11113
11212
|
url_tags: creativeSharedFields.url_tags,
|
|
11114
11213
|
enhancements: creativeSharedFields.enhancements
|
|
11115
11214
|
});
|
|
11116
|
-
var creativeContentSchema2 =
|
|
11215
|
+
var creativeContentSchema2 = z10.discriminatedUnion("creativeType", [
|
|
11117
11216
|
singleCreativeSchema,
|
|
11118
11217
|
carouselCreativeSchema2,
|
|
11119
11218
|
dynamicCreativeSchema,
|
|
11120
11219
|
existingPostCreativeSchema
|
|
11121
11220
|
]);
|
|
11122
11221
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
11123
|
-
var adCreativeUpdateSchema =
|
|
11124
|
-
name:
|
|
11222
|
+
var adCreativeUpdateSchema = z10.object({
|
|
11223
|
+
name: z10.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
11125
11224
|
status: updateStatusSchema.optional(),
|
|
11126
11225
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
11127
|
-
content:
|
|
11226
|
+
content: z10.record(z10.string(), z10.unknown()).optional()
|
|
11128
11227
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11129
|
-
var adCreateSchema2 =
|
|
11130
|
-
name:
|
|
11228
|
+
var adCreateSchema2 = z10.object({
|
|
11229
|
+
name: z10.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
11131
11230
|
adset_id: parentRefSchema2,
|
|
11132
11231
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
11133
|
-
creative:
|
|
11232
|
+
creative: z10.object({ creative_id: parentRefSchema2 }),
|
|
11134
11233
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
11135
|
-
tracking_specs:
|
|
11234
|
+
tracking_specs: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11136
11235
|
});
|
|
11137
|
-
var adUpdateSchema2 =
|
|
11138
|
-
name:
|
|
11236
|
+
var adUpdateSchema2 = z10.object({
|
|
11237
|
+
name: z10.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
11139
11238
|
status: updateStatusSchema.optional(),
|
|
11140
11239
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
11141
|
-
creative:
|
|
11142
|
-
tracking_specs:
|
|
11240
|
+
creative: z10.object({ creative_id: parentRefSchema2 }).optional(),
|
|
11241
|
+
tracking_specs: z10.array(z10.record(z10.string(), z10.unknown())).optional()
|
|
11143
11242
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11144
|
-
var lookalikeSpecSchema =
|
|
11145
|
-
origin:
|
|
11146
|
-
ratio:
|
|
11147
|
-
country:
|
|
11148
|
-
});
|
|
11149
|
-
var customAudienceCreateSchema =
|
|
11150
|
-
name:
|
|
11151
|
-
subtype:
|
|
11152
|
-
description:
|
|
11153
|
-
customer_file_source:
|
|
11154
|
-
retention_days:
|
|
11243
|
+
var lookalikeSpecSchema = z10.object({
|
|
11244
|
+
origin: z10.array(z10.object({ id: parentRefSchema2 })).min(1),
|
|
11245
|
+
ratio: z10.number().min(0.01).max(0.2).optional(),
|
|
11246
|
+
country: z10.string().length(2).optional()
|
|
11247
|
+
});
|
|
11248
|
+
var customAudienceCreateSchema = z10.object({
|
|
11249
|
+
name: z10.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
11250
|
+
subtype: z10.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
11251
|
+
description: z10.string().max(500).optional(),
|
|
11252
|
+
customer_file_source: z10.string().optional(),
|
|
11253
|
+
retention_days: z10.number().int().min(1).max(META_LIMITS.audience.retentionDaysMax).optional(),
|
|
11155
11254
|
lookalike_spec: lookalikeSpecSchema.optional(),
|
|
11156
11255
|
/** Website/engagement rule — structural passthrough validated by Meta. */
|
|
11157
|
-
rule:
|
|
11256
|
+
rule: z10.record(z10.string(), z10.unknown()).optional()
|
|
11158
11257
|
}).superRefine((p, ctx) => {
|
|
11159
11258
|
if (p.subtype === "LOOKALIKE" && !p.lookalike_spec) {
|
|
11160
11259
|
ctx.addIssue({ code: "custom", path: ["lookalike_spec"], message: "LOOKALIKE audiences need a lookalike_spec" });
|
|
@@ -11163,16 +11262,16 @@ var customAudienceCreateSchema = z9.object({
|
|
|
11163
11262
|
ctx.addIssue({ code: "custom", path: ["rule"], message: `${p.subtype} audiences need a rule (use --file)` });
|
|
11164
11263
|
}
|
|
11165
11264
|
});
|
|
11166
|
-
var customAudienceUpdateSchema =
|
|
11167
|
-
name:
|
|
11168
|
-
description:
|
|
11265
|
+
var customAudienceUpdateSchema = z10.object({
|
|
11266
|
+
name: z10.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
11267
|
+
description: z10.string().max(500).optional()
|
|
11169
11268
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
11170
|
-
var mediaUploadSchema =
|
|
11171
|
-
kind:
|
|
11269
|
+
var mediaUploadSchema = z10.object({
|
|
11270
|
+
kind: z10.enum(MEDIA_KINDS),
|
|
11172
11271
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
11173
11272
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
11174
11273
|
/** Optional display name / filename hint. */
|
|
11175
|
-
name:
|
|
11274
|
+
name: z10.string().max(255).optional()
|
|
11176
11275
|
}).superRefine((p, ctx) => {
|
|
11177
11276
|
if (p.kind === "image" && !p.bakerImageId) {
|
|
11178
11277
|
ctx.addIssue({ code: "custom", path: ["bakerImageId"], message: "image uploads need a bakerImageId" });
|
|
@@ -11194,16 +11293,16 @@ var META_DRAFT_OP_KINDS = [
|
|
|
11194
11293
|
"customAudience.update",
|
|
11195
11294
|
"media.upload"
|
|
11196
11295
|
];
|
|
11197
|
-
var metaDraftOpKindSchema =
|
|
11198
|
-
var accountIdSchema2 =
|
|
11199
|
-
var updateTargetSchema2 =
|
|
11296
|
+
var metaDraftOpKindSchema = z10.enum(META_DRAFT_OP_KINDS);
|
|
11297
|
+
var accountIdSchema2 = z10.string().regex(NUMERIC_ID_REGEX3, "accountId must be the bare numeric ad account id");
|
|
11298
|
+
var updateTargetSchema2 = z10.union([z10.string().regex(NUMERIC_ID_REGEX3), tempRefSchema3]);
|
|
11200
11299
|
function createOp3(kind, payload) {
|
|
11201
|
-
return
|
|
11300
|
+
return z10.object({ kind: z10.literal(kind), accountId: accountIdSchema2, payload });
|
|
11202
11301
|
}
|
|
11203
11302
|
function updateOp3(kind, payload) {
|
|
11204
|
-
return
|
|
11303
|
+
return z10.object({ kind: z10.literal(kind), accountId: accountIdSchema2, target: updateTargetSchema2, payload });
|
|
11205
11304
|
}
|
|
11206
|
-
var metaDraftOpInputSchema =
|
|
11305
|
+
var metaDraftOpInputSchema = z10.discriminatedUnion("kind", [
|
|
11207
11306
|
createOp3("campaign.create", campaignCreateSchema3),
|
|
11208
11307
|
updateOp3("campaign.update", campaignUpdateSchema3),
|
|
11209
11308
|
createOp3("adSet.create", adSetCreateSchema),
|
|
@@ -11218,89 +11317,89 @@ var metaDraftOpInputSchema = z9.discriminatedUnion("kind", [
|
|
|
11218
11317
|
]);
|
|
11219
11318
|
|
|
11220
11319
|
// ../api/src/ads-meta/wire.ts
|
|
11221
|
-
import { z as
|
|
11222
|
-
var metaWriteModeSchema =
|
|
11223
|
-
var metaDraftOpResultSchema =
|
|
11224
|
-
status:
|
|
11320
|
+
import { z as z11 } from "zod";
|
|
11321
|
+
var metaWriteModeSchema = z11.enum(["live", "simulated"]);
|
|
11322
|
+
var metaDraftOpResultSchema = z11.object({
|
|
11323
|
+
status: z11.enum(["applied", "simulated", "failed", "skipped"]),
|
|
11225
11324
|
/** The resulting Meta node id (campaign/adset/creative/ad/audience) or simulated id. */
|
|
11226
|
-
id:
|
|
11325
|
+
id: z11.string().optional(),
|
|
11227
11326
|
/** For media.upload ops: the resulting image hash. */
|
|
11228
|
-
hash:
|
|
11229
|
-
error:
|
|
11230
|
-
skippedBecause:
|
|
11231
|
-
executedAt:
|
|
11327
|
+
hash: z11.string().optional(),
|
|
11328
|
+
error: z11.string().optional(),
|
|
11329
|
+
skippedBecause: z11.string().optional(),
|
|
11330
|
+
executedAt: z11.number().optional()
|
|
11232
11331
|
});
|
|
11233
|
-
var metaDraftStageRequestSchema =
|
|
11234
|
-
chatId:
|
|
11332
|
+
var metaDraftStageRequestSchema = z11.object({
|
|
11333
|
+
chatId: z11.string(),
|
|
11235
11334
|
op: metaDraftOpInputSchema
|
|
11236
11335
|
});
|
|
11237
|
-
var metaDraftStageResponseSchema =
|
|
11238
|
-
staged:
|
|
11239
|
-
ref:
|
|
11336
|
+
var metaDraftStageResponseSchema = z11.object({
|
|
11337
|
+
staged: z11.literal(true),
|
|
11338
|
+
ref: z11.string(),
|
|
11240
11339
|
kind: metaDraftOpKindSchema,
|
|
11241
11340
|
mode: metaWriteModeSchema,
|
|
11242
|
-
dependsOn:
|
|
11243
|
-
summary:
|
|
11244
|
-
warnings:
|
|
11341
|
+
dependsOn: z11.array(z11.string()),
|
|
11342
|
+
summary: z11.string(),
|
|
11343
|
+
warnings: z11.array(z11.string()),
|
|
11245
11344
|
/** True when the op amended an already-staged op in place instead of appending a new one. */
|
|
11246
|
-
amended:
|
|
11247
|
-
});
|
|
11248
|
-
var metaDraftDuplicateRequestSchema =
|
|
11249
|
-
chatId:
|
|
11250
|
-
accountId:
|
|
11251
|
-
entity:
|
|
11252
|
-
sourceId:
|
|
11253
|
-
overrides:
|
|
11345
|
+
amended: z11.boolean().optional()
|
|
11346
|
+
});
|
|
11347
|
+
var metaDraftDuplicateRequestSchema = z11.object({
|
|
11348
|
+
chatId: z11.string(),
|
|
11349
|
+
accountId: z11.string(),
|
|
11350
|
+
entity: z11.enum(["campaign", "adSet", "ad"]),
|
|
11351
|
+
sourceId: z11.string(),
|
|
11352
|
+
overrides: z11.record(z11.string(), z11.unknown()).optional(),
|
|
11254
11353
|
/** Pause the original after the copy publishes. */
|
|
11255
|
-
replace:
|
|
11354
|
+
replace: z11.boolean().optional()
|
|
11256
11355
|
});
|
|
11257
|
-
var metaDraftOpViewSchema =
|
|
11258
|
-
ref:
|
|
11356
|
+
var metaDraftOpViewSchema = z11.object({
|
|
11357
|
+
ref: z11.string(),
|
|
11259
11358
|
kind: metaDraftOpKindSchema,
|
|
11260
|
-
accountId:
|
|
11261
|
-
target:
|
|
11262
|
-
dependsOn:
|
|
11263
|
-
summary:
|
|
11264
|
-
stagedAt:
|
|
11359
|
+
accountId: z11.string(),
|
|
11360
|
+
target: z11.string().optional(),
|
|
11361
|
+
dependsOn: z11.array(z11.string()),
|
|
11362
|
+
summary: z11.string(),
|
|
11363
|
+
stagedAt: z11.number(),
|
|
11265
11364
|
result: metaDraftOpResultSchema.optional()
|
|
11266
11365
|
});
|
|
11267
|
-
var metaDraftListRequestSchema =
|
|
11268
|
-
chatId:
|
|
11366
|
+
var metaDraftListRequestSchema = z11.object({
|
|
11367
|
+
chatId: z11.string()
|
|
11269
11368
|
});
|
|
11270
|
-
var metaDraftAdvisorySchema =
|
|
11271
|
-
ref:
|
|
11272
|
-
message:
|
|
11369
|
+
var metaDraftAdvisorySchema = z11.object({
|
|
11370
|
+
ref: z11.string(),
|
|
11371
|
+
message: z11.string()
|
|
11273
11372
|
});
|
|
11274
|
-
var metaDraftListResponseSchema =
|
|
11275
|
-
status:
|
|
11373
|
+
var metaDraftListResponseSchema = z11.object({
|
|
11374
|
+
status: z11.enum(["active", "publishing", "applied", "discarded", "none"]),
|
|
11276
11375
|
mode: metaWriteModeSchema,
|
|
11277
|
-
count:
|
|
11278
|
-
ops:
|
|
11376
|
+
count: z11.number(),
|
|
11377
|
+
ops: z11.array(metaDraftOpViewSchema),
|
|
11279
11378
|
/** Non-blocking cross-op quality advisories — "good campaign, not just valid". */
|
|
11280
|
-
advisories:
|
|
11379
|
+
advisories: z11.array(metaDraftAdvisorySchema)
|
|
11281
11380
|
});
|
|
11282
|
-
var metaDraftRemoveRequestSchema =
|
|
11283
|
-
chatId:
|
|
11284
|
-
ref:
|
|
11381
|
+
var metaDraftRemoveRequestSchema = z11.object({
|
|
11382
|
+
chatId: z11.string(),
|
|
11383
|
+
ref: z11.string()
|
|
11285
11384
|
});
|
|
11286
|
-
var metaDraftRemoveResponseSchema =
|
|
11385
|
+
var metaDraftRemoveResponseSchema = z11.object({
|
|
11287
11386
|
/** The requested ref plus any dependents removed by cascade. */
|
|
11288
|
-
removed:
|
|
11387
|
+
removed: z11.array(z11.string())
|
|
11289
11388
|
});
|
|
11290
|
-
var metaDraftClearRequestSchema =
|
|
11291
|
-
chatId:
|
|
11389
|
+
var metaDraftClearRequestSchema = z11.object({
|
|
11390
|
+
chatId: z11.string()
|
|
11292
11391
|
});
|
|
11293
|
-
var metaDraftClearResponseSchema =
|
|
11294
|
-
cleared:
|
|
11392
|
+
var metaDraftClearResponseSchema = z11.object({
|
|
11393
|
+
cleared: z11.number()
|
|
11295
11394
|
});
|
|
11296
|
-
var metaFieldErrorSchema =
|
|
11297
|
-
path:
|
|
11298
|
-
message:
|
|
11395
|
+
var metaFieldErrorSchema = z11.object({
|
|
11396
|
+
path: z11.string(),
|
|
11397
|
+
message: z11.string()
|
|
11299
11398
|
});
|
|
11300
|
-
var metaDraftErrorResponseSchema =
|
|
11301
|
-
code:
|
|
11302
|
-
error:
|
|
11303
|
-
fields:
|
|
11399
|
+
var metaDraftErrorResponseSchema = z11.object({
|
|
11400
|
+
code: z11.string(),
|
|
11401
|
+
error: z11.string(),
|
|
11402
|
+
fields: z11.array(metaFieldErrorSchema).optional()
|
|
11304
11403
|
});
|
|
11305
11404
|
|
|
11306
11405
|
// src/commands/ads/meta/write-shared.ts
|
|
@@ -14577,27 +14676,27 @@ import path6 from "path";
|
|
|
14577
14676
|
import { defineCommand as defineCommand89 } from "citty";
|
|
14578
14677
|
|
|
14579
14678
|
// src/engine/scaffold/staticAd.ts
|
|
14580
|
-
import { z as
|
|
14679
|
+
import { z as z12 } from "zod";
|
|
14581
14680
|
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"]);
|
|
14582
14681
|
var DEFAULT_ASPECT_RATIO = "9:16";
|
|
14583
|
-
var Blueprint =
|
|
14584
|
-
meta:
|
|
14585
|
-
text_content:
|
|
14682
|
+
var Blueprint = z12.object({
|
|
14683
|
+
meta: z12.object({ estimated_aspect_ratio: z12.string().optional() }).loose().optional(),
|
|
14684
|
+
text_content: z12.array(z12.object({ text: z12.string().optional() }).loose()).optional()
|
|
14586
14685
|
}).loose();
|
|
14587
|
-
var ElementLocator =
|
|
14588
|
-
collection:
|
|
14589
|
-
index:
|
|
14686
|
+
var ElementLocator = z12.object({
|
|
14687
|
+
collection: z12.enum(["subjects", "people", "brands_logos"]),
|
|
14688
|
+
index: z12.number().int().nonnegative()
|
|
14590
14689
|
}).loose();
|
|
14591
|
-
var MainElement =
|
|
14690
|
+
var MainElement = z12.object({
|
|
14592
14691
|
// logo | product | person | animal | badge | other
|
|
14593
|
-
type:
|
|
14594
|
-
label:
|
|
14595
|
-
description:
|
|
14596
|
-
expression:
|
|
14597
|
-
reason:
|
|
14692
|
+
type: z12.string(),
|
|
14693
|
+
label: z12.string().optional(),
|
|
14694
|
+
description: z12.string().optional(),
|
|
14695
|
+
expression: z12.string().nullable().optional(),
|
|
14696
|
+
reason: z12.string().optional(),
|
|
14598
14697
|
locator: ElementLocator.optional()
|
|
14599
14698
|
}).loose();
|
|
14600
|
-
var MainElements =
|
|
14699
|
+
var MainElements = z12.array(MainElement);
|
|
14601
14700
|
function sanitizeId(raw, fallback) {
|
|
14602
14701
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
14603
14702
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -15133,7 +15232,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
|
|
|
15133
15232
|
import { toCardinal as nwNl } from "n2words/nl-NL";
|
|
15134
15233
|
import { toCardinal as nwPl } from "n2words/pl-PL";
|
|
15135
15234
|
import { toCardinal as nwPt } from "n2words/pt-PT";
|
|
15136
|
-
import { z as
|
|
15235
|
+
import { z as z13 } from "zod";
|
|
15137
15236
|
|
|
15138
15237
|
// src/engine/scaffold/lib/shoot-modes.ts
|
|
15139
15238
|
var SHOOT_MODES = [
|
|
@@ -15446,71 +15545,71 @@ function trimArgs(durationS, offsetS = 0, dims) {
|
|
|
15446
15545
|
"{{out.video}}"
|
|
15447
15546
|
];
|
|
15448
15547
|
}
|
|
15449
|
-
var FrameAsset =
|
|
15450
|
-
var DialogueLine =
|
|
15451
|
-
speaker:
|
|
15452
|
-
line:
|
|
15548
|
+
var FrameAsset = z13.object({ url: z13.string().optional() }).loose().optional();
|
|
15549
|
+
var DialogueLine = z13.object({
|
|
15550
|
+
speaker: z13.string().optional(),
|
|
15551
|
+
line: z13.string().optional(),
|
|
15453
15552
|
// Absolute seconds on the source timeline (the deconstruct emits both).
|
|
15454
|
-
start_s:
|
|
15455
|
-
end_s:
|
|
15456
|
-
delivery:
|
|
15457
|
-
voice_description:
|
|
15553
|
+
start_s: z13.number().optional(),
|
|
15554
|
+
end_s: z13.number().optional(),
|
|
15555
|
+
delivery: z13.string().optional(),
|
|
15556
|
+
voice_description: z13.string().optional(),
|
|
15458
15557
|
// DECON-supplied: is this speaker's FACE visibly speaking in THIS scene? Element
|
|
15459
15558
|
// presence alone can't answer that — a founder pictured in a polaroid close-up is
|
|
15460
15559
|
// "present" yet the line is voiceover, and treating it as on-camera produced a
|
|
15461
15560
|
// native Seedance lip-sync clip of a still photograph. `false` pins the line to
|
|
15462
15561
|
// the VO path; absent keeps the presence-based decision (old blueprints).
|
|
15463
|
-
on_camera:
|
|
15562
|
+
on_camera: z13.boolean().optional()
|
|
15464
15563
|
}).loose();
|
|
15465
|
-
var Sfx =
|
|
15466
|
-
at_s:
|
|
15467
|
-
duration_s:
|
|
15468
|
-
sound_effect_prompt:
|
|
15469
|
-
description:
|
|
15564
|
+
var Sfx = z13.object({
|
|
15565
|
+
at_s: z13.number().optional(),
|
|
15566
|
+
duration_s: z13.number().optional(),
|
|
15567
|
+
sound_effect_prompt: z13.string().optional(),
|
|
15568
|
+
description: z13.string().optional()
|
|
15470
15569
|
}).loose();
|
|
15471
|
-
var CompositionRegion =
|
|
15570
|
+
var CompositionRegion = z13.object({
|
|
15472
15571
|
// full | top | bottom | left | right | inset
|
|
15473
|
-
panel:
|
|
15572
|
+
panel: z13.string().optional(),
|
|
15474
15573
|
// 9-grid anchor for an `inset` presenter box.
|
|
15475
|
-
position:
|
|
15476
|
-
is_presenter:
|
|
15574
|
+
position: z13.string().optional(),
|
|
15575
|
+
is_presenter: z13.boolean().optional(),
|
|
15477
15576
|
// The cast id shown/speaking in this region (routes lip-sync + element refs).
|
|
15478
|
-
cast_ref:
|
|
15577
|
+
cast_ref: z13.string().optional(),
|
|
15479
15578
|
// What the region's content IS: camera | screen_capture | static_graphic |
|
|
15480
15579
|
// generated. Authoritative for routing when present (regex-over-prose fallback
|
|
15481
15580
|
// otherwise): screen_capture/static_graphic are rebuilt from REAL surfaces on the
|
|
15482
15581
|
// overlay layer, never AI-generated.
|
|
15483
|
-
kind:
|
|
15582
|
+
kind: z13.string().optional(),
|
|
15484
15583
|
// Opaque id naming the SPECIFIC on-screen document/note/app-state this
|
|
15485
15584
|
// screen_capture region shows. Two scenes share it only when they show the SAME
|
|
15486
15585
|
// recording continuing (scrolling/typing/waiting within it) — a genuinely
|
|
15487
15586
|
// DIFFERENT document/note/recording (a source video splicing two screen captures)
|
|
15488
15587
|
// gets a different id. Breaks a persistent-layout run into separate surface stubs
|
|
15489
15588
|
// instead of asking the operator for one screenshot that can't cover both.
|
|
15490
|
-
surface_id:
|
|
15589
|
+
surface_id: z13.string().optional(),
|
|
15491
15590
|
// Camera bubble(s)/inset(s) embedded INSIDE this region's surface (a Loom-style
|
|
15492
15591
|
// presenter bubble inside a screen recording) — video-in-video the reproduction
|
|
15493
15592
|
// must re-composite, not paint into the surface.
|
|
15494
|
-
nested:
|
|
15495
|
-
summary:
|
|
15496
|
-
frame_prompt:
|
|
15497
|
-
motion_prompt:
|
|
15593
|
+
nested: z13.array(z13.object({}).loose()).optional(),
|
|
15594
|
+
summary: z13.string().optional(),
|
|
15595
|
+
frame_prompt: z13.string().optional(),
|
|
15596
|
+
motion_prompt: z13.string().optional()
|
|
15498
15597
|
}).loose();
|
|
15499
|
-
var SceneComposition =
|
|
15598
|
+
var SceneComposition = z13.object({
|
|
15500
15599
|
// full_frame (default) | split_screen | pip | keyed_overlay
|
|
15501
|
-
layout:
|
|
15600
|
+
layout: z13.string().optional(),
|
|
15502
15601
|
// split_screen only: vertical (top/bottom) | horizontal (left/right).
|
|
15503
|
-
split_axis:
|
|
15504
|
-
regions:
|
|
15602
|
+
split_axis: z13.string().optional(),
|
|
15603
|
+
regions: z13.array(CompositionRegion).optional()
|
|
15505
15604
|
}).loose();
|
|
15506
|
-
var CameraMotion =
|
|
15507
|
-
var TranscriptWord =
|
|
15508
|
-
var Scene =
|
|
15509
|
-
start_s:
|
|
15510
|
-
end_s:
|
|
15511
|
-
duration_s:
|
|
15512
|
-
summary:
|
|
15513
|
-
action_detail:
|
|
15605
|
+
var CameraMotion = z13.object({ movement: z13.string().optional(), detail: z13.string().optional() }).loose();
|
|
15606
|
+
var TranscriptWord = z13.object({ text: z13.string().optional() }).loose();
|
|
15607
|
+
var Scene = z13.object({
|
|
15608
|
+
start_s: z13.number().optional(),
|
|
15609
|
+
end_s: z13.number().optional(),
|
|
15610
|
+
duration_s: z13.number().optional(),
|
|
15611
|
+
summary: z13.string().optional(),
|
|
15612
|
+
action_detail: z13.string().optional(),
|
|
15514
15613
|
// The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
|
|
15515
15614
|
// A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
|
|
15516
15615
|
// builds one clip per region and stacks/overlays them into the scene picture.
|
|
@@ -15518,82 +15617,82 @@ var Scene = z12.object({
|
|
|
15518
15617
|
// The capture "look" for this scene — selected from the ad-native shoot-mode
|
|
15519
15618
|
// grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
|
|
15520
15619
|
// UGC/product mode; a human can override per scene by setting this.
|
|
15521
|
-
shoot_mode:
|
|
15620
|
+
shoot_mode: z13.string().optional(),
|
|
15522
15621
|
// Diegetic ambient the clip's native audio should carry (no music). When
|
|
15523
15622
|
// absent the scene falls back to its shoot mode's default ambience.
|
|
15524
|
-
ambient:
|
|
15623
|
+
ambient: z13.string().optional(),
|
|
15525
15624
|
camera_motion: CameraMotion.optional(),
|
|
15526
|
-
start_frame_prompt:
|
|
15527
|
-
end_frame_prompt:
|
|
15528
|
-
motion_prompt:
|
|
15625
|
+
start_frame_prompt: z13.string().optional(),
|
|
15626
|
+
end_frame_prompt: z13.string().optional(),
|
|
15627
|
+
motion_prompt: z13.string().optional(),
|
|
15529
15628
|
// The scene's role in the ad's persuasion arc (DECON-supplied); drives the
|
|
15530
15629
|
// script re-craft checklist. Inferred from position when absent.
|
|
15531
|
-
narrative_role:
|
|
15630
|
+
narrative_role: z13.string().optional(),
|
|
15532
15631
|
// DECON-supplied on the HOOK scene: the engineered physical/emotional state that
|
|
15533
15632
|
// makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
|
|
15534
15633
|
// into the hook's start-frame description so the generator renders that state,
|
|
15535
15634
|
// not a calm influencer (CCA-11).
|
|
15536
|
-
hook_mechanic:
|
|
15635
|
+
hook_mechanic: z13.object({ mechanic: z13.string().optional(), why_it_stops_scroll: z13.string().optional() }).loose().optional(),
|
|
15537
15636
|
// DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
|
|
15538
|
-
scene_setting:
|
|
15637
|
+
scene_setting: z13.string().optional(),
|
|
15539
15638
|
// How this scene cuts to the next (DECON-supplied). A recognized non-cut type
|
|
15540
15639
|
// (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
|
|
15541
15640
|
// boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
|
|
15542
15641
|
// ignored (nothing follows it).
|
|
15543
|
-
transition_out:
|
|
15544
|
-
dialogue:
|
|
15545
|
-
sfx:
|
|
15546
|
-
overlays:
|
|
15547
|
-
floating_elements:
|
|
15642
|
+
transition_out: z13.object({ type: z13.string().optional(), description: z13.string().optional() }).loose().optional(),
|
|
15643
|
+
dialogue: z13.array(DialogueLine).optional(),
|
|
15644
|
+
sfx: z13.array(Sfx).optional(),
|
|
15645
|
+
overlays: z13.array(z13.unknown()).optional(),
|
|
15646
|
+
floating_elements: z13.array(z13.unknown()).optional(),
|
|
15548
15647
|
// DECON-supplied: how much the picture itself moves within the shot. Gates the
|
|
15549
15648
|
// flash-hold optimization — a sub-2s b-roll flash with REAL subject motion
|
|
15550
15649
|
// (pouring, spreading, hands working) must stay a real clip; freezing it turns
|
|
15551
15650
|
// a montage into a slideshow. Absent (old blueprints) keeps the cheap still.
|
|
15552
|
-
motion_level:
|
|
15553
|
-
transcript_slice:
|
|
15651
|
+
motion_level: z13.enum(["static", "subtle", "dynamic"]).optional(),
|
|
15652
|
+
transcript_slice: z13.array(TranscriptWord).optional(),
|
|
15554
15653
|
start_frame_asset: FrameAsset,
|
|
15555
15654
|
end_frame_asset: FrameAsset,
|
|
15556
15655
|
// DECON-supplied: true when this scene is a length-split CONTINUATION of the
|
|
15557
15656
|
// previous one (the SAME physical shot, broken up only because it exceeded the
|
|
15558
15657
|
// clip ceiling). The scaffold then shares the splice keyframe — this scene's
|
|
15559
15658
|
// start frame IS the previous scene's end frame — so the join is seamless.
|
|
15560
|
-
continues_previous:
|
|
15659
|
+
continues_previous: z13.boolean().optional()
|
|
15561
15660
|
}).loose();
|
|
15562
|
-
var VideoBlueprint =
|
|
15563
|
-
source:
|
|
15564
|
-
global:
|
|
15565
|
-
music:
|
|
15566
|
-
present:
|
|
15567
|
-
music_prompt:
|
|
15661
|
+
var VideoBlueprint = z13.object({
|
|
15662
|
+
source: z13.object({ aspect_ratio: z13.string().optional(), duration_s: z13.number().optional() }).loose().optional(),
|
|
15663
|
+
global: z13.object({
|
|
15664
|
+
music: z13.object({
|
|
15665
|
+
present: z13.boolean().optional(),
|
|
15666
|
+
music_prompt: z13.string().optional(),
|
|
15568
15667
|
// Absolute second the music enters in the reference (the bed often
|
|
15569
15668
|
// kicks in mid-ad, after the hook). We start the regenerated track here
|
|
15570
15669
|
// instead of at 0 so the timing matches.
|
|
15571
|
-
starts_at_s:
|
|
15670
|
+
starts_at_s: z13.number().optional(),
|
|
15572
15671
|
// Populated by the deconstruct when AudD (Shazam-style) recognizes the
|
|
15573
15672
|
// reference track. We never reuse it — only style the regenerated bed.
|
|
15574
|
-
identified_track:
|
|
15673
|
+
identified_track: z13.object({ title: z13.string().optional(), artist: z13.string().optional() }).loose().nullish()
|
|
15575
15674
|
}).loose().optional(),
|
|
15576
|
-
cast:
|
|
15577
|
-
|
|
15578
|
-
id:
|
|
15579
|
-
description:
|
|
15675
|
+
cast: z13.array(
|
|
15676
|
+
z13.object({
|
|
15677
|
+
id: z13.string().optional(),
|
|
15678
|
+
description: z13.string().optional(),
|
|
15580
15679
|
// The deconstruct's note on the target-market localization (e.g. "native
|
|
15581
15680
|
// French speaker") — read to derive the spoken-track language code.
|
|
15582
|
-
market_localization_note:
|
|
15681
|
+
market_localization_note: z13.string().optional()
|
|
15583
15682
|
}).loose()
|
|
15584
15683
|
).optional(),
|
|
15585
|
-
voiceover:
|
|
15684
|
+
voiceover: z13.object({
|
|
15586
15685
|
// on_camera | mixed → mouths are on screen (lip-sync candidates);
|
|
15587
15686
|
// voiceover | none → narration over the picture (no lip-sync).
|
|
15588
|
-
mode:
|
|
15589
|
-
voice_description:
|
|
15590
|
-
persona:
|
|
15687
|
+
mode: z13.string().optional(),
|
|
15688
|
+
voice_description: z13.string().optional(),
|
|
15689
|
+
persona: z13.string().optional()
|
|
15591
15690
|
}).loose().optional(),
|
|
15592
15691
|
// Visual palette — read only to colour a clean brand-card/CTA plate (the
|
|
15593
15692
|
// first hex is the dominant brand colour); never to drive frame generation.
|
|
15594
|
-
style:
|
|
15693
|
+
style: z13.object({ palette: z13.array(z13.object({ hex: z13.string().optional() }).loose()).optional() }).loose().optional()
|
|
15595
15694
|
}).loose().optional(),
|
|
15596
|
-
scenes:
|
|
15695
|
+
scenes: z13.array(Scene).min(1)
|
|
15597
15696
|
}).loose();
|
|
15598
15697
|
function injectHookPhysicality(blueprint) {
|
|
15599
15698
|
for (const scene of blueprint.scenes) {
|
|
@@ -15603,26 +15702,26 @@ function injectHookPhysicality(blueprint) {
|
|
|
15603
15702
|
scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
|
|
15604
15703
|
}
|
|
15605
15704
|
}
|
|
15606
|
-
var AppearsItem =
|
|
15607
|
-
var RecurringElement =
|
|
15705
|
+
var AppearsItem = z13.union([z13.number(), z13.object({ scene: z13.number(), edge: z13.string().optional() }).loose()]);
|
|
15706
|
+
var RecurringElement = z13.object({
|
|
15608
15707
|
// person | animal | product | logo | badge | other
|
|
15609
|
-
type:
|
|
15610
|
-
label:
|
|
15611
|
-
description:
|
|
15612
|
-
expression:
|
|
15708
|
+
type: z13.string(),
|
|
15709
|
+
label: z13.string().optional(),
|
|
15710
|
+
description: z13.string().optional(),
|
|
15711
|
+
expression: z13.string().nullable().optional(),
|
|
15613
15712
|
// When the element maps to a global cast entry, its stable id (for annotation).
|
|
15614
|
-
cast_id:
|
|
15713
|
+
cast_id: z13.string().nullable().optional(),
|
|
15615
15714
|
// The label of another element that is the SAME individual as this one, shown
|
|
15616
15715
|
// in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
|
|
15617
15716
|
// pink shirt and believer in a white shirt). Each look gets its own reference
|
|
15618
15717
|
// slot, but the face/identity must stay identical across them.
|
|
15619
|
-
same_as:
|
|
15718
|
+
same_as: z13.string().nullable().optional(),
|
|
15620
15719
|
// Scenes the element appears in. Either a bare list of scene indices (both
|
|
15621
15720
|
// edges) or per-{scene,edge} entries. Both forms are accepted and merged.
|
|
15622
|
-
scenes:
|
|
15623
|
-
appears_in:
|
|
15721
|
+
scenes: z13.array(z13.number()).optional(),
|
|
15722
|
+
appears_in: z13.array(AppearsItem).optional()
|
|
15624
15723
|
}).loose();
|
|
15625
|
-
var RecurringElements =
|
|
15724
|
+
var RecurringElements = z13.array(RecurringElement);
|
|
15626
15725
|
function sanitizeId2(raw, fallback) {
|
|
15627
15726
|
const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
15628
15727
|
return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
|
|
@@ -16040,7 +16139,7 @@ function scrubFloatSentences(text, floatDescs) {
|
|
|
16040
16139
|
return kept;
|
|
16041
16140
|
}
|
|
16042
16141
|
function sceneFloatDescs(scene) {
|
|
16043
|
-
const floats =
|
|
16142
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
16044
16143
|
if (!floats.success) return [];
|
|
16045
16144
|
return floats.data.map((f) => f.description?.trim() ?? "").filter(Boolean);
|
|
16046
16145
|
}
|
|
@@ -17380,25 +17479,25 @@ function buildSfxMusic(blueprint, nodes) {
|
|
|
17380
17479
|
}
|
|
17381
17480
|
return tracks;
|
|
17382
17481
|
}
|
|
17383
|
-
var OverlayStyle =
|
|
17384
|
-
var Overlay =
|
|
17385
|
-
text:
|
|
17386
|
-
appears_at_s:
|
|
17387
|
-
duration_s:
|
|
17388
|
-
position:
|
|
17389
|
-
role:
|
|
17390
|
-
animation:
|
|
17391
|
-
animation_detail:
|
|
17482
|
+
var OverlayStyle = z13.object({ color_hex: z13.string().optional(), background: z13.string().optional(), size: z13.string().optional() }).loose();
|
|
17483
|
+
var Overlay = z13.object({
|
|
17484
|
+
text: z13.string().optional(),
|
|
17485
|
+
appears_at_s: z13.number().optional(),
|
|
17486
|
+
duration_s: z13.number().optional(),
|
|
17487
|
+
position: z13.string().optional(),
|
|
17488
|
+
role: z13.string().optional(),
|
|
17489
|
+
animation: z13.string().optional(),
|
|
17490
|
+
animation_detail: z13.string().optional(),
|
|
17392
17491
|
style: OverlayStyle.optional()
|
|
17393
17492
|
}).loose();
|
|
17394
|
-
var FloatingElement =
|
|
17395
|
-
kind:
|
|
17396
|
-
description:
|
|
17397
|
-
brand_name:
|
|
17398
|
-
what_it_represents:
|
|
17399
|
-
appears_at_s:
|
|
17400
|
-
duration_s:
|
|
17401
|
-
position:
|
|
17493
|
+
var FloatingElement = z13.object({
|
|
17494
|
+
kind: z13.string().optional(),
|
|
17495
|
+
description: z13.string().optional(),
|
|
17496
|
+
brand_name: z13.string().nullish(),
|
|
17497
|
+
what_it_represents: z13.string().optional(),
|
|
17498
|
+
appears_at_s: z13.number().optional(),
|
|
17499
|
+
duration_s: z13.number().optional(),
|
|
17500
|
+
position: z13.string().optional()
|
|
17402
17501
|
}).loose();
|
|
17403
17502
|
function escapeHtml(s) {
|
|
17404
17503
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -17430,7 +17529,7 @@ function positionClass(position) {
|
|
|
17430
17529
|
function collectCaptions(blueprint) {
|
|
17431
17530
|
return blueprint.scenes.flatMap((scene) => {
|
|
17432
17531
|
const sceneStart = scene.start_s ?? 0;
|
|
17433
|
-
const overlays =
|
|
17532
|
+
const overlays = z13.array(Overlay).safeParse(scene.overlays ?? []);
|
|
17434
17533
|
return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
|
|
17435
17534
|
const at = ov.appears_at_s ?? sceneStart;
|
|
17436
17535
|
return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
|
|
@@ -17510,7 +17609,7 @@ function collectFloatWindows(blueprint, uiRouted) {
|
|
|
17510
17609
|
const windows = /* @__PURE__ */ new Map();
|
|
17511
17610
|
blueprint.scenes.forEach((scene, i) => {
|
|
17512
17611
|
const sceneStart = scene.start_s ?? 0;
|
|
17513
|
-
const floats =
|
|
17612
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
17514
17613
|
if (!floats.success) return;
|
|
17515
17614
|
for (const fe of floats.data) {
|
|
17516
17615
|
const at = fe.appears_at_s ?? sceneStart;
|
|
@@ -17896,8 +17995,8 @@ function buildMotionBoard(blueprint) {
|
|
|
17896
17995
|
const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
|
|
17897
17996
|
cursor = end_s;
|
|
17898
17997
|
const spoken = sceneSpokenText(scene);
|
|
17899
|
-
const overlays =
|
|
17900
|
-
const floats =
|
|
17998
|
+
const overlays = z13.array(Overlay).safeParse(scene.overlays ?? []);
|
|
17999
|
+
const floats = z13.array(FloatingElement).safeParse(scene.floating_elements ?? []);
|
|
17901
18000
|
const graphics = [
|
|
17902
18001
|
...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
|
|
17903
18002
|
kind: "text",
|
|
@@ -23813,11 +23912,121 @@ var schemaCommand = defineCommand147({
|
|
|
23813
23912
|
}
|
|
23814
23913
|
});
|
|
23815
23914
|
|
|
23915
|
+
// src/commands/tags/index.ts
|
|
23916
|
+
import { defineCommand as defineCommand148 } from "citty";
|
|
23917
|
+
|
|
23918
|
+
// src/commands/tags/shared.ts
|
|
23919
|
+
function failApi3(err) {
|
|
23920
|
+
if (err instanceof ApiError) {
|
|
23921
|
+
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
23922
|
+
process.exit(1);
|
|
23923
|
+
}
|
|
23924
|
+
if (err instanceof Error) {
|
|
23925
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: err.message } });
|
|
23926
|
+
process.exit(1);
|
|
23927
|
+
}
|
|
23928
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
23929
|
+
process.exit(1);
|
|
23930
|
+
}
|
|
23931
|
+
function renderEffectiveEntry(entry) {
|
|
23932
|
+
const parts = [entry.ref, entry.type];
|
|
23933
|
+
if (entry.identifier !== void 0) {
|
|
23934
|
+
parts.push(entry.identifier);
|
|
23935
|
+
}
|
|
23936
|
+
if (entry.staged !== void 0) {
|
|
23937
|
+
parts.push(`[staged: ${entry.staged}]`);
|
|
23938
|
+
}
|
|
23939
|
+
const secretBits = [
|
|
23940
|
+
...entry.secretsSet.map((field) => `${field} \u2713 set`),
|
|
23941
|
+
...entry.secretsPending.map((field) => `${field} \u23F3 pending`)
|
|
23942
|
+
];
|
|
23943
|
+
if (secretBits.length > 0) {
|
|
23944
|
+
parts.push(`[secrets: ${secretBits.join(", ")}]`);
|
|
23945
|
+
}
|
|
23946
|
+
return parts.join(" ");
|
|
23947
|
+
}
|
|
23948
|
+
|
|
23949
|
+
// src/commands/tags/index.ts
|
|
23950
|
+
registerSchema({
|
|
23951
|
+
command: "tags.list",
|
|
23952
|
+
description: "Effective marketing tags for this chat: production tags overlaid with the changes staged in this chat. The printed refs (tag ids or tag_temp_*) are exactly what flow side-effect tagIds should reference. Read-only \u2014 every tag change (create, edit, delete) goes through the request_tag_input approval tool.",
|
|
23953
|
+
args: {
|
|
23954
|
+
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false }
|
|
23955
|
+
}
|
|
23956
|
+
});
|
|
23957
|
+
async function listTags(json) {
|
|
23958
|
+
try {
|
|
23959
|
+
const chatId = requireChatId();
|
|
23960
|
+
const response = await apiPost("/api/tags/list", { chatId });
|
|
23961
|
+
if (json) {
|
|
23962
|
+
writeJson({ ok: true, data: response });
|
|
23963
|
+
return;
|
|
23964
|
+
}
|
|
23965
|
+
if (response.tags.length === 0) {
|
|
23966
|
+
process.stdout.write("No tags configured. Propose one with the request_tag_input tool (baker_ui).\n");
|
|
23967
|
+
return;
|
|
23968
|
+
}
|
|
23969
|
+
process.stdout.write(`${response.tags.map(renderEffectiveEntry).join("\n")}
|
|
23970
|
+
`);
|
|
23971
|
+
} catch (err) {
|
|
23972
|
+
failApi3(err);
|
|
23973
|
+
}
|
|
23974
|
+
}
|
|
23975
|
+
var listCommand7 = defineCommand148({
|
|
23976
|
+
meta: {
|
|
23977
|
+
name: "list",
|
|
23978
|
+
description: "Effective tags for this chat (production + staged). Refs printed here are what flow side-effect tagIds should use. Example: baker tags list"
|
|
23979
|
+
},
|
|
23980
|
+
args: { json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" } },
|
|
23981
|
+
run: async ({ args }) => {
|
|
23982
|
+
await listTags(args.json === true);
|
|
23983
|
+
}
|
|
23984
|
+
});
|
|
23985
|
+
async function listDraft3() {
|
|
23986
|
+
try {
|
|
23987
|
+
const chatId = requireChatId();
|
|
23988
|
+
const response = await apiPost("/api/tags/draft", { chatId });
|
|
23989
|
+
writeJson({ ok: true, data: response });
|
|
23990
|
+
} catch (err) {
|
|
23991
|
+
failApi3(err);
|
|
23992
|
+
}
|
|
23993
|
+
}
|
|
23994
|
+
var draftCommand3 = defineCommand148({
|
|
23995
|
+
meta: {
|
|
23996
|
+
name: "draft",
|
|
23997
|
+
description: "Review the tag changes staged in this chat (read-only). Staged changes were approved via request_tag_input and apply when the chat is published; to amend or drop one, propose a follow-up change through the same tool (a delete on a tag_temp_* ref drops the staged create)."
|
|
23998
|
+
},
|
|
23999
|
+
run: async () => {
|
|
24000
|
+
await listDraft3();
|
|
24001
|
+
}
|
|
24002
|
+
});
|
|
24003
|
+
var tagsCommand3 = defineCommand148({
|
|
24004
|
+
meta: {
|
|
24005
|
+
name: "tags",
|
|
24006
|
+
description: `Read the client's marketing/analytics tags (Meta pixel, GA4, Google Ads, GTM, Clarity, Hotjar, \u2026) \u2014 production tags plus the changes staged in this chat.
|
|
24007
|
+
|
|
24008
|
+
This command is READ-ONLY. Every tag change \u2014 create, edit, or delete \u2014 goes through the request_tag_input tool (baker_ui MCP server): propose one or more changes (each becomes a tab in one approval form), pre-fill the non-secret fields you know, and the user reviews, fills secrets, and approves or skips each. Secret values (accessToken, apiSecret, authorizationToken, apiKey, conversionToken, OAuth connections) never pass through the CLI or the chat.
|
|
24009
|
+
|
|
24010
|
+
Refs: \`baker tags list\` prints each tag's ref \u2014 a real tag id, or tag_temp_* for creates staged in this chat. Use these refs as flow side-effect tagIds; they keep resolving after publish.
|
|
24011
|
+
|
|
24012
|
+
Examples:
|
|
24013
|
+
baker tags list # production + staged, with secret status
|
|
24014
|
+
baker tags draft # review the staged changes awaiting publish`
|
|
24015
|
+
},
|
|
24016
|
+
subCommands: {
|
|
24017
|
+
list: listCommand7,
|
|
24018
|
+
draft: draftCommand3
|
|
24019
|
+
},
|
|
24020
|
+
run: async () => {
|
|
24021
|
+
await listTags(false);
|
|
24022
|
+
}
|
|
24023
|
+
});
|
|
24024
|
+
|
|
23816
24025
|
// src/commands/testimonials/index.ts
|
|
23817
|
-
import { defineCommand as
|
|
24026
|
+
import { defineCommand as defineCommand152 } from "citty";
|
|
23818
24027
|
|
|
23819
24028
|
// src/commands/testimonials/get.ts
|
|
23820
|
-
import { defineCommand as
|
|
24029
|
+
import { defineCommand as defineCommand149 } from "citty";
|
|
23821
24030
|
registerSchema({
|
|
23822
24031
|
command: "testimonials.get",
|
|
23823
24032
|
description: "Get a single testimonial by ID",
|
|
@@ -23825,7 +24034,7 @@ registerSchema({
|
|
|
23825
24034
|
id: { type: "string", description: "Testimonial ID", required: true }
|
|
23826
24035
|
}
|
|
23827
24036
|
});
|
|
23828
|
-
var getCommand4 =
|
|
24037
|
+
var getCommand4 = defineCommand149({
|
|
23829
24038
|
meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
|
|
23830
24039
|
args: {
|
|
23831
24040
|
id: { type: "positional", description: "Testimonial ID", required: false },
|
|
@@ -23862,7 +24071,7 @@ var getCommand4 = defineCommand148({
|
|
|
23862
24071
|
});
|
|
23863
24072
|
|
|
23864
24073
|
// src/commands/testimonials/list.ts
|
|
23865
|
-
import { defineCommand as
|
|
24074
|
+
import { defineCommand as defineCommand150 } from "citty";
|
|
23866
24075
|
registerSchema({
|
|
23867
24076
|
command: "testimonials.list",
|
|
23868
24077
|
description: "List testimonials with optional filters.",
|
|
@@ -23892,7 +24101,7 @@ registerSchema({
|
|
|
23892
24101
|
limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
|
|
23893
24102
|
}
|
|
23894
24103
|
});
|
|
23895
|
-
var
|
|
24104
|
+
var listCommand8 = defineCommand150({
|
|
23896
24105
|
meta: {
|
|
23897
24106
|
name: "list",
|
|
23898
24107
|
description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
|
|
@@ -23941,7 +24150,7 @@ var listCommand7 = defineCommand149({
|
|
|
23941
24150
|
});
|
|
23942
24151
|
|
|
23943
24152
|
// src/commands/testimonials/search.ts
|
|
23944
|
-
import { defineCommand as
|
|
24153
|
+
import { defineCommand as defineCommand151 } from "citty";
|
|
23945
24154
|
registerSchema({
|
|
23946
24155
|
command: "testimonials.search",
|
|
23947
24156
|
description: "Search testimonials by text query. Uses hybrid BM25 + vector + reranking.",
|
|
@@ -23972,7 +24181,7 @@ registerSchema({
|
|
|
23972
24181
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
23973
24182
|
}
|
|
23974
24183
|
});
|
|
23975
|
-
var searchCommand2 =
|
|
24184
|
+
var searchCommand2 = defineCommand151({
|
|
23976
24185
|
meta: {
|
|
23977
24186
|
name: "search",
|
|
23978
24187
|
description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
|
|
@@ -24043,10 +24252,10 @@ var searchCommand2 = defineCommand150({
|
|
|
24043
24252
|
});
|
|
24044
24253
|
|
|
24045
24254
|
// src/commands/testimonials/tags.ts
|
|
24046
|
-
var
|
|
24255
|
+
var tagsCommand4 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
|
|
24047
24256
|
|
|
24048
24257
|
// src/commands/testimonials/index.ts
|
|
24049
|
-
var testimonialsCommand =
|
|
24258
|
+
var testimonialsCommand = defineCommand152({
|
|
24050
24259
|
meta: {
|
|
24051
24260
|
name: "testimonials",
|
|
24052
24261
|
description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
|
|
@@ -24061,16 +24270,16 @@ Examples:
|
|
|
24061
24270
|
subCommands: {
|
|
24062
24271
|
get: getCommand4,
|
|
24063
24272
|
search: searchCommand2,
|
|
24064
|
-
list:
|
|
24065
|
-
tags:
|
|
24273
|
+
list: listCommand8,
|
|
24274
|
+
tags: tagsCommand4
|
|
24066
24275
|
}
|
|
24067
24276
|
});
|
|
24068
24277
|
|
|
24069
24278
|
// src/commands/videos/index.ts
|
|
24070
|
-
import { defineCommand as
|
|
24279
|
+
import { defineCommand as defineCommand157 } from "citty";
|
|
24071
24280
|
|
|
24072
24281
|
// src/commands/videos/delete.ts
|
|
24073
|
-
import { defineCommand as
|
|
24282
|
+
import { defineCommand as defineCommand153 } from "citty";
|
|
24074
24283
|
registerSchema({
|
|
24075
24284
|
command: "videos.delete",
|
|
24076
24285
|
description: "Delete a video by ID",
|
|
@@ -24084,7 +24293,7 @@ registerSchema({
|
|
|
24084
24293
|
}
|
|
24085
24294
|
}
|
|
24086
24295
|
});
|
|
24087
|
-
var deleteCommand3 =
|
|
24296
|
+
var deleteCommand3 = defineCommand153({
|
|
24088
24297
|
meta: {
|
|
24089
24298
|
name: "delete",
|
|
24090
24299
|
description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
|
|
@@ -24125,7 +24334,7 @@ var deleteCommand3 = defineCommand152({
|
|
|
24125
24334
|
});
|
|
24126
24335
|
|
|
24127
24336
|
// src/commands/videos/get.ts
|
|
24128
|
-
import { defineCommand as
|
|
24337
|
+
import { defineCommand as defineCommand154 } from "citty";
|
|
24129
24338
|
registerSchema({
|
|
24130
24339
|
command: "videos.get",
|
|
24131
24340
|
description: "Get a single video by ID",
|
|
@@ -24133,7 +24342,7 @@ registerSchema({
|
|
|
24133
24342
|
id: { type: "string", description: "Video ID", required: true }
|
|
24134
24343
|
}
|
|
24135
24344
|
});
|
|
24136
|
-
var getCommand5 =
|
|
24345
|
+
var getCommand5 = defineCommand154({
|
|
24137
24346
|
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
24138
24347
|
args: {
|
|
24139
24348
|
id: { type: "positional", description: "Video ID", required: false },
|
|
@@ -24170,7 +24379,7 @@ var getCommand5 = defineCommand153({
|
|
|
24170
24379
|
});
|
|
24171
24380
|
|
|
24172
24381
|
// src/commands/videos/search.ts
|
|
24173
|
-
import { defineCommand as
|
|
24382
|
+
import { defineCommand as defineCommand155 } from "citty";
|
|
24174
24383
|
registerSchema({
|
|
24175
24384
|
command: "videos.search",
|
|
24176
24385
|
description: "Search videos by text query. Only returns ready videos.",
|
|
@@ -24180,7 +24389,7 @@ registerSchema({
|
|
|
24180
24389
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
24181
24390
|
}
|
|
24182
24391
|
});
|
|
24183
|
-
var searchCommand3 =
|
|
24392
|
+
var searchCommand3 = defineCommand155({
|
|
24184
24393
|
meta: {
|
|
24185
24394
|
name: "search",
|
|
24186
24395
|
description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
|
|
@@ -24227,12 +24436,12 @@ var searchCommand3 = defineCommand154({
|
|
|
24227
24436
|
});
|
|
24228
24437
|
|
|
24229
24438
|
// src/commands/videos/tags.ts
|
|
24230
|
-
var
|
|
24439
|
+
var tagsCommand5 = makeTagsCommand("videos", "video", "/api/videos/tags");
|
|
24231
24440
|
|
|
24232
24441
|
// src/commands/videos/upload.ts
|
|
24233
24442
|
import { readFile as readFile12, stat as stat3 } from "fs/promises";
|
|
24234
24443
|
import { extname as extname3 } from "path";
|
|
24235
|
-
import { defineCommand as
|
|
24444
|
+
import { defineCommand as defineCommand156 } from "citty";
|
|
24236
24445
|
var MIME_MAP = {
|
|
24237
24446
|
".mp4": "video/mp4",
|
|
24238
24447
|
".mov": "video/quicktime",
|
|
@@ -24266,7 +24475,7 @@ function detectContentType(filePath) {
|
|
|
24266
24475
|
}
|
|
24267
24476
|
return mime;
|
|
24268
24477
|
}
|
|
24269
|
-
var uploadCommand2 =
|
|
24478
|
+
var uploadCommand2 = defineCommand156({
|
|
24270
24479
|
meta: {
|
|
24271
24480
|
name: "upload",
|
|
24272
24481
|
description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
|
|
@@ -24320,7 +24529,7 @@ var uploadCommand2 = defineCommand155({
|
|
|
24320
24529
|
});
|
|
24321
24530
|
|
|
24322
24531
|
// src/commands/videos/index.ts
|
|
24323
|
-
var videosCommand =
|
|
24532
|
+
var videosCommand = defineCommand157({
|
|
24324
24533
|
meta: {
|
|
24325
24534
|
name: "videos",
|
|
24326
24535
|
description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
|
|
@@ -24338,15 +24547,15 @@ Examples:
|
|
|
24338
24547
|
search: searchCommand3,
|
|
24339
24548
|
upload: uploadCommand2,
|
|
24340
24549
|
delete: deleteCommand3,
|
|
24341
|
-
tags:
|
|
24550
|
+
tags: tagsCommand5
|
|
24342
24551
|
}
|
|
24343
24552
|
});
|
|
24344
24553
|
|
|
24345
24554
|
// src/commands/winning-ads/index.ts
|
|
24346
|
-
import { defineCommand as
|
|
24555
|
+
import { defineCommand as defineCommand160 } from "citty";
|
|
24347
24556
|
|
|
24348
24557
|
// src/commands/winning-ads/advertisers.ts
|
|
24349
|
-
import { defineCommand as
|
|
24558
|
+
import { defineCommand as defineCommand158 } from "citty";
|
|
24350
24559
|
registerSchema({
|
|
24351
24560
|
command: "winning-ads.advertisers",
|
|
24352
24561
|
description: "Resolve a brand name to advertiser_id(s) in the ad-dna corpus \u2014 to find your OWN advertiser (to --exclude-advertiser) or a competitor (to --advertiser-id).",
|
|
@@ -24359,7 +24568,7 @@ registerSchema({
|
|
|
24359
24568
|
function identity(record) {
|
|
24360
24569
|
return record;
|
|
24361
24570
|
}
|
|
24362
|
-
var advertisersCommand2 =
|
|
24571
|
+
var advertisersCommand2 = defineCommand158({
|
|
24363
24572
|
meta: {
|
|
24364
24573
|
name: "advertisers",
|
|
24365
24574
|
description: 'Resolve a brand name to advertiser_id(s). Use it to find your own advertiser for --exclude-advertiser, or a competitor for --advertiser-id. Example: baker winning-ads advertisers "Deel" --output md'
|
|
@@ -24410,7 +24619,7 @@ var advertisersCommand2 = defineCommand157({
|
|
|
24410
24619
|
});
|
|
24411
24620
|
|
|
24412
24621
|
// src/commands/winning-ads/search.ts
|
|
24413
|
-
import { defineCommand as
|
|
24622
|
+
import { defineCommand as defineCommand159 } from "citty";
|
|
24414
24623
|
registerSchema({
|
|
24415
24624
|
command: "winning-ads.search",
|
|
24416
24625
|
description: "Search the ad-dna corpus of scored winning ads. Returns a lean shortlist (advertiser, summary, scores, media_url) to pick a reference to reproduce.",
|
|
@@ -24518,7 +24727,7 @@ function buildSearchBody(args) {
|
|
|
24518
24727
|
}
|
|
24519
24728
|
return body;
|
|
24520
24729
|
}
|
|
24521
|
-
var searchCommand4 =
|
|
24730
|
+
var searchCommand4 = defineCommand159({
|
|
24522
24731
|
meta: {
|
|
24523
24732
|
name: "search",
|
|
24524
24733
|
description: "Search winning reference ads. Example: baker winning-ads search 'B2B SaaS before/after AI automation' --platform meta --format static --winner-category winner --exclude-advertiser adv_123 --output md"
|
|
@@ -24630,7 +24839,7 @@ var searchCommand4 = defineCommand158({
|
|
|
24630
24839
|
});
|
|
24631
24840
|
|
|
24632
24841
|
// src/commands/winning-ads/index.ts
|
|
24633
|
-
var winningAdsCommand =
|
|
24842
|
+
var winningAdsCommand = defineCommand160({
|
|
24634
24843
|
meta: {
|
|
24635
24844
|
name: "winning-ads",
|
|
24636
24845
|
description: `Search the ad-dna corpus of scored "winning" ads for reference creatives to reproduce. Proxied through the Baker backend (BAKER_API_KEY) \u2014 no separate token needed.
|
|
@@ -24670,11 +24879,11 @@ function getCliVersion() {
|
|
|
24670
24879
|
}
|
|
24671
24880
|
|
|
24672
24881
|
// src/cli.ts
|
|
24673
|
-
var main =
|
|
24882
|
+
var main = defineCommand161({
|
|
24674
24883
|
meta: {
|
|
24675
24884
|
name: "baker",
|
|
24676
24885
|
version: getCliVersion(),
|
|
24677
|
-
description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, and ad platform data in Baker.
|
|
24886
|
+
description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, marketing tags, and ad platform data in Baker.
|
|
24678
24887
|
|
|
24679
24888
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
24680
24889
|
Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
|
|
@@ -24694,6 +24903,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
24694
24903
|
videos: videosCommand,
|
|
24695
24904
|
testimonials: testimonialsCommand,
|
|
24696
24905
|
canvas: canvasCommand,
|
|
24906
|
+
tags: tagsCommand3,
|
|
24697
24907
|
"winning-ads": winningAdsCommand,
|
|
24698
24908
|
mcp: mcpCommand,
|
|
24699
24909
|
schema: schemaCommand
|