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